public function init() { // Here we define query conditions. $criteria = new CDbCriteria(); //$criteria->condition = '`status` = 1'; $criteria->order = '`id` ASC'; $items = CmsvideoMenu::model()->findAll($criteria); foreach ($items as $item) { $this->items[] = array('label' => $item->menu_text, 'url' => $item->menu_link); } parent::init(); }
public function actionMenuUpdate($id) { $this->pageTitle = 'Edit Menu'; if (!is_numeric($id)) { exit; } $MenuUpdate = false; $ModelMenu = CmsvideoMenu::model()->findByPk($id); if (isset($_POST['CmsvideoMenu'])) { $ModelMenu->attributes = $_POST['CmsvideoMenu']; if ($ModelMenu->validate()) { $ModelMenu->save(); $MenuUpdate = true; } $this->redirect(array('/admin/menu')); } $this->render('menuupdate', array('ModelMenu' => $ModelMenu, 'MenuUpdate' => $MenuUpdate)); }