Example #1
0
 /**
  * 自动生成表单
  *
  * @param $set_id
  *
  * @return unknown_type
  */
 function getForm($set_id = 0)
 {
     $this->_form_();
     //传入ID,修改表单
     if ($set_id) {
         $data = $this->get((int) $set_id)->get();
         foreach ($this->_form as $k => &$f) {
             $f['value'] = $data[$k];
         }
         if (method_exists($this, "_set_")) {
             $this->_set_();
         }
         if ($this->_form_secret) {
             Form::secret(get_class($this) . '_set');
         }
     } elseif (method_exists($this, "_add_")) {
         $this->_add_();
         if ($this->_form_secret) {
             Form::secret(get_class($this) . '_add');
         }
     }
     return Form::autoform($this->_form);
 }