Example #1
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['city'] = $this->getUrlVar('city', 0);
     $param['shopname'] = $this->getUrlVar('shopname', '');
     $export = $this->getUrlVar('export');
     // 表头
     $header = array('bookname' => array('name' => '菜品名称'), 'cc' => 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)->queryHit($param);
     $sum = 0;
     foreach ($res['data'] as $key => $value) {
         $sum += $value['cc'];
     }
     // 生产表格
     $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'))), 'city' => array('display', array('hide-label' => true, 'div' => false, 'attributes' => array('class' => "m-wrap"), 'content' => LogController::$city)), 'shopname' => array('display', array('left' => '', 'hide-label' => true, 'div' => false, 'attributes' => array('class' => 'small m-wrap'), 'content' => $shopNameOpt)), 'booktypeid' => array('display', array('left' => ' 菜品分类', 'hide-label' => true, 'div' => false, 'attributes' => array('class' => "m-wrap"), 'content' => '<select id="booktypeid-element" name="booktypeid" class="m-wrap"><option>全部菜品</option>' . Category::cateToOption($param['booktypeid']) . '</select>')), 'bookname' => array('text', array('left' => ' ', 'hide-label' => true, 'div' => false, 'placeholder' => '菜品名称', 'attributes' => array('class' => "m-wrap"), 'value' => $this->getUrlVar('bookname'))), 'bookid' => array('text', array('left' => ' ', 'hide-label' => true, 'div' => false, 'placeholder' => '菜品id', 'attributes' => array('class' => "m-wrap"), 'value' => $this->getUrlVar('bookid'))), '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);
 }
