TYPO3 LTS 9: Unterschied zwischen den Versionen
V (Diskussion | Beiträge) (→Benötigte Software & Konfiguration =) |
F (Diskussion | Beiträge) (→sprache in typoscript für plugin anpassen) |
||
(95 dazwischenliegende Versionen von 2 Benutzern werden nicht angezeigt) | |||
Zeile 1: | Zeile 1: | ||
+ | [[TYPO3 LTS 9]] | [[TYPO3 LTS 8]] | [[TYPO3.CMS 7.6 Schnipsel]] | [[Typo3]] | [[Typo3 Entwicklereinstellungen]] | [[Typo3 Endbenutzer Hilfe]] | ||
− | + | * https://forge.typo3.org/attachments/download/33482/TYPO3-v9-2-whats-new.german.pdf | |
+ | * https://blog.comwrap.com/typo3-version-9-die-wichtigsten-features-des-major-releases | ||
+ | * https://jweiland.net/typo3/versionen-und-updates/version-9.html | ||
+ | * https://forge.typo3.org/attachments/download/33888/TYPO3-v9-LTS-whats-new.german.pdf | ||
+ | ==Benötigte Software & Konfiguration == | ||
<source lang=bash> | <source lang=bash> | ||
Zeile 9: | Zeile 14: | ||
mysql_secure_installation | mysql_secure_installation | ||
+ | USE mysql; | ||
+ | UPDATE user SET plugin='mysql_native_password' WHERE User='root'; | ||
+ | FLUSH PRIVILEGES; | ||
+ | exit; | ||
+ | |||
+ | #Falls Die Sicherheit für Passwörte nachträglich geändert werden muss. | ||
mysql$ SHOW VARIABLES LIKE 'validate_password%'; | mysql$ SHOW VARIABLES LIKE 'validate_password%'; | ||
Zeile 28: | Zeile 39: | ||
− | + | == Typo3 Grundinstallation == | |
+ | === t3 Installation mit git === | ||
<source lang=bash> | <source lang=bash> | ||
+ | cd in /var/www/domain | ||
git clone https://github.com/TYPO3/TYPO3.CMS.git | git clone https://github.com/TYPO3/TYPO3.CMS.git | ||
+ | cd TYPO3.CMS/ | ||
git fetch --tags | git fetch --tags | ||
git tag --list | git tag --list | ||
Zeile 36: | Zeile 50: | ||
#Externe Bibliotheken installieren | #Externe Bibliotheken installieren | ||
composer install | composer install | ||
− | cd | + | |
− | ln -s | + | cd .. |
+ | ln -s TYPO3.CMS typo3_src | ||
ln -s typo3_src/typo3 typo3 | ln -s typo3_src/typo3 typo3 | ||
ln -s typo3_src/index.php . | ln -s typo3_src/index.php . | ||
+ | touch FIRST_INSTALL | ||
Zeile 47: | Zeile 63: | ||
max_input_vars = 1500 | max_input_vars = 1500 | ||
</source> | </source> | ||
+ | === t3 Installation mit composer === | ||
+ | <source lang=bash> | ||
+ | composer create-project "typo3/cms-base-distribution:^9.5" blanco9.netz.coop | ||
+ | cd blanco9.netz.coop | ||
+ | php vendor/bin/typo3cms install:setup | ||
+ | </source> | ||
+ | |||
+ | |||
+ | |||
+ | |||
+ | |||
+ | == Konfiguration == | ||
+ | |||
+ | === Debug === | ||
+ | |||
+ | |||
+ | .htaccess | ||
+ | SetEnv TYPO3_CONTEXT Development | ||
+ | |||
+ | * https://www.typo3lexikon.de/typo3-tutorials/fehlermeldungen/oops-an-error-occurred.html | ||
+ | |||
+ | |||
+ | === LocalConfiguration.php === | ||
+ | ==== Mail ==== | ||
+ | |||
+ | |||
+ | Achtung "Configuration Presets (Global Configuration)" unter Einstellungen, sugeriert nicht das auch defaultMailFromAddress angegeben werden muss :( | ||
+ | |||
+ | <source lang=php> | ||
+ | <?php | ||
+ | return [ | ||
+ | 'MAIL' => [ | ||
+ | 'defaultMailFromAddress' => 'xxxx@domain.tld', | ||
+ | 'defaultMailFromName' => 'xxxx domain.tld', | ||
+ | 'transport' => 'smtp', | ||
+ | 'transport_sendmail_command' => '/usr/sbin/sendmail -t -i ', | ||
+ | 'transport_smtp_encrypt' => 'tls', | ||
+ | 'transport_smtp_password' => 'password', | ||
+ | 'transport_smtp_server' => 'mx.domain.tld:25', | ||
+ | 'transport_smtp_username' => 'xxxx@domain.tld', | ||
+ | ], | ||
+ | ]; | ||
+ | </source> | ||
+ | |||
+ | == Module == | ||
+ | === Sites === | ||
+ | ==== Sprachen lanugages ==== | ||
+ | * https://docs.typo3.org/typo3cms/CoreApiReference/ApiOverview/SiteHandling/Basics.html | ||
+ | * https://docs.typo3.org/typo3cms/CoreApiReference/ApiOverview/Internationalization/ManagingTranslations.html | ||
+ | * https://docs.typo3.org/typo3cms/CoreApiReference/ApiOverview/SiteHandling/AddLanguages.html# | ||
+ | |||
+ | Achtung, derzeit existiert ein language fallback BUG :( | ||
+ | https://forge.typo3.org/issues/86762 | ||
+ | Seiten welche noch nicht übersetzt sind, kommen auf ne 404 Seite | ||
+ | |||
+ | # erstmal müssen Sprachen angelegt werden auf der Seite 0 (ganz ganz oben in der Seiten Hierrachie) ... dann kann angefangen werden Sprachen über Sites zu konfigurieren | ||
+ | # die Startseite (auch wenn nur Verweis) muss übersetzt werden mit dem Seiten oder Listen Modul | ||
+ | |||
+ | <source lang=typoscript> | ||
+ | page = PAGE | ||
+ | page { | ||
+ | 10 = FLUIDTEMPLATE | ||
+ | 10 { | ||
+ | dataProcessing { | ||
+ | |||
+ | 120 = TYPO3\CMS\Frontend\DataProcessing\LanguageMenuProcessor | ||
+ | 120 { | ||
+ | languages = auto | ||
+ | as = ncMenuLanguage | ||
+ | } | ||
+ | |||
+ | } | ||
+ | } | ||
+ | } | ||
+ | |||
+ | </source> | ||
+ | |||
+ | == Entwicklung == | ||
+ | |||
+ | === extbase=== | ||
+ | ==== link erstellen ==== | ||
+ | <source lang=php> | ||
+ | $objectManager = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance(\TYPO3\CMS\Extbase\Object\ObjectManager::class); | ||
+ | $uriBuilder = $objectManager->get(\TYPO3\CMS\Extbase\Mvc\Web\Routing\UriBuilder::class); | ||
+ | $uri = $uriBuilder | ||
+ | ->reset() | ||
+ | ->setTargetPageUid($confArray['ncChPwPluginPageId']) | ||
+ | // ->setArguments($getArgs) | ||
+ | ->uriFor( | ||
+ | 'ncchpwnoticeandmail', | ||
+ | ['cruser' => \Netzcoop\Anclib\Services\NcCrypt::encrypt($feUserId, 'passwort'], | ||
+ | 'Ncchpw', | ||
+ | 'ancregister', | ||
+ | 'ncchpwplugin' | ||
+ | ); | ||
+ | } | ||
+ | \TYPO3\CMS\Core\Utility\HttpUtility::redirect($uri); | ||
+ | </source> | ||
− | + | * https://daker.de/post/detail/2017/23/how-to-create-an-internal-uri-in-typo3.html | |
− | === | + | === fluid === |
− | ==== lang (Sprache) ==== | + | [[TYPO3.CMS_7.6_Schnipsel#fluid]] |
+ | |||
+ | ==== flashMessages ==== | ||
+ | mit umlauten, sonderzeichen und html tags | ||
+ | |||
+ | <source lang=php> | ||
+ | $this->addFlashMessage('äüz<a href="link">link</a>', '', \TYPO3\CMS\Core\Messaging\AbstractMessage::ERROR); | ||
+ | </source> | ||
+ | |||
+ | <source lang=xml> | ||
+ | <f:flashMessages as="flashMessages"> | ||
+ | <dl class="messages"> | ||
+ | <f:for each="{flashMessages}" as="flashMessage"> | ||
+ | <dt><f:format.raw>{flashMessage.code}</f:format.raw></dt> | ||
+ | <dd><f:format.raw>{flashMessage.message}</f:format.raw></dd> | ||
+ | </f:for> | ||
+ | </dl> | ||
+ | </f:flashMessages> | ||
+ | </source> | ||
+ | |||
+ | === Fehlermeldungen (unvollstängig) === | ||
+ | |||
+ | <source lang=php> | ||
+ | class CaptchaValidator extends AbstractValidator | ||
+ | // ......... | ||
+ | public function isValid($word) | ||
+ | { | ||
+ | // ......... | ||
+ | if (!$isValid) { | ||
+ | // Please enter the word or number as it appears in the image. The entered value was incorrect. | ||
+ | $this->addError( | ||
+ | $this->translateErrorMessage( | ||
+ | '9221561048', | ||
+ | 'sr_freecap' | ||
+ | ), | ||
+ | 9221561048 | ||
+ | ); | ||
+ | } | ||
+ | return $isValid; | ||
+ | } | ||
+ | } | ||
+ | </source> | ||
+ | |||
+ | <source lang="xml"> | ||
+ | alle Fehler anzeigen die so existieren | ||
+ | <f:render partial="FormErrors" arguments="{for: 'user'}" /> | ||
+ | |||
+ | speziellen Fehler anzeigen | ||
+ | <f:render partial="FieldError" arguments="{for: 'user', field: 'captcha'}" /> | ||
+ | </source> | ||
+ | === Ableiten === | ||
+ | |||
+ | ==== Controller ableiten ==== | ||
+ | [[TYPO3.CMS_7.6_Schnipsel#Backend_Klassen_ableiten]] | ||
+ | * EXT/ancregister/Classes/Controller/NcFeuserEditController.php | ||
+ | <source lang="php"> | ||
+ | <?php | ||
+ | namespace Netzcoop\Ancregister\Controller; | ||
+ | |||
+ | class NcFeuserEditController extends \Evoweb\SfRegister\Controller\FeuserEditController { | ||
+ | |||
+ | public function formAction(\Evoweb\SfRegister\Domain\Model\FrontendUser $user = null) | ||
+ | { | ||
+ | parent::formAction($user); | ||
+ | } | ||
+ | } | ||
+ | </source> | ||
+ | |||
+ | * ext_localconf.php | ||
+ | <source lang="php"> | ||
+ | $GLOBALS['TYPO3_CONF_VARS']['SYS']['Objects']['Evoweb\SfRegister\Controller\FeuserEditController'] = array( | ||
+ | 'className' => 'Netzcoop\Ancregister\Controller\NcFeuserEditController' | ||
+ | ); | ||
+ | </source> | ||
+ | |||
+ | |||
+ | <source lang="php"> | ||
+ | |||
+ | </source> | ||
+ | |||
+ | === Sprache === | ||
+ | <source lang=php> | ||
+ | $GLOBALS['LANG']->sL('LLL:EXT:core/Resources/Private/Language/locallang_core.xlf:flushPageCachesTitle') | ||
+ | </source> | ||
+ | |||
+ | |||
+ | |||
+ | ==== translate ==== | ||
+ | |||
+ | |||
+ | |||
+ | [[TYPO3.CMS_7.6_Schnipsel#translate]] | ||
+ | |||
+ | |||
+ | <source lang=xml> | ||
+ | {f:translate(key: 'ncchpw.passwordExpired', | ||
+ | arguments: '{ | ||
+ | 0: "eins", | ||
+ | 1: "zwei", | ||
+ | 2: "drei" | ||
+ | }') -> f:format.raw()} | ||
+ | </source> | ||
+ | |||
+ | |||
+ | ===== sprache in typoscript für plugin anpassen ===== | ||
+ | <source lang=typoscript> | ||
+ | plugin.tx_cookieman._LOCAL_LANG.de { | ||
+ | introText = Unsere Webseite verwendet Cookies. | ||
+ | } | ||
+ | </source> | ||
+ | |||
+ | ==== Extension Sprache verändern ==== | ||
+ | * Configuration/TypoScript/constants.txt | ||
+ | <source lang="typoscript"> | ||
+ | |||
+ | nc_password_txt = Die Länge des Passwort muß zwischen 8 und 80 Zeichen liegen. Ihr Passwort muss mindestens ein Groß- und Kleinbuchstaben haben, sowie ein Sonderzeichen oder eine Zahl enthalten. | ||
+ | |||
+ | |||
+ | </source> | ||
+ | * Configuration/TypoScript/setup.txt | ||
+ | <source lang="typoscript"> | ||
+ | plugin.tx_sfregister._LOCAL_LANG.de { | ||
+ | error_required = Bitte füllen Sie dieses Feld aus. | ||
+ | } | ||
+ | |||
+ | plugin.tx_srfreecap._LOCAL_LANG.de { | ||
+ | notice = | ||
+ | explain = | ||
+ | } | ||
+ | |||
+ | # Achtung: in der felogin Plugin Konfiguration hinterlegte Meldungen überschreiben sämtliche Spracheinstellungen | ||
+ | plugin.tx_felogin_pi1._LOCAL_LANG.de { | ||
+ | username = E-Mail-Adresse | ||
+ | ll_enter_your_data = E-Mail-Adresse | ||
+ | ll_forgot_header = Passwort vergessen? | ||
+ | |||
+ | # ll_forgot_reset_message = ll_forgot_reset_message | ||
+ | ll_welcome_header = Benutzeranmeldung | ||
+ | ll_welcome_message = Geben Sie Ihre E-Mailadresse und Ihr Passwort ein, um sich anzumelden: | ||
+ | # ll_status_header = status_header | ||
+ | # ll_status_message = ll_status_message | ||
+ | # ll_success_message = success_message | ||
+ | # ll_logout_message = logout_message | ||
+ | # ll_error_message = error_message | ||
+ | |||
+ | // siehe oben $plugin.tx_sfregister._LOCAL_LANG.de.passwordRequirements | ||
+ | ll_change_password_message = {$nc_password_txt} | ||
+ | ll_change_password_notvalid_message = {$nc_password_txt} | ||
+ | ll_change_password_tooshort_message = {$nc_password_txt} | ||
+ | ll_change_password_notequal_message = Die Passwörter stimmen nicht überein - das neue Passwort bitte zweimal eingeben. {$nc_password_txt} | ||
+ | } | ||
+ | plugin.tx_felogin_pi1 { | ||
+ | changePasswordNotValidMessage_stdWrap.wrap = <span class="errorMessage">|</span> | ||
+ | changePasswordNotValidMessage_stdWrap.wrap = <span class="errorMessage">|</span> | ||
+ | changePasswordTooShortMessage_stdWrap.wrap = <span class="errorMessage">|</span> | ||
+ | changePasswordNotEqualMessage_stdWrap.wrap = <span class="errorMessage">|</span> | ||
+ | } | ||
+ | |||
+ | </source> | ||
+ | |||
+ | ==== Sprache der Backend core Labels übersetzen ==== | ||
+ | |||
+ | zum Beispiel im Backend unter Listen Modul die Spalten | ||
+ | |||
+ | * EXT:ancextension/ext_localconf.php | ||
+ | <source lang="php"> | ||
+ | $GLOBALS['TYPO3_CONF_VARS']['SYS']['locallangXMLOverride']['EXT:core/Resources/Private/Language/locallang_core.xlf'][] = 'EXT:ancextension/Resources/Private/Language/de.locallang_ancbe.xlf'; | ||
+ | $GLOBALS['TYPO3_CONF_VARS']['SYS']['locallangXMLOverride']['EXT:frontend/Resources/Private/Language/locallang_tca.xlf'][] = 'EXT:ancextension/Resources/Private/Language/de.locallang_ancbe.xlf'; | ||
+ | $GLOBALS['TYPO3_CONF_VARS']['SYS']['locallangXMLOverride']['EXT:core/Resources/Private/Language/locallang_general.xlf'][] = 'EXT:ancextension/Resources/Private/Language/de.locallang_ancbe.xlf'; | ||
+ | |||
+ | </source> | ||
+ | |||
+ | * EXT:ancextension/Resources/Private/Language/de.locallang_ancbe.xlf | ||
+ | <source lang="xml"> | ||
+ | <?xml version="1.0" encoding="utf-8" standalone="yes" ?> | ||
+ | <xliff version="1.0"> | ||
+ | <file source-language="en" datatype="plaintext" original="messages" date="2019-03-26T18:44:59Z" product-name="lang"> | ||
+ | <header/> | ||
+ | <body> | ||
+ | <trans-unit id="LGL.enabled" xml:space="preserve"> | ||
+ | <target>XXXXXXXXXXXXX</target> | ||
+ | </trans-unit> | ||
+ | <trans-unit id="fe_users.lockToDomain" xml:space="preserve"> | ||
+ | <target>YYYYYYYYYYYYYYYYY</target> | ||
+ | </trans-unit> | ||
+ | <trans-unit id="labels.toggleall" xml:space="preserve"> | ||
+ | <target>Alle auswählen</target> | ||
+ | </trans-unit> | ||
+ | <trans-unit id="rm.closeDoc" xml:space="preserve"> | ||
+ | <target>Speichern und Schließen</target> | ||
+ | </trans-unit> | ||
+ | </body> | ||
+ | </file> | ||
+ | </xliff> | ||
+ | |||
+ | </source> | ||
+ | |||
+ | === sql === | ||
+ | |||
+ | * https://docs.typo3.org/m/typo3/reference-coreapi/master/en-us/ApiOverview/Database/ExpressionBuilder/Index.html | ||
+ | * https://docs.typo3.org/m/typo3/reference-coreapi/master/en-us/ApiOverview/Database/Connection/Index.html#delete | ||
+ | * https://wiki.agentur-ibk.de/doku.php?id=repository_datenbank | ||
+ | |||
+ | |||
+ | ==== select ==== | ||
+ | <source lang=php> | ||
+ | $qB = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance(\TYPO3\CMS\Core\Database\ConnectionPool::class) | ||
+ | ->getQueryBuilderForTable('fe_users'); | ||
+ | |||
+ | $qB->getRestrictions()->removeAll(); | ||
+ | $qB->from('fe_users'); | ||
+ | $qB->select('*'); | ||
+ | $qB->where( | ||
+ | $qB->expr()->lte('lastlogin', (int) $timestampWaitingPeriodStart) | ||
+ | ); | ||
+ | $qB->andWhere( | ||
+ | $qB->expr()->neq('lastlogin', 0) | ||
+ | ); | ||
+ | $qB->andWhere( | ||
+ | $qB->expr()->eq('ancfordeletefirstreminder', 0) | ||
+ | ); | ||
+ | $qB->andWhere( | ||
+ | $qB->expr()->eq('ancfordeletesecondreminder', 0) | ||
+ | ); | ||
+ | $qB->andWhere( | ||
+ | $qB->expr()->eq('ancfordeletelastreminder', 0) | ||
+ | ); | ||
+ | $qB->andWhere( | ||
+ | $qB->expr()->eq('deleted', (int) 0) | ||
+ | ); | ||
+ | $qB->andWhere( | ||
+ | $qB->expr()->eq('disable', (int) 0) | ||
+ | ); | ||
+ | $qB->andWhere( | ||
+ | $qB->expr()->gte('endtime', (int) time()) | ||
+ | ); | ||
+ | $arrayResult = $qB->execute()->fetchAll(); | ||
+ | |||
+ | foreach ($arrayResult as $rowvalue) { | ||
+ | |||
+ | } | ||
+ | </source> | ||
+ | |||
+ | === update === | ||
+ | <source lang=php> | ||
+ | $qB = GeneralUtility::makeInstance(ConnectionPool::class) | ||
+ | ->getQueryBuilderForTable('fe_users'); | ||
+ | $qB->update('fe_users') | ||
+ | ->where( | ||
+ | $qB->expr()->neq('ancfordeletefirstreminder', 0) | ||
+ | ) | ||
+ | ->andWhere( | ||
+ | $qB->expr()->gte('lastlogin', (int) $timestampWaitingPeriodStart) | ||
+ | ) | ||
+ | ->set('ancfordeletefirstreminder', 0) | ||
+ | ->set('ancfordeletesecondreminder', 0) | ||
+ | ->getRestrictions()->removeAll(); | ||
+ | $nrOfUpdates= $qB->execute(); | ||
+ | </source> | ||
+ | |||
+ | ==== sql queries debuggen ==== | ||
+ | <source lang="php"> | ||
+ | $objectManager = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\CMS\Extbase\Object\ObjectManager'); | ||
+ | $frontendUserRepository = $objectManager->get('TYPO3\CMS\Extbase\Domain\Repository\FrontendUserRepository'); | ||
+ | $users = $frontendUserRepository->findAll(); | ||
+ | $queryParser = $objectManager->get(\TYPO3\CMS\Extbase\Persistence\Generic\Storage\Typo3DbQueryParser::class); | ||
+ | krexx($queryParser->convertQueryToDoctrineQueryBuilder($frontendUserRepository->createQuery())->getSQL()); | ||
+ | </source> | ||
+ | |||
+ | <source lang="php"> | ||
+ | // .... | ||
+ | $rows = $qB->execute()->fetchAll(); | ||
+ | krexx($qB->getSQL()); | ||
+ | </source> | ||
+ | |||
+ | === Einstellungen einer Extension=== | ||
+ | * sie befindet sich nicht mehr im Module Extension Manager sondern im Module Einstellungen, desweiteren wird sie durch De- und Neuinstallation der Extension die Einstellungen gelöscht!!! was sehr nervig sein kann | ||
+ | |||
+ | * ext_conf_template.txt | ||
+ | <source lang="typoscript"> | ||
+ | |||
+ | # cat=basic/enable/010;; type=int+; label=LLL:EXT:ancfeloginaddon/Resources/Private/Language/locallang_be.xml:basic.showsentmailinfoPageId | ||
+ | showsentmailinfoPageId = | ||
+ | |||
+ | # cat=basic/enable/016;; type=int+; label=LLL:EXT:ancfeloginaddon/Resources/Private/Language/locallang_be.xml:basic.showAfterEmailloginPageId | ||
+ | showAfterEmailloginPageId = | ||
+ | |||
+ | # cat=basic/enable/020;; type=int+; label=LLL:EXT:ancfeloginaddon/Resources/Private/Language/locallang_be.xml:basic.forgotTimeForDeactivateLogin | ||
+ | forgotTimeForDeactivateLogin = | ||
+ | |||
+ | # cat=basic/enable/030;; type=string; label=LLL:EXT:ancfeloginaddon/Resources/Private/Language/locallang_be.xml:basic.mailsubject | ||
+ | mailsubject = | ||
+ | |||
+ | # cat=basic/enable/040;; type=string; label=LLL:EXT:ancfeloginaddon/Resources/Private/Language/locallang_be.xml:basic.mailsender | ||
+ | mailsender = | ||
+ | |||
+ | # cat=basic/enable/050;; type=user[Netzcoop\Ancfeloginaddon\ViewHelpers\TextArea->render]; label=LLL:EXT:ancfeloginaddon/Resources/Private/Language/locallang_be.xml:basic.mailtext | ||
+ | mailtext = | ||
+ | |||
+ | # cat=basic/enable/017;; type=options[gleich=0,ungleich=1]; label=LLL:EXT:ancfeloginaddon/Resources/Private/Language/locallang_be.xml:basic.emailcondition2 | ||
+ | emailcondition2 = | ||
+ | |||
+ | </source> | ||
+ | |||
+ | <source lang="php"> | ||
+ | $confArray = unserialize($GLOBALS["TYPO3_CONF_VARS"]["EXT"]["extConf"][strtolower($this->extensionName)]); | ||
+ | </source> | ||
+ | |||
+ | |||
+ | === Scheduler === | ||
+ | |||
+ | * [[TYPO3.CMS 6.2 Extension entwickeln - Cron Scheduler]] | ||
+ | * https://docs.typo3.org/typo3cms/extensions/scheduler/DevelopersGuide/CreatingTasks/Index.html | ||
+ | |||
+ | ==== Task ==== | ||
+ | * Classes/Task/NcIndexTtnewsPdffilesForSearchTask.php | ||
+ | <source lang=php> | ||
+ | <?php | ||
+ | |||
+ | namespace Netzcoop\Ancext\Task; | ||
+ | |||
+ | /** | ||
+ | * Description of NcIndexTtnewsPdfFilesForSearch | ||
+ | * | ||
+ | * @author nc | ||
+ | */ | ||
+ | class NcIndexTtnewsPdffilesForSearchTask extends \TYPO3\CMS\Scheduler\Task\AbstractTask { | ||
+ | /** | ||
+ | * @var string | ||
+ | */ | ||
+ | protected $commandIdentifier; | ||
+ | |||
+ | /** | ||
+ | * @var array | ||
+ | */ | ||
+ | protected $arguments = []; | ||
+ | |||
+ | /** | ||
+ | * Function execute from the Scheduler | ||
+ | * | ||
+ | * @return bool TRUE on successful execution | ||
+ | */ | ||
+ | public function execute() { | ||
+ | krexx($this->getArguments()); | ||
+ | // ... | ||
+ | return true; | ||
+ | } | ||
+ | |||
+ | |||
+ | /** | ||
+ | * @param array $arguments | ||
+ | */ | ||
+ | public function setArguments($arguments) | ||
+ | { | ||
+ | $this->arguments = $arguments; | ||
+ | } | ||
+ | |||
+ | /** | ||
+ | * @return array | ||
+ | */ | ||
+ | public function getArguments() | ||
+ | { | ||
+ | return $this->arguments; | ||
+ | } | ||
+ | |||
+ | /** | ||
+ | * Return a text representation of the selected command and arguments | ||
+ | * | ||
+ | * @return string Information to display | ||
+ | */ | ||
+ | public function getAdditionalInformation() | ||
+ | { | ||
+ | $label = "spezielle Parameter: \n"; | ||
+ | foreach($this->commandIdentifier as $key => $value ) { | ||
+ | $label .= "\t".$key.': '.$value."\n"; | ||
+ | } | ||
+ | |||
+ | return $label; | ||
+ | } | ||
+ | |||
+ | |||
+ | /** | ||
+ | * @param string $commandIdentifier | ||
+ | */ | ||
+ | public function setCommandIdentifier($commandIdentifier) | ||
+ | { | ||
+ | $this->commandIdentifier = $commandIdentifier; | ||
+ | } | ||
+ | |||
+ | /** | ||
+ | * @return string | ||
+ | */ | ||
+ | public function getCommandIdentifier() | ||
+ | { | ||
+ | return $this->commandIdentifier; | ||
+ | } | ||
+ | } | ||
+ | </source> | ||
+ | ==== AdditionalFieldProvider ==== | ||
+ | |||
+ | diese Klasse ist für das Formular innerhalb eines Task zuständig, Felder werden definiert, validiert und gespeichert! | ||
+ | |||
+ | * Classes/Task/NcIndexTtnewsPdffilesForSearchAdditionalFieldProvider.php | ||
+ | <source lang=php> | ||
+ | <?php | ||
+ | |||
+ | namespace Netzcoop\Ancext\Task; | ||
+ | |||
+ | class NcIndexTtnewsPdffilesForSearchAdditionalFieldProvider extends \TYPO3\CMS\Scheduler\AbstractAdditionalFieldProvider { | ||
+ | |||
+ | /** | ||
+ | * @var \TYPO3\CMS\Extbase\Mvc\Cli\CommandManager | ||
+ | */ | ||
+ | protected $commandManager; | ||
+ | |||
+ | /** | ||
+ | * @var \TYPO3\CMS\Extbase\Object\ObjectManagerInterface | ||
+ | */ | ||
+ | protected $objectManager; | ||
+ | |||
+ | /** | ||
+ | * @var \TYPO3\CMS\Extbase\Reflection\ReflectionService | ||
+ | */ | ||
+ | protected $reflectionService; | ||
+ | |||
+ | /** | ||
+ | * @var \TYPO3\CMS\Extbase\Scheduler\Task | ||
+ | */ | ||
+ | protected $task; | ||
+ | |||
+ | /** | ||
+ | * Default language file of the extension linkvalidator | ||
+ | * | ||
+ | * @var string | ||
+ | */ | ||
+ | protected $languageFile = 'LLL:EXT:ancext/Resources/Private/Language/locallang.xlf'; | ||
+ | |||
+ | |||
+ | const EXT_KEY = 'ancext_task'; | ||
+ | |||
+ | /** | ||
+ | * Constructor | ||
+ | * | ||
+ | * @param \TYPO3\CMS\Extbase\Object\ObjectManagerInterface $objectManager | ||
+ | * @param \TYPO3\CMS\Extbase\Mvc\Cli\CommandManager $commandManager | ||
+ | * @param \TYPO3\CMS\Extbase\Reflection\ReflectionService $reflectionService | ||
+ | */ | ||
+ | public function __construct(\TYPO3\CMS\Extbase\Object\ObjectManagerInterface $objectManager = null, \TYPO3\CMS\Extbase\Mvc\Cli\CommandManager $commandManager = null, \TYPO3\CMS\Extbase\Reflection\ReflectionService $reflectionService = null) | ||
+ | { | ||
+ | $this->objectManager = $objectManager ?? \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance(\TYPO3\CMS\Extbase\Object\ObjectManager::class); | ||
+ | $this->commandManager = $commandManager ?? $this->objectManager->get(\TYPO3\CMS\Extbase\Mvc\Cli\CommandManager::class); | ||
+ | $this->reflectionService = $reflectionService ?? $this->objectManager->get(\TYPO3\CMS\Extbase\Reflection\ReflectionService::class); | ||
+ | } | ||
+ | |||
+ | /** | ||
+ | * Render additional information fields within the scheduler backend. | ||
+ | * | ||
+ | * @param array &$taskInfo Array information of task to return | ||
+ | * @param AbstractTask|null $task When editing, reference to the current task. NULL when adding. | ||
+ | * @param SchedulerModuleController $schedulerModule Reference to the calling object (BE module of the Scheduler) | ||
+ | * @return array Additional fields | ||
+ | * @see \TYPO3\CMS\Scheduler\AdditionalFieldProvider#getAdditionalFields($taskInfo, $task, $schedulerModule) | ||
+ | */ | ||
+ | public function getAdditionalFields(array &$taskInfo, $task, \TYPO3\CMS\Scheduler\Controller\SchedulerModuleController $schedulerModule) | ||
+ | { | ||
+ | $this->task = $task; | ||
+ | if ($this->task !== null) { | ||
+ | $this->task->setScheduler(); | ||
+ | } | ||
+ | $argumentValues = $this->task->getArguments(); | ||
+ | $fields = []; | ||
+ | $fields['ancext_task_description'] = $this->getCommandControllerActionDescriptionField(); | ||
+ | $fieldname = 'newsFilePath'; | ||
+ | $fields[$fieldname] = [ | ||
+ | 'code' => '<input type="text" class="form-control" name="tx_scheduler['.self::EXT_KEY.'][arguments]['.htmlspecialchars($fieldname).']" value="' . $argumentValues[$fieldname] . '">', | ||
+ | 'label' => $this->languageFile.':ncIndexTtnewsPdffilesForSearchTask.field.newsFilePath', | ||
+ | 'cshKey' => '', | ||
+ | 'cshLabel' => $fieldname | ||
+ | ]; | ||
+ | |||
+ | return $fields; | ||
+ | } | ||
+ | |||
+ | /** | ||
+ | * Get description of selected command | ||
+ | * | ||
+ | * @return array | ||
+ | */ | ||
+ | protected function getCommandControllerActionDescriptionField() | ||
+ | { | ||
+ | return [ | ||
+ | 'code' => '', | ||
+ | 'label' => $this->languageFile.':ncIndexTtnewsPdffilesForSearchTask.description' | ||
+ | ]; | ||
+ | } | ||
+ | |||
+ | public function validateAdditionalFields(array &$submittedData, \TYPO3\CMS\Scheduler\Controller\SchedulerModuleController $parentObject) | ||
+ | { | ||
+ | if(is_dir($submittedData[self::EXT_KEY]['arguments']['newsFilePath']) | ||
+ | || is_dir(\TYPO3\CMS\Core\Core\Environment::getPublicPath().'/'.$submittedData[self::EXT_KEY]['arguments']['newsFilePath']) | ||
+ | || is_dir(\TYPO3\CMS\Core\Core\Environment::getProjectPath().'/'.$submittedData[self::EXT_KEY]['arguments']['newsFilePath']) | ||
+ | ) { | ||
+ | return true; | ||
+ | } else { | ||
+ | $this->addMessage( | ||
+ | $GLOBALS['LANG']->sL($this->languageFile . ':ncIndexTtnewsPdffilesForSearchTask.field.newsFilePath.error') | ||
+ | .'( '.$submittedData[self::EXT_KEY]['arguments']['newsFilePath'] | ||
+ | .' || '.\TYPO3\CMS\Core\Core\Environment::getPublicPath().'/'.$submittedData[self::EXT_KEY]['arguments']['newsFilePath'] | ||
+ | .' || '.\TYPO3\CMS\Core\Core\Environment::getProjectPath().'/'.$submittedData[self::EXT_KEY]['arguments']['newsFilePath'] | ||
+ | .' )' | ||
+ | , | ||
+ | \TYPO3\CMS\Core\Messaging\FlashMessage::ERROR | ||
+ | ); | ||
+ | return false; | ||
+ | } | ||
+ | } | ||
+ | public function saveAdditionalFields(array $submittedData, \TYPO3\CMS\Scheduler\Task\AbstractTask $task) | ||
+ | { | ||
+ | if(is_dir(\TYPO3\CMS\Core\Core\Environment::getPublicPath().'/'.$submittedData[self::EXT_KEY]['arguments']['newsFilePath'])) { | ||
+ | $submittedData[self::EXT_KEY]['arguments']['newsFilePath'] = \TYPO3\CMS\Core\Core\Environment::getPublicPath().'/'.$submittedData[self::EXT_KEY]['arguments']['newsFilePath']; | ||
+ | } else if(is_dir(\TYPO3\CMS\Core\Core\Environment::getProjectPath().'/'.$submittedData[self::EXT_KEY]['arguments']['newsFilePath'])) { | ||
+ | $submittedData[self::EXT_KEY]['arguments']['newsFilePath'] = \TYPO3\CMS\Core\Core\Environment::getProjectPath().'/'.$submittedData[self::EXT_KEY]['arguments']['newsFilePath']; | ||
+ | } | ||
+ | $task->setCommandIdentifier($submittedData[self::EXT_KEY]['arguments']); | ||
+ | $task->setArguments((array)$submittedData[self::EXT_KEY]['arguments']); | ||
+ | } | ||
+ | } | ||
+ | </source> | ||
+ | |||
+ | ==== ext_localconf.php ==== | ||
+ | |||
+ | <source lang=php> | ||
+ | $GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['scheduler']['tasks'][\Netzcoop\Ancext\Task\NcIndexTtnewsPdffilesForSearchTask::class] = array( | ||
+ | 'extension' => $_EXTKEY, | ||
+ | 'title' => 'LLL:EXT:'.$_EXTKEY.'/Resources/Private/Language/locallang.xlf:ncIndexTtnewsPdffilesForSearchTask.name', | ||
+ | 'description' => 'LLL:EXT:'.$_EXTKEY.'/Resources/Private/Language/locallang.xlf:ncIndexTtnewsPdffilesForSearchTask.description', | ||
+ | 'additionalFields' => \Netzcoop\Ancext\Task\NcIndexTtnewsPdffilesForSearchAdditionalFieldProvider::class | ||
+ | ); | ||
+ | </source> | ||
+ | |||
+ | |||
+ | === Backend === | ||
+ | |||
+ | ==== javascript im iframe im Backend einbinden ==== | ||
+ | |||
+ | (Lösung von [[TYPO3.CMS_7.6_Schnipsel#Javascript_in_Iframe_im_Backend]] funzt nicht mehr ) | ||
+ | |||
+ | |||
+ | |||
+ | * '''ext_localconf.php''' | ||
+ | <source lang=php> | ||
+ | <?php | ||
+ | $GLOBALS['TYPO3_CONF_VARS']['SYS']['Objects']['TYPO3\CMS\Backend\Form\FormResultCompiler'] = array( | ||
+ | 'className' => 'Netzcoop\Extensionsname\Form\NcFormResultCompiler' | ||
+ | ); | ||
+ | </source> | ||
+ | |||
+ | * '''extensionsname/Classes/Form/NcFormResultCompiler.php''' | ||
+ | <source lang=php> | ||
+ | <?php | ||
+ | namespace Netzcoop\Extensionsname\Form; | ||
+ | |||
+ | class NcFormResultCompiler extends \TYPO3\CMS\Backend\Form\FormResultCompiler { | ||
+ | |||
+ | public function printNeededJSFunctions() { | ||
+ | |||
+ | $pageRenderer = $this->getPageRenderer(); | ||
+ | $pageRenderer->addJsFile('EXT:ancextensionname/Resources/Public/JavaScript/ancbackendIframe.js'); | ||
+ | |||
+ | return parent::printNeededJSFunctions(); | ||
+ | } | ||
+ | } | ||
+ | </source> | ||
+ | |||
+ | == Extensions == | ||
+ | |||
+ | === scheduler === | ||
+ | über EM Local | ||
+ | === vhs === | ||
+ | über EM Repository | ||
+ | === includekrexx=== | ||
+ | über EM Repository | ||
+ | === ws_scss=== | ||
+ | git clone https://github.com/svewap/ws_scss.git | ||
+ | === gridelements === | ||
+ | git clone https://github.com/TYPO3-extensions/gridelements.git | ||
+ | |||
+ | === t3sbootstrap=== | ||
+ | * über https://www.t3sbootstrap.de/typo3-95/ | ||
+ | ** hier https://www.t3sbootstrap.de/fileadmin/user_upload/t3sbootstrap_4.1.96-dev.zip | ||
+ | * Konfiguration | ||
+ | ** Einstellungen > Extension Configuration > t3sbootstrap > Custom SCSS | ||
+ | *** Custom SCSS activate (clear cache and run Scheduler). | ||
+ | ** Wartung > Flush TYPO3 and PHP Cache | ||
+ | ** Scheduler | ||
+ | *** Add task | ||
+ | **** Class: T3SB Custom Scss - write a custom scss file | ||
+ | **** Type: Single | ||
+ | *** TASK "T3SB Custom Scss - write a custom scss file (t3sbootstrap)" ausführen | ||
+ | ** T3SB Config > nctypo9 (s. [[TYPO3_LTS_9#Beispiel_Seitenbaum]]) > New main configuration | ||
+ | |||
+ | === lang (Sprache) === | ||
Die Sprachkonfiguration wurde in das installtool verlegt | Die Sprachkonfiguration wurde in das installtool verlegt | ||
+ | |||
+ | |||
+ | |||
+ | === alte Extension Anpassungen === | ||
+ | <source lang=php> | ||
+ | @inject => @TYPO3\CMS\Extbase\Annotation\Inject | ||
+ | @ignorevalidation => @TYPO3\CMS\Extbase\Annotation\IgnoreValidation | ||
+ | </source> | ||
+ | |||
+ | |||
+ | ==== render Mode deprecated ==== | ||
+ | <source lang=xml> | ||
+ | <f:flashMessages renderMode="div" /> | ||
+ | <f:flashMessages /> | ||
+ | </source> | ||
+ | |||
+ | ==== htmlEscape="false" deprecated ==== | ||
+ | <source lang=xml> | ||
+ | <f:translate key="email_user_salutation" htmlEscape="false"/> | ||
+ | <f:translate key="email_user_salutation" /> | ||
+ | </source> | ||
+ | |||
+ | <f:translate key="email_user_salutation" htmlEscape="false"/>, | ||
+ | |||
+ | == netz.coop Extensions == | ||
+ | |||
+ | === anclib === | ||
+ | |||
+ | === ancbasic === | ||
+ | |||
+ | ==== Konfiguration: ==== | ||
+ | |||
+ | ===== Beispiel Seitenbaum ===== | ||
+ | |||
+ | id:0 nctypo | ||
+ | * id:1; Typ: Standard; Verhalten: Als Anfang der Website benutzen; Ressourcen: ancbasic; Erscheinungsbild > Backend-Layout ancbasic layout template; add Template enthält fluid_styled_content,gridelements, t3sbootstrap, anclib, ancbasic | ||
+ | ** id:2; Typ: Ordner; Name: menu_main | ||
+ | *** id:4: Typ: Seite; Name: Seite 1 | ||
+ | *** id:5: Typ: Seite; Name: Seite 2 | ||
+ | **** id:7: Typ: Seite; Name: Seite 2.1 | ||
+ | **** id:8: Typ: Seite; Name: Seite 2.2 | ||
+ | **** id:9: Typ: Seite; Name: Seite 2.3 | ||
+ | *** id:6: Typ: Seite; Name: Seite 3 | ||
+ | ** id:3; Typ: Ordner; Name: menu_footer | ||
+ | *** id:10: Typ: Seite; Name: Kontakt | ||
+ | *** id:11: Typ: Seite; Name: Impressum | ||
+ | *** id:12: Typ: Seite; Name: Sitemap | ||
+ | *** id:13: Typ: Seite; Name: Datenschutz | ||
+ | |||
+ | |||
+ | |||
+ | == Speaking URLS == | ||
+ | Site management => Sites | ||
+ | |||
+ | |||
+ | == Source Code Änderungen - deprecated ... == | ||
+ | |||
+ | === @TYPO3\CMS\Extbase\Annotation\Inject not @inject === | ||
+ | * https://docs.typo3.org/typo3cms/extensions/core/Changelog/9.0/Feature-82869-ReplaceInjectWithTYPO3CMSExtbaseAnnotationInject.html | ||
+ | |||
+ | |||
+ | |||
+ | == Query Builder == | ||
+ | === Klassen=== | ||
+ | <source lang=php> | ||
+ | use TYPO3\CMS\Core\Database\ConnectionPool; | ||
+ | use TYPO3\CMS\Core\Database\Query\QueryBuilder; | ||
+ | use TYPO3\CMS\Core\Utility\GeneralUtility; | ||
+ | </source> | ||
+ | === queryBuilder=== | ||
+ | <source lang=php> | ||
+ | $queryBuilder = GeneralUtility::makeInstance(ConnectionPool::class) | ||
+ | ->getQueryBuilderForTable('tt_news'); | ||
+ | </source> | ||
+ | === FROM=== | ||
+ | <source lang=php> | ||
+ | $qB = $queryBuilder->from('tt_news', 'n'); | ||
+ | </source> | ||
+ | === WHERE=== | ||
+ | <source lang=php> | ||
+ | $qB->where( | ||
+ | $queryBuilder->expr()->eq('pid', (int) $store_page_id) | ||
+ | ); | ||
+ | |||
+ | $qB->andWhere( | ||
+ | ' n.ncindexcontent like \'%' . $searchword . '%\' ' | ||
+ | ); | ||
+ | </source> | ||
+ | |||
+ | === Komplexe Abfragen=== | ||
+ | |||
+ | =====join ===== | ||
+ | <source lang=php> | ||
+ | $qB->join( | ||
+ | 'n', | ||
+ | 'tt_news_cat_mm', | ||
+ | 'p2c' . $join_i, | ||
+ | $queryBuilder->expr()->andX( | ||
+ | $queryBuilder->expr()->eq('p2c' . $join_i . '.uid_local', $queryBuilder->quoteIdentifier('n.uid')), | ||
+ | $queryBuilder->expr()->in('p2c' . $join_i . '.uid_foreign', trim(implode(",", $ORCategoriesArray),',')) | ||
+ | ) | ||
+ | ); | ||
+ | </source> | ||
+ | |||
+ | |||
+ | =====Equal===== | ||
+ | <source lang=php> | ||
+ | $qB->andWhere( | ||
+ | $qB->expr()->eq('mm.uid_local', $uid) | ||
+ | ); | ||
+ | </source> | ||
+ | |||
+ | |||
+ | |||
+ | =====Equal OR Equal===== | ||
+ | <source lang=php> | ||
+ | $qB->andWhere( | ||
+ | $qB->expr()->orX( | ||
+ | $qB->expr()->eq('nc.parent_category', 1), | ||
+ | $qB->expr()->eq('nc.uid', 2) | ||
+ | ) | ||
+ | ); | ||
+ | </source> | ||
+ | |||
+ | |||
+ | =====LIKE ====== | ||
+ | <source lang=php> | ||
+ | $qB->where( | ||
+ | $qB->expr()->like( | ||
+ | 'email', | ||
+ | $qB->createNamedParameter('%' . $qB->escapeLikeWildcards($domain) . '%') | ||
+ | ) | ||
+ | ); | ||
+ | </source> | ||
+ | =====Limit ===== | ||
+ | <source lang=php> | ||
+ | $qB->setMaxResults(10); | ||
+ | </source> | ||
+ | |||
+ | =====Offset ===== | ||
+ | <source lang=php> | ||
+ | $qB->setFirstResult(20); | ||
+ | </source> | ||
+ | |||
+ | =====Select ===== | ||
+ | <source lang=php> | ||
+ | $qB->select('*', 'n.uid as uid'); | ||
+ | |||
+ | </source> | ||
+ | |||
+ | |||
+ | <source lang=php> | ||
+ | $MysqliStatement = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance(\TYPO3\CMS\Core\Database\ConnectionPool::class) | ||
+ | ->getConnectionForTable('tx_scheduler_task') | ||
+ | ->select( | ||
+ | ['*'], | ||
+ | 'tx_scheduler_task', | ||
+ | ['deleted' => '0'] | ||
+ | ); | ||
+ | krexx($MysqliStatement->fetchAll()); | ||
+ | // ACHTUNG: einmal gefetcht .. nichts mehr drinn!!! | ||
+ | </source> | ||
+ | |||
+ | =====Order By ===== | ||
+ | <source lang=php> | ||
+ | $qB->orderBy('crdate', 'DESC'); | ||
+ | </source> | ||
+ | |||
+ | =====Ausführen ===== | ||
+ | <source lang=php> | ||
+ | $rows = $qB->execute()->fetchAll(); | ||
+ | </source> | ||
+ | |||
+ | ==== Count Distinct AS COUNT==== | ||
+ | <source lang=php> | ||
+ | $qB->addSelectLiteral( | ||
+ | $queryBuilder->expr()->count('n.uid', 'count') | ||
+ | ); | ||
+ | </source> | ||
+ | |||
+ | ===== Count Ausführen ===== | ||
+ | <source lang=php> | ||
+ | $rows = $qB->execute()->fetch(); | ||
+ | </source> | ||
+ | |||
+ | |||
+ | |||
+ | == Wenn Querybuilder keine Option ist == | ||
+ | === Klassen=== | ||
+ | <source lang=php> | ||
+ | use TYPO3\CMS\Core\Database\ConnectionPool; | ||
+ | </source> | ||
+ | |||
+ | ===== Individuelle SELECT Abfragen ===== | ||
+ | |||
+ | <source lang=php> | ||
+ | protected $connectionPool; | ||
+ | /** | ||
+ | * @param string $table | ||
+ | * | ||
+ | * @return \TYPO3\CMS\Core\Database\Connection | ||
+ | */ | ||
+ | protected function getConnection(string $table) | ||
+ | { | ||
+ | if (empty($this->connectionPool)) { | ||
+ | $this->connectionPool = GeneralUtility::makeInstance(ConnectionPool::class); | ||
+ | } | ||
+ | |||
+ | return $this->connectionPool->getConnectionForTable($table); | ||
+ | } | ||
+ | |||
+ | ... | ||
+ | |||
+ | $statement = 'SELECT * fe_users.email from fe_users WHERE activated_on>0 ORDER BY domains ASC'; | ||
+ | $rows= $this->getConnection('fe_users')->executeQuery($statement)->fetchAll(\PDO::FETCH_BOTH); | ||
+ | |||
+ | </source> | ||
+ | |||
+ | == Probleme == | ||
+ | |||
+ | === #1518472189 Request parameters could not be validated (&cHash empty) === | ||
+ | |||
+ | (1/1) #1518472189 TYPO3\CMS\Core\Error\Http\PageNotFoundException | ||
+ | Request parameters could not be validated (&cHash empty) | ||
+ | |||
+ | '''Lösung:''' | ||
+ | |||
+ | * setup.txt | ||
+ | <source lang=typoscript> | ||
+ | plugin.tx_ancregister.features.requireCHashArgumentForActionArguments = 0 | ||
+ | </source> | ||
+ | |||
+ | * https://mbdev.zone/snippets/typo3/chash-entfernen | ||
+ | |||
+ | == BUGFIXES == | ||
+ | |||
+ | === typo3 Backend fe_users exportieren, speziell die Spalte disable === | ||
+ | seit LTS 9 wird die Spalte disable nicht richtig gesetzt | ||
+ | eindeutig: | ||
+ | typo 8: Inaktiv [disable] => Nein wenn user aktiv | ||
+ | |||
+ | nicht eindeutig: | ||
+ | typo 9: Enabled [disable] => Yes wenn user aktiv (auch bei csv irreführend) | ||
+ | |||
+ | |||
+ | Lösung die Sprache ändern: aus disable => aktiv machen | ||
+ | |||
+ | * EXT:ancextension/ext_localconf.php | ||
+ | <source lang=php> | ||
+ | |||
+ | $GLOBALS['TYPO3_CONF_VARS']['SYS']['locallangXMLOverride']['EXT:core/Resources/Private/Language/locallang_core.xlf'][] = 'EXT:ancextension/Resources/Private/Language/locallang_ancbe.xlf'; | ||
+ | $GLOBALS['TYPO3_CONF_VARS']['SYS']['locallangXMLOverride']['EXT:frontend/Resources/Private/Language/locallang_tca.xlf'][] = 'EXT:ancextension/Resources/Private/Language/locallang_ancbe.xlf'; | ||
+ | $GLOBALS['TYPO3_CONF_VARS']['SYS']['locallangXMLOverride']['EXT:core/Resources/Private/Language/locallang_general.xlf'][] = 'EXT:ancextension/Resources/Private/Language/locallang_ancbe.xlf'; | ||
+ | |||
+ | |||
+ | $GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS'][\TYPO3\CMS\Recordlist\RecordList\DatabaseRecordList::class]['customizeCsvHeader'][] = 'Netzcoop\\Ancextension\\Hooks\\NcDatabaseRecordList->addHeaderRowToCSV'; | ||
+ | </source> | ||
+ | |||
+ | |||
+ | * EXT:ancextension/Classes/Hooks/NcDatabaseRecordList.php | ||
+ | <source lang=php> | ||
+ | <?php | ||
+ | |||
+ | namespace Netzcoop\Ancextension\Hooks; | ||
+ | |||
+ | class NcDatabaseRecordList { | ||
+ | public function addHeaderRowToCSV(array &$hookParameters, \TYPO3\CMS\Recordlist\RecordList\DatabaseRecordList $thisDatabaseRecordList) { | ||
+ | if($thisDatabaseRecordList->table ==='fe_users') { | ||
+ | if(is_array($hookParameters['fields']) && $hookParameters['fields']['disable']) { | ||
+ | $hookParameters['fields']['disable'] = $GLOBALS['LANG']->sL('LLL:EXT:ancextension/Resources/Private/Language/locallang_ancbe.xlf:LGL.enabled'); | ||
+ | } | ||
+ | } | ||
+ | } | ||
+ | } | ||
+ | |||
+ | </source> | ||
+ | |||
+ | * EXT:ancextension/Resources/Private/Language/de.locallang_ancbe.xlf | ||
+ | <source lang=php> | ||
+ | <?xml version="1.0" encoding="utf-8" standalone="yes" ?> | ||
+ | |||
+ | <xliff version="1.0"> | ||
+ | <file source-language="en" datatype="plaintext" original="messages" date="2019-03-26T18:44:59Z" product-name="lang"> | ||
+ | <header/> | ||
+ | <body> | ||
+ | <trans-unit id="LGL.enabled" xml:space="preserve"> | ||
+ | <target>aktiviert</target> | ||
+ | </trans-unit> | ||
+ | </body> | ||
+ | </file> | ||
+ | </xliff> | ||
+ | |||
+ | </source> |
Aktuelle Version vom 25. November 2020, 16:33 Uhr
TYPO3 LTS 9 | TYPO3 LTS 8 | TYPO3.CMS 7.6 Schnipsel | Typo3 | Typo3 Entwicklereinstellungen | Typo3 Endbenutzer Hilfe
- https://forge.typo3.org/attachments/download/33482/TYPO3-v9-2-whats-new.german.pdf
- https://blog.comwrap.com/typo3-version-9-die-wichtigsten-features-des-major-releases
- https://jweiland.net/typo3/versionen-und-updates/version-9.html
- https://forge.typo3.org/attachments/download/33888/TYPO3-v9-LTS-whats-new.german.pdf
Inhaltsverzeichnis
- 1 Benötigte Software & Konfiguration
- 2 Typo3 Grundinstallation
- 3 Konfiguration
- 4 Module
- 5 Entwicklung
- 6 Extensions
- 7 netz.coop Extensions
- 8 Speaking URLS
- 9 Source Code Änderungen - deprecated ...
- 10 Query Builder
- 11 Wenn Querybuilder keine Option ist
- 12 Probleme
- 13 BUGFIXES
Benötigte Software & Konfiguration
apt-get install imagemagick wget bash-completion zip unzip apache2 libapache2-mod-php7.2 php7.2-cli php7.2 php7.2-common php7.2-imap php7.2-intl php7.2-mysql php7.2-readline php7.2-soap php7.2-zip php7.2-zip php7.2-gd php7.2-xml php7.2-gd php7.2-json php7.2-opcache php-imagick php7.2-curl php7.2-mbstring php7.2-bcmath php7.2-gmp php7.2-zip mysql-server composer
a2enmod deflate rewrite headers mime expires ssl
mysql_secure_installation
USE mysql;
UPDATE user SET plugin='mysql_native_password' WHERE User='root';
FLUSH PRIVILEGES;
exit;
#Falls Die Sicherheit für Passwörte nachträglich geändert werden muss.
mysql$ SHOW VARIABLES LIKE 'validate_password%';
mysql$ SET GLOBAL validate_password_policy=LOW;
vim /etc/mysql/mysql.conf.d/mysqld.cnf
#add
[mysqld]
validate_password_policy=LOW
Typo3 Grundinstallation
t3 Installation mit git
cd in /var/www/domain
git clone https://github.com/TYPO3/TYPO3.CMS.git
cd TYPO3.CMS/
git fetch --tags
git tag --list
git checkout tags/v.9.5.1
#Externe Bibliotheken installieren
composer install
cd ..
ln -s TYPO3.CMS typo3_src
ln -s typo3_src/typo3 typo3
ln -s typo3_src/index.php .
touch FIRST_INSTALL
# /etc/php/7.2/apache2/php.ini
max_execution_time = 240
max_input_vars = 1500
t3 Installation mit composer
composer create-project "typo3/cms-base-distribution:^9.5" blanco9.netz.coop
cd blanco9.netz.coop
php vendor/bin/typo3cms install:setup
Konfiguration
Debug
.htaccess
SetEnv TYPO3_CONTEXT Development
LocalConfiguration.php
Achtung "Configuration Presets (Global Configuration)" unter Einstellungen, sugeriert nicht das auch defaultMailFromAddress angegeben werden muss :(
<?php
return [
'MAIL' => [
'defaultMailFromAddress' => 'xxxx@domain.tld',
'defaultMailFromName' => 'xxxx domain.tld',
'transport' => 'smtp',
'transport_sendmail_command' => '/usr/sbin/sendmail -t -i ',
'transport_smtp_encrypt' => 'tls',
'transport_smtp_password' => 'password',
'transport_smtp_server' => 'mx.domain.tld:25',
'transport_smtp_username' => 'xxxx@domain.tld',
],
];
Module
Sites
Sprachen lanugages
- https://docs.typo3.org/typo3cms/CoreApiReference/ApiOverview/SiteHandling/Basics.html
- https://docs.typo3.org/typo3cms/CoreApiReference/ApiOverview/Internationalization/ManagingTranslations.html
- https://docs.typo3.org/typo3cms/CoreApiReference/ApiOverview/SiteHandling/AddLanguages.html#
Achtung, derzeit existiert ein language fallback BUG :( https://forge.typo3.org/issues/86762 Seiten welche noch nicht übersetzt sind, kommen auf ne 404 Seite
- erstmal müssen Sprachen angelegt werden auf der Seite 0 (ganz ganz oben in der Seiten Hierrachie) ... dann kann angefangen werden Sprachen über Sites zu konfigurieren
- die Startseite (auch wenn nur Verweis) muss übersetzt werden mit dem Seiten oder Listen Modul
page = PAGE
page {
10 = FLUIDTEMPLATE
10 {
dataProcessing {
120 = TYPO3\CMS\Frontend\DataProcessing\LanguageMenuProcessor
120 {
languages = auto
as = ncMenuLanguage
}
}
}
}
Entwicklung
extbase
link erstellen
$objectManager = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance(\TYPO3\CMS\Extbase\Object\ObjectManager::class);
$uriBuilder = $objectManager->get(\TYPO3\CMS\Extbase\Mvc\Web\Routing\UriBuilder::class);
$uri = $uriBuilder
->reset()
->setTargetPageUid($confArray['ncChPwPluginPageId'])
// ->setArguments($getArgs)
->uriFor(
'ncchpwnoticeandmail',
['cruser' => \Netzcoop\Anclib\Services\NcCrypt::encrypt($feUserId, 'passwort'],
'Ncchpw',
'ancregister',
'ncchpwplugin'
);
}
\TYPO3\CMS\Core\Utility\HttpUtility::redirect($uri);
fluid
flashMessages
mit umlauten, sonderzeichen und html tags
$this->addFlashMessage('äüz<a href="link">link</a>', '', \TYPO3\CMS\Core\Messaging\AbstractMessage::ERROR);
<f:flashMessages as="flashMessages">
<dl class="messages">
<f:for each="{flashMessages}" as="flashMessage">
<dt><f:format.raw>{flashMessage.code}</f:format.raw></dt>
<dd><f:format.raw>{flashMessage.message}</f:format.raw></dd>
</f:for>
</dl>
</f:flashMessages>
Fehlermeldungen (unvollstängig)
class CaptchaValidator extends AbstractValidator
// .........
public function isValid($word)
{
// .........
if (!$isValid) {
// Please enter the word or number as it appears in the image. The entered value was incorrect.
$this->addError(
$this->translateErrorMessage(
'9221561048',
'sr_freecap'
),
9221561048
);
}
return $isValid;
}
}
alle Fehler anzeigen die so existieren
<f:render partial="FormErrors" arguments="{for: 'user'}" />
speziellen Fehler anzeigen
<f:render partial="FieldError" arguments="{for: 'user', field: 'captcha'}" />
Ableiten
Controller ableiten
TYPO3.CMS_7.6_Schnipsel#Backend_Klassen_ableiten
- EXT/ancregister/Classes/Controller/NcFeuserEditController.php
<?php
namespace Netzcoop\Ancregister\Controller;
class NcFeuserEditController extends \Evoweb\SfRegister\Controller\FeuserEditController {
public function formAction(\Evoweb\SfRegister\Domain\Model\FrontendUser $user = null)
{
parent::formAction($user);
}
}
- ext_localconf.php
$GLOBALS['TYPO3_CONF_VARS']['SYS']['Objects']['Evoweb\SfRegister\Controller\FeuserEditController'] = array(
'className' => 'Netzcoop\Ancregister\Controller\NcFeuserEditController'
);
Sprache
$GLOBALS['LANG']->sL('LLL:EXT:core/Resources/Private/Language/locallang_core.xlf:flushPageCachesTitle')
translate
TYPO3.CMS_7.6_Schnipsel#translate
{f:translate(key: 'ncchpw.passwordExpired',
arguments: '{
0: "eins",
1: "zwei",
2: "drei"
}') -> f:format.raw()}
sprache in typoscript für plugin anpassen
plugin.tx_cookieman._LOCAL_LANG.de {
introText = Unsere Webseite verwendet Cookies.
}
Extension Sprache verändern
- Configuration/TypoScript/constants.txt
nc_password_txt = Die Länge des Passwort muß zwischen 8 und 80 Zeichen liegen. Ihr Passwort muss mindestens ein Groß- und Kleinbuchstaben haben, sowie ein Sonderzeichen oder eine Zahl enthalten.
- Configuration/TypoScript/setup.txt
plugin.tx_sfregister._LOCAL_LANG.de {
error_required = Bitte füllen Sie dieses Feld aus.
}
plugin.tx_srfreecap._LOCAL_LANG.de {
notice =
explain =
}
# Achtung: in der felogin Plugin Konfiguration hinterlegte Meldungen überschreiben sämtliche Spracheinstellungen
plugin.tx_felogin_pi1._LOCAL_LANG.de {
username = E-Mail-Adresse
ll_enter_your_data = E-Mail-Adresse
ll_forgot_header = Passwort vergessen?
# ll_forgot_reset_message = ll_forgot_reset_message
ll_welcome_header = Benutzeranmeldung
ll_welcome_message = Geben Sie Ihre E-Mailadresse und Ihr Passwort ein, um sich anzumelden:
# ll_status_header = status_header
# ll_status_message = ll_status_message
# ll_success_message = success_message
# ll_logout_message = logout_message
# ll_error_message = error_message
// siehe oben $plugin.tx_sfregister._LOCAL_LANG.de.passwordRequirements
ll_change_password_message = {$nc_password_txt}
ll_change_password_notvalid_message = {$nc_password_txt}
ll_change_password_tooshort_message = {$nc_password_txt}
ll_change_password_notequal_message = Die Passwörter stimmen nicht überein - das neue Passwort bitte zweimal eingeben. {$nc_password_txt}
}
plugin.tx_felogin_pi1 {
changePasswordNotValidMessage_stdWrap.wrap = <span class="errorMessage">|</span>
changePasswordNotValidMessage_stdWrap.wrap = <span class="errorMessage">|</span>
changePasswordTooShortMessage_stdWrap.wrap = <span class="errorMessage">|</span>
changePasswordNotEqualMessage_stdWrap.wrap = <span class="errorMessage">|</span>
}
Sprache der Backend core Labels übersetzen
zum Beispiel im Backend unter Listen Modul die Spalten
- EXT:ancextension/ext_localconf.php
$GLOBALS['TYPO3_CONF_VARS']['SYS']['locallangXMLOverride']['EXT:core/Resources/Private/Language/locallang_core.xlf'][] = 'EXT:ancextension/Resources/Private/Language/de.locallang_ancbe.xlf';
$GLOBALS['TYPO3_CONF_VARS']['SYS']['locallangXMLOverride']['EXT:frontend/Resources/Private/Language/locallang_tca.xlf'][] = 'EXT:ancextension/Resources/Private/Language/de.locallang_ancbe.xlf';
$GLOBALS['TYPO3_CONF_VARS']['SYS']['locallangXMLOverride']['EXT:core/Resources/Private/Language/locallang_general.xlf'][] = 'EXT:ancextension/Resources/Private/Language/de.locallang_ancbe.xlf';
- EXT:ancextension/Resources/Private/Language/de.locallang_ancbe.xlf
<?xml version="1.0" encoding="utf-8" standalone="yes" ?>
<xliff version="1.0">
<file source-language="en" datatype="plaintext" original="messages" date="2019-03-26T18:44:59Z" product-name="lang">
<header/>
<body>
<trans-unit id="LGL.enabled" xml:space="preserve">
<target>XXXXXXXXXXXXX</target>
</trans-unit>
<trans-unit id="fe_users.lockToDomain" xml:space="preserve">
<target>YYYYYYYYYYYYYYYYY</target>
</trans-unit>
<trans-unit id="labels.toggleall" xml:space="preserve">
<target>Alle auswählen</target>
</trans-unit>
<trans-unit id="rm.closeDoc" xml:space="preserve">
<target>Speichern und Schließen</target>
</trans-unit>
</body>
</file>
</xliff>
sql
- https://docs.typo3.org/m/typo3/reference-coreapi/master/en-us/ApiOverview/Database/ExpressionBuilder/Index.html
- https://docs.typo3.org/m/typo3/reference-coreapi/master/en-us/ApiOverview/Database/Connection/Index.html#delete
- https://wiki.agentur-ibk.de/doku.php?id=repository_datenbank
select
$qB = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance(\TYPO3\CMS\Core\Database\ConnectionPool::class)
->getQueryBuilderForTable('fe_users');
$qB->getRestrictions()->removeAll();
$qB->from('fe_users');
$qB->select('*');
$qB->where(
$qB->expr()->lte('lastlogin', (int) $timestampWaitingPeriodStart)
);
$qB->andWhere(
$qB->expr()->neq('lastlogin', 0)
);
$qB->andWhere(
$qB->expr()->eq('ancfordeletefirstreminder', 0)
);
$qB->andWhere(
$qB->expr()->eq('ancfordeletesecondreminder', 0)
);
$qB->andWhere(
$qB->expr()->eq('ancfordeletelastreminder', 0)
);
$qB->andWhere(
$qB->expr()->eq('deleted', (int) 0)
);
$qB->andWhere(
$qB->expr()->eq('disable', (int) 0)
);
$qB->andWhere(
$qB->expr()->gte('endtime', (int) time())
);
$arrayResult = $qB->execute()->fetchAll();
foreach ($arrayResult as $rowvalue) {
}
update
$qB = GeneralUtility::makeInstance(ConnectionPool::class)
->getQueryBuilderForTable('fe_users');
$qB->update('fe_users')
->where(
$qB->expr()->neq('ancfordeletefirstreminder', 0)
)
->andWhere(
$qB->expr()->gte('lastlogin', (int) $timestampWaitingPeriodStart)
)
->set('ancfordeletefirstreminder', 0)
->set('ancfordeletesecondreminder', 0)
->getRestrictions()->removeAll();
$nrOfUpdates= $qB->execute();
sql queries debuggen
$objectManager = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\CMS\Extbase\Object\ObjectManager');
$frontendUserRepository = $objectManager->get('TYPO3\CMS\Extbase\Domain\Repository\FrontendUserRepository');
$users = $frontendUserRepository->findAll();
$queryParser = $objectManager->get(\TYPO3\CMS\Extbase\Persistence\Generic\Storage\Typo3DbQueryParser::class);
krexx($queryParser->convertQueryToDoctrineQueryBuilder($frontendUserRepository->createQuery())->getSQL());
// ....
$rows = $qB->execute()->fetchAll();
krexx($qB->getSQL());
Einstellungen einer Extension
- sie befindet sich nicht mehr im Module Extension Manager sondern im Module Einstellungen, desweiteren wird sie durch De- und Neuinstallation der Extension die Einstellungen gelöscht!!! was sehr nervig sein kann
- ext_conf_template.txt
# cat=basic/enable/010;; type=int+; label=LLL:EXT:ancfeloginaddon/Resources/Private/Language/locallang_be.xml:basic.showsentmailinfoPageId
showsentmailinfoPageId =
# cat=basic/enable/016;; type=int+; label=LLL:EXT:ancfeloginaddon/Resources/Private/Language/locallang_be.xml:basic.showAfterEmailloginPageId
showAfterEmailloginPageId =
# cat=basic/enable/020;; type=int+; label=LLL:EXT:ancfeloginaddon/Resources/Private/Language/locallang_be.xml:basic.forgotTimeForDeactivateLogin
forgotTimeForDeactivateLogin =
# cat=basic/enable/030;; type=string; label=LLL:EXT:ancfeloginaddon/Resources/Private/Language/locallang_be.xml:basic.mailsubject
mailsubject =
# cat=basic/enable/040;; type=string; label=LLL:EXT:ancfeloginaddon/Resources/Private/Language/locallang_be.xml:basic.mailsender
mailsender =
# cat=basic/enable/050;; type=user[Netzcoop\Ancfeloginaddon\ViewHelpers\TextArea->render]; label=LLL:EXT:ancfeloginaddon/Resources/Private/Language/locallang_be.xml:basic.mailtext
mailtext =
# cat=basic/enable/017;; type=options[gleich=0,ungleich=1]; label=LLL:EXT:ancfeloginaddon/Resources/Private/Language/locallang_be.xml:basic.emailcondition2
emailcondition2 =
$confArray = unserialize($GLOBALS["TYPO3_CONF_VARS"]["EXT"]["extConf"][strtolower($this->extensionName)]);
Scheduler
- TYPO3.CMS 6.2 Extension entwickeln - Cron Scheduler
- https://docs.typo3.org/typo3cms/extensions/scheduler/DevelopersGuide/CreatingTasks/Index.html
Task
- Classes/Task/NcIndexTtnewsPdffilesForSearchTask.php
<?php
namespace Netzcoop\Ancext\Task;
/**
* Description of NcIndexTtnewsPdfFilesForSearch
*
* @author nc
*/
class NcIndexTtnewsPdffilesForSearchTask extends \TYPO3\CMS\Scheduler\Task\AbstractTask {
/**
* @var string
*/
protected $commandIdentifier;
/**
* @var array
*/
protected $arguments = [];
/**
* Function execute from the Scheduler
*
* @return bool TRUE on successful execution
*/
public function execute() {
krexx($this->getArguments());
// ...
return true;
}
/**
* @param array $arguments
*/
public function setArguments($arguments)
{
$this->arguments = $arguments;
}
/**
* @return array
*/
public function getArguments()
{
return $this->arguments;
}
/**
* Return a text representation of the selected command and arguments
*
* @return string Information to display
*/
public function getAdditionalInformation()
{
$label = "spezielle Parameter: \n";
foreach($this->commandIdentifier as $key => $value ) {
$label .= "\t".$key.': '.$value."\n";
}
return $label;
}
/**
* @param string $commandIdentifier
*/
public function setCommandIdentifier($commandIdentifier)
{
$this->commandIdentifier = $commandIdentifier;
}
/**
* @return string
*/
public function getCommandIdentifier()
{
return $this->commandIdentifier;
}
}
AdditionalFieldProvider
diese Klasse ist für das Formular innerhalb eines Task zuständig, Felder werden definiert, validiert und gespeichert!
- Classes/Task/NcIndexTtnewsPdffilesForSearchAdditionalFieldProvider.php
<?php
namespace Netzcoop\Ancext\Task;
class NcIndexTtnewsPdffilesForSearchAdditionalFieldProvider extends \TYPO3\CMS\Scheduler\AbstractAdditionalFieldProvider {
/**
* @var \TYPO3\CMS\Extbase\Mvc\Cli\CommandManager
*/
protected $commandManager;
/**
* @var \TYPO3\CMS\Extbase\Object\ObjectManagerInterface
*/
protected $objectManager;
/**
* @var \TYPO3\CMS\Extbase\Reflection\ReflectionService
*/
protected $reflectionService;
/**
* @var \TYPO3\CMS\Extbase\Scheduler\Task
*/
protected $task;
/**
* Default language file of the extension linkvalidator
*
* @var string
*/
protected $languageFile = 'LLL:EXT:ancext/Resources/Private/Language/locallang.xlf';
const EXT_KEY = 'ancext_task';
/**
* Constructor
*
* @param \TYPO3\CMS\Extbase\Object\ObjectManagerInterface $objectManager
* @param \TYPO3\CMS\Extbase\Mvc\Cli\CommandManager $commandManager
* @param \TYPO3\CMS\Extbase\Reflection\ReflectionService $reflectionService
*/
public function __construct(\TYPO3\CMS\Extbase\Object\ObjectManagerInterface $objectManager = null, \TYPO3\CMS\Extbase\Mvc\Cli\CommandManager $commandManager = null, \TYPO3\CMS\Extbase\Reflection\ReflectionService $reflectionService = null)
{
$this->objectManager = $objectManager ?? \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance(\TYPO3\CMS\Extbase\Object\ObjectManager::class);
$this->commandManager = $commandManager ?? $this->objectManager->get(\TYPO3\CMS\Extbase\Mvc\Cli\CommandManager::class);
$this->reflectionService = $reflectionService ?? $this->objectManager->get(\TYPO3\CMS\Extbase\Reflection\ReflectionService::class);
}
/**
* Render additional information fields within the scheduler backend.
*
* @param array &$taskInfo Array information of task to return
* @param AbstractTask|null $task When editing, reference to the current task. NULL when adding.
* @param SchedulerModuleController $schedulerModule Reference to the calling object (BE module of the Scheduler)
* @return array Additional fields
* @see \TYPO3\CMS\Scheduler\AdditionalFieldProvider#getAdditionalFields($taskInfo, $task, $schedulerModule)
*/
public function getAdditionalFields(array &$taskInfo, $task, \TYPO3\CMS\Scheduler\Controller\SchedulerModuleController $schedulerModule)
{
$this->task = $task;
if ($this->task !== null) {
$this->task->setScheduler();
}
$argumentValues = $this->task->getArguments();
$fields = [];
$fields['ancext_task_description'] = $this->getCommandControllerActionDescriptionField();
$fieldname = 'newsFilePath';
$fields[$fieldname] = [
'code' => '<input type="text" class="form-control" name="tx_scheduler['.self::EXT_KEY.'][arguments]['.htmlspecialchars($fieldname).']" value="' . $argumentValues[$fieldname] . '">',
'label' => $this->languageFile.':ncIndexTtnewsPdffilesForSearchTask.field.newsFilePath',
'cshKey' => '',
'cshLabel' => $fieldname
];
return $fields;
}
/**
* Get description of selected command
*
* @return array
*/
protected function getCommandControllerActionDescriptionField()
{
return [
'code' => '',
'label' => $this->languageFile.':ncIndexTtnewsPdffilesForSearchTask.description'
];
}
public function validateAdditionalFields(array &$submittedData, \TYPO3\CMS\Scheduler\Controller\SchedulerModuleController $parentObject)
{
if(is_dir($submittedData[self::EXT_KEY]['arguments']['newsFilePath'])
|| is_dir(\TYPO3\CMS\Core\Core\Environment::getPublicPath().'/'.$submittedData[self::EXT_KEY]['arguments']['newsFilePath'])
|| is_dir(\TYPO3\CMS\Core\Core\Environment::getProjectPath().'/'.$submittedData[self::EXT_KEY]['arguments']['newsFilePath'])
) {
return true;
} else {
$this->addMessage(
$GLOBALS['LANG']->sL($this->languageFile . ':ncIndexTtnewsPdffilesForSearchTask.field.newsFilePath.error')
.'( '.$submittedData[self::EXT_KEY]['arguments']['newsFilePath']
.' || '.\TYPO3\CMS\Core\Core\Environment::getPublicPath().'/'.$submittedData[self::EXT_KEY]['arguments']['newsFilePath']
.' || '.\TYPO3\CMS\Core\Core\Environment::getProjectPath().'/'.$submittedData[self::EXT_KEY]['arguments']['newsFilePath']
.' )'
,
\TYPO3\CMS\Core\Messaging\FlashMessage::ERROR
);
return false;
}
}
public function saveAdditionalFields(array $submittedData, \TYPO3\CMS\Scheduler\Task\AbstractTask $task)
{
if(is_dir(\TYPO3\CMS\Core\Core\Environment::getPublicPath().'/'.$submittedData[self::EXT_KEY]['arguments']['newsFilePath'])) {
$submittedData[self::EXT_KEY]['arguments']['newsFilePath'] = \TYPO3\CMS\Core\Core\Environment::getPublicPath().'/'.$submittedData[self::EXT_KEY]['arguments']['newsFilePath'];
} else if(is_dir(\TYPO3\CMS\Core\Core\Environment::getProjectPath().'/'.$submittedData[self::EXT_KEY]['arguments']['newsFilePath'])) {
$submittedData[self::EXT_KEY]['arguments']['newsFilePath'] = \TYPO3\CMS\Core\Core\Environment::getProjectPath().'/'.$submittedData[self::EXT_KEY]['arguments']['newsFilePath'];
}
$task->setCommandIdentifier($submittedData[self::EXT_KEY]['arguments']);
$task->setArguments((array)$submittedData[self::EXT_KEY]['arguments']);
}
}
ext_localconf.php
$GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['scheduler']['tasks'][\Netzcoop\Ancext\Task\NcIndexTtnewsPdffilesForSearchTask::class] = array(
'extension' => $_EXTKEY,
'title' => 'LLL:EXT:'.$_EXTKEY.'/Resources/Private/Language/locallang.xlf:ncIndexTtnewsPdffilesForSearchTask.name',
'description' => 'LLL:EXT:'.$_EXTKEY.'/Resources/Private/Language/locallang.xlf:ncIndexTtnewsPdffilesForSearchTask.description',
'additionalFields' => \Netzcoop\Ancext\Task\NcIndexTtnewsPdffilesForSearchAdditionalFieldProvider::class
);
Backend
javascript im iframe im Backend einbinden
(Lösung von TYPO3.CMS_7.6_Schnipsel#Javascript_in_Iframe_im_Backend funzt nicht mehr )
- ext_localconf.php
<?php
$GLOBALS['TYPO3_CONF_VARS']['SYS']['Objects']['TYPO3\CMS\Backend\Form\FormResultCompiler'] = array(
'className' => 'Netzcoop\Extensionsname\Form\NcFormResultCompiler'
);
- extensionsname/Classes/Form/NcFormResultCompiler.php
<?php
namespace Netzcoop\Extensionsname\Form;
class NcFormResultCompiler extends \TYPO3\CMS\Backend\Form\FormResultCompiler {
public function printNeededJSFunctions() {
$pageRenderer = $this->getPageRenderer();
$pageRenderer->addJsFile('EXT:ancextensionname/Resources/Public/JavaScript/ancbackendIframe.js');
return parent::printNeededJSFunctions();
}
}
Extensions
scheduler
über EM Local
vhs
über EM Repository
includekrexx
über EM Repository
ws_scss
git clone https://github.com/svewap/ws_scss.git
gridelements
git clone https://github.com/TYPO3-extensions/gridelements.git
t3sbootstrap
- über https://www.t3sbootstrap.de/typo3-95/
- Konfiguration
- Einstellungen > Extension Configuration > t3sbootstrap > Custom SCSS
- Custom SCSS activate (clear cache and run Scheduler).
- Wartung > Flush TYPO3 and PHP Cache
- Scheduler
- Add task
- Class: T3SB Custom Scss - write a custom scss file
- Type: Single
- TASK "T3SB Custom Scss - write a custom scss file (t3sbootstrap)" ausführen
- Add task
- T3SB Config > nctypo9 (s. TYPO3_LTS_9#Beispiel_Seitenbaum) > New main configuration
- Einstellungen > Extension Configuration > t3sbootstrap > Custom SCSS
lang (Sprache)
Die Sprachkonfiguration wurde in das installtool verlegt
alte Extension Anpassungen
@inject => @TYPO3\CMS\Extbase\Annotation\Inject
@ignorevalidation => @TYPO3\CMS\Extbase\Annotation\IgnoreValidation
render Mode deprecated
<f:flashMessages renderMode="div" />
<f:flashMessages />
htmlEscape="false" deprecated
<f:translate key="email_user_salutation" htmlEscape="false"/>
<f:translate key="email_user_salutation" />
<f:translate key="email_user_salutation" htmlEscape="false"/>,
netz.coop Extensions
anclib
ancbasic
Konfiguration:
Beispiel Seitenbaum
id:0 nctypo
- id:1; Typ: Standard; Verhalten: Als Anfang der Website benutzen; Ressourcen: ancbasic; Erscheinungsbild > Backend-Layout ancbasic layout template; add Template enthält fluid_styled_content,gridelements, t3sbootstrap, anclib, ancbasic
- id:2; Typ: Ordner; Name: menu_main
- id:4: Typ: Seite; Name: Seite 1
- id:5: Typ: Seite; Name: Seite 2
- id:7: Typ: Seite; Name: Seite 2.1
- id:8: Typ: Seite; Name: Seite 2.2
- id:9: Typ: Seite; Name: Seite 2.3
- id:6: Typ: Seite; Name: Seite 3
- id:3; Typ: Ordner; Name: menu_footer
- id:10: Typ: Seite; Name: Kontakt
- id:11: Typ: Seite; Name: Impressum
- id:12: Typ: Seite; Name: Sitemap
- id:13: Typ: Seite; Name: Datenschutz
- id:2; Typ: Ordner; Name: menu_main
Speaking URLS
Site management => Sites
Source Code Änderungen - deprecated ...
@TYPO3\CMS\Extbase\Annotation\Inject not @inject
Query Builder
Klassen
use TYPO3\CMS\Core\Database\ConnectionPool;
use TYPO3\CMS\Core\Database\Query\QueryBuilder;
use TYPO3\CMS\Core\Utility\GeneralUtility;
queryBuilder
$queryBuilder = GeneralUtility::makeInstance(ConnectionPool::class)
->getQueryBuilderForTable('tt_news');
FROM
$qB = $queryBuilder->from('tt_news', 'n');
WHERE
$qB->where(
$queryBuilder->expr()->eq('pid', (int) $store_page_id)
);
$qB->andWhere(
' n.ncindexcontent like \'%' . $searchword . '%\' '
);
Komplexe Abfragen
join
$qB->join(
'n',
'tt_news_cat_mm',
'p2c' . $join_i,
$queryBuilder->expr()->andX(
$queryBuilder->expr()->eq('p2c' . $join_i . '.uid_local', $queryBuilder->quoteIdentifier('n.uid')),
$queryBuilder->expr()->in('p2c' . $join_i . '.uid_foreign', trim(implode(",", $ORCategoriesArray),','))
)
);
Equal
$qB->andWhere(
$qB->expr()->eq('mm.uid_local', $uid)
);
Equal OR Equal
$qB->andWhere(
$qB->expr()->orX(
$qB->expr()->eq('nc.parent_category', 1),
$qB->expr()->eq('nc.uid', 2)
)
);
LIKE =
$qB->where(
$qB->expr()->like(
'email',
$qB->createNamedParameter('%' . $qB->escapeLikeWildcards($domain) . '%')
)
);
Limit
$qB->setMaxResults(10);
Offset
$qB->setFirstResult(20);
Select
$qB->select('*', 'n.uid as uid');
$MysqliStatement = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance(\TYPO3\CMS\Core\Database\ConnectionPool::class)
->getConnectionForTable('tx_scheduler_task')
->select(
['*'],
'tx_scheduler_task',
['deleted' => '0']
);
krexx($MysqliStatement->fetchAll());
// ACHTUNG: einmal gefetcht .. nichts mehr drinn!!!
Order By
$qB->orderBy('crdate', 'DESC');
Ausführen
$rows = $qB->execute()->fetchAll();
Count Distinct AS COUNT
$qB->addSelectLiteral(
$queryBuilder->expr()->count('n.uid', 'count')
);
Count Ausführen
$rows = $qB->execute()->fetch();
Wenn Querybuilder keine Option ist
Klassen
use TYPO3\CMS\Core\Database\ConnectionPool;
Individuelle SELECT Abfragen
protected $connectionPool;
/**
* @param string $table
*
* @return \TYPO3\CMS\Core\Database\Connection
*/
protected function getConnection(string $table)
{
if (empty($this->connectionPool)) {
$this->connectionPool = GeneralUtility::makeInstance(ConnectionPool::class);
}
return $this->connectionPool->getConnectionForTable($table);
}
...
$statement = 'SELECT * fe_users.email from fe_users WHERE activated_on>0 ORDER BY domains ASC';
$rows= $this->getConnection('fe_users')->executeQuery($statement)->fetchAll(\PDO::FETCH_BOTH);
Probleme
#1518472189 Request parameters could not be validated (&cHash empty)
(1/1) #1518472189 TYPO3\CMS\Core\Error\Http\PageNotFoundException Request parameters could not be validated (&cHash empty)
Lösung:
- setup.txt
plugin.tx_ancregister.features.requireCHashArgumentForActionArguments = 0
BUGFIXES
typo3 Backend fe_users exportieren, speziell die Spalte disable
seit LTS 9 wird die Spalte disable nicht richtig gesetzt
eindeutig: typo 8: Inaktiv [disable] => Nein wenn user aktiv nicht eindeutig: typo 9: Enabled [disable] => Yes wenn user aktiv (auch bei csv irreführend)
Lösung die Sprache ändern: aus disable => aktiv machen
- EXT:ancextension/ext_localconf.php
$GLOBALS['TYPO3_CONF_VARS']['SYS']['locallangXMLOverride']['EXT:core/Resources/Private/Language/locallang_core.xlf'][] = 'EXT:ancextension/Resources/Private/Language/locallang_ancbe.xlf';
$GLOBALS['TYPO3_CONF_VARS']['SYS']['locallangXMLOverride']['EXT:frontend/Resources/Private/Language/locallang_tca.xlf'][] = 'EXT:ancextension/Resources/Private/Language/locallang_ancbe.xlf';
$GLOBALS['TYPO3_CONF_VARS']['SYS']['locallangXMLOverride']['EXT:core/Resources/Private/Language/locallang_general.xlf'][] = 'EXT:ancextension/Resources/Private/Language/locallang_ancbe.xlf';
$GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS'][\TYPO3\CMS\Recordlist\RecordList\DatabaseRecordList::class]['customizeCsvHeader'][] = 'Netzcoop\\Ancextension\\Hooks\\NcDatabaseRecordList->addHeaderRowToCSV';
- EXT:ancextension/Classes/Hooks/NcDatabaseRecordList.php
<?php
namespace Netzcoop\Ancextension\Hooks;
class NcDatabaseRecordList {
public function addHeaderRowToCSV(array &$hookParameters, \TYPO3\CMS\Recordlist\RecordList\DatabaseRecordList $thisDatabaseRecordList) {
if($thisDatabaseRecordList->table ==='fe_users') {
if(is_array($hookParameters['fields']) && $hookParameters['fields']['disable']) {
$hookParameters['fields']['disable'] = $GLOBALS['LANG']->sL('LLL:EXT:ancextension/Resources/Private/Language/locallang_ancbe.xlf:LGL.enabled');
}
}
}
}
- EXT:ancextension/Resources/Private/Language/de.locallang_ancbe.xlf
<?xml version="1.0" encoding="utf-8" standalone="yes" ?>
<xliff version="1.0">
<file source-language="en" datatype="plaintext" original="messages" date="2019-03-26T18:44:59Z" product-name="lang">
<header/>
<body>
<trans-unit id="LGL.enabled" xml:space="preserve">
<target>aktiviert</target>
</trans-unit>
</body>
</file>
</xliff>