Ejemplo n.º 1
0
 public function mod()
 {
     $configKey = 'settingConfig';
     // $cachePath = Doo::conf()->CACHE_PATH;
     // Doo::conf()->CACHE_PATH = Doo::conf()->SITE_PATH.'protect/confCache/';
     array_push($this->_includeJsFileList, 'js/ueditor/ueditor.config.js');
     array_push($this->_includeJsFileList, 'js/ueditor/ueditor.all.min.js');
     array_push($this->_includeJsFileList, 'js/ueditor/lang/zh-cn/zh-cn.js');
     array_push($this->_includeJsFileList, 'js/ueditor/ueditor.use.js');
     $shopNameList = DBproxy::getProcedure('Manage')->setDimension(2)->getShopName();
     $shopNameOpt = '<select class="m-wrap" name="shopname" id="city-element">';
     foreach ($shopNameList as $key => $value) {
         $selected = $this->getUrlVar('shopname') == $value['cityid'] . ',' . $value['shopname'] ? 'selected=selected' : '';
         $shopNameOpt .= '<option ' . $selected . ' value="' . $value['cityid'] . ',' . $value['shopname'] . '">' . $value['cityNshopname'] . '</option>';
     }
     $shopNameOpt .= '</select>';
     if ($this->isAjax() && $_POST) {
         $v = Doo::loadHelper('DooValidator', true);
         $success = true;
         $errors = array();
         DOO::cache('php')->set($configKey, json_encode($_POST), 3600 * 24 * 365 * 100);
         // 处理返回路径
         if ($success) {
             $errors = ConfigController::$dataTableUrl;
         }
         $this->ajaxFormResult($success, $errors);
     } else {
         $infoCache = DOO::cache('php')->get($configKey);
         $info = json_decode($infoCache, true);
         // echo Doo::conf()->CACHE_PATH = $cachePath;
         Doo::loadClassAt('html/DooFormExt', 'default');
         $form = new DooFormExt(array('method' => 'post', 'renderFormat' => 'html', 'action' => '', 'attributes' => array('id' => 'js-form', 'class' => 'form-horizontal'), 'elements' => array('errors' => array('display', array('div' => false, 'label' => false, 'content' => '<div id="js-form-errors" class=""></div><div style="clear:both"></div>')), 'peiSwitch' => array('select', array('label' => L('菜品调剂发送开关:'), 'attributes' => array('class' => "m-wrap"), 'multioptions' => array(0 => '关', 1 => '开'), 'value' => isset($info['peiSwitch']) ? $info['peiSwitch'] : '0')), 'waimaiSum' => array('text', array('label' => '外卖起送份数', 'attributes' => array('class' => "m-wrap"), 'value' => isset($info['waimaiSum']) ? $info['waimaiSum'] : '1')), 'aboutTxt' => array('display', array('label' => '关于我们', 'attributes' => array('class' => "m-wrap"), 'content' => '<script id="about" type="text/plain" style="width:1024px;height:500px;">' . $info['editorValue'] . '</script>')), 'saveAndSee' => array('button', array('div' => false, 'left' => ' ', 'label' => '保存&查看<i class="icon-arrow-right"></i>', 'attributes' => array('class' => "btn blue"), 'value' => 1)), 'cancelAndReturn' => array('display', array('div' => false, 'left' => ' ', 'right' => '</div>', 'content' => '<a class="btn" href="' . ConfigController::$dataTableUrl . '"><i class="icon-arrow-left"></i>取消&返回</a>')))));
         $this->contentlayoutRender($form->render());
     }
 }
