コード例 #1
0
ファイル: Api.php プロジェクト: ulrikkold/cal
 /**
  * Example:
  * require_once ('class.tx_cal_api.php');
  * $calAPI = new Api($this->cObj, &$conf);
  * $event = $calAPI->findEvent('2','tx_cal_phpicalendar');
  */
 function tx_cal_api_with(&$cObj, &$conf)
 {
     $this->cObj =& $cObj;
     $this->conf =& $conf;
     if (!$GLOBALS['TCA']) {
         $GLOBALS['TSFE']->includeTCA();
     }
     $this->conf['useInternalCaching'] = 1;
     $this->conf['cachingEngine'] = 'cachingFramework';
     $this->conf['writeCachingInfoToDevlog'] = 0;
     $GLOBALS['TSFE']->settingLocale();
     $this->controller = GeneralUtility::makeInstance('TYPO3\\CMS\\Cal\\Controller\\Controller');
     $this->controller->cObj =& $this->cObj;
     $this->controller->conf =& $this->conf;
     $this->controller->setWeekStartDay();
     $this->controller->cleanPiVarParam($this->piVars);
     $this->controller->clearPiVarParams();
     $this->controller->getParamsFromSession();
     $this->controller->initCaching();
     $this->controller->initConfigs();
     \TYPO3\CMS\Cal\Controller\Controller::initRegistry($this->controller);
     $this->rightsObj =& \TYPO3\CMS\Cal\Utility\Registry::Registry('basic', 'rightscontroller');
     $this->rightsObj = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstanceService('cal_rights_model', 'rights');
     $this->rightsObj->setDefaultSaveToPage();
     $this->modelObj =& \TYPO3\CMS\Cal\Utility\Registry::Registry('basic', 'modelcontroller');
     $this->modelObj = new \TYPO3\CMS\Cal\Controller\ModelController();
     $this->viewObj =& \TYPO3\CMS\Cal\Utility\Registry::Registry('basic', 'viewcontroller');
     $this->viewObj = GeneralUtility::makeInstance('TYPO3\\CMS\\Cal\\Controller\\ViewController');
     /*
      * $this->rightsObj = &\TYPO3\CMS\Cal\Utility\Registry::Registry('basic','rightscontroller'); $this->modelObj = &\TYPO3\CMS\Cal\Utility\Registry::Registry('basic','modelcontroller'); $this->viewObj = &\TYPO3\CMS\Cal\Utility\Registry::Registry('basic','viewcontroller');
      */
     return $this;
 }
コード例 #2
0
ファイル: BaseController.php プロジェクト: ulrikkold/cal
 function BaseController()
 {
     $this->cObj =& \TYPO3\CMS\Cal\Utility\Registry::Registry('basic', 'cobj');
     $this->local_cObj =& \TYPO3\CMS\Cal\Utility\Registry::Registry('basic', 'local_cobj');
     $this->controller =& \TYPO3\CMS\Cal\Utility\Registry::Registry('basic', 'controller');
     $this->conf =& \TYPO3\CMS\Cal\Utility\Registry::Registry('basic', 'conf');
     $this->rightsObj =& \TYPO3\CMS\Cal\Utility\Registry::Registry('basic', 'rightscontroller');
 }
コード例 #3
0
ファイル: CalDate.php プロジェクト: ulrikkold/cal
 public function __construct($date = null)
 {
     if (class_exists('TYPO3\\CMS\\Cal\\Utility\\Registry')) {
         if (is_object($GLOBALS['TSFE'])) {
             if (!is_array($GLOBALS['TSFE']->register['cal_shared_conf'])) {
                 $GLOBALS['TSFE']->register['cal_shared_conf'] =& Registry::Registry('basic', 'conf');
             }
             $this->conf =& $GLOBALS['TSFE']->register['cal_shared_conf'];
             $this->cObj =& $GLOBALS['TSFE']->cObj;
         } else {
             $this->conf =& Registry::Registry('basic', 'conf');
             $this->cObj =& Registry::Registry('basic', 'cobj');
         }
     }
     parent::Date($date);
 }
コード例 #4
0
ファイル: TodoRecModel.php プロジェクト: ulrikkold/cal
 public function fillTemplate($subpartMarker)
 {
     $cObj =& \TYPO3\CMS\Cal\Utility\Registry::Registry('basic', 'cobj');
     $confArr = unserialize($GLOBALS['TYPO3_CONF_VARS']['EXT']['extConf']['cal']);
     $modelTemplate = $confArr['todoSubtype'] == 'event' ? 'todoInlineModelTemplate' : 'todoSeparateModelTemplate';
     $page = $cObj->fileResource($this->parentEvent->conf['view.']['todo.'][$modelTemplate]);
     if ($page == '') {
         return '<h3>calendar: no todo model template file found:</h3>' . $this->parentEvent->conf['view.']['todo.'][$modelTemplate];
     }
     $page = $cObj->getSubpart($page, $subpartMarker);
     if (!$page) {
         return 'could not find the >' . str_replace('###', '', $subpartMarker) . '< subpart-marker in ' . $this->parentEvent->conf['view.']['todo.']['todoModelTemplate'];
     }
     $rems = array();
     $sims = array();
     $wrapped = array();
     $this->getMarker($page, $sims, $rems, $wrapped, $this->parentEvent->conf['view']);
     return $this->parentEvent->finish(\TYPO3\CMS\Cal\Utility\Functions::substituteMarkerArrayNotCached($page, $sims, $rems, $wrapped));
 }
コード例 #5
0
ファイル: LocationLoader.php プロジェクト: ulrikkold/cal
 /**
  * The function adds location markers into the event template
  *
  * @param Object $moduleCaller
  *        	Instance of the event model (phpicalendar_model)
  */
 public function start(&$moduleCaller)
 {
     if ($moduleCaller->getLocationId() > 0) {
         $this->modelObj =& \TYPO3\CMS\Cal\Utility\Registry::Registry('basic', 'modelcontroller');
         $this->cObj =& \TYPO3\CMS\Cal\Utility\Registry::Registry('basic', 'cobj');
         $moduleCaller->confArr = unserialize($GLOBALS['TYPO3_CONF_VARS']['EXT']['extConf']['cal']);
         $useLocationStructure = $moduleCaller->confArr['useLocationStructure'] ? $moduleCaller->confArr['useLocationStructure'] : 'tx_cal_location';
         $location = $this->modelObj->findLocation($moduleCaller->getLocationId(), $useLocationStructure);
         if (is_object($location)) {
             $page = $this->cObj->fileResource($moduleCaller->conf['module.']['locationloader.']['template']);
             if ($page == '') {
                 return '<h3>module locationloader: no template file found:</h3>' . $moduleCaller->conf['module.']['locationloader.']['template'];
             }
             $sims = array();
             $rems = array();
             $wrapped = array();
             $location->getMarker($page, $sims, $rems, $wrapped);
             return \TYPO3\CMS\Cal\Utility\Functions::substituteMarkerArrayNotCached($page, $sims, $rems, array());
         }
     }
     return '';
 }
