Skip to content

Commit e0a0dba

Browse files
committed
Component/Course: contribute cron jobs
1 parent d3d7404 commit e0a0dba

3 files changed

Lines changed: 23 additions & 14 deletions

File tree

components/ILIAS/Course/Course.php

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,5 +40,11 @@ public function init(
4040
new \ilCourseSetupAgent(
4141
$pull[\ILIAS\Refinery\Factory::class]
4242
);
43+
$contribute[\ILIAS\Cron\CronJob::class] = static fn() =>
44+
new \ilTimingsCronReminder(
45+
'components\\' . self::class,
46+
$use[\ILIAS\Language\Language::class],
47+
true
48+
);
4349
}
4450
}

components/ILIAS/Course/classes/class.ilTimingsCronReminder.php

Lines changed: 17 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,5 @@
11
<?php
22

3-
declare(strict_types=0);
4-
5-
use ILIAS\Cron\Schedule\CronJobScheduleType;
6-
73
/**
84
* This file is part of ILIAS, a powerful learning management system
95
* published by ILIAS open source e-Learning e.V.
@@ -20,6 +16,10 @@
2016
*
2117
*********************************************************************/
2218

19+
declare(strict_types=0);
20+
21+
use ILIAS\Cron\Schedule\CronJobScheduleType;
22+
2323
class ilTimingsCronReminder extends ilCronJob
2424
{
2525
private static array $objects_information;
@@ -29,21 +29,27 @@ class ilTimingsCronReminder extends ilCronJob
2929
private int $now;
3030

3131
protected ilLogger $log;
32-
protected ilLanguage $lng;
3332
protected ilLanguage $user_lang;
3433
protected ilDBInterface $db;
3534
protected ilObjectDataCache $obj_data_cache;
3635

37-
/**
38-
* Constructor
39-
*/
40-
public function __construct()
36+
public function __construct(
37+
string $component,
38+
\ILIAS\Language\Language $lng,
39+
bool $registration = false
40+
) {
41+
parent::__construct($component, $lng);
42+
$this->lng->loadLanguageModule('crs');
43+
if (!$registration) {
44+
$this->additionalConstruct();
45+
}
46+
}
47+
48+
private function additionalConstruct()
4149
{
4250
global $DIC;
4351

4452
$this->log = $DIC->logger()->crs();
45-
$this->lng = $DIC->language();
46-
$this->lng->loadLanguageModule('crs');
4753
$this->db = $DIC->database();
4854
$this->obj_data_cache = $DIC['ilObjDataCache'];
4955

components/ILIAS/Course/module.xml

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -41,9 +41,6 @@
4141
<event type="raise" id="addSubscriber" />
4242
<event type="raise" id="participantHasPassedCourse" />
4343
</events>
44-
<crons>
45-
<cron id="crs_timings_reminder" class="ilTimingsCronReminder" />
46-
</crons>
4744
<copage>
4845
<pageobject parent_type="lobj" class_name="ilLOPage" directory="classes/Objectives"/>
4946
</copage>

0 commit comments

Comments
 (0)