public function deleteAction($id = false)
 {
     $this->permission('delete');
     if (!$id) {
         return Brightery::error404();
     }
     $model = new \modules\blog\models\Blog_posts();
     $model->blog_post_id = $id;
     if ($model->delete()) {
         Uri_helper::redirect("management/blog_posts");
     }
 }
Ejemplo n.º 2
0
 public function indexAction()
 {
     $this->language->load('home');
     //      --------start sliders---------
     $this->language->load('sliders');
     $slides = new \modules\sliders\models\Slides();
     $slides->_select = 'slide_id, title, caption, url, image';
     $slides->where('slider_id', '1');
     //      -----------end sliders--------------
     //      ----------start news home-----------
     $this->Language->load('blog_posts');
     $posts = new \modules\blog\models\Blog_posts();
     $posts->_select = 'blog_post_id,title,image,short_content,seo,created';
     $posts->_limit = 4;
     //        $posts->_orderby = 4;
     $post = $posts->get();
     //      ----------end news home------------
     //      -------start testonmials home------
     $this->Language->load('testimonials');
     $testimonials = new \modules\testimonials\models\Testimonials();
     $testimonials->_select = 'testimonial_id,client_name,client_position,message,image';
     $testimonial = $testimonials->get();
     //      --------end testonmials home-------
     //      ----------start clients home-----------
     $this->Language->load('clients');
     $clients = new \modules\clients\models\Clients();
     $clients->_select = 'client_id, name, image';
     $client = $clients->get();
     //      ----------end clients home------------
     $this->Language->load('portfolio_categories');
     $portfolio_categories = new \modules\portfolio\models\Portfolio_categories();
     $portfolio_categories->_select = 'portfolio_category_id, title';
     $portfolio_categories = $portfolio_categories->get();
     $recent_portfolio = $this->Database->query("SELECT portfolio.*" . "FROM `portfolio` " . "ORDER BY portfolio.portfolio_id DESC LIMIT 4")->result();
     $recent_portfolio_ = $this->Database->query("SELECT portfolio.*" . "FROM `portfolio` " . "ORDER BY portfolio.portfolio_id ASC LIMIT 4")->result();
     return $this->render('home', ['slides' => $slides->get(), 'post' => $post, 'testimonial' => $testimonial, 'client' => $client, 'recent_portfolio' => $recent_portfolio, 'recent_portfolio_' => $recent_portfolio_, 'portfolio_category' => $portfolio_categories]);
 }
Ejemplo n.º 3
0
 public function postAction($seo = null)
 {
     if (!$seo) {
         return Brightery::error404();
     }
     $userInfo = $this->permissions->getUserInformation();
     $model = new \modules\blog\models\Blog_posts();
     $categories = new \modules\blog\models\Blog_categories();
     $comments = new \modules\blog\models\Blog_post_comments($userInfo ? 'registered' : 'unregistered');
     $comments->_joins = ['users' => ['users.user_id = blog_post_comments.user_id', 'left']];
     $model->seo = $seo;
     $item = $model->get();
     if (!$item) {
         return Brightery::error404();
     }
     if ($userInfo) {
         $comments->set(['name' => $userInfo->fullname, 'email' => $userInfo->email, 'user_id' => $userInfo->user_id, 'comment' => $this->input->post('comment'), 'datetime' => date('Y-m-d H:i:s')]);
     } else {
         $comments->set(['name' => $this->input->post('name'), 'email' => $this->input->post('email'), 'comment' => $this->input->post('comment'), 'datetime' => date('Y-m-d H:i:s')]);
     }
     $comments->blog_post_id = $item->blog_post_id;
     $comments->save();
     return $this->render('blog/post', ['item' => $item, 'categories' => $categories->get(), 'comments' => $comments->get(), 'comments_no' => $comments->get(1), 'user' => $userInfo]);
 }