Ejemplo n.º 2
0
 public function modPassword()
 {
     $userInfo = $this->_user->getUserInfo();
     //D($userInfo);
     $uid = $userInfo['uid'];
     if ($uid == 0 && isset($uid)) {
         $this->alert('参数错误');
         return;
     }
     if ($this->isAjax() && $_POST) {
         $v = Doo::loadHelper('DooValidator', true);
         $success = true;
         $errors = array();
         $password = $_POST['password'];
         $password1 = $_POST['password1'];
         $password2 = $_POST['password2'];
         $pwd = $this->_user->password($password);
         //md5(KEY_PASSWORD.$password);
         if ($userInfo['passwd'] != $pwd) {
             $success = false;
             $errors[] = '密码不正确';
         }
         if (!isset($password1)) {
             $success = false;
             $errors[] = '新登陆密码不能为空';
         }
         if (!isset($password2)) {
             $success = false;
             $errors[] = '再次输入密码不能为空';
         }
         if ($password1 != $password2) {
             $success = false;
             $errors[] = '两次输入的密码不一致,请检查';
         }
         // 插入数据库(接口没有验证数据是否重复,需添加者自己注意)
         if ($success) {
             $result = $this->_user->update_pwd(1, $uid, $password1);
             if (isset($result) && $result != 0) {
                 $success = false;
                 $errors[] = '插入数据库出错,不可连续修改两次密码且不可与原密码相同';
             }
         }
         // 处理返回路径
         if ($success) {
             if (isset($_POST['saveAndReutrn'])) {
                 $errors = Doo::conf()->APP_URL . 'index.php/in';
             }
         }
         // 处理表单位提交
         $this->ajaxFormResult($success, $errors, true, 'loginOut');
     } else {
         //取某用户信息
         $row = $this->_user->get_one($uid);
         //D($row);
         // 显示生成表单
         Doo::loadClassAt('html/DooFormExt', 'default');
         $form = new DooFormExt($this->_getPasswordFormConfig(false, $row));
         $this->contentlayoutRender($form->render());
     }
 }
