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

Documentation generated on Mon, 26 Oct 2015 21:53:55 +0100 by phpDocumentor 1.4.3