示例#1
0
 /**
  * Function getPlaylistVideosByAjax is used to get current user playlist videos and bind it existing videos
  * This function has userId to hold current user id
  * This function has startOffset arguments to hold start offset
  * This function has playlistId arguments to hold playlist id
  * This function call getPlaylistVideoDetails method to get required set of playlist video details
  * This function pass userid,playlistid,startoffset and current object as parameter to getPlaylistVideoDetails method
  * This function call getVideoByAjax to get required json details to bind next set of videos to existing videos
  * This function has exit statement to stop flow
  * @param int $userId user id
  * @param int $startOffset start offset
  * @param int $playlistId playlist id
  * @return array
  */
 public function getPlaylistVideosByAjax($userId, $startOffset, $playlistId)
 {
     global $wpdb;
     $result = array();
     $videoResults = getPlaylistVideoDetails($userId, $playlistId, $startOffset, $this);
     if (empty($videoResults)) {
         echo json_encode(array());
         exitAction('');
     }
     $result = getVideoByAjax($videoResults, '', $this->thumbPath . 'nothumbimage.jpg', $this->ratearray);
     array_push($result, $this->playlistVideoCount);
     echo json_encode($result);
     exitAction('');
 }
示例#2
0
 /**
  * Function displayView load the playlist default template file
  * @return void
  */
 public function displayView()
 {
     $userId = !empty($this->playlistUserId) ? $this->playlistUserId : '';
     if ($userId == '') {
         $userId = get_current_user_id();
     }
     $this->playlistId = isset($_REQUEST['pid']) && $_REQUEST['pid'] != '' ? intval($_REQUEST['pid']) : '';
     if (!empty($this->playlistId) && !empty($userId)) {
         $startOffset = 0;
         $this->videoDetails = getPlaylistVideoDetails($userId, $this->playlistId, $startOffset, $this);
         $this->playlistName = getPlaylistName($userId, $this->playlistId, $this);
     } elseif (empty($this->playlistId) && !empty($userId)) {
         $startOffset = 0;
         $this->playlistDetails = getPlaylistDetails($userId, $startOffset, $this);
         $this->playlistCount = getTotalPlaylistCount($userId, $this);
     } else {
         echo 'login';
     }
     $this->displayTemplate();
 }