ILIAS  trunk Revision v11.0_alpha-2638-g80c1d007f79
class.ilLSViewFactory.php
Go to the documentation of this file.
1 <?php
2 
19 declare(strict_types=1);
20 
22 
27 {
29  protected ilLanguage $lng;
30  protected ilAccess $access;
32 
33  public function __construct(
34  ilKioskModeService $kiosk_mode_service,
35  ilLanguage $lng,
36  ilAccess $access,
37  LOMServices $lom_services
38  ) {
39  $this->kiosk_mode_service = $kiosk_mode_service;
40  $this->lng = $lng;
41  $this->access = $access;
42  $this->lom_services = $lom_services;
43  }
44 
45  public function getViewFor(LSLearnerItem $item): ILIAS\KioskMode\View
46  {
47  $obj = $this->getInstanceByRefId($item->getRefId());
48  if ($this->kiosk_mode_service->hasKioskMode($item->getType())) {
49  return $this->kiosk_mode_service->getViewFor($obj);
50  } else {
51  return $this->getLegacyViewFor($obj);
52  }
53  }
54 
55  protected function getInstanceByRefId(int $ref_id): ?\ilObject
56  {
57  return ilObjectFactory::getInstanceByRefId($ref_id, false);
58  }
59 
60 
62  {
63  return new ilLegacyKioskModeView(
64  $obj,
65  $this->lng,
66  $this->access,
67  $this->lom_services
68  );
69  }
70 }
getViewFor(LSLearnerItem $item)
ilKioskModeService $kiosk_mode_service
Interface Observer Contains several chained tasks and infos about them.
getRefId()
Definition: LSItem.php:93
getInstanceByRefId(int $ref_id)
getLegacyViewFor(ilObject $obj)
__construct(ilKioskModeService $kiosk_mode_service, ilLanguage $lng, ilAccess $access, LOMServices $lom_services)
$ref_id
Definition: ltiauth.php:65
static getInstanceByRefId(int $ref_id, bool $stop_on_error=true)
get an instance of an Ilias object by reference id
Central entry point for users of the service.
getType()
Definition: LSItem.php:58
Add learning progress and availability information to the LSItem.