Skip to content

Commit 8b8ce99

Browse files
committed
Component/Survey: contribute cron jobs
1 parent cf00345 commit 8b8ce99

3 files changed

Lines changed: 18 additions & 7 deletions

File tree

components/ILIAS/Survey/Survey.php

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,5 +34,11 @@ public function init(
3434
): void {
3535
$contribute[Component\Resource\PublicAsset::class] = fn() =>
3636
new Component\Resource\ComponentCSS($this, "survey.css");
37+
$contribute[\ILIAS\Cron\CronJob::class] = static fn() =>
38+
new \ilSurveyCronNotification(
39+
'components\\' . self::class,
40+
$use[\ILIAS\Language\Language::class],
41+
true
42+
);
3743
}
3844
}

components/ILIAS/Survey/classes/class.ilSurveyCronNotification.php

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -26,14 +26,22 @@
2626
*/
2727
class ilSurveyCronNotification extends ilCronJob
2828
{
29-
protected ilLanguage $lng;
3029
protected ilTree $tree;
3130

32-
public function __construct()
31+
public function __construct(
32+
string $component,
33+
\ILIAS\Language\Language $lng,
34+
bool $registration = false
35+
) {
36+
parent::__construct($component, $lng);
37+
if (!$registration) {
38+
$this->additionalConstruct();
39+
}
40+
}
41+
42+
private function additionalConstruct()
3343
{
3444
global $DIC;
35-
36-
$this->lng = $DIC->language();
3745
if (isset($DIC["tree"])) {
3846
$this->tree = $DIC->repositoryTree();
3947
}

components/ILIAS/Survey/module.xml

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,6 @@
2121
<parent id="adm" max="1">adm</parent>
2222
</object>
2323
</objects>
24-
<crons>
25-
<cron id="survey_notification" class="ilSurveyCronNotification" />
26-
</crons>
2724
<mailtemplates>
2825
<context id="svy_context_rmd" class="ilSurveyMailTemplateReminderContext" />
2926
<context id="svy_rater_inv" class="ilSurveyMailTemplateRaterInvitationContext" />

0 commit comments

Comments
 (0)