public function outputControlValue()
 {
     $attr = $this->getValueAttributes();
     echo '<span ';
     $this->_outputAttr($attr);
     echo '>';
     $value = $this->getValue();
     $value = $this->ctrl->getDisplayValue($value);
     if (is_array($value)) {
         $s = '';
         foreach ($value as $v) {
             $s .= $this->valuesSeparator . htmlspecialchars($v);
         }
         echo substr($s, strlen($this->valuesSeparator));
     } else {
         if ($this->ctrl->isHtmlContent()) {
             echo $value;
         } else {
             echo htmlspecialchars($value);
         }
     }
     echo '</span>';
 }
Beispiel #2
0
 protected function commonJs()
 {
     $jsContent = '';
     if ($this->ctrl->isReadOnly()) {
         $jsContent .= "c.readOnly = true;\n";
     }
     if ($this->ctrl->required) {
         $jsContent .= "c.required = true;\n";
         if ($this->ctrl->alertRequired) {
             $jsContent .= "c.errRequired=" . $this->escJsStr($this->ctrl->alertRequired) . ";\n";
         } else {
             $jsContent .= "c.errRequired=" . $this->escJsStr(\jLocale::get('jelix~formserr.js.err.required', $this->ctrl->label)) . ";\n";
         }
     }
     if ($this->ctrl->alertInvalid) {
         $jsContent .= "c.errInvalid=" . $this->escJsStr($this->ctrl->alertInvalid) . ";\n";
     } else {
         $jsContent .= "c.errInvalid=" . $this->escJsStr(\jLocale::get('jelix~formserr.js.err.invalid', $this->ctrl->label)) . ";\n";
     }
     if (!$this->parentWidget->controlJsChild()) {
         $jsContent .= $this->builder->getJFormsJsVarName() . ".tForm.addControl(c);\n";
     }
     $this->parentWidget->addJs($jsContent);
 }