Пример #1
0
 public function init()
 {
     $e = new Daq_Form_Element("file", Daq_Form_Element::TYPE_FILE);
     $e->isRequired(true);
     $this->addElement($e);
 }
Пример #2
0
 public function render(Daq_Form_Element $element)
 {
     $label = true;
     if ($element->getType() == Daq_Form_Element::TYPE_CHECKBOX) {
         $label = false;
     }
     if ($element->getType() == Daq_Form_Element::TYPE_RADIO) {
         $label = false;
     }
     if ($element->hasErrors()) {
         $c = '<tr valign="top" class="error">';
     } else {
         $c = '<tr valign="top">';
     }
     if ($element->isRequired()) {
         $req = '<span class="wpjb-red">&nbsp;*</span>';
     } else {
         $req = '';
     }
     $c .= '   <th scope="row">';
     if ($label) {
         $c .= '       <label for="' . $element->getName() . '">' . $element->getLabel() . $req . '</label>';
     } else {
         $c .= '       ' . $element->getLabel() . $req;
     }
     $c .= '   </th>';
     $c .= '   <td>';
     $c .= $this->renderTag($element);
     $c .= '       <br />';
     if ($element->hasHint()) {
         $c .= '       <span class="setting-description">' . $this->_escape($element->getHint()) . '</span>';
     }
     if ($element->hasErrors()) {
         $c .= '       <ul class="updated">';
         $c .= '           <li><strong>Following errors occured</strong></li>';
         foreach ($element->getErrors() as $error) {
             $c .= '            <li>' . $error . '</li>';
         }
         $c .= '       </ul>';
     }
     $c .= '   </td>';
     $c .= '</tr>';
     return $c;
 }