예제 #1
0
 /**
  * Draws a create event form.
  * 
  * @param $getdate int
  *        	date to create the event for. Format: yyyymmdd
  * @param $pidList string
  *        	list of pids.
  * @param $object object
  *        	phpicalendar object to be updated
  * @return string HTML output.
  */
 function drawCreateEvent($getdate, $pidList, $object = '')
 {
     $this->objectString = 'event';
     if (is_object($object)) {
         $this->conf['view'] = 'edit_' . $this->objectString;
     } else {
         $this->conf['view'] = 'create_' . $this->objectString;
         unset($this->controller->piVars['uid']);
     }
     $lastPiVars = $this->controller->piVars;
     $sims = array();
     $rems = array();
     $wrapped = array();
     // If an event has been passed on the form is a edit form
     if (is_object($object) && $object->isUserAllowedToEdit($this->rightsObj->getUserId())) {
         $this->isEditMode = true;
         $this->object = $object;
         $this->prepareUserArray();
         $sims['###UID###'] = $this->object->getUid();
         $sims['###TYPE###'] = $this->object->getType();
         $sims['###L_EDIT_EVENT###'] = $this->controller->pi_getLL('l_edit_event');
         $copy = $this->controller->piVars;
         $this->object->updateWithPIVars($copy);
     } else {
         $sims['###UID###'] = '';
         $sims['###TYPE###'] = $this->eventType;
         $sims['###L_EDIT_EVENT###'] = $this->controller->pi_getLL('l_create_event');
         $this->object = $this->modelObj->createEvent('tx_cal_phpicalendar');
         $this->controller->piVars['mygetdate'] = $this->conf['getdate'];
         $allValues = array_merge($this->getDefaultValues(), $this->controller->piVars);
         $this->object->updateWithPIVars($allValues);
     }
     $requiredFieldSims = array();
     $allRequiredFieldsAreFilled = $this->checkRequiredFields($requiredFieldsSims);
     $constrainFieldSims = array();
     $noComplains = $this->checkContrains($constrainFieldSims);
     if ($allRequiredFieldsAreFilled && $noComplains) {
         $GLOBALS['TSFE']->fe_user->setKey('ses', 'tx_cal_controller_creatingEvent', '1');
         $GLOBALS['TSFE']->storeSessionData();
         $this->conf['lastview'] = $this->controller->extendLastView();
         $this->conf['view'] = 'confirm_' . $this->objectString;
         $this->controller->piVars = $lastPiVars;
         if ($this->conf['view.']['dontShowConfirmView'] == 1) {
             return $this->controller->saveEvent();
         }
         return $this->controller->confirmEvent();
     }
     $this->initTemplate();
     $sims['###VIEW###'] = $this->conf['view'];
     // Needed for translation options:
     $this->serviceName = 'cal_event_model';
     $this->table = 'tx_cal_event';
     $page = '';
     if ($this->conf['view.']['enableAjax'] && $this->controller->piVars['pid']) {
         $path = $this->conf['view.']['create_event.']['ajaxTemplate'];
         $page = $this->cObj->fileResource($path);
         $this->conf['noWrapInBaseClass'] = 1;
         header("Content-Type: application/xml");
         header("Accept-Charset: UTF-8");
     } else {
         $path = $this->conf['view.']['create_event.']['template'];
         $page = $this->cObj->fileResource($path);
     }
     if ($page == '') {
         return \TYPO3\CMS\Cal\Utility\Functions::createErrorMessage('No create event template file found at: >' . $path . '<.', 'Please make sure the path is correct and that you included the static template for fe-editing.');
     }
     if (is_object($object) && !$object->isUserAllowedToEdit()) {
         return $this->controller->pi_getLL('l_not_allowed_edit') . $this->controller->pi_getLL('l_' . $this->objectString);
     } else {
         if (!is_object($object) && !$this->rightsObj->isAllowedTo('create', $this->objectString, '')) {
             return $this->controller->pi_getLL('l_not_allowed_create') . $this->objectString;
         }
     }
     $this->validation = '';
     $this->dateFormatArray = array();
     $this->dateFormatArray[$this->conf['dateConfig.']['dayPosition']] = 'dd';
     $this->dateFormatArray[$this->conf['dateConfig.']['monthPosition']] = 'mm';
     $this->dateFormatArray[$this->conf['dateConfig.']['yearPosition']] = 'yyyy';
     $this->getTemplateSubpartMarker($page, $sims, $rems, $wrapped, $this->conf['view']);
     $page = \TYPO3\CMS\Cal\Utility\Functions::substituteMarkerArrayNotCached($page, array(), $rems, $wrapped);
     $page = \TYPO3\CMS\Cal\Utility\Functions::substituteMarkerArrayNotCached($page, $sims, array(), array());
     $sims = array();
     $rems = array();
     $this->getTemplateSingleMarker($page, $sims, $rems, $this->conf['view']);
     $this->addAdditionalMarker($page, $sims, $rems);
     $page = \TYPO3\CMS\Cal\Utility\Functions::substituteMarkerArrayNotCached($page, array(), $rems, array());
     $page = \TYPO3\CMS\Cal\Utility\Functions::substituteMarkerArrayNotCached($page, $sims, array(), array());
     $sims = array_merge($requiredFieldsSims, $constrainFieldSims);
     return \TYPO3\CMS\Cal\Utility\Functions::substituteMarkerArrayNotCached($page, $sims, array(), array());
 }
