/** * Function getPlaylistbyOffset is used to get current user playlist details and bind it to existing playlist details * This function has userId to hold current user id * This function has startOffset arguments to hold start offset * This function call getPlaylistDetails method to get required set of playlist details * This function pass userid,startoffset and current object as parameter to getPlaylistDetails method * This function call getTotalPlaylistCount to get total playlist count * This function has exit statement to stop flow * @param int $userId user id * @param int $startOffset start offset * @return array */ public function getPlaylistbyOffset($userId, $startOffset) { global $wpdb; $playlistDetails = getPlaylistDetails($userId, $startOffset, $this); $playlistCount = getTotalPlaylistCount($userId, $this); array_push($playlistDetails, $playlistCount); echo json_encode($playlistDetails); exitAction(''); }
/** * 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(); }