Exemplo n.º 1
0
 /**
  * Returns menu component
  *
  * @return BASE_CMP_ContentMenu
  */
 private function getMenu()
 {
     $language = OW::getLanguage();
     $validLists = array('photo', 'album', 'tagged');
     $classes = array('', '', 'ow_ic_tag');
     $urls = array(OW::getRouter()->urlForRoute('photo_list_index'), OW::getRouter()->urlForRoute('photo_list_albums'), '');
     $titles = array($language->text('advancedphoto', 'photos'), $language->text('advancedphoto', 'albums'), $language->text('photo', 'menu_tagged'));
     if ($user = OW::getUser()->getUserObject()) {
         $validLists[3] = "myalbum";
         $classes[3] = "";
         $urls[3] = OW::getRouter()->urlForRoute('photo_user_albums', array('user' => $user->username));
         $titles[3] = $language->text('advancedphoto', 'my_albums');
     }
     $checkPrivacy = PHOTO_BOL_PhotoService::getInstance()->countPhotos('featured');
     if (!PHOTO_BOL_PhotoService::getInstance()->countPhotos('featured', $checkPrivacy)) {
         array_shift($validLists);
         array_shift($classes);
     }
     $menuItems = array();
     $order = 0;
     foreach ($validLists as $type) {
         $item = new BASE_MenuItem();
         $item->setLabel($titles[$order]);
         $item->setUrl($urls[$order] != '' ? $urls[$order] : OW::getRouter()->urlForRoute('view_photo_list', array('listType' => $type)));
         $item->setKey($type);
         $item->setIconClass($classes[$order]);
         $item->setOrder($order);
         array_push($menuItems, $item);
         $order++;
     }
     $menu = new BASE_CMP_ContentMenu($menuItems);
     return $menu;
 }
Exemplo n.º 2
0
 public function import($params)
 {
     $importDir = $params['importDir'];
     $txtFile = $importDir . 'configs.txt';
     // import configs
     if (file_exists($txtFile)) {
         $string = file_get_contents($txtFile);
         $configs = json_decode($string, true);
     }
     if (!$configs) {
         return;
     }
     $photoService = PHOTO_BOL_PhotoService::getInstance();
     $types = array('main', 'preview', 'original');
     $photoDir = $photoService->getPhotoUploadDir();
     $page = 1;
     while (true) {
         $photos = $photoService->findPhotoList('latest', $page, 10);
         $page++;
         if (empty($photos)) {
             break;
         }
         foreach ($photos as $photo) {
             foreach ($types as $type) {
                 $path = $photoService->getPhotoPath($photo['id'], $photo['hash'], $type);
                 $photoName = str_replace($photoDir, '', $path);
                 $content = file_get_contents($configs['url'] . '/' . $photoName);
                 if (mb_strlen($content)) {
                     OW::getStorage()->fileSetContent($path, $content);
                 }
             }
         }
     }
 }
Exemplo n.º 3
0
 public function __construct($listType, $count, $exclude = null, $albumId = null)
 {
     parent::__construct();
     $this->photoService = PHOTO_BOL_PhotoService::getInstance();
     $this->photoAlbumService = PHOTO_BOL_PhotoAlbumService::getInstance();
     $checkPrivacy = !OW::getUser()->isAuthorized('photo');
     if ($albumId) {
         $photos = $this->photoService->getAlbumPhotos($albumId, 1, $count, $exclude);
     } else {
         $photos = $this->photoService->findPhotoList($listType, 1, $count, $checkPrivacy, $exclude);
     }
     $this->assign('photos', $photos);
     foreach ($photos as $photo) {
         array_push($exclude, $photo['id']);
     }
     if ($albumId) {
         $loadMore = $this->photoAlbumService->countAlbumPhotos($albumId, $exclude);
     } else {
         $loadMore = $this->photoService->countPhotos($listType, $checkPrivacy, $exclude);
     }
     if (!$loadMore) {
         $script = "OWM.trigger('photo.hide_load_more', {});";
         OW::getDocument()->addOnloadScript($script);
     }
 }
Exemplo n.º 4
0
 public function albumsDeleteProcess()
 {
     $config = OW::getConfig();
     // check if uninstall is in progress
     if (!$config->getValue('photo', 'uninstall_inprogress')) {
         return;
     }
     // check if cron queue is not busy
     if ($config->getValue('photo', 'uninstall_cron_busy')) {
         return;
     }
     $config->saveConfig('photo', 'uninstall_cron_busy', 1);
     $albumService = PHOTO_BOL_PhotoAlbumService::getInstance();
     try {
         $albumService->deleteAlbums(self::ALBUMS_DELETE_LIMIT);
     } catch (Exception $e) {
         OW::getLogger()->addEntry(json_encode($e));
     }
     $config->saveConfig('photo', 'uninstall_cron_busy', 0);
     if (!$albumService->countAlbums()) {
         BOL_PluginService::getInstance()->uninstall('photo');
         $config->saveConfig('photo', 'uninstall_inprogress', 0);
         PHOTO_BOL_PhotoService::getInstance()->setMaintenanceMode(false);
     }
 }
Exemplo n.º 5
0
 /**
  * Class constructor
  */
 public function __construct()
 {
     parent::__construct();
     $this->photoService = PHOTO_BOL_PhotoService::getInstance();
     $this->photoAlbumService = PHOTO_BOL_PhotoAlbumService::getInstance();
     $this->ajaxResponder = OW::getRouter()->urlFor('GPHOTOVIEWER_CTRL_Index', 'ajaxResponder');
 }
Exemplo n.º 6
0
 public function __construct($photoId)
 {
     parent::__construct();
     $photoEditForm = new PHOTO_CLASS_EditForm($photoId);
     $this->addForm($photoEditForm);
     $photo = PHOTO_BOL_PhotoService::getInstance()->findPhotoById($photoId);
     $photoEditForm->getElement('id')->setValue($photoId);
     $photoEditForm->getElement('description')->setValue($photo->description);
 }
Exemplo n.º 7
0
 public function export($params)
 {
     $photoService = PHOTO_BOL_PhotoService::getInstance();
     $url = OW::getStorage()->getFileUrl($photoService->getPhotoUploadDir());
     /* @var $za ZipArchives */
     $za = $params['zipArchive'];
     $archiveDir = $params['archiveDir'];
     $string = json_encode(array('url' => $url));
     $za->addFromString($archiveDir . '/' . 'configs.txt', $string);
 }
Exemplo n.º 8
0
 public function __construct($userId)
 {
     $photos = PHOTO_BOL_PhotoService::getInstance()->findPhotoList('latest', 1, 2);
     if (empty($photos)) {
         $this->setVisible(false);
         return;
     }
     $items = array();
     foreach ($photos as $item) {
         $items[] = array('src' => $item['url']);
     }
     parent::__construct($items, 'Photos');
 }