예제 #2
0
파일: ListView.php 프로젝트: ulrikkold/cal
 function drawList(&$master_array, $page = '', $starttime, $endtime)
 {
     $this->starttime = $starttime;
     $this->endtime = $endtime;
     $this->objectsInList = array();
     if ($this->conf['activateFluid'] == 1) {
         $this->_init($master_array);
         return $this->renderWithFluid();
     }
     $this->initTemplate($page);
     $this->_init($master_array);
     if ($this->error) {
         return \TYPO3\CMS\Cal\Utility\Functions::createErrorMessage($this->errorMessage, $this->suggestMessage);
     }
     $listTemplate = $this->getListSubpart($page);
     if ($this->error) {
         return $this->errorMessage;
     }
     // ordering of the events
     switch (strtolower($this->conf['view.']['list.']['order'])) {
         default:
             $this->reverse = false;
             break;
         case 'desc':
             $this->reverse = true;
             break;
     }
     $rems = array();
     $sims = array();
     $middle = $this->processObjects($master_array, $sims, $rems);
     $listRems = array();
     $listRems['###PRE_LIST_TEMPLATE###'] = '';
     $listRems['###POST_LIST_TEMPLATE###'] = '';
     $sims['###FOUND###'] = '';
     if ($this->conf['view.']['list.']['enableSectionMenu']) {
         $this->initLocalCObject();
         $this->local_cObj->setCurrentVal($sectionMenu);
         $sims['###SECTION_MENU###'] = $this->local_cObj->cObjGetSingle($this->conf['view.']['list.']['sectionMenu'], $this->conf['view.']['list.']['sectionMenu.']);
     }
     $rems['###PAGEBROWSER###'] = '';
     if (!$middle) {
         $this->initLocalCObject();
         $middle = $this->local_cObj->cObjGetSingle($this->conf['view.']['list.']['event.']['noEventFound'], $this->conf['view.']['list.']['event.']['noEventFound.']);
     } else {
         if ($this->conf['view.']['list.']['enableDayWrapper']) {
             $middle .= $this->local_cObj->cObjGetSingle($this->conf['view.']['list.']['dayWrapperEnd'], $this->conf['view.']['list.']['dayWrapperEnd.']);
         }
         if ($this->conf['view.']['list.']['enableWeekWrapper']) {
             $middle .= $this->local_cObj->cObjGetSingle($this->conf['view.']['list.']['weekWrapperEnd'], $this->conf['view.']['list.']['weekWrapperEnd.']);
         }
         if ($this->conf['view.']['list.']['enableMonthWrapper']) {
             $middle .= $this->local_cObj->cObjGetSingle($this->conf['view.']['list.']['monthWrapperEnd'], $this->conf['view.']['list.']['monthWrapperEnd.']);
         }
         if ($this->conf['view.']['list.']['enableYearWrapper']) {
             $middle .= $this->local_cObj->cObjGetSingle($this->conf['view.']['list.']['yearWrapperEnd'], $this->conf['view.']['list.']['yearWrapperEnd.']);
         }
         // prepare pre- and post-list subparts
         $listRems['###PRE_LIST_TEMPLATE###'] = $this->cObj->getSubpart($page, '###PRE_LIST_TEMPLATE###');
         $listRems['###POST_LIST_TEMPLATE###'] = $this->cObj->getSubpart($page, '###POST_LIST_TEMPLATE###');
         $sims['###FOUND###'] = $this->cObj->stdWrap($this->count, $this->conf['view.']['list.']['found_stdWrap.']);
         // render pagebrowser
         if ($this->count > $this->recordsPerPage && $this->conf['view.']['list.']['pageBrowser.']['onlyShowIfNeeded'] || !$this->conf['view.']['list.']['pageBrowser.']['onlyShowIfNeeded']) {
             $pageBrowser = $this->cObj->getSubpart($page, '###PAGEBROWSER###');
             $rems['###PAGEBROWSER###'] = $this->getPageBrowser($pageBrowser);
         }
     }
     $rems['###LIST###'] = $middle;
     $listTemplate = \TYPO3\CMS\Cal\Utility\Functions::substituteMarkerArrayNotCached($listTemplate, array(), $listRems, array());
     $return = \TYPO3\CMS\Cal\Utility\Functions::substituteMarkerArrayNotCached($listTemplate, $sims, $rems, array());
     $rems = array();
     return $this->finish($return, $rems);
 }
