Example #1
0
 /**
  * 修改考试日历
  */
 public function detailAction($cal_id)
 {
     //判断是否是ajax
     if ($this->request->isAjax()) {
         $validate = new \Validate();
         $data['cal_id'] = $validate->getPost('cal_id', \Validate::int());
         //考试日历id
         $data['cal_year'] = $validate->getPost('cal_year', \Validate::scope(range(2014, 2020)));
         //考试年份
         $data['cal_month'] = $validate->getPost('cal_month', \Validate::scope(range(1, 12)));
         //考试月份
         $data['cal_date'] = $validate->getPost('cal_date', \Validate::length(30, 1), ['slashes' => true, 'html' => true]);
         //具体考试时间
         $data['cal_name'] = $validate->getPost('cal_name', \Validate::regex('/^[a-z0-9\\x{4e00}-\\x{9fa5}]{2,30}$/iu'));
         //考试名称
         $data['cal_sort'] = $validate->getPost('cal_sort', \Validate::between(99999999, 0));
         //分类介绍
         //验证参数
         if ($validate->getMessage()) {
             $this->end(400);
         }
         //修改banner
         $result = (new \Calendar())->updCalendar($this->session->get('id'), $data);
         $this->end($result);
     }
     //数据id
     $cal_id = (int) $cal_id;
     //考试日历详情数据
     $basic = (new \Calendar())->getCalenderDetail($cal_id);
     //加载js
     $this->assets->addJs('backend/mt-js/calendar.js');
     $this->view->setVars(['basic' => $basic]);
 }
Example #2
0
 /**
  * 高校教师的详细信息
  */
 public function detailAction($col_news_id)
 {
     //判断是否ajax
     if ($this->request->isAjax()) {
         $validate = new \Validate();
         $data['col_id'] = $validate->getPost('col_id', \Validate::int());
         //学校id
         $data['col_news_thumb'] = $validate->getPost('col_news_thumb');
         //教师头像
         $data['col_news_id'] = $validate->getPost('col_news_id', \Validate::int());
         //动态id
         $data['col_news_title'] = $validate->getPost('col_news_title', \Validate::length(30, 2));
         //教师名称
         $data['col_news_content'] = $validate->getPost('col_news_content', \Validate::length(100000, 0));
         //教师简介
         //验证参数
         if ($validate->getMessage()) {
             $this->end(400);
         }
         //生成教师头像
         if ($data['col_news_thumb']) {
             $data['col_news_thumb'] = \Func::touchImg($data['col_news_thumb'], 'col_news_thumb');
             if (!$data['col_news_thumb']) {
                 $this->end(400);
             }
         }
         $this->end((new \CollegeNews())->updNews($this->session->get('id'), $data));
     }
     //教师id
     $col_news_id = (int) $col_news_id;
     //教师数据
     $detail = (new \CollegeNews())->getNewsDetail($col_news_id);
     $this->view->setVars(['col_news_id' => $col_news_id, 'detail' => $detail, 'col_id' => $detail['col_id']]);
 }
Example #3
0
 public function detailAction()
 {
     if ($this->isMobile()) {
         $this->response->redirect(HOST . '/single/wap');
     }
     if ($this->request->isAjax()) {
         $validate = new \Validate();
         $data['name'] = $validate->getPost('name', \Validate::regex('/^[a-z0-9\\x{4e00}-\\x{9fa5}]{1,30}$/iu'));
         $data['phone'] = $validate->getPost('phone', \Validate::regex('/^1[358]\\d{9}$/iu'));
         $data['record'] = $validate->getPost('record', \Validate::regex('/^[a-z0-9\\x{4e00}-\\x{9fa5}]{1,30}$/iu'));
         $data['hope'] = $validate->getPost('hope', \Validate::regex('/^[a-z0-9\\x{4e00}-\\x{9fa5}]{1,30}$/iu'));
         $data['review'] = $validate->getPost('review', \Validate::length(800, 0), ['slashes' => true]);
         if ($validate->getMessage()) {
             $this->end(400);
         }
         $this->end((new \Single())->addRegister($data));
     }
     $this->tag->setTitle('四川高职单招院校-四川高职单招考试-四川高职单招试卷|51升学网');
     $web_key = "四川高职单招院校,四川高职单招考试,四川高职单招试卷,51升学网";
     $web_desc = "高职单招,大部分人的选择。51升学网为你提供了四川高职单招院校,提供往年的四川高职单招考试的试卷,四川高考单招试卷免费下载,更有在线的高职单招考试的报名。";
     $this->assets->addCss("fontend/css/danzhao/danzhao.css");
     $this->assets->addJs("fontend/js/lib/jquery.velocity.min.js");
     $this->assets->addJs("fontend/js/danzhao.js");
     $this->view->setVars(['web_key' => $web_key, 'web_desc' => $web_desc]);
 }
Example #4
0
 /**
  * 修改小初高动态
  */
 public function detailAction($sch_dny_id)
 {
     //判断是否ajax
     if ($this->request->isAjax()) {
         $validate = new \Validate();
         $data['sch_id'] = $validate->getPost('sch_id', ['int']);
         //学校id
         $data['sch_dny_id'] = $validate->getPost('sch_dny_id', ['int']);
         //动态id
         $data['sch_dny_title'] = $validate->getPost('sch_dny_title', \Validate::length(60, 1), ['slashes' => true, 'html' => true]);
         //动态标题
         $data['sch_dny_content'] = $validate->getPost('sch_dny_content', \Validate::nil(), ['slashes' => true]);
         //动态内容
         //验证参数
         if ($validate->getMessage()) {
             $this->end(400);
         }
         $this->end((new \Dynamic())->updDynamic($this->session->get('id'), $data));
     }
     //动态id
     $sch_dny_id = (int) $sch_dny_id;
     //小初高学校动态数据
     $dynamic = (new \Dynamic())->getDynamicDetail($sch_dny_id);
     //获取学校类型
     $sch_dny_type = (new \Dynamic())->getDnyType($sch_dny_id);
     if ($sch_dny_type['sch_type'] == 1) {
         $this->view->setLayout("kindergarten");
     } else {
         $this->view->setLayout("school");
     }
     $this->view->setVars(['sch_dny_id' => $sch_dny_id, 'dynamic' => $dynamic, 'sch_id' => $dynamic['sch_id'], 'sch_dny_type' => $sch_dny_type]);
 }
 /**
  * 新增隶属部门
  */
 public function newAction()
 {
     //判断是否ajax
     if ($this->request->isAjax()) {
         $validate = new \Validate();
         $data['dep_name'] = $validate->getPost('dep_name', \Validate::length(15, 2));
         //入学途径名称
         $data['dep_sort'] = $validate->getPost('dep_sort', \Validate::int());
         //入学途径排序
         //验证参数
         if ($validate->getMessage()) {
             $this->end(400);
         }
         //新增动态
         $this->end((new \Department())->addDepartment($this->session->get('id'), $data));
     }
     //加载js
     $this->assets->addJs('backend/mt-js/school-department.js');
 }