Exemplo n.º 9
0
 public function __construct($albumId = NULL, $albumName = NULL, $albumDescription = null, $url = NULL)
 {
     if (!OW::getUser()->isAuthorized('photo', 'upload')) {
         $this->setVisible(FALSE);
         return;
     }
     $userId = OW::getUser()->getId();
     $document = OW::getDocument();
     PHOTO_BOL_PhotoTemporaryService::getInstance()->deleteUserTemporaryPhotos($userId);
     $plugin = OW::getPluginManager()->getPlugin('photo');
     $document->addStyleSheet($plugin->getStaticCssUrl() . 'photo_upload.css');
     $document->addScript($plugin->getStaticJsUrl() . 'jQueryRotate.min.js');
     $document->addScript($plugin->getStaticJsUrl() . 'codemirror.min.js');
     $document->addScript($plugin->getStaticJsUrl() . 'upload.js');
     $document->addScriptDeclarationBeforeIncludes(UTIL_JsGenerator::composeJsString(';window.ajaxPhotoUploadParams = {};
             Object.defineProperties(ajaxPhotoUploadParams, {
                 actionUrl: {
                     value: {$url},
                     writable: false,
                     enumerable: true
                 },
                 maxFileSize: {
                     value: {$size},
                     writable: false,
                     enumerable: true
                 },
                 deleteAction: {
                     value: {$deleteAction},
                     writable: false,
                     enumerable: true
                 }
             });', array('url' => OW::getRouter()->urlForRoute('photo.ajax_upload'), 'size' => PHOTO_BOL_PhotoService::getInstance()->getMaxUploadFileSize(), 'deleteAction' => OW::getRouter()->urlForRoute('photo.ajax_upload_delete'))));
     $document->addOnloadScript(';window.ajaxPhotoUploader.init();');
     $this->addForm(new PHOTO_CLASS_AjaxUploadForm('user', $userId, $albumId, $albumName, $albumDescription, $url));
     $newsfeedAlbum = PHOTO_BOL_PhotoAlbumService::getInstance()->getNewsfeedAlbum($userId);
     $this->assign('albumNameList', PHOTO_BOL_PhotoAlbumService::getInstance()->findAlbumNameListByUserId($userId, !empty($newsfeedAlbum) ? array($newsfeedAlbum->id) : array()));
     $language = OW::getLanguage();
     $language->addKeyForJs('photo', 'not_all_photos_uploaded');
     $language->addKeyForJs('photo', 'size_limit');
     $language->addKeyForJs('photo', 'type_error');
     $language->addKeyForJs('photo', 'dnd_support');
     $language->addKeyForJs('photo', 'dnd_not_support');
     $language->addKeyForJs('photo', 'drop_here');
     $language->addKeyForJs('photo', 'please_wait');
     $language->addKeyForJs('photo', 'create_album');
     $language->addKeyForJs('photo', 'album_name');
     $language->addKeyForJs('photo', 'album_desc');
     $language->addKeyForJs('photo', 'describe_photo');
     $language->addKeyForJs('photo', 'photo_upload_error');
 }
Exemplo n.º 10
0
 public function onInfoRender(OW_Event $event)
 {
     $language = OW::getLanguage();
     $params = $event->getParams();
     if ($params["entityType"] != HINT_BOL_Service::ENTITY_TYPE_USER) {
         return;
     }
     $userId = $params["entityId"];
     if ($params["key"] != "photo-count") {
         return;
     }
     $count = PHOTO_BOL_PhotoService::getInstance()->countUserPhotos($userId);
     $url = OW::getRouter()->urlForRoute("photo_user_albums", array("user" => BOL_UserService::getInstance()->getUserName($userId)));
     $event->setData($language->text("hint", "info_photo_count", array("count" => $count, "url" => $url)));
 }
Exemplo n.º 11
0
 public function findIndexedData($searchVal, array $entityTypes = array(), $limit = PHOTO_BOL_SearchService::SEARCH_LIMIT)
 {
     $condition = PHOTO_BOL_PhotoService::getInstance()->getQueryCondition('searchByDesc', array('photo' => 'p', 'album' => 'a'));
     $sql = 'SELECT `index`.*
         FROM `' . $this->getTableName() . '` AS `index`
             INNER JOIN `' . PHOTO_BOL_PhotoDao::getInstance()->getTableName() . '` AS `p` ON(`index`.`entityId` = `p`.`id`)
             INNER JOIN `' . PHOTO_BOL_PhotoAlbumDao::getInstance()->getTableName() . '` AS `a` ON(`a`.`id` = `p`.`albumId`)
         ' . $condition['join'] . '
         WHERE MATCH(`index`.`' . self::CONTENT . '`) AGAINST(:val IN BOOLEAN MODE) AND `p`.`privacy` = :everybody AND `p`.`status` = :status AND ' . $condition['where'];
     if (count($entityTypes) !== 0) {
         $sql .= ' AND `index`.`' . self::ENTITY_TYPE_ID . '` IN (SELECT `entity`.`id`
             FROM `' . PHOTO_BOL_SearchEntityTypeDao::getInstance()->getTableName() . '` AS `entity`
             WHERE `entity`.`' . PHOTO_BOL_SearchEntityTypeDao::ENTITY_TYPE . '` IN( ' . $this->dbo->mergeInClause($entityTypes) . '))';
     }
     $sql .= ' LIMIT :limit';
     return $this->dbo->queryForObjectList($sql, $this->getDtoClassName(), array_merge($condition['params'], array('val' => $searchVal, 'limit' => (int) $limit, 'everybody' => PHOTO_BOL_PhotoDao::PRIVACY_EVERYBODY, 'status' => 'approved')));
 }
Exemplo n.º 12
0
 public function __construct($photoId = NULL)
 {
     parent::__construct('photo-edit-form');
     $this->setAjax(TRUE);
     $this->setAction(OW::getRouter()->urlFor('PHOTO_CTRL_Photo', 'ajaxUpdatePhoto'));
     $this->bindJsFunction('success', 'function( data )
         {
             OW.trigger("photo.afterPhotoEdit", data);
         }');
     $photo = PHOTO_BOL_PhotoService::getInstance()->findPhotoById($photoId);
     $album = PHOTO_BOL_PhotoAlbumService::getInstance()->findAlbumById($photo->albumId);
     $photoIdField = new HiddenField('photoId');
     $photoIdField->setRequired(TRUE);
     $photoIdField->setValue($photo->id);
     $photoIdField->addValidator(new PHOTO_CLASS_PhotoOwnerValidator());
     $this->addElement($photoIdField);
     $albumField = new TextField('album');
     $albumField->setId('ajax-upload-album');
     $albumField->setRequired();
     $albumField->setValue($album->name);
     $albumField->setLabel(OW::getLanguage()->text('photo', 'create_album'));
     $albumField->addAttribute('class', 'ow_dropdown_btn ow_inputready ow_cursor_pointer');
     $albumField->addAttribute('autocomplete', 'off');
     $albumField->addAttribute('readonly');
     $this->addElement($albumField);
     $albumNameField = new TextField('album-name');
     $albumNameField->setRequired();
     $albumNameField->setValue($album->name);
     $albumNameField->addValidator(new PHOTO_CLASS_AlbumNameValidator(FALSE, NULL, $album->name));
     $albumNameField->setHasInvitation(TRUE);
     $albumNameField->setInvitation(OW::getLanguage()->text('photo', 'album_name'));
     $albumNameField->addAttribute('class', 'ow_smallmargin invitation');
     $this->addElement($albumNameField);
     $desc = new Textarea('description');
     $desc->setHasInvitation(TRUE);
     $desc->setInvitation(OW::getLanguage()->text('photo', 'album_desc'));
     $this->addElement($desc);
     $photoDesc = new PHOTO_CLASS_HashtagFormElement('photo-desc');
     $photoDesc->setValue($photo->description);
     $photoDesc->setLabel(OW::getLanguage()->text('photo', 'album_desc'));
     $this->addElement($photoDesc);
     $submit = new Submit('edit');
     $submit->setValue(OW::getLanguage()->text('photo', 'btn_edit'));
     $this->addElement($submit);
 }
Exemplo n.º 13
0
 public function findUserPhotos($userId, $start, $offset)
 {
     $photoService = PHOTO_BOL_PhotoService::getInstance();
     $photoDao = PHOTO_BOL_PhotoDao::getInstance();
     $albumDao = PHOTO_BOL_PhotoAlbumDao::getInstance();
     $query = 'SELECT p.* FROM ' . $photoDao->getTableName() . ' AS p
         INNER JOIN ' . $albumDao->getTableName() . ' AS a ON p.albumId=a.id
             WHERE a.userId=:u AND p.status = "approved" ORDER BY p.addDatetime DESC
                 LIMIT :start, :offset';
     $list = OW::getDbo()->queryForList($query, array('u' => $userId, 'start' => $start, 'offset' => $offset));
     $out = array();
     foreach ($list as $photo) {
         $id = $photo['id'];
         $out[$id] = array('id' => $id, 'thumb' => $photoService->getPhotoPreviewUrl($id), 'url' => $photoService->getPhotoUrl($id), 'path' => $photoService->getPhotoPath($id), 'description' => $photo['description'], 'permalink' => OW::getRouter()->urlForRoute('view_photo', array('id' => $id)));
         $out[$id]['oembed'] = json_encode(array('type' => 'photo', 'url' => $out[$id]['url'], 'href' => $out[$id]['permalink'], 'description' => $out[$id]['description']));
     }
     return $out;
 }
Exemplo n.º 14
0
 /**
  * Class constructor
  */
 public function __construct($photoId)
 {
     parent::__construct('photo-edit-form');
     $this->setAjax(true);
     $this->setAction(OW::getRouter()->urlFor('PHOTO_CTRL_Photo', 'ajaxUpdatePhoto'));
     $language = OW::getLanguage();
     $photo = PHOTO_BOL_PhotoService::getInstance()->findPhotoById($photoId);
     $album = PHOTO_BOL_PhotoAlbumService::getInstance()->findAlbumById($photo->albumId);
     $userId = OW::getUser()->getId();
     // photo id field
     $photoIdField = new HiddenField('id');
     $photoIdField->setRequired(true);
     $this->addElement($photoIdField);
     // photo album Field
     $albumField = new SuggestField('album');
     $responderUrl = OW::getRouter()->urlFor('PHOTO_CTRL_Upload', 'suggestAlbum', array('userId' => $userId));
     $albumField->setResponderUrl($responderUrl);
     if ($album) {
         $albumField->setValue($album->name);
     }
     $albumField->setRequired(true);
     $albumField->setLabel($language->text('photo', 'album'));
     $this->addElement($albumField);
     // description Field
     $descField = new WysiwygTextarea('description', null, false);
     $descField->setId("photo-desc-area");
     $this->addElement($descField->setLabel($language->text('photo', 'description')));
     $tags = array();
     $entityTags = BOL_TagService::getInstance()->findEntityTags($photo->id, 'photo');
     if ($entityTags) {
         $tags = array();
         foreach ($entityTags as $entityTag) {
             $tags[] = $entityTag->label;
         }
         $tagsField = new TagsInputField('tags');
         $tagsField->setValue($tags);
     } else {
         $tagsField = new TagsInputField('tags');
     }
     $this->addElement($tagsField->setLabel($language->text('photo', 'tags')));
     $submit = new Submit('edit');
     $submit->setValue($language->text('photo', 'btn_edit'));
     $this->addElement($submit);
 }
Exemplo n.º 15
0
 public function getMenuItems(array $keys, $uniqId)
 {
     $lang = OW::getLanguage();
     $menuItems = array();
     $photoService = PHOTO_BOL_PhotoService::getInstance();
     if (in_array('latest', $keys)) {
         $count = $photoService->countPhotos('latest');
         $menuItems['latest'] = array('label' => $lang->text('photo', 'menu_latest'), 'id' => 'photo-cmp-menu-latest-' . $uniqId, 'contId' => 'photo-cmp-latest-' . $uniqId, 'active' => true, 'visibility' => $count > $this->visiblePhotoCount ? true : false);
     }
     if (in_array('featured', $keys)) {
         $count = $photoService->countPhotos('featured');
         $menuItems['featured'] = array('label' => $lang->text('photo', 'menu_featured'), 'id' => 'photo-cmp-menu-featured-' . $uniqId, 'contId' => 'photo-cmp-featured-' . $uniqId, 'active' => false, 'visibility' => $count > $this->visiblePhotoCount ? true : false);
     }
     if (in_array('toprated', $keys)) {
         $count = $photoService->countPhotos('toprated');
         $menuItems['toprated'] = array('label' => $lang->text('photo', 'menu_toprated'), 'id' => 'photo-cmp-menu-toprated-' . $uniqId, 'contId' => 'photo-cmp-toprated-' . $uniqId, 'active' => false, 'visibility' => $count > $this->visiblePhotoCount ? true : false);
     }
     return $menuItems;
 }
Exemplo n.º 16
0
 /**
  * @param BASE_CLASS_WidgetParameter $paramObj
  */
 public function __construct(BASE_CLASS_WidgetParameter $paramObj)
 {
     parent::__construct();
     $photoService = PHOTO_BOL_PhotoService::getInstance();
     $num = isset($paramObj->customParamList['photoCount']) ? $paramObj->customParamList['photoCount'] : 8;
     $cmpParams = array('photoCount' => $num, 'checkAuth' => false, 'wrapBox' => false, 'uniqId' => uniqid(), 'showTitle' => false, 'showToolbar' => true);
     if (!$paramObj->customizeMode) {
         $items = array('latest', 'toprated');
         if ($photoService->countPhotos('featured')) {
             $items[] = 'featured';
         }
         $menuItems = PHOTO_CMP_IndexPhotoList::getMenuItems($items, $cmpParams['uniqId']);
         $this->addComponent('menu', new BASE_CMP_WidgetMenu($menuItems));
     } else {
         $cmpParams['showMenu'] = false;
     }
     $cmp = new PHOTO_CMP_IndexPhotoList($cmpParams);
     $this->addComponent('cmp', $cmp);
 }
Exemplo n.º 17
0
 public function getService($pluginKey)
 {
     switch ($pluginKey) {
         case 'newsfeed':
             return NEWSFEED_BOL_Service::getInstance();
         case 'blogs':
             return PostService::getInstance();
         case 'groups':
             return GROUPS_BOL_Service::getInstance();
         case 'event':
             return EVENT_BOL_EventService::getInstance();
         case 'links':
             return LinkService::getInstance();
         case 'video':
             return VIDEO_BOL_ClipService::getInstance();
         case 'forum':
             return FORUM_BOL_ForumService::getInstance();
         case 'photo':
             return PHOTO_BOL_PhotoService::getInstance();
     }
 }
Exemplo n.º 18
0
 /**
  * @return Constructor.
  */
 public function __construct(BASE_CLASS_WidgetParameter $paramObj)
 {
     parent::__construct();
     $photoService = PHOTO_BOL_PhotoService::getInstance();
     $photoAlbumService = PHOTO_BOL_PhotoAlbumService::getInstance();
     $userId = $paramObj->additionalParamList['entityId'];
     $user = BOL_UserService::getInstance()->getUserName($userId);
     $this->assign('user', $user);
     $num = isset($paramObj->customParamList['albumsCount']) ? $paramObj->customParamList['albumsCount'] : 4;
     $albums = $photoAlbumService->findUserAlbumList($userId, 1, $num);
     if ($albums) {
         $this->assign('albums', $albums);
         $albumsCount = $photoAlbumService->countUserAlbums($userId);
         $this->assign('albumsCount', $albumsCount);
     } else {
         if (!$paramObj->customizeMode) {
             $this->setVisible(false);
         }
         $this->assign('albums', null);
         $this->assign('albumsCount', 0);
         $albumsCount = 0;
     }
     // privacy check
     $viewerId = OW::getUser()->getId();
     $ownerMode = $userId == $viewerId;
     $modPermissions = OW::getUser()->isAuthorized('photo');
     if (!$ownerMode && !$modPermissions) {
         $privacyParams = array('action' => 'photo_view_album', 'ownerId' => $userId, 'viewerId' => $viewerId);
         $event = new OW_Event('privacy_check_permission', $privacyParams);
         try {
             OW::getEventManager()->trigger($event);
         } catch (RedirectException $e) {
             $this->setVisible(false);
         }
     }
     $showTitles = isset($paramObj->customParamList['showTitles']) ? $paramObj->customParamList['showTitles'] : false;
     $this->assign('showTitles', $showTitles);
     $lang = OW::getLanguage();
     $this->setSettingValue(self::SETTING_TOOLBAR, array(array('label' => $lang->text('photo', 'total_albums', array('total' => $albumsCount))), array('label' => $lang->text('base', 'view_all'), 'href' => OW::getRouter()->urlForRoute('photo_user_albums', array('user' => $user)))));
 }
Exemplo n.º 19
0
 /**
  * @param BASE_CLASS_WidgetParameter $paramObj
  */
 public function __construct(BASE_CLASS_WidgetParameter $paramObj)
 {
     parent::__construct();
     $photoService = PHOTO_BOL_PhotoService::getInstance();
     $num = !empty($paramObj->customParamList['photoCount']) ? $paramObj->customParamList['photoCount'] : 8;
     $cmpParams = array('photoCount' => $num, 'checkAuth' => false, 'wrapBox' => false, 'uniqId' => uniqid(), 'showTitle' => false, 'showToolbar' => true);
     $uniqId = $cmpParams['uniqId'];
     $cmp = new PHOTO_MCMP_IndexPhotoList($cmpParams);
     $this->addComponent('cmp', $cmp);
     $items = array('latest', 'toprated');
     if ($photoService->countPhotos('featured')) {
         $items[] = 'featured';
     }
     $menuItems = $cmp->getMenuItems($items, $uniqId);
     $menuCmp = new BASE_MCMP_WidgetMenu($menuItems);
     $paramObj->standartParamList->capContent = $menuCmp->render();
     $this->setSettingValue(self::SETTING_TOOLBAR, PHOTO_MCMP_IndexPhotoList::getToolbar($uniqId));
     $script = '';
     foreach ($menuItems as $key => $item) {
         if (!empty($item["visibility"])) {
             $script .= '
                 $("#photo-cmp-menu-' . $key . '-' . $uniqId . '").click(function(){
                     var list = $("#toolbar-photo-' . $key . '-' . $uniqId . '").parents("div:eq(0)").find("a");
                     list.hide();
                     list.css("visibility","hidden");
                     $("#toolbar-photo-' . $key . '-' . $uniqId . '").css("visibility","visible").show();
                 }); ';
         } else {
             $script .= '
                 $("#photo-cmp-menu-' . $key . '-' . $uniqId . '").click(function(){
                     var list = $("#toolbar-photo-' . $key . '-' . $uniqId . '").parents("div:eq(0)").find("a");
                     list.hide();
                     list.css("visibility","hidden");
                     $("#toolbar-photo-' . $key . '-' . $uniqId . '").show();
                 }); ';
         }
     }
     OW::getDocument()->addOnloadScript($script);
     $this->setTemplate(OW::getPluginManager()->getPlugin('photo')->getMobileCmpViewDir() . 'photo_list_widget.html');
 }
Exemplo n.º 20
0
 public function __construct($albumId = null, $albumName = null, $albumDescription = null, $url = null, $data = null)
 {
     parent::__construct();
     if (!OW::getUser()->isAuthorized('photo', 'upload')) {
         $this->setVisible(false);
         return;
     }
     $userId = OW::getUser()->getId();
     $document = OW::getDocument();
     PHOTO_BOL_PhotoTemporaryService::getInstance()->deleteUserTemporaryPhotos($userId);
     $plugin = OW::getPluginManager()->getPlugin('photo');
     $document->addStyleSheet($plugin->getStaticCssUrl() . 'photo_upload.css');
     $document->addScript($plugin->getStaticJsUrl() . 'codemirror.min.js');
     $document->addScript($plugin->getStaticJsUrl() . 'upload.js');
     $document->addScriptDeclarationBeforeIncludes(UTIL_JsGenerator::composeJsString(';window.ajaxPhotoUploadParams = Object.freeze({$params});', array('params' => array('actionUrl' => OW::getRouter()->urlForRoute('photo.ajax_upload'), 'maxFileSize' => PHOTO_BOL_PhotoService::getInstance()->getMaxUploadFileSize(), 'deleteAction' => OW::getRouter()->urlForRoute('photo.ajax_upload_delete')))));
     $document->addOnloadScript(';window.ajaxPhotoUploader.init();');
     $form = new PHOTO_CLASS_AjaxUploadForm('user', $userId, $albumId, $albumName, $albumDescription, $url, $data);
     $this->addForm($form);
     $this->assign('extendInputs', $form->getExtendedElements());
     $this->assign('albumId', $albumId);
     $this->assign('userId', $userId);
     $newsfeedAlbum = PHOTO_BOL_PhotoAlbumService::getInstance()->getNewsfeedAlbum($userId);
     $exclude = !empty($newsfeedAlbum) ? array($newsfeedAlbum->id) : array();
     $this->addComponent('albumNames', OW::getClassInstance('PHOTO_CMP_AlbumNameList', $userId, $exclude));
     $language = OW::getLanguage();
     $language->addKeyForJs('photo', 'not_all_photos_uploaded');
     $language->addKeyForJs('photo', 'size_limit');
     $language->addKeyForJs('photo', 'type_error');
     $language->addKeyForJs('photo', 'dnd_support');
     $language->addKeyForJs('photo', 'dnd_not_support');
     $language->addKeyForJs('photo', 'drop_here');
     $language->addKeyForJs('photo', 'please_wait');
     $language->addKeyForJs('photo', 'create_album');
     $language->addKeyForJs('photo', 'album_name');
     $language->addKeyForJs('photo', 'album_desc');
     $language->addKeyForJs('photo', 'describe_photo');
     $language->addKeyForJs('photo', 'photo_upload_error');
 }
Exemplo n.º 21
0
 public function getUserPhotoCount($userId)
 {
     if (!$this->isActive()) {
         return null;
     }
     return PHOTO_BOL_PhotoService::getInstance()->countUserPhotos($userId);
 }
Exemplo n.º 22
0
 /**
  * Class constructor
  *
  * @param string $listType
  * @param int $count
  * @param string $tag
  */
 public function __construct(array $params)
 {
     parent::__construct();
     $photoId = $params['photoId'];
     $config = OW::getConfig();
     $lang = OW::getLanguage();
     $this->photoService = PHOTO_BOL_PhotoService::getInstance();
     $this->photoAlbumService = PHOTO_BOL_PhotoAlbumService::getInstance();
     $photo = $this->photoService->findPhotoById($photoId);
     $album = $this->photoAlbumService->findAlbumById($photo->albumId);
     $this->assign('album', $album);
     // is owner
     $contentOwner = $this->photoService->findPhotoOwner($photo->id);
     $userId = OW::getUser()->getId();
     $ownerMode = $contentOwner == $userId;
     $this->assign('ownerMode', $ownerMode);
     // is moderator
     $modPermissions = OW::getUser()->isAuthorized('photo');
     $this->assign('moderatorMode', $modPermissions);
     $canView = true;
     if (!$ownerMode && !$modPermissions && !OW::getUser()->isAuthorized('photo', 'view')) {
         $canView = false;
     }
     $this->assign('canView', $canView);
     $cmtParams = new BASE_CommentsParams('photo', 'photo_comments');
     $cmtParams->setEntityId($photo->id);
     $cmtParams->setOwnerId($contentOwner);
     $cmtParams->setDisplayType(BASE_CommentsParams::DISPLAY_TYPE_BOTTOM_FORM_WITH_FULL_LIST);
     $photoCmts = new BASE_CMP_Comments($cmtParams);
     $this->addComponent('comments', $photoCmts);
     $photoRates = new BASE_CMP_Rate('photo', 'photo_rates', $photo->id, $contentOwner);
     $this->addComponent('rate', $photoRates);
     $photoTags = new BASE_CMP_EntityTagCloud('photo');
     $photoTags->setEntityId($photo->id);
     $photoTags->setRouteName('view_tagged_photo_list');
     $this->addComponent('tags', $photoTags);
     $description = $photo->description;
     $photo->description = UTIL_HtmlTag::autoLink($photo->description);
     $this->assign('photo', $photo);
     $this->assign('url', $this->photoService->getPhotoUrl($photo->id, false, $photo->hash));
     $this->assign('ownerName', BOL_UserService::getInstance()->getUserName($album->userId));
     $is_featured = PHOTO_BOL_PhotoFeaturedService::getInstance()->isFeatured($photo->id);
     if ((int) $config->getValue('photo', 'store_fullsize') && $photo->hasFullsize) {
         $this->assign('fullsizeUrl', $this->photoService->getPhotoFullsizeUrl($photo->id, $photo->hash));
     } else {
         $this->assign('fullsizeUrl', null);
     }
     $action = new BASE_ContextAction();
     $action->setKey('photo-moderate');
     $context = new BASE_CMP_ContextAction();
     $context->addAction($action);
     $contextEvent = new BASE_CLASS_EventCollector('photo.collect_photo_context_actions', array('photoId' => $photoId, 'photoDto' => $photo));
     OW::getEventManager()->trigger($contextEvent);
     foreach ($contextEvent->getData() as $contextAction) {
         $action = new BASE_ContextAction();
         $action->setKey(empty($contextAction['key']) ? uniqid() : $contextAction['key']);
         $action->setParentKey('photo-moderate');
         $action->setLabel($contextAction['label']);
         if (!empty($contextAction['id'])) {
             $action->setId($contextAction['id']);
         }
         if (!empty($contextAction['order'])) {
             $action->setOrder($contextAction['order']);
         }
         if (!empty($contextAction['class'])) {
             $action->setClass($contextAction['class']);
         }
         if (!empty($contextAction['url'])) {
             $action->setUrl($contextAction['url']);
         }
         $attributes = empty($contextAction['attributes']) ? array() : $contextAction['attributes'];
         foreach ($attributes as $key => $value) {
             $action->addAttribute($key, $value);
         }
         $context->addAction($action);
     }
     if ($userId && !$ownerMode) {
         $action = new BASE_ContextAction();
         $action->setKey('flag');
         $action->setParentKey('photo-moderate');
         $action->setLabel($lang->text('base', 'flag'));
         $action->setId('btn-photo-flag');
         $action->addAttribute('rel', $photoId);
         $action->addAttribute('url', OW::getRouter()->urlForRoute('view_photo', array('id' => $photo->id)));
         $context->addAction($action);
     }
     if ($ownerMode || $modPermissions) {
         $action = new BASE_ContextAction();
         $action->setKey('edit');
         $action->setParentKey('photo-moderate');
         $action->setLabel($lang->text('base', 'edit'));
         $action->setId('btn-photo-edit');
         $action->addAttribute('rel', $photoId);
         $context->addAction($action);
         $action = new BASE_ContextAction();
         $action->setKey('delete');
         $action->setParentKey('photo-moderate');
         $action->setLabel($lang->text('base', 'delete'));
         $action->setId('photo-delete');
         $action->addAttribute('rel', $photoId);
         $context->addAction($action);
     }
     if ($modPermissions) {
         if ($is_featured) {
             $action = new BASE_ContextAction();
             $action->setKey('unmark-featured');
             $action->setParentKey('photo-moderate');
             $action->setLabel($lang->text('photo', 'remove_from_featured'));
             $action->setId('photo-mark-featured');
             $action->addAttribute('rel', 'remove_from_featured');
             $action->addAttribute('photo-id', $photoId);
             $context->addAction($action);
         } else {
             $action = new BASE_ContextAction();
             $action->setKey('mark-featured');
             $action->setParentKey('photo-moderate');
             $action->setLabel($lang->text('photo', 'mark_featured'));
             $action->setId('photo-mark-featured');
             $action->addAttribute('rel', 'mark_featured');
             $action->addAttribute('photo-id', $photoId);
             $context->addAction($action);
         }
     }
     $this->addComponent('contextAction', $context);
     $nextPhoto = $this->photoService->getNextPhoto($photo->albumId, $photo->id);
     $this->assign('nextPhoto', $nextPhoto);
     $previousPhoto = $this->photoService->getPreviousPhoto($photo->albumId, $photo->id);
     $this->assign('previousPhoto', $previousPhoto);
     $photoCount = $this->photoAlbumService->countAlbumPhotos($photo->albumId);
     $this->assign('photoCount', $photoCount);
     $photoIndex = $this->photoService->getPhotoIndex($photo->albumId, $photo->id);
     $this->assign('photoIndex', $photoIndex);
     $avatar = BOL_AvatarService::getInstance()->getDataForUserAvatars(array($contentOwner), true, true, true, false);
     $this->assign('avatar', $avatar[$contentOwner]);
 }
Exemplo n.º 23
0
 public function findPhotoIdListByUserIdList(array $idList)
 {
     if (empty($idList)) {
         return array();
     }
     $condition = PHOTO_BOL_PhotoService::getInstance()->getQueryCondition('searchByUsername', array('photo' => 'p', 'album' => 'a'));
     $sql = ' SELECT `p`.`id`
         FROM `' . $this->getTableName() . '` AS `p`
             INNER JOIN ' . PHOTO_BOL_PhotoAlbumDao::getInstance()->getTableName() . ' AS `a` ON(`p`.`albumId` = `a`.`id`)
         ' . $condition['join'] . '
         WHERE `a`.`userId` IN(' . $this->dbo->mergeInClause($idList) . ') AND ' . $condition['where'];
     return $this->dbo->queryForColumnList($sql, $condition['params']);
 }
Exemplo n.º 24
0
 public function updatePhotoStatus($photoId, $status)
 {
     if (!$this->isActive()) {
         return null;
     }
     $photo = PHOTO_BOL_PhotoService::getInstance()->findPhotoById($photoId);
     $photo->status = $status;
     PHOTO_BOL_PhotoDao::getInstance()->save($photo);
 }
Exemplo n.º 25
0
 public function moveTemporaryPhoto($tmpId, $albumId, $desc, $tag = NULL, $angle = 0, $uploadKey = null, $status = null)
 {
     $tmp = $this->photoTemporaryDao->findById($tmpId);
     $album = PHOTO_BOL_PhotoAlbumService::getInstance()->findAlbumById($albumId);
     if (!$tmp || !$album) {
         return FALSE;
     }
     $previewTmp = $this->photoTemporaryDao->getTemporaryPhotoPath($tmp->id, 1);
     $mainTmp = $this->photoTemporaryDao->getTemporaryPhotoPath($tmp->id, 2);
     $originalTmp = $this->photoTemporaryDao->getTemporaryPhotoPath($tmp->id, 3);
     $smallTmp = $this->photoTemporaryDao->getTemporaryPhotoPath($tmp->id, 4);
     $fullscreenTmp = $this->photoTemporaryDao->getTemporaryPhotoPath($tmp->id, 5);
     $privacy = OW::getEventManager()->call('plugin.privacy.get_privacy', array('ownerId' => $album->userId, 'action' => 'photo_view_album'));
     $photoService = PHOTO_BOL_PhotoService::getInstance();
     $photo = new PHOTO_BOL_Photo();
     $photo->description = htmlspecialchars(trim($desc));
     $photo->albumId = $albumId;
     $photo->addDatetime = time();
     $photo->status = empty($status) ? "approved" : $status;
     $photo->hasFullsize = (int) $tmp->hasFullsize;
     $photo->privacy = !empty($privacy) ? $privacy : 'everybody';
     $photo->hash = uniqid();
     $photo->uploadKey = empty($uploadKey) ? $photoService->getPhotoUploadKey($albumId) : $uploadKey;
     PHOTO_BOL_PhotoDao::getInstance()->save($photo);
     try {
         $storage = OW::getStorage();
         $dimension = array();
         if ((int) $angle !== 0) {
             $tmpImage = $tmp->hasFullsize ? (bool) OW::getConfig()->getValue('photo', 'store_fullsize') ? $originalTmp : $fullscreenTmp : $mainTmp;
             $smallImg = new UTIL_Image($tmpImage);
             $smallImg->resizeImage(PHOTO_BOL_PhotoService::DIM_SMALL_WIDTH, PHOTO_BOL_PhotoService::DIM_SMALL_HEIGHT, TRUE)->rotate($angle)->saveImage($smallTmp);
             $storage->copyFile($smallTmp, $photoService->getPhotoPath($photo->id, $photo->hash, PHOTO_BOL_PhotoService::TYPE_SMALL));
             $dimension[PHOTO_BOL_PhotoService::TYPE_SMALL] = array($smallImg->getWidth(), $smallImg->getHeight());
             $smallImg->destroy();
             $previewImage = new UTIL_Image($tmpImage);
             $previewImage->resizeImage(PHOTO_BOL_PhotoService::DIM_PREVIEW_WIDTH, PHOTO_BOL_PhotoService::DIM_PREVIEW_HEIGHT)->rotate($angle)->saveImage($previewTmp);
             $storage->copyFile($previewTmp, $photoService->getPhotoPath($photo->id, $photo->hash, PHOTO_BOL_PhotoService::TYPE_PREVIEW));
             $dimension[PHOTO_BOL_PhotoService::TYPE_PREVIEW] = array($previewImage->getWidth(), $previewImage->getHeight());
             $previewImage->destroy();
             $main = new UTIL_Image($tmpImage);
             $main->resizeImage(PHOTO_BOL_PhotoService::DIM_MAIN_WIDTH, PHOTO_BOL_PhotoService::DIM_MAIN_HEIGHT)->rotate($angle)->saveImage($mainTmp);
             $storage->copyFile($mainTmp, $photoService->getPhotoPath($photo->id, $photo->hash, PHOTO_BOL_PhotoService::TYPE_MAIN));
             $dimension[PHOTO_BOL_PhotoService::TYPE_MAIN] = array($main->getWidth(), $main->getHeight());
             $main->destroy();
             $originalImage = new UTIL_Image($tmpImage);
             $originalImage->resizeImage(PHOTO_BOL_PhotoService::DIM_ORIGINAL_WIDTH, PHOTO_BOL_PhotoService::DIM_ORIGINAL_HEIGHT)->rotate($angle)->saveImage($originalTmp);
             $storage->copyFile($originalTmp, $photoService->getPhotoPath($photo->id, $photo->hash, PHOTO_BOL_PhotoService::TYPE_ORIGINAL));
             $dimension[PHOTO_BOL_PhotoService::TYPE_ORIGINAL] = array($originalImage->getWidth(), $originalImage->getHeight());
             $originalImage->destroy();
             if ($tmp->hasFullsize && (bool) OW::getConfig()->getValue('photo', 'store_fullsize')) {
                 $fullscreen = new UTIL_Image($tmpImage);
                 $fullscreen->resizeImage(PHOTO_BOL_PhotoService::DIM_FULLSCREEN_WIDTH, PHOTO_BOL_PhotoService::DIM_FULLSCREEN_HEIGHT)->rotate($angle)->saveImage($fullscreenTmp);
                 $storage->copyFile($fullscreenTmp, $photoService->getPhotoPath($photo->id, $photo->hash, PHOTO_BOL_PhotoService::TYPE_FULLSCREEN));
                 $dimension[PHOTO_BOL_PhotoService::TYPE_FULLSCREEN] = array($fullscreen->getWidth(), $fullscreen->getHeight());
                 $fullscreen->destroy();
             }
         } else {
             $storage->copyFile($smallTmp, $photoService->getPhotoPath($photo->id, $photo->hash, PHOTO_BOL_PhotoService::TYPE_SMALL));
             list($width, $height) = getimagesize($smallTmp);
             $dimension[PHOTO_BOL_PhotoService::TYPE_SMALL] = array($width, $height);
             $storage->copyFile($previewTmp, $photoService->getPhotoPath($photo->id, $photo->hash, PHOTO_BOL_PhotoService::TYPE_PREVIEW));
             list($width, $height) = getimagesize($previewTmp);
             $dimension[PHOTO_BOL_PhotoService::TYPE_PREVIEW] = array($width, $height);
             $storage->copyFile($mainTmp, $photoService->getPhotoPath($photo->id, $photo->hash, PHOTO_BOL_PhotoService::TYPE_MAIN));
             list($width, $height) = getimagesize($mainTmp);
             $dimension[PHOTO_BOL_PhotoService::TYPE_MAIN] = array($width, $height);
             $storage->copyFile($originalTmp, $photoService->getPhotoPath($photo->id, $photo->hash, PHOTO_BOL_PhotoService::TYPE_ORIGINAL));
             list($width, $height) = getimagesize($originalTmp);
             $dimension[PHOTO_BOL_PhotoService::TYPE_ORIGINAL] = array($width, $height);
             if ($tmp->hasFullsize && (bool) OW::getConfig()->getValue('photo', 'store_fullsize')) {
                 $storage->copyFile($fullscreenTmp, $photoService->getPhotoPath($photo->id, $photo->hash, PHOTO_BOL_PhotoService::TYPE_FULLSCREEN));
                 list($width, $height) = getimagesize($fullscreenTmp);
                 $dimension[PHOTO_BOL_PhotoService::TYPE_FULLSCREEN] = array($width, $height);
             }
         }
         $photo->setDimension(json_encode($dimension));
         PHOTO_BOL_PhotoDao::getInstance()->save($photo);
         if (mb_strlen($desc)) {
             BOL_TagService::getInstance()->updateEntityTags($photo->id, 'photo', $photoService->descToHashtag($desc));
         }
         if (mb_strlen($tag)) {
             BOL_TagService::getInstance()->updateEntityTags($photo->id, 'photo', explode(',', $tag));
         }
         OW::getEventManager()->trigger(new OW_Event('photo.onMoveTemporaryPhoto', array('tmpId' => $tmpId, 'albumId' => $albumId, 'photoId' => $photo->id)));
     } catch (Exception $e) {
         $photo = NULL;
     }
     return $photo;
 }
Exemplo n.º 26
0
 public function isValid($photoId)
 {
     return !empty($photoId) && ($photo = PHOTO_BOL_PhotoService::getInstance()->findPhotoById($photoId)) !== NULL && ($album = PHOTO_BOL_PhotoAlbumService::getInstance()->findAlbumById($photo->albumId)) !== NULL && ($album->userId == OW::getUser()->getId() || OW::getUser()->isAuthorized('photo'));
 }
Exemplo n.º 27
0
 public function __construct()
 {
     parent::__construct('configSaveForm');
     $language = OW::getLanguage();
     $acceptedFilesizeField = new TextField('acceptedFilesize');
     $acceptedFilesizeField->setRequired(true);
     $sValidator = new FloatValidator(0.5, PHOTO_BOL_PhotoService::getInstance()->getMaxUploadFileSize());
     $sValidator->setErrorMessage($language->text('photo', 'file_size_validation_error'));
     $acceptedFilesizeField->addValidator($sValidator);
     $this->addElement($acceptedFilesizeField->setLabel($language->text('photo', 'accepted_filesize')));
     $albumQuotaField = new TextField('albumQuota');
     $albumQuotaField->setRequired(true);
     $aqValidator = new IntValidator(0, 1000);
     $albumQuotaField->addValidator($aqValidator);
     $this->addElement($albumQuotaField->setLabel($language->text('photo', 'album_quota')));
     $userQuotaField = new TextField('userQuota');
     $userQuotaField->setRequired(true);
     $uqValidator = new IntValidator(0, 10000);
     $userQuotaField->addValidator($uqValidator);
     $this->addElement($userQuotaField->setLabel($language->text('photo', 'user_quota')));
     $downloadAccept = new CheckboxField('downloadAccept');
     $downloadAccept->setLabel($language->text('photo', 'download_accept_label'));
     $downloadAccept->setValue(OW::getConfig()->getValue('photo', 'download_accept'));
     $this->addElement($downloadAccept);
     $storeFullsizeField = new CheckboxField('storeFullsize');
     $storeFullsizeField->setLabel($language->text('photo', 'store_full_size'));
     $storeFullsizeField->setValue((bool) OW::getConfig()->getValue('photo', 'store_fullsize'));
     $this->addElement($storeFullsizeField);
     $submit = new Submit('save');
     $submit->setValue($language->text('photo', 'btn_edit'));
     $this->addElement($submit);
 }
Exemplo n.º 28
0
    /**
     * Class constructor
     *
     * @param string $listType
     * @param int $count
     * @param string $tag
     */
    public function __construct(array $params)
    {
        parent::__construct();
        $listType = $params['type'];
        $count = isset($params['count']) ? $params['count'] : 5;
        $this->photoService = PHOTO_BOL_PhotoService::getInstance();
        $page = !empty($_GET['page']) && (int) $_GET['page'] ? abs((int) $_GET['page']) : 1;
        $config = OW::getConfig();
        $photosPerPage = $config->getValue('photo', 'photos_per_page');
        if (isset($params['tag']) && strlen($tag = $params['tag'])) {
            $photos = $this->photoService->findTaggedPhotos($tag, $page, $photosPerPage);
            $records = $this->photoService->countTaggedPhotos($tag);
        } else {
            $checkPrivacy = $listType == 'latest' && !OW::getUser()->isAuthorized('photo');
            $photos = $this->photoService->findPhotoList($listType, $page, $photosPerPage, $checkPrivacy);
            $records = $this->photoService->countPhotos($listType, $checkPrivacy);
        }
        if ($photos) {
            $userIds = array();
            foreach ($photos as $photo) {
                if (!in_array($photo['userId'], $userIds)) {
                    array_push($userIds, $photo['userId']);
                }
            }
            $names = BOL_UserService::getInstance()->getDisplayNamesForList($userIds);
            $this->assign('names', $names);
            $usernames = BOL_UserService::getInstance()->getUserNamesForList($userIds);
            $this->assign('usernames', $usernames);
            // Paging
            $pages = (int) ceil($records / $photosPerPage);
            $paging = new BASE_CMP_Paging($page, $pages, 10);
            $this->addComponent('paging', $paging);
            $this->assign('photos', $photos);
            $this->assign('no_content', false);
        } else {
            $this->assign('no_content', true);
        }
        $this->assign('listType', $listType);
        $this->assign('widthConfig', $config->getValue('photo', 'preview_image_width'));
        $this->assign('heightConfig', $config->getValue('photo', 'preview_image_height'));
        $this->assign('count', $count);
        OW::getDocument()->addScript(OW::getPluginManager()->getPlugin('base')->getStaticJsUrl() . 'jquery.bbq.min.js');
        OW::getDocument()->addScript(OW::getPluginManager()->getPlugin('photo')->getStaticJsUrl() . 'photo.js');
        OW::getLanguage()->addKeyForJs('photo', 'tb_edit_photo');
        OW::getLanguage()->addKeyForJs('photo', 'confirm_delete');
        OW::getLanguage()->addKeyForJs('photo', 'mark_featured');
        OW::getLanguage()->addKeyForJs('photo', 'remove_from_featured');
        $objParams = array('ajaxResponder' => OW::getRouter()->urlFor('PHOTO_CTRL_Photo', 'ajaxResponder'), 'fbResponder' => OW::getRouter()->urlForRoute('photo.floatbox'));
        $script = '$("div.ow_photo_list_item_thumb a").on("click", function(e){
            e.preventDefault();
            var photo_id = $(this).attr("rel");

            if ( !window.photoViewObj ) {
                window.photoViewObj = new photoView(' . json_encode($objParams) . ');
            }
            
            window.photoViewObj.setId(photo_id);
        });
        
        $(window).bind( "hashchange", function(e) {
            var photo_id = $.bbq.getState("view-photo");
            if ( photo_id != undefined )
            {
                if ( window.photoFBLoading ) { return; }
                window.photoViewObj.showPhotoCmp(photo_id);
            }
        });';
        OW::getDocument()->addOnloadScript($script);
    }
