当前位置: 首页>>代码示例>>PHP>>正文


PHP PHOTO_BOL_PhotoAlbumService类代码示例

本文整理汇总了PHP中PHOTO_BOL_PhotoAlbumService的典型用法代码示例。如果您正苦于以下问题:PHP PHOTO_BOL_PhotoAlbumService类的具体用法?PHP PHOTO_BOL_PhotoAlbumService怎么用?PHP PHOTO_BOL_PhotoAlbumService使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了PHOTO_BOL_PhotoAlbumService类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: __construct

 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);
     }
 }
开发者ID:vazahat,项目名称:dudex,代码行数:25,代码来源:photo_list.php

示例2: getInstance

 /**
  * Returns class instance
  *
  * @return PHOTO_BOL_PhotoAlbumService
  */
 public static function getInstance()
 {
     if (null === self::$classInstance) {
         self::$classInstance = new self();
     }
     return self::$classInstance;
 }
开发者ID:tammyrocks,项目名称:photo,代码行数:12,代码来源:photo_album_service.php

示例3: __construct

 public function __construct($albumId)
 {
     parent::__construct('albumEditForm');
     $album = PHOTO_BOL_PhotoAlbumService::getInstance()->findAlbumById($albumId);
     $this->setAction(OW::getRouter()->urlForRoute('photo.ajax_update_photo'));
     $this->setAjax(TRUE);
     $this->setAjaxResetOnSuccess(FALSE);
     $albumIdField = new HiddenField('album-id');
     $albumIdField->setValue($album->id);
     $albumIdField->setRequired();
     $albumIdField->addValidator(new PHOTO_CLASS_AlbumOwnerValidator());
     $this->addElement($albumIdField);
     $albumNameField = new TextField('albumName');
     $albumNameField->setValue($album->name);
     $albumNameField->setRequired();
     if ($album->name != trim(OW::getLanguage()->text('photo', 'newsfeed_album'))) {
         $albumNameField->addValidator(new PHOTO_CLASS_AlbumNameValidator(TRUE, NULL, $album->name));
     }
     $albumNameField->addAttribute('class', 'ow_photo_album_name_input');
     $this->addElement($albumNameField);
     $desc = new Textarea('desc');
     $desc->setValue(!empty($album->description) ? $album->description : NULL);
     $desc->setHasInvitation(TRUE);
     $desc->setInvitation(OW::getLanguage()->text('photo', 'describe_photo'));
     $desc->addAttribute('class', 'ow_photo_album_description_textarea');
     $this->addElement($desc);
 }
开发者ID:hardikamutech,项目名称:loov,代码行数:27,代码来源:album_edit_form.php

示例4: albumsDeleteProcess

 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);
     }
 }
开发者ID:tammyrocks,项目名称:photo,代码行数:25,代码来源:cron.php

示例5: __construct

 public function __construct($albumId)
 {
     parent::__construct(self::FORM_NAME);
     $album = PHOTO_BOL_PhotoAlbumService::getInstance()->findAlbumById($albumId);
     $this->setAction(OW::getRouter()->urlForRoute('photo.ajax_update_photo'));
     $this->setAjax(true);
     $this->setAjaxResetOnSuccess(false);
     $albumIdField = new HiddenField(self::ELEMENT_ALBUM_ID);
     $albumIdField->setValue($album->id);
     $albumIdField->setRequired();
     $albumIdField->addValidator(new PHOTO_CLASS_AlbumOwnerValidator());
     $this->addElement($albumIdField);
     $albumNameField = new TextField(self::ELEMENT_ALBUM_NAME);
     $albumNameField->setValue($album->name);
     $albumNameField->setRequired();
     if ($album->name != trim(OW::getLanguage()->text('photo', 'newsfeed_album'))) {
         $albumNameField->addValidator(new PHOTO_CLASS_AlbumNameValidator(true, null, $album->name));
     }
     $albumNameField->addAttribute('class', 'ow_photo_album_name_input');
     $this->addElement($albumNameField);
     $desc = new Textarea(self::ELEMENT_DESC);
     $desc->setValue(!empty($album->description) ? $album->description : NULL);
     $desc->setHasInvitation(TRUE);
     $desc->setInvitation(OW::getLanguage()->text('photo', 'describe_photo'));
     $desc->addAttribute('class', 'ow_photo_album_description_textarea');
     $this->addElement($desc);
     $this->triggerReady(array('albumId' => $albumId));
 }
开发者ID:tammyrocks,项目名称:photo,代码行数:28,代码来源:album_edit_form.php

