4 * Class Catalog controls video hierarchy and searching
7 * @author Călin-Andrei Burloiu
9 class Catalog extends CI_Controller {
11 public function __construct()
13 parent::__construct();
15 //$this->lang->load('catalog');
18 public function index()
23 // Retrieve videos summary.
24 $this->load->model('videos_model');
25 foreach ($this->config->item('categories') as $id => $name)
28 $vs_data['videos'] = $this->videos_model->get_videos_summary(
29 $id, 0, $this->config->item('videos_per_row'));
32 $vs_data['category_title'] = $name ?
33 $this->lang->line("ui_categ_$name") : $name;
34 $vs_data['category_id'] = $id;
36 // Pagination (not required)
37 $vs_data['pagination'] = '';
39 $data['videos_summaries'][] =
40 $this->load->view('catalog/videos_summary_view',
44 $params = array( 'title' => $this->config->item('site_name'),
49 //'metas' => array('description'=>'','keywords'=>'')
51 $this->load->library('html_head_params', $params);
56 $this->load->view('html_begin', $this->html_head_params);
57 $this->load->view('header', array('selected_menu' => 'home'));
59 $main_params['content'] = $this->load->view('catalog/index_view', $data, TRUE);
60 $main_params['side'] = $this->load->view('side_default.php', NULL, TRUE);
61 $this->load->view('main', $main_params);
63 $this->load->view('footer');
64 $this->load->view('html_end');
67 public function test($page = 0)
69 $params = array( 'title' => 'Test - '. $this->config->item('site_name'),
72 //'metas' => array('description'=>'','keywords'=>'')
74 $this->load->library('html_head_params', $params);
79 $this->load->view('html_begin', $this->html_head_params);
80 $this->load->view('header', array('selected_menu' => 'home'));
82 $this->load->view('echo', array('output'=>'Test Page', 'clear'=>TRUE));
84 $this->load->view('footer');
85 $this->load->view('html_end');
88 public function category($category_name, $offset = 0)
94 $categories = $this->config->item('categories');
95 $category_id = array_search($category_name, $categories);
96 $vs_data['category_name'] = $category_name;
97 $vs_data['category_id'] = $category_id;
98 $vs_data['category_title'] = $category_name ?
99 $this->lang->line("ui_categ_$category_name") : $category_name;
101 // Retrieve videos summary.
102 $this->load->model('videos_model');
103 $vs_data['videos'] = $this->videos_model->get_videos_summary(
104 $vs_data['category_id'], intval($offset),
105 $this->config->item('videos_per_page'));
108 $this->load->library('pagination');
109 $pg_config['base_url'] = site_url("catalog/category/$category_id/");
110 $pg_config['uri_segment'] = 4;
111 $pg_config['total_rows'] = $this->videos_model->get_videos_count(
113 $pg_config['per_page'] = $this->config->item('videos_per_page');
114 $this->pagination->initialize($pg_config);
115 $vs_data['pagination'] = $this->pagination->create_links();
118 $data['video_summary'] = $this->load->view('catalog/videos_summary_view',
121 $params = array( 'title' => $this->config->item('site_name'),
126 //'metas' => array('description'=>'','keywords'=>'')
128 $this->load->library('html_head_params', $params);
133 $this->load->view('html_begin', $this->html_head_params);
134 $this->load->view('header');
136 $main_params['content'] = $this->load->view('catalog/category_view', $data, TRUE);
137 $main_params['side'] = $this->load->view('side_default.php', NULL, TRUE);
138 $this->load->view('main', $main_params);
140 $this->load->view('footer');
141 $this->load->view('html_end');
144 public function search($query_str)
146 echo '<h1>Search not yet implemented</h1>';
150 /* End of file catalog.php */
151 /* Location: ./application/controllers/catalog.php */