Example #1
0
 public function actionAdmin()
 {
     $model = new Page('search');
     $model->unsetAttributes();
     if (isset($_GET['Page'])) {
         $model->setAttributes($_GET['Page']);
     }
     $this->render('admin', array('model' => $model));
 }
 public function actionManage()
 {
     $model = new Page('search');
     $model->unsetAttributes();
     if (isset($_GET['Page'])) {
         $model->attributes = $_GET['Page'];
     }
     $this->render('manage', ["model" => $model]);
 }
Example #3
0
 /**
  * Manages all models.
  */
 public function actionAdmin()
 {
     $model = new Page('search');
     $model->unsetAttributes();
     // clear any default values
     if (isset($_GET['Page'])) {
         $model->attributes = $_GET['Page'];
     }
     $this->render('admin', array('model' => $model));
 }
Example #4
0
 /**
  * Lists all pages
  *
  * @param int $parentId
  */
 public function actionIndex($parentId = 0)
 {
     $model = new Page('search');
     $this->breadcrumbs = Page::getBreadcrumbs($parentId);
     $model->unsetAttributes();
     $model->parent_id = $parentId;
     if (isset($_GET['Page'])) {
         $model->attributes = $_GET['Page'];
     }
     $this->render('index', array('model' => $model, 'parentId' => $parentId));
 }
Example #5
0
 public function actionUserPages($user_id, $widget = 'list')
 {
     $widgets = self::displayWidgets();
     if (!isset($widgets[$widget])) {
         $this->pageNotFound();
     }
     $user = User::model()->findByPk($user_id);
     if (!$user) {
         $this->pageNotFound();
     }
     $criteria = new CDbCriteria();
     $criteria->with = ['tags'];
     $criteria->order = 'date_create DESC';
     $is_owner = !Yii::app()->user->isGuest && Yii::app()->user->id == $user->id;
     if ($is_owner) {
         $this->page_title = t('Ваши страницы');
         $model = new Page(ActiveRecord::SCENARIO_SEARCH);
         $model->unsetAttributes();
         if (isset($_GET['Page'])) {
             $model->attributes = $_GET['Page'];
         }
         $criteria->compare('status', $model->status);
     } else {
         $this->page_title = t("Страницы пользователя " . "(" . $user->name . ")");
         $criteria->compare('status', Page::STATUS_PUBLISHED);
     }
     $data_provider = new CActiveDataProvider('Page', ['criteria' => $criteria, 'pagination' => ['pageSize' => '10']]);
     $this->render('userPages', ['data_provider' => $data_provider, 'widget' => $widget, 'user' => $user, 'model' => isset($model) ? $model : null]);
 }
Example #6
0
 public function actionManage()
 {
     $page = new Page('search');
     $page->unsetAttributes();
     $page->type = 'Page';
     if (isset($_GET['Page'])) {
         $page->setAttributes($_GET['Page']);
     }
     $this->render('manage', array('page' => $page));
 }
 /**
  * Manages all models.
  *
  * @return void
  */
 public function actionIndex()
 {
     $model = new Page('search');
     $model->unsetAttributes();
     $model->setAttributes(Yii::app()->getRequest()->getParam('Page', []));
     $this->render('index', ['model' => $model, 'pages' => Page::model()->getAllPagesList()]);
 }
 /**
  * Manages all models.
  */
 public function actionAdmin()
 {
     if ($this->menu_use[1]) {
         $model = new Page('search');
         $model->unsetAttributes();
         // clear any default values
         if (isset($_GET['Page'])) {
             $model->attributes = $_GET['Page'];
         }
         $this->render('admin', array('model' => $model));
     } else {
         $this->redirect(array('site/index'));
     }
 }