예제 #3
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));
 }
예제 #4
0
 /**
  * Returns a specific event with a given serviceKey and UID.
  *
  * @param
  *        	string	The serviceKey to be searched in.
  * @param
  *        	integer	The UID to look up.
  * @return event event object matching the serviceKey and UID.
  */
 function create($serviceName, $type, $subtype)
 {
     /* Gets the model for the provided service key */
     $service = $this->getServiceObjByKey($serviceName, $subtype, $type);
     if (!is_object($service)) {
         return \TYPO3\CMS\Cal\Utility\Functions::createErrorMessage('Missing or wrong parameter. The object you are looking for could not be found.', 'Please verify your URL parameters: tx_cal_controller[type].');
     }
     /* Look up an event with a specific ID inside the model */
     $event = $service->createEvent(null, false);
     return $event;
 }
예제 #5
0
 /**
  * 
  * @return string
  */
 public function organizer()
 {
     $uid = $this->conf['uid'];
     $type = $this->conf['type'];
     $pidList = $this->conf['pidList'];
     $hookObjectsArr = $this->getHookObjectsArray('drawOrganizerClass');
     $modelObj =& \TYPO3\CMS\Cal\Utility\Registry::Registry('basic', 'modelcontroller');
     $availableTypes = $modelObj->getServiceTypes('cal_organizer_model', 'organizer');
     if (!in_array($type, $availableTypes)) {
         $type = '';
     }
     $organizer = $modelObj->findOrganizer($uid, $type, $pidList);
     if (!is_object($organizer)) {
         if (is_string($organizer)) {
             return $organizer;
         }
         return \TYPO3\CMS\Cal\Utility\Functions::createErrorMessage('Missing or wrong parameter. The organizer you are looking for could not be found.', 'Please verify your URL parameter: tx_cal_controller[uid]');
     }
     $relatedEvents =& $this->findRelatedEvents('organizer', ' AND organizer_id = ' . $uid);
     // Hook: preOrganizerRendering
     foreach ($hookObjectsArr as $hookObj) {
         if (method_exists($hookObj, 'preOrganizerRendering')) {
             $hookObj->preOrganizerRendering($organizer, $relatedEvents, $this);
         }
     }
     $viewObj =& \TYPO3\CMS\Cal\Utility\Registry::Registry('basic', 'viewcontroller');
     $drawnOrganizer = $viewObj->drawOrganizer($organizer, $relatedEvents);
     // Hook: postOrganizerRendering
     foreach ($hookObjectsArr as $hookObj) {
         if (method_exists($hookObj, 'postOrganizerRendering')) {
             $hookObj->postOrganizerRendering($drawnOrganizer, $organizer, $this);
         }
     }
     return $drawnOrganizer;
 }