X-Git-Url: http://p2p-next.cs.pub.ro/gitweb/?a=blobdiff_plain;ds=sidebyside;f=application%2Fcontrollers%2Fcatalog.php;h=581e147703fee8177fbe426a229e224862f69f46;hb=b56dce7ae724d5b955a96d7d3d5b3b476d2e28fb;hp=da3548a617ffed7fc4acd4e837e63c1e1609b02e;hpb=497b76b61faee6e2e8d72ce6d9ed8eacd45107d2;p=living-lab-site.git diff --git a/application/controllers/catalog.php b/application/controllers/catalog.php index da3548a..581e147 100644 --- a/application/controllers/catalog.php +++ b/application/controllers/catalog.php @@ -17,6 +17,18 @@ class Catalog extends CI_Controller { public function index() { + $user_id = $this->session->userdata('user_id'); + if ($user_id) + { + if (intval($user_id) & USER_ROLE_ADMIN) + $allow_unactivated = TRUE; + else + $allow_unactivated = FALSE; + } + else + $allow_unactivated = FALSE; + + // ** // ** LOADING MODEL // ** @@ -26,7 +38,8 @@ class Catalog extends CI_Controller { { // Videos $vs_data['videos'] = $this->videos_model->get_videos_summary( - $id, NULL, 0, $this->config->item('videos_per_row')); + $id, NULL, 0, $this->config->item('videos_per_row'), + $allow_unactivated); // Category $vs_data['category_name'] = $name; @@ -47,7 +60,7 @@ class Catalog extends CI_Controller { 'css' => array( 'catalog.css' ), - //'js' => array(), + 'js' => array('jquery.ui.thumbs.js'), //'metas' => array('description'=>'','keywords'=>'') ); $this->load->library('html_head_params', $params); @@ -71,17 +84,24 @@ class Catalog extends CI_Controller { public function test() { - $data['email'] = 'CA-LăIN$*(_3@GMAIL.COM'; - $data['email'] = strtolower($data['email']); - $data['username'] = substr($data['email'], - 0, strpos($data['email'], '@')); - $data['username'] = preg_replace(array('/[^a-z0-9\._]*/'), - array(''), $data['username']); - echo $data['username']; + $this->load->helper('av_info'); + + var_dump(get_video_dar('./data/media/test.ogv')); } public function category($category_name, $ordering = 'hottest', $offset = 0) { + $user_id = $this->session->userdata('user_id'); + if ($user_id) + { + if (intval($user_id) & USER_ROLE_ADMIN) + $allow_unactivated = TRUE; + else + $allow_unactivated = FALSE; + } + else + $allow_unactivated = FALSE; + // ** // ** LOADING MODEL // ** @@ -92,7 +112,8 @@ class Catalog extends CI_Controller { $this->load->model('videos_model'); $vs_data['videos'] = $this->videos_model->get_videos_summary( $category_data['category_id'], NULL, intval($offset), - $this->config->item('videos_per_page'), $ordering); + $this->config->item('videos_per_page'), $ordering, + $allow_unactivated); $vs_data['ordering'] = $ordering; @@ -102,7 +123,7 @@ class Catalog extends CI_Controller { "catalog/category/$category_name/$ordering/"); $pg_config['uri_segment'] = 5; $pg_config['total_rows'] = $this->videos_model->get_videos_count( - $category_data['category_id']); + $category_data['category_id'], NULL, $allow_unactivated); $pg_config['per_page'] = $this->config->item('videos_per_page'); $this->pagination->initialize($pg_config); $vs_data['pagination'] = $this->pagination->create_links(); @@ -114,8 +135,9 @@ class Catalog extends CI_Controller { . $this->config->item('site_name'), 'css' => array( 'catalog.css' - ) - //'metas' => array('description'=>'','keywords'=>'') + ), + 'js' => array('jquery.ui.thumbs.js') + //'metas' => array('description'=>'','keywords'=>'') ); $this->load->library('html_head_params', $params); @@ -213,8 +235,8 @@ class Catalog extends CI_Controller { 'css' => array( 'catalog.css' ), - //'js' => array(), - //'metas' => array('description'=>'','keywords'=>'') + 'js' => array('jquery.ui.thumbs.js'), + //'metas' => array('description'=>'','keywords'=>'') ); $this->load->library('html_head_params', $params);