本文整理汇总了PHP中PHOTO_BOL_PhotoService::triggerNewsfeedEventOnSinglePhotoAdd方法的典型用法代码示例。如果您正苦于以下问题:PHP PHOTO_BOL_PhotoService::triggerNewsfeedEventOnSinglePhotoAdd方法的具体用法?PHP PHOTO_BOL_PhotoService::triggerNewsfeedEventOnSinglePhotoAdd怎么用?PHP PHOTO_BOL_PhotoService::triggerNewsfeedEventOnSinglePhotoAdd使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PHOTO_BOL_PhotoService
的用法示例。
在下文中一共展示了PHOTO_BOL_PhotoService::triggerNewsfeedEventOnSinglePhotoAdd方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: onSubmitComplete
protected function onSubmitComplete($entityType, $entityId, PHOTO_BOL_PhotoAlbum $album, $photos)
{
$result = array();
if (empty($photos)) {
OW::getFeedback()->warning(OW::getLanguage()->text('photo', 'no_photo_uploaded'));
$result["url"] = OW::getRouter()->urlFor(get_class($this), "uploadReset", array("entityType" => $entityType, "entityId" => $entityId));
return $result;
}
$movedArray = array();
foreach ($photos as $photo) {
$movedArray[] = array('entityType' => $entityType, 'entityId' => $entityId, 'addTimestamp' => $photo->addDatetime, 'photoId' => $photo->id, 'hash' => $photo->hash);
}
$event = new OW_Event(PHOTO_CLASS_EventHandler::EVENT_ON_PHOTO_ADD, $movedArray);
OW::getEventManager()->trigger($event);
$userId = OW::getUser()->getId();
$result["url"] = OW::getRouter()->urlForRoute('photo_user_album', array('user' => BOL_UserService::getInstance()->getUserName($userId), 'album' => $album->id));
$photoCount = count($photos);
if ($photoCount == 1) {
$this->photoService->triggerNewsfeedEventOnSinglePhotoAdd($photos[0]->id, $userId);
} else {
$this->photoService->triggerNewsfeedEventOnMultiplePhotosAdd($photos, $userId, $album);
}
OW::getFeedback()->info(OW::getLanguage()->text('photo', 'photos_uploaded', array('count' => $photoCount)));
return $result;
}
示例2: onBeforeMultiplePhotoDelete
public function onBeforeMultiplePhotoDelete(OW_Event $event)
{
$params = $event->getParams();
if (empty($params['albumId']) || empty($params['photoIdList']) || ($album = $this->albumService->findAlbumById($params['albumId'])) === NULL) {
return;
}
if ($this->albumService->isNewsfeedAlbum($album)) {
foreach ($params['photoIdList'] as $photoId) {
$this->photoService->feedDeleteItem('photo_comments', $photoId);
}
return;
}
$photo = $this->photoService->findPhotoById($params['photoIdList'][0]);
$this->photoService->feedDeleteItem('photo_comments', $photo->id);
$this->photoService->feedDeleteItem('multiple_photo_upload', $photo->uploadKey);
$photos = PHOTO_BOL_PhotoDao::getInstance()->getAlbumAllPhotos($album->id, $params['photoIdList']);
if (empty($photos)) {
return;
}
if (count($photos) === 1) {
$this->photoService->triggerNewsfeedEventOnSinglePhotoAdd($album, $photos[0], FALSE);
} else {
$this->photoService->triggerNewsfeedEventOnMultiplePhotosAdd($album, $photos, FALSE);
}
}