/** * 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 = Supports::model()->findByPk($id); if ($model === null) { throw new CHttpException(404, 'The requested page does not exist.'); } return $model; }
public function run() { //News $criNew = new CDBCriteria(); $criNew->addCondition("category_news_id = 5"); $criNew->order = "id DESC"; $criNew->limit = 5; $arrNews = News::model()->findAll($criNew); //Support $criSupport = new CDbCriteria(); $criSupport->order = "id DESC"; $arrSupport = Supports::model()->findAll($criSupport); /*Ads Right*/ $criAds = new CDbCriteria(); $criAds->addCondition("album_id = 1"); $criAds->order = "id DESC"; $arrAds = Images::model()->findAll($criAds); /*Pictures*/ $criPic = new CDbCriteria(); $criPic->addCondition("album_id = 2"); $criPic->order = "id DESC"; $arrPic = Images::model()->findAll($criPic); $this->render("widgetRight", array('dataSystem' => $this->dataSystem, 'arrNews' => $arrNews, 'arrSupport' => $arrSupport, 'arrAds' => $arrAds, 'arrPic' => $arrPic)); }
public function run() { parent::run(); $data['data'] = Supports::model()->findAll(array("condition" => "state = 1", "order" => "'order' desc")); $this->render('support', $data); }