Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
TYPO3
sg_mail
Commits
0a2f68e1
Commit
0a2f68e1
authored
Jul 13, 2017
by
Torsten Oppermann
Browse files
[TASK] Refactoring some code, exception handling
parent
15859bab
Changes
1
Hide whitespace changes
Inline
Side-by-side
Classes/Controller/MailController.php
View file @
0a2f68e1
...
...
@@ -71,14 +71,14 @@ class MailController extends ActionController {
* @param string $selectedExtension
* @param string $selectedLanguageLeft
* @param string $selectedLanguageRight
* @param string $selectedExtensionKey
* @param string $selectedTemplateKey
* @throws \InvalidArgumentException
* @throws \UnexpectedValueException
* @throws \TYPO3\CMS\Extbase\Mvc\Exception\StopActionException
* @throws \TYPO3\CMS\Extbase\Mvc\Exception\UnsupportedRequestTypeException
*/
public
function
indexAction
(
$selectedTemplate
=
NULL
,
$selectedExtension
=
NULL
,
$selectedLanguageLeft
=
NULL
,
$selectedLanguageRight
=
NULL
,
$selectedExtensionKey
=
NULL
,
$selectedTemplateKey
=
NULL
$selectedLanguageRight
=
NULL
)
{
$siteRoot
=
BackendService
::
getSiteRoot
((
int
)
GeneralUtility
::
_GP
(
'id'
));
$siteRootId
=
$siteRoot
[
'uid'
];
...
...
@@ -106,20 +106,24 @@ class MailController extends ActionController {
// get last selected languages
if
(
$selectedLanguageLeft
===
NULL
)
{
$selectedLanguageLeft
=
$this
->
session
->
getDataByKey
(
'selectedLanguageLeft'
);
if
(
$selectedLanguageLeft
===
NULL
)
{
$selectedLanguageLeft
FromSession
=
$this
->
session
->
getDataByKey
(
'selectedLanguageLeft'
);
if
(
$selectedLanguageLeft
FromSession
===
NULL
)
{
$selectedLanguageLeft
=
$languages
[
0
];
}
else
{
$selectedLanguageLeft
=
$selectedLanguageLeftFromSession
;
}
}
if
(
$selectedLanguageRight
===
NULL
)
{
$selectedLanguageRight
=
$this
->
session
->
getDataByKey
(
'selectedLanguageRight'
);
if
(
$selectedLanguageRight
===
NULL
)
{
$selectedLanguageRight
FromSession
=
$this
->
session
->
getDataByKey
(
'selectedLanguageRight'
);
if
(
$selectedLanguageRight
FromSession
===
NULL
)
{
if
(
isset
(
$languages
[
1
]))
{
$selectedLanguageRight
=
$languages
[
1
];
}
else
{
$selectedLanguageRight
=
$languages
[
0
];
}
}
else
{
$selectedLanguageRight
=
$selectedLanguageRightFromSession
;
}
}
...
...
@@ -184,12 +188,10 @@ class MailController extends ActionController {
$langFile
=
GeneralUtility
::
readLLfile
(
'EXT:'
.
$selectedExtension
.
'/Resources/Private/Language/locallang.xlf'
,
$selectedLanguageLeft
);
$translatedSubject
=
''
;
$translatedSubject
=
$langFile
[
'default'
][
$subject
][
0
][
'target'
];
if
(
$langFile
[
$selectedLanguageLeft
][
$subject
][
0
])
{
$translatedSubject
=
$langFile
[
$selectedLanguageLeft
][
$subject
][
0
][
'target'
];
}
else
{
$translatedSubject
=
$langFile
[
'default'
][
$subject
][
0
][
'target'
];
}
$this
->
view
->
assign
(
...
...
@@ -200,12 +202,10 @@ class MailController extends ActionController {
$langFile
=
GeneralUtility
::
readLLfile
(
'EXT:'
.
$selectedExtension
.
'/Resources/Private/Language/locallang.xlf'
,
$selectedLanguageRight
);
$translatedSubject
=
''
;
$translatedSubject
=
$langFile
[
'default'
][
$subject
][
0
][
'target'
];
if
(
$langFile
[
$selectedLanguageLeft
][
$subject
][
0
][
$subject
])
{
$translatedSubject
=
$langFile
[
$selectedLanguageRight
][
$subject
][
0
][
'target'
];
}
else
{
$translatedSubject
=
$langFile
[
'default'
][
$subject
][
0
][
'target'
];
}
$this
->
view
->
assign
(
...
...
@@ -272,6 +272,11 @@ class MailController extends ActionController {
* @param string $ccRight
* @param string $bccRight
* @param string $replyToRight
* @throws \InvalidArgumentException
* @throws \TYPO3\CMS\Extbase\Persistence\Exception\IllegalObjectTypeException
* @throws \TYPO3\CMS\Extbase\Persistence\Exception\UnknownObjectException
* @throws \TYPO3\CMS\Extbase\Mvc\Exception\StopActionException
* @throws \TYPO3\CMS\Extbase\Mvc\Exception\UnsupportedRequestTypeException
*/
public
function
saveAction
(
$contentLeft
=
NULL
,
$contentRight
=
NULL
,
$selectedExtension
=
NULL
,
$selectedTemplate
=
NULL
,
...
...
@@ -310,6 +315,9 @@ class MailController extends ActionController {
* @param string $selectedBcc
* @param string $selectedReplyTo
* @return Template $template
* @throws \InvalidArgumentException
* @throws \TYPO3\CMS\Extbase\Persistence\Exception\IllegalObjectTypeException
* @throws \TYPO3\CMS\Extbase\Persistence\Exception\UnknownObjectException
*/
private
function
saveTemplate
(
$selectedExtension
,
$selectedTemplate
,
$selectedLanguage
,
$selectedContent
,
$selectedSubject
,
...
...
@@ -360,6 +368,10 @@ class MailController extends ActionController {
* @param string $selectedExtensionKey
* @param string $selectedLanguageLeft
* @param string $selectedLanguageRight
* @throws \InvalidArgumentException
* @throws \TYPO3\CMS\Extbase\Persistence\Exception\IllegalObjectTypeException
* @throws \TYPO3\CMS\Extbase\Mvc\Exception\StopActionException
* @throws \TYPO3\CMS\Extbase\Mvc\Exception\UnsupportedRequestTypeException
*/
public
function
sendTestMailAction
(
$emailAddress
,
$selectedExtensionKey
,
$selectedTemplateKey
,
$selectedLanguageLeft
,
$selectedLanguageRight
...
...
@@ -410,6 +422,9 @@ class MailController extends ActionController {
* @param string $template
* @param string $extensionKey
* @param string $language
* @throws \InvalidArgumentException
* @throws \TYPO3\CMS\Extbase\Mvc\Exception\StopActionException
* @throws \TYPO3\CMS\Extbase\Mvc\Exception\UnsupportedRequestTypeException
*/
public
function
resetAction
(
$template
,
$extensionKey
,
$language
=
''
)
{
$this
->
templateRepository
->
deleteTemplate
(
$extensionKey
,
$template
,
$language
);
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment