apps/dav/lib/CalDAV/Activity/Backend.php
/**
	 * Creates activities when a calendar object was created/updated/deleted
	 *
	 * @param string $action
	 * @param array $calendarData
	 * @param array $shares
	 * @param array $objectData
	 */
Creates activities when a calendar object was created/updated/deleted
@param string $action
@param array $calendarData
@param array $shares
@param array $objectData
Creates activities when a calendar object was created / updated / deleted @param string $action @param array $calendarData @param array $shares @param array $objectData
public function onTouchCalendarObject($action, array $calendarData, array $shares, array $objectData) {
		if (!isset($calendarData['principaluri'])) {
			return;
		}
		$principal = explode('/', $calendarData['principaluri']);
		$owner = array_pop($principal);
		$currentUser = $this->userSession->getUser();
		if ($currentUser instanceof IUser) {
			$currentUser = $currentUser->getUID();
		} else {
			$currentUser = $owner;
		}
		$object = $this->getObjectNameAndType($objectData);
		$action = $action . '_' . $object['type'];
		if ($object['type'] === 'todo' && strpos($action, Event::SUBJECT_OBJECT_UPDATE) === 0 && $object['status'] === 'COMPLETED') {
			$action .= '_completed';
		} else if ($object['type'] === 'todo' && strpos($action, Event::SUBJECT_OBJECT_UPDATE) === 0 && $object['status'] === 'NEEDS-ACTION') {
			$action .= '_needs_action';
		}
		$event = $this->activityManager->generateEvent();
		$event->setApp('dav')
			->setObject('calendar', (int) $calendarData['id'])
			->setType($object['type'] === 'event' ? 'calendar_event' : 'calendar_todo')
			->setAuthor($currentUser);
		$users = $this->getUsersForShares($shares);
		$users[] = $owner;
		foreach ($users as $user) {
			$event->setAffectedUser($user)
				->setSubject(
					$user === $currentUser ? $action . '_self' : $action,
					[
						$currentUser,
						$calendarData['{DAV:}displayname'],
						[
							'id' => $object['id'],
							'name' => $object['name'],
						],
					]
				);
			$this->activityManager->publish($event);
		}
	}
public function onTouchCalendarObject ( $ action , array $ calendarData , array $ shares , array $ objectData ) { if ( ! isset ( $ calendarData [ 'principaluri' ] ) ) { return ; } $ principal = explode ( '/' , $ calendarData [ 'principaluri' ] ) ; $ owner = array_pop ( $ principal ) ; $ currentUser = $ this -> userSession -> getUser ( ) ; if ( $ currentUser instanceof IUser ) { $ currentUser = $ currentUser -> getUID ( ) ; } else { $ currentUser = $ owner ; } $ object = $ this -> getObjectNameAndType ( $ objectData ) ; $ action = $ action . '_' . $ object [ 'type' ] ; if ( $ object [ 'type' ] === 'todo' && strpos ( $ action , Event :: SUBJECT_OBJECT_UPDATE ) === 0 && $ object [ 'status' ] === 'COMPLETED' ) { $ action .= '_completed' ; } else if ( $ object [ 'type' ] === 'todo' && strpos ( $ action , Event :: SUBJECT_OBJECT_UPDATE ) === 0 && $ object [ 'status' ] === 'NEEDS-ACTION' ) { $ action .= '_needs_action' ; } $ event = $ this -> activityManager -> generateEvent ( ) ; $ event -> setApp ( 'dav' ) -> setObject ( 'calendar' , ( int ) $ calendarData [ 'id' ] ) -> setType ( $ object [ 'type' ] === 'event' ? 'calendar_event' : 'calendar_todo' ) -> setAuthor ( $ currentUser ) ; $ users = $ this -> getUsersForShares ( $ shares ) ; $ users [ ] = $ owner ; foreach ( $ users as $ user ) { $ event -> setAffectedUser ( $ user ) -> setSubject ( $ user === $ currentUser ? $ action . '_self' : $ action , [ $ currentUser , $ calendarData [ '{DAV:}displayname' ] , [ 'id' => $ object [ 'id' ] , 'name' => $ object [ 'name' ] , ] , ] ) ; $ this -> activityManager -> publish ( $ event ) ; } }
Creates activities when a calendar object was created/updated/deleted
 @param string $action
 @param array $calendarData
 @param array $shares
 @param array $objectData
Creates activities when a calendar object was created / updated / deleted @param string $action @param array $calendarData @param array $shares @param array $objectData