/** * Class constructor * * @param string $listType * @param int $count * @param string $tag * @param int $userId */ public function __construct(array $params) { parent::__construct(); $listType = isset($params['type']) ? $params['type'] : ''; $count = isset($params['count']) ? $params['count'] : 5; // $count = 5; $tag = isset($params['tag']) ? $params['tag'] : ''; $userId = isset($params['userId']) ? $params['userId'] : null; $this->clipService = VWVR_BOL_ClipService::getInstance(); $page = isset($_GET['page']) && (int) $_GET['page'] ? (int) $_GET['page'] : 1; // $clipsPerPage = $this->clipService->getClipPerPageConfig(); $clipsPerPage = 10; 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('vwvr', 'no_vwvr_found')); } }
/** * Class constructor * * @param int $exclude * @param int $itemsNum */ public function __construct(array $params) { parent::__construct(); $exclude = $params['exclude']; $itemsNum = $params['itemsNum']; $this->clipService = VWVR_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); } }