Example #6
0
 /**
  * 修改管理员密码
  */
 public function updpwdAction()
 {
     //判断是否是ajax
     if ($this->request->isAjax()) {
         $validate = new \Validate();
         $old_pwd = $validate->getPost('old_pwd', \Validate::length(30, 6));
         //旧密码
         $new_pwd = $validate->getPost('new_pwd', \Validate::length(30, 6));
         //旧密码
         //验证参数
         if ($validate->getMessage()) {
             $this->end(400);
         }
         //加密
         $old_pwd = $this->password($old_pwd);
         $new_pwd = $this->password($new_pwd);
         //修改密码
         $this->end((new \Manager())->updPassword($this->session->get('id'), $old_pwd, $new_pwd));
     }
     //加载js
     $this->assets->addJs('backend/mt-js/pwd.js');
 }
Example #7
0
 public function praiseAction($id)
 {
     //判断是否是ajax请求
     if ($this->request->isAjax()) {
         $validate = new \Validate();
         $data['cou_id'] = (int) $id;
         $data['ip'] = $this->getClientIp();
         $data['content'] = $validate->getPost('content', \Validate::length(255, 0), ['slashes' => true, 'html' => true]);
         $data['star'] = $validate->getPost('star', \Validate::int());
         if ($validate->getMessage()) {
             $this->end(404);
         }
         $this->end((new \Course())->Review($data));
     }
     $id = (int) $id;
     if (!$id) {
         $this->notFound();
     }
     $detail = (new \Course())->getDetail($id);
     if ($detail == 404) {
         $this->notFound();
     }
     $praise = (new \Course())->getPraise($id);
     foreach ($praise['list'] as $key => $val) {
         $praise['list'][$key]['cou_rev_ip'] = $this->ipGetCity($val['cou_rev_ip']) == 404 ? "未知网友" : $this->ipGetCity($val['cou_rev_ip']);
     }
     //好评差评率
     $good = $praise['good'];
     $bad = $praise['bad'];
     //设置标题
     $this->tag->setTitle($detail['cou_name'] . "-51升学网");
     //引入css js
     $this->assets->addCss("fontend/css/train/train-comment.css");
     //        $this->assets->addCss("fontend/css/org/course-praise.css");
     $this->assets->addJs("fontend/js/org_praise.js");
     $this->view->setVars(['detail' => $detail, 'praise' => $praise['list'], 'id' => $id, 'good' => $good, 'bad' => $bad]);
 }
 /**
  * 知名校友的详细信息
  */
 public function detailAction($col_alu_id)
 {
     //判断是否ajax
     if ($this->request->isAjax()) {
         $validate = new \Validate();
         $data['col_id'] = $validate->getPost('col_id', \Validate::int());
         //学校id
         $data['alu_id'] = $validate->getPost('alu_id', \Validate::int());
         //校友id
         $data['alu_name'] = $validate->getPost('alu_name', \Validate::length(15, 2));
         //校友名称
         $data['alu_desc'] = $validate->getPost('alu_desc', \Validate::length(255, 2));
         //校友简介
         $data['alu_src'] = $validate->getPost('alu_src');
         //资料来源
         $data['alu_head'] = $validate->getPost('alu_head');
         //校友头像
         //验证参数
         if ($validate->getMessage()) {
             $this->end(400);
         }
         //生成校友头像
         if ($data['alu_head']) {
             $data['alu_head'] = \Func::touchImg($data['alu_head'], 'alu_head');
             if (!$data['alu_head']) {
                 $this->end(400);
             }
         }
         $this->end((new \CollegeAlumnus())->updAlumnus($this->session->get('id'), $data));
     }
     //校友id
     $col_alu_id = (int) $col_alu_id;
     //校友数据
     $alumnus = (new \CollegeAlumnus())->getAlumnusDetail($col_alu_id);
     $this->view->setVars(['col_alu_id' => $col_alu_id, 'alumnus' => $alumnus, 'col_id' => $alumnus['col_id']]);
 }
 /**
  * 修改阳光宝贝详情
  */
 public function detailAction($sch_star_id)
 {
     //判断是否ajax
     if ($this->request->isAjax()) {
         $validate = new \Validate();
         $data['sch_id'] = $validate->getPost('sch_id', \Validate::int());
         //学校id
         $data['star_id'] = $validate->getPost('star_id', \Validate::int());
         //阳光宝贝id
         $data['star_head'] = $validate->getPost('star_head');
         //学员头像
         $data['star_name'] = $validate->getPost('star_name', \Validate::length(15, 2));
         //学员名称
         $data['star_sort'] = $validate->getPost('star_sort', \Validate::length(99999999, 0));
         //排序
         //验证参数
         if ($validate->getMessage()) {
             $this->end(4001);
         }
         //生成阳光宝贝头像
         if ($data['star_head']) {
             $data['star_head'] = \Func::touchImg($data['star_head'], 'star_head');
             if (!$data['star_head']) {
                 $this->end(400);
             }
         }
         $this->end((new \Kindergarten())->updStar($this->session->get('id'), $data));
     }
     //阳光宝贝id
     $sch_star_id = (int) $sch_star_id;
     //阳光宝贝数据
     $stars = (new \Kindergarten())->getStarDetail($sch_star_id);
     //加载js
     $this->assets->addJs('backend/mt-js/kindergarten-star.js');
     $this->view->setLayout('kindergarten');
     $this->view->setVars(['sch_star_id' => $sch_star_id, 'stars' => $stars, 'sch_id' => $stars['sch_id']]);
 }
 /**
  * 高校教师的详细信息
  */
 public function detailAction($col_tea_id)
 {
     //判断是否ajax
     if ($this->request->isAjax()) {
         $validate = new \Validate();
         $data['col_id'] = $validate->getPost('col_id', \Validate::int());
         //学校id
         $data['tea_id'] = $validate->getPost('tea_id', \Validate::int());
         //教师id
         $data['tea_name'] = $validate->getPost('tea_name', \Validate::length(15, 2));
         //教师名称
         $data['tea_degree'] = $validate->getPost('tea_degree', \Validate::length(10, 2));
         //教师学位
         $data['tea_position'] = $validate->getPost('tea_position', \Validate::length(20, 2));
         //教师职位
         $data['tea_college'] = $validate->getPost('tea_college', \Validate::length(30, 2));
         //毕业学校
         $data['tea_sort'] = $validate->getPost('tea_sort', \Validate::length(99999999, 0));
         //排序
         $data['tea_summary'] = $validate->getPost('tea_summary', \Validate::length(255, 2));
         //教师简介
         $data['tea_head'] = $validate->getPost('tea_head');
         //教师头像
         //验证参数
         if ($validate->getMessage()) {
             $this->end(400);
         }
         //生成教师头像
         if ($data['tea_head']) {
             $data['tea_head'] = \Func::touchImg($data['tea_head'], 'tea_head');
             if (!$data['tea_head']) {
                 $this->end(400);
             }
         }
         $this->end((new \CollegeTeacher())->updTeacher($this->session->get('id'), $data));
     }
     //教师id
     $col_tea_id = (int) $col_tea_id;
     //教师数据
     $teacher = (new \CollegeTeacher())->getTeacherDetail($col_tea_id);
     $this->view->setVars(['col_tea_id' => $col_tea_id, 'teacher' => $teacher, 'col_id' => $teacher['col_id']]);
 }
