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_name'] = $name;
33 $vs_data['category_title'] = $name ?
34 $this->lang->line("ui_categ_$name") : $name;
35 $vs_data['category_id'] = $id;
37 // Pagination (not required)
38 $vs_data['pagination'] = '';
40 $data['videos_summaries'][] =
41 $this->load->view('catalog/videos_summary_view',
45 $params = array( 'title' => $this->config->item('site_name'),
50 //'metas' => array('description'=>'','keywords'=>'')
52 $this->load->library('html_head_params', $params);
57 $this->load->view('html_begin', $this->html_head_params);
58 $this->load->view('header', array('selected_menu' => 'home'));
60 $main_params['content'] = $this->load->view('catalog/index_view', $data, TRUE);
61 $main_params['side'] = $this->load->view('side_default.php', NULL, TRUE);
62 $this->load->view('main', $main_params);
64 $this->load->view('footer');
65 $this->load->view('html_end');
68 public function test($page = 0)
70 $params = array( 'title' => 'Test - '. $this->config->item('site_name'),
73 //'metas' => array('description'=>'','keywords'=>'')
75 $this->load->library('html_head_params', $params);
80 $this->load->view('html_begin', $this->html_head_params);
81 $this->load->view('header', array('selected_menu' => 'home'));
83 $this->load->view('echo', array('output'=>'Test Page', 'clear'=>TRUE));
85 $this->load->view('footer');
86 $this->load->view('html_end');
89 public function category($category_name, $offset = 0)
95 $categories = $this->config->item('categories');
96 $category_id = array_search($category_name, $categories);
97 $vs_data['category_name'] = $category_name;
98 $vs_data['category_id'] = $category_id;
99 $vs_data['category_title'] = $category_name ?
100 $this->lang->line("ui_categ_$category_name") : $category_name;
102 // Retrieve videos summary.
103 $this->load->model('videos_model');
104 $vs_data['videos'] = $this->videos_model->get_videos_summary(
105 $vs_data['category_id'], intval($offset),
106 $this->config->item('videos_per_page'));
109 $this->load->library('pagination');
110 $pg_config['base_url'] = site_url("catalog/category/$category_name/");
111 $pg_config['uri_segment'] = 4;
112 $pg_config['total_rows'] = $this->videos_model->get_videos_count(
114 $pg_config['per_page'] = $this->config->item('videos_per_page');
115 $this->pagination->initialize($pg_config);
116 $vs_data['pagination'] = $this->pagination->create_links();
119 $data['video_summary'] = $this->load->view('catalog/videos_summary_view',
122 $params = array( 'title' => $this->config->item('site_name'),
127 //'metas' => array('description'=>'','keywords'=>'')
129 $this->load->library('html_head_params', $params);
134 $this->load->view('html_begin', $this->html_head_params);
135 $this->load->view('header');
137 $main_params['content'] = $this->load->view('catalog/category_view', $data, TRUE);
138 $main_params['side'] = $this->load->view('side_default.php', NULL, TRUE);
139 $this->load->view('main', $main_params);
141 $this->load->view('footer');
142 $this->load->view('html_end');
145 public function search($query_str)
147 echo '<h1>Search not yet implemented</h1>';
151 /* End of file catalog.php */
152 /* Location: ./application/controllers/catalog.php */