Skip to content

Commit 8507815

Browse files
committed
Component/Skill: contribute cron jobs
1 parent 8b8ce99 commit 8507815

3 files changed

Lines changed: 22 additions & 10 deletions

File tree

components/ILIAS/Skill/Skill.php

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,5 +38,12 @@ public function init(
3838
);
3939
$contribute[Component\Resource\PublicAsset::class] = fn() =>
4040
new Component\Resource\ComponentJS($this, "SkillEntries.js");
41+
42+
$contribute[\ILIAS\Cron\CronJob::class] = static fn() =>
43+
new \ilSkillNotifications(
44+
'components\\' . self::class,
45+
$use[\ILIAS\Language\Language::class],
46+
true
47+
);
4148
}
4249
}

components/ILIAS/Skill/classes/class.ilSkillNotifications.php

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

3-
declare(strict_types=1);
4-
53
/**
64
* This file is part of ILIAS, a powerful learning management system
75
* published by ILIAS open source e-Learning e.V.
@@ -16,8 +14,9 @@
1614
* https://www.ilias.de
1715
* https://github.com/ILIAS-eLearning
1816
*
19-
********************************************************************
20-
*/
17+
*********************************************************************/
18+
19+
declare(strict_types=1);
2120

2221
use ILIAS\Skill\Service\SkillTreeService;
2322
use ILIAS\Cron\Schedule\CronJobScheduleType;
@@ -29,17 +28,26 @@
2928
*/
3029
class ilSkillNotifications extends ilCronJob
3130
{
32-
protected ilLanguage $lng;
3331
protected ilObjUser $user;
3432
protected ilIniFile $client_ini;
3533
protected ilTree $tree;
3634
protected SkillTreeService $tree_service;
3735

38-
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+
if (!$registration) {
43+
$this->additionalConstruct();
44+
}
45+
}
46+
47+
private function additionalConstruct()
3948
{
4049
global $DIC;
4150

42-
$this->lng = $DIC->language();
4351
if (isset($DIC["ilUser"])) {
4452
$this->user = $DIC->user();
4553
}

components/ILIAS/Skill/service.xml

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,4 @@
1919
<event type="listen" id="components/ILIAS/Object" />
2020
<event type="raise" id="deleteSkill" />
2121
</events>
22-
<crons>
23-
<cron id="skll_notification" class="ilSkillNotifications" />
24-
</crons>
2522
</service>

0 commit comments

Comments
 (0)