/** * @var string the default layout for the views. Defaults to '//layouts/column2', meaning * using two-column layout. See 'protected/views/layouts/column2.php'. */ public function loadScheme($schemid) { if ($this->_scheme === null) { $this->_scheme = Scheme::model()->findbyPk($schemid); if ($this->_scheme === null) { throw new CHttpException(404, 'The requested scheme does not exist.'); } } return $this->_scheme; }
/** * 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 the ID of the model to be loaded */ public function loadModel($id) { $model = Scheme::model()->with('university')->findByPk((int) $id); if ($model === null) { throw new CHttpException(404, 'The requested page does not exist.'); } return $model; }
public static function getSchemeOptions() { //lists all schemes $_Schemes = Scheme::model()->findAll(); $schemesArray = CHtml::listData($_Schemes, 'id', 'name'); return $schemesArray; }