本文整理汇总了PHP中Comment::unsetAttributes方法的典型用法代码示例。如果您正苦于以下问题:PHP Comment::unsetAttributes方法的具体用法?PHP Comment::unsetAttributes怎么用?PHP Comment::unsetAttributes使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Comment
的用法示例。
在下文中一共展示了Comment::unsetAttributes方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: actionAdmin
/**
* Manages all models.
*/
public function actionAdmin()
{
$model = new Comment('search');
$model->unsetAttributes();
// clear any default values
if (isset($_GET['Comment'])) {
$model->attributes = $_GET['Comment'];
}
$this->render('admin', array('model' => $model));
}
示例2: actionView
public function actionView($id)
{
$model = $this->loadModel($id);
if (isset($_POST['Comment'])) {
$modelComment = new Comment();
$modelComment->attributes = $_POST['Comment'];
$modelComment->post_id = $id;
if ($modelComment->save()) {
$modelComment->unsetAttributes();
// reset form
Yii::app()->user->setFlash('success', "Comment added!");
}
}
$this->render('view', array('model' => $model));
}
示例3: actionIndex
/**
* Display all site comments
*/
public function actionIndex()
{
$model = new Comment('search');
$model->unsetAttributes(); // clear any default values
if(!empty($_GET['Comment']))
$model->attributes = $_GET['Comment'];
$dataProvider = $model->search();
$dataProvider->pagination->pageSize = Yii::app()->settings->get('core', 'productsPerPageAdmin');
$this->render('index', array(
'model'=>$model,
'dataProvider'=>$dataProvider
));
}
示例4: actionIndex
public function actionIndex() {
$model = new Comment('search');
$model->unsetAttributes();
if(!empty($_GET['Comment']))
$model->attributes = $_GET['Comment'];
$criteria = new CDbCriteria;
$criteria->condition = 'id_parent is null';
$dataProvider = $model->search($criteria);
$dataProvider->pagination->pageSize = 25;
$this->render('index', array(
'model'=>$model,
'dataProvider'=>$dataProvider
));
}
示例5: actionManage
/**
* Manages all models.
*/
public function actionManage()
{
$model = new Comment('search');
$model->unsetAttributes();
// clear any default values
if (isset($_GET['status'])) {
$model->status = $_GET['status'];
}
$this->render('manage', array('model' => $model));
}
示例6: actionAdmin
/**
* Manages all models.
*/
public function actionAdmin()
{
if (isset($_GET['pageSize'])) {
Yii::app()->user->setState('pageSize', (int) $_GET['pageSize']);
unset($_GET['pageSize']);
// would interfere with pager and repetitive page size change
}
$model = new Comment('search');
$model->unsetAttributes();
// clear any default values
if (isset($_GET['Comment'])) {
$model->attributes = $_GET['Comment'];
}
$this->render('admin', array('model' => $model));
}
示例7: actionTrash
public function actionTrash($id = NULL)
{
$model = new Comment('search');
$model->unsetAttributes();
// clear any default values
if (isset($_GET['Comment'])) {
$model->attributes = $_GET['Comment'];
}
if (isset($id)) {
$model = $this->loadModel($id);
$model->status = 1;
$ids = array();
$result = Comment::model()->getAllParent($id, $ids);
if ($model->save(true, array('status'))) {
$transaction = Yii::app()->db->beginTransaction();
try {
if ($result && Comment::model()->updateAllNode($model->status, $ids)) {
$transaction->commit();
}
} catch (Exception $ex) {
$transaction->rollback();
}
Yii::app()->user->setFlash('success', Yii::t('comment', 'Comment was re-activate.'));
} else {
Yii::app()->user->setFlash('error', Yii::t('comment', 'Comment cannot re-activate. Please try it later.'));
}
$this->redirect(array('/' . backend . '/comment/trash'));
}
$this->render(strtolower($this->action->Id), array('model' => $model));
}
示例8: actionAdmin
/**
* Manages all models.
*/
public function actionAdmin()
{
$travelerId = null;
if (isset($_GET['travelerId'])) {
$travelerId = $_GET['travelerId'];
} else {
throw new CHttpException(404, 'The requested page does not exist.');
}
$model = new Comment('search');
$model->unsetAttributes();
// clear any default values
if (isset($_GET['Comment'])) {
$model->attributes = $_GET['Comment'];
}
$this->render('admin', array('model' => $model, 'travelerId' => $travelerId));
}
示例9: actionIndex
/**
* Manages all models.
*/
public function actionIndex()
{
$model = new Comment('search');
$model->unsetAttributes();
// clear any default values
$model->setAttributes(Yii::app()->getRequest()->getParam('Comment', array()));
$this->render('index', array('model' => $model));
}