Пример #1
0
 public function actionDoctor()
 {
     if (isset($_GET['id'])) {
         $model = Alumni::model()->findByPk($_GET['id']);
         $this->render('detail', array('model' => $model));
     } else {
         $criteria = new CDbCriteria();
         $criteria->select = '*';
         $criteria->condition = 'status = 1 AND alumni_group=\'Doctor\'';
         $criteria->order = 'sort_order';
         $total = Alumni::model()->count($criteria);
         $pages = new CPagination($total);
         $pages->setPageSize(10);
         $pages->applyLimit($criteria);
         $model = Alumni::model()->findAll($criteria);
         $this->render('doctor', array('model' => $model, 'pages' => $pages));
     }
 }
Пример #2
0
 /**
  * Returns the data model based on the primary key given in the GET variable.
  * If the data model is not found, an HTTP exception will be raised.
  * @param integer $id the ID of the model to be loaded
  * @return Alumni the loaded model
  * @throws CHttpException
  */
 public function loadModel($id)
 {
     $model = Alumni::model()->findByPk($id);
     if ($model === null) {
         throw new CHttpException(404, 'The requested page does not exist.');
     }
     return $model;
 }