本文整理汇总了PHP中PHOTO_BOL_PhotoService::feedDeleteItem方法的典型用法代码示例。如果您正苦于以下问题:PHP PHOTO_BOL_PhotoService::feedDeleteItem方法的具体用法?PHP PHOTO_BOL_PhotoService::feedDeleteItem怎么用?PHP PHOTO_BOL_PhotoService::feedDeleteItem使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PHOTO_BOL_PhotoService
的用法示例。
在下文中一共展示了PHOTO_BOL_PhotoService::feedDeleteItem方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: onBeforePhotoMove
public function onBeforePhotoMove(OW_Event $event)
{
$params = $event->getParams();
if (empty($params['fromAlbum']) || empty($params['photoIdList'])) {
return;
}
$fromAlbum = $this->albumService->findAlbumById($params['fromAlbum']);
$fromAlbumLastPhoto = PHOTO_BOL_PhotoDao::getInstance()->getLastPhoto($params['fromAlbum']);
$toAlbum = $this->albumService->findAlbumById($params['toAlbum']);
$toAlbumLastPhoto = PHOTO_BOL_PhotoDao::getInstance()->getLastPhoto($params['toAlbum']);
if ($fromAlbumLastPhoto) {
$this->photoService->feedDeleteItem('photo_comments', $fromAlbumLastPhoto->id);
$this->photoService->feedDeleteItem('multiple_photo_upload', $fromAlbumLastPhoto->uploadKey);
}
if ($toAlbumLastPhoto) {
$this->photoService->feedDeleteItem('photo_comments', $toAlbumLastPhoto->id);
$this->photoService->feedDeleteItem('multiple_photo_upload', $toAlbumLastPhoto->uploadKey);
}
if (empty($params['toAlbum'])) {
$photoIdList = PHOTO_BOL_PhotoDao::getInstance()->findPhotoIdListByAlbumId($fromAlbum->id);
$count = count($photoIdList);
$user = BOL_UserService::getInstance()->findUserById($fromAlbum->userId);
$albumUrl = OW::getRouter()->urlForRoute('photo.user_photos', array('user' => $user->username));
$event = new OW_Event('feed.action', array('pluginKey' => 'photo', 'entityType' => $count === 1 ? 'photo_comments' : 'multiple_photo_upload', 'entityId' => $fromAlbumLastPhoto->uploadKey, 'userId' => $user->id), array('photoIdList' => $photoIdList, 'string' => array('key' => 'photo+feed_move_photo_descriptions', 'vars' => array('number' => $count, 'albumUrl' => $albumUrl)), 'features' => array('likes'), 'content' => '', 'view' => array('iconClass' => 'ow_ic_picture')));
OW::getEventManager()->trigger($event);
} else {
$fromPhotoIdList = PHOTO_BOL_PhotoDao::getInstance()->findPhotoIdListByAlbumId($fromAlbum->id, $params['photoIdList']);
if (empty($fromPhotoIdList)) {
$photo = $this->photoService->findPhotoById($params['photoIdList'][0]);
$this->photoService->feedDeleteItem('photo_comments', $photo->id);
$this->photoService->feedDeleteItem('photo_comments', $photo->uploadKey);
$this->photoService->feedDeleteItem('multiple_photo_upload', $photo->uploadKey);
} else {
$fromCount = count($fromPhotoIdList);
$fromEntityType = $fromCount === 1 ? 'photo_comments' : 'multiple_photo_upload';
$fromAlbumUrl = OW::getRouter()->urlForRoute('photo_user_album', array('user' => BOL_UserService::getInstance()->getUserName($fromAlbum->userId), 'album' => $fromAlbum->id));
$event = new OW_Event('feed.action', array('pluginKey' => 'photo', 'entityType' => $fromEntityType, 'entityId' => $fromAlbumLastPhoto->uploadKey, 'userId' => $fromAlbum->userId), array('photoIdList' => $fromPhotoIdList, 'string' => array('key' => 'photo+feed_multiple_descriptions', 'vars' => array('number' => $fromCount, 'albumUrl' => $fromAlbumUrl, 'albumName' => $fromAlbum->name)), 'features' => array('likes'), 'content' => '', 'view' => array('iconClass' => 'ow_ic_picture')));
OW::getEventManager()->trigger($event);
}
if ($toAlbumLastPhoto) {
$toPhotoIdList = array_merge(PHOTO_BOL_PhotoDao::getInstance()->findPhotoIdListByAlbumId($toAlbum->id), $params['photoIdList']);
$toAlbumUrl = OW::getRouter()->urlForRoute('photo_user_album', array('user' => BOL_UserService::getInstance()->getUserName($toAlbum->userId), 'album' => $toAlbum->id));
$event = new OW_Event('feed.action', array('pluginKey' => 'photo', 'entityType' => 'multiple_photo_upload', 'entityId' => $toAlbumLastPhoto->uploadKey, 'userId' => $toAlbum->userId), array('photoIdList' => $toPhotoIdList, 'string' => array('key' => 'photo+feed_multiple_descriptions', 'vars' => array('number' => count($toPhotoIdList), 'albumUrl' => $toAlbumUrl, 'albumName' => $toAlbum->name)), 'features' => array('likes'), 'content' => '', 'view' => array('iconClass' => 'ow_ic_picture')));
OW::getEventManager()->trigger($event);
}
}
}