-
Notifications
You must be signed in to change notification settings - Fork 340
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
booking manager: migrated settings form
- Loading branch information
Showing
12 changed files
with
696 additions
and
110 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -116,5 +116,4 @@ public function readingTime(): GUIService | |
$this | ||
); | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -26,22 +26,16 @@ | |
use ILIAS\BookingManager\Objects\ObjectsManager; | ||
use ILIAS\BookingManager\Schedule\ScheduleManager; | ||
use ILIAS\User\UserEvent; | ||
use ILIAS\BookingManager\Settings\SettingsManager; | ||
|
||
/** | ||
* @author Alexander Killing <[email protected]> | ||
* Author: Alexander Killing <[email protected]> | ||
*/ | ||
class InternalDomainService | ||
{ | ||
use GlobalDICDomainServices; | ||
|
||
/** | ||
* @var ObjectsManager[] | ||
*/ | ||
protected static array $object_manager = []; | ||
/** | ||
* @var ScheduleManager[] | ||
*/ | ||
protected static array $schedule_manager = []; | ||
protected static array $instances = []; | ||
protected ?\ilLogger $book_log = null; | ||
protected InternalRepoService $repo_service; | ||
protected InternalDataService $data_service; | ||
|
@@ -56,37 +50,23 @@ public function __construct( | |
$this->initDomainServices($DIC); | ||
} | ||
|
||
/* | ||
public function access(int $ref_id, int $user_id) : Access\AccessManager | ||
{ | ||
return new Access\AccessManager( | ||
$this, | ||
$this->access, | ||
$ref_id, | ||
$user_id | ||
); | ||
}*/ | ||
|
||
public function log(): \ilLogger | ||
{ | ||
if (is_null($this->book_log)) { | ||
$this->book_log = $this->logger()->book(); | ||
} | ||
return $this->book_log; | ||
return self::$instances["book_log"] ??= $this->logger()->book(); | ||
} | ||
|
||
public function preferences( | ||
\ilObjBookingPool $pool | ||
): \ilBookingPreferencesManager { | ||
return new \ilBookingPreferencesManager( | ||
return self::$instances["preferences"][$pool->getId()] ??= new \ilBookingPreferencesManager( | ||
$pool, | ||
$this->repo_service->preferenceBasedBooking() | ||
); | ||
} | ||
|
||
public function process(): BookingProcessManager | ||
{ | ||
return new BookingProcessManager( | ||
return self::$instances["process"] ??= new BookingProcessManager( | ||
$this->data_service, | ||
$this->repo_service, | ||
$this | ||
|
@@ -95,33 +75,27 @@ public function process(): BookingProcessManager | |
|
||
public function objects(int $pool_id): ObjectsManager | ||
{ | ||
if (!isset(self::$object_manager[$pool_id])) { | ||
self::$object_manager[$pool_id] = new ObjectsManager( | ||
$this->data_service, | ||
$this->repo_service, | ||
$this, | ||
$pool_id | ||
); | ||
} | ||
return self::$object_manager[$pool_id]; | ||
return self::$instances["objects"][$pool_id] ??= new ObjectsManager( | ||
$this->data_service, | ||
$this->repo_service, | ||
$this, | ||
$pool_id | ||
); | ||
} | ||
|
||
public function schedules(int $pool_id): ScheduleManager | ||
{ | ||
if (!isset(self::$schedule_manager[$pool_id])) { | ||
self::$schedule_manager[$pool_id] = new ScheduleManager( | ||
$this->data_service, | ||
$this->repo_service, | ||
$this, | ||
$pool_id | ||
); | ||
} | ||
return self::$schedule_manager[$pool_id]; | ||
return self::$instances["schedules"][$pool_id] ??= new ScheduleManager( | ||
$this->data_service, | ||
$this->repo_service, | ||
$this, | ||
$pool_id | ||
); | ||
} | ||
|
||
public function reservations(): Reservations\ReservationManager | ||
{ | ||
return new Reservations\ReservationManager( | ||
return self::$instances["reservations"] ??= new Reservations\ReservationManager( | ||
$this->data_service, | ||
$this->repo_service, | ||
$this | ||
|
@@ -130,7 +104,7 @@ public function reservations(): Reservations\ReservationManager | |
|
||
public function participants(): Participants\ParticipantsManager | ||
{ | ||
return new Participants\ParticipantsManager( | ||
return self::$instances["participants"] ??= new Participants\ParticipantsManager( | ||
$this->data_service, | ||
$this->repo_service, | ||
$this | ||
|
@@ -139,7 +113,7 @@ public function participants(): Participants\ParticipantsManager | |
|
||
public function objectSelection(int $pool_id): BookingProcess\ObjectSelectionManager | ||
{ | ||
return new BookingProcess\ObjectSelectionManager( | ||
return self::$instances["object_sel"][$pool_id] ??= new BookingProcess\ObjectSelectionManager( | ||
$this->data_service, | ||
$this->repo_service, | ||
$this, | ||
|
@@ -149,7 +123,15 @@ public function objectSelection(int $pool_id): BookingProcess\ObjectSelectionMan | |
|
||
public function userEvent(): UserEvent | ||
{ | ||
return new UserEvent($this); | ||
return self::$instances["user_event"] ??= new UserEvent($this); | ||
} | ||
|
||
public function bookingSettings(): SettingsManager | ||
{ | ||
return self::$instances["settings"] ??= new SettingsManager( | ||
$this->data_service, | ||
$this->repo_service, | ||
$this | ||
); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,5 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
/** | ||
* This file is part of ILIAS, a powerful learning management system | ||
* published by ILIAS open source e-Learning e.V. | ||
|
@@ -18,6 +16,8 @@ | |
* | ||
*********************************************************************/ | ||
|
||
declare(strict_types=1); | ||
|
||
namespace ILIAS\BookingManager; | ||
|
||
use ILIAS\BookingManager\Reservation\ReservationTableSessionRepository; | ||
|
@@ -26,68 +26,57 @@ | |
use ILIAS\BookingManager\BookingProcess\SelectedObjectsDBRepository; | ||
use ILIAS\BookingManager\Schedule\SchedulesDBRepository; | ||
use ILIAS\BookginManager\Participants\ParticipantsRepository; | ||
use ILIAS\BookingManager\Settings\SettingsDBRepository; | ||
|
||
/** | ||
* Repository internal repo service | ||
* @author Alexander Killing <[email protected]> | ||
*/ | ||
class InternalRepoService | ||
{ | ||
protected InternalDataService $data; | ||
protected \ilDBInterface $db; | ||
protected static array $instances = []; | ||
|
||
public function __construct(InternalDataService $data, \ilDBInterface $db) | ||
{ | ||
$this->data = $data; | ||
$this->db = $db; | ||
public function __construct( | ||
protected InternalDataService $data, | ||
protected \ilDBInterface $db | ||
) { | ||
} | ||
|
||
/* | ||
public function ...() : ...\RepoService | ||
{ | ||
return new ...\RepoService( | ||
$this->data, | ||
$this->db | ||
); | ||
}*/ | ||
|
||
public function preferences(): \ilBookingPreferencesDBRepository | ||
{ | ||
return new \ilBookingPreferencesDBRepository( | ||
return self::$instances["preferences"] ??= new \ilBookingPreferencesDBRepository( | ||
$this->data, | ||
$this->db | ||
); | ||
} | ||
|
||
public function preferenceBasedBooking(): \ilBookingPrefBasedBookGatewayRepository | ||
{ | ||
return new \ilBookingPrefBasedBookGatewayRepository( | ||
return self::$instances["preferenceBasedBooking"] ??= new \ilBookingPrefBasedBookGatewayRepository( | ||
$this->db | ||
); | ||
} | ||
|
||
public function reservationTable(): ReservationTableSessionRepository | ||
{ | ||
return new ReservationTableSessionRepository(); | ||
return self::$instances["reservationTable"] ??= new ReservationTableSessionRepository(); | ||
} | ||
|
||
public function objects(): ObjectsDBRepository | ||
{ | ||
return new ObjectsDBRepository( | ||
return self::$instances["objects"] ??= new ObjectsDBRepository( | ||
$this->db | ||
); | ||
} | ||
|
||
public function schedules(): SchedulesDBRepository | ||
{ | ||
return new SchedulesDBRepository( | ||
return self::$instances["schedules"] ??= new SchedulesDBRepository( | ||
$this->db | ||
); | ||
} | ||
|
||
public function reservation(): ReservationDBRepository | ||
{ | ||
return new ReservationDBRepository($this->db); | ||
return self::$instances["reservation"] ??= new ReservationDBRepository( | ||
$this->db | ||
); | ||
} | ||
|
||
/** | ||
|
@@ -97,17 +86,32 @@ public function reservation(): ReservationDBRepository | |
public function reservationWithContextObjCache( | ||
array $context_obj_ids | ||
): ReservationDBRepository { | ||
return new ReservationDBRepository($this->db, $context_obj_ids); | ||
return new ReservationDBRepository( | ||
$this->db, | ||
$context_obj_ids | ||
); | ||
} | ||
|
||
public function objectSelection(): SelectedObjectsDBRepository | ||
{ | ||
return new SelectedObjectsDBRepository($this->db); | ||
return self::$instances["objectSelection"] ??= new SelectedObjectsDBRepository( | ||
$this->db | ||
); | ||
} | ||
|
||
public function participants(): ParticipantsRepository | ||
{ | ||
return new ParticipantsRepository($this->db); | ||
return self::$instances["participants"] ??= new ParticipantsRepository( | ||
$this->db | ||
); | ||
} | ||
|
||
public function settings(): SettingsDBRepository | ||
{ | ||
return self::$instances["settings"] ??= new SettingsDBRepository( | ||
$this->db, | ||
$this->data | ||
); | ||
} | ||
|
||
} |
Oops, something went wrong.