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

Documentation generated on Mon, 19 Sep 2011 14:12:45 +0200 by phpDocumentor 1.4.3