/** * Returns all settings. * * @return array */ public function getSettings() { if ($this->settings === NULL) { $this->settings = $this->configurationManager->getConfiguration(Tx_Extbase_Configuration_ConfigurationManagerInterface::CONFIGURATION_TYPE_SETTINGS, 'News', 'Pi1'); } return $this->settings; }
/** * (non-PHPdoc) * * @see Tx_Fluid_Core_ViewHelper_AbstractTagBasedViewHelper::initialize() */ public function initialize() { // 1st param: must be 'Settings' // 2nd param: name of extension // 3rd param: name of plugin $this->settings = $this->configurationManager->getConfiguration('Settings', 'Hriseo', 'Robots'); }
/** * injectConfigurationManager * * @param Tx_Extbase_Configuration_ConfigurationManagerInterface $configurationManager * @return void */ public function injectConfigurationManager(Tx_Extbase_Configuration_ConfigurationManagerInterface $configurationManager) { $this->configurationManager = $configurationManager; $this->contentObj = $this->configurationManager->getContentObject(); $this->settings = $this->configurationManager->getConfiguration(Tx_Extbase_Configuration_ConfigurationManagerInterface::CONFIGURATION_TYPE_SETTINGS); // merge the storagePid into settings for the cache tags $frameworkConfiguration = $this->configurationManager->getConfiguration(Tx_Extbase_Configuration_ConfigurationManagerInterface::CONFIGURATION_TYPE_FRAMEWORK); $this->settings['storagePid'] = $frameworkConfiguration['persistence']['storagePid']; }
/** * Builds a data map by adding column maps for all the configured columns in the $TCA. * It also resolves the type of values the column is holding and the typo of relation the column * represents. * * @param string $className The class name you want to fetch the Data Map for * @return Tx_Extbase_Persistence_Mapper_DataMap The data map */ public function buildDataMap($className) { if (!class_exists($className)) { throw new Tx_Extbase_Persistence_Exception_InvalidClass('Could not find class definition for name "' . $className . '". This could be caused by a mis-spelling of the class name in the class definition.'); } $recordType = NULL; $subclasses = array(); $tableName = strtolower($className); $columnMapping = array(); $frameworkConfiguration = $this->configurationManager->getConfiguration(Tx_Extbase_Configuration_ConfigurationManagerInterface::CONFIGURATION_TYPE_FRAMEWORK); $classSettings = $frameworkConfiguration['persistence']['classes'][$className]; if ($classSettings !== NULL) { if (isset($classSettings['subclasses']) && is_array($classSettings['subclasses'])) { $subclasses = $classSettings['subclasses']; } if (isset($classSettings['mapping']['recordType']) && strlen($classSettings['mapping']['recordType']) > 0) { $recordType = $classSettings['mapping']['recordType']; } if (isset($classSettings['mapping']['tableName']) && strlen($classSettings['mapping']['tableName']) > 0) { $tableName = $classSettings['mapping']['tableName']; } $classHierachy = array_merge(array($className), class_parents($className)); foreach ($classHierachy as $currentClassName) { if (in_array($currentClassName, array('Tx_Extbase_DomainObject_AbstractEntity', 'Tx_Extbase_DomainObject_AbstractValueObject'))) { break; } $currentClassSettings = $frameworkConfiguration['persistence']['classes'][$currentClassName]; if ($currentClassSettings !== NULL) { if (isset($currentClassSettings['mapping']['columns']) && is_array($currentClassSettings['mapping']['columns'])) { $columnMapping = t3lib_div::array_merge_recursive_overrule($columnMapping, $currentClassSettings['mapping']['columns'], 0, FALSE); // FALSE means: do not include empty values form 2nd array } } } } $dataMap = new Tx_Extbase_Persistence_Mapper_DataMap($className, $tableName, $recordType, $subclasses); $dataMap = $this->addMetaDataColumnNames($dataMap, $tableName); // $classPropertyNames = $this->reflectionService->getClassPropertyNames($className); $tcaColumnsDefinition = $this->getColumnsDefinition($tableName); $tcaColumnsDefinition = t3lib_div::array_merge_recursive_overrule($tcaColumnsDefinition, $columnMapping); // TODO Is this is too powerful? foreach ($tcaColumnsDefinition as $columnName => $columnDefinition) { if (isset($columnDefinition['mapOnProperty'])) { $propertyName = $columnDefinition['mapOnProperty']; } else { $propertyName = t3lib_div::underscoredToLowerCamelCase($columnName); } // if (in_array($propertyName, $classPropertyNames)) { // TODO Enable check for property existance $columnMap = new Tx_Extbase_Persistence_Mapper_ColumnMap($columnName, $propertyName); $propertyMetaData = $this->reflectionService->getClassSchema($className)->getProperty($propertyName); $columnMap = $this->setRelations($columnMap, $columnDefinition['config'], $propertyMetaData); $dataMap->addColumnMap($columnMap); // } } // debug($dataMap); return $dataMap; }
/** * Creates a query object working on the given class name * * @param string $className The class name * @return Tx_Extbase_Persistence_QueryInterface */ public function create($className) { $query = $this->objectManager->create('Tx_Extbase_Persistence_QueryInterface', $className); $querySettings = $this->objectManager->create('Tx_Extbase_Persistence_Typo3QuerySettings'); $frameworkConfiguration = $this->configurationManager->getConfiguration(Tx_Extbase_Configuration_ConfigurationManagerInterface::CONFIGURATION_TYPE_FRAMEWORK); $querySettings->setStoragePageIds(t3lib_div::intExplode(',', $frameworkConfiguration['persistence']['storagePid'])); $query->setQuerySettings($querySettings); return $query; }
public function setUp() { parent::setUp(); $this->mockContentObject = $this->getMock('tslib_cObj', array(), array(), '', FALSE); $this->mockConfigurationManager = $this->getMock('Tx_Extbase_Configuration_ConfigurationManagerInterface'); $this->mockConfigurationManager->expects($this->any())->method('getContentObject')->will($this->returnValue($this->mockContentObject)); $this->viewHelper = $this->getMock('Tx_Fluid_ViewHelpers_Format_CropViewHelper', array('renderChildren')); $this->viewHelper->injectConfigurationManager($this->mockConfigurationManager); $this->viewHelper->expects($this->once())->method('renderChildren')->will($this->returnValue('Some Content')); }
/** * (non-PHPdoc) * * @see Tx_Fluid_Core_ViewHelper_AbstractTagBasedViewHelper::initialize() */ public function initialize() { $this->loc = new Tx_Fluid_Core_ViewHelper_TagBuilder(); $this->loc->setTagName('loc'); $this->lastmod = new Tx_Fluid_Core_ViewHelper_TagBuilder(); $this->lastmod->setTagName('lastmod'); $this->tagBuilder = new Tx_Fluid_Core_ViewHelper_TagBuilder(); // 1st param: must be 'Settings' // 2nd param: name of extension // 3rd param: name of plugin $this->settings = $this->configurationManager->getConfiguration('Settings', 'Hriseo', 'Sitemap'); }
/** * @return Tx_Doctrine2_Query */ public function create($className) { $query = new Tx_Doctrine2_Query($className); $query->injectEntityManager($this->manager->getEntityManager()); if (!$this->objectManager || !$this->configurationManager) { return $query; } $querySettings = $this->objectManager->create('Tx_Extbase_Persistence_QuerySettingsInterface'); $frameworkConfiguration = $this->configurationManager->getConfiguration(Tx_Extbase_Configuration_ConfigurationManagerInterface::CONFIGURATION_TYPE_FRAMEWORK); $querySettings->setStoragePageIds(t3lib_div::intExplode(',', $frameworkConfiguration['persistence']['storagePid'])); $query->setQuerySettings($querySettings); return $query; }
/** * Renders a record list as known from the TYPO3 list module * Note: This feature is experimental! * * @param icon string * @param event Tx_WoehrlSeminare_Domain_Model_Event * @return string the rendered record list */ public function render($icon = 'edit', Tx_WoehrlSeminare_Domain_Model_Event $event = NULL) { if ($event !== NULL) { $row['uid'] = $event->getUid(); $row['title'] = $event->getTitle(); $row['hidden'] = $event->getHidden(); } $frameworkConfiguration = $this->configurationManager->getConfiguration(Tx_Extbase_Configuration_ConfigurationManagerInterface::CONFIGURATION_TYPE_FRAMEWORK); $row['storagePid'] = $frameworkConfiguration['persistence']['storagePid']; switch ($icon) { case 'new': $content = $this->getNewIcon('tx_woehrlseminare_domain_model_event', $row); break; case 'edit': $content = $this->getEditIcon('tx_woehrlseminare_domain_model_event', $row); break; case 'hide': $content = $this->getHideIcon('tx_woehrlseminare_domain_model_event', $row); break; case 'geniusbar': $content = $this->getGeniusBarIcon($event); break; case 'icsinvitation': $content = $this->getIcsInvitationIcon($event); break; case 'onlineSurvey': $content = $this->getOnlineSurveyIcon($event); break; case 'datepicker': $content = $this->getDatePickerIcon(); break; } return $content; }
/** * Renders a record list as known from the TYPO3 list module * Note: This feature is experimental! * * @param string $tableName name of the database table * @param array $fieldList list of fields to be displayed. If empty, only the title column (configured in $TCA[$tableName]['ctrl']['title']) is shown * @param integer $storagePid by default, records are fetched from the storage PID configured in persistence.storagePid. With this argument, the storage PID can be overwritten * @param integer $levels corresponds to the level selector of the TYPO3 list module. By default only records from the current storagePid are fetched * @param string $filter corresponds to the "Search String" textbox of the TYPO3 list module. If not empty, only records matching the string will be fetched * @param integer $recordsPerPage amount of records to be displayed at once. Defaults to $TCA[$tableName]['interface']['maxSingleDBListItems'] or (if that's not set) to 100 * @param string $sortField table field to sort the results by * @param boolean $sortDescending if TRUE records will be sorted in descending order * @param boolean $readOnly if TRUE, the edit icons won't be shown. Otherwise edit icons will be shown, if the current BE user has edit rights for the specified table! * @param boolean $enableClickMenu enables context menu * @param string $clickTitleMode one of "edit", "show" (only pages, tt_content), "info" * @param boolean $alternateBackgroundColors if set, rows will have alternate background colors * @return string the rendered record list * @see localRecordList */ public function render($tableName, array $fieldList = array(), $storagePid = NULL, $levels = 0, $filter = '', $recordsPerPage = 0, $sortField = '', $sortDescending = FALSE, $readOnly = FALSE, $enableClickMenu = TRUE, $clickTitleMode = NULL, $alternateBackgroundColors = FALSE) { $pageinfo = t3lib_BEfunc::readPageAccess(t3lib_div::_GP('id'), $GLOBALS['BE_USER']->getPagePermsClause(1)); $dblist = t3lib_div::makeInstance('localRecordList'); $dblist->backPath = $GLOBALS['BACK_PATH']; $dblist->pageRow = $pageinfo; if ($readOnly === FALSE) { $dblist->calcPerms = $GLOBALS['BE_USER']->calcPerms($pageinfo); } $dblist->showClipboard = FALSE; $dblist->disableSingleTableView = TRUE; $dblist->clickTitleMode = $clickTitleMode; $dblist->alternateBgColors = $alternateBackgroundColors; $dblist->clickMenuEnabled = $enableClickMenu; if ($storagePid === NULL) { $frameworkConfiguration = $this->configurationManager->getConfiguration(Tx_Extbase_Configuration_ConfigurationManagerInterface::CONFIGURATION_TYPE_FRAMEWORK); $storagePid = $frameworkConfiguration['persistence']['storagePid']; } $dblist->start($storagePid, $tableName, (int) t3lib_div::_GP('pointer'), $filter, $levels, $recordsPerPage); $dblist->allFields = TRUE; $dblist->dontShowClipControlPanels = TRUE; $dblist->displayFields = FALSE; $dblist->setFields = array($tableName => $fieldList); $dblist->noControlPanels = TRUE; $dblist->sortField = $sortField; $dblist->sortRev = $sortDescending; $dblist->script = $_SERVER['REQUEST_URI']; $dblist->generateList(); return $dblist->HTMLcode; }
/** * @param Tx_Extbase_Configuration_ConfigurationManagerInterface $configurationManager * @return void */ public function injectConfigurationManager(Tx_Extbase_Configuration_ConfigurationManagerInterface $configurationManager) { $this->configurationManager = $configurationManager; $this->cObj = $this->configurationManager->getContentObject(); $this->typoScriptSetup = $this->configurationManager->getConfiguration(Tx_Extbase_Configuration_ConfigurationManagerInterface::CONFIGURATION_TYPE_FULL_TYPOSCRIPT); $this->settings = $this->typoScriptSetup['plugin.']['tx_powermail.']['settings.']['setup.']; $this->piVars = t3lib_div::_GP('tx_powermail_pi1'); }
/** * @test * @expectedException Tx_Extbase_MVC_Exception */ public function buildThrowsExceptionIfControllerConfigurationHasNoDefaultActionDefined() { $this->configuration['controllerConfiguration']['TheFirstController'] = array(); $this->mockConfigurationManager->expects($this->any())->method('getConfiguration')->will($this->returnValue($this->configuration)); $this->requestBuilder->injectConfigurationManager($this->mockConfigurationManager); $this->requestBuilder->build(); }
/** * Injects the Configuration Manager and is initializing the framework settings * * @param Tx_Extbase_Configuration_ConfigurationManagerInterface $configurationManager Instance of the Configuration Manager * @return void */ public function injectConfigurationManager(Tx_Extbase_Configuration_ConfigurationManagerInterface $configurationManager) { $this->configurationManager = $configurationManager; $tsSettings = $this->configurationManager->getConfiguration(Tx_Extbase_Configuration_ConfigurationManagerInterface::CONFIGURATION_TYPE_FRAMEWORK, 'news', 'news_pi1'); $originalSettings = $this->configurationManager->getConfiguration(Tx_Extbase_Configuration_ConfigurationManagerInterface::CONFIGURATION_TYPE_SETTINGS); // start override if (isset($tsSettings['settings']['overrideFlexformSettingsIfEmpty'])) { $overrideIfEmpty = t3lib_div::trimExplode(',', $tsSettings['settings']['overrideFlexformSettingsIfEmpty'], TRUE); foreach ($overrideIfEmpty as $key) { // if flexform setting is empty and value is available in TS if ((!isset($originalSettings[$key]) || empty($originalSettings[$key])) && isset($tsSettings['settings'][$key])) { $originalSettings[$key] = $tsSettings['settings'][$key]; } } } // Use stdWrap for given defined settings if (isset($originalSettings['useStdWrap']) && !empty($originalSettings['useStdWrap'])) { if (class_exists('Tx_Extbase_Service_TypoScriptService')) { $typoScriptService = t3lib_div::makeInstance('Tx_Extbase_Service_TypoScriptService'); } else { $typoScriptService = t3lib_div::makeInstance('Tx_Extbase_Utility_TypoScript'); } $typoScriptArray = $typoScriptService->convertPlainArrayToTypoScriptArray($originalSettings); $stdWrapProperties = t3lib_div::trimExplode(',', $originalSettings['useStdWrap'], TRUE); foreach ($stdWrapProperties as $key) { if (is_array($typoScriptArray[$key . '.'])) { $originalSettings[$key] = $this->configurationManager->getContentObject()->stdWrap($originalSettings[$key], $typoScriptArray[$key . '.']); } } } $this->settings = $originalSettings; }
/** * Determines whether the current action can be cached * * @param string $controllerName * @param string $actionName * @return boolean TRUE if the given action should be cached, otherwise FALSE */ protected function isCacheable($controllerName, $actionName) { $frameworkConfiguration = $this->configurationManager->getConfiguration(Tx_Extbase_Configuration_ConfigurationManagerInterface::CONFIGURATION_TYPE_FRAMEWORK); if (isset($frameworkConfiguration['controllerConfiguration'][$controllerName]['nonCacheableActions']) && in_array($actionName, $frameworkConfiguration['controllerConfiguration'][$controllerName]['nonCacheableActions'])) { return FALSE; } return TRUE; }
/** * Determine the storage page ID for a given NEW record * * This does the following: * - If there is a TypoScript configuration "classes.CLASSNAME.newRecordStoragePid", that is used to store new records. * - If there is no such TypoScript configuration, it uses the first value of The "storagePid" taken for reading records. * * @param Tx_Extbase_DomainObject_DomainObjectInterface $object * @return int the storage Page ID where the object should be stored */ protected function determineStoragePageIdForNewRecord(Tx_Extbase_DomainObject_DomainObjectInterface $object = NULL) { $frameworkConfiguration = $this->configurationManager->getConfiguration(Tx_Extbase_Configuration_ConfigurationManagerInterface::CONFIGURATION_TYPE_FRAMEWORK); if ($object !== NULL) { $className = get_class($object); if (isset($frameworkConfiguration['persistence']['classes'][$className]) && !empty($frameworkConfiguration['persistence']['classes'][$className]['newRecordStoragePid'])) { return (int) $frameworkConfiguration['persistence']['classes'][$className]['newRecordStoragePid']; } } $storagePidList = t3lib_div::intExplode(',', $frameworkConfiguration['persistence']['storagePid']); return (int) $storagePidList[0]; }
/** * Render * * @param string $path * @return mixed */ public function render($path = NULL) { if ($path === NULL) { $path = $this->renderChildren(); } if (!$path) { return NULL; } $all = $this->configurationManager->getConfiguration(Tx_Extbase_Configuration_ConfigurationManagerInterface::CONFIGURATION_TYPE_FULL_TYPOSCRIPT); $segments = explode('.', $path); $value = $all; foreach ($segments as $path) { if (isset($value[$path . '.'])) { $value = $value[$path . '.']; } else { $value = $value[$path]; } } if (is_array($value)) { $value = $this->convertTypoScriptArrayToPlainArray($value); } return $value; }
/** * @param string $table * @return string, * @api */ public function getObjectType($table) { $typoscript = $this->configurationManager->getConfiguration(Tx_Extbase_Configuration_ConfigurationManagerInterface::CONFIGURATION_TYPE_FULL_TYPOSCRIPT); $configuration = $typoscript['config.']['tx_extbase.']['persistence.']['classes.']; if (is_array($configuration)) { $configuration = Tx_Tool_Utility_ArrayUtility::convertTypoScriptArrayToPlainArray($configuration); foreach ($configuration as $objectType => $definition) { if ($definition['tableName'] === $table) { return $objectType; } } } return NULL; }
/** * Prepares $GLOBALS['TSFE'] for Backend mode * This somewhat hacky work around is currently needed because the getImgResource() function of tslib_cObj relies on those variables to be set * * @return void * @author Bastian Waidelich <*****@*****.**> */ protected function simulateFrontendEnvironment() { $this->tsfeBackup = isset($GLOBALS['TSFE']) ? $GLOBALS['TSFE'] : NULL; // set the working directory to the site root $this->workingDirectoryBackup = getcwd(); chdir(PATH_site); $typoScriptSetup = $this->configurationManager->getConfiguration(Tx_Extbase_Configuration_ConfigurationManagerInterface::CONFIGURATION_TYPE_FULL_TYPOSCRIPT); $GLOBALS['TSFE'] = new stdClass(); $template = t3lib_div::makeInstance('t3lib_TStemplate'); $template->tt_track = 0; $template->init(); $template->getFileName_backPath = PATH_site; $GLOBALS['TSFE']->tmpl = $template; $GLOBALS['TSFE']->tmpl->setup = $typoScriptSetup; $GLOBALS['TSFE']->config = $typoScriptSetup; }
/** * cover all cases: * 1. extend TYPO3 class like fe_users (no mapping table needed) * * @param Tx_ExtensionBuilder_Domain_Model_DomainObject $domainObject */ private function validateMapping(Tx_ExtensionBuilder_Domain_Model_DomainObject $domainObject) { $parentClass = $domainObject->getParentClass(); $tableName = $domainObject->getMapToTable(); $extensionPrefix = 'Tx_' . t3lib_div::underscoredToUpperCamelCase($domainObject->getExtension()->getExtensionKey()) . '_Domain_Model_'; if (!empty($parentClass)) { $classConfiguration = $this->configurationManager->getExtbaseClassConfiguration($parentClass); t3lib_div::devlog('class settings ' . $parentClass, 'extension_builder', 0, $classConfiguration); if (!isset($classConfiguration['tableName'])) { if (!$tableName) { $this->validationResult['errors'][] = new Tx_ExtensionBuilder_Domain_Exception_ExtensionException('Mapping configuration error in domain object ' . $domainObject->getName() . ': The mapping table could not be detected from Extbase Configuration. Please enter a table name', self::ERROR_MAPPING_NO_TABLE); } } else { // get the table name from the parent class configuration $tableName = $classConfiguration['tableName']; } if (!class_exists($parentClass, TRUE)) { $this->validationResult['errors'][] = new Tx_ExtensionBuilder_Domain_Exception_ExtensionException('Mapping configuration error in domain object ' . $domainObject->getName() . ': the parent class ' . $parentClass . 'seems not to exist ', self::ERROR_MAPPING_NO_PARENTCLASS); } } if ($tableName) { if (strpos($extensionPrefix, $tableName) !== FALSE) { // the domainObject extends a class of the same extension if (!$parentClass) { $this->validationResult['errors'][] = new Tx_ExtensionBuilder_Domain_Exception_ExtensionException('Mapping configuration error in domain object ' . $domainObject->getName() . ': you have to define a parent class if you map to a table of another domain object of the same extension ', self::ERROR_MAPPING_NO_PARENTCLASS); } } if (!isset($GLOBALS['TCA'][$tableName])) { $this->validationResult['errors'][] = new Tx_ExtensionBuilder_Domain_Exception_ExtensionException('There is no entry for table "' . $tableName . '" of ' . $domainObject->getName() . ' in TCA. For technical reasons you can only extend tables with TCA configuration.', self::ERROR_MAPPING_NO_TCA); } } if (isset($GLOBALS['TCA'][$tableName]['ctrl']['type'])) { $dataTypeRes = $GLOBALS['TYPO3_DB']->sql_query('DESCRIBE ' . $tableName); while ($row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($dataTypeRes)) { if ($row['Field'] == $GLOBALS['TCA'][$tableName]['ctrl']['type']) { if (strpos($row['Type'], 'int') !== FALSE) { $this->validationResult['warnings'][] = new Tx_ExtensionBuilder_Domain_Exception_ExtensionException('The configured type field for table "' . $tableName . '" is of type ' . $row['Type'] . '<br />This means the type field can not be used for defining the record type. <br />You have to configure the mappings yourself if you want to map to this<br /> table or extend the correlated class', self::ERROR_MAPPING_WRONG_TYPEFIELD_CONFIGURATION); } } } } }
/** * @return void */ protected function loadDefaultValues() { $configuration = $this->configurationManager->getConfiguration(Tx_Extbase_Configuration_ConfigurationManagerInterface::CONFIGURATION_TYPE_FRAMEWORK); if (empty($configuration['extensionName'])) { throw new Tx_Extbase_MVC_Exception('"extensionName" is not properly configured. Request can\'t be dispatched!', 1289843275); } if (empty($configuration['pluginName'])) { throw new Tx_Extbase_MVC_Exception('"pluginName" is not properly configured. Request can\'t be dispatched!', 1289843277); } $this->extensionName = $configuration['extensionName']; $this->pluginName = $configuration['pluginName']; $frameworkConfiguration = $this->configurationManager->getConfiguration(Tx_Extbase_Configuration_ConfigurationManagerInterface::CONFIGURATION_TYPE_FRAMEWORK); $controllerConfiguration = $frameworkConfiguration['controllerConfiguration']; $this->defaultControllerName = current(array_keys($controllerConfiguration)); $this->defaultActionName = current($controllerConfiguration[$this->defaultControllerName]['actions']); $allowedControllerActions = array(); foreach ($controllerConfiguration as $controllerName => $controllerActions) { $allowedControllerActions[$controllerName] = $controllerActions['actions']; } $this->allowedControllerActions = $allowedControllerActions; }
/** * makeStatisticsReportsCommand * * @param int stroagePid * @param string senderEmailAddress * @param string receiverEmailAddress list of receiver email addresses separated by comma * @return void */ public function makeStatisticsReportsCommand($storagePid, $senderEmailAddress = '', $receiverEmailAddress = '') { // do some init work... $this->initializeAction(); // abort if no storagePid is found if (!t3lib_utility_Math::canBeInterpretedAsInteger($storagePid)) { echo 'NO storagePid given. Please enter the storagePid in the scheduler task.'; exit(1); } // abort if no senderEmailAddress is found if (empty($senderEmailAddress)) { echo 'NO senderEmailAddress given. Please enter the senderEmailAddress in the scheduler task.'; exit(1); } // abort if no senderEmailAddress is found if (empty($receiverEmailAddress)) { echo 'NO receiverEmailAddress given. Please enter the receiverEmailAddress in the scheduler task.'; exit(1); } else { $receiverEmailAddress = explode(', ', $receiverEmailAddress); } // set storagePid to point extbase to the right repositories $configurationArray = array('persistence' => array('storagePid' => $storagePid)); $this->configurationManager->setConfiguration($configurationArray); // start the work... // 1. get the categories $categories = $this->categoryRepository->findAll(); foreach ($categories as $uid => $category) { $searchParameter['category'][$uid] = $uid; } // 2. get events of last month $startDateTime = strtotime('first day of last month 00:00:00'); $endDateTime = strtotime('last day of last month 23:59:59'); $allevents = $this->eventRepository->findAllByCategoriesAndDateInterval($searchParameter['category'], $startDateTime, $endDateTime); // used to name the csv file... $helper['nameto'] = strftime('%Y%m', $startDateTime); // email to all receivers... $out = $this->sendTemplateEmail($receiverEmailAddress, array($senderEmailAddress => 'WÖHRL Akademie - noreply'), 'Statistik Report Veranstaltungen: ' . ': ' . strftime('%x', $startDateTime) . ' - ' . strftime('%x', $endDateTime), 'Statistics', array('events' => $allevents, 'categories' => $categories, 'helper' => $helper, 'attachCsv' => TRUE, 'attachIcs' => FALSE)); return; }
/** * Copies the specified parseFunc configuration to $GLOBALS['TSFE']->tmpl->setup in Backend mode * This somewhat hacky work around is currently needed because the parseFunc() function of tslib_cObj relies on those variables to be set * * @return void * @author Bastian Waidelich <*****@*****.**> */ protected function simulateFrontendEnvironment() { $this->tsfeBackup = isset($GLOBALS['TSFE']) ? $GLOBALS['TSFE'] : NULL; $GLOBALS['TSFE'] = new stdClass(); $GLOBALS['TSFE']->tmpl->setup = $this->configurationManager->getConfiguration(Tx_Extbase_Configuration_ConfigurationManagerInterface::CONFIGURATION_TYPE_FULL_TYPOSCRIPT); }
/** * Life-cycle method that is called by the DI container as soon as this object is completely built * * @return void */ public function initializeObject() { $this->contentObject = $this->configurationManager->getContentObject(); }
/** * Returns TRUE if what we are outputting may be cached * * @return boolean */ protected function isCached() { $userObjType = $this->configurationManager->getContentObject()->getUserObjectType(); return $userObjType !== \TYPO3\CMS\Frontend\ContentObject\ContentObjectRenderer::OBJECTTYPE_USER_INT; }
public function checkEvent($params, $obj) { $this->initializeAction(); $frameworkConfiguration = $this->configurationManager->getConfiguration(Tx_Extbase_Configuration_ConfigurationManagerInterface::CONFIGURATION_TYPE_FRAMEWORK, 'woehrlSeminare', 'Eventlist'); //~ t3lib_utility_Debug::debug($params, 'addInformation: params: '); $gp = t3lib_div::_GP('tx_powermail_pi1'); $formUid = $gp['form']; $form = $this->formsRepository->findByUid($formUid); if (!method_exists($form, 'getPages')) { return $this->isValid = FALSE; } foreach ($form->getPages() as $page) { // every page in current form foreach ($page->getFields() as $field) { // every field in current page switch ($field->getMarker()) { case 'action': $action = $params[$field->getUid()]; break; case 'editcode': $editcode = $params[$field->getUid()]; break; case 'event': $formIdEvent = $field->getUid(); $eventId = $params[$formIdEvent]; break; case 'eventtitle': $formIdEventtitle = $field->getUid(); break; } } } //~ t3lib_utility_Debug::debug($editcode, 'checkEvent: editcode... '); switch ($action) { case 'delete': //~ $subscriber = $this->subscriberRepository->findAllByFeuser($frameworkConfiguration['persistence']['storagePid'])->getFirst(); $subscriber = $this->subscriberRepository->findAllByEditcode($editcode, $frameworkConfiguration['persistence']['storagePid'])->getFirst(); if (empty($subscriber)) { t3lib_utility_Debug::debug($subscriber, 'checkEvent: NO subscriber found... '); $obj->isValid = FALSE; // we have to use the language labels of powermail :-( // --> for validationerror_validation: $obj->setError('validation', $idEventTitle); break; } //~ t3lib_utility_Debug::debug($subscriber, 'saveSubscription: delete... '); $event = $this->eventRepository->findByUid($eventId); if (empty($event)) { $obj->isValid = FALSE; // we have to use the language labels of powermail :-( // --> for validationerror_validation: $obj->setError('validation', $idEventTitle); break; } $event->removeSubscriber($subscriber); break; case 'new': if ($eventId > 0) { $event = $this->eventRepository->findByUid($eventId); // limit reached already --> overbooked if (count($event->getSubscribers()) >= $event->getMaxSubscriber()) { $obj->isValid = FALSE; // we have to use the language labels of powermail :-( // --> for validationerror_validation: $obj->setError('validation', $idEventTitle); } } break; default: return; } return; //~ t3lib_utility_Debug::debug($eventId , 'checkEvent: eventId'); if ($eventId > 0) { $event = $this->eventRepository->findByUid($eventId); // limit reached already --> overbooked if (count($event->getSubscribers()) >= $event->getMaxSubscriber()) { $obj->isValid = FALSE; // we have to use the language labels of powermail :-( // --> for validationerror_validation: $obj->setError('validation', $idEventTitle); } } return; }
/** * Returns a list of all registered request handlers. * * @return array */ public function getRegisteredRequestHandlerClassNames() { $settings = $this->configurationManager->getConfiguration(Tx_Extbase_Configuration_ConfigurationManagerInterface::CONFIGURATION_TYPE_FRAMEWORK); return is_array($settings['mvc']['requestHandlers']) ? $settings['mvc']['requestHandlers'] : array(); }
/** * Getter for the controller object name * * @return string * @author Robert Lemke <*****@*****.**> */ public function getControllerObjectName() { $frameworkConfiguration = $this->configurationManager->getConfiguration(Tx_Extbase_Configuration_ConfigurationManagerInterface::CONFIGURATION_TYPE_FRAMEWORK); return 'Tx_' . $frameworkConfiguration['extensionName'] . '_Controller_' . $this->action; }
/** * Initializes this service * * @return void */ public function initialize() { if ($this->initialized) { throw new Tx_Extbase_Reflection_Exception('The Reflection Service can only be initialized once.', 1232044696); } $frameworkConfiguration = $this->configurationManager->getConfiguration(Tx_Extbase_Configuration_ConfigurationManagerInterface::CONFIGURATION_TYPE_FRAMEWORK); $this->cacheIdentifier = 'ReflectionData_' . $frameworkConfiguration['extensionName']; $this->loadFromCache(); $this->initialized = TRUE; }
/** * @param Tx_Extbase_Configuration_ConfigurationManagerInterface $configurationManager * @return void */ public function injectConfigurationManager(Tx_Extbase_Configuration_ConfigurationManagerInterface $configurationManager) { $this->configurationManager = $configurationManager; $this->contentObject = $this->configurationManager->getContentObject(); }
/** * Returns TRUE if what we are outputting may be cached * * DEPRECATED - but will be moved to a more suitable location such as a possible * cache manager or other Service. * * @return boolean * @deprecated */ public function isCached() { $userObjType = $this->configurationManager->getContentObject()->getUserObjectType(); return $userObjType !== tslib_cObj::OBJECTTYPE_USER_INT; }