Exemple #1
0
 /**
  * Class constructor
  *
  * @param array $params
  */
 public function __construct(array $params)
 {
     parent::__construct();
     $exclude = $params['exclude'];
     $itemsNum = $params['itemsNum'];
     $this->clipService = VIDEO_BOL_ClipService::getInstance();
     $userId = $this->clipService->findClipOwner($exclude);
     if (!$userId) {
         $this->setVisible(false);
     } else {
         $clips = $this->clipService->findUserClipsList($userId, 1, $itemsNum, $exclude);
         if (!$clips) {
             $this->setVisible(false);
         }
         $this->assign('clips', $clips);
     }
 }
Exemple #2
0
 /**
  * Class constructor
  *
  * @param array $params
  */
 public function __construct(array $params)
 {
     parent::__construct();
     $listType = isset($params['type']) ? $params['type'] : '';
     $count = isset($params['count']) ? $params['count'] : 5;
     $tag = isset($params['tag']) ? $params['tag'] : '';
     $userId = isset($params['userId']) ? $params['userId'] : null;
     $this->clipService = VIDEO_BOL_ClipService::getInstance();
     $page = !empty($_GET['page']) && (int) $_GET['page'] ? abs((int) $_GET['page']) : 1;
     $clipsPerPage = $this->clipService->getClipPerPageConfig();
     if ($userId) {
         $clips = $this->clipService->findUserClipsList($userId, $page, $clipsPerPage);
         $records = $this->clipService->findUserClipsCount($userId);
     } else {
         if (strlen($tag)) {
             $clips = $this->clipService->findTaggedClipsList($tag, $page, $clipsPerPage);
             $records = $this->clipService->findTaggedClipsCount($tag);
         } else {
             $clips = $this->clipService->findClipsList($listType, $page, $clipsPerPage);
             $records = $this->clipService->findClipsCount($listType);
         }
     }
     $this->assign('listType', $listType);
     if ($clips) {
         $this->assign('no_content', null);
         $this->assign('clips', $clips);
         $userIds = array();
         foreach ($clips as $clip) {
             if (!in_array($clip['userId'], $userIds)) {
                 array_push($userIds, $clip['userId']);
             }
         }
         $names = BOL_UserService::getInstance()->getDisplayNamesForList($userIds);
         $this->assign('displayNames', $names);
         $usernames = BOL_UserService::getInstance()->getUserNamesForList($userIds);
         $this->assign('usernames', $usernames);
         // Paging
         $pages = (int) ceil($records / $clipsPerPage);
         $paging = new BASE_CMP_Paging($page, $pages, 10);
         $this->assign('paging', $paging->render());
         $this->assign('count', $count);
     } else {
         $this->assign('no_content', OW::getLanguage()->text('video', 'no_video_found'));
     }
 }
Exemple #3
0
 /**
  * Method acts as ajax responder. Calls methods using ajax
  * 
  * @return JSON encoded string
  *
  */
 public function getVideosContent()
 {
     if (empty($_GET['video_id']) || !$_GET['video_id']) {
         throw new Redirect404Exception();
         exit;
     }
     $id = $_GET['video_id'];
     $clip = $this->clipService->findClipById($id);
     if (!$clip) {
         throw new Redirect404Exception();
     }
     $contentOwner = (int) $this->clipService->findClipOwner($id);
     $videoCount = $this->clipService->findUserClipsCount($contentOwner);
     $videos = $this->clipService->findUserClipsList($contentOwner, 1, $videoCount);
     foreach ($videos as $item) {
         $videosList[] = array('video_id' => $item['id'], 'thumb' => $item['thumb'] != 'undefined' ? $item['thumb'] : OW_URL_HOME . 'ow_static/plugins/gvideoviewer/img/video-no-video.jpg', 'src' => $this->getVideoCode($item['code'], $item['provider']), 'active' => $item['id'] == $_GET['video_id'], 'title' => $item['title'], 'description' => $item['description'], 'href' => OW::getRouter()->urlForRoute('view_clip', array('id' => $item['id'])));
     }
     exit(json_encode(array('videos' => $videosList, 'count' => $videoCount, 'album_title' => '', 'album_href' => '', 'owner_title' => BOL_UserService::getInstance()->getDisplayName($contentOwner), 'owner_href' => BOL_UserService::getInstance()->getUserUrl($contentOwner))));
 }