Ejemplo n.º 3
0
 public function dataTable()
 {
     Doo::loadClassAt('html/DataTable', 'default');
     Doo::loadClassAt('html/DooFormExt', 'default');
     $dt = new DataTable();
     $param['starttime'] = $this->getUrlVar('starttime', NULL);
     $param['endtime'] = $this->getUrlVar('endtime', NULL);
     //$param['bookid'] = $this->getUrlVar('bookid',NULL);
     $param['order'] = $this->getUrlVar('order', NULL);
     $param['bookname'] = $this->getUrlVar('bookname', NULL);
     //$param['booktypeid'] = $this->getUrlVar('booktypeid',0);
     $param['waimai'] = $this->getUrlVar('waimai', '2');
     $param['shopname'] = $this->getUrlVar('shopname', '');
     $export = $this->getUrlVar('export');
     // 表头
     $header = array('bookid' => array('name' => '菜品ID'), 'title' => array('name' => '菜品名称'), 'sum' => array('name' => '销量'), 'price' => array('name' => '微信单价'), 'totle' => array('name' => '总价'));
     //所有店列表
     $shopNameList = DBproxy::getProcedure('Manage')->setDimension(2)->getShopName();
     $shopNameOpt = '<select class="m-wrap" name="shopname" id="city-element"><option>全部门店</option>';
     foreach ($shopNameList as $key => $value) {
         $selected = $this->getUrlVar('shopname') == $value['cityid'] . ',' . $value['shopname'] ? 'selected=selected' : '';
         $shopNameOpt .= '<option ' . $selected . ' value="' . $value['cityid'] . ',' . $value['shopname'] . '">' . $value['cityNshopname'] . '</option>';
     }
     $shopNameOpt .= '</select>';
     $res = DBproxy::getProcedure('Manage')->setDimension(2)->queryOrderHit($param);
     $sum = 0;
     foreach ($res['data'] as $key => $value) {
         $sum += $value['sum'];
         $res['data'][$key]['totle'] = $value['sum'] * $value['price'];
     }
     // 生产表格
     $content = $dt->setTitle('')->setAttr(array('class' => 'table table-hover  ', 'id' => 'js-queryTable '))->setHeader($header)->setData($res['data'])->setTopContent('')->setBottomContent('')->setDefaultValue('unkown')->render(false);
     //查询表单
     $form = new DooFormExt(array('method' => 'get', 'renderFormat' => 'html', 'action' => '', 'attributes' => array('id' => 'js-get-form', 'class' => 'form-horizontal'), 'elements' => array('starttime' => array('text', array('left' => ' ', 'hide-label' => true, 'div' => false, 'placeholder' => '开始日期', 'attributes' => array('class' => "m-wrap", "onClick" => "WdatePicker()"), 'value' => $this->getUrlVar('starttime'))), 'endtime' => array('text', array('left' => ' ', 'hide-label' => true, 'div' => false, 'placeholder' => '结束日期', 'attributes' => array('class' => "m-wrap", "onClick" => "WdatePicker({maxDate:'%y-%M-%d'})"), 'value' => $this->getUrlVar('endtime'))), 'shopname' => array('display', array('left' => '', 'hide-label' => true, 'div' => false, 'attributes' => array('class' => 'small m-wrap'), 'content' => $shopNameOpt)), 'bookname' => array('text', array('left' => ' ', 'hide-label' => true, 'div' => false, 'placeholder' => '菜品名称', 'attributes' => array('class' => "m-wrap"), 'value' => $this->getUrlVar('bookname'))), 'waimai' => array('select', array('left' => ' 是否外卖', 'hide-label' => true, 'div' => false, 'attributes' => array('class' => 'small m-wrap'), 'multioptions' => array('2' => '全部', '1' => '是', '0' => '否'), 'value' => $this->getUrlVar('waimai'))), 'order' => array('select', array('left' => ' 点击量排序', 'hide-label' => true, 'div' => false, 'attributes' => array('class' => 'small m-wrap'), 'multioptions' => array('desc' => '多', 'asc' => '少'), 'value' => $this->getUrlVar('order'))), 'search' => array('button', array('div' => false, 'label' => '<i class="icon-search"></i>查询', 'attributes' => array('class' => "btn blue"), 'value' => 1)), 'export' => array('button', array('div' => false, 'label' => ' <i class="icon-export"></i> 导出', 'attributes' => array('class' => "btn black"), 'value' => 1)))));
     $sumDiv = '销售总数量:' . $sum;
     $content .= $sumDiv;
     //export
     if (trim($export) == 1) {
         exportExcel($content);
         exit;
     }
     // 显示模版
     $this->contentlayoutRender($form->render() . $content);
 }
Ejemplo n.º 4
0
 /**
  * 登录
  */
 public function in()
 {
     if ($this->_user->isLogin()) {
         $result = $this->_user->logout();
     }
     // 自动登录
     // if($this->_user->autoLogin()) {
     // 	$this->alert('自动登录成功','success');
     // 	return;
     // }
     if ($this->isAjax() && $_POST) {
         $result = $this->_user->login($_POST['username'], $_POST['password'], $_POST['safecode'], $_POST['lang'], isset($_POST['remember']) ? 1 : 0);
         $this->ajaxFormResult($result['success'], $result['success'] ? adminAppUrl('home') : $result['errors']);
     } else {
         Doo::loadClassAt('html/DooFormExt', 'default');
         $form = new DooFormExt(array('method' => 'post', 'renderFormat' => 'array', 'action' => '', 'attributes' => array('id' => 'js-form', 'class' => 'form-vertical login-form'), 'elements' => array('username' => array('text', array('hide-label' => FALSE, 'placeholder' => '用户名', 'attributes' => array('class' => "m-wrap placeholder-no-fix"))), 'lang' => array('select', array('multioptions' => Doo::conf()->langList, 'hide-label' => FALSE, 'attributes' => array('class' => "m-wrap small"))), 'password' => array('password', array('hide-label' => FALSE, 'placeholder' => '密码', 'attributes' => array('class' => "m-wrap placeholder-no-fix"))), 'remember' => array('checkbox', array('hide-label' => FALSE, 'div' => FALSE, 'attributes' => array('class' => ""))), 'safecode' => array('text', array('div' => FALSE, 'hide-label' => FALSE, 'placeholder' => '验证码', 'attributes' => array('class' => "m-wrap small"))))));
         $this->renderc($this->_templateDefault . '/login/in', $form->render());
     }
 }