コード例 #6
0
ファイル: Organizer.php プロジェクト: ulrikkold/cal
 function isUserAllowedToDelete($feUserUid = '', $feGroupsArray = array())
 {
     $rightsObj =& \TYPO3\CMS\Cal\Utility\Registry::Registry('basic', 'rightscontroller');
     if (!$rightsObj->isViewEnabled('delete_organizer')) {
         return false;
     }
     if ($rightsObj->isCalAdmin()) {
         return true;
     }
     if ($feUserUid == '') {
         $feUserUid = $rightsObj->getUserId();
     }
     if (empty($feGroupsArray)) {
         $feGroupsArray = $rightsObj->getUserGroups();
     }
     $isSharedUser = $this->isSharedUser($feUserUid, $feGroupsArray);
     $isAllowedToDeleteOrganizers = $rightsObj->isAllowedToDeleteOrganizer();
     $isAllowedToDeleteOwnOrganizersOnly = $rightsObj->isAllowedToDeleteOnlyOwnOrganizer();
     if ($isAllowedToDeleteOwnOrganizersOnly) {
         return $isSharedUser;
     }
     return $isAllowedToDeleteOrganizers;
 }
コード例 #7
0
ファイル: EventModel.php プロジェクト: ulrikkold/cal
 function getCruserNameMarker(&$template, &$sims, &$rems, &$wrapped, $view)
 {
     $modelObj =& \TYPO3\CMS\Cal\Utility\Registry::Registry('basic', 'modelcontroller');
     $sims['###CRUSER_NAME###'] = '';
     $feUser = $modelObj->findFeUser($this->getCreateUserId());
     if (is_array($feUser)) {
         $this->initLocalCObject();
         $this->local_cObj->setCurrentVal($feUser[$this->conf['view.'][$view . '.']['event.']['cruser_name.']['db_field']]);
         $sims['###CRUSER_NAME###'] = $this->local_cObj->cObjGetSingle($this->conf['view.'][$view . '.']['event.']['cruser_name'], $this->conf['view.'][$view . '.']['event.']['cruser_name.']);
     }
 }
コード例 #8
0
ファイル: NotificationView.php プロジェクト: ulrikkold/cal
 function invite($oldEventDataArray, $newEventDataArray = array())
 {
     unset($oldEventDataArray['starttime']);
     unset($oldEventDataArray['endtime']);
     unset($newEventDataArray['starttime']);
     unset($newEventDataArray['endtime']);
     $event_new = $event_old = $this->modelObj->findEvent($oldEventDataArray['uid'], 'tx_cal_phpicalendar', $this->conf['pidList'], false, false, false, true, true);
     // no need for executing the same query twice, is it?
     // event_new = $this->modelObj->findEvent($oldEventDataArray['uid'],'tx_cal_phpicalendar', $this->conf['pidList'], false, false, false, true, true);
     if (count($newEventDataArray) > 0) {
         $event_new->updateWithPiVars(array_merge($oldEventDataArray, $newEventDataArray));
     }
     $this->startMailer();
     $modelObj =& \TYPO3\CMS\Cal\Utility\Registry::Registry('basic', 'modelcontroller');
     $globalAttendeeArray = $modelObj->findEventAttendees($event_new->getUid());
     $eventService = $modelObj->getServiceObjByKey('cal_event_model', 'event', $event_new->getType());
     $this->setChairmanAsMailer($globalAttendeeArray);
     $template = $this->conf['view.']['event.']['meeting.']['onChangeTemplate'];
     $viewObj =& \TYPO3\CMS\Cal\Utility\Registry::Registry('basic', 'viewcontroller');
     $eventArray = array($event_new);
     foreach ($globalAttendeeArray as $serviceType => $attendeeArray) {
         foreach ($attendeeArray as $uid => $attendee) {
             if ($attendee->getFeUserId()) {
                 $eventService->updateAttendees($event_new->getUid());
             }
             if ($attendee->getEmail()) {
                 $conf = array();
                 $conf['parameter'] = $this->conf['view.']['event.']['meeting.']['statusViewPid'];
                 $conf['forceAbsoluteUrl'] = 1;
                 $urlParameters = array('tx_cal_controller[view]' => 'meeting', 'tx_cal_controller[attendee]' => $attendee->getUid(), 'tx_cal_controller[uid]' => $event_old->getUid(), 'tx_cal_controller[status]' => 'accept', 'tx_cal_controller[sid]' => md5($event_old->getUid() . $attendee->getEmail() . $attendee->row['crdate']));
                 $conf['additionalParams'] .= GeneralUtility::implodeArrayForUrl('', $urlParameters);
                 $this->controller->cObj->typolink('', $conf);
                 $acceptLink = $this->controller->cObj->lastTypoLinkUrl;
                 $urlParameters = array('tx_cal_controller[view]' => 'meeting', 'tx_cal_controller[attendee]' => $attendee->getUid(), 'tx_cal_controller[uid]' => $event_old->getUid(), 'tx_cal_controller[status]' => 'decline', 'tx_cal_controller[sid]' => md5($event_old->getUid() . $attendee->getEmail() . $attendee->row['crdate']));
                 $conf['additionalParams'] .= GeneralUtility::implodeArrayForUrl('', $urlParameters);
                 $this->controller->cObj->typolink('', $conf);
                 $declineLink = $this->controller->cObj->lastTypoLinkUrl;
                 $ics = $viewObj->drawIcs($eventArray, $this->conf['getdate'], false, $attendee->getEmail());
                 $title = $event_new->getTitle() . '.ics';
                 $title = strtr($title, array(' ' => '', ',' => '_'));
                 $icsAttachmentFile = $this->createTempIcsFile($ics, $title);
                 if (\TYPO3\CMS\Core\Utility\VersionNumberUtility::convertVersionNumberToInteger(TYPO3_version) < 4005010) {
                     $this->mailer->addAttachment($icsAttachmentFile);
                 } else {
                     $attachment = \Swift_Attachment::fromPath($icsAttachmentFile, 'text/calendar');
                     $this->mailer->attach($attachment);
                 }
                 if (count($newEventDataArray) > 0) {
                     $this->sendNotificationOfChanges($event_old, $event_new, $attendee->getEmail(), $template, '###TITLE###', '', $acceptLink, $declineLink);
                 } else {
                     $this->sendNotification($event_old, $attendee->getEmail(), $template, '###TITLE###', '', $acceptLink, $declineLink);
                 }
                 unlink($icsAttachmentFile);
                 if (\TYPO3\CMS\Core\Utility\VersionNumberUtility::convertVersionNumberToInteger(TYPO3_version) < 4005010) {
                     $this->mailer->theParts['attach'] = array();
                 }
             }
         }
     }
 }
