Skip to content

Commit 416c3b7

Browse files
committed
Component/BookingManager: contribute cron jobs
1 parent 5469618 commit 416c3b7

4 files changed

Lines changed: 25 additions & 18 deletions

File tree

components/ILIAS/BookingManager/BookingManager.php

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,5 +39,17 @@ public function init(
3939

4040
$contribute[Component\Resource\PublicAsset::class] = fn() =>
4141
new Component\Resource\ComponentJS($this, "ScheduleInput.js");
42+
43+
$contribute[\ILIAS\Cron\CronJob::class] = static fn() =>
44+
new \ilBookCronNotification(
45+
'components\\' . self::class,
46+
$use[\ILIAS\Language\Language::class],
47+
true
48+
);
49+
$contribute[\ILIAS\Cron\CronJob::class] = static fn() =>
50+
new \ilBookingPrefBookCron(
51+
'components\\' . self::class,
52+
$use[\ILIAS\Language\Language::class]
53+
);
4254
}
4355
}

components/ILIAS/BookingManager/classes/class.ilBookCronNotification.php

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -25,15 +25,23 @@
2525
class ilBookCronNotification extends ilCronJob
2626
{
2727
protected \ILIAS\BookingManager\InternalRepoService $repo;
28-
protected ilLanguage $lng;
2928
protected ilLogger $book_log;
3029

31-
public function __construct()
30+
public function __construct(
31+
string $component,
32+
\ILIAS\Language\Language $lng,
33+
bool $registration = false
34+
) {
35+
parent::__construct($component, $lng);
36+
$this->lng->loadLanguageModule('dateplaner');
37+
if (!$registration) {
38+
$this->additionalConstruct();
39+
}
40+
}
41+
42+
private function additionalConstruct()
3243
{
3344
global $DIC;
34-
35-
$this->lng = $DIC->language();
36-
3745
$this->book_log = ilLoggerFactory::getLogger("book");
3846
$this->repo = $DIC->bookingManager()
3947
->internal()

components/ILIAS/BookingManager/classes/class.ilBookingPrefBookCron.php

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -26,15 +26,6 @@
2626
*/
2727
class ilBookingPrefBookCron extends ilCronJob
2828
{
29-
protected ilLanguage $lng;
30-
31-
public function __construct()
32-
{
33-
global $DIC;
34-
35-
$this->lng = $DIC->language();
36-
}
37-
3829
public function getId(): string
3930
{
4031
return "book_pref_book";

components/ILIAS/BookingManager/module.xml

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,5 @@
2121
<web_access_checker>
2222
<secure_path path="ilBookingManager" checking-class="ilObjBookingPoolAccess"/>
2323
</web_access_checker>
24-
<crons>
25-
<cron id="book_notification" class="ilBookCronNotification" />
26-
<cron id="book_pref_book" class="ilBookingPrefBookCron" />
27-
</crons>
2824
<logging />
2925
</module>

0 commit comments

Comments
 (0)