Ejemplo n.º 1
0
 public function triggerNewsfeedEventOnMultiplePhotosAdd(PHOTO_BOL_PhotoAlbum $album, array $photos, $isAdd = TRUE)
 {
     $lastPhoto = $this->photoDao->getLastPhoto($album->id);
     $photoIdList = array();
     if ($isAdd && $lastPhoto && time() - $lastPhoto->addDatetime < 60 * 15 && $lastPhoto->uploadKey) {
         $this->feedDeleteItem('photo_comments', $lastPhoto->id);
         $this->feedDeleteItem('multiple_photo_upload', $lastPhoto->uploadKey);
         $photoIdList = $this->photoDao->findPhotoIdListByAlbumId($album->id);
         sort($photoIdList, SORT_NUMERIC);
         $albumUrl = OW::getRouter()->urlForRoute('photo_user_album', array('user' => BOL_UserService::getInstance()->getUserName($album->userId), 'album' => $album->id));
         $event = new OW_Event('feed.action', array('pluginKey' => 'photo', 'entityType' => 'multiple_photo_upload', 'entityId' => $lastPhoto->uploadKey, 'userId' => $album->userId), array('photoIdList' => array_reverse($photoIdList), 'string' => array('key' => 'photo+feed_multiple_descriptions', 'vars' => array('number' => count($photoIdList), 'albumUrl' => $albumUrl, 'albumName' => $album->name)), 'features' => array('likes'), 'content' => '', 'view' => array('iconClass' => 'ow_ic_picture')));
         OW::getEventManager()->trigger($event);
     } else {
         $this->feedDeleteItem('photo_comments', $lastPhoto->id);
         $this->feedDeleteItem('multiple_photo_upload', $lastPhoto->uploadKey);
         $albumUrl = OW::getRouter()->urlForRoute('photo_user_album', array('user' => BOL_UserService::getInstance()->getUserName($album->userId), 'album' => $album->id));
         foreach ($photos as $photo) {
             $photoIdList[] = $photo->id;
         }
         sort($photoIdList, SORT_NUMERIC);
         $event = new OW_Event('feed.action', array('pluginKey' => 'photo', 'entityType' => 'multiple_photo_upload', 'entityId' => $photos[0]->uploadKey, 'userId' => $album->userId, 'time' => $photos[0]->addDatetime), array('photoIdList' => array_reverse($photoIdList), 'string' => array('key' => 'photo+feed_multiple_descriptions', 'vars' => array('number' => count($photos), 'albumUrl' => $albumUrl, 'albumName' => $album->name)), 'features' => array('likes'), 'content' => '', 'view' => array('iconClass' => 'ow_ic_picture')));
         OW::getEventManager()->trigger($event);
     }
     return TRUE;
 }