12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455 |
- <?php
- /**
- * 学期管理模型类
- * @author jiangfei
- * @date 2015-08-17 18:28:00
- * @company 上海风车教育有限公司.
- */
- class Semester extends MyActiveRecord{
- public static function model($className = __CLASS__){
- return parent::model($className);
- }
- public function tableName(){
- return "semester";
- }
- // 学生列表
- public function getSemesList($condition = "", $orderBy = "start_time desc"){
-
- $data = array();
- $criteria = new CDbCriteria();
-
- $total = $this->count($criteria);
- $pager = new CPagination($total);
-
- if($condition)
- $criteria->condition = $condition;
- if($orderBy)
- $criteria->order = $orderBy;
-
- $pager->pageSize = 20;
- $pager->applyLimit($criteria);
- $data['result']=$this->findAll($criteria);
- $data['page']=$pager;
- $data['page_total']= $total;
- return $data;
- }
-
-
- // 根据id获取学期名称
- public function getSemesterName($sid){
- $info = $this->findByPk($sid);
-
- if (empty($info)) {
- return null;
- } else {
- return $info->semester_name;
- }
- }
-
-
- }
|