當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。