Ejemplo n.º 5
0
 public function mod()
 {
     $configKey = 'settingConfig';
     if ($this->isAjax() && $_POST) {
         $v = Doo::loadHelper('DooValidator', true);
         $success = true;
         $errors = array();
         DOO::cache('php')->set($configKey, json_encode($_POST), 3600 * 24 * 365 * 100);
         // 处理返回路径
         if ($success) {
             $errors = ConfigController::$dataTableUrl;
         }
         $this->ajaxFormResult($success, $errors);
     } else {
         Doo::loadClassAt('html/DooFormExt', 'default');
         $infoCache = DOO::cache('php')->get($configKey);
         $info = json_decode($infoCache, true);
         $form = new DooFormExt(array('method' => 'post', 'renderFormat' => 'html', 'action' => '', 'attributes' => array('id' => 'js-form', 'class' => 'form-horizontal'), 'elements' => array('errors' => array('display', array('div' => false, 'label' => false, 'content' => '<div id="js-form-errors" class=""></div><div style="clear:both"></div>')), 'peiSum' => array('text', array('label' => '菜品调剂数', 'attributes' => array('class' => "m-wrap"), 'value' => isset($info['peiSum']) ? $info['peiSum'] : '', 'help' => '根据历史的订单加上这个数量,作为菜品配送数')), 'shopMaster' => array('text', array('label' => '店长微信openid', 'attributes' => array('class' => "m-wrap"), 'value' => isset($info['shopMaster']) ? $info['shopMaster'] : '', 'help' => '可以根据店长订餐时绑定的电话号码,从用户列表中查到店长的微信openid')), 'saveAndSee' => array('button', array('div' => false, 'left' => ' ', 'label' => '保存&查看<i class="icon-arrow-right"></i>', 'attributes' => array('class' => "btn blue"), 'value' => 1)), 'cancelAndReturn' => array('display', array('div' => false, 'left' => ' ', 'right' => '</div>', 'content' => '<a class="btn" href="' . ConfigController::$dataTableUrl . '"><i class="icon-arrow-left"></i>取消&返回</a>')))));
         $this->contentlayoutRender($form->render());
     }
 }
Ejemplo n.º 6
0
 public function login()
 {
     Doo::loadClassAt('html/DataTable', 'default');
     Doo::loadClassAt('html/DooFormExt', 'default');
     $dt = new DataTable();
     $form = new DooFormExt(array('method' => 'get', 'renderFormat' => 'html', 'action' => '', 'attributes' => array('id' => 'js-get-form', 'class' => 'form-horizontal'), 'elements' => array('code' => array('text', array('left' => ' ', 'hide-label' => true, 'div' => false, 'placeholder' => '登陆验证码', 'attributes' => array('class' => "m-wrap"), 'value' => '')), 'search' => array('button', array('div' => false, 'label' => '<i class="icon-search"></i>提交', 'attributes' => array('class' => "btn blue"), 'value' => 1)))));
     $uname = $this->getCacheUrlVar('uname');
     //用户账号
     $code = trim($this->getUrlVar('code', ''));
     //登陆验证码
     $codeConf = Doo::conf()->code;
     //登陆验证码(配置文件)
     if (!empty($code)) {
         if ($code == $codeConf) {
             $this->_user->accountLogin($uname);
         } else {
             $this->alert('验证码错误', 'ERROR', false);
         }
     }
     $content = $dt->setTitle('')->setAttr(array('class' => 'table'))->setDefaultValue('unkown')->setTopContent('<a href="' . UserController::$addUrl . '" class="btn green-stripe"><i class="icon-plus"></i>返回列表</a>' . $form->render())->render(false);
     $this->contentlayoutRender($content);
 }
