ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
LSLearnerItem.php
Go to the documentation of this file.
1<?php
2
3declare(strict_types=1);
4
11class LSLearnerItem extends LSItem
12{
16 protected $usr_id;
17
22
27
31 protected $kiosk_state;
32
33
34 public function __construct(
35 int $usr_id,
38 ILIAS\KioskMode\State $kiosk_state,
39 LSItem $ls_item
40 ) {
41 $this->usr_id = $usr_id;
42 $this->learning_progress_status = $learning_progress_status;
43 $this->availability_status = $availability_status;
44 $this->kiosk_state = $kiosk_state;
45
46 parent::__construct(
47 $ls_item->getType(),
48 $ls_item->getTitle(),
49 $ls_item->getDescription(),
50 $ls_item->getIconPath(),
51 $ls_item->isOnline(),
52 $ls_item->getOrderNumber(),
53 $ls_item->getPostCondition(),
54 $ls_item->getRefId()
55 );
56 }
57
58 public function getUserId() : int
59 {
60 return $this->usr_id;
61 }
62
69 public function getLearningProgressStatus() : int
70 {
72 $lp = $lp_call($this->getRefId(), $this->getUserId());
73 return $lp;
74 }
75
76 public function getAvailability() : int
77 {
79 }
80
81 public function getState() : ILIAS\KioskMode\State
82 {
83 return $this->kiosk_state;
84 }
85
86 public function withPostCondition(ilLSPostCondition $postcondition) : LSItem
87 {
88 throw new \LogicException('keep this item receptive only');
89 }
90
91 public function withOrderNumber(int $position) : LSItem
92 {
93 throw new \LogicException('keep this item receptive only');
94 }
95
96 public function withOnline(bool $online) : LSItem
97 {
98 throw new \LogicException('keep this item receptive only');
99 }
100}
An exception for terminatinating execution or to throw for unit testing.
Data holding class LSItem .
Definition: LSItem.php:12
getRefId()
Definition: LSItem.php:129
getIconPath()
Definition: LSItem.php:88
getOrderNumber()
Definition: LSItem.php:105
getType()
Definition: LSItem.php:73
getDescription()
Definition: LSItem.php:83
getTitle()
Definition: LSItem.php:78
getPostCondition()
Definition: LSItem.php:117
isOnline()
Definition: LSItem.php:93
Add learning progress and availability information to the LSItem.
withOnline(bool $online)
withPostCondition(ilLSPostCondition $postcondition)
getLearningProgressStatus()
Calling a closure here is a breach of the "immutable object" paradigm and no good practice at all!...
withOrderNumber(int $position)
__construct(int $usr_id, \Closure $learning_progress_status, int $availability_status, ILIAS\KioskMode\State $kiosk_state, LSItem $ls_item)
A PostCondition does restrict the progression of a user through the learning sequence.
Class BaseForm.