public function add() { //编辑和添加用同一个方法 if (!empty($_POST)) { $group = M('AuthGroup'); $group->create(); $res = $group->add(); if ($res) { $this->success('添加成功'); } else { $this->error($info->getError); } } else { $jankzmaker = new \JankzMaker\Controller\Admin\MakerForm(); $jankzmaker->setMetaTitle('添加用户组')->setCoulmn(1)->setUrl(U('Group/add'))->addFormItem('title', 'text', '用户组名')->addFormItem('rules', 'text', '规则id')->display(); } }
public function edit() { $id = I('id', '', intval); $student = M('Student'); $info = $student->find($id); if (!empty($_POST)) { $_POST['id'] = $_GET['id']; $student = M('Student'); $student->create(); $info = $student->save(); if ($info) { $this->success('已编辑', U('Student/index')); } else { $this->error('编辑失败!'); } } else { $jankzmaker = new \JankzMaker\Controller\Admin\MakerForm(); $jankzmaker->setMetaTitle('添加学生')->setCoulmn(1)->setUrl(U('Student/edit', array('id' => $id)))->addFormItem('stu_name', 'text', '姓名', $info['stu_name'])->addFormItem('stu_number', 'text', '学号', $info['stu_number'])->addFormItem('parent_number', 'text', '家长号', $info['parent_number'])->addFormItem('phone', 'text', '电话', $info['phone'])->display(); } }
public function edit() { $id = I('id', '', intval); $Order = M('Order'); $info = $Order->find($id); if (!empty($_POST)) { $_POST['id'] = $_GET['id']; $Order = M('Order'); $Order->create(); $info = $Order->save(); if ($info) { $this->success('已编辑', U('Order/index')); } else { $this->error('编辑失败!'); } } else { $options = M('AuthGroup')->where(array('status' => 1))->select(); $jankzmaker = new \JankzMaker\Controller\Admin\MakerForm(); $jankzmaker->setMetaTitle('编辑管理员')->setCoulmn(1)->setUrl(U('Order/edit', array('id' => $id)))->addFormItem('username', 'text', '管理员名称', $info['username'])->addFormItem('password', 'text', '密码', $info['password'])->addFormItem('repassword', 'text', '重复密码', $info['password'])->addFormItem('email', 'text', '邮箱', $info['email'])->addFormItem('level', 'text', '管理等级', $info['level'])->addFormItem('group_id', 'select', '用户组id', '', 1, 2, 10, $options)->display(); } }
public function edit() { $id = I('id', '', intval); $Notice = M('Notice'); $info = $Notice->find($id); if (!empty($_POST)) { $_POST['id'] = $_GET['id']; $Notice = M('Notice'); $Notice->create(); $info = $Notice->save(); if ($info) { $this->success('已编辑', U('Notice/index')); } else { $this->error('编辑失败!'); } } else { $options = M('AuthGroup')->where(array('status' => 1))->select(); $jankzmaker = new \JankzMaker\Controller\Admin\MakerForm(); $jankzmaker->setMetaTitle('编辑管理员')->setCoulmn(1)->setUrl(U('Notice/edit', array('id' => $id)))->addFormItem('title', 'text', '通知名称', $info['title'])->addFormItem('content', 'textarea', '通知内容', $info['content'])->display(); } }
public function edit() { $id = I('id', '', intval); $system = M('System'); $res = $system->find($id); if (!empty($_POST)) { $_POST['id'] = $_GET['id']; $system = M('System'); $system->create(); $result = $system->save(); if ($result) { $this->success('已编辑', U('System/menulist')); } else { $this->error('编辑失败!'); } } else { $info = getList(); //调用无限级分类函数 $jankzmaker = new \JankzMaker\Controller\Admin\MakerForm(); $jankzmaker->setMetaTitle('编辑')->setUrl(U('System/edit', array('id' => $id)))->setCoulmn(1)->addFormItem('title', 'text', '菜单名称', $res['title'])->addFormItem('sort', 'text', '排序值', $res['sort'])->addFormItem('url', 'text', '链接地址', $res['url'])->addFormItem('icon', 'text', '图标', $res['icon'])->addFormItem('pid', 'select', '父ID', '', 1, 2, 10, $info)->display(); } }