コード例 #9
0
ファイル: LocationModel.php プロジェクト: ulrikkold/cal
 function updateWithPIVars(&$piVars)
 {
     $modelObj =& \TYPO3\CMS\Cal\Utility\Registry::Registry('basic', 'modelController');
     $cObj =& $this->controller->cObj;
     foreach ($piVars as $key => $value) {
         switch ($key) {
             case 'uid':
                 $this->setUid(intval($piVars['uid']));
                 unset($piVars['uid']);
                 break;
             case 'hidden':
                 $this->setHidden(intval($piVars['hidden']));
                 unset($piVars['hidden']);
                 break;
             case 'name':
                 $this->setName(strip_tags($piVars['name']));
                 unset($piVars['name']);
                 break;
             case 'description':
                 $this->setDescription($cObj->removeBadHTML($piVars['description'], array()));
                 unset($piVars['description']);
                 break;
             case 'street':
                 $this->setStreet(strip_tags($piVars['street']));
                 unset($piVars['street']);
                 break;
             case 'zip':
                 $this->setZip(strip_tags($piVars['zip']));
                 unset($piVars['zip']);
                 break;
             case 'city':
                 $this->setCity(strip_tags($piVars['city']));
                 unset($piVars['city']);
                 break;
             case 'phone':
                 $this->setPhone(strip_tags($piVars['phone']));
                 unset($piVars['phone']);
                 break;
             case 'fax':
                 $this->setFax(strip_tags($piVars['fax']));
                 unset($piVars['fax']);
                 break;
             case 'email':
                 $this->setEmail(strip_tags($piVars['email']));
                 unset($piVars['email']);
                 break;
             case 'image':
                 foreach ((array) $piVars['image'] as $image) {
                     $this->addImage(strip_tags($image));
                 }
                 unset($piVars['image']);
                 break;
             case 'country':
                 $this->setCountry(strip_tags($piVars['country']));
                 unset($piVars['country']);
                 break;
             case 'country_static_info':
                 $this->setCountry(strip_tags($piVars['country_static_info']));
                 unset($piVars['country_static_info']);
                 break;
             case 'countryzone':
                 $this->setCountryZone(strip_tags($piVars['countryzone']));
                 unset($piVars['countryzone']);
                 break;
             case 'countryzone_static_info':
                 $this->setCountryZone(strip_tags($piVars['countryzone_static_info']));
                 unset($piVars['countryzone_static_info']);
                 break;
             case 'link':
                 $this->setLink(strip_tags($piVars['link']));
                 unset($piVars['link']);
                 break;
             case 'longitude':
                 $this->setLongitude(strip_tags($piVars['longitude']));
                 unset($piVars['longitude']);
                 break;
             case 'latitude':
                 $this->setLatitude(strip_tags($piVars['latitude']));
                 unset($piVars['latitude']);
                 break;
             case 'shared':
             case 'shared_ids':
                 $this->setSharedGroups(array());
                 $this->setSharedUsers(array());
                 $values = $piVars[$key];
                 if (!is_array($piVars[$key])) {
                     $values = GeneralUtility::trimExplode(',', $piVars[$key], 1);
                 }
                 foreach ($values as $entry) {
                     preg_match('/(^[a-z])_([0-9]+)/', $entry, $idname);
                     if ($idname[1] == 'u') {
                         $this->addSharedUser($idname[2]);
                     } else {
                         if ($idname[1] == 'g') {
                             $this->addSharedGroup($idname[2]);
                         }
                     }
                 }
                 break;
         }
     }
 }
コード例 #10
0
ファイル: Ajax.php プロジェクト: ulrikkold/cal
            break;
    }
} else {
    if (is_array($controllerPiVars['translate'])) {
        $tempScriptRelPath = $calAPI->controller->scriptRelPath;
        $calAPI->controller->scriptRelPath = $calAPI->controller->locallangPath;
        $calAPI->controller->pi_loadLL();
        $calAPI->controller->scriptRelPath = $tempScriptRelPath;
        $translationArray = array();
        foreach ($controllerPiVars['translate'] as $value) {
            $translationArray[$value] = $calAPI->controller->pi_getLL('l_' . strtolower($value));
        }
        $ajax_return_data = json_encode($translationArray);
        $htmlheader_contenttype = 'Content-Type: application/json';
    } else {
        $rightsObj =& \TYPO3\CMS\Cal\Utility\Registry::Registry('basic', 'rightscontroller');
        $checkedView = $rightsObj->checkView($view);
        $res = '';
        $error = true;
        if ($checkedView == $view) {
            $error = false;
            $return = $calAPI->controller->getContent(false);
            echo $return;
            exit;
        } else {
            $res = 'You do not have the proper rights!' . $checkedView . '=' . $view;
        }
        $ajax_return_data = GeneralUtility::array2xml(array('error' => $error, 'response' => $res));
        $htmlheader_contenttype = 'Content-Type: text/xml';
    }
}
コード例 #11
0
ファイル: CalendarModel.php プロジェクト: ulrikkold/cal
 public function isUserAllowedToDelete($feUserUid = '', $feGroupsArray = array())
 {
     $rightsObj =& \TYPO3\CMS\Cal\Utility\Registry::Registry('basic', 'rightscontroller');
     if (!$rightsObj->isViewEnabled('delete_calendar')) {
         return false;
     }
     if ($rightsObj->isCalAdmin()) {
         return true;
     }
     if ($feUserUid == '') {
         $feUserUid = $rightsObj->getUserId();
     }
     if (empty($feGroupsArray)) {
         $feGroupsArray = $rightsObj->getUserGroups();
     }
     $isCalendarOwner = $this->isCalendarOwner($feUserUid, $feGroupsArray);
     $isAllowedToDeleteCalendars = $rightsObj->isAllowedToDeleteCalendar();
     $isAllowedToDeleteOwnCalendarsOnly = $rightsObj->isAllowedToDeleteOnlyOwnCalendar();
     $isAllowedToDeletePublicCalendars = $rightsObj->isAllowedToDeletePublicCalendar();
     if ($isAllowedToDeleteOwnCalendarsOnly) {
         return $isCalendarOwner;
     }
     return $isAllowedToDeleteCalendars && ($isCalendarOwner || $this->isPublic && $isAllowedToDeletePublicCalendars);
 }
