コード例 #1
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 the ID of the model to be loaded
  */
 public function loadModel($id)
 {
     $model = CmsNode::model()->findByPk($id);
     if ($model === null) {
         throw new CHttpException(404, 'The requested page does not exist.');
     }
     return $model;
 }
コード例 #2
0
ファイル: AdminController.php プロジェクト: kksshp/cms
 public function loadModel()
 {
     if ($this->_model === null) {
         if (isset($_GET['id'])) {
             $this->_model = CmsNode::model()->findbyPk($_GET['id']);
         }
         if ($this->_model === null) {
             throw new CHttpException(404, 'The requested page does not exist.');
         }
     }
     return $this->_model;
 }
コード例 #3
0
ファイル: CmsBlock.php プロジェクト: kksshp/cms
 /**
  * Runs the widget.
  */
 public function run()
 {
     $model = CmsNode::model()->with('cms')->findByAttributes(array('cms_type' => 2, 'name' => $this->name));
     $this->render('block', array('model' => $model, 'content' => $model->cms->body));
 }