ILIAS  trunk Revision v12.0_alpha-1227-g7ff6d300864
class.ilDashboardLearningSequenceGUI.php
Go to the documentation of this file.
1<?php
2
19declare(strict_types=1);
20
23
25{
26 protected function getIcon(string $title): Standard
27 {
28 if (!isset($this->icon) || is_null($this->icon)) {
29 $this->icon = $this->factory->symbol()->icon()->standard(
30 'lso',
31 $title,
32 'medium'
33 );
34 }
35
36 return $this->icon;
37 }
38
39 public function emptyHandling(): string
40 {
41 return '';
42 }
43
44 public function initViewSettings(): void
45 {
46 $this->view_settings = new ilPDSelectedItemsBlockViewSettings(
47 $this->user,
49 );
50
51 $this->ctrl->setParameter($this, 'view', $this->view_settings->getView());
52 }
53
54 public function initData(): void
55 {
56 $data = [];
57 $assignments = ilParticipants::_getMembershipByType($this->user->getId(), ['lso']);
58 foreach ($assignments as $assignment) {
59 $ref_ids = ilObject::_getAllReferences($assignment);
60 $lso_ref_id = array_shift($ref_ids);
61
63 $lso_obj = ilObjLearningSequence::getInstanceByRefId($lso_ref_id);
64
65 if (!$lso_obj) {
66 continue;
67 }
68
69 if (!(ilLPStatus::_lookupStatus($lso_obj->getId(), $this->user->getId()) === ilLPStatus::LP_STATUS_IN_PROGRESS_NUM)) {
70 continue;
71 }
72
73 if (!$this->access->checkAccess('read', '', $lso_ref_id)) {
74 continue;
75 }
76
77 $data[] = new BlockDTO(
78 'lso',
79 $lso_ref_id,
80 $lso_obj->getId(),
81 $lso_obj->getTitle(),
82 $lso_obj->getDescription(),
83 );
84 }
85
86 $this->setData(['' => $data]);
87 }
88
89 public function getBlockType(): string
90 {
91 return 'dash_ls';
92 }
93
94 public function confirmedRemove(array $ids): void
95 {
96 foreach ($ids as $ref_id) {
97 if ($this->access->checkAccess('leave', '', $ref_id)) {
98 if (ilObject::_lookupType($ref_id, true) === 'lso') {
100 if ($lso instanceof ilObjLearningSequence) {
101 $lso->getLSRoles()->leave($this->user->getId());
102 }
103 }
104
105 ilForumNotification::checkForumsExistsDelete($ref_id, $this->user->getId());
106 }
107 }
108
109 $this->main_tpl->setOnScreenMessage('success', $this->lng->txt('mmbr_unsubscribed_from_objs'), true);
110 $this->ctrl->returnToParent($this);
111 }
112
113 public function removeMultipleEnabled(): bool
114 {
115 return true;
116 }
117}
factory()
static checkForumsExistsDelete(int $ref_id, int $user_id)
const LP_STATUS_IN_PROGRESS_NUM
static _lookupStatus(int $a_obj_id, int $a_user_id, bool $a_create=true)
Lookup status.
static getInstanceByRefId(int $ref_id)
static _lookupType(int $id, bool $reference=false)
static _getAllReferences(int $id)
get all reference ids for object ID
static _getMembershipByType(int $a_usr_id, array $a_type, bool $a_only_member_role=false)
get membership by type Get course or group membership
This describes the specific behavior of an ILIAS standard icon.
Definition: Standard.php:27
$ref_id
Definition: ltiauth.php:66