Exemplo n.º 1
0
 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;
 }
Exemplo n.º 2
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);
     }
 }