protected function resumeListBox($where_type, $search_form, $order, $forward = false) { $enterprise = session('account'); //获取列表数据 $param = I('get.'); $param['ct'] = I('get.ct') ? urldecode(I('get.ct')) : ''; isset($_GET['pt']) && $_GET['pt'] ? $where['resume_post.post_id'] = intval($param['pt']) : ''; //职位 isset($_GET['dt']) && $_GET['dt'] ? $where['student.education'] = intval($param['dt']) : ''; //学历 isset($_GET['ct']) && $_GET['ct'] ? $where['student.living_city'] = cityNameToid($param['ct']) : ''; //学生所在城市 isset($_GET['gt']) && $_GET['gt'] ? $where['student.graduate_year'] = I('get.gt') : ''; //学生所在城市 /*---------更新搜索规则start------------*/ isset($_GET['ps']) && $_GET['ps'] ? $start = I('get.ps') : ''; //实习开始时间 isset($_GET['pe']) && $_GET['pe'] ? $end = I('get.pe') : ''; //实习结束时间 if ($start && !$end) { $where['_string'] = "post_subscribe.period_start >= '{$start}' OR post_subscribe.period_start ='0000-00-00'"; } if (!$start && $end) { $where['_string'] = "post_subscribe.period_start <= '{$end}'"; } if ($start && $end) { $where['_string'] = "(post_subscribe.period_start between '{$start}' and '{$end}') OR post_subscribe.period_start='0000-00-00'"; } /*----------更新搜索规则end-----------*/ isset($_GET['major_wish']) ? $major = I('get.major_wish') : ''; //多专业 if (is_array($major) && count($major) > 0 && $major[0] != 0) { $where['student.major_type'] = array('in', $major); $major_string = join($major, ','); } if (is_string($major)) { $major_arr = explode(',', $major); $where['student.major_type'] = array('in', $major_arr); $major_string = $major; } $where['resume_post.status'] = $where_type; $where['resume_post.send_type'] = 1; $where['post_subscribe.info_type'] = 1; $where['resume_post.enterprise_id'] = session('account.enterprise_id'); $resumePostTotal = $this->ResumePostModel->getResumePostCount($where); //列表总数量 $page = isset($_GET['p']) ? intval(htmlspecialchars(strip_tags($_GET['p']))) : ''; //获取url的分页参数 $page = max(1, $page); $page = min($page, ceil($resumePostTotal / $this->page_number)); // 获取合法的分页数 $resumePostList = $this->ResumePostModel->getResumePostData($where, $page, $this->page_number, $order); if ($resumePostList) { foreach ($resumePostList as $k => $v) { /*用于计算转发次数by allen at 2015-12-03*/ if ($forward == true) { $resumePostList[$k]['forward_count'] = $this->ResumeForwardModel->where(array('resume_post_id' => $v['pkid']))->getField('count(pkid)'); } /*用于计算转发次数*/ $resumePostList[$k]['education_text'] = $v['education'] ? getDegreeTextSTU($v['education']) : ''; $resumePostList[$k]['graduate_text'] = $v['graduate_year'] ? getGradeText($v['graduate_year']) . '毕业' : ''; $resumePostList[$k]['city_text'] = $v['living_city'] ? regionIdToname($v['living_city']) : ''; $resumePostList[$k]['type_text'] = $v['resume_type'] ? resumePostType($v['resume_type']) : ''; //处理时间 if ($v['status'] == 1 || $v['status'] == 2) { $show_time = $v['create_time']; } else { $show_time = $v['deal_time']; } if ($v['status'] == 3) { $resumePostList[$k]['status_text'] = '允许面试'; } if ($v['status'] == 4) { $resumePostList[$k]['status_text'] = '不合适'; } $resumePostList[$k]['time_text'] = $show_time ? time2Unit($show_time) : ''; if ($v['period_start'] == $this->date_type && $v['period_finish'] == $this->date_type) { $resumePostList[$k]['dateType'] = 1; } elseif ($v['period_start'] != $this->date_type && $v['period_finish'] == $this->date_type) { $resumePostList[$k]['dateType'] = 2; } else { $resumePostList[$k]['dateType'] = 3; } } } if ($major_string) { $param['major_wish'] = $major_string; } else { unset($param['major_wish']); } if (is_null($major_string)) { $majorLi = ''; } if ($major_string || $major_wish[0] == 0 && isset($_GET['major_wish'])) { $majorLi = majorNameListLi($major_string); } $map = $param ? $param : array(); $Page = new PageAdmin($resumePostTotal, $this->page_number, $map); $this->assign('show', !empty($resumePostList) ? 1 : 0); //判断下拉框是否需要显示 $this->assign('search_form', $search_form); $this->assign('majorLi', $majorLi); $this->assign('param', $param); $this->assign('total', $resumePostTotal); $this->assign('resumePostList', $resumePostList); $this->assign('page', $Page->show()); $this->assign('majorTypeList', $this->majorTypeList()); $this->assign('postList', $this->postList()); $this->assign('majorList', $this->majorTypeArr()); $this->assign('degreList', getDegreeTextSTU()); $this->assign('grade', getGradeText()); }
public function update_base() { $data = $this->CommonController->getRequestData(); $data = $this->CommonController->arr2ToArr($data['user']); foreach ($data as $k => $v) { if ($k == 'id_number') { continue; } $v = trim($v); if (empty($v)) { $error[$k] = C('L_REQUIRED_INPUT'); } } if ($data['contact_email']) { if (!checkMailRuleStudent($data['contact_email'])) { $error['contact_email'] = '邮箱格式不对'; } } if ($data['id_number']) { //简单验证身份证正则表达式(18位) $isIDCard = "/^[1-9]\\d{5}[1-9]\\d{3}((0\\d)|(1[0-2]))(([0|1|2]\\d)|3[0-1])\\d{3}(\\d{1}|X{1})\$/i"; $id_number_bool = preg_match($isIDCard, $data['id_number']); if (!$id_number_bool) { $error['id_number'] = '输入合法身份证号'; } if (strlen($data['id_number']) != 18) { $error['id_number'] = '输入合法身份证号'; } } if ($data['living_city']) { $data['living_city'] = cityNameToid($data['living_city']); } if ($data['mobile_type'] == 1) { if (!checkPhoneRule($data['contact_mobile'])) { $error['mobile'] = C('L_PHONE_RULE'); } } if ($data['birth_date']) { if (strtotime($data['birth_date']) > strtotime(date('Y-m-d', NOW_TIME))) { $error['birth_date'] = C('L_BIRTH_RULE'); } } if ($data['name']) { if (!strLength($data['name'], 12)) { $error['name'] = C('L_LIMIT_NAME'); } } if ($data['graduate_school']) { if (!strLength($data['graduate_school'], 20)) { $error['graduate_school'] = C('L_LIMIT_SCHOOL'); } } if ($data['detail_major']) { if (!strLength($data['detail_major'], 17)) { $error['detail_major'] = C('L_LIMIT_MAJOR'); } } if (!empty($error)) { $error['status'] = FALSE; $error['code'] = 1; exit(json_encode($error)); } $bool = $this->StudentModel->studentUpdata($data); if ($bool) { D('Account')->makeSession(session('account.account_id')); //编辑成功后写入SESSION exit(json_encode(array('code' => 2, 'status' => TRUE, 'msg' => C('L_UPDATE_SUCCESS'), 'data' => self::baseInfoTpl('', TRUE)))); } else { exit(json_encode(array('code' => 3, 'status' => FALSE, 'msg' => C('L_UPDATE_FAIL')))); } }
function expectCityID($string) { $city_arr = explode(',', $string); $city_str = ''; if (is_array($city_arr)) { foreach ($city_arr as $v) { if ($v) { $city_str .= cityNameToid($v) . ','; } } } return $city_str ? trim($city_str, ',') : ''; }