ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
class.ilLPListOfProgressGUI.php
Go to the documentation of this file.
1<?php
2/* Copyright (c) 1998-2010 ILIAS open source, Extended GPL, see docs/LICENSE */
3
17{
18 public $tracked_user = null;
19 public $details_id = 0;
20 public $details_type = '';
21 public $details_mode = 0;
22
23 public function __construct($a_mode, $a_ref_id, $a_user_id = 0)
24 {
25 parent::__construct($a_mode, $a_ref_id, $a_user_id);
26 $this->__initUser($a_user_id);
27
28 // Set item id for details
29 $this->__initDetails((int) $_GET['details_id']);
30 $this->ctrl->saveParameter($this, 'details_id', $_REQUEST['details_id']);
31 }
32
33
37 public function executeCommand()
38 {
39 global $ilUser;
40
41 $this->ctrl->setReturn($this, "show");
42 $this->ctrl->saveParameter($this, 'user_id', $this->getUserId());
43 switch ($this->ctrl->getNextClass()) {
44 case 'illpprogresstablegui':
45 include_once './Services/Tracking/classes/repository_statistics/class.ilLPProgressTableGUI.php';
46 $table_gui = new ilLPProgressTableGUI($this, "", $this->tracked_user);
47 $this->ctrl->setReturn($this, 'show');
48 $this->ctrl->forwardCommand($table_gui);
49 break;
50
51 default:
52 $cmd = $this->__getDefaultCommand();
53 $this->$cmd();
54
55 }
56 return true;
57 }
58
59 public function show()
60 {
61 global $ilObjDataCache;
62
63 switch ($this->getMode()) {
64 // Show only detail of current repository item if called from repository
66 $this->__initDetails($this->getRefId());
67 return $this->details();
68
71 // if called from user folder obj_id is id of current user
72 $this->__initUser($this->getUserId());
73 break;
74 }
75
76 // not called from repository
77 $this->__showProgressList();
78 }
79
80 public function details()
81 {
82 global $ilToolbar,$ilCtrl,$rbacsystem, $ilAccess;
83
88 // Show back button to crs if called from crs. Otherwise if called from personal desktop or administration
89 // show back to list
90 if ((int) $_GET['crs_id']) {
91 $this->ctrl->setParameter($this, 'details_id', (int) $_GET['crs_id']);
92
93 $ilToolbar->addButton(
94 $this->lng->txt('trac_view_crs'),
95 $this->ctrl->getLinkTarget($this, 'details')
96 );
97 } elseif ($this->getMode() == self::LP_CONTEXT_PERSONAL_DESKTOP or
98 $this->getMode() == self::LP_CONTEXT_ADMINISTRATION or
99 $this->getMode() == self::LP_CONTEXT_USER_FOLDER) {
100 $ilToolbar->addButton(
101 $this->lng->txt('trac_view_list'),
102 $this->ctrl->getLinkTarget($this, 'show')
103 );
104 }
105
106 $this->tpl->addBlockFile('ADM_CONTENT', 'adm_content', 'tpl.lp_progress_container.html', 'Services/Tracking');
107
108 include_once("./Services/InfoScreen/classes/class.ilInfoScreenGUI.php");
109 $info = new ilInfoScreenGUI($this);
110 $info->setFormAction($ilCtrl->getFormAction($this));
111 $this->__appendUserInfo($info, $this->tracked_user);
112 $this->__appendLPDetails($info, $this->details_obj_id, $this->tracked_user->getId());
113 $this->__showObjectDetails($info, $this->details_obj_id, false);
114
115 // Finally set template variable
116 $this->tpl->setVariable("LM_INFO", $info->getHTML());
117
118 include_once './Services/Object/classes/class.ilObjectLP.php';
119 $olp = ilObjectLP::getInstance($this->details_obj_id);
120 $collection = $olp->getCollectionInstance();
121 $obj_ids = array();
122 if ($collection) {
123 foreach ($collection->getItems() as $item_id) {
124 if ($collection instanceof ilLPCollectionOfRepositoryObjects) {
125 $obj_id = ilObject::_lookupObjectId($item_id);
126 if ($ilAccess->checkAccessOfUser($this->tracked_user->getId(), 'visible', '', $item_id)) {
127 $obj_ids[$obj_id] = array( $item_id );
128 }
129 } else {
130 $obj_ids[] = $item_id;
131 }
132 }
133 }
134
135 // #15247
136 if (count($obj_ids) > 0) {
137 // seems obsolete
138 include_once './Services/Tracking/classes/class.ilLearningProgressAccess.php';
139 $personal_only = !ilLearningProgressAccess::checkPermission('read_learning_progress', $this->getRefId());
140
141 include_once("./Services/Tracking/classes/repository_statistics/class.ilLPProgressTableGUI.php");
142 $lp_table = new ilLPProgressTableGUI($this, "details", $this->tracked_user, $obj_ids, true, $this->details_mode, $personal_only, $this->details_obj_id, $this->details_id);
143 $this->tpl->setVariable("LP_OBJECTS", $lp_table->getHTML());
144 }
145
146 $this->tpl->setVariable("LEGEND", $this->__getLegendHTML());
147 }
148
149 public function __showProgressList()
150 {
151 global $ilUser,$ilObjDataCache,$ilCtrl;
152
153 $this->tpl->addBlockFile('ADM_CONTENT', 'adm_content', 'tpl.lp_list_progress.html', 'Services/Tracking');
154
155 // User info
156 include_once("./Services/InfoScreen/classes/class.ilInfoScreenGUI.php");
157 $info = new ilInfoScreenGUI($this);
158 $info->setFormAction($ilCtrl->getFormAction($this));
159
160 if ($this->__appendUserInfo($info, $this->tracked_user)) {
161 $this->tpl->setCurrentBlock("info_user");
162 $this->tpl->setVariable("USER_INFO", $info->getHTML());
163 $this->tpl->parseCurrentBlock();
164 }
165
166 include_once("./Services/Tracking/classes/repository_statistics/class.ilLPProgressTableGUI.php");
167 $lp_table = new ilLPProgressTableGUI($this, "", $this->tracked_user, null, false, null, false, null, null, $this->getMode());
168 $this->tpl->setVariable("LP_OBJECTS", $lp_table->getHTML());
169
170 $this->tpl->setVariable("LEGEND", $this->__getLegendHTML());
171 }
172
173 public function __initUser($a_usr_id = 0)
174 {
175 global $ilUser,$rbacreview,$rbacsystem;
176
177 if ($_POST['user_id']) {
178 $a_usr_id = $_POST['user_id'];
179 $this->ctrl->setParameter($this, 'user_id', $_POST['user_id']);
180 }
181
182 if ($a_usr_id) {
183 $this->tracked_user = ilObjectFactory::getInstanceByObjId($a_usr_id);
184 } else {
185 $this->tracked_user = $ilUser;
186 }
187
188 // #8762: see ilObjUserGUI->getTabs()
189 if ($this->mode == self::LP_CONTEXT_USER_FOLDER && $rbacsystem->checkAccess('read', $this->ref_id)) {
190 return true;
191 }
192
193 if ($this->mode == self::LP_CONTEXT_ORG_UNIT && ilObjOrgUnitAccess::_checkAccessToUserLearningProgress($this->ref_id, $a_usr_id)) {
194 return true;
195 }
196
197 // Check access
198 if (!$rbacreview->isAssigned($ilUser->getId(), SYSTEM_ROLE_ID)) {
199 $this->tracked_user = $ilUser;
200 }
201
202 return true;
203 }
204
205 public function __initDetails($a_details_id)
206 {
207 global $ilObjDataCache;
208
209 if (!$a_details_id) {
210 $a_details_id = $this->getRefId();
211 }
212 if ($a_details_id) {
213 $ref_ids = ilObject::_getAllReferences($a_details_id);
214
215 $this->details_id = $a_details_id;
216 $this->details_obj_id = $ilObjDataCache->lookupObjId($this->details_id);
217 $this->details_type = $ilObjDataCache->lookupType($this->details_obj_id);
218
219 include_once 'Services/Object/classes/class.ilObjectLP.php';
220 $olp = ilObjectLP::getInstance($this->details_obj_id);
221 $this->details_mode = $olp->getCurrentMode();
222 }
223 }
224}
$_GET["client_id"]
$_POST["username"]
An exception for terminatinating execution or to throw for unit testing.
Class ilInfoScreenGUI.
__construct($a_mode, $a_ref_id, $a_user_id=0)
TableGUI class for learning progress.
static checkPermission($a_permission, $a_ref_id, $a_user_id=null)
wrapper for rbac access checks
__showObjectDetails(&$info, $item_id=0, $add_section=true)
show details about current object.
__appendLPDetails(&$info, $item_id, $user_id)
static _checkAccessToUserLearningProgress($ref_id, $usr_id)
static getInstanceByObjId($a_obj_id, $stop_on_error=true)
get an instance of an Ilias object by object id
static getInstance($a_obj_id)
static _lookupObjectId($a_ref_id)
lookup object id
static _getAllReferences($a_id)
get all reference ids of object
global $ilCtrl
Definition: ilias.php:18
$info
Definition: index.php:5
$ilUser
Definition: imgupload.php:18