コード例 #12
0
ファイル: EventService.php プロジェクト: ulrikkold/cal
 function _updateEvent($uid, $eventData, $object)
 {
     $tempValues = array();
     $tempValues['notify_ids'] = $eventData['notify_ids'];
     $tempValues['notify_offset'] = $eventData['notify_offset'] ? $eventData['notify_offset'] : $this->conf['view.']['event.']['remind.']['time'];
     unset($eventData['notify_ids']);
     $tempValues['exception_ids'] = $eventData['exception_ids'];
     unset($eventData['exception_ids']);
     $tempValues['attendee_ids'] = $eventData['attendee_ids'];
     unset($eventData['attendee_ids']);
     // Creating DB records
     $table = 'tx_cal_event';
     $where = 'uid = ' . $uid;
     $result = $GLOBALS['TYPO3_DB']->exec_UPDATEquery($table, $where, $eventData);
     if (FALSE === $result) {
         throw new \RuntimeException('Could not write event record to database: ' . $GLOBALS['TYPO3_DB']->sql_error(), 1431458130);
     }
     $eventData['pid'] = $object->row['pid'];
     if ($this->rightsObj->isAllowedTo('edit', 'event', 'image')) {
         $this->checkOnNewOrDeletableFiles('tx_cal_event', 'image', $eventData, $uid);
     }
     if ($this->rightsObj->isAllowedTo('edit', 'event', 'attachment')) {
         $this->checkOnNewOrDeletableFiles('tx_cal_event', 'attachment', $eventData, $uid);
     }
     $cal_user_ids = array();
     $where = ' AND tx_cal_event.uid=' . $uid . ' AND tx_cal_fe_user_category_mm.tablenames="fe_users" ' . $this->cObj->enableFields('tx_cal_event');
     $orderBy = '';
     $groupBy = '';
     $limit = '';
     if ($this->rightsObj->isAllowedToEditEventCategory()) {
         $where = 'uid_local = ' . $uid;
         $category_mm_relation_table = 'tx_cal_event_category_mm';
         $switchUidLocalForeign = false;
         if ($this->extConf['categoryService'] == 'sys_category') {
             $category_mm_relation_table = 'sys_category_record_mm';
             $switchUidLocalForeign = true;
             $GLOBALS['TYPO3_DB']->exec_DELETEquery($category_mm_relation_table, $where);
         } else {
             $GLOBALS['TYPO3_DB']->exec_DELETEquery($category_mm_relation_table, $where);
         }
         $categoryIds = array();
         foreach ($object->getCategories() as $category) {
             if (is_object($category)) {
                 $categoryIds[] = $category->getUid();
             }
         }
         $this->insertIdsIntoTableWithMMRelation($category_mm_relation_table, $categoryIds, $uid, '', array(), $switchUidLocalForeign);
     }
     if ($this->rightsObj->isAllowedToEditEventNotify() && !is_null($tempValues['notify_ids'])) {
         $GLOBALS['TYPO3_DB']->exec_DELETEquery('tx_cal_fe_user_event_monitor_mm', 'uid_local =' . $uid . ' AND tablenames in ("fe_users","fe_groups")');
         if ($tempValues['notify_ids'] != '') {
             $user = array();
             $group = array();
             $this->splitUserAndGroupIds(explode(',', strip_tags($tempValues['notify_ids'])), $user, $group);
             foreach ($user as $u) {
                 $userOffsetArray = GeneralUtility::trimExplode('_', $u, 1);
                 $this->insertIdsIntoTableWithMMRelation('tx_cal_fe_user_event_monitor_mm', array($userOffsetArray[0]), $uid, 'fe_users', array('offset' => isset($userOffsetArray[1]) ? $userOffsetArray[1] : $this->conf['view.']['event.']['remind.']['time'], 'pid' => $eventData['pid']));
             }
             $ignore = GeneralUtility::trimExplode(',', $this->conf['rights.']['create.']['event.']['addFeGroupToNotify.']['ignore'], 1);
             foreach ($group as $g) {
                 $groupOffsetArray = GeneralUtility::trimExplode('_', $g, 1);
                 if (!in_array($groupOffsetArray[0], $ignore)) {
                     $this->insertIdsIntoTableWithMMRelation('tx_cal_fe_user_event_monitor_mm', array($groupOffsetArray[0]), $uid, 'fe_groups', array('offset' => isset($groupOffsetArray[1]) ? $groupOffsetArray[1] : $this->conf['view.']['event.']['remind.']['time'], 'pid' => $eventData['pid']));
                 }
             }
         }
     } else {
         $userIdArray = GeneralUtility::trimExplode(',', $this->conf['rights.']['edit.']['event.']['fields.']['notify.']['defaultUser'], 1);
         if ($this->conf['rights.']['edit.']['event.']['addFeUserToNotify']) {
             $userIdArray[] = $this->rightsObj->getUserId();
         }
         $groupIdArray = GeneralUtility::trimExplode(',', $this->conf['rights.']['edit.']['event.']['fields.']['notify.']['defaultGroup'], 1);
         if ($this->conf['rights.']['edit.']['event.']['addFeGroupToNotify']) {
             $groupIdArray = $this->rightsObj->getUserGroups();
             $ignore = GeneralUtility::trimExplode(',', $this->conf['rights.']['edit.']['event.']['addFeGroupToNotify.']['ignore'], 1);
             $groupIdArray = array_diff($groupIdArray, $ignore);
         }
         if (!empty($userIdArray) || !empty($groupIdArray)) {
             $GLOBALS['TYPO3_DB']->exec_DELETEquery('tx_cal_fe_user_event_monitor_mm', 'uid_local =' . $uid . ' AND tablenames in ("fe_users","fe_groups")');
             $this->insertIdsIntoTableWithMMRelation('tx_cal_fe_user_event_monitor_mm', array_unique($userIdArray), $uid, 'fe_users', array('offset' => $tempValues['notify_offset'], 'pid' => $object->row['pid']));
             $this->insertIdsIntoTableWithMMRelation('tx_cal_fe_user_event_monitor_mm', array_unique($groupIdArray), $uid, 'fe_groups', array('offset' => $tempValues['notify_offset'], 'pid' => $object->row['pid']));
         }
     }
     if ($this->rightsObj->isAllowedToEditEventException() && !is_null($tempValues['exception_ids'])) {
         if ($tempValues['exception_ids'] != '') {
             $table = 'tx_cal_exception_event_mm';
             $where = 'uid_local = ' . $uid;
             $GLOBALS['TYPO3_DB']->exec_DELETEquery($table, $where);
             $user = array();
             $group = array();
             $this->splitUserAndGroupIds(explode(',', strip_tags($tempValues['exception_ids'])), $user, $group);
             $this->insertIdsIntoTableWithMMRelation($table, $user, $uid, 'tx_cal_exception_event');
             $this->insertIdsIntoTableWithMMRelation($table, $group, $uid, 'tx_cal_exception_event_group');
         }
     }
     if ($this->rightsObj->isAllowedTo('edit', 'event', 'shared')) {
         $GLOBALS['TYPO3_DB']->exec_DELETEquery('tx_cal_event_shared_user_mm', 'uid_local =' . $uid);
         $this->insertIdsIntoTableWithMMRelation('tx_cal_event_shared_user_mm', array_unique($object->getSharedUsers()), $uid, 'fe_users');
         $this->insertIdsIntoTableWithMMRelation('tx_cal_event_shared_user_mm', array_unique($object->getSharedGroups()), $uid, 'fe_groups');
     } else {
         $userIdArray = GeneralUtility::trimExplode(',', $this->conf['rights.']['edit.']['event.']['fields.']['shared.']['defaultUser'], 1);
         if ($this->conf['rights.']['edit.']['event.']['addFeUserToShared']) {
             $userIdArray[] = $this->rightsObj->getUserId();
         }
         $groupIdArray = GeneralUtility::trimExplode(',', $this->conf['rights.']['edit.']['event.']['fields.']['shared.']['defaultGroup'], 1);
         if ($this->conf['rights.']['edit.']['event.']['addFeGroupToShared']) {
             $groupIdArray = $this->rightsObj->getUserGroups();
             $ignore = GeneralUtility::trimExplode(',', $this->conf['rights.']['edit.']['event.']['addFeGroupToShared.']['ignore'], 1);
             $groupIdArray = array_diff($groupIdArray, $ignore);
         }
         if (!empty($userIdArray) || !empty($groupIdArray)) {
             $GLOBALS['TYPO3_DB']->exec_DELETEquery('tx_cal_event_shared_user_mm', 'uid_local =' . $uid);
             $this->insertIdsIntoTableWithMMRelation('tx_cal_event_shared_user_mm', array_unique($userIdArray), $uid, 'fe_users');
             $this->insertIdsIntoTableWithMMRelation('tx_cal_event_shared_user_mm', array_unique($groupIdArray), $uid, 'fe_groups');
         }
     }
     if ($this->rightsObj->isAllowedTo('edit', 'event', 'attendee') && $object->getEventType() == \TYPO3\CMS\Cal\Model\Model::EVENT_TYPE_MEETING) {
         $modelObj =& \TYPO3\CMS\Cal\Utility\Registry::Registry('basic', 'modelcontroller');
         $attendeeServices = $modelObj->findEventAttendees($uid);
         $attendeeIndex = array();
         $attendeeServiceKeys = array_keys($attendeeServices);
         $servKey = 'tx_cal_attendee';
         $oldAttendeeUids = array($servKey => array());
         foreach ($attendeeServiceKeys as $serviceKey) {
             $attendeeKeys = array_keys($attendeeServices[$serviceKey]);
             foreach ($attendeeKeys as $attendeeKey) {
                 $attendeeIndex[$serviceKey . '_' . ($attendeeServices[$serviceKey][$attendeeKey]->getFeUserId() ? $attendeeServices[$serviceKey][$attendeeKey]->getFeUserId() : $attendeeServices[$serviceKey][$attendeeKey]->getEmail())] =& $attendeeServices[$serviceKey][$attendeeKey];
                 $oldAttendeeUids[$serviceKey][] = $attendeeServices[$serviceKey][$attendeeKey]->getUid();
             }
         }
         $attendeeService = $modelObj->getServiceObjByKey('cal_attendee_model', 'attendee', $servKey);
         $attendeeUids = array();
         $attendees =& $object->getAttendees();
         foreach ($attendees[$servKey] as $attendee) {
             if (is_object($attendeeIndex[$serviceKey . '_' . ($attendee->getFeUserId() ? $attendee->getFeUserId() : $attendee->getEmail())])) {
                 // Attendee is already assigned -> updating attendance
                 $attendeeValues = array();
                 $attendeeValues['attendance'] = $attendee->getAttendance();
                 $attendeeValues['status'] = $attendee->getStatus();
                 $attendeeValues['event_id'] = $attendee->getEventUid();
                 $attendeeService->_updateAttendee($attendee->getUid(), $attendeeValues);
                 $attendeeUids[] = $attendee->getUid();
             } else {
                 // It's a new attendee -> creating new one
                 $crdate = time();
                 $attendeeValues = array('pid' => $this->conf['rights.']['create.']['attendee.']['saveAttendeeToPid'] ? $this->conf['rights.']['create.']['attendee.']['saveAttendeeToPid'] : $object->row['pid'], 'tstamp' => $crdate, 'crdate' => $crdate);
                 $attendeeValues['event_id'] = $uid;
                 $attendeeValues['cruser_id'] = $this->rightsObj->getUserId();
                 $attendeeValues['fe_user_id'] = $attendee->getFeUserId();
                 $attendeeValues['email'] = $attendee->getEmail();
                 $attendeeValues['attendance'] = $attendee->getAttendance();
                 $attendeeValues['status'] = $attendee->getStatus();
                 $attendeeService->_saveAttendee($attendeeValues);
                 $attendeeUids[] = $GLOBALS['TYPO3_DB']->sql_insert_id();
             }
         }
         $uidsToBeDeleted = array_diff($oldAttendeeUids[$servKey], $attendeeUids);
         if (!empty($uidsToBeDeleted)) {
             $GLOBALS['TYPO3_DB']->exec_DELETEquery('tx_cal_attendee', 'uid in (' . implode(',', $uidsToBeDeleted) . ')');
         }
         $eventData['attendee'] = count($attendeeUids);
     }
 }
