/** * helping function to get a translation of a string * * @param string $key * @return string */ protected function getLL($key) { if (is_null($this->extensionName)) { $this->extensionName = $this->controllerContext->getRequest()->getControllerExtensionName(); } return Tx_Extbase_Utility_Localization::translate($key, $this->extensionName); }
protected function getPages($includeDescription = true) { $values = array(0 => $this->localization->translate('page', $this->extensionName), 1 => $this->localization->translate('page1', $this->extensionName), 2 => $this->localization->translate('page2', $this->extensionName), 3 => $this->localization->translate('page3', $this->extensionName), 4 => $this->localization->translate('page4', $this->extensionName), 5 => $this->localization->translate('page5', $this->extensionName)); if (!$includeDescription) { unset($values[0]); } return $values; }
/** * helper function to use localized strings in BlogExample controllers * * @param string $key locallang key * @param string $default the default message to show if key was not found * @return string */ protected function translate($key, $defaultMessage = '') { $message = Tx_Extbase_Utility_Localization::translate($key, 'BlogExample'); if ($message === NULL) { $message = $defaultMessage; } return $message; }
/** * Checks whether the given blog is valid * * @param Tx_BlogExample_Domain_Model_Blog $blog The blog * @return boolean TRUE if blog could be validated, otherwise FALSE */ public function isValid($blog) { if (strtolower($blog->getTitle()) === 'extbase') { $this->addError(Tx_Extbase_Utility_Localization::translate('error.Blog.invalidTitle', 'BlogExample'), 1297418974); return FALSE; } return TRUE; }
/** * Translate a given key or use the tag body as default. * * @param string $key The locallang key * @param string $default if the given locallang key could not be found, this value is used. . If this argument is not set, child nodes will be used to render the default * @param boolean $htmlEscape TRUE if the result should be htmlescaped. This won't have an effect for the default value * @param array $arguments Arguments to be replaced in the resulting string * @return string The translated key or tag body if key doesn't exist * @author Christopher Hlubek <*****@*****.**> * @author Bastian Waidelich <*****@*****.**> */ public function render($key, $default = NULL, $htmlEscape = TRUE, array $arguments = NULL) { $request = $this->controllerContext->getRequest(); $extensionName = $request->getControllerExtensionName(); $value = Tx_Extbase_Utility_Localization::translate($key, $extensionName, $arguments); if ($value === NULL) { $value = $default !== NULL ? $default : $this->renderChildren(); } elseif ($htmlEscape) { $value = htmlspecialchars($value); } return $value; }
/** * If the given event is valid * * @param Tx_CalendarDisplay_Domain_Model_Event $event * @return boolean true */ public function isValid($event) { $isValid = TRUE; if ($event->getTimeBegin() == NULL || $event->getTimeBegin() == '') { $this->addError(\TYPO3\CMS\Extbase\Utility\LocalizationUtility::translate('tx_calendardisplay_domain_model_event.time_begin.required', 'CalendarDisplay'), 2); $isValid = FALSE; } if ($event->getTimeEnd() == NULL || $event->getTimeEnd() == '') { $this->addError(Tx_Extbase_Utility_Localization::translate('tx_calendardisplay_domain_model_event.time_end.required', 'CalendarDisplay'), 2); $isValid = FALSE; } return $isValid; }
/** * This method is designed to return some additional information about the task, * that may help to set it apart from other tasks from the same class * This additional information is used - for example - in the Scheduler's BE module * This method should be implemented in most task classes * * @return string Information to display */ public function getAdditionalInformation() { $objectManager = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('Tx_Extbase_Object_ObjectManager'); $newsletterRepository = $objectManager->get('Tx_Newsletter_Domain_Repository_NewsletterRepository'); $emailNotSentCount = 0; $newsletters = $newsletterRepository->findAllReadyToSend(); $newsletterCount = count($newsletters); foreach ($newsletters as $newsletter) { $emailNotSentCount += $newsletter->getEmailNotSentCount(); } $emailsPerRound = Tx_Newsletter_Tools::confParam('mails_per_round'); return Tx_Extbase_Utility_Localization::translate('task_send_emails_additional_information', 'newsletter', array($emailsPerRound, $emailNotSentCount, $newsletterCount)); }
/** * Gets additional fields to render in the form to add/edit a task * * @param array $taskInfo * @param tx_scheduler_Task $task * @param tx_scheduler_Module $schedulerModule * @return array A two dimensional array, array('Identifier' => array('fieldId' => array('code' => '', * 'label' => '', 'cshKey' => '', 'cshLabel' => '')) */ public function getAdditionalFields(array &$taskInfo, $task, tx_scheduler_Module $schedulerModule) { $additionalFields = array(); // adds field for setting file path for CSV file to import $importFile = ''; $membershipStoragePid = 0; if ($task instanceof tx_scheduler_Task) { $importFile = htmlspecialchars($task->getImportFile()); $membershipStoragePid = (int) $task->getMembershipStoragePid(); } $additionalFields['importFile'] = array('code' => '<input type="text" name="tx_scheduler[importFile]" value="' . $importFile . '" />', 'label' => Tx_Extbase_Utility_Localization::translate('importFile', 't3o_membership')); // adds field for setting storage PID $additionalFields['storagePid'] = array('code' => '<input type="text" name="tx_scheduler[storagePid]" value="' . $membershipStoragePid . '" />', 'label' => Tx_Extbase_Utility_Localization::translate('storagePid', 't3o_membership')); return $additionalFields; }
/** * @param string $message * @param integer $code * @param Exception $previous */ public function __construct($message, $code, Exception $previous = null) { $this->findTranslationSubKeyByExceptionClassName(); // Build the locallang label index $translationKey = 'error.'; if ($this->subKey !== null) { $translationKey .= $this->subKey . '.'; } $translationKey .= $code; // Get the translated message $translated = Tx_Extbase_Utility_Localization::translate($translationKey, 'ExtbaseBuilder'); if (!empty($translated)) { $message = $translated; } parent::__construct($message, $code); }
/** * * @param mixed $dummy * is empty because the property is not in $_REQUEST but in * $_FILES * @return boolean */ public function isValid($dummy) { $property = $this->options['property']; if ($_FILES['tx_feupload_upload']['tmp_name'][$property][$property]) { $extConf = unserialize($GLOBALS['TYPO3_CONF_VARS']['EXT']['extConf']['feupload']); // This is not really a security check, but it does what it should. preg_match('/(.*)\\.([^\\.]*$)/', $_FILES['tx_feupload_upload']['name'][$property][$property], $matches); $ext = strtolower($matches[2]); if (in_array($ext, explode(',', $extConf['allowedFileExtensions']))) { return true; } else { $this->errors[] = new Tx_Extbase_Validation_Error(Tx_Extbase_Utility_Localization::translate('error.' . $property . 'WrongFileType.message', 'feupload'), 1332941667); return false; } } else { $this->errors[] = new Tx_Extbase_Validation_Error(Tx_Extbase_Utility_Localization::translate('error.' . $property . 'Empty.message', 'feupload'), 1332507175); return false; } }
/** * Performs the connection test for the selected service and passes the appropriate results to the view * * @param string $service Key of the service to test * @param string $parameters Parameters for the service being tested * @param integer $format Type of format to use (0 = raw, 1 = array, 2 = xml) * @return string Result from the test */ protected function performTest($service, $parameters, $format) { $result = ''; // Get the corresponding service object from the repository $serviceObject = $this->connectorRepository->findServiceByKey($service); if ($serviceObject->init()) { $parameters = $this->parseParameters($parameters); try { // Call the right "fetcher" depending on chosen format switch ($format) { case 1: $result = $serviceObject->fetchArray($parameters); break; case 2: $result = $serviceObject->fetchXML($parameters); break; default: $result = $serviceObject->fetchRaw($parameters); break; } // If the result is empty, issue an information message if (empty($result)) { /** @var $messageObject t3lib_FlashMessage */ $messageObject = t3lib_div::makeInstance('t3lib_FlashMessage', Tx_Extbase_Utility_Localization::translate('no.result', 'svconnector'), '', t3lib_FlashMessage::INFO); t3lib_FlashMessageQueue::addMessage($messageObject); } } catch (Exception $e) { /** @var $messageObject t3lib_FlashMessage */ $messageObject = t3lib_div::makeInstance('t3lib_FlashMessage', Tx_Extbase_Utility_Localization::translate('service.error', 'svconnector', array($e->getMessage(), $e->getCode())), '', t3lib_FlashMessage::ERROR); t3lib_FlashMessageQueue::addMessage($messageObject); } } return $result; }
/** * action create * @param Tx_T3oSlack_Domain_Model_SlackUser $newSlackUser * @return void */ public function createAction(Tx_T3oSlack_Domain_Model_SlackUser $newSlackUser) { // Initialize options for REST interface $adb_url = $this->settings['Slack']['TeamUrl']; $adb_option_defaults = array(CURLOPT_HEADER => false, CURLOPT_RETURNTRANSFER => true, CURLOPT_TIMEOUT => 2); $adb_handle = curl_init(); $options = array(CURLOPT_URL => $adb_url . '/api/users.admin.invite', CURLOPT_CUSTOMREQUEST => 'POST', CURLOPT_POSTFIELDS => 'email=' . urlencode($newSlackUser->getEmail()) . '&first_name=' . urlencode($newSlackUser->getFirstname()) . '&last_name=' . urlencode($newSlackUser->getLastname()) . '&token=' . $this->settings['Slack']['token'] . '&set_active=true'); curl_setopt_array($adb_handle, $options + $adb_option_defaults); // send request and wait for responce $responce = json_decode(curl_exec($adb_handle), true); switch ($responce['error']) { case 'already_in_team': $this->flashMessageContainer->add(Tx_Extbase_Utility_Localization::translate('tx_t3oslack.existingAccount', $this->extensionName) . $newSlackUser->getEmail()); break; case 'missing_scope': $this->flashMessageContainer->add(Tx_Extbase_Utility_Localization::translate('tx_t3oslack.apiKeyMissing', $this->extensionName)); break; default: if ($responce['error']) { $message = ' Error code: ' . $responce['error']; } $this->flashMessageContainer->add(Tx_Extbase_Utility_Localization::translate('tx_t3oslack.noConnection', $this->extensionName) . $message); break; } if ($responce['ok'] == 1) { $this->flashMessageContainer->add(Tx_Extbase_Utility_Localization::translate('tx_t3oslack.userCreated', $this->extensionName)); } }
/** * Returns an array with names of content columns for the given TypoScript * * @param string $typoScript * @return array */ private function getContentColsFromTs($typoScript) { $parser = t3lib_div::makeInstance('t3lib_TSparser'); $parser->parse($typoScript); $data = $parser->setup['backend_layout.']; $contentCols = array(); $contentCols[''] = Tx_Extbase_Utility_Localization::translate('label_select', 'sf_tv2fluidge'); if ($data) { foreach ($data['rows.'] as $row) { foreach ($row['columns.'] as $column) { $contentCols[$column['colPos']] = $column['name']; } } } return $contentCols; }
/** * Sends an email to the address configured in extension settings when a recipient unsubscribe * @param Tx_Newsletter_Domain_Model_Newsletter $newsletter * @param Tx_Newsletter_Domain_Model_RecipientList $recipientList * @param Tx_Newsletter_Domain_Model_Email $email * @return void */ protected function notifyUnsubscribe($newsletter, $recipientList, Tx_Newsletter_Domain_Model_Email $email) { $notificationEmail = Tx_Newsletter_Tools::confParam('notification_email'); // Use the page-owner as user if ($notificationEmail == 'user') { $rs = $GLOBALS['TYPO3_DB']->sql_query("SELECT email\n\t\t\tFROM be_users\n\t\t\tLEFT JOIN pages ON be_users.uid = pages.perms_userid\n\t\t\tWHERE pages.uid = " . $newsletter->getPid()); list($notificationEmail) = $GLOBALS['TYPO3_DB']->sql_fetch_row($rs); } // If cannot find valid email, don't send any notification if (!\TYPO3\CMS\Core\Utility\GeneralUtility::validEmail($notificationEmail)) { return; } // Build email texts $baseUrl = 'http://' . $newsletter->getDomain(); $urlRecipient = $baseUrl . '/typo3/alt_doc.php?&edit[tx_newsletter_domain_model_email][' . $email->getUid() . ']=edit'; $urlRecipientList = $baseUrl . '/typo3/alt_doc.php?&edit[tx_newsletter_domain_model_recipientlist][' . $recipientList->getUid() . ']=edit'; $urlNewsletter = $baseUrl . '/typo3/alt_doc.php?&edit[tx_newsletter_domain_model_newsletter][' . $newsletter->getUid() . ']=edit'; $subject = Tx_Extbase_Utility_Localization::translate('unsubscribe_notification_subject', 'newsletter'); $body = Tx_Extbase_Utility_Localization::translate('unsubscribe_notification_body', 'newsletter', array($email->getRecipientAddress(), $urlRecipient, $recipientList->getTitle(), $urlRecipientList, $newsletter->getTitle(), $urlNewsletter)); // Actually sends email $message = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Core\\Mail\\MailMessage'); $message->setTo($notificationEmail)->setFrom(array($newsletter->getSenderEmail() => $newsletter->getSenderName()))->setSubject($subject)->setBody($body, 'text/html'); $message->send(); }
/** * Filter available item by some parameters category and keyword * * @param Tx_CalendarDisplay_Domain_Model_Event $event the Event to display * @param integer $category the Category to be filter * @param string $keyword the Keyword * @param string $dateBegin the dateBegin * @param string $dateEnd the dateEnd * @return void */ public function filterResourcesAction($event = NULL, $category = NULL, $keyword = '', $dateBegin = NULL, $dateEnd = NULL) { $dateBegin = strtotime($dateBegin); $dateEnd = strtotime($dateEnd); if ($dateBegin <= $dateEnd) { $events = $this->eventRepository->findAllByTimeRange($dateBegin, $dateEnd); $this->view->assign('availableResources', $this->resourceRepository->findAvailable($events, $category, $keyword)); } else { $this->view->assign('message', Tx_Extbase_Utility_Localization::translate('date_error', 'CalendarDisplay')); $this->view->assign('messageType', 'error'); $this->view->assign('availableResources', array()); } }
/** * Initializes the current action * * @return void */ protected function initializeAction() { $this->div = t3lib_div::makeInstance('Tx_Powermail_Utility_Div'); Tx_Powermail_Utility_Div::mergeTypoScript2FlexForm($this->settings, 'Pi2'); // merge typoscript to flexform $this->piVars = $this->request->getArguments(); // check if ts is included if (!isset($this->settings['staticTemplate'])) { $this->flashMessageContainer->add(Tx_Extbase_Utility_Localization::translate('error_no_typoscript_pi2', 'powermail')); } }
/** * @param array $password Associate array with the following keys. * cur - Current password * new - New password * check - Confirmed new password * @validate $password Tx_Ajaxlogin_Domain_Validator_PasswordsValidator * @return string */ public function doChangePasswordAction(array $password) { $errors = array(); $currentUser = $this->userRepository->findCurrent(); if (isset($password['cur']) && isset($password['new']) && isset($password['check'])) { $plainTextPassword = $password['cur']; $encryptedPassword = $currentUser->getPassword(); if (Tx_Ajaxlogin_Utility_Password::validate($plainTextPassword, $encryptedPassword)) { $saltedPassword = Tx_Ajaxlogin_Utility_Password::salt($password['new']); $currentUser->setPassword($saltedPassword); // redirect (if configured) or show static success text $redirectPageId = intval($this->settings['page']['passwordChangeSuccess']); if ($redirectPageId > 0) { $this->redirectToPage($redirectPageId); } else { return Tx_Extbase_Utility_Localization::translate('password_updated', 'ajaxlogin'); } } else { $errors['current_password'] = Tx_Extbase_Utility_Localization::translate('password_invalid', 'ajaxlogin'); } } $this->forward('changePassword', null, null, array('errors' => $errors)); }
/** * Returns the New Icon with link * * @param string $table Table name * @param array $row Data row * @return string html output */ protected function getHideIcon($table, array $row) { $doc = $this->getDocInstance(); if ($row['hidden']) { $title = Tx_Extbase_Utility_Localization::translate('be.unhideEvent', 'woehrl_seminare', $arguments = NULL); $params = '&data[' . $table . '][' . $row['uid'] . '][hidden]=0'; $icon = '<a href="#" onclick="' . htmlspecialchars('return jumpToUrl(\'' . $doc->issueCommand($params, -1) . '\');') . '" title="' . $title . '">' . t3lib_iconWorks::getSpriteIcon('actions-edit-unhide') . '</a>'; // Hide } else { $title = Tx_Extbase_Utility_Localization::translate('be.hideEvent', 'woehrl_seminare', $arguments = NULL); $params = '&data[' . $table . '][' . $row['uid'] . '][hidden]=1'; $icon = '<a href="#" onclick="' . htmlspecialchars('return jumpToUrl(\'' . $doc->issueCommand($params, -1) . '\');') . '" title="' . $title . '">' . t3lib_iconWorks::getSpriteIcon('actions-edit-hide') . '</a>'; } return $icon; }
/** * This method loads the locallang.xml file (default language), and * adds all keys found in it to the TYPO3.settings.extension_builder._LOCAL_LANG object * translated into the current language * * Dots in a key are replaced by a _ * * Example: * error.name becomes TYPO3.settings.extension_builder._LOCAL_LANG.error_name * * @return void */ private function setLocallangSettings() { $LL = t3lib_div::readLLfile('EXT:extension_builder/Resources/Private/Language/locallang.xml', 'default'); if (!empty($LL['default']) && is_array($LL['default'])) { foreach ($LL['default'] as $key => $value) { $this->pageRenderer->addInlineSetting('extensionBuilder._LOCAL_LANG', str_replace('.', '_', $key), Tx_Extbase_Utility_Localization::translate($key, 'extension_builder')); } } }
/** * Initializes the current action * * @return void */ protected function initializeAction() { $this->cObj = $this->configurationManager->getContentObject(); $typoScriptSetup = $this->configurationManager->getConfiguration(Tx_Extbase_Configuration_ConfigurationManagerInterface::CONFIGURATION_TYPE_FULL_TYPOSCRIPT); $this->conf = $typoScriptSetup['plugin.']['tx_powermail.']['settings.']['setup.']; $this->div = t3lib_div::makeInstance('Tx_Powermail_Utility_Div'); Tx_Powermail_Utility_Div::mergeTypoScript2FlexForm($this->settings); // merge typoscript to flexform (if flexform field also exists and is empty, take typoscript part) $this->signalSlotDispatcher->dispatch(__CLASS__, __FUNCTION__ . 'Settings', array($this)); // check if ts is included if (!isset($this->settings['staticTemplate'])) { $this->flashMessageContainer->add(Tx_Extbase_Utility_Localization::translate('error_no_typoscript', 'powermail')); } // Debug Output if ($this->settings['debug']['settings']) { t3lib_utility_Debug::debug($this->settings, 'powermail debug: Show Settings'); } }
/** * Adds the wizard icon * * @param array Input array with wizard items for plugins * @return array Modified input array, having the item for the plugin added. */ function proc($wizardItems) { $wizardItems['plugins_tx_nbowishlist_display'] = array('icon' => t3lib_extMgm::extRelPath('nbowishlist') . 'Resources/Public/Icons/be_wizard.gif', 'title' => Tx_Extbase_Utility_Localization::translate("backend.wizard", "nbowishlist", NULL), 'description' => Tx_Extbase_Utility_Localization::translate("backend.wizard.description", "nbowishlist", NULL), 'params' => '&defVals[tt_content][CType]=list&defVals[tt_content][list_type]=nbowishlist_whishlist'); return $wizardItems; }
/** * Sets the currently active language/language_alt keys. * Default values are "default" for language key and "" for language_alt key. * * @return void * @author Christopher Hlubek <*****@*****.**> * @author Bastian Waidelich <*****@*****.**> */ protected function setLanguageKeys() { self::$languageKey = 'default'; self::$alternativeLanguageKey = ''; if (TYPO3_MODE === 'FE') { if (isset($GLOBALS['TSFE']->config['config']['language'])) { self::$languageKey = $GLOBALS['TSFE']->config['config']['language']; if (isset($GLOBALS['TSFE']->config['config']['language_alt'])) { self::$alternativeLanguageKey = $GLOBALS['TSFE']->config['config']['language_alt']; } } } elseif (strlen($GLOBALS['BE_USER']->uc['lang']) > 0) { self::$languageKey = $GLOBALS['BE_USER']->uc['lang']; } }
/** * Shortcut function for fetching language labels * * @param $key * @param $arguments * @return string */ public function ll($key, $arguments = NULL) { return $this->translator->translate($key, 'smoothmigration', $arguments); }
/** * Deletes a file * * @param Tx_Feupload_Domain_Model_File $file * $file * @return void */ public function deleteAction(Tx_Feupload_Domain_Model_File $file) { if ($file->getDeletable()) { $this->fileRepository->remove($file); $this->flashMessageContainer->add(Tx_Extbase_Utility_Localization::translate('LLL:EXT:feupload/Resources/Private/Language/locallang.xml:flash.ok.file.deleted.content'), Tx_Extbase_Utility_Localization::translate('LLL:EXT:feupload/Resources/Private/Language/locallang.xml:flash.ok.file.deleted.title'), t3lib_FlashMessage::OK); } else { $this->flashMessageContainer->add(Tx_Extbase_Utility_Localization::translate('LLL:EXT:feupload/Resources/Private/Language/locallang.xml:flash.error.file.not_deleted.content'), Tx_Extbase_Utility_Localization::translate('LLL:EXT:feupload/Resources/Private/Language/locallang.xml:flash.error.file.not_deleted.title', array($file->getTitle())), t3lib_FlashMessage::ERROR); } $this->redirect('index'); }
/** * Translate a given local lang reference. * * @param string $lll The local lang reference LLL:EXT:ext/locallang_db.xml:some.key. If no LLL: is present, the $lll value is returned. * @return string The translated text. */ protected function translate($lll) { if (substr($lll, 0, 4) !== 'LLL:') { return $lll; } return Tx_Extbase_Utility_Localization::translate($lll, ''); }
/** * action base * */ public function baseAction() { if( TYPO3_MODE != 'FE' ) { return; } $files = array( ); // compiler activated? if( $this->configuration['other']['activateCompiler'] ) { // folders defined? if( $this->lessfolder && $this->outputfolder ) { // are there files in the defined less folder? if( t3lib_div::getFilesInDir( $this->lessfolder, "less", TRUE ) ) { $files = t3lib_div::getFilesInDir( $this->lessfolder, "less", TRUE ); } else { echo Tx_T3Less_Utility_Utilities::wrapErrorMessage( Tx_Extbase_Utility_Localization::translate( 'noLessFilesInFolder', $this->extensionName, $arguments = array( 's' => $this->lessfolder ) ) ); } } else { echo Tx_T3Less_Utility_Utilities::wrapErrorMessage( Tx_Extbase_Utility_Localization::translate( 'emptyPathes', $this->extensionName ) ); } } /* Hook to pass less-files from other extension, see manual */ if( isset( $GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['t3less']['addForeignLessFiles'] ) ) { foreach( $GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['t3less']['addForeignLessFiles'] as $hookedFilePath ) { $hookPath = Tx_T3Less_Utility_Utilities::getPath( $hookedFilePath ); $files[] = t3lib_div::getFilesInDir( $hookPath, "less", TRUE ); } $files = Tx_T3Less_Utility_Utilities::flatArray( null, $files ); } switch( $this->configuration['enable']['mode'] ) { case 'PHP-Compiler': $controller = t3lib_div::makeInstance( 'Tx_T3Less_Controller_LessPhpController' ); $controller->lessPhp( $files ); break; case 'JS-Compiler': $controller = t3lib_div::makeInstance( 'Tx_T3Less_Controller_LessJsController' ); $controller->lessJs( $files ); break; case 'JS-Compiler via Node.js': $controller = t3lib_div::makeInstance( 'Tx_T3Less_Controller_LessJsNodeController' ); if( $controller->isLesscInstalled() ) { $controller->lessc( $files ); } else { echo Tx_T3Less_Utility_Utilities::wrapErrorMessage( Tx_Extbase_Utility_Localization::translate( 'lesscRequired', $this->extensionName ) ); } break; } }
/** * Deletes a folder * * @param Tx_Feupload_Domain_Model_Folder $folder * @return void */ public function deleteAction(Tx_Feupload_Domain_Model_Folder $folder) { $parentId = $folder->getParent(); if ($folder->isDeletable()) { $this->folderRepository->remove($folder); /* @var $sessionHandler Tx_Feupload_Session_Folder */ $sessionHandler = t3lib_div::makeInstance('Tx_Feupload_Session_Folder'); $sessionHandler->writeToSession($parentId); $this->flashMessageContainer->add(Tx_Extbase_Utility_Localization::translate('LLL:EXT:feupload/Resources/Private/Language/locallang.xml:flash.ok.folder.deleted.title'), t3lib_FlashMessage::OK); } else { $this->flashMessageContainer->add(Tx_Extbase_Utility_Localization::translate('LLL:EXT:feupload/Resources/Private/Language/locallang.xml:flash.error.folder.not_deleted.title', array($folder->getTitle())), t3lib_FlashMessage::ERROR); } $this->redirect('index'); }
/** * action beIcsInvitation * * --> see ics template in Resources/Private/Backend/Templates/Email/ * * @param Tx_WoehrlSeminare_Domain_Model_Event $event * @ignorevalidation $event * @return void */ public function beIcsInvitationAction(Tx_WoehrlSeminare_Domain_Model_Event $event) { // startDateTime may never be empty $helper['start'] = $event->getStartDateTime()->getTimestamp(); // endDateTime may be empty if ($event->getEndDateTime() instanceof DateTime && $event->getStartDateTime() != $event->getEndDateTime()) { $helper['end'] = $event->getEndDateTime()->getTimestamp(); } else { $helper['end'] = $helper['start']; } if ($event->isAllDay()) { $helper['allDay'] = 1; } $helper['now'] = time(); $helper['description'] = $this->foldline($this->html2rest($event->getDescription())); // location may be empty... if (is_object($event->getLocation())) { $helper['location'] = $event->getLocation()->getName(); $helper['locationics'] = $this->foldline($event->getLocation()->getName()); } $helper['nameto'] = strtolower(str_replace(array(',', ' '), array('', '-'), $event->getContact()->getName())); $this->sendTemplateEmail(array($event->getContact()->getEmail() => $event->getContact()->getName()), array($this->settings['senderEmailAddress'] => Tx_Extbase_Utility_Localization::translate('tx_woehrlseminare.be.eventmanagement', 'woehrl_seminare')), 'Termineinladung: ' . $event->getTitle(), 'Invitation', array('event' => $event, 'subscribers' => $event->getSubscribers(), 'attachSubscriberAsCsv' => TRUE, 'helper' => $helper, 'settings' => $this->settings, 'attachIcsInvitation' => TRUE)); $this->view->assign('event', $event); }
/** * Processes uploads * * @param mixed $file * @return void */ public function createAction(Tx_Feupload_Domain_Model_File $file) { $ffunc = t3lib_div::makeInstance('t3lib_basicFileFunctions'); $path = $ffunc->getUniqueName($_FILES['tx_feupload_upload']['name']['file']['file'], t3lib_div::getFileAbsFileName('uploads/feupload/')); t3lib_div::upload_copy_move($_FILES['tx_feupload_upload']['tmp_name']['file']['file'], $path); $file->setFile(basename($path)); if ($GLOBALS['TSFE']->fe_user->user) { // This is because $GLOBALS['TSFE']->fe_user is of type // tslib_feUserAuth // and $GLOBALS['TSFE']->fe_user->user is an array. $owner = $this->frontendUserRepository->findByUid($GLOBALS["TSFE"]->fe_user->user['uid']); $file->setOwner($owner); } $visibility = $_POST['tx_feupload_upload']['visibility']; $extConf = unserialize($GLOBALS['TYPO3_CONF_VARS']['EXT']['extConf']['feupload']); $defaultVisibility = $extConf['defaultFileVisibility']; // globalVisibilty set? ignore user preference if (!empty($defaultVisibility) and in_array($defaultVisibility, array('public', 'login', 'groups'))) { $visibility = $defaultVisibility; } switch ($visibility) { case 'public': $file->setVisibility(0); break; case 'login': $file->setVisibility(-2); break; case 'groups': $file->setVisibility(1); foreach ($_POST['tx_feupload_upload']['groups'] as $groupId) { $group = $this->frontendUserGroupRepository->findByUid($groupId); if ($group) { $file->addFrontendUserGroup($group); } } break; } if ((bool) $this->userTS['appendGroups']) { $groupIds = explode(',', $this->userTS['appendGroups']); foreach ($groupIds as $groupId) { $group = $this->frontendUserGroupRepository->findByUid($groupId); if ($group) { $file->addFrontendUserGroup($group); } } } /* @var $sessionHandler Tx_Feupload_Session_Folder */ $sessionHandler = t3lib_div::makeInstance('Tx_Feupload_Session_Folder'); $file->setFolder($sessionHandler->getCurrentFolder()); $this->fileRepository->add($file); $this->flashMessageContainer->add(Tx_Extbase_Utility_Localization::translate('LLL:EXT:feupload/Resources/Private/Language/locallang.xml:flash.ok.file.uploaded.content'), Tx_Extbase_Utility_Localization::translate('LLL:EXT:feupload/Resources/Private/Language/locallang.xml:flash.ok.file.uploaded.title'), t3lib_FlashMessage::OK); $this->redirect('new'); }
/** * Translate a given key. * * @param string $key The locallang key. * @param array $arguments If given, it will be passed to vsprintf. * @return string The locallized string. */ public function translate($key, $arguments = null) { return Tx_Extbase_Utility_Localization::translate($key, 'Contentstage', $arguments); }