Beispiel #1
0
 public function onBeforePhotoDelete(OW_Event $event)
 {
     $params = $event->getParams();
     $photoId = $params['id'];
     if ($photoId) {
         $photo = $this->photoService->findPhotoById($photoId);
         $album = $this->albumService->findAlbumById($photo->albumId);
         if ($photo->uploadKey) {
             $remainingList = $this->photoService->getPhotoListByUploadKey($photo->uploadKey, array($photo->id));
             $this->photoService->triggerNewsfeedEventOnMultiplePhotosAdd($remainingList, $album->userId, $album);
         }
     }
 }
Beispiel #2
0
 public function onBeforePhotoDelete(OW_Event $event)
 {
     $params = $event->getParams();
     if (empty($params['id']) || ($photo = $this->photoService->findPhotoById($params['id'])) === NULL || ($album = $this->albumService->findAlbumById($photo->albumId)) == NULL) {
         return;
     }
     if ($this->albumService->isNewsfeedAlbum($album)) {
         $this->photoService->feedDeleteItem('photo_comments', $photo->id);
         return;
     }
     if ($photo->uploadKey) {
         $this->photoService->feedDeleteItem('photo_comments', $photo->id);
         $this->photoService->feedDeleteItem('multiple_photo_upload', $photo->uploadKey);
         $photos = $this->photoService->getPhotoListByUploadKey($photo->uploadKey, array($photo->id));
         if (empty($photos)) {
             return;
         }
         if (count($photos) === 1) {
             $this->photoService->triggerNewsfeedEventOnSinglePhotoAdd($album, $photos[0], FALSE);
         } else {
             $this->photoService->triggerNewsfeedEventOnMultiplePhotosAdd($album, $photos, FALSE);
         }
     }
 }