public function search() { if ($_GET) { $inputs = I('get.inputs'); $lang = LANG_SET; $data = self::lists(20, I('get.type'), $inputs, $lang); // 可以申请的年份 $appYears = getApplyForYears(); $this->assign('year', $appYears[0]); $this->assign('data', $data['data']); $this->assign('html', $data['html']); $this->assign('count', $data['count']); $this->assign('type', I('get.type')); $this->assign('get', json_encode($_GET)); $this->display(); } }
public function lists() { $regdate = 0; $is_active = -1; $username = ''; $name = ''; $email = ''; $year = 0; $bd = ''; $data = self::getParam($_GET); if ((int) $data['regdate']) { $regdate = $data['regdate']; } if ($data['is_active'] === '0' || $data['is_active'] === '2') { $is_active = $data['is_active']; } if ($data['username']) { $username = $data['username']; } if ($data['name']) { $name = $data['name']; } if ($data['email']) { $email = $data['email']; } if ((int) $data['year']) { $year = $data['year']; } if ($data['bd'] && $data['bd'] != '中介负责人') { $bd = $data['bd']; } $data = self::getSubAccountList(20, $regdate, $is_active, $username, $name, $email, $year, $bd); $this->assign('data', $data['data']); $this->assign('html', $data['html']); $this->assign('account', $data['account']); $this->assign('get', json_encode($_GET)); $this->assign('showYearList', getApplyForYears()); $bdList = M('user_agent')->field('bd')->where("bd<>''")->group('bd')->select(); $this->assign('bdList', $bdList); $this->display(); }
/** * 学生有申请的列表. * * @access public * @return void * @author Liuping <*****@*****.**> */ public function studentList() { // 允许申请的部门 $allowParts = AgentAuth::getAllowParts([AgentAuth::READ]); $part_ids = []; foreach ($allowParts as $row) { $part_ids[] = $row['id']; } $modelAppStatus = new ApplyStatusModel(); // 已有申请的年份 $allAppYears = $modelAppStatus->fetchApplyYears($part_ids); // 当前允许申请的年份 $allowAppYears = getApplyForYears(); // 从第几个年份显示 $_tmp_year = $allowAppYears[0]; // 增加一个 全部 的部门 array_unshift($allowParts, ['id' => '', 'name' => 'All']); // 默认显示的部门名称 $default_show_part_name = 'All'; // 页面展示的全部年份 $showYears = $allowAppYears; foreach ($allAppYears as $row) { $showYears[] = intval($row['year']); } $showYears = array_unique($showYears); // 去重 sort($showYears); // 排序 // 获取 左右 移动控制默认显示的第几页 $_tmp_key = array_search($_tmp_year, $showYears); // selectYear(integer), startDate(string), endDate(string), dept(integer), firstName(string), // familyName(string), birth(string) $defaultWhere = ['selectYear' => '', 'startDate' => '', 'endDate' => '', 'dept' => '', 'firstName' => '', 'familyName' => '', 'birth' => '']; // 列表数据 $lists = []; foreach ($showYears as $row) { $defaultWhere['selectYear'] = $row; $lists[$row] = $this->fetchApplyStuList($defaultWhere, TRUE, 20); // 替换分页请求的控制器为 ajaxGetStudentList $pageList = $lists[$row]['pageList']; $pageList = str_replace(ACTION_NAME, 'ajaxGetStudentList', $pageList); $lists[$row]['pageList'] = $pageList; } $this->assign('controlPage', $_tmp_key + 1); $this->assign('lists', $lists); $this->assign('defaultDeptName', $default_show_part_name); $this->assign('allowParts', $allowParts); $this->assign('showYears', $showYears); $this->display(); }
/** * 大学列表页面 * * @access public * @return void * @author Liuping <*****@*****.**> */ public function lists() { // 当前的语系, LANG_SET $lang = LANG_SET; // 搜索条件区域的学科下拉数据集 $subjectList = M('subject')->field(array('su_id AS subjectid', 'name AS subjectname'))->where("lang='{$lang}'")->order('su_id ASC')->select(); // 页面搜索条件区域的静态数据集 $staticList = C('SCHOOL_LIST_PAGE'); // 区域数据集 $staticAreaList = $staticList['districts'][$lang]; // 城市数据集(在页面上取当前语系的值 ) $staticCityList = $staticList['cities']; // 排名数据集 $staticRankList = $staticList['rank']; // 获取数据 $lists = $this->getSchoolList(TRUE); // 可以申请的年份 $appYears = getApplyForYears(); $this->assign('year', $appYears[0]); $this->assign('currLang', $lang); $this->assign('subjectList', $subjectList); $this->assign('staticAreaList', $staticAreaList); $this->assign('staticCityList', $staticCityList); $this->assign('staticRankList', $staticRankList); $this->assign('schoolList', $lists['lists']); $this->assign('pageList', str_replace(ACTION_NAME, 'getSchoolList', $lists['pageList'])); if (is_wap()) { $this->theme('bootstrap'); } $this->display(); }
/** * 信息统计. * * @access public * @return void * @author Liuping <*****@*****.**> */ public function info() { $lang = 'en-us'; // 当前可以申请的年份 $allowAppYears = getApplyForYears(); // 全部有申请的年份 $appliedYears = $this->fetchAppliedYearsData(); $_appliedYears = []; // 将有申请的年份转换成一维数组 foreach ($appliedYears as $row) { $_appliedYears[] = intval($row['year']); } unset($appliedYears); sort($_appliedYears); // 排序 // 最近有申请的年份 // $showYear = end($_appliedYears); $showYear = $allowAppYears[0]; // 显示的年份改成 当前可申请年份的第一个. /*if(!is_numeric($showYear)) { $showYear = $allowAppYears[0]; }*/ $_appliedYears = array_merge($_appliedYears, $allowAppYears); $_appliedYears = array_unique($_appliedYears); // 去重 rsort($_appliedYears); // 排序 // diy 列表数据 $diyData = $this->fetchDiyRegData($showYear, TRUE, 20); $diyData['pageList'] = str_replace(ACTION_NAME, 'ajaxGetDiyRegList', $diyData['pageList']); // 最新申请学校数据 $schoolData = $this->fetchNewApplySchoolData($showYear, '', $lang, TRUE, 20); $schoolData['pageList'] = str_replace(ACTION_NAME, 'ajaxGetNewAppSchoolList', $schoolData['pageList']); $this->assign('yesterdayNewUserNum', $this->fetchYesterdayNewUserNum()); $this->assign('yesterdayNewApplyNum', $this->fetchYesterdayNewApplyNum()); $this->assign('showSubmitTypeId', ''); $this->assign('showSubmitTypeName', '全部'); $this->assign('submitTypeList', $this->_userTypes); $this->assign('diyList', $diyData); $this->assign('schoolAppList', $schoolData); $this->assign('showYear', $showYear); // 当前显示的年份 $this->assign('applyYearList', $_appliedYears); // 年份列表数据 $this->display(); }
/** * 获取已有申请的全部年份值. * lists 表示全部的年份列表, curr 表示当前要显示的年份. * * @access private * @return array * @author Liuping <*****@*****.**> */ private function fetchAppliedYearsData() { $field = 'year'; $where = "is_del=0 AND is_complete=1"; $model = M('apply_status'); $lists = $model->field($field)->where($where)->group('year')->select(); if (NULL === $lists || FALSE === $lists) { $lists = []; } $_appliedYears = []; // 将有申请的年份转换成一维数组 foreach ($lists as $row) { $_appliedYears[] = intval($row['year']); } unset($appliedYears); sort($_appliedYears); // 排序 // 当前可以申请的年份 $allowAppYears = getApplyForYears(); // 最近有申请的年份 // $showYear = end ($_appliedYears); // 2015-10-17 改成当前学年 $showYear = $allowAppYears[0]; $_appliedYears = array_merge($_appliedYears, $allowAppYears); $_appliedYears = array_unique($_appliedYears); // 去重 rsort($_appliedYears); // 排序 if (!is_numeric($showYear)) { // 没有已申请的年份取第一个可申请的年份 $showYear = $allowAppYears[0]; } $result['lists'] = $_appliedYears; $result['curr'] = $showYear; return $result; }
/** * 提交申请第 1 步. * * @access public * @return void * @author Liuping <*****@*****.**> */ public function appSubmit1() { // 校验一级中介是否有权限添加申请 if (!AgentAuth::checkTopAgentOfApply()) { $this->error('No permission'); } // 当前语系 $lang = 'en-us'; // 点击详情页面的 Submit new application 需要传 按钮所在的 年份 和 学生 id // 从 appSubmit2 中的 Back 返回时, 需要传 申请主键 id // 点击详情页面的 Re-submit 按钮时, 传 申请主键 id // 从学生详情页面点申请传过来的参数, 第 2 步也要传 $studentId = intval(I('post.studentId', '')); $appYear = I('post.selectYear', ''); // 此参数在 第 2 步不用传 // 是从第 2 步传过来的, 也用于 详情页面的 re-submit 重新提交 $appStatusId = I('post.appStatus', ''); // 操作类型 1 : 添加, 2 : 编辑 $operFlag = intval(I('post.oper', 1)); // 根据操作类型, 设置不同的权限 $authRule = []; if (1 === $operFlag) { $authRule[] = AgentAuth::ADD; } else { $authRule[] = AgentAuth::WRITE; } // 可申请的年份 $allowYears = getApplyForYears(); //$uid = session('uid'); // 当前登录用户 if (empty($studentId)) { $this->error('Parameters error'); } // 实例化 MemberStu 模型 $modelStu = new MemberStuModel(); // 学生信息 $stuInfo = $modelStu->fetchStuInfo($studentId); if (empty($stuInfo)) { $this->error('Parameters error'); } // 权限验证 $res = AgentAuth::checkStu($studentId, $authRule); if ($res['status'] !== 9) { $this->error('No permission'); } $appInfo = []; $modelAppStatus = new ApplyStatusModel(); if (!empty($appStatusId)) { $appInfo = $modelAppStatus->fetchApplyInfo($appStatusId, $lang); // 从第 2 步传过来的 ano 没有找到该申请信息. if (empty($appInfo)) { $this->error('Parameters error'); } } // 大学列表 $schoolList = $this->fetchUniversityData($lang); // programme type $progTypeList = $modelAppStatus->fetchApplyProgTypeData($lang); // programe type 对应的 name $progTypeName = ''; if (!empty($appInfo)) { $key = $appInfo['type']; $progTypeName = isset($progTypeList[$key]) ? $progTypeList[$key] : ''; } $this->assign('operFlag', $operFlag); $this->assign('appStatusId', $appStatusId); $this->assign('progTypeList', $progTypeList); $this->assign('progTypeName', $progTypeName); $this->assign('applyInfo', $appInfo); $this->assign('schoolList', $schoolList); $this->assign('appYear', $appYear); $this->assign('stuInfo', $stuInfo); $this->assign('allowYears', $allowYears); $this->display(); }
/** * 用户中心弹出层数据. * * @access private * @return array * @author Liuping <*****@*****.**> */ private function getPopLayerData() { // 当前语系 $lang = LANG_SET; $defaultLang = 'en-us'; $uid = session('uid'); //------------------ 计算当前可申请的年份 $resYears = getApplyForYears(); // ------------------ 国家数据 $countryList = ['zh-cn' => [1 => '中国', 2 => '英国'], 'en-us' => [1 => 'China', 2 => 'United Kingdom']]; $resCountrys = isset($countryList[$lang]) ? $countryList[$lang] : $countryList[$defaultLang]; // ---------------------- 学科数据 $subjectList = M('Subject')->field(['su_id', 'name', 'lang'])->where('su_id < 8 AND lang=:lang')->bind(':lang', $lang)->select(); // ---------------------- 英语成绩要求类型 $langScoreType = ['zh-cn' => ['IELTS' => '雅思'], 'en-us' => ['IELTS' => 'IELTS']]; $resLangScoreType = isset($langScoreType[$lang]) ? $langScoreType[$lang] : $langScoreType[$defaultLang]; // ------------------------------申请的基本信息 apply_info if ($uid) { $resApplyInfo = M('apply_info')->where('uid=:uid')->bind(':uid', $uid)->find(); } else { //未登陆尝试取用户cookie数据 $resApplyInfo = unserialize(authcode(cookie('applyInfo'), 'DECODE', C('AUTH_KEY'))); } if ($resApplyInfo === NULL || $resApplyInfo === FALSE) { $resApplyInfo = []; } $return = ['years' => $resYears, 'country' => $resCountrys, 'subject' => $subjectList, 'langScoreType' => $resLangScoreType, 'applyInfo' => $resApplyInfo]; return $return; }