当前位置: 首页>>代码示例>>PHP>>正文


PHP School::getList方法代码示例

本文整理汇总了PHP中School::getList方法的典型用法代码示例。如果您正苦于以下问题:PHP School::getList方法的具体用法?PHP School::getList怎么用?PHP School::getList使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在School的用法示例。


在下文中一共展示了School::getList方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: listAction

 /**
  * 学校列表
  */
 public function listAction()
 {
     //当前页码
     $page_id = (int) $this->request->getQuery('page');
     $page_id = $page_id < 1 ? 1 : $page_id;
     //省份code
     $pro_code = (int) $this->request->getQuery('pro_code');
     //城市code
     $city_code = (int) $this->request->getQuery('city_code');
     //区县code
     $area_code = (int) $this->request->getQuery('area_code');
     //学校类型
     $sch_type = (int) $this->request->getQuery('sch_type');
     //关键字
     $keyword = preg_replace('/[^\\da-z\\x{4e00}-\\x{9fa5}]/iu', '', mb_substr($this->request->getQuery('keyword'), 0, 10, 'utf-8'));
     //关键字长度小于10,并且只能是字符数字中文
     //每页显示条数
     $limit = 20;
     //省市区县
     $site = new \Site();
     $provinces = $site->getProvince();
     //省
     $cities = $site->getCity($pro_code);
     //城市
     $areas = $site->getArea($city_code);
     //区县
     //查询数据
     $school = new \School();
     $list = $school->getList($page_id, $limit, $pro_code, $city_code, $area_code, $sch_type, $keyword);
     //数据
     $page_html = $this->pageHtml($list['page']);
     //分页html
     //加载js
     $this->assets->addJs('backend/mt-js/school-list.js');
     $this->view->setVars(['pro_code' => $pro_code, 'city_code' => $city_code, 'area_code' => $area_code, 'sch_type' => $sch_type, 'keyword' => $keyword, 'provinces' => $provinces, 'cities' => $cities, 'areas' => $areas, 'list' => $list, 'page_html' => $page_html]);
 }
开发者ID:xw716825,项目名称:git_back,代码行数:39,代码来源:SchoolController.php

示例2: student

 public function student()
 {
     function isEmpty($value)
     {
         return strlen('' . $value) == 0;
     }
     //if ($this->user->firstname == 'fred'){
     //echo 'user->school_id &#9830; '.$this->user->school_id.'<br>';
     //echo (int)empty($this->request->get('school')).'<br>';
     //echo $this->request->get('school', 0).'<br>';
     //echo 'empty(user->school_id) &#9830; '.(int)isEmpty($this->user->school_id).'<br>';
     //}
     $school_id = !isEmpty($this->user->school_id) ? $this->user->school_id : 1;
     //if ($this->user->firstname == 'fred') echo '$school_id &#9830; '.$school_id.'<br>';
     $school_id = !empty($this->request->get('school')) ? $this->request->get('school') : $school_id;
     //if ($this->user->firstname == 'fred') echo '$school_id &#9830; '.$school_id.'<br>';
     $schools = '';
     if ($this->user->isRole('admin') or $this->user->isRole('pdt')) {
         $schools = School::getList('SELECT * FROM school ORDER BY name DESC');
     }
     $where = '';
     $where = 'AND school_id=' . $school_id;
     if ($this->user->isRole('admin')) {
         $where = 'AND school_id=' . $school_id;
     }
     if ($this->user->isRole('pdt')) {
         $where = 'AND school_id=' . $school_id;
     }
     if ($this->user->isRole('dir')) {
         //$school_id = $this->user->school_id;
         $where = 'AND school_id=' . $school_id;
     }
     if ($this->user->isRole('prof')) {
         $where = 'AND school_id=' . $school_id;
     }
     $promos = Promotion::getList('SELECT * FROM session WHERE true ' . $where . ' ORDER BY date_start DESC');
     function currentPromo_id($promos)
     {
         $now = date('Y-m-d');
         foreach ($promos as $index => $promo) {
             if ($now >= $promo->date_start and $now <= $promo->date_end) {
                 return $promo->id;
             }
         }
         if (!empty($promo[0])) {
             return $promo[0]->id;
         } else {
             return '0';
         }
     }
     $promo_id = $this->request->get('promo', 0);
     if ($promo_id == 0) {
         $promo_id = currentPromo_id($promos);
     }
     $students = Student::getList('SELECT s.*, CONCAT(s.firstname," ",s.lastname)as fullname FROM student as s, session as p WHERE p.id=s.session_id AND p.id=' . $promo_id);
     $edit_url = $this->user->canDo('student_update') ? ROOT_HTTP . 'admin/student/update' : '';
     $delete_url = $this->user->canDo('student_delete') ? ROOT_HTTP . 'admin/student/delete' : '';
     $tableStudents = new Table('data-table', 'student', $students, ['id', 'fullname', 'email'], $edit_url, $delete_url);
     //if ($this->user->firstname == 'fred') echo '$school_id &#9830; '.$school_id.'<br>';
     $vars = ['canAddStudent' => $this->user->canDo('student_create'), 'schools' => $schools, 'school_id' => $school_id, 'promos' => $promos, 'promo_id' => $promo_id, 'table' => $tableStudents->render()];
     $this->render('admin/student', $vars);
 }
开发者ID:erichub,项目名称:-Dashboard-Process,代码行数:62,代码来源:AdminController.class.php


注:本文中的School::getList方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。