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
90ab140f
Commit
90ab140f
authored
6 years ago
by
Torsten Oppermann
Browse files
Options
Downloads
Patches
Plain Diff
[TASK] Implementing signal slot for sitemap generation
parent
a7d0f1ab
No related branches found
Branches containing commit
Tags
1.6.3
Tags containing commit
1 merge request
!9
Feature entry registration
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
Classes/SignalSlot/SitemapSignalSlot.php
+58
-3
58 additions, 3 deletions
Classes/SignalSlot/SitemapSignalSlot.php
ext_localconf.php
+4
-4
4 additions, 4 deletions
ext_localconf.php
with
62 additions
and
7 deletions
Classes/SignalSlot/SitemapSignalSlot.php
+
58
−
3
View file @
90ab140f
...
...
@@ -26,21 +26,76 @@ namespace SGalinski\SgJobs\SignalSlot;
* This copyright notice MUST APPEAR in all copies of the script!
***************************************************************/
use
TYPO3\CMS\Core\Database\DatabaseConnection
;
use
TYPO3\CMS\Core\Utility\GeneralUtility
;
use
TYPO3\CMS\Extbase\Mvc\Web\Routing\UriBuilder
;
use
TYPO3\CMS\Extbase\Object\ObjectManager
;
/**
* Signal functions regarding sg_seo sitemap generation
*/
class
SitemapSignalSlot
{
const
PLUGIN_NAME
=
'sgjobs_jobapplication'
;
/**
* @var UriBuilder
*/
protected
$uriBuilder
;
/**
* before the sitemap is generated
*
* @param array $pageList
*/
public
function
beforeSitemapGeneration
(
array
&
$pageList
)
{
/** @var $databaseConnection DatabaseConnection */
$databaseConnection
=
$GLOBALS
[
'TYPO3_DB'
];
// find sites where job detail plugin is added
$rows
=
$databaseConnection
->
exec_SELECTgetRows
(
'pid, pages'
,
'tt_content'
,
'CType = "list" and list_type = "'
.
self
::
PLUGIN_NAME
.
'" and hidden = 0 and deleted = 0'
);
foreach
(
$rows
as
$row
)
{
$jobs
=
$this
->
getJobsByPid
(
$row
[
'pages'
]);
$objectManager
=
GeneralUtility
::
makeInstance
(
ObjectManager
::
class
);
$request
=
$objectManager
->
get
(
\TYPO3\CMS\Extbase\Mvc\Web\Request
::
class
);
$request
->
setRequestUri
(
GeneralUtility
::
getIndpEnv
(
'TYPO3_REQUEST_URL'
));
$request
->
setBaseUri
(
GeneralUtility
::
getIndpEnv
(
'TYPO3_SITE_URL'
));
$this
->
uriBuilder
=
$objectManager
->
get
(
UriBuilder
::
class
);
foreach
(
$jobs
as
$job
)
{
$url
=
$this
->
uriBuilder
->
reset
()
->
setTargetPageUid
(
$row
[
'pid'
])
->
setArguments
(
[
'tx_sgjobs_jobapplication'
=>
[
'jobId'
=>
$job
[
'uid'
]]]
)
->
buildFrontendUri
();
$pageList
[]
=
[
'url'
=>
$url
,
'title'
=>
''
];
}
}
}
/**
* get all jobs stored on specific page ids
*
* @param string $pid
* @return array|null
*/
private
function
getJobsByPid
(
$pid
)
{
/** @var $databaseConnection DatabaseConnection */
$databaseConnection
=
$GLOBALS
[
'TYPO3_DB'
];
$rows
=
$databaseConnection
->
exec_SELECTgetRows
(
'*'
,
'tx_sgjobs_domain_model_job'
,
'pid IN ('
.
$pid
.
')'
);
// @todo
# find sites where job detail plugin is added
# add entry for each job as parameter pid=x jobuid = y to pagelist
return
$rows
;
}
}
This diff is collapsed.
Click to expand it.
ext_localconf.php
+
4
−
4
View file @
90ab140f
...
...
@@ -66,8 +66,8 @@ $signalSlotDispatcher = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance(
\TYPO3\CMS\Extbase\SignalSlot\Dispatcher
::
class
);
$signalSlotDispatcher
->
connect
(
\
TYPO3\CMS\Extensionmanager\Utility\InstallUtility
::
class
,
'
beforeSitemapGeneration
'
,
SGalinski\Sg
Seo\Generator\PagesSitemapGenerator
::
class
,
'
accessPageList
'
\
SGalinski\SgSeo\Generator\PagesSitemapGenerator
::
class
,
'
accessPageList
'
,
\
SGalinski\Sg
Jobs\SignalSlot\SitemapSignalSlot
::
class
,
'
beforeSitemapGeneration
'
);
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