コード例 #13
0
ファイル: Functions.php プロジェクト: ulrikkold/cal
 public static function substituteMarkerArrayNotCached($content, $markContentArray = array(), $subpartContentArray = array(), $wrappedSubpartContentArray = array())
 {
     $cObj =& \TYPO3\CMS\Cal\Utility\Registry::Registry('basic', 'cobj');
     // return $cObj->substituteMarkerArrayCached($content,$markContentArray,$subpartContentArray,$wrappedSubpartContentArray);
     // If not arrays then set them
     if (!is_array($markContentArray)) {
         $markContentArray = array();
     }
     // Plain markers
     if (!is_array($subpartContentArray)) {
         $subpartContentArray = array();
     }
     // Subparts being directly substituted
     if (!is_array($wrappedSubpartContentArray)) {
         $wrappedSubpartContentArray = array();
     }
     // Subparts being wrapped
     // Finding keys and check hash:
     $sPkeys = array_keys($subpartContentArray);
     $wPkeys = array_keys($wrappedSubpartContentArray);
     // Finding subparts and substituting them with the subpart as a marker
     reset($sPkeys);
     while (list(, $sPK) = each($sPkeys)) {
         $content = $cObj->substituteSubpart($content, $sPK, $subpartContentArray[$sPK]);
     }
     // Finding subparts and wrapping them with markers
     reset($wPkeys);
     while (list(, $wPK) = each($wPkeys)) {
         if (is_array($wrappedSubpartContentArray[$wPK])) {
             $parts =& $wrappedSubpartContentArray[$wPK];
         } else {
             $parts = explode('|', $wrappedSubpartContentArray[$wPK]);
         }
         $content = $cObj->substituteSubpart($content, $wPK, $parts);
     }
     return $cObj->substituteMarkerArray($content, $markContentArray);
 }
