X-Git-Url: http://p2p-next.cs.pub.ro/gitweb/?a=blobdiff_plain;f=application%2Fmodels%2Fvideos_model.php;h=711b967a0930f36f0a01b4c9d00a0a28891d7bd1;hb=a4de6b263b2faef2a215da76c93b756299201544;hp=2b0add64285893cfeb93895ed351dc4c54ab85c4;hpb=a69349a99360f6cb64ae3d87f6572f1d8a98400f;p=living-lab-site.git diff --git a/application/models/videos_model.php b/application/models/videos_model.php index 2b0add6..711b967 100644 --- a/application/models/videos_model.php +++ b/application/models/videos_model.php @@ -189,6 +189,7 @@ class Videos_model extends CI_Model { public function get_video($id, $name = NULL) { $this->load->helper('video'); + $this->load->helper('text'); $query = $this->db->query("SELECT v.*, u.username FROM `videos` v, `users` u @@ -240,6 +241,10 @@ class Videos_model extends CI_Model { // Thumbnails $video['thumbs'] = $this->get_thumbs($video['name'], $video['thumbs_count']); + // Shorted description + $video['shorted_description'] = character_limiter( + $video['description'], 128); + return $video; } @@ -515,8 +520,8 @@ class Videos_model extends CI_Model { else { // TODO select data, description if details are needed - $selected_columns = "id, name, title, duration, user_id, views, - thumbs_count, default_thumb, + $selected_columns = "v.id, name, title, duration, user_id, views, + thumbs_count, default_thumb, u.username, (views + likes - dislikes) AS score, $relevance"; $order = "ORDER BY relevance DESC, score DESC"; @@ -529,8 +534,8 @@ class Videos_model extends CI_Model { $category_cond = ""; $str_query = "SELECT $selected_columns - FROM `videos` - WHERE $category_cond ( $search_cond ) + FROM `videos` v, `users` u + WHERE v.user_id = u.id AND $category_cond ( $search_cond ) $order $limit"; // echo "

$str_query

";