X-Git-Url: http://p2p-next.cs.pub.ro/gitweb/?a=blobdiff_plain;f=application%2Fcontrollers%2Fcatalog.php;h=3ed020f44580a1f7cd5c9105c4d06f4f3595d47a;hb=ac366a43f0cda63c2506321104b6760c153ac993;hp=37b1a6cb32ecaa0ec1dae4c3d030068526fc13b1;hpb=6c67c9d74550575fbc96be0baad42260c2dbcb6a;p=living-lab-site.git diff --git a/application/controllers/catalog.php b/application/controllers/catalog.php index 37b1a6c..3ed020f 100644 --- a/application/controllers/catalog.php +++ b/application/controllers/catalog.php @@ -1,39 +1,144 @@ lang->load('catalog'); + } + public function index() { + // ** + // ** LOADING MODEL + // ** // Retrieve videos summary. $this->load->model('videos_model'); - $data['videos'] = $this->videos_model->get_videos_summary(); + foreach ($this->config->item('categories') as $id => $name) + { + // Videos + $vs_data['videos'] = $this->videos_model->get_videos_summary( + $id, 0, $this->config->item('videos_per_row')); + + // Category + $vs_data['category_title'] = $name ? + $this->lang->line("ui_categ_$name") : $name; + $vs_data['category_id'] = $id; + + // Pagination (not required) + $vs_data['pagination'] = ''; + + $data['videos_summaries'][] = + $this->load->view('catalog/videos_summary_view', + $vs_data, TRUE); + } $params = array( 'title' => $this->config->item('site_name'), - //'stylesheets' => array(), - //'javascripts' => array(), + 'css' => array( + 'catalog.css' + ), + //'js' => array(), //'metas' => array('description'=>'','keywords'=>'') ); $this->load->library('html_head_params', $params); + + // ** + // ** LOADING VIEWS + // ** $this->load->view('html_begin', $this->html_head_params); - $this->load->view('header'); + $this->load->view('header', array('selected_menu' => 'home')); + + $main_params['content'] = $this->load->view('catalog/index_view', $data, TRUE); + $main_params['side'] = $this->load->view('side_default.php', NULL, TRUE); + $this->load->view('main', $main_params); + + $this->load->view('footer'); + $this->load->view('html_end'); + } + + public function test($page = 0) + { + $params = array( 'title' => 'Test - '. $this->config->item('site_name'), + //'css' => array(), + //'js' => array(), + //'metas' => array('description'=>'','keywords'=>'') + ); + $this->load->library('html_head_params', $params); + + // ** + // ** LOADING VIEWS + // ** + $this->load->view('html_begin', $this->html_head_params); + $this->load->view('header', array('selected_menu' => 'home')); - $this->load->view('catalog/index_view', $data); + $this->load->view('echo', array('output'=>'Test Page', 'clear'=>TRUE)); $this->load->view('footer'); $this->load->view('html_end'); } - public function test() + public function category($category_name, $offset = 0) { - $this->load->helper('url'); + // ** + // ** LOADING MODEL + // ** + // Video Category + $categories = $this->config->item('categories'); + $category_id = array_search($category_name, $categories); + $vs_data['category_name'] = $category_name; + $vs_data['category_id'] = $category_id; + $vs_data['category_title'] = $category_name ? + $this->lang->line("ui_categ_$category_name") : $category_name; - echo 'link'; + // Retrieve videos summary. + $this->load->model('videos_model'); + $vs_data['videos'] = $this->videos_model->get_videos_summary( + $vs_data['category_id'], intval($offset), + $this->config->item('videos_per_page')); + + // Pagination + $this->load->library('pagination'); + $pg_config['base_url'] = site_url("catalog/category/$category_id/"); + $pg_config['uri_segment'] = 4; + $pg_config['total_rows'] = $this->videos_model->get_videos_count( + $category_id); + $pg_config['per_page'] = $this->config->item('videos_per_page'); + $this->pagination->initialize($pg_config); + $vs_data['pagination'] = $this->pagination->create_links(); + + // Video Summary + $data['video_summary'] = $this->load->view('catalog/videos_summary_view', + $vs_data, TRUE); + + $params = array( 'title' => $this->config->item('site_name'), + 'css' => array( + 'catalog.css' + ), + //'js' => array(), + //'metas' => array('description'=>'','keywords'=>'') + ); + $this->load->library('html_head_params', $params); + + // ** + // ** LOADING VIEWS + // ** + $this->load->view('html_begin', $this->html_head_params); + $this->load->view('header'); + + $main_params['content'] = $this->load->view('catalog/category_view', $data, TRUE); + $main_params['side'] = $this->load->view('side_default.php', NULL, TRUE); + $this->load->view('main', $main_params); + + $this->load->view('footer'); + $this->load->view('html_end'); } public function search($query_str)