Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
S
sg_jobs
Manage
Activity
Members
Labels
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Model registry
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
TYPO3
sg_jobs
Commits
e4234ee6
Commit
e4234ee6
authored
3 years ago
by
Matthias Adrowski
Browse files
Options
Downloads
Patches
Plain Diff
[TASK] Migrate JoblistController
parent
fdc53f04
No related branches found
Branches containing commit
No related tags found
Tags containing commit
1 merge request
!35
Feature upgrade to typo3 11
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
Classes/Controller/JoblistController.php
+59
-9
59 additions, 9 deletions
Classes/Controller/JoblistController.php
with
59 additions
and
9 deletions
Classes/Controller/JoblistController.php
+
59
−
9
View file @
e4234ee6
...
...
@@ -146,13 +146,12 @@ class JoblistController extends ActionController {
* @param array $filters
* @param int $jobId
* @param int $currentPageBrowserPage
* @return void
* @throws \TYPO3\CMS\Core\Context\Exception\AspectNotFoundException
* @throws \TYPO3\CMS\Core\Error\Http\PageNotFoundException
* @throws ImmediateResponseException
* @throws \TYPO3\CMS\Core\Package\Exception
*/
public
function
indexAction
(
array
$filters
=
[],
int
$jobId
=
NULL
,
int
$currentPageBrowserPage
=
0
):
void
{
public
function
indexAction
(
array
$filters
=
[],
int
$jobId
=
NULL
,
int
$currentPageBrowserPage
=
0
):
?
\Psr\Http\Message\ResponseInterface
{
if
(
$filters
)
{
$this
->
view
->
assign
(
'selectedCountry'
,
$filters
[
'filterCountry'
]);
$this
->
view
->
assign
(
'selectedCompany'
,
$filters
[
'filterCompany'
]);
...
...
@@ -239,6 +238,13 @@ class JoblistController extends ActionController {
$this
->
view
->
assign
(
'jobs'
,
$jobs
);
$this
->
view
->
assign
(
'limit'
,
$jobLimit
);
$this
->
view
->
assign
(
'numberOfPages'
,
$numberOfPages
);
if
(
version_compare
(
\TYPO3\CMS\Core\Utility\VersionNumberUtility
::
getCurrentTypo3Version
(),
'11.0.0'
,
'<'
))
{
return
NULL
;
}
else
{
return
$this
->
htmlResponse
();
}
}
/**
...
...
@@ -251,7 +257,7 @@ class JoblistController extends ActionController {
* @throws \TYPO3\CMS\Extbase\Mvc\Exception\InvalidArgumentNameException
* @throws \TYPO3\CMS\Extbase\Mvc\Exception\StopActionException
*/
public
function
applyFormAction
(
JobApplication
$applyData
=
NULL
,
string
$error
=
''
,
int
$jobId
=
NULL
):
void
{
public
function
applyFormAction
(
JobApplication
$applyData
=
NULL
,
string
$error
=
''
,
int
$jobId
=
NULL
):
?
\Psr\Http\Message\ResponseInterface
{
if
(
$error
!==
''
)
{
$this
->
view
->
assign
(
'internalError'
,
$error
);
$this
->
request
->
setArgument
(
'error'
,
NULL
);
...
...
@@ -348,22 +354,34 @@ class JoblistController extends ActionController {
$arguments
[
'applyData'
]
=
(
string
)
$arguments
[
'applyData'
];
$this
->
request
->
setArguments
(
$arguments
);
}
if
(
version_compare
(
\TYPO3\CMS\Core\Utility\VersionNumberUtility
::
getCurrentTypo3Version
(),
'11.0.0'
,
'<'
))
{
return
NULL
;
}
else
{
return
$this
->
htmlResponse
();
}
}
/**
* Pre-apply action setup, configures model-property mapping and handles file upload
*
* @return void
* @throws NoSuchArgumentException
* @throws \TYPO3\CMS\Extbase\Mvc\Exception\StopActionException
*/
protected
function
initializeApplyAction
():
void
{
protected
function
initializeApplyAction
():
?
\Psr\Http\Message\ResponseInterface
{
try
{
$uniqueFolderName
=
$this
->
request
->
getArgument
(
'folderName'
);
}
catch
(
NoSuchArgumentException
$exception
)
{
$exceptionMessage
=
'Some file could not be uploaded. Is it too large?'
;
$this
->
redirect
(
'applyForm'
,
NULL
,
NULL
,
[
'error'
=>
$exceptionMessage
]);
exit
;
if
(
version_compare
(
\TYPO3\CMS\Core\Utility\VersionNumberUtility
::
getCurrentTypo3Version
(),
'11.0.0'
,
'<'
))
{
$this
->
redirect
(
'applyForm'
,
NULL
,
NULL
,
[
'error'
=>
$exceptionMessage
]);
return
NULL
;
}
else
{
return
$this
->
redirect
(
'applyForm'
,
NULL
,
NULL
,
[
'error'
=>
$exceptionMessage
]);
}
}
$propertyMappingConfiguration
=
$this
->
arguments
->
getArgument
(
'applyData'
)
->
getPropertyMappingConfiguration
();
$propertyMappingConfiguration
->
forProperty
(
'job'
)
->
allowAllProperties
();
...
...
@@ -377,6 +395,12 @@ class JoblistController extends ActionController {
$typeConverter
->
setTargetUploadFileName
(
$property
);
$propertyMappingConfiguration
->
forProperty
(
$property
)
->
setTypeConverter
(
$typeConverter
);
}
if
(
version_compare
(
\TYPO3\CMS\Core\Utility\VersionNumberUtility
::
getCurrentTypo3Version
(),
'11.0.0'
,
'<'
))
{
return
NULL
;
}
else
{
return
$this
->
htmlResponse
();
}
}
/**
...
...
@@ -406,7 +430,7 @@ class JoblistController extends ActionController {
* @throws \TYPO3\CMS\Extbase\Mvc\Exception\InvalidArgumentNameException
* @throws \TYPO3\CMS\Extbase\Mvc\Exception\StopActionException
*/
public
function
applyAction
(
JobApplication
$applyData
):
void
{
public
function
applyAction
(
JobApplication
$applyData
):
?
\Psr\Http\Message\ResponseInterface
{
$folderName
=
$this
->
request
->
getArgument
(
'folderName'
);
try
{
...
...
@@ -492,6 +516,13 @@ class JoblistController extends ActionController {
[
'applyData'
=>
$applyData
,
'error'
=>
$exception
->
getMessage
(),
'jobId'
=>
$jobId
]
);
}
if
(
version_compare
(
\TYPO3\CMS\Core\Utility\VersionNumberUtility
::
getCurrentTypo3Version
(),
'11.0.0'
,
'<'
))
{
return
NULL
;
}
else
{
return
$this
->
htmlResponse
();
}
}
/**
...
...
@@ -500,7 +531,7 @@ class JoblistController extends ActionController {
* @param int $rootPageId
* @throws \TYPO3\CMS\Core\Context\Exception\AspectNotFoundException
*/
protected
function
assignFilterValues
(
$rootPageId
):
void
{
protected
function
assignFilterValues
(
$rootPageId
):
?
\Psr\Http\Message\ResponseInterface
{
$countries
=
$this
->
companyRepository
->
getAllCountries
(
$rootPageId
);
$this
->
view
->
assign
(
'countries'
,
$countries
);
...
...
@@ -515,6 +546,13 @@ class JoblistController extends ActionController {
$experienceLevels
=
$this
->
experienceLevelRepository
->
findAll
();
$this
->
view
->
assign
(
'experienceLevels'
,
$experienceLevels
);
if
(
version_compare
(
\TYPO3\CMS\Core\Utility\VersionNumberUtility
::
getCurrentTypo3Version
(),
'11.0.0'
,
'<'
))
{
return
NULL
;
}
else
{
return
$this
->
htmlResponse
();
}
}
/**
...
...
@@ -667,4 +705,16 @@ class JoblistController extends ActionController {
parent
::
errorAction
();
}
/**
* Build Typo3 11 Response
* @param string|NULL $html
* @return \Psr\Http\Message\ResponseInterface
*/
protected
function
htmlResponse
(
string
$html
=
null
):
\Psr\Http\Message\ResponseInterface
{
return
$this
->
responseFactory
->
createResponse
()
->
withHeader
(
'Content-Type'
,
'text/html; charset=utf-8'
)
->
withBody
(
$this
->
streamFactory
->
createStream
(
$html
??
$this
->
view
->
render
()));
}
}
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
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!
Save comment
Cancel
Please
register
or
sign in
to comment