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'));
 }
 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));
 }
 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));
 }
Exemple #4
0
 /**
  * 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));
 }
Exemple #5
0
 public function getForUser($user)
 {
     $posts = new Post('search');
     $posts->unsetAttributes();
     $posts->create_user_id = (int) $user;
     return $posts;
 }
Exemple #6
0
 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;
 }
 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));
 }
 /**
  * Управление записями.
  *
  * @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));
 }
 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));
 }
Exemple #10
0
	/**
	 * 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,
		));
	}
 /**
  * Управление записями.
  *
  * @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]);
 }