public function init() { Doo::loadClassAt('Category', 'default'); Doo::loadClassAt('City', 'default'); BookController::$dataTableUrl = adminAppUrl('operation/book/dataTable'); BookController::$addUrl = adminAppUrl('operation/book/add'); BookController::$modUrl = adminAppUrl('operation/book/mod?id='); BookController::$delUrl = adminAppUrl('operation/book/del?id='); BookController::$city = '<select class="m-wrap" name="city" id="city-element"><option value="0">' . L('全部城市') . '</option>' . City::cateToOption($this->getUrlVar('city'), 1) . '</select>'; }
public function init() { OrderController::$status = array('' => '全部') + Doo::conf()->wxStatus; Doo::loadClassAt('City', 'default'); OrderController::$dataTableUrl = adminAppUrl('operation/order/dataTable'); OrderController::$addUrl = adminAppUrl('operation/order/add'); OrderController::$modUrl = adminAppUrl('operation/order/mod?id='); OrderController::$delUrl = adminAppUrl('operation/order/del?id='); OrderController::$city = '<select class="m-wrap" name="city" id="city-element"><option value="0">' . L('顶级城市') . '</option>' . City::cateToOption($this->getUrlVar('city'), false) . '</select>'; }
/** * 取得表单配置 * @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(); $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>')), 'cityid' => array('display', array('label' => L('所属城市:'), 'attributes' => array('class' => "m-wrap"), 'content' => PeiSongController::$city)), 'shopname' => array('text', array('label' => L('店名:'), 'attributes' => array('class' => "m-wrap"), 'value' => '')), 'shopNamePhone' => array('text', array('label' => L('店长电话:'), 'attributes' => array('class' => "m-wrap"), 'value' => '')), 'peisongPhone' => array('text', array('label' => L('配送间电话:'), 'attributes' => array('class' => "m-wrap"), 'value' => '')), '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="' . PeiSongController::$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']['cityid'][1]['content'] = '<select class="m-wrap" name="city" id="city-element"><option value="0">' . L('顶级城市') . '</option>' . City::cateToOption($data['cityid'], false) . '</select>'; return $insertForm; } }
/** * 取得表单配置 * @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; } }
/** * 更新所有分类的,所有子类,父类,是否有子类 *@return bool */ public function changeCity() { Doo::loadClassAt('City', 'default'); $name = City::cateToOption(0, false, 'array'); foreach ($name as $key => $value) { $arrparent = trim($value['arrparentid']) == '' ? 0 : trim($value['arrparentid']); $upSql = "UPDATE `citylist` 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); }