function getMeetingInformationMarker(&$page, &$sims, &$rems, $view) { $sims['###MEETING_INFORMATION###'] = ''; $foundEvents = array(); $eventService =& \TYPO3\CMS\Cal\Utility\Functions::getEventService(); $eventDateArray = $eventService->findMeetingEventsWithEmptyStatus($this->conf['pidList']); if (!empty($eventDateArray)) { $foundEvents[] = 'These meetings require your action:'; } if (is_array($eventDateArray)) { foreach ($eventDateArray as $eventTimeArray) { foreach ($eventTimeArray as $eventArray) { foreach ($eventArray as $event) { $foundEvents[] = $event->getLinkToEvent($event->getTitle(), $this->conf['view'], $this->conf['getdate']); } } } } $sims['###MEETING_INFORMATION###'] = implode('<br/>', $foundEvents); }
function updateAttendees($eventUid) { $select = 'tx_cal_event.*'; $table = 'tx_cal_event'; $where = 'uid=' . $eventUid; $eventRow = array(); $result = $GLOBALS['TYPO3_DB']->exec_SELECTquery($select, $table, $where, $groupBy); if ($result) { while ($row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($result)) { $eventRow = $row; break; } $GLOBALS['TYPO3_DB']->sql_free_result($result); } $eventObject = $this->createEvent($eventRow, false); $modelObj =& tx_cal_registry::Registry('basic', 'modelcontroller'); $attendeeRecordsArray = $modelObj->findEventAttendees($eventObject->getUid()); if (!empty($attendeeRecordsArray['tx_cal_attendee'])) { $attendeeRecords = $attendeeRecordsArray['tx_cal_attendee']; // update related event record in attendee calendar $updatedCalendar = array(0); // attendees have changed, we need to go through every one of them :( foreach ($attendeeRecords as $attendee) { // Check if attendee is a fe-user and has a private calendar defined $select = 'tx_cal_calendar.uid, tx_cal_calendar.pid, tx_cal_event.uid AS event_id'; $table = 'fe_users, tx_cal_calendar, tx_cal_event'; $where = 'fe_users.uid = ' . $attendee->getFeUserId() . ' AND tx_cal_calendar.uid NOT IN (' . $eventObject->getCalendarUid() . ') AND fe_users.tx_cal_calendar=tx_cal_calendar.uid AND tx_cal_calendar.uid = tx_cal_event.calendar_id AND tx_cal_event.ref_event_id = ' . $eventObject->getUid() . ' AND fe_users.disable=0 AND fe_users.deleted=0 AND tx_cal_calendar.hidden=0 AND tx_cal_calendar.deleted=0'; $groupBy = 'tx_cal_calendar.uid'; $result = $GLOBALS['TYPO3_DB']->exec_SELECTquery($select, $table, $where, $groupBy); if ($result) { while ($row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($result)) { // found private calendar of attendee $eventService =& \TYPO3\CMS\Cal\Utility\Functions::getEventService(); $eventData = $eventRow; $uid = $eventData['uid']; $this->cleanEventData($eventData); $eventData['pid'] = $row['pid']; $crdate = time(); $eventData['crdate'] = $crdate; $eventData['tstamp'] = $crdate; $eventData['calendar_id'] = $row['uid']; $eventData['ref_event_id'] = $eventObject->getUid(); $eventData['attendee_ids'] = implode(',', array_keys($attendeeRecords)); $eventService->conf['rights.']['edit.']['event.']['fields.']['attendee.']['public'] = 1; $eventService->_updateEvent($row['event_id'], $eventData, $eventObject); $updatedCalendar[] = $row['uid']; } $GLOBALS['TYPO3_DB']->sql_free_result($result); } } $updatedCalendar[] = $eventObject->getCalendarUid(); foreach ($attendeeRecords as $attendee) { // Check if attendee is a fe-user and has a private calendar defined $select = 'tx_cal_calendar.uid, tx_cal_calendar.pid'; $table = 'fe_users, tx_cal_calendar'; $where = 'tx_cal_calendar.uid NOT IN (' . implode(',', $updatedCalendar) . ') AND fe_users.uid = ' . $attendee->getFeUserId() . ' AND fe_users.tx_cal_calendar=tx_cal_calendar.uid AND fe_users.disable=0 AND fe_users.deleted=0 AND tx_cal_calendar.hidden=0 AND tx_cal_calendar.deleted=0'; $groupBy = 'tx_cal_calendar.uid'; $result = $GLOBALS['TYPO3_DB']->exec_SELECTquery($select, $table, $where, $groupBy); if ($result) { while ($row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($result)) { // found private calendar of attendee $eventService =& \TYPO3\CMS\Cal\Utility\Functions::getEventService(); $eventData = $eventRow; $this->cleanEventData($eventData); $eventData['pid'] = $row['pid']; $crdate = time(); $eventData['crdate'] = $crdate; $eventData['tstamp'] = $crdate; $eventData['calendar_id'] = $row['uid']; $eventData['ref_event_id'] = $eventObject->getUid(); $eventData['attendee_ids'] = implode(',', array_keys($attendeeRecords)); $eventService->conf['rights.']['create.']['event.']['fields.']['attendee.']['public'] = 1; $eventService->_saveEvent($eventData, $eventObject); } $GLOBALS['TYPO3_DB']->sql_free_result($result); } } } else { // Lets delete events with a ref_event_id to this event, b/c there are no attendees anymore // But first we have to find the events $select = 'tx_cal_event.uid'; $table = 'tx_cal_event'; $where = 'ref_event_id=' . $eventObject->getUid(); $rememberUids = array(0); $result = $GLOBALS['TYPO3_DB']->exec_SELECTquery($select, $table, $where); if ($result) { while ($row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($result)) { $rememberUids[] = $row['uid']; } $GLOBALS['TYPO3_DB']->sql_free_result($result); } // Now lets delete the mm relations to the attendees $where = 'uid IN (' . implode(',', $rememberUids) . ')'; $GLOBALS['TYPO3_DB']->exec_DELETEquery('tx_cal_attendee', $where); // Now delete the events $where = 'ref_event_id=' . $eventObject->getUid(); $GLOBALS['TYPO3_DB']->exec_DELETEquery('tx_cal_event', $where); } }