示例6: process

 public function process()
 {
     $values = $this->getValues();
     $photoIdList = array_unique(array_map('intval', explode(',', $values['photos'])));
     sort($photoIdList);
     OW::getEventManager()->trigger(new OW_Event(PHOTO_CLASS_EventHandler::EVENT_BEFORE_PHOTO_MOVE, array('fromAlbum' => $values['from-album'], 'toAlbum' => $values['to-album'], 'photoIdList' => $photoIdList)));
     $albumService = PHOTO_BOL_PhotoAlbumService::getInstance();
     $photoService = PHOTO_BOL_PhotoService::getInstance();
     $fromAlbum = $albumService->findAlbumById($values['from-album']);
     $userDto = BOL_UserService::getInstance()->findUserById($fromAlbum->userId);
     $albumName = htmlspecialchars(trim($values['album-name']));
     $isNewAlbum = FALSE;
     if (($toAlbum = $albumService->findAlbumByName($albumName, $userDto->id)) === NULL) {
         $toAlbum = new PHOTO_BOL_PhotoAlbum();
         $toAlbum->name = $albumName;
         $toAlbum->description = htmlspecialchars(trim($values['desc']));
         $toAlbum->userId = $userDto->id;
         $toAlbum->entityId = $userDto->id;
         $toAlbum->entityType = 'user';
         $toAlbum->createDatetime = time();
         $albumService->addAlbum($toAlbum);
         $this->getElement('to-album')->setValue($toAlbum->id);
         $isNewAlbum = TRUE;
     }
     if ($photoService->movePhotosToAlbum($photoIdList, $toAlbum->id, $isNewAlbum)) {
         $values = $this->getValues();
         OW::getEventManager()->trigger(new OW_Event(PHOTO_CLASS_EventHandler::EVENT_AFTER_PHOTO_MOVE, array('fromAlbum' => $values['from-album'], 'toAlbum' => $values['to-album'], 'photoIdList' => $photoIdList)));
     }
     return TRUE;
 }
开发者ID:tammyrocks,项目名称:photo,代码行数:30,代码来源:album_add_form.php

示例7: onAddProfileContentMenu

 public function onAddProfileContentMenu(BASE_CLASS_EventCollector $event)
 {
     $params = $event->getParams();
     if (empty($params['userId'])) {
         return;
     }
     $userId = (int) $params['userId'];
     $lang = OW::getLanguage();
     $linkId = uniqid('photo');
     $albumService = PHOTO_BOL_PhotoAlbumService::getInstance();
     $exclude = array();
     $newsfeedAlbum = $albumService->getNewsfeedAlbum($userId);
     if ($newsfeedAlbum !== null) {
         $exclude[] = $newsfeedAlbum->id;
     }
     if (!$albumService->countUserAlbums($userId, $exclude)) {
         return;
     }
     $albumList = $albumService->findUserAlbumList($userId, 1, 1, $exclude);
     $cover = !empty($albumList[0]['cover']) ? $albumList[0]['cover'] : null;
     $username = BOL_UserService::getInstance()->getUserName($userId);
     $url = OW::getRouter()->urlForRoute('photo_user_albums', array('user' => $username));
     $resultArray = array(BASE_MCMP_ProfileContentMenu::DATA_KEY_LABEL => $lang->text('photo', 'user_photo_albums_widget'), BASE_MCMP_ProfileContentMenu::DATA_KEY_LINK_HREF => $url, BASE_MCMP_ProfileContentMenu::DATA_KEY_LINK_ID => $linkId, BASE_MCMP_ProfileContentMenu::DATA_KEY_LINK_CLASS => 'owm_profile_nav_photo', BASE_MCMP_ProfileContentMenu::DATA_KEY_THUMB => $cover);
     $event->add($resultArray);
 }
开发者ID:tammyrocks,项目名称:photo,代码行数:25,代码来源:event_handler.php

示例8: __construct

 public function __construct($userId, $limit, $exclude)
 {
     parent::__construct();
     $this->photoAlbumService = PHOTO_BOL_PhotoAlbumService::getInstance();
     $user = BOL_UserService::getInstance()->findUserById($userId);
     $this->assign('username', $user->getUsername());
     $albums = $this->photoAlbumService->findUserAlbumList($user->id, 1, $limit, $exclude, true);
     $this->assign('albums', $albums);
     foreach ($albums as $album) {
         array_push($exclude, $album['dto']->id);
     }
     $loadMore = $this->photoAlbumService->countUserAlbums($userId, $exclude);
     if (!$loadMore) {
         $script = "OWM.trigger('photo.hide_load_more', {});";
         OW::getDocument()->addOnloadScript($script);
     }
 }
开发者ID:tammyrocks,项目名称:photo,代码行数:17,代码来源:album_list.php

示例9: __construct

 /**
  * @param int $userId
  */
 public function __construct($userId, $exclude)
 {
     parent::__construct();
     if (empty($userId)) {
         $this->setVisible(false);
         return;
     }
     $this->assign('albumNameList', PHOTO_BOL_PhotoAlbumService::getInstance()->findAlbumNameListByUserId($userId, $exclude));
 }
开发者ID:tammyrocks,项目名称:photo,代码行数:12,代码来源:album_name_list.php