Ejemplo n.º 7
0
 public function mod()
 {
     $id = (int) $this->getUrlVar('id');
     $res = DBproxy::getProcedure('Manage')->setDimension(2)->getBook(array('id' => $id), '1');
     if (empty($res)) {
         $this->alert('data null');
     }
     if ($this->isAjax() && $_POST) {
         $v = Doo::loadHelper('DooValidator', true);
         $success = true;
         $errors = array();
         $rules = $this->_getFormRule();
         // 验证数据
         if ($errors = $v->validate($_POST, $rules)) {
             $success = false;
         }
         //数据处理
         if ($success) {
             //图片处理
             $img = '';
             Doo::loadClassAt('Picupload', 'default');
             $Picupload = new Picupload();
             $imgRes = $Picupload->upload('img');
             if ($imgRes) {
                 $img = $Picupload::$picinfo['dirname'] . '/' . $Picupload::$picinfo['basename'];
             } else {
                 $img = trim($_POST['img']);
             }
             //数据处理
             $param['categoryid'] = intval($_POST['categoryid']);
             $param['name'] = trim($_POST['name']);
             $param['sort'] = intval($_POST['sort']);
             $param['status'] = intval($_POST['status']);
             $param['la'] = trim($_POST['la']);
             $param['descript'] = trim($_POST['descript']);
             $param['img'] = $img;
             $param['price'] = trim($_POST['price']);
             $param['wxprice'] = trim($_POST['wxprice']);
             $param['peiSongSum'] = intval($_POST['peiSongSum']);
             $res = DBproxy::getProcedure('Manage')->setDimension(2)->bookIU('u', $param, $id);
             if ($res['status'] != 0) {
                 $success = false;
                 $errors[] = 'DB异常!';
             }
         }
         // 处理返回路径
         if ($success) {
             if (isset($_POST['saveAndReutrn'])) {
                 $errors = BookController::$dataTableUrl;
             } else {
                 $errors = BookController::$addUrl;
             }
         }
         // 处理表单位提交
         $this->ajaxFormResult($success, $errors);
     } else {
         // 显示生成表单
         Doo::loadClassAt('html/DooFormExt', 'default');
         $form = new DooFormExt($this->_getFormConfig(false, $res['data'][0]));
         $btn = '<a class="btn green-stripe" href="' . BookController::$dataTableUrl . '"><i class="icon-backward"> </i>' . L('列表') . '</a>';
         // 显示模版
         $this->contentlayoutRender($btn . $form->render());
     }
 }
Ejemplo n.º 8
0
 public function mod()
 {
     $id = (int) $this->getUrlVar('id');
     $res = DBproxy::getProcedure('Manage')->setDimension(2)->getMap(array('id' => $id));
     if (!isset($res['data']) || empty($res['data'])) {
         $this->alert('data null');
         die;
     }
     if ($this->isAjax() && $_POST) {
         $v = Doo::loadHelper('DooValidator', true);
         $success = true;
         $errors = array();
         $rules = $this->_getFormRule();
         // 验证数据
         if ($errors = $v->validate($_POST, $rules)) {
             $success = false;
         }
         if ($success) {
             //数据处理
             $param['name'] = trim($_POST['name']);
             $param['city'] = trim($_POST['city']);
             $param['longitude'] = intval($_POST['longitude']);
             $param['latitude'] = intval($_POST['latitude']);
             $param['status'] = intval($_POST['status']);
             $res = DBproxy::getProcedure('Manage')->setDimension(2)->mapIU('u', $param, $id);
             if ($res['status'] != 0) {
                 $success = false;
                 $errors[] = 'DB异常!';
             }
         }
         // 处理返回路径
         if ($success) {
             if (isset($_POST['saveAndReutrn'])) {
                 $errors = MapController::$dataTableUrl;
             } else {
                 $errors = MapController::$addUrl;
             }
         }
         // 处理表单位提交
         $this->ajaxFormResult($success, $errors);
     } else {
         // 显示生成表单
         Doo::loadClassAt('html/DooFormExt', 'default');
         $form = new DooFormExt($this->_getFormConfig(false, $res['data'][0]));
         $btn = '<a class="btn green-stripe" href="' . MapController::$dataTableUrl . '"><i class="icon-backward"> </i>门店列表</a>';
         // 显示模版
         $this->contentlayoutRender($btn . $form->render());
     }
 }
Ejemplo n.º 9
0
 public function mod()
 {
     $id = (int) $this->getUrlVar('id');
     $param['id'] = intval($id);
     $res = DBproxy::getProcedure('Manage')->setDimension(2)->getPeiSongList($param);
     if (empty($res)) {
         $this->alert('data error');
         die;
     }
     if ($this->isAjax() && $_POST) {
         $v = Doo::loadHelper('DooValidator', true);
         $success = true;
         $errors = array();
         $rules = $this->_getFormRule();
         // 验证数据
         if ($errors = $v->validate($_POST, $rules)) {
             $success = false;
         }
         //数据处理
         $param['cityid'] = intval($_POST['city']);
         $param['shopname'] = trim($_POST['shopname']);
         $param['shopNamePhone'] = make_semiangle(trim($_POST['shopNamePhone']));
         $param['peisongPhone'] = make_semiangle(trim($_POST['peisongPhone']));
         $list = DBproxy::getProcedure('Manage')->setDimension(2)->getPeiSongIU('u', $param, $param['id']);
         if ($list['status'] != 0) {
             $success = false;
             $errors[] = L('添加失败!DB异常!');
         }
         // 处理返回路径
         if ($success) {
             if (isset($_POST['saveAndReutrn'])) {
                 $errors = PeiSongController::$dataTableUrl;
             } else {
                 $errors = PeiSongController::$addUrl;
             }
         }
         // 处理表单位提交
         $this->ajaxFormResult($success, $errors);
     } else {
         // 显示生成表单
         Doo::loadClassAt('html/DooFormExt', 'default');
         $form = new DooFormExt($this->_getFormConfig(false, $res[0]));
         $btn = '<a class="btn green-stripe" href="' . PeiSongController::$dataTableUrl . '"><i class="icon-backward"> </i>' . L('列表') . '</a>';
         // 显示模版
         $this->contentlayoutRender($btn . $form->render());
     }
 }
Ejemplo n.º 10
0
 public function mod()
 {
     $id = $_GET['id'];
     $info = $_GET;
     $page_url = urldecode($_GET['page_url']);
     $info['page_url'] = $page_url;
     Doo::loadClassAt('Menu', 'default');
     $menu = new menu(DBproxy::getManage());
     //通过url传递id值查询数据库
     if ($this->isAjax() && $_POST) {
         $v = Doo::loadHelper('DooValidator', true);
         $success = true;
         $errors = array();
         $rules = $this->_getFormRule();
         // 验证数据
         if ($errors = $v->validate($_POST, $rules)) {
             $success = false;
         }
         //验证权限
         $permission = isset($_POST['permission']) ? array_sum($_POST['permission']) : 0;
         if ($permission == 0) {
             $success = false;
             $errors = '请选择用户权限';
         }
         // 插入数据库
         if ($success) {
             $param = array('menu_name' => trim($_POST['menu_name']), 'sort_id' => $_POST['sort_id'], 'type_id' => $_POST['type_id'], 'perm_id' => $permission, 'is_show' => $_POST['is_show'], 'url' => $_POST['page_url'], 'parent_id' => $_POST['parent_id']);
             $res = $menu->menuEdit($id, $param);
             if ($res['status'] == 0) {
                 //$id = $res['id'];
             } else {
                 $success = false;
                 $errors[] = '插入数据库出错';
             }
         }
         // 处理返回路径
         if ($success) {
             if (isset($_POST['saveAndReutrn'])) {
                 $errors = MenuController::$dataTableUrl;
             } else {
                 $errors = MenuController::$addUrl;
             }
         }
         // 处理表单位提交
         $this->ajaxFormResult($success, $errors);
     } else {
         $data = $menu->getMenuTreeList();
         //D($data);
         // 显示生成表单
         Doo::loadClassAt('html/DooFormExt', 'default');
         $form = new DooFormExt($this->_getFormConfig(false, $data, $info));
         array_push($this->_includeJsFileList, 'js/default/sysMenu.js');
         $this->contentlayoutRender('<a class="btn blue-stripe" href="' . MenuController::$dataTableUrl . '"><i class="icon-plus"></i>添加菜单</a>' . $form->render());
     }
 }
