public function handle_request_internel() { $params = $this->getParam(); $itemcode = 0; if (!empty($params['itemparent'])) { $itemcode = $params['itemparent']; } if (!empty($params['itemchild'])) { $itemcode = $params['itemchild']; } if (!empty($params['itemchildc'])) { $itemcode = $params['itemchildc']; } $datacount = Bll_Menus::get_menus_info_with_item_parent_count($itemcode, null, $params['searchText']); if ($datacount > 0) { $page = isset($params['p']) ? (int) $params['p'] : 1; if ($this->request->is_post_method()) { $page = 1; } $page_size = 10; $show_num = 10; $datainfo = Bll_Menus::get_menus_info_with_item_parent_info($itemcode, null, $params['searchText'], $page, $page_size); $this->setAttribute('datainfo', $datainfo); $m_url = $this->build_url(__CLASS__); $this->set_multipage($page, $page_size, $datacount, $m_url, $show_num, $params); } $this->setAttribute('params', $params); $this->setAttribute('datacount', $datacount); return 'Menus_List'; }
public function handle_request_internel() { $self_uri = $this->get_uri(); $self_url = $this->build_page_url($self_uri); $apf = APF::get_instance(); $params = $this->request->get_parameters(); $app_send_os = $apf->get_config('app_send_os'); $app_send_prefer = $apf->get_config('app_send_prefer'); $request_uri = explode("/", $this->request->get_request_uri()); $curr_page = $request_uri[3] ? intval($request_uri[3]) : 1; $plan_bll = BLL_AppPlan::get_instance(); $plan_count = $plan_bll->countPlans(); $offset = ($curr_page - 1) * $this->pagesize; $data = $plan_bll->getPlanlist('', '', $offset, $this->pagesize); $page_count = ceil(intval($plan_count) / intval($this->pagesize)); $merge_rows = $this->mergeRows($data); $this->request->set_attribute("data", $data); $this->request->set_attribute("merge_rows", $merge_rows); $this->request->set_attribute("listcount", $plan_count); $this->request->set_attribute("app_send_os", $app_send_os); $this->request->set_attribute("app_send_prefer", $app_send_prefer); $this->request->set_attribute('pageTotalNum', $page_count); $this->request->set_attribute('page', $curr_page); $this->request->set_attribute('nowurl', $self_uri); $this->request->set_attribute('self_url', $self_url); $this->request->set_attribute('prev_url', $curr_page > 1 ? $self_url . ($curr_page - 1) : '#'); $this->request->set_attribute('next_url', $curr_page >= $page_count ? '#' : $self_url . ($curr_page + 1)); $userId = $this->get_user_id(); //最近使用菜单 $menus_total_info = Bll_Menus::get_user_last_menus_info($userId); $this->setAttribute("menus_total_info", $menus_total_info); return 'App_Index'; }
public function handle_request_internel() { $userId = $this->get_user_id(); //最近使用菜单 $menus_total_info = Bll_Menus::get_user_last_menus_info($userId); $this->setAttribute("menus_total_info", $menus_total_info); return 'Home_Home'; }
public function handle_request_internel() { $userId = $this->get_user_id(); //最近使用菜单 $menus_total_info = Bll_Menus::get_user_last_menus_info($userId); $this->setAttribute("menus_total_info", $menus_total_info); //推荐功能code $recommendMenus = $this->get_config('recommend_menus', 'menus'); $recommendMenusInfo = Dao_Menus::get_menus_by_codes($recommendMenus); $this->setAttribute('recommendMenusInfo', $recommendMenusInfo); return 'Home_Home'; }
public function handle_request_internel() { $params = $this->getParam(); $res = $this->_res; switch ($params['type']) { case 'getitem': if (!empty($params['itemcode']) && !empty($params['itemtype'])) { $result = Bll_Menus::get_menus_info_with_item_parent($params['itemcode'], $params['itemtype']); $html = '<option value="0">全部</option>'; foreach ($result as $resultKey => $resultVal) { $b = intval($resultVal['item_deepth']) + 1; $html .= '<option b="' . $b . '" value="' . $resultVal['item_code'] . '">' . $resultVal['item_title'] . '</option>'; } $res = $this->init_res($html); } break; case 'getitemnew': if (!empty($params['itemcode']) && !empty($params['itemtype'])) { $result = Bll_Menus::get_menus_info_with_item_parent($params['itemcode'], $params['itemtype']); $html = ''; foreach ($result as $resultKey => $resultVal) { $b = intval($resultVal['item_deepth']) + 1; $html .= '<li><a b="' . $b . '" p="' . $resultVal['item_code'] . '" href="javascript:void(0);">' . $resultVal['item_title'] . '</a></li>'; } $res = $this->init_res($html); } break; case 'getitemcode': if (!empty($params['itemdeepth']) && !empty($params['itemcode'])) { $result = Bll_Menus::get_new_menus_with_item($params['itemcode'], $params['itemdeepth']); if (empty($result)) { $maxitemcode = str_pad($params['itemcode'], intval($params['itemdeepth']) * 3, "0", STR_PAD_RIGHT); $maxitemcode = str_pad($maxitemcode, intval($params['itemdeepth']) * 3 + 1, "1", STR_PAD_RIGHT); } else { $maxitemcode = $this->addManiac($result, 1); } $res = $this->init_res($this->itemcode_prep_replace($maxitemcode)); } break; case 'getitemparent': if (!empty($params['itemparentcode'])) { $result = Bll_Menus::get_menus_parent($params['itemparentcode']); $res = $this->init_res(json_encode($result)); } break; case 'modify': if (!empty($params['itemid']) && !empty($params['itemname']) && (!empty($params['itemurl']) || $params['itemdeepth'] != 4)) { $ch = Bll_Menus::check_data_is_exist($params['itemid']); if ($ch > 0) { $ch_url = Bll_Menus::check_data_is_exist_with_url($params['itemurl'], $params['itemid'], intval($params['itemdeepth'])); if (empty($ch_url)) { $data = array('item_title' => $params['itemname'], 'item_url' => $params['itemurl']); if (!empty($params['newitemcode'])) { $data = array_merge($data, array('item_parent' => $params['newitemcode'])); } $iswhere = array('id' => $params['itemid']); $result = Bll_Menus::update_data_row($data, $iswhere); $res = $this->init_res($result); } else { $this->_res['mes'] = 'URL地址已存在'; $res = $this->_res; } } else { $this->_res['mes'] = '没有该条数据'; $res = $this->_res; } } else { $this->_res['mes'] = '参数为空'; $res = $this->_res; } break; case 'adddata': if (!empty($params['itemdeepth']) && !empty($params['itemtitle']) && !empty($params['itemcode']) && !empty($params['itemparent'])) { $ch = Bll_Menus::check_data_is_exist_with_url($params['itemurl'], null, intval($params['urllv'])); if ($ch > 0) { $this->_res['mes'] = 'URL地址已存在'; $res = $this->_res; } else { $addData = array('item_code' => str_replace('_', '', $params['itemcode']), 'item_parent' => $params['itemparent'], 'item_title' => $params['itemtitle'], 'item_url' => $params['itemurl'], 'item_deepth' => $params['itemdeepth'], 'operation_name' => $this->get_user_name(), 'operation_id' => $this->get_user_id(), 'create_time' => time(), 'status' => $params['itemstatus']); $result = Bll_Menus::insert_data_row($addData); $res = $this->init_res($result); } } break; case 'delete': if (!empty($params['itemid'])) { $setData = array('status' => intval($params['status'])); $whereData = array('id' => intval($params['itemid'])); $result = Bll_Menus::update_data_row($setData, $whereData); $res = $this->init_res($result); } break; //记录操作日志 //记录操作日志 case 'log': $loginfo = array('type' => 1, 'operation_type' => $params['operationtype'], 'item_code' => str_replace('_', '', $params['itemcode']), 'title' => $params['itemtitle'], 'comment' => $params['comment'], 'operation_id' => $this->get_user_id(), 'operation_name' => $this->get_user_name(), 'create_time' => date('Y-m-d H:i:s', time())); $result = Bll_Changelog::insert_data_row($loginfo); $res = $this->init_res($result); break; default: $res = $this->_res; break; } echo json_encode($res); exit; }
/** * 检查用户是否有访问权限 * @param $itemCode * @param $selfMenuArr 权限菜单code * @param $userlevel 用户等级 * @return bool */ private function _check_authority($itemCode, &$selfMenuArr, &$userlevel) { $userinfo = $this->_userInfo; if (empty($userinfo)) { return false; } $this->userlevel = $userlevel = $userinfo['level']; $selfMenuArr = Bll_Authority::get_all_menus_by_group_id($userinfo['group_id']); $selfMenu = Bll_Menus::init_menus_arr($selfMenuArr); $isSupperMan = intval($userlevel) == Const_Cms::CMS_USER_LEVEL_SUPPER ? true : false; //标记系统设置是否需要展示 if ($isSupperMan || in_array('G004', $selfMenu)) { $this->setAttribute('system_show_' . $this->get_user_id(), true); } $itemCodeCur = str_replace('_', '', $itemCode); if (!$isSupperMan) { //超级管理员不需要判断是否有访问权限 //城市权限判断 $cityid = $this->get_city_id(); $this->setAttribute('setcookiecityid', $cityid); $selfcityArr = array_filter(explode(',', $userinfo['citys'])); $cityAuthority = true; if (!empty($cityid)) { if (!in_array($cityid, $selfcityArr)) { //不能访问的城市 $cityAuthority = false; } } else { $cityAuthority = false; } if (strlen($itemCode) == Const_Cms::CMS_YIJI_MENU_CODE_LEN) { //如果是各个app首页,直接返回true if (!$cityAuthority) { //如果是不能访问的城市,菜单则不显示 $selfMenuArr = array(); } return true; } if (!$cityAuthority) { return false; } if (!in_array($itemCodeCur, $selfMenu)) { //不能访问的菜单 return false; } } return true; }
/** * 初始化菜单信息 * @param $itemCode * @param $selfMenuArr 用户可以访问的菜单编码 * @param $userlevel 用户等级 * @param $siJiMenusId * @param $deepth * @param $curent_item 当前菜单信息 * @param $total_item 所有菜单信息菜单信息 * @return array|bool */ public static function init_user_menus($itemCode, $selfMenuArr, $userlevel, &$siJiMenusId, &$deepth, &$curent_item, &$total_item) { return Bll_Menus::get_user_menus($itemCode, $selfMenuArr, $userlevel, $siJiMenusId, $deepth, $curent_item, $total_item); }
public function handle_request_internel() { $apf = APF::get_instance(); $request = $apf->get_request(); $params = $request->get_parameters(); $this->plan_bll = BLL_AppPlan::get_instance(); $request_uri = explode("/", $this->request->get_request_uri()); $act = trim($request_uri[3]); $aid = intval($request_uri[4]); if ($act == 'delete' && is_numeric($aid)) { if ($this->deletePlan($aid)) { exit("1"); } else { exit("-1"); } } if ($act == 'apply' && is_numeric($aid)) { if ($this->applyPlan($aid, 1)) { exit("1"); } else { exit("-1"); } } if ($act == 'cancel' && is_numeric($aid)) { if ($this->applyPlan($aid, 0)) { exit("1"); } else { exit("-1"); } } if ($act == 'edit' && is_numeric($aid)) { $edit_data = $this->plan_bll->getPlanInfo($aid); if ($edit_data['sendtime'] && strtotime($edit_data['sendtime']) < time()) { $this->request->set_attribute("disable_edit", 1); } $this->request->set_attribute("edit_data", $edit_data); } if ($params) { $isapply = isset($params['isapply']) ? intval($params['isapply']) : 0; $send_time = $params['send_time'] ? strtotime($params['send_time']) : ''; $send_time = $send_time ? date("Y-m-d H:00:00", $send_time) : ''; if (is_array($params['send_title'])) { foreach ($params['send_title'] as $k => $send_title) { $prefer = $params['app_prefer'][$k] ? $params['app_prefer'][$k] : 0; $os = $params['app_os'][$k] ? $params['app_os'][$k] : 0; $image = $params['app_image'][$k] ? $params['app_image'][$k] : ''; $title = $params['content_title'][$k] ? $params['content_title'][$k] : ''; $desc = $params['content_desc'][$k] ? $params['content_desc'][$k] : ''; if ($k == 0 && $params['edit_id'] && is_numeric($params['edit_id'])) { $data = $this->plan_bll->getPlanInfo($params['edit_id']); if ($data) { $this->plan_bll->updateTemplate($data['msgid'], $image, $send_title, $desc, $title); $result = $this->plan_bll->updatePlan($params['edit_id'], $data['msgid'], $prefer, $send_time, $os, $isapply); } } else { $plan_id = $this->plan_bll->addPlan($image, $title, $desc, $prefer, $os, $send_time, $send_title, $isapply); } } } } if ($params['edit_id'] && is_numeric($params['edit_id'])) { $apf->get_response()->redirect($this->build_page_url('/user/app/edit/' . $params['edit_id'])); } $app_send_os = $apf->get_config('app_send_os'); $app_send_prefer = $apf->get_config('app_send_prefer'); $this->request->set_attribute("app_send_os", $app_send_os); $this->request->set_attribute("app_send_prefer", $app_send_prefer); $userId = $this->get_user_id(); //最近使用菜单 $menus_total_info = Bll_Menus::get_user_last_menus_info($userId); $this->setAttribute("menus_total_info", $menus_total_info); return 'App_Edit'; }