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 .= ' <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')); } }
public function edit(array $params) { if (!isset($params['id']) || !($id = (int) $params['id'])) { throw new Redirect404Exception(); return; } $clip = $this->clipService->findClipById($id); if (!$clip) { throw new Redirect404Exception(); } $language = OW_Language::getInstance(); // is moderator $modPermissions = OW::getUser()->isAuthorized('vwvc'); $this->assign('moderatorMode', $modPermissions); $contentOwner = (int) $this->clipService->findClipOwner($id); $userId = OW::getUser()->getId(); $ownerMode = $contentOwner == $userId; $this->assign('ownerMode', $ownerMode); if (!$ownerMode && !$modPermissions) { $this->setTemplate(OW::getPluginManager()->getPlugin('base')->getCtrlViewDir() . 'authorization_failed.html'); return; } $videoEditForm = new vwvcEditForm($clip->id); $this->addForm($videoEditForm); $videoEditForm->getElement('id')->setValue($clip->id); $videoEditForm->getElement('room_name')->setValue($clip->title); $videoEditForm->getElement('description')->setValue($clip->description); $videoEditForm->getElement('welcome')->setValue($clip->welcome); $resolution = $clip->camWidth . "x" . $clip->camHeight; $videoEditForm->getElement('resolution')->setValue($resolution); $videoEditForm->getElement('camera_fps')->setValue($clip->camFPS); $videoEditForm->getElement('microphone_rate')->setValue($clip->micRate); $videoEditForm->getElement('soundQuality')->setValue($clip->soundQuality); $videoEditForm->getElement('bandwidth')->setValue($clip->camBandwidth); $videoEditForm->getElement('background_url')->setValue($clip->background_url); $videoEditForm->getElement('layout_code')->setValue($clip->layoutCode); $permissions = $clip->permission; $permission = explode("|", $permissions); $videoEditForm->getElement('fill_window')->setValue($permission[0]); $videoEditForm->getElement('show_camera_settings')->setValue($permission[1]); $videoEditForm->getElement('advanced_camera_settings')->setValue($permission[2]); $videoEditForm->getElement('configure_source')->setValue($permission[3]); $videoEditForm->getElement('disable_video')->setValue($permission[4]); $videoEditForm->getElement('disable_sound')->setValue($permission[5]); $videoEditForm->getElement('panel_rooms')->setValue($permission[6]); $videoEditForm->getElement('panel_users')->setValue($permission[7]); $videoEditForm->getElement('panel_files')->setValue($permission[8]); $videoEditForm->getElement('file_upload')->setValue($permission[9]); $videoEditForm->getElement('file_delete')->setValue($permission[10]); $videoEditForm->getElement('tutorial')->setValue($permission[11]); $videoEditForm->getElement('auto_view_cameras')->setValue($permission[12]); $videoEditForm->getElement('show_timer')->setValue($permission[13]); $videoEditForm->getElement('write_text')->setValue($permission[14]); $videoEditForm->getElement('regular_watch')->setValue($permission[15]); $videoEditForm->getElement('new_watch')->setValue($permission[16]); $videoEditForm->getElement('private_textchat')->setValue($permission[17]); $videoEditForm->getElement('administrator')->setValue($permission[18]); $videoEditForm->getElement('verbose_level')->setValue($permission[19]); $videoEditForm->getElement('flood_protection')->setValue($clip->floodProtection); $videoEditForm->getElement('filter_regex')->setValue($clip->filterRegex); $videoEditForm->getElement('filter_replace')->setValue($clip->filterReplace); $videoEditForm->getElement('user_list')->setValue($clip->user_list); $videoEditForm->getElement('moderator_list')->setValue($clip->moderator_list); if (OW::getRequest()->isPost() && $videoEditForm->isValid($_POST)) { $res = $videoEditForm->process(); OW::getFeedback()->info($language->text('vwvc', 'clip_updated')); $this->redirect(OW::getRouter()->urlForRoute('vwview_clip', array('id' => $res['id']))); } OW::getDocument()->setHeading($language->text('vwvc', 'tb_vwedit_clip')); OW::getDocument()->setHeadingIconClass('ow_ic_vwvc'); OW::getDocument()->setTitle($language->text('vwvc', 'tb_vwedit_clip')); }
/** * Class constructor * * @param int $clipId */ public function __construct(array $params) { parent::__construct(); $clipId = $params['id']; $this->clipService = VWVC_BOL_ClipService::getInstance(); $clip = $this->clipService->findClipById($clipId); $room_name = $clip->title; $params = $clip->description . '^'; $params .= $clip->welcome . '^'; $params .= $clip->camWidth . '^'; $params .= $clip->camHeight . '^'; $params .= $clip->camFPS . '^'; $params .= $clip->micRate . '^'; $params .= $clip->camBandwidth . '^'; $params .= $clip->background_url . '^'; $params .= $clip->layoutCode . '^'; $params .= $clip->filterRegex . '^'; $params .= $clip->filterReplace . '^'; $params .= $clip->floodProtection . '^'; $params .= $clip->permission . '^'; $params .= $clip->user_list . '^'; $params .= $clip->moderator_list . '^'; $config = OW::getConfig(); $settings = $config->getValue('vwvc', 'p2pGroup') . '^'; $settings .= $config->getValue('vwvc', 'camMaxBandwidth') . '^'; $settings .= $config->getValue('vwvc', 'bufferLive') . '^'; $settings .= $config->getValue('vwvc', 'bufferFull') . '^'; $settings .= $config->getValue('vwvc', 'bufferLivePlayback') . '^'; $settings .= $config->getValue('vwvc', 'bufferFullPlayback') . '^'; $settings .= $config->getValue('vwvc', 'disableBandwidthDetection') . '^'; $settings .= $config->getValue('vwvc', 'disableUploadDetection') . '^'; $settings .= $config->getValue('vwvc', 'limitByBandwidth') . '^'; $settings .= $config->getValue('vwvc', 'ws_ads') . '^'; $settings .= $config->getValue('vwvc', 'adsTimeout') . '^'; $settings .= $config->getValue('vwvc', 'adsInterval') . '^'; $settings .= $config->getValue('vwvc', 'statusInterval') . '^'; $settings .= $config->getValue('vwvc', 'videos_per_page') . '^'; $settings .= $config->getValue('vwvc', 'server') . '^'; $settings .= $config->getValue('vwvc', 'serverAMF') . '^'; $settings .= $config->getValue('vwvc', 'serverRTMFP') . '^'; // new codec setting, etc $cSettings = $config->getValue('vwvc', 'videoCodec') . '^'; $cSettings .= $config->getValue('vwvc', 'codecProfile') . '^'; $cSettings .= $config->getValue('vwvc', 'codecLevel') . '^'; $cSettings .= $config->getValue('vwvc', 'soundCodec') . '^'; $cSettings .= $config->getValue('vwvc', 'enableRTMP') . '^'; $cSettings .= $config->getValue('vwvc', 'enableP2P') . '^'; $cSettings .= $config->getValue('vwvc', 'supportRTMP') . '^'; $cSettings .= $config->getValue('vwvc', 'supportP2P') . '^'; $cSettings .= $config->getValue('vwvc', 'alwaysRTMP') . '^'; $cSettings .= $config->getValue('vwvc', 'alwaysP2P') . '^'; $cSettings .= $clip->soundQuality . '^'; // room owner $idOwner = $clip->userId; $usernameOwner = BOL_UserService::getInstance()->getUsername($idOwner); $userId = OW::getUser()->getId(); // visitor $userService = BOL_UserService::getInstance(); $user = $userService->findUserById($userId); if (isset($user)) { $username = $user->getUsername(); } else { $username = "******" . base_convert(time() - 1224350000 . rand(0, 10), 10, 36); } // userLink and userPicture $userLink = $userService->getUserUrl($userId); $userPicture = BOL_AvatarService::getInstance()->getAvatarUrl($userId); $baseSwfUrl = $config->getValue('vwvc', 'baseSwf_url'); $room = $room_name . '^' . $params . $settings . $username . '^' . $usernameOwner . '^' . $userId . '^' . $userLink . '^' . $userPicture . '^' . $cSettings; // create sessions/$sessionid file $sessionsPath = 'ow_plugins/vwvideoconference/vc/sessions'; @chmod($sessionsPath, 0777); $sessionName = "vcs" . base_convert(time() - 1112340000 . rand(0, 10), 10, 36); $filename = $sessionsPath . '/' . $sessionName . '.vwf'; $handle = fopen($filename, "x+"); $roomContent = $room; fwrite($handle, $roomContent); fclose($handle); // send file name to _login setcookie("sessionNameVc", $sessionName, time() + 180, '/'); $urlRoom = OW::getRouter()->urlForRoute('vwview_list', array('listType' => 'latest')); setcookie("urlRoomVc", $urlRoom, time() + 86400, '/'); $srcSwfUrl = $baseSwfUrl . "videowhisper_conference.swf?room=" . $room_name; $code = '<embed width="100%" height="600px" scale="noscale" salign="lt" src="' . $srcSwfUrl . '" bgcolor="#777777" base="' . $baseSwfUrl . '" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" wmode="transparent"></embed>'; $this->assign('clipCode', $code); }