示例10: __construct

 public function __construct($albumId, $photoId = NULL, $userId = NULL)
 {
     parent::__construct();
     if (empty($userId)) {
         $userId = OW::getUser()->getId();
     }
     if (empty($userId) || ($album = PHOTO_BOL_PhotoAlbumService::getInstance()->findAlbumById($albumId)) === null || ($album->userId != $userId || !OW::getUser()->isAuthorized('photo', 'view'))) {
         $this->setVisible(FALSE);
         return;
     }
     if ($photoId === NULL && !PHOTO_BOL_PhotoAlbumCoverDao::getInstance()->isAlbumCoverExist($albumId)) {
         $this->setVisible(FALSE);
         return;
     }
     $storage = OW::getStorage();
     if (empty($photoId)) {
         if ($storage instanceof BASE_CLASS_FileStorage) {
             $photoPath = PHOTO_BOL_PhotoAlbumCoverDao::getInstance()->getAlbumCoverPathByAlbumId($albumId);
         } else {
             $photoPath = PHOTO_BOL_PhotoAlbumCoverDao::getInstance()->getAlbumCoverUrlByAlbumId($albumId, true);
         }
         $info = getimagesize($photoPath);
         if ($info['0'] < 330 || $info['1'] < 330) {
             $this->assign('imgError', OW::getLanguage()->text('photo', 'to_small_cover_img'));
             return;
         }
         $this->assign('coverUrl', PHOTO_BOL_PhotoAlbumCoverDao::getInstance()->getAlbumCoverUrlByAlbumId($albumId, TRUE));
     } else {
         $photo = PHOTO_BOL_PhotoDao::getInstance()->findById($photoId);
         $this->assign('coverUrl', PHOTO_BOL_PhotoDao::getInstance()->getPhotoUrl($photo->id, $photo->hash, FALSE));
         if (!empty($photo->dimension)) {
             $info = json_decode($photo->dimension, true);
             if ($info[PHOTO_BOL_PhotoService::TYPE_ORIGINAL]['0'] < 330 || $info[PHOTO_BOL_PhotoService::TYPE_ORIGINAL]['1'] < 330) {
                 $this->assign('imgError', OW::getLanguage()->text('photo', 'to_small_cover_img'));
                 return;
             }
         } else {
             if ($storage instanceof BASE_CLASS_FileStorage) {
                 $photoPath = PHOTO_BOL_PhotoDao::getInstance()->getPhotoPath($photo->id, $photo->hash, PHOTO_BOL_PhotoService::TYPE_ORIGINAL);
             } else {
                 $photoPath = PHOTO_BOL_PhotoDao::getInstance()->getPhotoUrl($photo->id, $photo->hash, FALSE);
             }
             $info = getimagesize($photoPath);
             if ($info['0'] < 330 || $info['1'] < 330) {
                 $this->assign('imgError', OW::getLanguage()->text('photo', 'to_small_cover_img'));
                 return;
             }
         }
     }
     OW::getDocument()->addStyleSheet(OW::getPluginManager()->getPlugin('base')->getStaticCssUrl() . 'jquery.Jcrop.css');
     OW::getDocument()->addScript(OW::getPluginManager()->getPlugin('base')->getStaticJsUrl() . 'jquery.Jcrop.js');
     $form = new PHOTO_CLASS_MakeAlbumCover();
     $form->getElement('albumId')->setValue($albumId);
     $form->getElement('photoId')->setValue($photoId);
     $this->addForm($form);
 }
开发者ID:tammyrocks,项目名称:photo,代码行数:56,代码来源:make_album_cover.php

示例11: isValid

 public function isValid($albumName)
 {
     if (strcasecmp(trim($this->albumName), OW::getLanguage()->text('photo', 'newsfeed_album')) === 0) {
         return TRUE;
     }
     if (strcasecmp(trim($albumName), OW::getLanguage()->text('photo', 'newsfeed_album')) === 0) {
         return FALSE;
     } elseif ($this->checkDuplicate && strcasecmp($albumName, $this->albumName) !== 0 && PHOTO_BOL_PhotoAlbumService::getInstance()->findAlbumByName($albumName, $this->userId) !== NULL) {
         $this->setErrorMessage(OW::getLanguage()->text('photo', 'album_name_error'));
         return FALSE;
     }
     return TRUE;
 }
开发者ID:tammyrocks,项目名称:photo,代码行数:13,代码来源:album_name_validator.php

示例12: getAlbum

 private function getAlbum($userId)
 {
     $albumService = PHOTO_BOL_PhotoAlbumService::getInstance();
     $albumName = $this->getAlbumName();
     $album = $albumService->findAlbumByName($albumName, $userId);
     if (empty($album)) {
         $album = new PHOTO_BOL_PhotoAlbum();
         $album->name = $albumName;
         $album->userId = $userId;
         $album->createDatetime = time();
         $albumService->addAlbum($album);
     }
     return $album;
 }
开发者ID:vazahat,项目名称:dudex,代码行数:14,代码来源:photo_bridge.php

示例13: __construct

 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');
 }
开发者ID:hardikamutech,项目名称:loov,代码行数:50,代码来源:ajax_upload.php

示例14: __construct

 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);
 }
开发者ID:tammyrocks,项目名称:photo,代码行数:45,代码来源:edit_form.php

示例15: __construct

 /**
  * 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);
 }
开发者ID:vazahat,项目名称:dudex,代码行数:47,代码来源:edit_form.php


注:本文中的PHOTO_BOL_PhotoAlbumService类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。