コード例 #14
0
 function processDatamap_afterDatabaseOperations($status, $table, $id, &$fieldArray, &$tcemain)
 {
     /* If we have a new calendar event */
     if (($table == 'tx_cal_event' || $table == 'tx_cal_exception_event') && count($fieldArray) > 1) {
         $event = BackendUtility::getRecord($table, $status == 'new' ? $tcemain->substNEWwithIDs[$id] : $id);
         /* If we're in a workspace, don't notify anyone about the event */
         if ($event['pid'] > 0 && !$GLOBALS['BE_USER']->workspace) {
             /* Check Page TSConfig for a preview page that we should use */
             $pageTSConf = BackendUtility::getPagesTSconfig($event['pid']);
             if ($pageTSConf['options.']['tx_cal_controller.']['pageIDForPlugin']) {
                 $pageIDForPlugin = $pageTSConf['options.']['tx_cal_controller.']['pageIDForPlugin'];
             } else {
                 $pageIDForPlugin = $event['pid'];
             }
             $page = BackendUtility::getRecord('pages', intval($pageIDForPlugin), 'doktype');
             if ($page['doktype'] != 254) {
                 $tx_cal_api = new \TYPO3\CMS\Cal\Controller\Api();
                 $tx_cal_api =& $tx_cal_api->tx_cal_api_without($pageIDForPlugin);
                 if ($event['event_type'] == 3 && !$event['ref_event_id']) {
                     $modelObj =& \TYPO3\CMS\Cal\Utility\Registry::Registry('basic', 'modelcontroller');
                     $modelObj->updateEventAttendees($event['uid'], 'tx_cal_phpicalendar');
                 }
                 if ($table == 'tx_cal_event' && ($status == 'new' || $fieldArray['send_invitation'])) {
                     /* Notify of new event */
                     $notificationService =& \TYPO3\CMS\Cal\Utility\Functions::getNotificationService();
                     $oldPath =& $notificationService->conf['view.']['event.']['eventModelTemplate'];
                     $extPath = \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::extPath('cal');
                     $oldPath = str_replace('EXT:cal/', $extPath, $oldPath);
                     // $oldPath = str_replace(PATH_site, '', $oldPath);
                     $tx_cal_api->conf['view.']['event.']['eventModelTemplate'] = $oldPath;
                     $oldBackPath = $GLOBALS['TSFE']->tmpl->getFileName_backPath;
                     $GLOBALS['TSFE']->tmpl->getFileName_backPath = '';
                     $fileInfo = GeneralUtility::split_fileref($oldPath);
                     $GLOBALS['TSFE']->tmpl->allowedPaths[] = $fileInfo['path'];
                     $notificationService->controller->getDateTimeObject = new \TYPO3\CMS\Cal\Model\CalDate($event['start_date'] . '000000');
                     if ($status == 'new') {
                         $notificationService->notify($event);
                     }
                     if ($fieldArray['send_invitation']) {
                         $notificationService->invite($fieldArray);
                         $fieldArray['send_invitation'] = 0;
                     }
                     $GLOBALS['TSFE']->tmpl->getFileName_backPath = $oldBackPath;
                 }
                 /** @var \TYPO3\CMS\Cal\Utility\RecurrenceGenerator $rgc */
                 $rgc = GeneralUtility::makeInstance('TYPO3\\CMS\\Cal\\Utility\\RecurrenceGenerator', $pageIDForPlugin);
                 $rgc->generateIndexForUid($event['uid'], $table);
                 if ($table == 'tx_cal_event' && $tx_cal_api->conf['view.']['event.']['remind']) {
                     /* Schedule reminders for new and changed events */
                     $reminderService =& \TYPO3\CMS\Cal\Utility\Functions::getReminderService();
                     $reminderService->scheduleReminder($event['uid']);
                 }
             }
         }
     }
     if ($table == 'pages' && $status == 'new') {
         $GLOBALS['BE_USER']->setAndSaveSessionData('cal_itemsProcFunc', array());
     }
 }
コード例 #15
0
ファイル: NewWeekView.php プロジェクト: ulrikkold/cal
 private function getDayLink($weekdayIndex)
 {
     $conf =& \TYPO3\CMS\Cal\Utility\Registry::Registry('basic', 'conf');
     if ($this->initialized === false) {
         // initializing!!
         $this->getAlldaysMarker($template, $sims, $rems, $wrapped, $conf['view']);
         $this->initialized = true;
     }
     $daysKeys = array_keys($this->days);
     return $this->days[$daysKeys[$weekdayIndex]]->getDayLink($conf['view'], $this->days[$daysKeys[$weekdayIndex]]->time, $this->dayHasEvent[$this->days[$daysKeys[$weekdayIndex]]->weekdayNumber]);
 }
コード例 #16
0
ファイル: BaseView.php プロジェクト: ulrikkold/cal
 /**
  * Method to initialise a local content object, that can be used for customized TS rendering with own db values
  * @param	$customData	array	Array with key => value pairs that should be used as fake db-values for TS rendering instead of the values of the current object
  */
 function initLocalCObject($customData = false)
 {
     if (!is_object($this->local_cObj)) {
         $this->local_cObj =& \TYPO3\CMS\Cal\Utility\Registry::Registry('basic', 'local_cObj');
     }
     if ($customData && is_array($customData)) {
         $this->local_cObj->data = $customData;
     } else {
         $this->local_cObj->data = $this->cachedValueArray;
     }
 }
コード例 #17
0
ファイル: BaseModel.php プロジェクト: ulrikkold/cal
 public function fillTemplate($subpartMarker)
 {
     $cObj =& \TYPO3\CMS\Cal\Utility\Registry::Registry('basic', 'cobj');
     $page = $cObj->fileResource($this->templatePath);
     if ($page == '') {
         return \TYPO3\CMS\Cal\Utility\Functions::createErrorMessage('No ' . $this->objectType . ' template file found at: >' . $this->templatePath . '<.', 'Please make sure the path is correct and that you included the static template and double-check the path using the Typoscript Object Browser.');
     }
     $page = $cObj->getSubpart($page, $subpartMarker);
     if (!$page) {
         return \TYPO3\CMS\Cal\Utility\Functions::createErrorMessage('Could not find the >' . str_replace('###', '', $subpartMarker) . '< subpart-marker in ' . $this->templatePath, 'Please add the subpart >' . str_replace('###', '', $subpartMarker) . '< to your ' . $this->templatePath);
     }
     $rems = array();
     $sims = array();
     $wrapped = array();
     $this->getMarker($page, $sims, $rems, $wrapped);
     return $this->finish(\TYPO3\CMS\Cal\Utility\Functions::substituteMarkerArrayNotCached($page, $sims, $rems, $wrapped));
 }
コード例 #18
0
ファイル: Model.php プロジェクト: ulrikkold/cal
 /**
  * Returns the location object.
  */
 public function getLocationObject()
 {
     if (!$this->locationObject) {
         $confArr = unserialize($GLOBALS['TYPO3_CONF_VARS']['EXT']['extConf']['cal']);
         $useLocationStructure = $confArr['useLocationStructure'] ? $confArr['useLocationStructure'] : 'tx_cal_location';
         $modelObj =& \TYPO3\CMS\Cal\Utility\Registry::Registry('basic', 'modelcontroller');
         $this->locationObject = $modelObj->findLocation($this->getLocationId(), $useLocationStructure, $this->conf['pidList']);
     }
     return $this->locationObject;
 }
コード例 #19
0
ファイル: NewMonthView.php プロジェクト: ulrikkold/cal
 function getMonthTitleMarker(&$template, &$sims, &$rems, &$wrapped, $view)
 {
     $current_month = new \TYPO3\CMS\Cal\Model\CalDate();
     $current_month->setMonth($this->month);
     $current_month->setYear($this->year);
     $conf =& \TYPO3\CMS\Cal\Utility\Registry::Registry('basic', 'conf');
     $sims['###MONTH_TITLE###'] = $current_month->format($conf['view.'][$view . '.']['dateFormatMonth']);
 }
