/** * Function for get the video from category based. * * @global type $wpdb * @param type $CountOFVideos * @param type $TypeOFvideos * @param type $pagenum * @param type $dataLimit * @param type $category_page * @return $category_videos */ function categorylist($CountOFVideos, $TypeOFvideos, $pagenum, $dataLimit, $category_page, $thumImageorder) { global $wpdb; $userId = get_current_user_id(); $watchLaterVideoIds = getWatchLaterVideoIds($userId, $this->watchDetailsTable); $div = ''; /** Calculating page number for home page category videos */ $pagenum = isset($pagenum) ? absint($pagenum) : 1; $div .= '<style scoped> .video-block { margin-left:' . $this->_settingsData->gutterspace . 'px !important;float:left;} </style>'; foreach ($TypeOFvideos as $catList) { /** Get video details for particular playlist */ $playLists = getCatVideos($catList->pid, $dataLimit, $thumImageorder); /** Get count of home page category videos */ $playlistCount = count($playLists); /** Get count of video assigned in this category. */ $category_video = $wpdb->get_results('SELECT * FROM ' . $wpdb->prefix . 'hdflvvideoshare_med2play as m LEFT JOIN ' . $wpdb->prefix . 'hdflvvideoshare_playlist as p on m.playlist_id = p.pid WHERE m.playlist_id=' . intval($catList->pid) . ' AND p.is_publish=1'); /** Get count of videos for category */ $video_count = count($category_video); /** Display home page category title */ $div .= '<div class="titleouter"> <h4 class="more_title">' . $catList->playlist_name . '</h4></div>'; if (!empty($playlistCount)) { $inc = 1; /** Video container starts */ $div .= '<ul class="video-block-container">'; /** Dsplay videos for category */ foreach ($playLists as $playList) { $this->watchLaterHelper($playList, $watchLaterVideoIds); /** Display home cat thumb image */ $div .= '<li class="video-block"><div class="video-thumbimg"><a href="' . $this->guid . '"><img src="' . $this->imageFea . '" alt="" class="imgHome" title=""></a>'; /** Display video duration */ if ($this->duration) { $div .= '<span class="video_duration">' . $this->duration . '</span>'; } $div .= '<span class="watchlaterIcon" ' . $this->clickEvent . ' ><img class="watchlaterImg" style="width:24px !important;height:24px !important;" src="' . $this->watchLaterImg . '" title="' . $this->watchLaterTitle . '"></span> <span class="playlistIcon" data-vid = ' . $this->videoId . '><img class="playlistIconImg" style="width:24px !important;height:24px !important;" src="' . $this->playlistImg . '" title="Add to playlist"></span>'; /** Display home cat video name */ $div .= '</div><div class="vid_info"><a href="' . $this->guid . '" title="' . $playList->name . '" class="videoHname"><span>' . limitTitle($playList->name) . '</span></a>'; /** Rating for home category video */ if ($this->_settingsData->ratingscontrol == 1) { $div .= getRatingValue($playList->rate, $playList->ratecount, ''); } /** Show views count for home page category videos */ if ($this->_settingsData->view_visible == 1) { $div .= displayViews($playList->hitcount); } $div .= '</div></li>'; if ($inc % $this->_colCat == 0 && $inc != 0) { /** Column count */ $div .= '</ul><div class="clear"></div><ul class="video-block-container">'; } $inc++; } $div .= '</ul>'; /** Video category thumb based on gallery setting rows, cols */ $colF = $this->_settingsData->colCat; $rowF = $this->_settingsData->rowCat; $CatLimit = $colF * $rowF; if ($video_count > $CatLimit) { /** Get more videos permalink for home cat videos */ $more_playlist_link = get_playlist_permalink($this->_mPageid, $catList->pid, $catList->playlist_slugname); /** Display more videos link for home categories */ $div .= '<a class="video-more" href="' . $more_playlist_link . '">' . __('More Videos', APPTHA_VGALLERY) . '</a>'; } else { $div .= '<div align="clear"> </div>'; } } else { /** If there is no video for category */ $div .= '<div class="titleouter">' . __('No Videos for this Category', APPTHA_VGALLERY) . '</div>'; } } $div .= '<div class="clear"></div>'; /** Check tha page is category page */ if ($category_page != 0) { /** Pagination starts * Call helper function to get pagination values for category videos */ $div .= paginateLinks($CountOFVideos, $category_page, $pagenum, '', ''); } return $div; }
/** * Function to display category thumbs * * @param unknown $CountOfCatVideos * @param unknown $TypeOfCatvideos * @param unknown $pagenum * @param unknown $dataLimit * @param unknown $default_order * @return string */ function categorylist($CountOfCatVideos, $TypeOfCatvideos, $pagenum, $dataLimit, $default_order) { global $wpdb; $userId = get_current_user_id(); $watchLaterVideoIds = getWatchLaterVideoIds($userId, $this->watchDetailsTable); $div = ''; /** Calculating page number for category videos */ $pagenum = absint($pagenum) ? absint($pagenum) : 1; $div .= '<style> .video-block { margin-left:' . $this->_settingsData->gutterspace . 'px !important; } </style>'; foreach ($TypeOfCatvideos as $catList) { /** Fetch videos for every category * Get more page id */ $playLists = getCatVideos($catList->pid, $dataLimit, $default_order); $moreName = morePageID(); $playlistCount = count($playLists); $div .= '<div class="titleouter"> <h4 class="clear more_title">' . $catList->playlist_name . '</h4></div>'; if (!empty($playlistCount)) { $i = 0; $inc = 1; $div .= '<ul class="video-block-container">'; foreach ($playLists as $playList) { $this->watchLaterHelper($playList, $watchLaterVideoIds); /** To display the category videos thumb image and video duration */ $div .= '<li class="video-block"><div class="video-thumbimg"><a href="' . $this->guid . '" title="' . $playList->name . '" ><img src="' . $this->imageFea . '" alt="" class="imgHome" title="" /></a>'; if (!empty($this->duration) && $this->duration != '0:00') { $div .= '<span class="video_duration">' . $this->duration . '</span>'; } $div .= '<span class="watchlaterIcon" ' . $this->clickEvent . ' ><img class="watchlaterImg" style="width:24px !important;height:24px !important;" src="' . $this->watchLaterImg . '" title="' . $this->watchLaterTitle . '"></span> <span class="playlistIcon" data-vid = ' . $this->videoId . '><img class="playlistIconImg" style="width:24px !important;height:24px !important;" src="' . $this->playlistImg . '" title="Add to playlist"></span>'; /** To display playlist name as linkable */ $div .= '</div><div class="vid_info"><h5><a href="' . $this->guid . '" class="videoHname" title="' . $playList->name . '">' . limitTitle($playList->name) . '</a></h5>'; if ($this->_settingsData->categorydisplay == 1) { $div .= '<a class="playlistName" href="' . $playlist_more_link . '"><span>' . $catList->playlist_name . '</span></a>'; } if ($this->_settingsData->ratingscontrol == 1) { /** Rating starts here * for category videos */ $div .= getRatingValue($playList->rate, $playList->ratecount, ''); } /** Views starts here for category videos */ if ($this->_settingsData->view_visible == 1) { $div .= displayViews($playList->hitcount); } $div .= '</div></li>'; if ($i > $this->_perCat - 2) { break; } else { $i = $i + 1; } if ($inc % $this->_colCat == 0 && $inc != 0) { $div .= '</ul><div class="clear"></div><ul class="video-block-container">'; } $inc++; } $div .= '</ul>'; /** Calculate datalimit for video more page */ if ($this->_rowCat && $this->_colCat) { $dataLimit = $this->_perCat; } else { if ($this->_rowCat || $this->_colCat) { $dataLimit = ''; } else { $dataLimit = 8; } } /** Display more videos link for category thumbs */ if ($playlistCount > $dataLimit) { $div .= '<a class="video-more" href="' . $playlist_more_link . '">' . __('More Videos', APPTHA_VGALLERY) . '</a>'; } else { $div .= '<div align="clear"> </div>'; } } else { /** If there is no video for category */ $div .= '<div class="titleouter">' . __('No Videos for this Category', APPTHA_VGALLERY) . '</div>'; } } $div .= '<div class="clear"></div>'; /** Pagination starts - Call helper function to get pagination values for categories */ if ($dataLimit != 0) { $div .= paginateLinks($CountOfCatVideos, $dataLimit, $pagenum, '', ''); } /** Pagination ends */ /** Display videmore page content */ echo $div; }