ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
class.ilLSViewFactory.php
Go to the documentation of this file.
1 <?php
2 
3 declare(strict_types=1);
4 
11 {
12  public function __construct(
13  ilKioskModeService $kiosk_mode_service,
15  ilAccess $access
16  ) {
17  $this->kiosk_mode_service = $kiosk_mode_service;
18  $this->lng = $lng;
19  $this->access = $access;
20  }
21 
22  public function getViewFor(LSLearnerItem $item) : ILIAS\KioskMode\View
23  {
24  $obj = $this->getInstanceByRefId($item->getRefId());
25  if ($this->kiosk_mode_service->hasKioskMode($item->getType())) {
26  return $this->kiosk_mode_service->getViewFor($obj);
27  } else {
28  return $this->getLegacyViewFor($obj);
29  }
30  }
31 
32  protected function getInstanceByRefId(int $ref_id) : ilObject
33  {
34  return ilObjectFactory::getInstanceByRefId($ref_id, false);
35  }
36 
37 
38  protected function getLegacyViewFor(ilObject $obj) : ilLegacyKioskModeView
39  {
40  $view = new ilLegacyKioskModeView(
41  $obj,
42  $this->lng,
43  $this->access
44  );
45  return $view;
46  }
47 }
getViewFor(LSLearnerItem $item)
Class ilLegacyKioskModeView.
Class BaseForm.
getRefId()
Definition: LSItem.php:129
getInstanceByRefId(int $ref_id)
getLegacyViewFor(ilObject $obj)
Class ilAccessHandler.
$lng
Central entry point for users of the service.
__construct(ilKioskModeService $kiosk_mode_service, ilLanguage $lng, ilAccess $access)
static getInstanceByRefId($a_ref_id, $stop_on_error=true)
get an instance of an Ilias object by reference id
language handling
getType()
Definition: LSItem.php:73
Add learning progress and availability information to the LSItem.