コード例 #20
0
ファイル: RecurrenceGenerator.php プロジェクト: ulrikkold/cal
 /**
  * Get the event service
  *
  * @return EventService
  */
 function getEventService()
 {
     static $eventService = null;
     if (is_object($eventService)) {
         return $eventService;
     }
     try {
         $modelObj =& Registry::Registry('basic', 'modelcontroller');
         if (!$modelObj) {
             /** @var Api $calAPI */
             $calAPI = GeneralUtility::makeInstance('TYPO3\\CMS\\Cal\\Controller\\Api');
             $calAPI =& $calAPI->tx_cal_api_without($this->pageIDForPlugin);
             $modelObj = $calAPI->modelObj;
         }
         $eventService = $modelObj->getServiceObjByKey('cal_event_model', 'event', 'tx_cal_phpicalendar');
     } catch (\Exception $e) {
         $this->info = CalIndexer::getMessage($e, FlashMessage::ERROR);
     }
     if (!is_object($eventService)) {
         $this->info = CalIndexer::getMessage('Could not fetch the event service! Please make sure the page id is correct!', FlashMessage::ERROR);
     }
     return $eventService;
 }
コード例 #21
0
ファイル: FeEditingBaseView.php プロジェクト: ulrikkold/cal
 protected function constrainParser($field, $constrainConfig)
 {
     $result = array();
     $rightsObj =& \TYPO3\CMS\Cal\Utility\Registry::Registry('basic', 'rightscontroller');
     foreach ($constrainConfig as $rule) {
         $value = $this->ruleParser($field, $rule);
         if ($value != '' && ($field == 'start' || $field == 'end') && $rule['rule'] == 'after' && $rule['field'] == 'now') {
             if ($rightsObj->isAllowedToCreateEventInPast()) {
                 $value = '';
             }
         }
         if ($value != '') {
             $result[] = $value;
         }
     }
     return implode('<br/>', $result);
 }
コード例 #22
0
ファイル: BaseService.php プロジェクト: ulrikkold/cal
 public function __construct()
 {
     $this->controller =& \TYPO3\CMS\Cal\Utility\Registry::Registry('basic', 'controller');
     $this->conf =& \TYPO3\CMS\Cal\Utility\Registry::Registry('basic', 'conf');
     $this->rightsObj =& \TYPO3\CMS\Cal\Utility\Registry::Registry('basic', 'rightscontroller');
     $this->cObj =& \TYPO3\CMS\Cal\Utility\Registry::Registry('basic', 'cobj');
     $this->modelObj =& \TYPO3\CMS\Cal\Utility\Registry::Registry('basic', 'modelcontroller');
     $this->extConf = unserialize($GLOBALS['TYPO3_CONF_VARS']['EXT']['extConf']['cal']);
     if (!isset($this->extConf['categoryService'])) {
         $this->extConf['categoryService'] = 'tx_cal_category';
     }
 }
コード例 #23
0
ファイル: Controller.php プロジェクト: ulrikkold/cal
 /**
  * 
  * @param unknown $objectType
  * @param unknown $additionalWhere
  * @return array
  */
 public function findRelatedEvents($objectType, $additionalWhere)
 {
     $relatedEvents = array();
     $modelObj =& \TYPO3\CMS\Cal\Utility\Registry::Registry('basic', 'modelcontroller');
     if ($this->conf['view.'][$this->conf['view'] . '.'][$objectType . '.']['includeEventsInResult'] == 1) {
         $starttime = $this->getListViewTime($this->conf['view.'][$this->conf['view'] . '.'][$this->conf['view'] . '.']['includeEventsInResult.']['starttime']);
         $endtime = $this->getListViewTime($this->conf['view.'][$this->conf['view'] . '.'][$this->conf['view'] . '.']['includeEventsInResult.']['endtime']);
         $relatedEvents = $modelObj->findEventsForList($starttime, $endtime, '', $this->conf['pidList'], '0,1,2,3', $additionalWhere);
     }
     return $relatedEvents;
 }
コード例 #24
0
ファイル: NewDayView.php プロジェクト: ulrikkold/cal
 public function getDayLink($view, $value, $hasEvent = false)
 {
     $rightsObj =& \TYPO3\CMS\Cal\Utility\Registry::Registry('basic', 'rightscontroller');
     $conf =& \TYPO3\CMS\Cal\Utility\Registry::Registry('basic', 'conf');
     $dayLinkViewTarget = $conf['view.']['dayLinkTarget'];
     $isAllowedToCreateEvent = $rightsObj->isAllowedToCreateEvent();
     $local_cObj =& $this->getLocalCObject();
     $local_cObj->setCurrentVal($value);
     $local_cObj->data['view'] = $dayLinkViewTarget;
     $local_cObj->data['link_timestamp'] = $value;
     $controller =& \TYPO3\CMS\Cal\Utility\Registry::Registry('basic', 'controller');
     if (($rightsObj->isViewEnabled($dayLinkViewTarget) || $conf['view.'][$dayLinkViewTarget . '.'][$dayLinkViewTarget . 'ViewPid']) && (!empty($this->events) || $hasEvent || $this->hasAlldayEvents || $isAllowedToCreateEvent)) {
         $controller->getParametersForTyposcriptLink($local_cObj->data, array('getdate' => $this->Ymd, 'view' => $dayLinkViewTarget, $controller->getPointerName() => NULL), $conf['cache'], $conf['clear_anyway'], $conf['view.'][$dayLinkViewTarget . '.'][$dayLinkViewTarget . 'ViewPid']);
     }
     return $local_cObj->cObjGetSingle($conf['view.'][$view . '.'][$dayLinkViewTarget . 'ViewLink'], $conf['view.'][$view . '.'][$dayLinkViewTarget . 'ViewLink.']);
 }