Exemplo n.º 29
0
$EmailVerifyService = BOL_EmailVerifyService::getInstance();
$BOL_AvatarService_inst = BOL_AvatarService::getInstance();
$SKAPI_BOL_Service_inst = SKAPI_BOL_Service::getInstance();
$PHOTO_BOL_PhotoService_inst = PHOTO_BOL_PhotoService::getInstance();
$PHOTO_BOL_PhotoAlbumService = PHOTO_BOL_PhotoAlbumService::getInstance();
$PHOTO_BOL_PhotoTemporaryService = PHOTO_BOL_PhotoTemporaryService::getInstance();
$UserResetPassword = BOL_UserResetPasswordDao::getInstance();
$QuestionService = BOL_QuestionService::getInstance();
$AccountTypeToGenderService = SKADATE_BOL_AccountTypeToGenderService::getInstance();
$BOL_AuthorizationService = BOL_AuthorizationService::getInstance();
$BOL_UserOnlineDao = BOL_UserOnlineDao::getInstance();
$USEARCH_BOL_Service = USEARCH_BOL_Service::getInstance();
$BOL_SearchService = BOL_SearchService::getInstance();
$getPluginManager = OW::getPluginManager();
$CONTACTUS_BOL_Service = CONTACTUS_BOL_Service::getInstance();
$PHOTO_BOL_PhotoService = PHOTO_BOL_PhotoService::getInstance();
$PHOTO_BOL_PhotoAlbumCoverDao = PHOTO_BOL_PhotoAlbumCoverDao::getInstance();
$PHOTO_BOL_PhotoDao = PHOTO_BOL_PhotoDao::getInstance();
$getRouter = OW::getRouter();
$language = OW::getLanguage();
$getMailer = OW::getMailer();
$getConfig = OW::getConfig();
$getFeedback = OW::getFeedback();
$getEventManager = OW::getEventManager();
$getMailer = OW::getMailer();
$ow = OW_DB_PREFIX;
$LanguageService = BOL_LanguageService::getInstance();
$OW_Language = OW_Language::getInstance();
$QUESTION_PRESENTATION_DATE = BOL_QuestionService::QUESTION_PRESENTATION_DATE;
$QUESTION_PRESENTATION_RANGE = BOL_QuestionService::QUESTION_PRESENTATION_RANGE;
$QUESTION_PRESENTATION_BIRTHDATE = BOL_QuestionService::QUESTION_PRESENTATION_BIRTHDATE;
Exemplo n.º 30
0
 private function getMenu()
 {
     $menuItems = array();
     $lang = OW::getLanguage();
     $item = new BASE_MenuItem();
     $item->setLabel($lang->text('photo', 'menu_latest'));
     $item->setUrl(OW::getRouter()->urlForRoute('view_photo_list', array('listType' => 'latest')));
     $item->setKey('latest');
     $item->setOrder(1);
     array_push($menuItems, $item);
     if (PHOTO_BOL_PhotoService::getInstance()->countPhotos('featured')) {
         $item = new BASE_MenuItem();
         $item->setLabel($lang->text('photo', 'menu_featured'));
         $item->setUrl(OW::getRouter()->urlForRoute('view_photo_list', array('listType' => 'featured')));
         $item->setKey('featured');
         $item->setOrder(2);
         array_push($menuItems, $item);
     }
     $item = new BASE_MenuItem();
     $item->setLabel($lang->text('photo', 'menu_toprated'));
     $item->setUrl(OW::getRouter()->urlForRoute('view_photo_list', array('listType' => 'toprated')));
     $item->setKey('toprated');
     $item->setOrder(3);
     array_push($menuItems, $item);
     return new BASE_MCMP_ContentMenu($menuItems);
 }