/** * Add a new page action */ public function actionaddpage() { // Perms if (!Yii::app()->user->checkAccess('op_custompages_addpages')) { throw new CHttpException(403, Yii::t('error', 'Sorry, You don\'t have the required permissions to enter this section')); } $model = new CustomPages(); if (isset($_POST['CustomPages'])) { if (isset($_POST['submit'])) { $model->attributes = $_POST['CustomPages']; if ($model->save()) { Yii::app()->user->setFlash('success', Yii::t('admincustompages', 'Page Added.')); $this->redirect(array('custompages/index')); } } else { if (isset($_POST['preview'])) { $model->attributes = $_POST['CustomPages']; } } } $roles = AuthItem::model()->findAll(array('order' => 'type DESC, name ASC')); $_roles = array(); if (count($roles)) { foreach ($roles as $role) { $_roles[AuthItem::model()->types[$role->type]][$role->name] = $role->name; } } $this->breadcrumbs[Yii::t('admincustompages', 'Adding Custom Page')] = ''; $this->pageTitle[] = Yii::t('admincustompages', 'Adding Custom Page'); // Display form $this->render('page_form', array('roles' => $_roles, 'model' => $model, 'label' => Yii::t('admincustompages', 'Adding Custom Page'))); }