コード例 #25
0
ファイル: NewTimeView.php プロジェクト: ulrikkold/cal
 public function getCreateEventLinkMarker(&$template, &$sims, &$rems, &$wrapped, $view)
 {
     $sims['###CREATE_EVENT_LINK###'] = '';
     $rightsObj =& \TYPO3\CMS\Cal\Utility\Registry::Registry('basic', 'rightscontroller');
     $conf =& \TYPO3\CMS\Cal\Utility\Registry::Registry('basic', 'conf');
     $controller =& \TYPO3\CMS\Cal\Utility\Registry::Registry('basic', 'controller');
     if (!$rightsObj->isViewEnabled('create_event')) {
         return;
     }
     $than = new \TYPO3\CMS\Cal\Model\CalDate();
     $than->setTZbyId('UTC');
     $than->addSeconds($createOffset);
     $date = new \TYPO3\CMS\Cal\Model\CalDate();
     $date->setDay($this->day);
     $date->setMonth($this->month);
     $date->setYear($this->year);
     $date->setHour($this->hour);
     $date->setMinute($this->minute);
     if ($rightsObj->isAllowedToCreateEventForTodayAndFuture()) {
         $date->setHour(23);
         $date->setMinute(59);
     }
     if (($date->after($than) || $rightsObj->isAllowedToCreateEventInPast()) && $rightsObj->isAllowedToCreateEvent()) {
         $local_cObj = $this->getLocalCObject();
         $timeParams = '';
         if ($view == 'day' || $view == 'week') {
             $timeParams = '&tx_cal_controller[gettime]=' . $date->format('%H%M');
         } else {
             if ($conf['rights.']['create.']['event.']['fields.']['starttime.']['default'] == 'now') {
                 $now = new \TYPO3\CMS\Cal\Model\CalDate();
                 $than->setTZbyId('UTC');
                 $timeParams = '&tx_cal_controller[gettime]=' . $now->format('%H%M');
             }
         }
         $local_cObj->setCurrentVal($conf['view.'][$view . '.']['event.']['addIcon']);
         // linkConf = Array();
         $local_cObj->data['link_useCacheHash'] = 0;
         $local_cObj->data['link_no_cache'] = 1;
         $local_cObj->data['link_additionalParams'] = $timeParams . '&tx_cal_controller[startdate]=' . $date->format('%Y%m%d') . '&tx_cal_controller[lastview]=' . $controller->extendLastView() . '&tx_cal_controller[view]=create_event';
         $local_cObj->data['link_section'] = 'default';
         $local_cObj->data['link_parameter'] = $conf['view.']['event.']['createEventViewPid'] ? $conf['view.']['event.']['createEventViewPid'] : $GLOBALS['TSFE']->id;
         $sims['###CREATE_EVENT_LINK###'] .= $local_cObj->cObjGetSingle($conf['view.'][$view . '.']['event.']['addLink'], $conf['view.'][$view . '.']['event.']['addLink.']);
     }
 }
コード例 #26
0
ファイル: EventRecModel.php プロジェクト: ulrikkold/cal
 function isUserAllowedToDelete($feUserUid = '', $feGroupsArray = array())
 {
     $rightsObj =& \TYPO3\CMS\Cal\Utility\Registry::Registry('basic', 'rightscontroller');
     if (!$rightsObj->isViewEnabled('delete_event')) {
         return false;
     }
     if ($rightsObj->isCalAdmin()) {
         return true;
     }
     $deleteOffset = $this->parentEvent->conf['rights.']['delete.']['event.']['timeOffset'] * 60;
     if ($feUserUid == '') {
         $feUserUid = $rightsObj->getUserId();
     }
     if (empty($feGroupsArray)) {
         $feGroupsArray = $rightsObj->getUserGroups();
     }
     $isEventOwner = $this->parentEvent->isEventOwner($feUserUid, $feGroupsArray);
     $isSharedUser = $this->parentEvent->isSharedUser($feUserUid, $feGroupsArray);
     if ($rightsObj->isAllowedToDeleteStartedEvents()) {
         $eventHasntStartedYet = true;
     } else {
         $temp = new \TYPO3\CMS\Cal\Model\CalDate();
         $temp->setTZbyId('UTC');
         $temp->addSeconds($deleteOffset);
         $eventStart = $this->getStart();
         $eventHasntStartedYet = $eventStart->after($temp);
     }
     $isAllowedToDeleteEvents = $rightsObj->isAllowedToDeleteEvents();
     $isAllowedToDeleteOwnEventsOnly = $rightsObj->isAllowedToDeleteOnlyOwnEvents();
     if ($isAllowedToDeleteOwnEventsOnly) {
         return ($isEventOwner || $isSharedUser) && $eventHasntStartedYet;
     }
     return $isAllowedToDeleteEvents && ($isEventOwner || $isSharedUser) && $eventHasntStartedYet;
 }
コード例 #27
0
ファイル: LocationService.php プロジェクト: ulrikkold/cal
 /**
  * Generates the sql query and builds location objects out of the result rows
  * 
  * @param string $pidList
  *        	to search in
  * @param string $additionalWhere
  *        	where clause
  * @return array containing the location objects
  */
 function getLocationFromTable($pidList = '', $additionalWhere = '')
 {
     $locations = array();
     $orderBy = \TYPO3\CMS\Cal\Utility\Functions::getOrderBy('tx_cal_location');
     if ($pidList != '') {
         $additionalWhere .= ' AND tx_cal_location.pid IN (' . $pidList . ')';
     }
     $additionalWhere .= $this->getAdditionalWhereForLocalizationAndVersioning('tx_cal_location');
     $table = 'tx_cal_location';
     $select = '*';
     $where = ' l18n_parent = 0 ' . $additionalWhere . $this->cObj->enableFields('tx_cal_location');
     $groupBy = '';
     $limit = '';
     $rightsObj =& \TYPO3\CMS\Cal\Utility\Registry::Registry('basic', 'rightscontroller');
     $feUserUid = $rightsObj->getUserId();
     $feGroupsArray = $rightsObj->getUserGroups();
     $hookObjectsArr = \TYPO3\CMS\Cal\Utility\Functions::getHookObjectsArray('tx_cal_location_service', 'locationServiceClass', 'service');
     foreach ($hookObjectsArr as $hookObj) {
         if (method_exists($hookObj, 'preGetLocationFromTableExec')) {
             $hookObj->preGetLocationFromTableExec($this, $select, $table, $where, $groupBy, $orderBy, $limit);
         }
     }
     $result = $GLOBALS['TYPO3_DB']->exec_SELECTquery($select, $table, $where, $groupBy, $orderBy, $limit);
     if ($result) {
         while ($row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($result)) {
             if ($GLOBALS['TSFE']->sys_language_content) {
                 $row = $GLOBALS['TSFE']->sys_page->getRecordOverlay('tx_cal_location', $row, $GLOBALS['TSFE']->sys_language_content, $GLOBALS['TSFE']->sys_language_contentOL, '');
             }
             if ($GLOBALS['TSFE']->sys_page->versioningPreview == TRUE) {
                 // get workspaces Overlay
                 $GLOBALS['TSFE']->sys_page->versionOL('tx_cal_location', $row);
             }
             $lastLocation = new \TYPO3\CMS\Cal\Model\Location($row, $pidList);
             $select = 'uid_foreign,tablenames';
             $table = 'tx_cal_location_shared_user_mm';
             $where = 'uid_local = ' . $row['uid'];
             $sharedUserResult = $GLOBALS['TYPO3_DB']->exec_SELECTquery($select, $table, $where);
             if ($sharedUserResult) {
                 while ($sharedUserRow = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($sharedUserResult)) {
                     if ($sharedUserRow['tablenames'] == 'fe_users') {
                         $lastLocation->addSharedUser($sharedUserRow['uid_foreign']);
                     } else {
                         if ($sharedUserRow['tablenames'] == 'fe_groups') {
                             $lastLocation->addSharedGroup($sharedUserRow['uid_foreign']);
                         }
                     }
                 }
                 $GLOBALS['TYPO3_DB']->sql_free_result($sharedUserResult);
             }
             $locations[] = $lastLocation;
         }
         $GLOBALS['TYPO3_DB']->sql_free_result($result);
     }
     return $locations;
 }