Example #11
0
     * @return array
     */
    public function get_errors()
    {
        return $this->_error;
    }
    /**
     * Privately collects errors
     * @param string $details
     */
    private function _error($details)
    {
        $this->_error[] = $details;
    }
}
echo "<hr />";
$val = new Validate();
echo "<br />";
$val->max_length("Sebastian", 2);
echo "<br />";
$val->min_length("Sebastian", 12);
echo "<br />";
$val->length("Sebastian", [9, 12]);
$val->is_alpha("dog");
$val->is_alphanum("dog");
$val->is_numeric("sebastian");
if (!$val->submit()) {
    $errors = $val->get_errors();
    echo "<pre>";
    print_r($errors);
}
Example #12
0
 /**
  * 大学报名处理
  */
 public function colhandleAction($col_reg_id)
 {
     //判断是否ajax
     if ($this->request->isAjax()) {
         $validate = new \Validate();
         $data['col_id'] = $validate->getPost('col_id', \Validate::int());
         //学校id
         $data['col_reg_id'] = $validate->getPost('col_reg_id', \Validate::int());
         //报名id
         $data['col_reg_remark'] = $validate->getPost('col_reg_remark', \Validate::length(255, 2));
         //处理记录
         //验证参数
         if ($validate->getMessage()) {
             $this->end(400);
         }
         $this->end((new \Register())->handleCollegeRegister($this->session->get('id'), $data));
     }
     //回复id
     $col_reg_id = (int) $col_reg_id;
     //报名数据
     $detail = (new \Register())->getCollgeRegister($col_reg_id);
     //加载js
     $this->assets->addJs('backend/mt-js/register-college.js');
     $this->view->setVars(['col_reg_id' => $col_reg_id, 'detail' => $detail]);
 }
Example #13
0
 /**
  * 口碑评价
  */
 public function praiseAction($col_id)
 {
     //判断是否是ajax请求
     if ($this->request->isAjax()) {
         $validate = new \Validate();
         $data['col_id'] = $col_id;
         $data['ip'] = $this->getClientIp();
         $data['content'] = $validate->getPost('content', \Validate::length(255, 0), ['slashes' => true, 'html' => true]);
         $data['star'] = $validate->getPost('star', \Validate::int());
         if ($validate->getMessage()) {
             $this->end(404);
         }
         $this->end((new \College())->addReview($data));
     }
     //获取大学基本信息
     $model = new \College();
     $college = $model->getCollegeBasic($col_id);
     if (!$college) {
         $this->notFound();
     }
     $praise = $model->getPraise($col_id);
     //计算评分
     $praise['num'] = 0;
     foreach ($praise['sco'] as $v) {
         $praise['num'] += $v['col_rev_star'];
         $praise['score'] = $praise['num'] / count($praise['list']);
     }
     //大家都在评论
     foreach ($praise['common_id'] as $item) {
         $praise['common'][] = $model->getPraiseDesc($item['col_id']);
     }
     $common = $praise['common'];
     $good = $praise['good'];
     $bad = $praise['bad'];
     $score = $praise['score'];
     foreach ($praise['list'] as $key => $val) {
         $praise['list'][$key]['col_rev_ip'] = $this->ipGetCity($val['col_rev_ip']) == 404 ? "未知网友" : $this->ipGetCity($val['col_rev_ip']);
     }
     //设置标题
     $this->tag->setTitle($college['col_name'] . "-51升学网");
     $web_desc = strip_tags($college['col_summary']);
     //引入css 和js
     $this->assets->addCss("fontend/css/org2/university/publish-praise.css");
     $this->assets->addJs("fontend/js/org_praise.js");
     $this->view->setVars(['college' => $college, 'praise' => $praise['list'], 'good' => $good, 'bad' => $bad, 'score' => $score, 'common' => $common, 'web_desc' => $web_desc]);
 }
