Skip to content

Commit 68cd8eb

Browse files
committed
Component/Skill: contribute cron jobs
1 parent c293f4d commit 68cd8eb

3 files changed

Lines changed: 15 additions & 16 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+
self::class,
45+
$use[\ILIAS\Language\Language::class],
46+
$use[\ILIAS\Logging\LoggerFactory::class]
47+
);
4148
}
4249
}

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

Lines changed: 8 additions & 13 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,17 @@
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 init(): void
3937
{
38+
$this->lng->loadLanguageModule("skll");
39+
4040
global $DIC;
4141

42-
$this->lng = $DIC->language();
4342
if (isset($DIC["ilUser"])) {
4443
$this->user = $DIC->user();
4544
}
@@ -59,16 +58,12 @@ public function getId(): string
5958

6059
public function getTitle(): string
6160
{
62-
$lng = $this->lng;
63-
$lng->loadLanguageModule("skll");
64-
return $lng->txt("skll_skill_notification");
61+
return $this->lng->txt("skll_skill_notification");
6562
}
6663

6764
public function getDescription(): string
6865
{
69-
$lng = $this->lng;
70-
$lng->loadLanguageModule("skll");
71-
return $lng->txt("skll_skill_notification_desc");
66+
return $this->lng->txt("skll_skill_notification_desc");
7267
}
7368

7469
public function getDefaultScheduleType(): CronJobScheduleType

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)