/** * Returns an instance of class (singleton pattern implementation). * * @return OW_Router */ public static function getInstance() { if (self::$classInstance === null) { self::$classInstance = new self(); } return self::$classInstance; }
public function addQuickLink(BASE_CLASS_EventCollector $event) { $count = BOOKMARKS_BOL_Service::getInstance()->findBookmarksCount(OW::getUser()->getId()); if (empty($count)) { return; } $router = OW_Router::getInstance(); $event->add(array(BASE_CMP_QuickLinksWidget::DATA_KEY_LABEL => OW::getLanguage()->text('bookmarks', 'quick_link_index'), BASE_CMP_QuickLinksWidget::DATA_KEY_URL => $router->urlForRoute('bookmarks.list', array('category' => BOOKMARKS_BOL_Service::LIST_LATEST)), BASE_CMP_QuickLinksWidget::DATA_KEY_COUNT => $count, BASE_CMP_QuickLinksWidget::DATA_KEY_COUNT_URL => $router->urlForRoute('bookmarks.list', array('category' => BOOKMARKS_BOL_Service::LIST_LATEST)))); }
function socialbridge_preference_menu_item(BASE_EventCollector $event) { $router = OW_Router::getInstance(); $language = OW::getLanguage(); $menuItems = array(); $menuItem = new BASE_MenuItem(); $menuItem->setKey('socialbridge'); $menuItem->setLabel($language->text('ynsocialbridge', 'manage_socialbridge_label')); $menuItem->setIconClass('ow_ic_moderator'); $menuItem->setUrl($router->urlForRoute('ynsocialbridge-connects')); $menuItem->setOrder(99); $event->add($menuItem); }
function notifications_preference_menu_item(BASE_EventCollector $event) { $router = OW_Router::getInstance(); $language = OW::getLanguage(); $menuItems = array(); $menuItem = new BASE_MenuItem(); $menuItem->setKey('email_notifications'); $menuItem->setLabel($language->text('notifications', 'dashboard_menu_item')); $menuItem->setIconClass('ow_ic_mail'); $menuItem->setUrl($router->urlForRoute('notifications-settings')); $menuItem->setOrder(3); $event->add($menuItem); }
public function init() { $router = OW_Router::getInstance(); $pageActions = array('choose_theme', 'add_theme'); $menuItems = array(); foreach ($pageActions as $key => $item) { $menuItem = new BASE_MenuItem(); $menuItem->setKey($item)->setLabel(OW::getLanguage()->text('admin', 'themes_menu_item_' . $item))->setOrder($key)->setUrl($router->urlFor(__CLASS__, $item)); $menuItems[] = $menuItem; } $this->menu = new BASE_CMP_ContentMenu($menuItems); $this->addComponent('contentMenu', $this->menu); $this->setPageHeading(OW::getLanguage()->text('admin', 'themes_choose_page_title')); }
public function init() { $router = OW_Router::getInstance(); $pageActions = array(array('name' => 'settings', 'iconClass' => 'ow_ic_gear_wheel'), array('name' => 'css', 'iconClass' => 'ow_ic_files'), array('name' => 'graphics', 'iconClass' => 'ow_ic_picture')); $menuItems = array(); foreach ($pageActions as $key => $item) { $menuItem = new BASE_MenuItem(); $menuItem->setKey($item['name'])->setLabel(OW::getLanguage()->text('admin', 'sidebar_menu_item_' . $item['name']))->setOrder($key)->setUrl($router->urlForRoute('admin_theme_' . $item['name'])); $menuItem->setIconClass($item['iconClass']); $menuItems[] = $menuItem; } $this->menu = new BASE_CMP_ContentMenu($menuItems); $this->addComponent('contentMenu', $this->menu); OW::getNavigation()->activateMenuItem(OW_Navigation::ADMIN_APPEARANCE, 'admin', 'sidebar_menu_item_theme_edit'); $this->setPageHeading(OW::getLanguage()->text('admin', 'themes_settings_page_title')); }
private function addContentMenu() { $language = OW::getLanguage(); $router = OW_Router::getInstance(); $menuItems = array(); $menuItem = new BASE_MenuItem(); $menuItem->setKey('general_settings')->setLabel($language->text('usearch', 'general_settings'))->setUrl($router->urlForRoute('usearch.admin_general_setting'))->setOrder('1'); $menuItem->setIconClass('ow_ic_gear_wheel'); $menuItems[] = $menuItem; $menuItem = new BASE_MenuItem(); $menuItem->setKey('quick_search_settings')->setLabel($language->text('usearch', 'quick_search_settings'))->setUrl($router->urlForRoute('usearch.admin_quick_search_setting'))->setOrder('4'); $menuItem->setIconClass('ow_ic_lens'); $menuItems[] = $menuItem; $this->contentMenu = new BASE_CMP_ContentMenu($menuItems); $this->addComponent('contentMenu', $this->contentMenu); }
public function onApplicationInit(OW_Event $e) { $cssUrl = OW::getPluginManager()->getPlugin('ynsocialstream')->getStaticCssUrl() . 'sociastream.css'; OW::getDocument()->addStyleSheet($cssUrl); $providers = array('Facebook' => "facebook", 'Twitter' => "twitter", 'LinkedIn' => "linkedin"); $user = OW::getUser()->getUserObject(); $user_id = $user->getId(); $profile = $user->username; //can't get feed in another profile $pos = strpos(OW_Router::getInstance()->getUri(), "user/"); if ($pos === 0) { if (OW_Router::getInstance()->getUri() == "user/" . $profile) { $this->init_icon($providers, $user_id); } } else { $this->init_icon($providers, $user_id); } }
public function __construct() { parent::__construct(); $language = OW::getLanguage(); $router = OW_Router::getInstance(); $menuItems = array(); $menuItem = new BASE_MenuItem(); $menuItem->setKey('socialsharing_index'); $menuItem->setLabel($language->text('socialsharing', 'socialsharing_items')); $menuItem->setUrl($router->urlForRoute('socialsharing.admin')); $menuItem->setOrder('1'); $menuItem->setIconClass('ow_ic_gear_wheel'); $menuItems[] = $menuItem; $menuItem = new BASE_MenuItem(); $menuItem->setKey('socialsharing_default_image'); $menuItem->setLabel($language->text('socialsharing', 'socialsharing_default_image')); $menuItem->setUrl($router->urlForRoute('socialsharing.default_image')); $menuItem->setOrder('2'); $menuItem->setIconClass('ow_ic_files'); $menuItems[] = $menuItem; $this->contentMenu = new BASE_CMP_ContentMenu($menuItems); $this->addComponent('contentMenu', $this->contentMenu); }
public function addConsoleItem(BASE_CLASS_EventCollector $event) { $event->add(array('label' => OW::getLanguage()->text('privacy', 'privacy_index'), 'url' => OW_Router::getInstance()->urlForRoute('privacy_index'))); }
public function ajaxCropPhoto($params) { if (isset($params['coords']) && isset($params['view_size'])) { $coords = $params['coords']; $viewSize = $params['view_size']; $userId = OW_Auth::getInstance()->getUserId(); $avatarService = BOL_AvatarService::getInstance(); $avatar = $avatarService->findByUserId($userId); $oldHash = $avatar->hash; $hash = time(); try { $event = new OW_Event('base.before_avatar_change', array('userId' => $userId, 'avatarId' => $avatar->id, 'upload' => false, 'crop' => true)); OW::getEventManager()->trigger($event); $avatarService->cropAvatar($userId, $coords, $viewSize, $hash); // remove old avatar $oldAvatarPath = $avatarService->getAvatarPath($userId, 1, $oldHash); $avatarService->removeAvatarImage($oldAvatarPath); // update hash $avatar->hash = $hash; $avatarService->updateAvatar($avatar); // rename original $avatarService->renameAvatarOriginal($userId, $oldHash, $avatar->hash); $oldBigAvatarPath = $avatarService->getAvatarPath($userId, 2, $oldHash); $avatarService->removeAvatarImage($oldBigAvatarPath); $event = new OW_Event('base.after_avatar_change', array('userId' => $userId, 'avatarId' => $avatar->id, 'upload' => false, 'crop' => true)); OW::getEventManager()->trigger($event); $avatarService->trackAvatarChangeActivity($userId, $avatar->id); return array('result' => true, 'location' => OW_Router::getInstance()->urlForRoute('base_avatar_crop')); } catch (Exception $e) { return array('result' => false); } } else { return array('result' => false); } }
/** * Deletes vwvr clip * * @param array $params * @return array */ public function ajaxDeleteClip($params) { $clipId = $params['clipId']; $ownerId = $this->clipService->findClipOwner($clipId); $isOwner = OW::getUser()->isAuthorized('vwvr', 'add', $ownerId); $isModerator = OW::getUser()->isAuthorized('vwvr'); if (!$isOwner && !$isModerator) { throw new Redirect404Exception(); return; } // find room_name $clipRec = $this->clipService->findClipById($clipId); $clipName = $clipRec->title . $clipRec->recordingId; if ($clipName) { // delete recorded file from recordPath $config = OW::getConfig(); $recordPath = $config->getValue('vwvr', 'recordPath'); if (file_exists($fileRecordPath = $recordPath . "/" . $clipName . ".flv")) { unlink($fileRecordPath); } if (file_exists($fileRecordPath = $recordPath . "/" . $clipName . ".mp4")) { unlink($fileRecordPath); } // delete recorded file from streams and recordings folder $dirname = 'streams'; if (file_exists('../../' . $dirname)) { $dir = '../../' . $dirname; } elseif (file_exists('../../../' . $dirname)) { $dir = '../../../' . $dirname; } elseif (file_exists('../../../../' . $dirname)) { $dir = '../../../../' . $dirname; } elseif (file_exists('../../../../../' . $dirname)) { $dir = '../../../../../' . $dirname; } elseif (file_exists('../../../../../../' . $dirname)) { $dir = '../../../../../../' . $dirname; } // $streamsPath = realpath($dir); $streamsPath = realpath("../" . $dir); // delete file if exists if (file_exists($fileStreamsPath = $streamsPath . "/streams/" . $clipName . ".flv")) { unlink($fileStreamsPath); } if (file_exists($fileStreamsPath = $streamsPath . "/streams/" . $clipName . ".key")) { unlink($fileStreamsPath); } if (file_exists($fileStreamsPath = $streamsPath . "/streams/" . $clipName . ".meta")) { unlink($fileStreamsPath); } // delete file from recordings directory if (file_exists($fileRecordings = OW_DIR_ROOT . "ow_plugins/vwvideorecorder/vr/recordings/" . $clipName . ".vwr")) { unlink($fileRecordings); } } $delResult = $this->clipService->deleteClip($clipId); if ($delResult) { $return = array('result' => true, 'msg' => OW::getLanguage()->text('vwvr', 'clip_deleted'), 'url' => OW_Router::getInstance()->urlForRoute('vwvr_vwview_list_vr')); } else { $return = array('result' => false, 'error' => OW::getLanguage()->text('vwvr', 'clip_not_deleted')); } return $return; }
public function basePreferenceMenuItems(BASE_EventCollector $event) { // init $router = OW_Router::getInstance(); $language = OW::getLanguage(); $menuItems = array(); // process $menuItem = new BASE_MenuItem(); $menuItem->setKey('ynsc_user_linking'); $menuItem->setLabel(OW::getLanguage()->text('ynsocialconnect', 'menu_account_linking')); $menuItem->setIconClass('ow_ic_moderator'); $menuItem->setUrl($router->urlForRoute('ynsocialconnect_user_user_linking')); $menuItem->setOrder(99); $event->add($menuItem); // end }
/** * Deletes vwls clip * * @param array $params * @return array */ public function ajaxDeleteClip($params) { $clipId = $params['clipId']; $ownerId = $this->clipService->findClipOwner($clipId); $isOwner = OW::getUser()->isAuthorized('vwls', 'add', $ownerId); $isModerator = OW::getUser()->isAuthorized('vwls'); if (!$isOwner && !$isModerator) { throw new Redirect404Exception(); return; } $delResult = $this->clipService->deleteClip($clipId); if ($delResult) { $return = array('result' => true, 'msg' => OW::getLanguage()->text('vwls', 'clip_deleted'), 'url' => OW_Router::getInstance()->urlForRoute('vwls_vwview_list_ls')); } else { $return = array('result' => false, 'error' => OW::getLanguage()->text('vwls', 'clip_not_deleted')); } return $return; }
public function ajaxDeleteItem($params) { $eventId = $params['id']; $event = $this->eventService->findEvent($eventId); $isOwner = $event->getUserId() == OW::getUser()->getId(); $isModerator = OW::getUser()->isAuthorized('eventx'); if (!$isOwner && !$isModerator) { throw new Redirect404Exception(); return; } $delResult = $this->eventService->deleteEvent($eventId); if ($delResult) { $return = array('result' => true, 'msg' => OW::getLanguage()->text('eventx', 'item_deleted'), 'url' => OW_Router::getInstance()->urlForRoute('eventx.main_menu_route')); } else { $return = array('result' => false, 'error' => OW::getLanguage()->text('eventx', 'item_not_deleted')); } return $return; }
function notifications_add_console_item(BASE_CLASS_EventCollector $event) { $event->add(array('label' => OW::getLanguage()->text('notifications', 'console_menu_label'), 'url' => OW_Router::getInstance()->urlForRoute('notifications-settings'))); }
/** * Returns system router object. * * @return OW_Router */ public static function getRouter() { return OW_Router::getInstance(); }
public function onDashboardMenuItem(BASE_CLASS_EventCollector $event) { $router = OW_Router::getInstance(); $language = OW::getLanguage(); $menuItems = array(); $menuItem = new BASE_MenuItem(); $menuItem->setKey('widget_panel'); $menuItem->setLabel($language->text('base', 'widgets_panel_dashboard_label')); $menuItem->setIconClass('ow_ic_house'); $menuItem->setUrl($router->urlForRoute('base_member_dashboard')); $menuItem->setOrder(1); $event->add($menuItem); $menuItem = new BASE_MenuItem(); $menuItem->setKey('profile_edit'); $menuItem->setLabel($language->text('base', 'edit_index')); $menuItem->setIconClass('ow_ic_user'); $menuItem->setUrl($router->urlForRoute('base_edit')); $menuItem->setOrder(2); $event->add($menuItem); $menuItem = new BASE_MenuItem(); $menuItem->setKey('preference'); $menuItem->setLabel($language->text('base', 'preference_index')); $menuItem->setIconClass('ow_ic_gear_wheel'); $menuItem->setUrl($router->urlForRoute('base_preference_index')); $menuItem->setOrder(4); $event->add($menuItem); }
public function ajaxDeleteClip($params) { $videoId = $params['id']; $ownerId = IVIDEO_BOL_Service::getInstance()->findOwner($videoId); $isOwner = OW::getUser()->isAuthorized('ivideo', 'add', $ownerId); $isModerator = OW::getUser()->isAuthorized('ivideo'); if (!$isOwner && !$isModerator) { throw new Redirect404Exception(); return; } $delResult = IVIDEO_BOL_Service::getInstance()->deleteVideo($videoId); if ($delResult) { $return = array('result' => true, 'msg' => OW::getLanguage()->text('ivideo', 'video_deleted'), 'url' => OW_Router::getInstance()->urlForRoute('ivideo_view_list_main')); } else { $return = array('result' => false, 'error' => OW::getLanguage()->text('ivideo', 'video_not_deleted')); } return $return; }
/** * Deletes photo album * * @param array $params * @return array */ public function ajaxDeletePhotoAlbum(array $params) { $albumId = $params['albumId']; $lang = OW::getLanguage(); $album = $this->photoAlbumService->findAlbumById($albumId); if ($album) { // check permissions $canEdit = OW::getUser()->isAuthorized('photo', 'upload', $album->userId); $canModerate = OW::getUser()->isAuthorized('photo'); $authorized = $canEdit || $canModerate; if ($authorized) { $delResult = $this->photoAlbumService->deleteAlbum($albumId); if ($delResult) { $url = OW_Router::getInstance()->urlForRoute('photo_user_albums', array('user' => BOL_UserService::getInstance()->getUserName($album->userId))); return array('result' => true, 'msg' => $lang->text('photo', 'album_deleted'), 'url' => $url); } } else { $url = OW_Router::getInstance()->urlForRoute('photo_user_album', array('user' => BOL_UserService::getInstance()->getUserName($album->userId), 'album' => $album->id)); return array('result' => false, 'error' => $lang->text('photo', 'album_delete_not_allowed'), 'url' => $url); } } return array('result' => false); }
private function addContentMenu() { $language = OW::getLanguage(); $router = OW_Router::getInstance(); $menuItems = array(); $menuItem = new BASE_MenuItem(); $menuItem->setKey('qst_index')->setLabel($language->text('base', 'questions_menu_index'))->setUrl($router->urlForRoute('questions_account_types'))->setOrder('1'); $menuItem->setIconClass('ow_ic_files'); $menuItems[] = $menuItem; $this->contentMenu = new BASE_CMP_ContentMenu($menuItems); $this->addComponent('contentMenu', $this->contentMenu); }
/** * */ function on_add_console_item(BASE_CLASS_EventCollector $event) { $event->add(array('label' => 'Video Manager', 'url' => OW_Router::getInstance()->urlForRoute('spvideolite.my_video'))); }
/** * Returns album's previous photo * * @param int $albumId * @param int $id * @return array */ public function getPreviousPhoto($albumId, $id) { $photo = $this->photoDao->getPreviousPhoto($albumId, $id); if ($photo) { $router = OW_Router::getInstance(); $prevPhoto = array(); $prevPhoto['dto'] = $photo; $prevPhoto['url'] = $this->getPhotoPreviewUrl($photo->id, $photo->hash); $prevPhoto['href'] = $router->urlForRoute('view_photo', array('id' => $photo->id)); return $prevPhoto; } return null; }
public function ajaxDeletePhoto(array $params) { $return = array(); if (!empty($params['entityId']) && ($photo = $this->photoService->findPhotoById($params['entityId'])) !== NULL) { $ownerId = $this->photoService->findPhotoOwner($photo->id); $isOwner = $ownerId == OW::getUser()->getId(); $isModerator = OW::getUser()->isAuthorized('photo'); if (!$isOwner && !$isModerator) { throw new Redirect404Exception(); } if ($this->photoService->deletePhoto($photo->id)) { $cover = PHOTO_BOL_PhotoAlbumCoverDao::getInstance()->findByAlbumId($photo->albumId); if ($cover === NULL || (int) $cover->auto) { PHOTO_BOL_PhotoAlbumCoverDao::getInstance()->deleteCoverByAlbumId($photo->albumId); $this->photoService->createAlbumCover($photo->albumId, array_reverse(PHOTO_BOL_PhotoDao::getInstance()->getAlbumAllPhotos($photo->albumId))); } $url = OW_Router::getInstance()->urlForRoute('photo_user_albums', array('user' => BOL_UserService::getInstance()->getUserName($ownerId))); $return = array('result' => TRUE, 'msg' => OW::getLanguage()->text('photo', 'photo_deleted'), 'url' => $url, 'coverUrl' => PHOTO_BOL_PhotoAlbumCoverDao::getInstance()->getAlbumCoverUrlByAlbumId($photo->albumId), 'isHasCover' => PHOTO_BOL_PhotoAlbumCoverDao::getInstance()->isAlbumCoverExist($photo->albumId)); } else { $return = array('result' => FALSE, 'error' => OW::getLanguage()->text('photo', 'photo_not_deleted')); } } return $return; }
public function addConsoleItem(BASE_CLASS_EventCollector $event) { $event->add(array('label' => OW::getLanguage()->text('matchmaking', 'matchmaking_preferences'), 'url' => OW_Router::getInstance()->urlForRoute('matchmaking_preferences'))); }