Example #14
0
 /**
  * 新增权限分组
  */
 public function appendAction()
 {
     if ($this->request->isAjax()) {
         $validate = new \Validate();
         $data['gro_name'] = $validate->getPost('gro_name', \Validate::length(20, 1));
         //权限分组名称
         $data['aut_id'] = $validate->getPost('aut_id');
         //验证参数
         if ($validate->getMessage()) {
             $this->end(400);
         }
         $this->end((new \Authority())->addAuthorityGroup($this->session->get('id'), $data));
     }
     //获取权限分类数据
     $aut_cats = (new \Authority())->getAutCats();
     //获取权限信息
     $authoritys = (new \Authority())->getAuthoritys();
     //加载js
     $this->assets->addJs('backend/mt-js/authority-group.js');
     $this->view->setVars(['aut_cats' => $aut_cats, 'authoritys' => $authoritys]);
 }
Example #15
0
 /**
  * 新增学校课程
  */
 public function detailAction($tra_id, $cou_id)
 {
     //检查是否是ajax请求
     if ($this->request->isAjax()) {
         $validate = new \Validate();
         $data['tra_id'] = (int) $tra_id;
         //学校ID
         $data['cou_id'] = (int) $cou_id;
         //课程ID
         $data['cou_thumb'] = $validate->getPost('cou_thumb');
         //学校缩略图
         $data['spe_id'] = $validate->getPost('spe_id', \Validate::int());
         //分类ID
         $data['cou_name'] = $validate->getPost('cou_name', \Validate::regex('/^[a-z0-9\\x{4e00}-\\x{9fa5}]{2,30}$/iu'));
         //课程名称
         $data['cou_sort'] = $validate->getPost('cou_sort', \Validate::int());
         //课程排序
         $data['cou_price'] = $validate->getPost('cou_price', \Validate::regex('/^[a-z0-9\\.\\/\\(\\)\\(\\)\\x{4e00}-\\x{9fa5}]{0,30}$/iu'));
         //课程价格
         $data['cou_system'] = $validate->getPost('cou_system', \Validate::int());
         //上课类型
         $data['is_hot'] = $validate->getPost('is_hot', \Validate::int());
         //是否热门
         $data['cou_summary'] = $validate->getPost('cou_summary', \Validate::nil(), ['slashes' => true]);
         //课程简介
         $data['cou_key'] = $validate->getPost('cou_key', \Validate::regex('/^[a-z0-9\\x{4e00}-\\x{9fa5}]{1,10}([\\s,][a-z0-9\\x{4e00}-\\x{9fa5}]{1,10}){0,9}$/iu'));
         //关键词
         $data['cou_desc'] = $validate->getPost('cou_desc', \Validate::length(250, 2), ['slashes' => true, 'html' => true]);
         //描述
         $data['cou_trait'] = $validate->getPost('cou_trait', \Validate::length(250, 2), ['slashes' => true, 'html' => true]);
         //优势
         $data['tea_id'] = $validate->getPost('tea_id');
         $data['cou_addr'] = $validate->getPost('cou_addr');
         //验证数据
         if ($validate->getMessage()) {
             $this->end(400);
         }
         //验证机构是否存在
         if (!(new \Train())->getDetail($tra_id)) {
             $this->end(404);
         }
         //生成课程缩略图
         $cou_thumb = \Func::touchImg($data['cou_thumb'], 'cou_thumb');
         //将生成的图片地址存入img,用户失败时删除
         $img = [UPLOAD_PATH . $data['cou_thumb']];
         //监测图片是否全部生成成功
         if ($data['cou_thumb'] && !$cou_thumb) {
             \FileUtil::getInstance()->unlink($img);
             $this->end(400);
         }
         $data['cou_thumb'] = $cou_thumb;
         //修改高校课程
         $result = (new \Course())->UpdateCourse($this->session->get('id'), $data);
         if ($result != 200) {
             $this->end($result);
         }
         $this->end($result);
     }
     //获取参数
     $cou_id = (int) $cou_id;
     $tra_id = (int) $tra_id;
     //获取详细信息
     $detail = (new \Course())->getDetail($cou_id);
     if ($detail == 404) {
         $this->end(404);
     }
     //获取一级分类
     $categorys = (new \Course())->getCategory();
     //获取教师列表
     $teachers = (new \TrainTeacher())->getTeacherList($tra_id)['list'];
     //获取课程教师
     $tea_id = (new \Course())->getTeacher($cou_id);
     //获取地址列表
     $cou_addr = (new \Course())->getAddress($cou_id);
     $address = '';
     foreach ($cou_addr as $val) {
         $address .= ',' . $val['cou_add_content'];
     }
     //加载所需js
     $this->assets->addJs('backend/js/editors/summernote/summernote.js');
     $this->assets->addJs('backend/mt-js/bootstrap-tagsinput.js');
     $this->assets->addJs('backend/mt-js/course-detail.js');
     $this->view->setLayout('train');
     $this->view->setVars(['detail' => $detail, 'tra_id' => $tra_id, 'categorys' => $categorys, 'teachers' => $teachers, 'tea_id' => $tea_id, 'cou_addr' => $cou_addr, 'address' => $address]);
 }
Example #16
0
 /**
  * 专业评论回复
  */
 public function majreplayAction($maj_rev_id)
 {
     //判断是否ajax
     if ($this->request->isAjax()) {
         $validate = new \Validate();
         $data['maj_id'] = $validate->getPost('maj_id', \Validate::int());
         //专业id
         $data['maj_rev_id'] = $validate->getPost('maj_rev_id', \Validate::int());
         //评论id
         $data['maj_rev_replay'] = $validate->getPost('maj_rev_replay', \Validate::length(255, 2));
         //回复
         //验证参数
         if ($validate->getMessage()) {
             $this->end(400);
         }
         $this->end((new \Review())->updMajorReplay($this->session->get('id'), $data));
     }
     //回复id
     $maj_rev_id = (int) $maj_rev_id;
     //评论数据
     $detail = (new \Review())->getMajorReplay($maj_rev_id);
     //加载js
     $this->assets->addJs('backend/mt-js/review-major.js');
     $this->view->setVars(['maj_rev_id' => $maj_rev_id, 'detail' => $detail]);
 }
