示例#1
0
 /**
  * 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 = VWVC_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('vwvc', 'no_vwvc_found'));
     }
 }
 public function __construct(BASE_CLASS_WidgetParameter $params)
 {
     parent::__construct();
     if (empty($params->additionalParamList['entityId'])) {
         $userId = OW::getUser()->getId();
     } else {
         $userId = $params->additionalParamList['entityId'];
     }
     $friendsIdList = OW::getEventManager()->call('plugin.friends.get_friend_list', array('userId' => OW::getUser()->getId()));
     $count = 25;
     $this->clipService = VWVC_BOL_ClipService::getInstance();
     $clips = $this->clipService->findClipsList('online', '1', $count);
     $friendsCount = count($friendsIdList);
     $result = array();
     $resultx = "";
     foreach ($friendsIdList as $friendId) {
         $resultx = $this->clipService->findClipsByFriendId($friendId, $clips);
         if ($resultx != "") {
             array_push($result, $resultx);
         }
     }
     $html = "";
     if ($result != "") {
         foreach ($result as $part) {
             $partx = explode(":", $part);
             $displayName = BOL_UserService::getInstance()->getDisplayName($partx[0]);
             $html .= $displayName . " ";
             $active_in = OW::getLanguage()->text('vwvc', 'active_in');
             $html .= $active_in;
             $roomIdx = explode("|", $partx[1]);
             foreach ($roomIdx as $roomId) {
                 $clipx = $this->clipService->findClipById($roomId);
                 $urlRoom = OW::getRouter()->urlForRoute('vwview_clip', array('id' => $roomId));
                 $html .= '&nbsp;<a href ="' . $urlRoom . '">' . $clipx->title . '</a>';
             }
             $html .= "<br />";
         }
         $this->assign('content', $html);
         //        $this->assign('content', var_dump ($resultx));
     } else {
         $this->assign('content', OW::getLanguage()->text('vwvc', 'no_active_room'));
     }
 }