本文整理汇总了PHP中Post::unsetAttributes方法的典型用法代码示例。如果您正苦于以下问题:PHP Post::unsetAttributes方法的具体用法?PHP Post::unsetAttributes怎么用?PHP Post::unsetAttributes使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Post
的用法示例。
在下文中一共展示了Post::unsetAttributes方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: actionPost
public function actionPost()
{
$model = new Post('search');
$model->unsetAttributes();
// clear any default values
if (isset($_GET['Post'])) {
$model->attributes = $_GET['Post'];
}
$this->render('post', compact('model'));
}
示例2: actionIndex
public function actionIndex()
{
$model = new Post('search');
$model->unsetAttributes();
// clear any default values
if (isset($_GET['Post'])) {
$model->attributes = $_GET['Post'];
}
$this->render('index', array('model' => $model));
}
示例3: actionCreate
public function actionCreate()
{
$model = new Post();
if (isset($_POST['Post'])) {
$model->attributes = $_POST['Post'];
$model->user_id = Yii::app()->user->id;
if ($model->save()) {
$id = $model->id;
$model->unsetAttributes();
// reset form
Yii::app()->user->setFlash('success', "Post Created!");
$this->redirect(array('post/view', 'id' => $id));
}
}
$this->render('create', array('model' => $model));
}
示例4: actionAdmin
/**
* Administra todos los modelos.
*/
public function actionAdmin()
{
$model = new Post('search');
$model->unsetAttributes();
// borrar los valores por defecto
if (isset($_GET['Post'])) {
$model->attributes = $_GET['Post'];
}
$this->render('admin', array('model' => $model));
}
示例5: getForUser
public function getForUser($user)
{
$posts = new Post('search');
$posts->unsetAttributes();
$posts->create_user_id = (int) $user;
return $posts;
}
示例6: getPosts
public function getPosts()
{
$posts = new Post('search');
$posts->unsetAttributes();
$posts->blog_id = $this->id;
$posts->status = Post::STATUS_PUBLISHED;
$posts->access_type = Post::ACCESS_PUBLIC;
return $posts;
}
示例7: actionAdmin
public function actionAdmin()
{
$lang = $this->getLanguageCode();
//tạo array để hiện thị trên dropDownList category
$listCategory_Array = CategoryLanguage::model()->getListCategoryWithLanguage($lang);
unset($listCategory_Array[1]);
reset($listCategory_Array);
$category_id = key($listCategory_Array);
//lây phan tu dau tien
if (Yii::app()->request->getParam('id')) {
//nếu không tồn tại thì lấy phần tử đầu tiên trong category
$category_id = Yii::app()->request->getParam('id');
}
$model = new Post('search');
$model->unsetAttributes();
// clear any default values
$this->render('admin', array('model' => $model->getListPost($lang, $category_id, 1), 'category_id' => $category_id, 'listCategory_Array' => $listCategory_Array, 'lang' => $lang));
}
示例8: actionIndex
/**
* Управление записями.
*
* @return void
*/
public function actionIndex()
{
$model = new Post('search');
$model->unsetAttributes();
// clear any default values
$model->comment_status = true;
if (Yii::app()->getRequest()->getParam('Post')) {
$model->setAttributes(Yii::app()->getRequest()->getParam('Post'));
}
$this->render('index', array('model' => $model));
}
示例9: actionJobs
public function actionJobs()
{
$model = new Post('search');
$model->unsetAttributes();
// clear any default values
if (isset($_GET['Post'])) {
$model->attributes = $_GET['Post'];
}
//send model object for search
$this->render('jobs', array('dataProvider' => $model->search(), 'model' => $model));
}
示例10: actionAdmin
/**
* Manages all models.
*/
public function actionAdmin() {
$model=new Post('search');
$model->unsetAttributes(); // clear any default values
if (isset($_GET['Post']))
$model->attributes=$_GET['Post'];
$this->render('admin', array(
'model'=> $model,
));
}
示例11: actionIndex
/**
* Управление записями.
*
* @return void
*/
public function actionIndex()
{
$model = new Post('search');
$model->unsetAttributes();
// clear any default values
if (Yii::app()->getRequest()->getParam('Post')) {
$model->setAttributes(Yii::app()->getRequest()->getParam('Post'));
}
$this->render('index', ['model' => $model]);
}