Example #17
0
 /**
  * 幼小初高评论
  */
 public function praiseAction($sch_id)
 {
     //判断是否是ajax请求
     if ($this->request->isAjax()) {
         $validate = new \Validate();
         $data['sch_id'] = $sch_id;
         $data['ip'] = $this->getClientIp();
         $data['content'] = $validate->getPost('content', \Validate::length(255, 0), ['slashes' => true, 'html' => true]);
         $data['star'] = $validate->getPost('star', \Validate::int());
         if ($validate->getMessage()) {
             $this->end(404);
         }
         $this->end((new \School())->addReview($data));
     }
     //获取大学基本信息
     $model = new \School();
     $school = $model->getSchoolBasic($sch_id);
     if (!$school) {
         $this->notFound();
     }
     //获取评论
     $praise = $model->getPraise($sch_id);
     foreach ($praise as $key => $val) {
         $praise[$key]['sch_rev_ip'] = $this->ipGetcity($val['sch_rev_ip']);
     }
     //设置标题
     $this->tag->setTitle($school['sch_name'] . "-51升学网");
     //引入css 和js
     $this->assets->addCss("fontend/css/org/public-praise.css");
     $this->assets->addJs("fontend/js/org_praise.js");
     $this->view->setVars(['school' => $school, 'praise' => $praise]);
 }
Example #18
0
 /**
  * 培训详情
  * parmar  $col_id 学校id
  */
 public function detailAction($tra_id)
 {
     //检查是否是ajax请求
     if ($this->request->isAjax()) {
         $validate = new \Validate();
         $data['tra_logo'] = $validate->getPost('tra_logo');
         //机构logo
         $data['tra_thumb'] = $validate->getPost('tra_thumb');
         //机构缩略图
         $data['tra_name'] = $validate->getPost('tra_name', \Validate::regex('/^[a-z0-9\\x{4e00}-\\x{9fa5}]{2,30}$/iu'));
         //学校名称
         $data['tra_cat_id'] = $validate->getPost('tra_cat_id', \Validate::int());
         //机构分类
         $data['tra_system'] = $validate->getPost('tra_system', \Validate::int());
         //上课类型
         $data['tra_click'] = $validate->getPost('tra_click', \Validate::int());
         //上课类型
         $data['is_join'] = $validate->getPost('is_join', \Validate::scopeCall('Setting', 'getJoin'));
         //官方合作
         $data['home_type'] = $validate->getPost('is_home', \Validate::scopeCall('Setting', 'getHome'));
         //包住宿
         $data['hire_type'] = $validate->getPost('is_hire', \Validate::scopeCall('Setting', 'getHire'));
         //包就业
         $data['tra_tel'] = $validate->getPost('tra_tel', \Validate::length(60, 0), ['slashes' => true, 'html' => true]);
         //联系电话
         $data['tra_url'] = $validate->getPost('tra_url', \Validate::regex('/^(http(s)?:\\/\\/[^\'"\\s]+)?$/'));
         //机构官网
         $data['pro_code'] = $validate->getPost('pro_code', \Validate::regex('/^[1-9]\\d{5}$/'));
         //机构所在省份编码
         $data['city_code'] = $validate->getPost('city_code', \Validate::regex('/^[1-9]\\d{5}$/'));
         //机构所在城市编码
         $data['area_code'] = $validate->getPost('area_code', \Validate::regex('/^[1-9]\\d{5}$/'));
         //机构所在区县编码
         $data['dist_code'] = $validate->getPost('dist_code', \Validate::regex('/^0|(^[1-9]\\d{5})$/'));
         //机构所在城市编码
         $data['tra_addr'] = $validate->getPost('tra_addr', \Validate::length(100, 0), ['slashes' => true, 'html' => true]);
         //详细地址
         $data['tra_summary'] = $validate->getPost('tra_summary', \Validate::length(100000, 0), ['slashes' => true]);
         //机构简介
         $data['tra_key'] = $validate->getPost('tra_key', \Validate::regex('/^([a-z0-9\\x{4e00}-\\x{9fa5}]{1,10}([\\s,][a-z0-9\\x{4e00}-\\x{9fa5}]{1,10}){0,9})?$/iu'));
         //关键词
         $data['tra_desc'] = $validate->getPost('tra_desc', \Validate::length(250, 0), ['slashes' => true, 'html' => true]);
         //验证数据
         if ($validate->getMessage()) {
             $this->end(400);
         }
         //生成学校logo,缩略图
         $tra_logo = \Func::touchImg($data['tra_logo'], 'tra_logo');
         $tra_thumb = \Func::touchImg($data['tra_thumb'], 'tra_thumb');
         //将生成的图片地址存入img,用户失败时删除
         $img = [UPLOAD_PATH . $data['tra_logo'], UPLOAD_PATH . $data['tra_thumb']];
         //监测图片是否全部生成成功
         if ($data['tra_logo'] && !$tra_logo || $data['tra_thumb'] && !$tra_thumb) {
             \FileUtil::getInstance()->unlink($img);
             $this->end(400);
         }
         $data['tra_logo'] = $tra_logo;
         $data['tra_thumb'] = $tra_thumb;
         if (!$tra_logo) {
             unset($data['tra_logo']);
         }
         if (!$tra_thumb) {
             unset($data['tra_thumb']);
         }
         //修改高校
         $result = (new \Train())->updateTrain($this->session->get('id'), $tra_id, $data);
         if ($result != 200) {
             \FileUtil::getInstance()->unlink($img);
         }
         $this->end($result);
     }
     //高校id
     $tra_id = (int) $tra_id;
     //获取学校基本信息
     $detail = (new \Train())->getDetail($tra_id);
     if ($detail == 404) {
         $this->dispatcher->forward(['controller' => 'error', 'action' => 'error404']);
     }
     //获取学校已存在属性
     $att_id = (new \College())->getAttId($tra_id);
     //获取省份数据
     $provinces = (new \Site())->getProvince();
     //城市数据
     $city = (new \Site())->getCity($detail['pro_code']);
     //区县数据
     $area = (new \Site())->getArea($detail['city_code']);
     //城市数据
     $district = (new \Site())->getDist($detail['city_code']);
     //工程属性
     $category = (new \Train())->getCategory();
     //   print_r($detail);die;
     //加载所需js
     $this->assets->addJs('backend/js/datetime/bootstrap-datepicker.js');
     $this->assets->addJs('backend/js/editors/summernote/summernote.js');
     $this->assets->addJs('backend/mt-js/train-detail.js');
     // 加载公共部分
     $this->view->setLayout('train');
     $this->view->setVars(['provinces' => $provinces, 'city' => $city, 'area' => $area, 'district' => $district, 'category' => $category, 'detail' => $detail, 'att_id' => $att_id, 'tra_id' => $tra_id]);
 }
