本文整理汇总了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]);
}
示例2: student
public function student()
{
function isEmpty($value)
{
return strlen('' . $value) == 0;
}
//if ($this->user->firstname == 'fred'){
//echo 'user->school_id ♦ '.$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) ♦ '.(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 ♦ '.$school_id.'<br>';
$school_id = !empty($this->request->get('school')) ? $this->request->get('school') : $school_id;
//if ($this->user->firstname == 'fred') echo '$school_id ♦ '.$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 ♦ '.$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);
}