ILIAS  release_8 Revision v8.19
All Data Structures Namespaces Files Functions Variables Modules Pages
class.DomainService.php
Go to the documentation of this file.
1 <?php
2 
3 declare(strict_types=1);
4 
22 
25 
31 {
34 
35  // for managers that need to be created
36  // on the fly and should be cached
37  protected static array $managers = [];
38 
39  public function __construct(
40  InternalDomainService $domain_service,
41  InternalRepoService $repo_service
42  ) {
43  $this->domain_service = $domain_service;
44  $this->repo_service = $repo_service;
45  }
46 
51  public function randomAssignments(\ilObjExercise $exercise, \ilObjUser $user = null): Mandatory\RandomAssignmentsManager
52  {
53  if (!isset(self::$managers[Mandatory\RandomAssignmentsManager::class][$exercise->getId()])) {
54  self::$managers[Mandatory\RandomAssignmentsManager::class][$exercise->getId()] =
56  $exercise,
57  $this->repo_service->assignment()->randomAssignments(),
58  $this->repo_service->submission(),
59  $user
60  );
61  }
62  return self::$managers[Mandatory\RandomAssignmentsManager::class][$exercise->getId()];
63  }
64 
69  public function mandatoryAssignments(\ilObjExercise $exercise): Mandatory\MandatoryAssignmentsManager
70  {
71  if (!isset(self::$managers[Mandatory\MandatoryAssignmentsManager::class][$exercise->getId()])) {
72  self::$managers[Mandatory\MandatoryAssignmentsManager::class][$exercise->getId()] =
73  new Mandatory\MandatoryAssignmentsManager($exercise, $this->randomAssignments($exercise));
74  }
75  return self::$managers[Mandatory\MandatoryAssignmentsManager::class][$exercise->getId()];
76  }
77 }
__construct(InternalDomainService $domain_service, InternalRepoService $repo_service)
Class ilObjExercise.
Manages random mandatory assignments of an exercise (business logic)
randomAssignments(\ilObjExercise $exercise, \ilObjUser $user=null)
Get random assignment manager.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
Exercise domain service (business logic)
mandatoryAssignments(\ilObjExercise $exercise)
Get mandatory assignment manager.