Example #19
0
 /**
  * 修改新闻分类
  */
 public function updCategoryAction()
 {
     //判定是否是ajax请求
     if (!$this->request->isAjax()) {
         return 403;
     }
     $validate = new \Validate();
     $data['news_cat_id'] = $validate->getPost('news_cat_id', \Validate::int());
     //新闻分类id
     $data['news_cat_name'] = $validate->getPost('news_cat_name', \Validate::regex('/^[\\da-z\\x{4e00}-\\x{9fa5}]{2,10}$/iu'));
     //新闻分类名称
     $data['news_cat_sort'] = $validate->getPost('news_cat_sort', \Validate::regex('/^(0|[1-9]\\d{0,7})$/'));
     //新闻分类排序
     $data['news_cat_key'] = $validate->getPost('news_cat_key', \Validate::regex('/^[a-z\\d\\x{4e00}-\\x{9fa5}]{1,10}([\\s,][a-z\\d\\x{4e00}-\\x{9fa5}]{1,10}){0,9}$/iu'));
     //新闻分类关键词
     $data['news_cat_desc'] = $validate->getPost('news_cat_desc', \Validate::length(250, 2), ['slashes' => true, 'html' => true]);
     //新闻分类描述
     //验证参数
     if ($validate->getMessage()) {
         $this->end(400);
     }
     $this->end((new \News())->updCategory($this->session->get('id'), $data));
 }
Example #20
0
 /**
  * 修改学校课程
  */
 public function detailAction($col_id, $col_maj_id)
 {
     //检查是否是ajax请求
     if ($this->request->isAjax()) {
         $validate = new \Validate();
         $col_id = (int) $col_id;
         //学校ID
         $data['col_maj_id'] = (int) $col_maj_id;
         //学校专业关联id
         $data['maj_id'] = $validate->getPost('maj_id', \Validate::int());
         //专业ID
         $data['maj_par_id'] = $validate->getPost('maj_par_id', \Validate::int());
         //专业分类ID
         $data['maj_par_par_id'] = $validate->getPost('maj_par_par_id', \Validate::int());
         //专业学科ID
         $data['maj_sort'] = $validate->getPost('maj_sort', \Validate::int());
         //专业排序
         $data['maj_click'] = $validate->getPost('maj_click', \Validate::int());
         //专业点击量
         $data['is_stress'] = $validate->getPost('is_stress', \Validate::int());
         //国家重点
         $data['is_brand'] = $validate->getPost('is_brand', \Validate::int());
         //国家专题
         $data['is_province'] = $validate->getPost('is_province', \Validate::int());
         //省部重点
         $data['col_maj_name'] = $validate->getPost('col_maj_name', \Validate::regex('/^[a-z0-9\\x{4e00}-\\x{9fa5}\\(\\)()]{2,30}$/iu'));
         //专业名称
         $data['col_maj_faculty'] = $validate->getPost('col_maj_faculty', \Validate::regex('/^[a-z0-9\\x{4e00}-\\x{9fa5}\\(\\)()]{2,30}$/iu'));
         //专业学院
         $data['maj_summary'] = $validate->getPost('maj_summary', \Validate::length(1000000, 0), ['slashes' => true]);
         //招生简章
         //验证数据
         if ($validate->getMessage()) {
             $this->end(400);
         }
         //验证高校专业是否存在
         $result = (new \College())->getMajor($col_id, $data['col_maj_id']);
         if ($result == 404) {
             $this->end(404);
         }
         //修改高校课程
         $result = (new \College())->UpdateMajor($this->session->get('id'), $data);
         if ($result != 200) {
             $this->end(400);
         }
         $this->end($result);
     }
     //获取参数
     $col_maj_id = (int) $col_maj_id;
     $col_id = (int) $col_id;
     //获取详细信息
     $detail = (new \College())->getMajor($col_id, $col_maj_id);
     if ($detail == 404) {
         $this->end(404);
     }
     //获取一级分类
     $categorys = (new \Major())->getCategory();
     //湖区专业分类列表
     $major_parent = (new \Major())->getParent($detail['maj_par_par_id']);
     //获取专业列表
     $major = (new \Major())->getMajor($detail['maj_par_id']);
     //教学类型
     $genre = (new \Genre())->getList();
     //加载所需js
     $this->assets->addJs('backend/js/editors/summernote/summernote.js');
     $this->assets->addJs('backend/mt-js/major-detail.js');
     $this->view->setLayout('college');
     $this->view->setVars(['detail' => $detail, 'col_id' => $col_id, 'categorys' => $categorys, 'major_parent' => $major_parent, 'major' => $major, 'genre' => $genre]);
 }
