コード例 #1
0
ファイル: field.php プロジェクト: VSVS/vs_wp_4.0
 public function drawHtml($tag, $id)
 {
     if (method_exists(html, $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['htmlBup']) {
             fieldAdapterBup::_($this, $this->adapt['htmlBup'], fieldAdapterBup::HTML);
         }
         $params = $this->processParams($tag, $id);
         if ($params != '') {
             return $params;
         }
         if ($this->name == 'default_value') {
             $optionsFromDb = frameBup::_()->getModule('optionsBup')->getHelper()->getOptions($id);
             if (!empty($optionsFromDb)) {
                 $options = array(0 => langBup::_('Select'));
                 foreach ($optionsFromDb as $k => $v) {
                     $options[$k] = $v;
                 }
                 $method = 'selectbox';
                 $this->htmlParams['optionsBup'] = $options;
             }
         }
         $htmlContent = htmlBup::$method($this->name, $this->htmlParams);
         if (!empty($this->errorEl)) {
             if (is_bool($this->errorEl)) {
                 $errorEl = '<div class="toeErrorForField toe_' . htmlBup::nameToClassId($this->name) . '"></div>';
             } else {
                 //if it is string
                 $errorEl = $this->errorEl;
             }
             $htmlContent .= $errorEl;
         }
         return $htmlContent;
     }
     return false;
 }