/** * Lists all models. */ public function actionIndex() { $this->addToolbar(); $model = new Content('search'); $model->unsetAttributes(); // clear any default values if (isset($_GET['Content'])) { $model->attributes = $_GET['Content']; } $this->render('index', array('model' => $model)); }
public function actionIndex() { if (Yii::app()->user->role == "moderator") { $this->redirect('admin/news'); } $this->layout = '//layouts/admin'; $this->pageTitle = 'Страницы контента'; $this->breadcrumbs = array('Страницы контента'); $model = new Content('search'); $model->unsetAttributes(); if (isset($_GET['Content'])) { $model->attributes = $_GET['Content']; } $this->render('index', array('model' => $model)); }
/** * Default management page * Display all items in a CListView for easy editing */ public function actionIndex() { $preview = NULL; $model = new Content('search'); $model->unsetAttributes(); // clear any default values if (Cii::get($_GET, 'Content') !== NULL) { $model->attributes = $_GET['Content']; } // Only show posts that belong to that user if they are not an editor or an admin if ($role = Yii::app()->user->role) { if ($role != 7 && $role != 9) { $model->author_id = Yii::app()->user->id; } } if (Cii::get($_GET, 'id') !== NULL) { $preview = Content::model()->findByPk(Cii::get($_GET, 'id')); } $model->pageSize = 20; $this->render('index', array('model' => $model, 'preview' => $preview)); }
/** * Manages all models. */ public function actionAdmin() { $Content = new Content('search'); $Content->unsetAttributes(); // clear any default values if (isset($_GET['Content'])) { $Content->attributes = $_GET['Content']; } $this->render('admin', array('Content' => $Content)); }
/** * Retrieves all articles that are published and not password protected */ private function getAllContent() { $model = new Content('Search'); $model->unsetAttributes(); // clear any default values unset($_GET['password']); unset($_GET['like_count']); unset($_GET['comment_count']); if (!empty($_GET)) { $model->attributes = $_GET; } // A list of attributes that we want to hide $attributes = array('password', 'like_count', 'comment_count'); $model->status = 1; $response = array(); foreach ($model->search()->getData() as $content) { if ($content->isPublished() && ($content->password == "" || Cii::decrypt($content->password) == "")) { $response[] = $content->getApiAttributes($attributes); } } return $response; }