Ejemplo n.º 11
0
 public function mod()
 {
     $id = (int) $this->getUrlVar('id');
     $res = DBproxy::getProcedure('Manage')->setDimension(2)->getUserInfo(array('userid' => $id));
     if (!isset($res['data'][0]) || empty($res['data'][0])) {
         $this->alert('data null');
         die;
     }
     //所有店列表
     $shopNameList = DBproxy::getProcedure('Manage')->setDimension(2)->getShopName();
     $shopNameOpt = '<select class="m-wrap" name="shopname" id="city-element"><option>无</option>';
     foreach ($shopNameList as $key => $value) {
         $selected = $res['data'][0]['cityid'] . ',' . $res['data'][0]['shopname'] == $value['cityid'] . ',' . $value['shopname'] ? 'selected=selected' : '';
         $shopNameOpt .= '<option ' . $selected . ' value="' . $value['cityid'] . ',' . $value['shopname'] . '">' . $value['cityNshopname'] . '</option>';
     }
     $shopNameOpt .= '</select>';
     UserController::$shopList = $shopNameOpt;
     if ($this->isAjax() && $_POST) {
         // $v = Doo::loadHelper('DooValidator', true);
         $success = true;
         // $errors = array();
         // $rules = $this->_getFormRule();
         // // 验证数据
         // if ($errors = $v->validate($_POST, $rules)) {
         //     $success = false;
         // }
         //数据处理
         $cityNshopnameArr = explode(',', trim($_POST['shopname']));
         $param['userid'] = intval($id);
         $param['cityid'] = $cityNshopnameArr[0];
         $param['shopname'] = $cityNshopnameArr[1];
         $param['phone'] = trim($_POST['phone']);
         $param['addr'] = trim($_POST['addr']);
         $res = DBproxy::getProcedure('Manage')->setDimension(2)->saveUserInfo($param);
         if ($res['status'] != 0) {
             $success = false;
             $errors[] = 'DB异常!';
         }
         // 处理返回路径
         if ($success) {
             $errors = UserController::$modUrl . $id;
         }
         // 处理表单位提交
         $this->ajaxFormResult($success, $errors);
     } else {
         // 显示生成表单
         Doo::loadClassAt('html/DooFormExt', 'default');
         $form = new DooFormExt($this->_getFormConfig(false, $res['data'][0]));
         $btn = '<a class="btn green-stripe" href="' . UserController::$dataTableUrl . '"><i class="icon-backward"> </i>用户信息</a>';
         // 显示模版
         $this->contentlayoutRender($btn . $form->render());
     }
 }
