本文整理汇总了PHP中PHOTO_BOL_PhotoService::getPreviousPhoto方法的典型用法代码示例。如果您正苦于以下问题:PHP PHOTO_BOL_PhotoService::getPreviousPhoto方法的具体用法?PHP PHOTO_BOL_PhotoService::getPreviousPhoto怎么用?PHP PHOTO_BOL_PhotoService::getPreviousPhoto使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PHOTO_BOL_PhotoService
的用法示例。
在下文中一共展示了PHOTO_BOL_PhotoService::getPreviousPhoto方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: __construct
//.........这里部分代码省略.........
$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]);
}