表单功能完善
This commit is contained in:
@@ -135,7 +135,11 @@ class Form extends Admin {
|
||||
return $this->error($this->Fattr->getError());
|
||||
}
|
||||
}else{
|
||||
$info = array(
|
||||
'form_id' => $form_id
|
||||
);
|
||||
$data = array(
|
||||
'info' => $info,
|
||||
'keyList' => $this->field
|
||||
);
|
||||
$this->assign($data);
|
||||
|
||||
@@ -37,7 +37,7 @@ class FormAttr extends Base{
|
||||
return $db->columField('form_' . strtolower($name), $attr)->query();
|
||||
}
|
||||
});
|
||||
self::beforeUpdate(function($data){
|
||||
self::beforeUpdate(function($data){dump($data);
|
||||
$attr = $data->toArray();
|
||||
$attr['action'] = 'CHANGE';
|
||||
$attr['oldname'] = db('FormAttr')->where('id', $attr['id'])->value('name');
|
||||
@@ -59,7 +59,7 @@ class FormAttr extends Base{
|
||||
|
||||
public function getFieldlist($map,$index='id'){
|
||||
$list = array();
|
||||
$row = db('Attribute')->field('*,remark as help,type,extra as "option"')->where($map)->order('group_id asc, sort asc')->select();
|
||||
$row = $this->field('*,remark as help,type,extra as "option"')->where($map)->order('group_id asc, sort asc')->select();
|
||||
foreach ($row as $key => $value) {
|
||||
if (in_array($value['type'],array('checkbox','radio','select','bool'))) {
|
||||
$value['option'] = parse_field_attr($value['extra']);
|
||||
|
||||
@@ -15,6 +15,7 @@ class Form extends Front {
|
||||
public function _initialize() {
|
||||
parent::_initialize();
|
||||
$model_name = $this->request->param('model');
|
||||
$this->form = db('Form')->where('name', $model_name)->find();
|
||||
$this->model = M($model_name, 'form');
|
||||
}
|
||||
|
||||
@@ -53,6 +54,13 @@ class Form extends Front {
|
||||
return $this->error('提交失败!');
|
||||
}
|
||||
}else{
|
||||
$map['form_id'] = $this->form['id'];
|
||||
$attr = model('FormAttr')->getFieldlist($map);
|
||||
|
||||
$data = array(
|
||||
'attr' => $attr
|
||||
);
|
||||
$this->assign($data);
|
||||
return $this->fetch();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user