/** * @return array CMenu-prepared links array */ public function mainMenuLinks() { $links = array(); foreach (StaticPage::model()->mainMenu()->findAll() as $p) { $links[] = array("label" => $p->title, "url" => array($this->actionView, "id" => $p->path ? $p->path : $p->id)); } return $links; }
/** * 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) { if (is_numeric($id)) { $model = StaticPage::model()->findByPk($id); } else { $model = StaticPage::model()->findByPath($id); } if ($model === null) { throw new CHttpException(404, 'The requested page does not exist.'); } return $model; }