Skip to content

Commit d02e204

Browse files
committed
Component/Exercise: contribute cron jobs
1 parent 52c24d5 commit d02e204

4 files changed

Lines changed: 18 additions & 25 deletions

File tree

components/ILIAS/Exercise/Exercise.php

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,5 +42,17 @@ public function init(
4242
new Component\Resource\ComponentJS($this, "ilExcPresentation.js");
4343
$contribute[Component\Resource\PublicAsset::class] = fn() =>
4444
new Component\Resource\ComponentJS($this, "ilExcPeerReview.js");
45+
$contribute[\ILIAS\Cron\CronJob::class] = static fn() =>
46+
new \ilExcCronFeedbackNotification(
47+
self::class,
48+
$use[\ILIAS\Language\Language::class],
49+
$use[\ILIAS\Logging\LoggerFactory::class]
50+
);
51+
$contribute[\ILIAS\Cron\CronJob::class] = static fn() =>
52+
new \ilExcCronReminders(
53+
self::class,
54+
$use[\ILIAS\Language\Language::class],
55+
$use[\ILIAS\Logging\LoggerFactory::class]
56+
);
4557
}
4658
}

components/ILIAS/Exercise/classes/class.ilExcCronFeedbackNotification.php

Lines changed: 4 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -26,14 +26,9 @@
2626
*/
2727
class ilExcCronFeedbackNotification extends ilCronJob
2828
{
29-
protected ilLanguage $lng;
30-
31-
32-
public function __construct()
29+
public function init(): void
3330
{
34-
global $DIC;
35-
36-
$this->lng = $DIC->language();
31+
$this->lng->loadLanguageModule('exc');
3732
}
3833

3934
public function getId(): string
@@ -43,18 +38,12 @@ public function getId(): string
4338

4439
public function getTitle(): string
4540
{
46-
$lng = $this->lng;
47-
48-
$lng->loadLanguageModule("exc");
49-
return $lng->txt("exc_global_feedback_file_cron");
41+
return $this->lng->txt("exc_global_feedback_file_cron");
5042
}
5143

5244
public function getDescription(): string
5345
{
54-
$lng = $this->lng;
55-
56-
$lng->loadLanguageModule("exc");
57-
return $lng->txt("exc_global_feedback_file_cron_info");
46+
return $this->lng->txt("exc_global_feedback_file_cron_info");
5847
}
5948

6049
public function getDefaultScheduleType(): CronJobScheduleType

components/ILIAS/Exercise/classes/class.ilExcCronReminders.php

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -26,13 +26,9 @@
2626
*/
2727
class ilExcCronReminders extends ilCronJob
2828
{
29-
protected ilLanguage $lng;
30-
31-
public function __construct()
29+
public function init(): void
3230
{
33-
global $DIC;
34-
35-
$this->lng = $DIC->language();
31+
$this->lng->loadLanguageModule('exc');
3632
}
3733

3834
public function getId(): string

components/ILIAS/Exercise/module.xml

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,10 +25,6 @@
2525
<parent id="wfld">wfld</parent>
2626
</object>
2727
</objects>
28-
<crons>
29-
<cron id="exc_feedback_notification" class="ilExcCronFeedbackNotification" />
30-
<cron id="exc_reminders" class="ilExcCronReminders" />
31-
</crons>
3228
<mailtemplates>
3329
<context id="exc_context_submit_rmd" class="ilExcMailTemplateSubmitReminderContext" />
3430
<context id="exc_context_grade_rmd" class="ilExcMailTemplateGradeReminderContext" />

0 commit comments

Comments
 (0)