Example #2
0
 /**
  * 取得表单配置
  * @param  boolean $isInsert 1 是插入表单配置,0 是修改表单
  * @param  array   $data    修改表单时传入数组
  * @return array
  */
 protected function _getFormConfig($isInsert = true, $data = array())
 {
     Doo::loadClassAt('DataExt', 'default');
     $dataExt = new DataExt();
     $id = isset($data['categoryid']) ? $data['categoryid'] : '';
     $insertForm = array('method' => 'post', 'renderFormat' => 'html', 'action' => '', 'attributes' => array('id' => 'js-form', 'class' => 'form-horizontal'), 'elements' => array('errors' => array('display', array('div' => false, 'label-hide' => true, 'content' => '<div id="js-form-errors" class=""></div><div style="clear:both"></div>')), 'categoryid' => array('display', array('label' => L('父分类:'), 'attributes' => array('class' => "m-wrap"), 'content' => '<select id="categoryid-element" name="categoryid" class="m-wrap">' . Category::cateToOption($id) . '</select>')), 'name' => array('text', array('label' => L('名称:'), 'attributes' => array('class' => "m-wrap"), 'value' => '')), 'price' => array('text', array('label' => L('价格'), 'attributes' => array('class' => "m-wrap"), 'value' => 0)), 'wxprice' => array('text', array('label' => L('微信预定价格'), 'attributes' => array('class' => "m-wrap"), 'value' => 0)), 'peiSongSum' => array('text', array('label' => L('配送调度数'), 'attributes' => array('class' => "m-wrap"), 'value' => 10)), 'la' => array('text', array('label' => L('辣程序(越高越辣)'), 'attributes' => array('class' => "m-wrap"), 'value' => 0)), 'sort' => array('text', array('label' => L('排序:'), 'attributes' => array('class' => "m-wrap"), 'value' => '', 'help' => '数字越大排越前')), 'status' => array('select', array('label' => L('可用状态:'), 'attributes' => array('class' => "m-wrap"), 'multioptions' => BookController::$status, 'value' => 0)), 'descript' => array('text', array('label' => L('描述'), 'attributes' => array('class' => "m-wrap"), 'value' => '')), 'img' => array('file', array('label' => L('菜品图片:'), 'attributes' => array('class' => "m-wrap"), 'help' => '图片规格:(宽*高)640*480px,大小200-300k左右')), '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)), 'saveAndAdd' => array('button', array('div' => false, 'left' => ' ', 'label' => '<i class="icon-plus"></i>保存&新增', 'attributes' => array('class' => "btn blue"), 'value' => 1)), 'cancel' => array('display', array('div' => false, 'left' => ' ', 'content' => '<a class="btn" href="' . $_SERVER['REQUEST_URI'] . '"><i class="icon-undo"></i>取消</a>')), 'cancelAndReturn' => array('display', array('div' => false, 'left' => ' ', 'right' => '</div>', 'content' => '<a class="btn" href="' . BookController::$dataTableUrl . '"><i class="icon-arrow-left"></i>取消&返回</a>'))));
     if ($isInsert) {
         return $insertForm;
     } else {
         #$insertForm['elements']['img'][1]['help'].= '<label class="m-wrap text"><img style="height:100px" src="' . Doo::conf()->APP_URL.$data['img'] . '"> <input type="hidden" name="img" id="img-element" value="' . $data['img'] . '"> </label>';
         #$insertForm['elements']['img'][0] = 'display';
         #$insertForm['elements']['img'][1]['content'] = '<label class="m-wrap text"><img style="height:100px" src="' . Doo::conf()->APP_URL.$data['img'] . '"> <input type="hidden" name="img" id="img-element" value="' . $data['img'] . '"> </label>';
         // 将数据写入表单
         foreach ($data as $key => $val) {
             if (isset($insertForm['elements'][$key])) {
                 $insertForm['elements'][$key][1]['value'] = $val;
             }
         }
         $insertForm['elements']['img'][1]['help'] .= '<label class="m-wrap text"><img style="height:100px" src="' . Doo::conf()->APP_URL . $data['img'] . '"> <input type="hidden" name="img" id="img-element" value="' . $data['img'] . '"> </label>';
         $insertForm['elements']['img'][1]['value'] = '';
         return $insertForm;
     }
 }
Example #3
0
 /**
  * 取得表单配置
  * @param  boolean $isInsert 1 是插入表单配置,0 是修改表单
  * @param  array   $data    修改表单时传入数组
  * @return array
  */
 protected function _getFormConfig($isInsert = true, $data = array(), $info = array())
 {
     Doo::loadClassAt('DataExt', 'default');
     $dataExt = new DataExt();
     $id = isset($data['parentid']) ? $data['parentid'] : '';
     $insertForm = array('method' => 'post', 'renderFormat' => 'html', 'action' => '', 'attributes' => array('id' => 'js-form', 'class' => 'form-horizontal'), 'elements' => array('errors' => array('display', array('div' => false, 'label-hide' => true, 'content' => '<div id="js-form-errors" class=""></div><div style="clear:both"></div>')), 'parentid' => array('display', array('label' => L('父分类:'), 'attributes' => array('class' => "m-wrap"), 'content' => '<select id="parentid-element" name="parentid" class="m-wrap"><option value="0">' . L('顶级父类') . '</option>' . Category::cateToOption($id, false) . '</select>')), 'name' => array('text', array('label' => L('分类名称:'), 'attributes' => array('class' => "m-wrap"), 'value' => '')), 'status' => array('select', array('label' => L('可用状态:'), 'attributes' => array('class' => "m-wrap"), 'multioptions' => CategoryController::$status, 'value' => 0)), 'city' => array('display', array('label' => L('所属城市:'), 'attributes' => array('class' => "m-wrap"), 'content' => CategoryController::$city)), 'sort' => array('text', array('label' => L('排序:'), 'attributes' => array('class' => "m-wrap"), 'value' => '0')), 'opentimeDay' => array('select', array('label' => L('开始预定日期:'), 'attributes' => array('class' => "m-wrap"), 'multioptions' => array(0 => '当天'), 'value' => 0)), 'opentime' => array('text', array('label' => L('开始预定时间:'), 'attributes' => array('class' => "m-wrap"), 'value' => '', 'help' => '24小时格式,例子 9:00')), 'endtime' => array('text', array('label' => L('结束预定时间:'), 'attributes' => array('class' => "m-wrap"), 'value' => '', 'help' => '24小时格式,例子 12:00')), 'waimaiEndtime' => array('text', array('label' => L('结束外卖预定时间:'), 'attributes' => array('class' => "m-wrap"), 'value' => '', 'help' => '24小时格式,例子 9:00')), 'endSaleTime' => array('text', array('label' => L('结束售卖时间:'), 'attributes' => array('class' => "m-wrap"), 'value' => '', 'help' => '24小时格式,例子 12:00')), 'saveAndReutrn' => array('button', array('div' => false, 'left' => '<div class="form-actions js-submitButton">', 'label' => '<i class="icon-arrow-left"></i>' . L('保存&返回'), 'attributes' => array('class' => "btn blue"), 'value' => 1)), 'saveAndAdd' => array('button', array('div' => false, 'left' => ' ', 'label' => '<i class="icon-plus"></i>' . L('保存&新增'), 'attributes' => array('class' => "btn blue"), 'value' => 1)), 'cancel' => array('display', array('div' => false, 'left' => ' ', 'content' => '<a class="btn" href="' . $_SERVER['REQUEST_URI'] . '"><i class="icon-undo"></i>' . L('取消') . '</a>')), 'cancelAndReturn' => array('display', array('div' => false, 'left' => ' ', 'right' => '</div>', 'content' => '<a class="btn" href="' . CategoryController::$dataTableUrl . '"><i class="icon-arrow-left"></i>' . L('取消&返回') . '</a>'))));
     if ($isInsert) {
         return $insertForm;
     } else {
         // 将数据写入表单
         foreach ($data as $key => $val) {
             if (isset($insertForm['elements'][$key])) {
                 if ($key == 'name') {
                     $val = $data['cname'];
                 }
                 $insertForm['elements'][$key][1]['value'] = $val;
             }
         }
         $insertForm['elements']['city'][1]['content'] = '<select class="m-wrap" name="city" id="city-element"><option value="0">' . L('顶级城市') . '</option>' . City::cateToOption($data['city'], false) . '</select>';
         return $insertForm;
     }
 }
Example #4
0
 /**
  * 更新所有分类的,所有子类,父类,是否有子类
  *@return bool
  */
 public function changeCategory()
 {
     Doo::loadClassAt('Category', 'default');
     $name = Category::cateToOption(0, false, 'array');
     foreach ($name as $key => $value) {
         $arrparent = trim($value['arrparentid']) == '' ? 0 : trim($value['arrparentid']);
         $upSql = "UPDATE `type` SET `child` = '" . intval($value['child']) . "' ,\n                        `arrparentid`='" . $arrparent . "' ,\n                        `arrchildid`='" . trim($value['arrchildid']) . "' \n                    WHERE `id` = '" . intval($value['id']) . "'";
         self::execute($upSql, 'u');
     }
     return array('status' => 0);
 }