Source for file jFormsBuilderHtml.class.php

Documentation is available at jFormsBuilderHtml.class.php

  1. <?php
  2. /**
  3. @package     jelix
  4. @subpackage  forms
  5. @author      Laurent Jouanneau
  6. @contributor Julien Issler, Dominique Papin
  7. @copyright   2006-2011 Laurent Jouanneau
  8. @copyright   2008-2011 Julien Issler, 2008 Dominique Papin
  9. @link        http://www.jelix.org
  10. @licence     http://www.gnu.org/licenses/lgpl.html GNU Lesser General Public Licence, see LICENCE file
  11. */
  12.  
  13. /**
  14.  * HTML form builder
  15.  * @package     jelix
  16.  * @subpackage  jelix-plugins
  17.  */
  18. class jFormsBuilderHtml extends jFormsBuilderBase {
  19.  
  20.     protected $jFormsJsVarName = 'jForms';
  21.  
  22.     protected $options;
  23.  
  24.     protected $isRootControl = true;
  25.  
  26.     public function outputAllControls({
  27.  
  28.         echo '<table class="jforms-table" border="0">';
  29.         foreach$this->_form->getRootControls(as $ctrlref=>$ctrl){
  30.             if($ctrl->type == 'submit' || $ctrl->type == 'reset' || $ctrl->type == 'hidden'continue;
  31.             if(!$this->_form->isActivated($ctrlref)) continue;
  32.             if($ctrl->type == 'group'{
  33.                 echo '<tr><td colspan="2">';
  34.                 $this->outputControl($ctrl);
  35.                 echo '</td></tr>';
  36.             }else{
  37.                 echo '<tr><th scope="row">';
  38.                 $this->outputControlLabel($ctrl);
  39.                 echo '</th><td>';
  40.                 $this->outputControl($ctrl);
  41.                 echo "</td></tr>\n";
  42.             }
  43.         }
  44.         echo '</table> <div class="jforms-submit-buttons">';
  45.         if $ctrl $this->_form->getReset() ) {
  46.             if(!$this->_form->isActivated($ctrl->ref)) continue;
  47.             $this->outputControl($ctrl);
  48.             echo ' ';
  49.         }
  50.         foreach$this->_form->getSubmits(as $ctrlref=>$ctrl){
  51.             if(!$this->_form->isActivated($ctrlref)) continue;
  52.             $this->outputControl($ctrl);
  53.             echo ' ';
  54.         }
  55.         echo "</div>\n";
  56.     }
  57.  
  58.     public function outputMetaContent($t{
  59.         global $gJCoord$gJConfig;
  60.         $resp$gJCoord->response;
  61.         if($resp === null || $resp->getType(!='html'){
  62.             return;
  63.         }
  64.         $www =$gJConfig->urlengine['jelixWWWPath'];
  65.         $bp =$gJConfig->urlengine['basePath'];
  66.         $resp->addJSLink($www.'js/jforms_light.js');
  67.         $resp->addCSSLink($www.'design/jform.css');
  68.         foreach($t->_vars as $k=>$v){
  69.             if($v instanceof jFormsBase && count($edlist $v->getHtmlEditors())) {
  70.                 foreach($edlist as $ed{
  71.                     if(isset($gJConfig->htmleditors[$ed->config.'.engine.file'])){
  72.                         if(is_array($gJConfig->htmleditors[$ed->config.'.engine.file'])){
  73.                             foreach($gJConfig->htmleditors[$ed->config.'.engine.file'as $url{
  74.                                 $resp->addJSLink($bp.$url);
  75.                             }
  76.                         }else
  77.                             $resp->addJSLink($bp.$gJConfig->htmleditors[$ed->config.'.engine.file']);
  78.                     }
  79.                     if(isset($gJConfig->htmleditors[$ed->config.'.config']))
  80.                         $resp->addJSLink($bp.$gJConfig->htmleditors[$ed->config.'.config']);
  81.                     $skin $ed->config.'.skin.'.$ed->skin;
  82.                     if(isset($gJConfig->htmleditors[$skin]&& $gJConfig->htmleditors[$skin!= '')
  83.                         $resp->addCSSLink($bp.$gJConfig->htmleditors[$skin]);
  84.                 }
  85.             }
  86.         }
  87.     }
  88.  
  89.     protected function outputHeaderScript(){
  90.                 echo '<script type="text/javascript">
  91. //<![CDATA[
  92. '.$this->jFormsJsVarName.'.tForm = new jFormsForm(\''.$this->_name.'\');
  93. '.$this->jFormsJsVarName.'.tForm.setErrorDecorator(new '.$this->options['errorDecorator'].'());
  94. '.$this->jFormsJsVarName.'.declareForm(jForms.tForm);
  95. //]]>
  96. </script>';
  97.     }
  98.  
  99.     /**
  100.      * output the header content of the form
  101.      * @param array $params some parameters <ul>
  102.      *       <li>"errDecorator"=>"name of your javascript object for error listener"</li>
  103.      *       <li>"method" => "post" or "get". default is "post"</li>
  104.      *       </ul>
  105.      */
  106.     public function outputHeader($params){
  107.         $this->options = array_merge(array('errorDecorator'=>$this->jFormsJsVarName.'ErrorDecoratorHtml',
  108.             'method'=>'post')$params);
  109.  
  110.         if (preg_match('#^https?://#',$this->_action)) {
  111.             $urlParams $this->_actionParams;
  112.             echo '<form action="',$this->_action,'" method="'.$this->options['method'].'" id="'$this->_name,'"';
  113.         else {
  114.             $url jUrl::get($this->_action$this->_actionParams2)// retourne le jurl correspondant
  115.             $urlParams $url->params;
  116.             echo '<form action="',$url->getPath(),'" method="'.$this->options['method'].'" id="'$this->_name,'"';
  117.         }
  118.         if($this->_form->hasUpload())
  119.             echo ' enctype="multipart/form-data">';
  120.         else
  121.             echo '>';
  122.  
  123.         $this->outputHeaderScript();
  124.  
  125.         $hiddens '';
  126.         foreach ($urlParams as $p_name => $p_value{
  127.             $hiddens .= '<input type="hidden" name="'$p_name .'" value="'htmlspecialchars($p_value)'"'.$this->_endt"\n";
  128.         }
  129.  
  130.         foreach ($this->_form->getHiddens(as $ctrl{
  131.             if(!$this->_form->isActivated($ctrl->ref)) continue;
  132.             $hiddens .= '<input type="hidden" name="'$ctrl->ref.'" id="'.$this->_name.'_'.$ctrl->ref.'" value="'htmlspecialchars($this->_form->getData($ctrl->ref))'"'.$this->_endt"\n";
  133.         }
  134.  
  135.         if($this->_form->securityLevel){
  136.             $tok $this->_form->createNewToken();
  137.             $hiddens .= '<input type="hidden" name="__JFORMS_TOKEN__" value="'.$tok.'"'.$this->_endt"\n";
  138.         }
  139.  
  140.         if($hiddens){
  141.             echo '<div class="jforms-hiddens">',$hiddens,'</div>';
  142.         }
  143.  
  144.         $errors $this->_form->getContainer()->errors;
  145.         if(count($errors)){
  146.             $ctrls $this->_form->getControls();
  147.             echo '<ul id="'.$this->_name.'_errors" class="jforms-error-list">';
  148.             $errRequired='';
  149.             foreach($errors as $cname => $err){
  150.                 if(!$this->_form->isActivated($ctrls[$cname]->ref)) continue;
  151.                 if ($err === jForms::ERRDATA_REQUIRED{
  152.                     if ($ctrls[$cname]->alertRequired){
  153.                         echo '<li>'$ctrls[$cname]->alertRequired,'</li>';
  154.                     }
  155.                     else {
  156.                         echo '<li>'jLocale::get('jelix~formserr.js.err.required'$ctrls[$cname]->label),'</li>';
  157.                     }
  158.                 }else if ($err === jForms::ERRDATA_INVALID{
  159.                     if($ctrls[$cname]->alertInvalid){
  160.                         echo '<li>'$ctrls[$cname]->alertInvalid,'</li>';
  161.                     }else{
  162.                         echo '<li>'jLocale::get('jelix~formserr.js.err.invalid'$ctrls[$cname]->label),'</li>';
  163.                     }
  164.                 }
  165.                 elseif ($err === jForms::ERRDATA_INVALID_FILE_SIZE{
  166.                     echo '<li>'jLocale::get('jelix~formserr.js.err.invalid.file.size'$ctrls[$cname]->label),'</li>';
  167.                 }
  168.                 elseif ($err === jForms::ERRDATA_INVALID_FILE_TYPE{
  169.                     echo '<li>'jLocale::get('jelix~formserr.js.err.invalid.file.type'$ctrls[$cname]->label),'</li>';
  170.                 }
  171.                 elseif ($err === jForms::ERRDATA_FILE_UPLOAD_ERROR{
  172.                     echo '<li>'jLocale::get('jelix~formserr.js.err.file.upload'$ctrls[$cname]->label),'</li>';
  173.                 }
  174.                 elseif ($err != ''{
  175.                     echo '<li>'$err,'</li>';
  176.                 }
  177.             }
  178.             echo '</ul>';
  179.         }
  180.     }
  181.  
  182.     protected $jsContent = '';
  183.  
  184.     protected $lastJsContent = '';
  185.  
  186.     public function outputFooter(){
  187.         echo '<script type="text/javascript">
  188. //<![CDATA[
  189. (function(){var c, c2;
  190. '.$this->jsContent.$this->lastJsContent.'
  191. })();
  192. //]]>
  193. </script>';
  194.         echo '</form>';
  195.     }
  196.  
  197.     public function outputControlLabel($ctrl){
  198.         if($ctrl->type == 'hidden' || $ctrl->type == 'group'return;
  199.         $required ($ctrl->required == false || $ctrl->isReadOnly()?'':' jforms-required');
  200.         $reqhtml ($required?'<span class="jforms-required-star">*</span>':'');
  201.         $inError (isset($this->_form->getContainer()->errors[$ctrl->ref]?' jforms-error':'');
  202.         $hint ($ctrl->hint == ''?'':' title="'.htmlspecialchars($ctrl->hint).'"');
  203.         $id $this->_name.'_'.$ctrl->ref;
  204.         $idLabel ' id="'.$id.'_label"';
  205.         if($ctrl->type == 'output' || $ctrl->type == 'checkboxes' || $ctrl->type == 'radiobuttons' || $ctrl->type == 'date' || $ctrl->type == 'datetime' || $ctrl->type == 'choice'){
  206.             echo '<span class="jforms-label',$required,$inError,'"',$idLabel,$hint,'>',htmlspecialchars($ctrl->label),$reqhtml,"</span>\n";
  207.         }else if($ctrl->type != 'submit' && $ctrl->type != 'reset'){
  208.             echo '<label class="jforms-label',$required,$inError,'" for="',$id,'"',$idLabel,$hint,'>',htmlspecialchars($ctrl->label),$reqhtml,"</label>\n";
  209.         }
  210.     }
  211.  
  212.     public function outputControl($ctrl$attributes=array()){
  213.         if($ctrl->type == 'hidden'return;
  214.         $ro $ctrl->isReadOnly();
  215.         $attributes['name'$ctrl->ref;
  216.         $attributes['id'$this->_name.'_'.$ctrl->ref;
  217.  
  218.         if ($ro)
  219.             $attributes['readonly''readonly';
  220.         else
  221.             unset($attributes['readonly']);
  222.         if (!isset($attributes['title']&& $ctrl->hint{
  223.             $attributes['title'$ctrl->hint;
  224.         }
  225.  
  226.         $class 'jforms-ctrl-'.$ctrl->type;
  227.         $class .= ($ctrl->required == false || $ro?'':' jforms-required');
  228.         $class .= (isset($this->_form->getContainer()->errors[$ctrl->ref]?' jforms-error':'');
  229.         $class .= ($ro && $ctrl->type != 'captcha'?' jforms-readonly':'');
  230.         if (isset($attributes['class']))
  231.             $attributes['class'].= ' '.$class;
  232.         else
  233.             $attributes['class'$class;
  234.         $this->{'output'.$ctrl->type}($ctrl$attributes);
  235.         echo "\n";
  236.         $this->{'js'.$ctrl->type}($ctrl);
  237.         $this->outputHelp($ctrl);
  238.     }
  239.  
  240.     protected function _outputAttr(&$attributes{
  241.         foreach($attributes as $name=>$val{
  242.             echo ' '.$name.'="'.htmlspecialchars($val).'"';
  243.         }
  244.     }
  245.  
  246.     protected function escJsStr($str{
  247.         return '\''.str_replace(array("'","\n"),array("\\'""\\n")$str).'\'';
  248.     }
  249.  
  250.     /**
  251.      * @param jFormsControl $ctrl 
  252.      */
  253.     protected function commonJs($ctrl{
  254.         if ($ctrl->isReadOnly()) {
  255.             $this->jsContent .="c.readOnly = true;\n";
  256.         }
  257.  
  258.         if($ctrl->required){
  259.             $this->jsContent .="c.required = true;\n";
  260.             if($ctrl->alertRequired){
  261.                 $this->jsContent .="c.errRequired=".$this->escJsStr($ctrl->alertRequired).";\n";
  262.             }
  263.             else {
  264.                 $this->jsContent .="c.errRequired=".$this->escJsStr(jLocale::get('jelix~formserr.js.err.required'$ctrl->label)).";\n";
  265.             }
  266.         }
  267.  
  268.         if($ctrl->alertInvalid){
  269.             $this->jsContent .="c.errInvalid=".$this->escJsStr($ctrl->alertInvalid).";\n";
  270.         }
  271.         else {
  272.             $this->jsContent .="c.errInvalid=".$this->escJsStr(jLocale::get('jelix~formserr.js.err.invalid'$ctrl->label)).";\n";
  273.         }
  274.  
  275.         if ($this->isRootControl$this->jsContent .= $this->jFormsJsVarName.".tForm.addControl(c);\n";
  276.         
  277.     }
  278.  
  279.     protected function outputInput($ctrl&$attr{
  280.         $value $this->_form->getData($ctrl->ref);
  281.         if ($ctrl->size != 0)
  282.             $attr['size'$ctrl->size;
  283.         $maxl$ctrl->datatype->getFacet('maxLength');
  284.         if($maxl !== null)
  285.             $attr['maxlength']=$maxl;
  286.         $attr['value'$value;
  287.         $attr['type''text';
  288.         echo '<input';
  289.         $this->_outputAttr($attr);
  290.         echo $this->_endt;
  291.     }
  292.  
  293.     protected function jsInput($ctrl{
  294.  
  295.         $datatype array('jDatatypeBoolean'=>'Boolean','jDatatypeDecimal'=>'Decimal','jDatatypeInteger'=>'Integer','jDatatypeHexadecimal'=>'Hexadecimal',
  296.                         'jDatatypeDateTime'=>'Datetime','jDatatypeDate'=>'Date','jDatatypeTime'=>'Time',
  297.                         'jDatatypeUrl'=>'Url','jDatatypeEmail'=>'Email','jDatatypeIPv4'=>'Ipv4','jDatatypeIPv6'=>'Ipv6');
  298.         $isLocale false;
  299.         $data_type_class get_class($ctrl->datatype);
  300.         if(isset($datatype[$data_type_class]))
  301.             $dt $datatype[$data_type_class];
  302.         else if ($ctrl->datatype instanceof jDatatypeLocaleTime)
  303.             $dt 'Time'$isLocale true}
  304.         else if ($ctrl->datatype instanceof jDatatypeLocaleDate)
  305.             $dt 'LocaleDate'$isLocale true}
  306.         else if ($ctrl->datatype instanceof jDatatypeLocaleDateTime)
  307.             $dt 'LocaleDatetime'$isLocale true}
  308.         else
  309.             $dt 'String';
  310.  
  311.         $this->jsContent .="c = new ".$this->jFormsJsVarName."Control".$dt."('".$ctrl->ref."', ".$this->escJsStr($ctrl->label).");\n";
  312.         if ($isLocale)
  313.             $this->jsContent .="c.lang='".$GLOBALS['gJConfig']->locale."';\n";
  314.  
  315.         $maxl$ctrl->datatype->getFacet('maxLength');
  316.         if($maxl !== null)
  317.             $this->jsContent .="c.maxLength = '$maxl';\n";
  318.  
  319.         $minl$ctrl->datatype->getFacet('minLength');
  320.         if($minl !== null)
  321.             $this->jsContent .="c.minLength = '$minl';\n";
  322.         $re $ctrl->datatype->getFacet('pattern');
  323.         if($re !== null)
  324.             $this->jsContent .="c.regexp = ".$re.";\n";
  325.  
  326.         $this->commonJs($ctrl);
  327.     }
  328.  
  329.     protected function _outputDateControlDay($ctrl$attr$value){
  330.         $attr['name'$ctrl->ref.'[day]';
  331.         $attr['id'.= 'day';
  332.         if($GLOBALS['gJConfig']->forms['controls.datetime.input'== 'textboxes'){
  333.             $attr['value'$value;
  334.             echo '<input type="text" size="2" maxlength="2"';
  335.             $this->_outputAttr($attr);
  336.             echo $this->_endt;
  337.         }
  338.         else{
  339.             echo '<select';
  340.             $this->_outputAttr($attr);
  341.             echo '><option value="">'.htmlspecialchars(jLocale::get('jelix~jforms.date.day.label')).'</option>';
  342.             for($i=1;$i<32;$i++){
  343.                 $k ($i<10)?'0'.$i:$i;
  344.                 echo '<option value="'.$k.'"'.($k == $value?' selected="selected"':'').'>'.$k.'</option>';
  345.             }
  346.             echo '</select>';
  347.         }
  348.     }
  349.  
  350.     protected function _outputDateControlMonth($ctrl$attr$value){
  351.         $attr['name'$ctrl->ref.'[month]';
  352.         $attr['id'.= 'month';
  353.         if($GLOBALS['gJConfig']->forms['controls.datetime.input'== 'textboxes'{
  354.             $attr['value'$value;
  355.             echo '<input type="text" size="2" maxlength="2"';
  356.             $this->_outputAttr($attr);
  357.             echo $this->_endt;
  358.         }
  359.         else{
  360.             $monthLabels $GLOBALS['gJConfig']->forms['controls.datetime.months.labels'];
  361.             echo '<select';
  362.             $this->_outputAttr($attr);
  363.             echo '><option value="">'.htmlspecialchars(jLocale::get('jelix~jforms.date.month.label')).'</option>';
  364.             for($i=1;$i<13;$i++){
  365.                 $k ($i<10)?'0'.$i:$i;
  366.                 if($monthLabels == 'names')
  367.                     $l htmlspecialchars(jLocale::get('jelix~date_time.month.'.$k.'.label'));
  368.                 else if($monthLabels == 'shortnames')
  369.                     $l htmlspecialchars(jLocale::get('jelix~date_time.month.'.$k.'.shortlabel'));
  370.                 else
  371.                     $l $k;
  372.                 echo '<option value="'.$k.'"'.($k == $value?' selected="selected"':'').'>'.$l.'</option>';
  373.             }
  374.             echo '</select>';
  375.         }
  376.     }
  377.  
  378.     protected function _outputDateControlYear($ctrl$attr$value){
  379.         $attr['name'$ctrl->ref.'[year]';
  380.         $attr['id'.= 'year';
  381.         if($GLOBALS['gJConfig']->forms['controls.datetime.input'== 'textboxes'{
  382.             $attr['value'$value;
  383.             echo '<input type="text" size="4" maxlength="4"';
  384.             $this->_outputAttr($attr);
  385.             echo $this->_endt;
  386.         }
  387.         else{
  388.             $minDate $ctrl->datatype->getFacet('minValue');
  389.             $maxDate $ctrl->datatype->getFacet('maxValue');
  390.             if($minDate && $maxDate){
  391.                 echo '<select';
  392.                 $this->_outputAttr($attr);
  393.                 echo '><option value="">'.htmlspecialchars(jLocale::get('jelix~jforms.date.year.label')).'</option>';
  394.                 for($i=$minDate->year;$i<=$maxDate->year;$i++)
  395.                     echo '<option value="'.$i.'"'.($i == $value?' selected="selected"':'').'>'.$i.'</option>';
  396.                 echo '</select>';
  397.             }
  398.             else{
  399.                 $attr['value'$value;
  400.                 echo '<input type="text" size="4" maxlength="4"';
  401.                 $this->_outputAttr($attr);
  402.                 echo $this->_endt;
  403.             }
  404.         }
  405.     }
  406.  
  407.     protected function _outputDateControlHour($ctrl$attr$value){
  408.         $attr['name'$ctrl->ref.'[hour]';
  409.         $attr['id'.= 'hour';
  410.         if($GLOBALS['gJConfig']->forms['controls.datetime.input'== 'textboxes'{
  411.             $attr['value'$value;
  412.             echo '<input type="text" size="2" maxlength="2"';
  413.             $this->_outputAttr($attr);
  414.             echo $this->_endt;
  415.         }
  416.         else{
  417.             echo '<select';
  418.             $this->_outputAttr($attr);
  419.             echo '><option value="">'.htmlspecialchars(jLocale::get('jelix~jforms.time.hour.label')).'</option>';
  420.             for($i=0;$i<24;$i++){
  421.                 $k ($i<10)?'0'.$i:$i;
  422.                 echo '<option value="'.$k.'"'.(string) $k === $value?' selected="selected"':'').'>'.$k.'</option>';
  423.             }
  424.             echo '</select>';
  425.         }
  426.     }
  427.  
  428.     protected function _outputDateControlMinutes($ctrl$attr$value){
  429.         $attr['name'$ctrl->ref.'[minutes]';
  430.         $attr['id'.= 'minutes';
  431.         if($GLOBALS['gJConfig']->forms['controls.datetime.input'== 'textboxes'{
  432.             $attr['value'$value;
  433.             echo '<input type="text" size="2" maxlength="2"';
  434.             $this->_outputAttr($attr);
  435.             echo $this->_endt;
  436.         }
  437.         else{
  438.             echo '<select';
  439.             $this->_outputAttr($attr);
  440.             echo '><option value="">'.htmlspecialchars(jLocale::get('jelix~jforms.time.minutes.label')).'</option>';
  441.             for($i=0;$i<60;$i++){
  442.                 $k ($i<10)?'0'.$i:$i;
  443.                 echo '<option value="'.$k.'"'.(string) $k === $value?' selected="selected"':'').'>'.$k.'</option>';
  444.             }
  445.             echo '</select>';
  446.         }
  447.     }
  448.  
  449.     protected function _outputDateControlSeconds($ctrl$attr$value){
  450.         $attr['name'$ctrl->ref.'[seconds]';
  451.         $attr['id'.= 'seconds';
  452.         if(!$ctrl->enableSeconds)
  453.             echo '<input type="hidden" id="'.$attr['id'].'" name="'.$attr['name'].'" value="'.$value.'"'.$this->_endt;
  454.         else if($GLOBALS['gJConfig']->forms['controls.datetime.input'== 'textboxes'{
  455.             $attr['value'$value;
  456.             echo '<input type="text"';
  457.             $this->_outputAttr($attr);
  458.             echo $this->_endt;
  459.         }
  460.         else{
  461.             echo '<select';
  462.             $this->_outputAttr($attr);
  463.             echo '><option value="">'.htmlspecialchars(jLocale::get('jelix~jforms.time.seconds.label')).'</option>';
  464.             for($i=0;$i<60;$i++){
  465.                 $k ($i<10)?'0'.$i:$i;
  466.                 echo '<option value="'.$k.'"'.(string) $k === $value?' selected="selected"':'').'>'.$k.'</option>';
  467.             }
  468.             echo '</select>';
  469.         }
  470.     }
  471.  
  472.     protected function outputDate($ctrl&$attr){
  473.         $attr['id'$this->_name.'_'.$ctrl->ref.'_';
  474.         $v array('year'=>'','month'=>'','day'=>'');
  475.         if(preg_match('#^(\d{4})?-(\d{2})?-(\d{2})?$#',$this->_form->getData($ctrl->ref),$matches)){
  476.             if(isset($matches[1]))
  477.                 $v['year'$matches[1];
  478.             if(isset($matches[2]))
  479.                 $v['month'$matches[2];
  480.             if(isset($matches[3]))
  481.                 $v['day'$matches[3];
  482.         }
  483.         $f jLocale::get('jelix~format.date');
  484.         for($i=0;$i<strlen($f);$i++){
  485.             if($f[$i== 'Y')
  486.                 $this->_outputDateControlYear($ctrl$attr$v['year']);
  487.             else if($f[$i== 'm')
  488.                 $this->_outputDateControlMonth($ctrl$attr$v['month']);
  489.             else if($f[$i== 'd')
  490.                 $this->_outputDateControlDay($ctrl$attr$v['day']);
  491.             else
  492.                 echo ' ';
  493.         }
  494.     }
  495.  
  496.     protected function jsDate($ctrl){
  497.         $this->jsContent .= "c = new ".$this->jFormsJsVarName."ControlDate('".$ctrl->ref."', ".$this->escJsStr($ctrl->label).");\n";
  498.         $this->jsContent .= "c.multiFields = true;\n";
  499.         $minDate $ctrl->datatype->getFacet('minValue');
  500.         $maxDate $ctrl->datatype->getFacet('maxValue');
  501.         if($minDate)
  502.             $this->jsContent .= "c.minDate = '".$minDate->toString(jDateTime::DB_DFORMAT)."';\n";
  503.         if($maxDate)
  504.             $this->jsContent .= "c.maxDate = '".$maxDate->toString(jDateTime::DB_DFORMAT)."';\n";
  505.         $this->commonJs($ctrl);
  506.     }
  507.  
  508.     protected function outputDatetime($ctrl&$attr){
  509.         $attr['id'$this->_name.'_'.$ctrl->ref.'_';
  510.         $v array('year'=>'','month'=>'','day'=>'','hour'=>'','minutes'=>'','seconds'=>'');
  511.         if(preg_match('#^(\d{4})?-(\d{2})?-(\d{2})? (\d{2})?:(\d{2})?(:(\d{2})?)?$#',$this->_form->getData($ctrl->ref),$matches)){
  512.             if(isset($matches[1]))
  513.                 $v['year'$matches[1];
  514.             if(isset($matches[2]))
  515.                 $v['month'$matches[2];
  516.             if(isset($matches[3]))
  517.                 $v['day'$matches[3];
  518.             if(isset($matches[4]))
  519.                 $v['hour'$matches[4];
  520.             if(isset($matches[5]))
  521.                 $v['minutes'$matches[5];
  522.             if(isset($matches[7]))
  523.                 $v['seconds'$matches[7];
  524.         }
  525.         $f jLocale::get('jelix~format.datetime');
  526.         for($i=0;$i<strlen($f);$i++){
  527.             if($f[$i== 'Y')
  528.                 $this->_outputDateControlYear($ctrl$attr$v['year']);
  529.             else if($f[$i== 'm')
  530.                 $this->_outputDateControlMonth($ctrl$attr$v['month']);
  531.             else if($f[$i== 'd')
  532.                 $this->_outputDateControlDay($ctrl$attr$v['day']);
  533.             else if($f[$i== 'H')
  534.                 $this->_outputDateControlHour($ctrl$attr$v['hour']);
  535.             else if($f[$i== 'i')
  536.                 $this->_outputDateControlMinutes($ctrl$attr$v['minutes']);
  537.             else if($f[$i== 's')
  538.                 $this->_outputDateControlSeconds($ctrl$attr$v['seconds']);
  539.             else
  540.                 echo ' ';
  541.         }
  542.     }
  543.  
  544.     protected function jsDatetime($ctrl){
  545.         $this->jsContent .= "c = new ".$this->jFormsJsVarName."ControlDatetime('".$ctrl->ref."', ".$this->escJsStr($ctrl->label).");\n";
  546.         $this->jsContent .= "c.multiFields = true;\n";
  547.         $minDate $ctrl->datatype->getFacet('minValue');
  548.         $maxDate $ctrl->datatype->getFacet('maxValue');
  549.         if($minDate)
  550.             $this->jsContent .= "c.minDate = '".$minDate->toString(jDateTime::DB_DTFORMAT)."';\n";
  551.         if($maxDate)
  552.             $this->jsContent .= "c.maxDate = '".$maxDate->toString(jDateTime::DB_DTFORMAT)."';\n";
  553.         $this->commonJs($ctrl);
  554.     }
  555.  
  556.     protected function outputCheckbox($ctrl&$attr{
  557.         $value $this->_form->getData($ctrl->ref);
  558.  
  559.         if($ctrl->valueOnCheck == $value){
  560.             $attr['checked'"checked";
  561.          }
  562.         $attr['value'$ctrl->valueOnCheck;
  563.         $attr['type''checkbox';
  564.         echo '<input';
  565.         $this->_outputAttr($attr);
  566.         echo $this->_endt;
  567.     }
  568.  
  569.     protected function jsCheckbox($ctrl{
  570.  
  571.         $this->jsContent .="c = new ".$this->jFormsJsVarName."ControlBoolean('".$ctrl->ref."', ".$this->escJsStr($ctrl->label).");\n";
  572.  
  573.         $this->commonJs($ctrl);
  574.     }
  575.  
  576.     protected function echoCheckboxes($span$id&$values&$attr&$value&$i{
  577.         foreach($values as $v=>$label){
  578.             $attr['id'$id.$i;
  579.             $attr['value'$v;
  580.             echo $span;
  581.             $this->_outputAttr($attr);
  582.             if((is_array($value&& in_array((string) $v,$value,true)) || ($value === (string) $v))
  583.                 echo ' checked="checked"';
  584.             echo $this->_endt,'<label for="',$id,$i,'">',htmlspecialchars($label),"</label></span>\n";
  585.             $i++;
  586.         }
  587.     }
  588.  
  589.     protected function showRadioCheck($ctrl&$attr&$value$span{
  590.         $id $this->_name.'_'.$ctrl->ref.'_';
  591.         $i=0;
  592.         $data $ctrl->datasource->getData($this->_form);
  593.         if ($ctrl->datasource instanceof jIFormsDatasource2 && $ctrl->datasource->hasGroupedData()) {
  594.             if (isset($data[''])) {
  595.                 $this->echoCheckboxes($span$id$data['']$attr$value$i);
  596.             }
  597.             foreach($data as $group=>$values){
  598.                 if ($group === '')
  599.                     continue;
  600.                 echo '<fieldset><legend>'.htmlspecialchars($group).'</legend>'."\n";
  601.                 $this->echoCheckboxes($span$id$values$attr$value$i);
  602.                 echo "</fieldset>\n";
  603.             }
  604.         }else{
  605.             $this->echoCheckboxes($span$id$data$attr$value$i);
  606.         }
  607.     }
  608.  
  609.     protected function outputCheckboxes($ctrl&$attr{
  610.         $value $this->_form->getData($ctrl->ref);
  611.         $attr['name'$ctrl->ref.'[]';
  612.         unset($attr['title']);
  613.         if(is_array($value&& count($value== 1)
  614.             $value $value[0];
  615.         $span ='<span class="jforms-chkbox jforms-ctl-'.$ctrl->ref.'"><input type="checkbox"';
  616.  
  617.         if(is_array($value)){
  618.             $value array_map(create_function('$v''return (string) $v;'),$value);
  619.         }
  620.         else {
  621.             $value = (string) $value;
  622.         }
  623.         $this->showRadioCheck($ctrl$attr$value$span);
  624.     }
  625.  
  626.     protected function jsCheckboxes($ctrl{
  627.  
  628.         $this->jsContent .="c = new ".$this->jFormsJsVarName."ControlString('".$ctrl->ref."[]', ".$this->escJsStr($ctrl->label).");\n";
  629.  
  630.         $this->commonJs($ctrl);
  631.     }
  632.  
  633.     protected function outputRadiobuttons($ctrl&$attr{
  634.         $id $this->_name.'_'.$ctrl->ref.'_';
  635.         $attr['name'$ctrl->ref;
  636.         unset($attr['title']);
  637.         $value $this->_form->getData($ctrl->ref);
  638.         if(is_array($value)){
  639.             if(isset($value[0]))
  640.                 $value $value[0];
  641.             else
  642.                 $value '';
  643.         }
  644.         $value = (string) $value;
  645.         $span ='<span class="jforms-radio jforms-ctl-'.$ctrl->ref.'"><input type="radio"';
  646.         $this->showRadioCheck($ctrl$attr$value$span);
  647.     }
  648.  
  649.     protected function jsRadiobuttons($ctrl{
  650.  
  651.         $this->jsContent .="c = new ".$this->jFormsJsVarName."ControlString('".$ctrl->ref."', ".$this->escJsStr($ctrl->label).");\n";
  652.  
  653.         $this->commonJs($ctrl);
  654.     }
  655.  
  656.  
  657.     protected function fillSelect($ctrl$value{
  658.         $data $ctrl->datasource->getData($this->_form);
  659.         if ($ctrl->datasource instanceof jIFormsDatasource2 && $ctrl->datasource->hasGroupedData()) {
  660.             if (isset($data[''])) {
  661.                 foreach($data[''as $v=>$label){
  662.                     if(is_array($value))
  663.                         $selected in_array((string) $v,$value,true);
  664.                     else
  665.                         $selected ((string) $v===$value);
  666.                     echo '<option value="',htmlspecialchars($v),'"',($selected?' selected="selected"':''),'>',htmlspecialchars($label),"</option>\n";
  667.                 }
  668.             }
  669.             foreach($data as $group=>$values{
  670.                 if ($group === '')
  671.                     continue;
  672.                 echo '<optgroup label="'.htmlspecialchars($group).'">';
  673.                 foreach($values as $v=>$label){
  674.                     if(is_array($value))
  675.                         $selected in_array((string) $v,$value,true);
  676.                     else
  677.                         $selected ((string) $v===$value);
  678.                     echo '<option value="',htmlspecialchars($v),'"',($selected?' selected="selected"':''),'>',htmlspecialchars($label),"</option>\n";
  679.                 }
  680.                 echo '</optgroup>';
  681.             }
  682.         }
  683.         else {
  684.             foreach($data as $v=>$label){
  685.                     if(is_array($value))
  686.                         $selected in_array((string) $v,$value,true);
  687.                     else
  688.                         $selected ((string) $v===$value);
  689.                 echo '<option value="',htmlspecialchars($v),'"',($selected?' selected="selected"':''),'>',htmlspecialchars($label),"</option>\n";
  690.             }
  691.         }
  692.  
  693.     }
  694.  
  695.     protected function outputMenulist($ctrl&$attr{
  696.         if (isset($attr['readonly'])) {
  697.             $attr['disabled''disabled';
  698.             unset($attr['readonly']);
  699.         }
  700.  
  701.         $attr['size''1';
  702.         echo '<select';
  703.         $this->_outputAttr($attr);
  704.         echo ">\n";
  705.         $value $this->_form->getData($ctrl->ref);
  706.         if(is_array($value)){
  707.             if(isset($value[0]))
  708.                 $value $value[0];
  709.             else
  710.                 $value='';
  711.         }
  712.         $value = (string) $value;
  713.         if (!$ctrl->required{
  714.             echo '<option value=""',($value===''?' selected="selected"':''),'>',htmlspecialchars($ctrl->emptyItemLabel),"</option>\n";
  715.         }
  716.         $this->fillSelect($ctrl$value);
  717.         echo '</select>';
  718.     }
  719.  
  720.     protected function jsMenulist($ctrl{
  721.  
  722.         $this->jsContent .="c = new ".$this->jFormsJsVarName."ControlString('".$ctrl->ref."', ".$this->escJsStr($ctrl->label).");\n";
  723.  
  724.         $this->commonJs($ctrl);
  725.     }
  726.  
  727.     protected function outputListbox($ctrl&$attr{
  728.         if (isset($attr['readonly'])) {
  729.             $attr['disabled''disabled';
  730.             unset($attr['readonly']);
  731.         }
  732.         $attr['size'$ctrl->size;
  733.  
  734.         if($ctrl->multiple){
  735.             $attr['name'$ctrl->ref.'[]';
  736.             $attr['id'$this->_name.'_'.$ctrl->ref;
  737.             $attr['multiple''multiple';
  738.             echo '<select';
  739.             $this->_outputAttr($attr);
  740.             echo ">\n";
  741.             $value $this->_form->getData($ctrl->ref);
  742.  
  743.             if(is_array($value&& count($value== 1)
  744.                 $value $value[0];
  745.  
  746.             if(is_array($value)){
  747.                 $value array_map(create_function('$v''return (string) $v;'),$value);
  748.                 $this->fillSelect($ctrl$value);
  749.             }else{
  750.                 $this->fillSelect($ctrl(string)$value);
  751.             }
  752.             echo '</select>';
  753.         }else{
  754.             $value $this->_form->getData($ctrl->ref);
  755.  
  756.             if(is_array($value)){
  757.                 if(count($value>= 1)
  758.                     $value $value[0];
  759.                 else
  760.                     $value ='';
  761.             }
  762.  
  763.             $value = (string) $value;
  764.             echo '<select';
  765.             $this->_outputAttr($attr);
  766.             echo ">\n";
  767.             $this->fillSelect($ctrl$value);
  768.             echo '</select>';
  769.         }
  770.     }
  771.  
  772.     protected function jsListbox($ctrl{
  773.         if($ctrl->multiple){
  774.             $this->jsContent .= "c = new ".$this->jFormsJsVarName."ControlString('".$ctrl->ref."[]', ".$this->escJsStr($ctrl->label).");\n";
  775.             $this->jsContent .= "c.multiple = true;\n";
  776.         else {
  777.             $this->jsContent .= "c = new ".$this->jFormsJsVarName."ControlString('".$ctrl->ref."', ".$this->escJsStr($ctrl->label).");\n";
  778.         }
  779.  
  780.         $this->commonJs($ctrl);
  781.     }
  782.  
  783.     protected function outputTextarea($ctrl&$attr{
  784.         if (!isset($attr['rows']))
  785.             $attr['rows'$ctrl->rows;
  786.         if (!isset($attr['cols']))
  787.             $attr['cols'$ctrl->cols;
  788.         echo '<textarea';
  789.         $this->_outputAttr($attr);
  790.         echo '>',htmlspecialchars($this->_form->getData($ctrl->ref)),'</textarea>';
  791.     }
  792.  
  793.     protected function jsTextarea($ctrl$withjsobj=true{
  794.         if ($withjsobj)
  795.             $this->jsContent .="c = new ".$this->jFormsJsVarName."ControlString('".$ctrl->ref."', ".$this->escJsStr($ctrl->label).");\n";
  796.  
  797.         $maxl$ctrl->datatype->getFacet('maxLength');
  798.         if($maxl !== null)
  799.             $this->jsContent .="c.maxLength = '$maxl';\n";
  800.  
  801.         $minl$ctrl->datatype->getFacet('minLength');
  802.         if($minl !== null)
  803.             $this->jsContent .="c.minLength = '$minl';\n";
  804.  
  805.         $this->commonJs($ctrl);
  806.     }
  807.  
  808.     protected function outputHtmleditor($ctrl&$attr{
  809.         $this->outputTextarea($ctrl$attr);
  810.     }
  811.  
  812.     protected function jsHtmleditor($ctrl{
  813.         $this->jsContent .="c = new ".$this->jFormsJsVarName."ControlHtml('".$ctrl->ref."', ".$this->escJsStr($ctrl->label).");\n";
  814.         $this->jsTextarea($ctrlfalse);
  815.         $engine $GLOBALS['gJConfig']->htmleditors[$ctrl->config.'.engine.name'];
  816.         $this->jsContent .= 'jelix_'.$engine.'_'.$ctrl->config.'("'.$this->_name.'_'.$ctrl->ref.'","'.$this->_name.'","'.$ctrl->skin."\",".$this->jFormsJsVarName.".config);\n";
  817.     }
  818.  
  819.     protected function outputWikieditor($ctrl&$attr{
  820.         $this->outputTextarea($ctrl$attr);
  821.     }
  822.  
  823.     protected function jsWikieditor($ctrl{
  824.  
  825.     }
  826.  
  827.     protected function outputSecret($ctrl&$attr{
  828.         if ($ctrl->size != 0)
  829.             $attr['size'$ctrl->size;
  830.         $maxl $ctrl->datatype->getFacet('maxLength');
  831.         if($maxl !== null)
  832.             $attr['maxlength'$maxl;
  833.         $attr['type''password';
  834.         $attr['value'$this->_form->getData($ctrl->ref);
  835.         echo '<input';
  836.         $this->_outputAttr($attr);
  837.         echo $this->_endt;
  838.     }
  839.  
  840.     protected function jsSecret($ctrl{
  841.         $this->jsContent .="c = new ".$this->jFormsJsVarName."ControlSecret('".$ctrl->ref."', ".$this->escJsStr($ctrl->label).");\n";
  842.  
  843.         $maxl$ctrl->datatype->getFacet('maxLength');
  844.         if($maxl !== null)
  845.             $this->jsContent .="c.maxLength = '$maxl';\n";
  846.  
  847.         $minl$ctrl->datatype->getFacet('minLength');
  848.         if($minl !== null)
  849.             $this->jsContent .="c.minLength = '$minl';\n";
  850.         $re $ctrl->datatype->getFacet('pattern');
  851.         if($re !== null)
  852.             $this->jsContent .="c.regexp = ".$re.";\n";
  853.         $this->commonJs($ctrl);
  854.     }
  855.  
  856.     protected function outputSecretconfirm($ctrl&$attr{
  857.         if ($ctrl->size != 0)
  858.             $attr['size'$ctrl->size;
  859.         $attr['type''password';
  860.         $attr['value'$this->_form->getData($ctrl->ref);
  861.         echo '<input';
  862.         $this->_outputAttr($attr);
  863.         echo $this->_endt;
  864.     }
  865.  
  866.     protected function jsSecretconfirm($ctrl{
  867.         $this->jsContent .="c = new ".$this->jFormsJsVarName."ControlConfirm('".$ctrl->ref."', ".$this->escJsStr($ctrl->label).");\n";
  868.         $this->commonJs($ctrl);
  869.     }
  870.  
  871.     protected function outputOutput($ctrl&$attr{
  872.         unset($attr['readonly']);
  873.         unset($attr['class']);
  874.         if (isset($attr['title'])){
  875.             $hint ' title="'.htmlspecialchars($attr['title']).'"';
  876.             unset($attr['title']);
  877.         }
  878.         else $hint '';
  879.         $attr['type''hidden';
  880.         $attr['value'$this->_form->getData($ctrl->ref);
  881.         echo '<input';
  882.         $this->_outputAttr($attr);
  883.         echo $this->_endt;
  884.         echo '<span class="jforms-value"',$hint,'>',htmlspecialchars($attr['value']),'</span>';
  885.     }
  886.  
  887.     protected function jsOutput($ctrl{
  888.     }
  889.  
  890.     protected function outputUpload($ctrl&$attr{
  891.         /*if($ctrl->maxsize){
  892.             echo '<input type="hidden" name="MAX_FILE_SIZE" value="',$ctrl->maxsize,'"',$this->_endt;
  893.         }*/
  894.         $attr['type''file';
  895.         $attr['value''';
  896.         echo '<input';
  897.         $this->_outputAttr($attr);
  898.         echo $this->_endt;
  899.     }
  900.  
  901.     protected function jsUpload($ctrl{
  902.         $this->jsContent .="c = new ".$this->jFormsJsVarName."ControlString('".$ctrl->ref."', ".$this->escJsStr($ctrl->label).");\n";
  903.  
  904.         $this->commonJs($ctrl);
  905.     }
  906.  
  907.     protected function outputSubmit($ctrl$attr{
  908.         unset($attr['readonly']);
  909.         $attr['class''jforms-submit';
  910.         $attr['type''submit';
  911.  
  912.         if($ctrl->standalone){
  913.             $attr['value'$ctrl->label;
  914.             echo '<input';
  915.             $this->_outputAttr($attr);
  916.             echo $this->_endt;
  917.         }else{
  918.             $id $this->_name.'_'.$ctrl->ref.'_';
  919.             $attr['name'$ctrl->ref;
  920.             foreach($ctrl->datasource->getData($this->_formas $v=>$label){
  921.                 // because IE6 sucks with <button type=submit> (see ticket #431), we must use input :-(
  922.                 $attr['value'$label;
  923.                 $attr['id'$id.$v;
  924.                 echo ' <input';
  925.                 $this->_outputAttr($attr);
  926.                 echo $this->_endt;
  927.             }
  928.         }
  929.     }
  930.  
  931.     protected function jsSubmit($ctrl{
  932.         // no javascript
  933.     }
  934.  
  935.     protected function outputReset($ctrl&$attr{
  936.         unset($attr['readonly']);
  937.         $attr['class''jforms-reset';
  938.         $attr['type''reset';
  939.         echo '<button';
  940.         $this->_outputAttr($attr);
  941.         echo '>',htmlspecialchars($ctrl->label),'</button>';
  942.     }
  943.  
  944.     protected function jsReset($ctrl{
  945.         // no javascript
  946.     }
  947.  
  948.     protected function outputCaptcha($ctrl&$attr{
  949.         $ctrl->initExpectedValue();
  950.         echo '<span class="jforms-captcha-question">',htmlspecialchars($ctrl->question),'</span> ';
  951.  
  952.         unset($attr['readonly']);
  953.         $attr['type''text';
  954.         $attr['value''';
  955.         echo '<input';
  956.         $this->_outputAttr($attr);
  957.         echo $this->_endt;
  958.     }
  959.  
  960.     protected function jsCaptcha($ctrl{
  961.         $this->jsTextarea($ctrl);
  962.     }
  963.  
  964.     protected function outputGroup($ctrl&$attr{
  965.         echo '<fieldset><legend>',htmlspecialchars($ctrl->label),"</legend>\n";
  966.         echo '<table class="jforms-table-group" border="0">',"\n";
  967.         foreach$ctrl->getChildControls(as $ctrlref=>$c){
  968.             if($c->type == 'submit' || $c->type == 'reset' || $c->type == 'hidden'continue;
  969.             if(!$this->_form->isActivated($ctrlref)) continue;
  970.             echo '<tr><th scope="row">';
  971.             $this->outputControlLabel($c);
  972.             echo "</th>\n<td>";
  973.             $this->outputControl($c);
  974.             echo "</td></tr>\n";
  975.         }
  976.         echo "</table></fieldset>";
  977.     }
  978.  
  979.     protected function jsGroup($ctrl{
  980.         //no javacript
  981.     }
  982.  
  983.     protected function outputChoice($ctrl&$attr{
  984.         echo '<ul class="jforms-choice jforms-ctl-'.$ctrl->ref.'" >',"\n";
  985.  
  986.         $value $this->_form->getData($ctrl->ref);
  987.         if(is_array($value)){
  988.             if(isset($value[0]))
  989.                 $value $value[0];
  990.             else
  991.                 $value='';
  992.         }
  993.  
  994.         $i=0;
  995.         $attr['name'$ctrl->ref;
  996.         $id $this->_name.'_'.$ctrl->ref.'_';
  997.         $attr['type']='radio';
  998.         unset($attr['class']);
  999.         $readonly (isset($attr['readonly']&& $attr['readonly']!='');
  1000.  
  1001.         $this->jsChoiceInternal($ctrl);
  1002.         $this->jsContent .="c2 = c;\n";
  1003.         $this->isRootControl = false;
  1004.         foreach$ctrl->items as $itemName=>$listctrl){
  1005.             echo '<li><label><input';
  1006.             $attr['id'$id.$i;
  1007.             $attr['value'$itemName;
  1008.             if ($itemName==$value)
  1009.                 $attr['checked''checked';
  1010.             else
  1011.                 unset($attr['checked']);
  1012.             $this->_outputAttr($attr);
  1013.             echo ' onclick="'.$this->jFormsJsVarName.'.getForm(\'',$this->_name,'\').getControl(\'',$ctrl->ref,'\').activate(\'',$itemName,'\')"'$this->_endt;
  1014.             echo htmlspecialchars($ctrl->itemsNames[$itemName]),"</label>\n";
  1015.  
  1016.             $displayedControls false;
  1017.             foreach($listctrl as $ref=>$c{
  1018.                 if(!$this->_form->isActivated($ref|| $c->type == 'hidden'continue;
  1019.                 $displayedControls true;
  1020.                 echo ' <span class="jforms-item-controls">';
  1021.                 $this->outputControlLabel($c);
  1022.                 echo ' ';
  1023.                 $this->outputControl($c);
  1024.                 echo "</span>\n";
  1025.                 $this->jsContent .="c2.addControl(c, ".$this->escJsStr($itemName).");\n";
  1026.             }
  1027.             if(!$displayedControls{
  1028.                 $this->jsContent .="c2.items[".$this->escJsStr($itemName)."]=[];\n";
  1029.             }
  1030.  
  1031.             echo "</li>\n";
  1032.             $i++;
  1033.         }
  1034.         echo "</ul>\n";
  1035.         $this->isRootControl = true;
  1036.     }
  1037.  
  1038.     protected function jsChoice($ctrl{
  1039.         $value $this->_form->getData($ctrl->ref);
  1040.         if(is_array($value)){
  1041.             if(isset($value[0]))
  1042.                 $value $value[0];
  1043.             else
  1044.                 $value='';
  1045.         }
  1046.         $this->jsContent .= "c2.activate('".$value."');\n";
  1047.     }
  1048.  
  1049.     protected function jsChoiceInternal($ctrl{
  1050.  
  1051.         $this->jsContent .="c = new ".$this->jFormsJsVarName."ControlChoice('".$ctrl->ref."', ".$this->escJsStr($ctrl->label).");\n";
  1052.  
  1053.         $this->commonJs($ctrl);
  1054.     }
  1055.  
  1056.     protected function outputHelp($ctrl{
  1057.         if ($ctrl->help{
  1058.             if($ctrl->type == 'checkboxes' || ($ctrl->type == 'listbox' && $ctrl->multiple)){
  1059.                 $name=$ctrl->ref.'[]';
  1060.             }else{
  1061.                 $name=$ctrl->ref;
  1062.             }
  1063.             // additionnal &nbsp, else background icon is not shown in webkit
  1064.             echo '<span class="jforms-help" id="'$this->_name.'_'.$ctrl->ref.'-help">&nbsp;<span>'.htmlspecialchars($ctrl->help).'</span></span>';
  1065.         }
  1066.     }
  1067. }

Documentation generated on Thu, 19 Sep 2013 00:04:45 +0200 by phpDocumentor 1.4.3