/**
  * 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));
 }
 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));
 }
	/**
	 * 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
		));
	}
    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
        ));
    }
Example #5
0
 /**
  * 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));
 }
Example #6
0
 /**
  * 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));
 }
 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));
 }
 /**
  * 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));
 }
 /**
  * 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));
 }