Example #21
0
    }
    /**
     * Getter for fetching error list
     * 
     * @return array
     */
    public function get_errors()
    {
        return $this->_error;
    }
    /**
     * Privately collects errors
     * 
     * @param string $details
     */
    private function _error($details)
    {
        $this->_error[] = $details;
    }
}
$val = new Validate();
$val->max_length('superman', 1);
$val->min_length('superman', 2);
$val->length('superman', [9, 12]);
$val->is_alpha(123);
$val->is_alphanum('dog');
$val->is_numeric('dog');
if (!$val->submit()) {
    $errors = $val->get_errors();
    print_r($errors);
}
Example #22
0
 public function praiseAction($page_id, $id)
 {
     //判断是否是ajax请求
     if ($this->request->isAjax()) {
         $validate = new \Validate();
         $data['tra_id'] = (int) $id;
         $data['ip'] = $this->getClientIp();
         $data['content'] = $validate->getPost('content', \Validate::length(255, 0), ['slashes' => true, 'html' => true]);
         $data['star'] = $validate->getPost('star', \Validate::int());
         if ($validate->getMessage()) {
             $this->end(404);
         }
         $this->end((new \Train())->Review($data));
     }
     //验证大学是否存在
     $id = (int) $id;
     $page_id = (int) $page_id < 1 ? 1 : (int) $page_id;
     $train = (new \Train())->getDetail($id);
     if ($train == 404) {
         $this->notFound();
     }
     $teacher = (new \Train())->getHotTeacher($id, 3);
     $praise = (new \Train())->getAllPraise($id, $page_id);
     foreach ($praise['list'] as $key => $val) {
         $praise['list'][$key]['tra_rev_ip'] = $this->ipGetCity($val['tra_rev_ip']) == 404 ? "未知网友" : $this->ipGetCity($val['tra_rev_ip']);
     }
     $page_html = $this->praisePageHtml($praise['page']);
     //设置标题
     $this->tag->setTitle($train['tra_name'] . "-51升学网");
     //引入css 和js
     $this->assets->addCss("fontend/css/org2/public-praise2.css");
     $this->assets->addJs("fontend/js/org2_base.js");
     $this->view->setVars(['train' => $train, 'praise' => $praise['list'], 'teacher' => $teacher, 'page' => $praise['page'], 'page_html' => $page_html]);
 }
Example #23
0
 /**
  * 小初高学校生活
  */
 public function lifeAction($sch_id)
 {
     //检查是否是ajax请求
     if ($this->request->isAjax()) {
         $validate = new \Validate();
         $data['sch_life_eat'] = $validate->getPost('sch_life_eat', \Validate::length(255, 2), ['slashes' => true, 'html' => true]);
         //食堂信息
         $data['sch_life_homework'] = $validate->getPost('sch_life_homework', \Validate::length(255, 2), ['slashes' => true, 'html' => true]);
         //作业安排
         $data['sch_life_stay'] = $validate->getPost('sch_life_stay', \Validate::length(255, 2), ['slashes' => true, 'html' => true]);
         //住宿信息
         $data['sch_life_rest'] = $validate->getPost('sch_life_rest', \Validate::length(255, 2), ['slashes' => true, 'html' => true]);
         //作息时间
         $data['sch_life_activity'] = $validate->getPost('sch_life_activity', \Validate::length(255, 2), ['slashes' => true, 'html' => true]);
         //课外活动
         $data['sch_life_basic'] = $validate->getPost('sch_life_basic', \Validate::length(255, 2), ['slashes' => true, 'html' => true]);
         //基本设施
         //验证参数
         if ($validate->getMessage()) {
             $this->end(400);
         }
         //新增学校
         $result = (new \School())->updSchoolLife($this->session->get('id'), $data, $sch_id);
         $this->end($result);
     }
     //学校id
     $sch_id = (int) $sch_id;
     //学校生活数据
     $sch_life = (new \School())->getSchoolLife($sch_id);
     //加载js
     $this->assets->addJs('backend/mt-js/life-new.js');
     $this->view->setLayout('school');
     $this->view->setVars(['sch_id' => $sch_id, 'sch_life' => $sch_life]);
 }
