public function manageAction($id = false, $slider_id = false) { $this->permission('manage'); if ($id) { $model = new \modules\sliders\models\Slides('edit'); $model->slide_id = $id; } else { $model = new \modules\sliders\models\Slides('add'); $model->slider_id = $slider_id; } $model->set($this->Input->post()); $model->language_id = $this->language->getDefaultLanguage(); if (!$id) { $model->created = date("Y-m-d H:i:s"); } if ($model->save()) { Uri_helper::redirect("management/sliders"); } return $this->render('sliders/manage_slide', ['item' => $id ? $model->get() : null]); }
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]); }