本文整理汇总了PHP中Content::unsetAttributes方法的典型用法代码示例。如果您正苦于以下问题:PHP Content::unsetAttributes方法的具体用法?PHP Content::unsetAttributes怎么用?PHP Content::unsetAttributes使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Content
的用法示例。
在下文中一共展示了Content::unsetAttributes方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: actionIndex
/**
* 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));
}
示例2: actionIndex
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));
}
示例3: actionIndex
/**
* 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));
}
示例4: actionAdmin
/**
* 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));
}
示例5: getAllContent
/**
* 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;
}