Example #24
0
 /**
  * 学校详情
  * parmar  $col_id 学校id
  */
 public function detailAction($col_id)
 {
     //检查是否是ajax请求
     if ($this->request->isAjax()) {
         $validate = new \Validate();
         $data['col_logo'] = $validate->getPost('col_logo');
         //学校logo
         $data['col_thumb'] = $validate->getPost('col_thumb');
         //学校缩略图
         $data['col_name'] = $validate->getPost('col_name', \Validate::regex('/^[a-z0-9\\x{4e00}-\\x{9fa5}\\(\\)()]{2,30}$/iu'));
         //学校名称
         $data['col_code'] = $validate->getPost('col_code', \Validate::regex('/^(\\d{3,6})?$/'));
         //学校code
         $data['col_build'] = $validate->getPost('col_build', \Validate::regex('/^[a-z0-9\\x{4e00}-\\x{9fa5}\\(\\)\\-()]{0,30}$/iu'));
         //学校创建时间
         $data['att_id'] = $validate->getPost('att_id');
         //学校属性
         $data['col_department'] = $validate->getPost('col_department', \Validate::regex('/^[a-z0-9\\x{4e00}-\\x{9fa5}]{2,30}$/iu'));
         //隶属部门
         $data['gen_id'] = $validate->getPost('gen_id', \Validate::int());
         //教学类型
         $data['is_join'] = $validate->getPost('is_join', \Validate::scopeCall('Setting', 'getJoin'));
         //官方合作
         $data['is_fine'] = $validate->getPost('is_fine', \Validate::scopeCall('Setting', 'getFine'));
         //优秀学校
         $data['is_honesty'] = $validate->getPost('is_honesty', \Validate::scopeCall('Setting', 'getFine'));
         //诚信学校
         $data['public_type'] = $validate->getPost('public_type', \Validate::scopeCall('Setting', 'getPublic'));
         //办学性质
         $data['hire_type'] = $validate->getPost('hire_type', \Validate::scopeCall('Setting', 'getHire'));
         //办学性质
         $data['col_type'] = $validate->getPost('col_type', \Validate::scopeCall('Setting', 'getColType'));
         //学校类型
         $data['col_tel'] = $validate->getPost('col_tel', \Validate::length(60, 0), ['slashes' => true, 'html' => true]);
         //联系电话
         $data['col_mail'] = $validate->getPost('col_mail', \Validate::length(80, 0), ['slashes' => true, 'html' => true]);
         //邮箱
         $data['col_url'] = $validate->getPost('col_url', \Validate::length(80, 0), ['slashes' => true, 'html' => true]);
         //学校官网
         $data['col_enroll_url'] = $validate->getPost('col_enroll_url', \Validate::length(80, 0), ['slashes' => true, 'html' => true]);
         //学校招生官网
         $data['col_man'] = $validate->getPost('col_man', \Validate::regex('/^(0|(-)?[1-9]\\d?)(\\.\\d{1,2})?$/'));
         //男生比例
         $data['col_job'] = $validate->getPost('col_job', \Validate::regex('/^(0|(-)?[1-9]\\d?0?)(\\.\\d{1,2})?$/'));
         //就业率
         $data['col_degree'] = $validate->getPost('col_degree', \Validate::regex('/^(0|(-)?[1-9]\\d?)(\\.\\d{1,2})?$/'));
         //报考难度
         $data['col_academician'] = $validate->getPost('col_academician', \Validate::int());
         //院士数量
         $data['col_test'] = $validate->getPost('col_test', \Validate::int());
         //国家实验室数量
         $data['col_stress'] = $validate->getPost('col_stress', \Validate::int());
         //重点专业数量
         $data['col_master'] = $validate->getPost('col_master', \Validate::int());
         //硕士点数
         $data['col_doctor'] = $validate->getPost('col_doctor', \Validate::int());
         //院士点数
         $data['pro_code'] = $validate->getPost('pro_code', \Validate::regex('/^[1-9]\\d{5}$/'));
         //学校所在省份编码
         $data['city_code'] = $validate->getPost('city_code', \Validate::regex('/^[1-9]\\d{5}$/'));
         //学校所在城市编码
         $data['col_addr'] = $validate->getPost('col_addr', \Validate::length(60, 0), ['slashes' => true, 'html' => true]);
         //详细地址
         $data['col_summary'] = $validate->getPost('col_summary', \Validate::length(100000, 0), ['slashes' => true]);
         //学校简介
         $data['col_key'] = $validate->getPost('col_key', \Validate::length(100, 0), ['slashes' => true, 'html' => true]);
         //关键词
         $data['col_desc'] = $validate->getPost('col_desc', \Validate::length(250, 0), ['slashes' => true, 'html' => true]);
         //描述
         $data['col_cost'] = $validate->getPost('col_cost', \Validate::length(100000, 0), ['slashes' => true]);
         //收费情况
         $data['col_general'] = $validate->getPost('col_general', \Validate::length(100000, 0), ['slashes' => true]);
         //招生简章
         //验证数据
         if ($validate->getMessage()) {
             $this->end(400);
         }
         //生成学校logo,缩略图
         $col_logo = \Func::touchImg($data['col_logo'], 'col_logo');
         $col_thumb = \Func::touchImg($data['col_thumb'], 'col_thumb');
         //将生成的图片地址存入img,用户失败时删除
         $img = [UPLOAD_PATH . $data['col_logo'], UPLOAD_PATH . $data['col_thumb']];
         //监测图片是否全部生成成功
         if ($data['col_logo'] && !$col_logo || $data['col_thumb'] && !$col_thumb) {
             \FileUtil::getInstance()->unlink($img);
             $this->end(400);
         }
         $data['col_logo'] = $col_logo;
         $data['col_thumb'] = $col_thumb;
         if (!$col_logo) {
             unset($data['col_logo']);
         }
         if (!$col_thumb) {
             unset($data['col_thumb']);
         }
         //修改高校
         $result = (new \College())->updateCollege($this->session->get('id'), $col_id, $data);
         if ($result != 200) {
             \FileUtil::getInstance()->unlink($img);
         }
         $this->end($result);
     }
     //高校id
     $col_id = (int) $col_id;
     //获取学校基本信息
     $detail = (new \College())->getDetail($col_id);
     if ($detail == 404) {
         $this->dispatcher->forward(['controller' => 'error', 'action' => 'error404']);
     }
     //获取学校已存在属性
     $att_id = (new \College())->getAttId($col_id);
     //获取省份数据
     $provinces = (new \Site())->getProvince();
     //城市数据
     $city = (new \Site())->getCity($detail['pro_code']);
     //工程属性
     $attribute = (new \Attribute())->getList();
     //教学类型
     $genre = (new \Genre())->getList();
     //   print_r($detail);die;
     //加载所需js
     $this->assets->addJs('backend/js/datetime/bootstrap-datepicker.js');
     $this->assets->addJs('backend/js/editors/summernote/summernote.js');
     $this->assets->addJs('backend/mt-js/college-detail.js');
     // 加载公共部分
     $this->view->setLayout('college');
     $this->view->setVars(['provinces' => $provinces, 'city' => $city, 'attribute' => $attribute, 'genre' => $genre, 'detail' => $detail, 'att_id' => $att_id, 'col_id' => $col_id]);
 }
Example #25
0
 public function replayAction($id)
 {
     //判断是否ajax访问
     if ($this->request->isAjax()) {
         $validate = new \Validate();
         $data['id'] = (int) $id;
         $data['ip'] = $this->getClientIp();
         $data['content'] = $validate->getPost('content', \Validate::length(255, 0), ['slashes' => true, 'html' => true]);
         if ($validate->getMessage()) {
             $this->end(404);
         }
         $this->end((new \Major())->Review($data));
     }
     $data['action'] = "replay";
     $data['id'] = (int) $id;
     $data['type'] = $this->request->getQuery('type') ? $this->request->getQuery('type') : 1;
     $data['id'] = $this->request->getQuery('id') ? $this->request->getQuery('id') : 0;
     $detail = (new \Major())->getDetail($id);
     $list = (new \Major())->getList($detail['maj_type']);
     foreach ($list as &$val) {
         $val['url'] = "/major/list?type=" . $data['type'] . "&id=" . $val['maj_par_par_id'];
     }
     $web_key = "51升学网-" . $detail['maj_name'];
     $web_desc = strip_tags($detail['maj_explain']);
     $this->tag->setTitle($detail['maj_name'] . "-51升学网");
     $this->view->setLayout("major");
     $replay = (new \Major())->getReplay($id);
     foreach ($replay as $key => $val) {
         $replay[$key]['maj_rev_ip'] = $this->ipGetCity($val['maj_rev_ip']) == 404 ? "未知网友" : $this->ipGetCity($val['maj_rev_ip']);
     }
     //引入js 和css
     $this->assets->addCss("fontend/css/major/detail-reply.css");
     $this->assets->addJs("fontend/js/major_detail_reply.js");
     $this->view->setVars(['list' => $list, 'detail' => $detail, 'replay' => $replay, 'data' => $data, 'web_key' => $web_key, 'web_desc' => $web_desc]);
 }