Ticket #649: 649-jTpl-text-plugins-formdatafull.diff

File 649-jTpl-text-plugins-formdatafull.diff, 1.7 kB (added by Julien, 4 months ago)
  • build/manifests/jelix-lib.mn

    old new  
    465465cd lib/jelix/plugins/tpl/text 
    466466  function.jlocale.php 
    467467  function.jurl.php 
     468  function.formdatafull.php 
    468469 
    469470cd lib/jelix/plugins/tpl/xml 
    470471  function.jlocale.php 
  • lib/jelix/plugins/tpl/text/function.formdatafull.php

    old new  
     1<?php 
     2/** 
     3* @package      jelix 
     4* @subpackage   jtpl_plugin 
     5* @author       Julien Issler 
     6* @contributor 
     7* @copyright    2008 Julien Issler 
     8* @link         http://www.jelix.org 
     9* @licence      GNU Lesser General Public Licence see LICENCE file or http://www.gnu.org/licenses/lgpl.html 
     10*/ 
     11 
     12/** 
     13 * Display all data of a form without the use of other plugins. 
     14 * 
     15 * @param jTpl $tpl template engine 
     16 * @param jFormsBase $form the form to display 
     17 */ 
     18function jtpl_function_text_formdatafull($tpl, $form){ 
     19 
     20    foreach($form->getControls() as $ctrlref=>$ctrl){ 
     21        if($ctrl->type == 'submit' || $ctrl->type == 'reset' || $ctrl->type == 'hidden' || $ctrl->type == 'captcha') continue; 
     22        if(!$form->isActivated($ctrlref)) continue; 
     23 
     24        echo $ctrl->label,' : '; 
     25 
     26        $value = $ctrl->getDisplayValue($form->getData($ctrlref)); 
     27        if(is_array($value)) 
     28            echo join(',',$value); 
     29        else if($ctrl->datatype instanceof jDatatypeHtml) 
     30            echo strip_tags($value); 
     31        else 
     32            echo $value; 
     33 
     34        echo "\n\n"; 
     35    } 
     36 
     37} 
Download in other formats: Original Format