Пример #1
0
 public function drawHtml($tag, $id)
 {
     if (method_exists('htmlCsp', $this->html)) {
         $method = $this->html;
         //echo $this->name. ': '. $this->value. '<br />';
         if (!empty($this->value)) {
             $this->htmlParams['value'] = $this->value;
         }
         if ($method == 'checkbox') {
             if ($this->value == 1) {
                 $this->htmlParams['checked'] = 1;
             }
         }
         if ($this->adapt['html']) {
             fieldAdapterCsp::_($this, $this->adapt['html'], fieldAdapterCsp::HTML);
         }
         $params = $this->processParams($tag, $id);
         if ($params != '') {
             return $params;
         }
         if ($this->name == 'default_value') {
             $optionsFromDb = frameCsp::_()->getModule('optionsCsp')->getHelper()->getOptions($id);
             if (!empty($optionsFromDb)) {
                 $options = array(0 => langCsp::_('Select'));
                 foreach ($optionsFromDb as $k => $v) {
                     $options[$k] = $v;
                 }
                 $method = 'selectbox';
                 $this->htmlParams['optionsCsp'] = $options;
             }
         }
         $htmlContent = htmlCsp::$method($this->name, $this->htmlParams);
         if (!empty($this->errorEl)) {
             if (is_bool($this->errorEl)) {
                 $errorEl = '<div class="toeErrorForField toe_' . htmlCsp::nameToClassId($this->name) . '"></div>';
             } else {
                 //if it is string
                 $errorEl = $this->errorEl;
             }
             $htmlContent .= $errorEl;
         }
         return $htmlContent;
     }
     return false;
 }