예제 #1
0
 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);
     }
 }