Exemplo n.º 1
0
 public function getForm()
 {
     $form = new OJForm($this->name, ($this->isNew() ? 'Add ' : 'Update ') . $this->name);
     if (!$this->isNew()) {
         $form->addField(array('type' => 'hidden', 'name' => $this->idField, 'default' => $this->row[$this->idField]));
     }
     foreach ($this->fields as $field) {
         $detail = array('name' => $field[0]);
         $detail['type'] = $this->mapField($field[1]);
         $detail['default'] = $this->getCol($field[0]);
         $detail['label'] = $field[2] ? $field[2] : ucfirst($field[0]);
         if (preg_match('/required/i', $field[3])) {
             $detail['label'] .= ' *';
         }
         $form->addField($detail, $field[5]);
     }
     return $form;
 }