Ejemplo n.º 12
0
 public function mod()
 {
     $id = (int) $this->getUrlVar('id');
     Doo::loadClassAt('Role', 'default');
     $role = new role();
     $data = $role->get_one($id);
     if (empty($data)) {
         $this->alert('没有找到数据');
         return;
     }
     if ($this->isAjax() && $_POST) {
         $v = Doo::loadHelper('DooValidator', true);
         $success = true;
         $errors = array();
         //D($postData);
         $rules = array('name' => array(array('required', "请填写角色名"), array('minlength', 2, "角色名最少长度不允许少于2个字节"), array('maxlength', 12, "角色名最大长度不允许大于12个字节")), 'perm' => array(array('required', "请勾选角色权限")));
         // 验证数据
         if ($errors = $v->validate($_POST, $rules)) {
             $success = false;
         }
         // 插入角色数据
         if ($success) {
             $role = Doo::loadClass('Role', true);
             $_POST['id'] = $id;
             list($success, $errors) = array_values($role->update($_POST));
         }
         // 处理返回路径
         if ($success) {
             if (isset($_POST['saveAndReutrn'])) {
                 $errors = RoleController::$dataTableUrl;
             } else {
                 if (isset($_POST['saveAndSee'])) {
                     $errors = RoleController::$modUrl . $errors;
                 } else {
                     $errors = RoleController::$addUrl;
                 }
             }
         }
         $this->ajaxFormResult($success, $errors);
     } else {
         Doo::loadClassAt('html/DooFormExt', 'default');
         Doo::loadClassAt('Menu', 'default');
         $menu = new Menu(DBproxy::getManage());
         $perms = $role->get_role_perm($id);
         $menus = $menu->get_menu_formlists($perms);
         // 引入树状css
         array_push($this->_includeCssFileList, 'css/tree.css');
         $form = new DooFormExt(array('method' => 'post', 'renderFormat' => 'html', 'action' => '', 'attributes' => array('id' => 'js-form', 'class' => 'form-horizontal'), 'elements' => array('errors' => array('display', array('div' => false, 'label' => false, 'content' => '<div id="js-form-errors" class=""></div><div style="clear:both"></div>')), 'name' => array('text', array('label' => '角色名', 'attributes' => array('class' => "m-wrap"), 'value' => $data[0]['name'])), 'menus' => array('display', array('label' => '菜单', 'content' => '<div style="width:800px;height:500px;overflow-y:auto;" class="tree-wrapper">' . $menus . '</div>')), 'saveAndReutrn' => array('button', array('div' => false, 'left' => '<div class="form-actions js-submitButton">', 'label' => '<i class="icon-arrow-left"></i>保存&返回', 'attributes' => array('class' => "btn blue"), 'value' => 1)), 'saveAndSee' => array('button', array('div' => false, 'left' => ' ', 'label' => '保存&查看<i class="icon-arrow-right"></i>', 'attributes' => array('class' => "btn blue"), 'value' => 1)), 'cancelAndReturn' => array('display', array('div' => false, 'left' => ' ', 'right' => '</div>', 'content' => '<a class="btn" href="' . RoleController::$dataTableUrl . '"><i class="icon-arrow-left"></i>取消&返回</a>')))));
         $this->contentlayoutRender($form->render());
     }
 }
Ejemplo n.º 13
0
 private function edit_status($btn, $id, $value)
 {
     Doo::loadClassAt('html/DataTable', 'default');
     Doo::loadClassAt('html/DooFormExt', 'default');
     $statusArr = OrderController::$status;
     unset($statusArr['']);
     //修改表单
     $form = new DooFormExt(array('method' => 'post', 'renderFormat' => 'html', 'action' => '', 'attributes' => array('id' => 'js-form', 'class' => 'form-horizontal'), 'elements' => array('href' => array('display', array('hide-label' => true, 'div' => false, 'attributes' => array('class' => 'small m-wrap'), 'content' => $btn)), 'status' => array('select', array('left' => ' 订单状态:', 'hide-label' => true, 'div' => false, 'attributes' => array('class' => 'small m-wrap'), 'multioptions' => $statusArr, 'value' => $value)), 'submit' => array('button', array('div' => false, 'label' => ' <i class="icon-export"></i> 修改', 'attributes' => array('class' => "btn black"), 'value' => 1)))));
     return $form->render();
 }