ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
class.ilIndividualAssessmentMembersTableGUI.php
Go to the documentation of this file.
1<?php
2/* @author Denis Klöpfer <denis.kloepfer@concepts-and-training.de> */
3require_once 'Services/Table/classes/class.ilTable2GUI.php';
4require_once 'Modules/IndividualAssessment/classes/Members/class.ilIndividualAssessmentMembersStorageDB.php';
5require_once 'Services/UIComponent/AdvancedSelectionList/classes/class.ilAdvancedSelectionListGUI.php';
6require_once 'Services/Tracking/classes/class.ilLearningProgressBaseGUI.php';
7require_once 'Services/Tracking/classes/class.ilLPStatus.php';
8
16{
17 public function __construct($a_parent_obj, $a_parent_cmd="", $a_template_context="")
18 {
19 parent::__construct($a_parent_obj, $a_parent_cmd, $a_template_context);
20
21 global $DIC;
22 $this->ctrl = $DIC['ilCtrl'];
23 $this->lng = $DIC['lng'];
24 $this->viewer_id = (int) $DIC['ilUser']->getId();
25
26 $this->setEnableTitle(true);
27 $this->setTopCommands(true);
28 $this->setEnableHeader(true);
29 $this->setExternalSorting(false);
30 $this->setExternalSegmentation(true);
31 $this->setRowTemplate("tpl.members_table_row.html", "Modules/IndividualAssessment");
32 $this->setFormAction($this->ctrl->getFormAction($a_parent_obj, "view"));
33
34 $this->iass_access = $this->parent_obj->object->accessHandler();
35
36 foreach ($this->visibleColumns() as $lng_var => $params) {
37 $this->addColumn($this->lng->txt($lng_var), $params[0], $params[1]);
38 }
39 $this->setData(iterator_to_array($a_parent_obj->object->loadVisibleMembers()));
40 }
41
47 protected function visibleColumns()
48 {
49 $columns = array( 'name' => array('name', "")
50 , 'login' => array('login', ""));
51 if ($this->userMayViewGrades() || $this->userMayEditGrades()) {
52 $columns['grading'] = array('lp_status', "");
53 $columns['iass_graded_by'] = array('iass_graded_by', "");
54 $columns['iass_changed_by'] = array('iass_changed_by', "");
55 }
56 $columns['actions'] = array(null, "120px");
57 return $columns;
58 }
59
63 protected function fillRow($a_set)
64 {
65 $this->tpl->setVariable("FULLNAME", $a_set[ilIndividualAssessmentMembers::FIELD_LASTNAME] . ', ' . $a_set[ilIndividualAssessmentMembers::FIELD_FIRSTNAME]);
66 $this->tpl->setVariable("LOGIN", $a_set[ilIndividualAssessmentMembers::FIELD_LOGIN]);
67
69 $this->tpl->setCurrentBlock('access_warning');
70 $this->tpl->setVariable('PARENT_ACCESS', $this->lng->txt('usr_account_inactive'));
71 $this->tpl->parseCurrentBlock();
72 }
73
74 if ($this->userMayViewGrades() || $this->userMayEditGrades()) {
75 $this->tpl->setCurrentBlock('grading_columns');
77 if ($status == 0) {
79 }
80 if ($a_set['finalized'] === '0' && $a_set['examiner_id'] !== null) {
82 }
83 $this->tpl->setVariable("LP_STATUS", $this->getEntryForStatus($status));
84
85 $graded_by = "";
88 }
89 $this->tpl->setVariable("GRADED_BY", $graded_by);
90
91 $changed_by = "";
93 $changed_by =
97 ;
98 }
99 $this->tpl->setVariable("CHANGED_BY", $changed_by);
100 $this->tpl->parseCurrentBlock();
101 }
102
103 $this->tpl->setVariable("ACTIONS", $this->buildActionDropDown($a_set));
104 }
105
113 protected function getImagetPathForStatus($a_status)
114 {
115 switch ($a_status) {
118 break;
121 break;
124 break;
125 default:
127 break;
128 }
130 }
131
139 protected function getEntryForStatus($a_status)
140 {
141 switch ($a_status) {
143 return $this->lng->txt('iass_status_pending');
144 break;
146 return $this->lng->txt('iass_status_completed');
147 break;
149 return $this->lng->txt('iass_status_failed');
150 break;
152 return $this->lng->txt('iass_assessment_not_completed');
153 break;
154 }
155 }
156
164 protected function buildActionDropDown($a_set)
165 {
167 $l->setListTitle($this->lng->txt("actions"));
168
169 $this->ctrl->setParameterByClass('ilIndividualAssessmentMemberGUI', 'usr_id', $a_set['usr_id']);
170 $edited_by_viewer = $this->setWasEditedByViewer((int) $a_set[ilIndividualAssessmentMembers::FIELD_EXAMINER_ID]);
171 $finalized = (bool) $a_set[ilIndividualAssessmentMembers::FIELD_FINALIZED];
172
173 if (($this->userIsSystemAdmin() && $finalized) || ($finalized && (($this->userMayEditGradesOf($a_set["usr_id"]) && $edited_by_viewer) || $this->userMayViewGrades()))) {
174 $target = $this->ctrl->getLinkTargetByClass('ilIndividualAssessmentMemberGUI', 'view');
175 $l->addItem($this->lng->txt('iass_usr_view'), 'view', $target);
176 }
177
178 if (($this->userIsSystemAdmin() && !$finalized) || (!$finalized && $this->userMayEditGradesOf($a_set["usr_id"]) && $edited_by_viewer)) {
179 $target = $this->ctrl->getLinkTargetByClass('ilIndividualAssessmentMemberGUI', 'edit');
180 $l->addItem($this->lng->txt('iass_usr_edit'), 'edit', $target);
181 }
182
183 if (($this->userIsSystemAdmin() && !$finalized) || (!$finalized && $this->userMayEditMembers())) {
184 $this->ctrl->setParameter($this->parent_obj, 'usr_id', $a_set['usr_id']);
185 $target = $this->ctrl->getLinkTarget($this->parent_obj, 'removeUserConfirmation');
186 $this->ctrl->setParameter($this->parent_obj, 'usr_id', null);
187 $l->addItem($this->lng->txt('iass_usr_remove'), 'removeUser', $target);
188 }
189
190 if (($this->userIsSystemAdmin() && $finalized) || ($finalized && $this->userMayAmendGrades())) {
191 $target = $this->ctrl->getLinkTargetByClass('ilIndividualAssessmentMemberGUI', 'amend');
192 $l->addItem($this->lng->txt('iass_usr_amend'), 'amend', $target);
193 }
194
195 if ($this->userIsSystemAdmin() || ($this->userMayDownloadAttachment($a_set['usr_id']) && (string) $a_set['file_name'] !== '')) {
196 $target = $this->ctrl->getLinkTargetByClass('ilIndividualAssessmentMemberGUI', 'downloadAttachment');
197 $l->addItem($this->lng->txt('iass_usr_download_attachment'), 'downloadAttachment', $target);
198 }
199 $this->ctrl->setParameterByClass('ilIndividualAssessmentMemberGUI', 'usr_id', null);
200 return $l->getHTML();
201 }
202
210 protected function setWasEditedByViewer($examiner_id)
211 {
212 return $examiner_id === $this->viewer_id || 0 === $examiner_id;
213 }
214
220 protected function userMayEditGrades()
221 {
222 return $this->iass_access->mayGradeUser();
223 }
224
231 protected function userMayEditGradesOf($a_user_id)
232 {
233 return $this->iass_access->mayGradeUserById($a_user_id);
234 }
235
241 protected function userMayViewGrades()
242 {
243 return $this->iass_access->mayViewUser();
244 }
245
251 protected function userMayEditMembers()
252 {
253 return $this->iass_access->mayEditMembers();
254 }
255
261 protected function userMayAmendGrades()
262 {
263 return $this->iass_access->mayAmendGradeUser();
264 }
265
271 protected function userMayDownloadAttachment($usr_id)
272 {
273 return $this->userMayViewGrades() || $this->userMayEditGrades() || $this->userMayEditGradesOf($usr_id);
274 }
275
281 protected function userIsSystemAdmin()
282 {
283 return $this->iass_access->isSystemAdmin();
284 }
285}
if(! $in) $columns
Definition: Utf8Test.php:45
global $l
Definition: afr.php:30
An exception for terminatinating execution or to throw for unit testing.
const IL_CAL_DATETIME
const IL_CAL_FKT_DATE
User interface class for advanced drop-down selection lists.
@classDescription Date and time handling
getImagetPathForStatus($a_status)
Get image path for lp images.
fillRow($a_set)
Standard Version of Fill Row.Most likely to be overwritten by derived class.
userMayEditGradesOf($a_user_id)
User may edit grades of a specific user.
__construct($a_parent_obj, $a_parent_cmd="", $a_template_context="")
ilTable2GUI constructor.
setWasEditedByViewer($examiner_id)
Check the set was edited by viewing user.
const LP_STATUS_COMPLETED_NUM
const LP_STATUS_IN_PROGRESS_NUM
const LP_STATUS_FAILED_NUM
const LP_STATUS_NOT_ATTEMPTED
static _getImagePathForStatus($a_status)
Get image path for status.
static _lookupActive($a_usr_id)
Check user account active.
Class ilTable2GUI.
setTopCommands($a_val)
Set top commands (display command buttons on top of table, too)
setEnableHeader($a_enableheader)
Set Enable Header.
setExternalSorting($a_val)
Set external sorting.
getId()
Get element id.
setData($a_data)
set table data @access public
setEnableTitle($a_enabletitle)
Set Enable Title.
setRowTemplate($a_template, $a_template_dir="")
Set row template.
addColumn( $a_text, $a_sort_field="", $a_width="", $a_is_checkbox_action_column=false, $a_class="", $a_tooltip="", $a_tooltip_with_html=false)
Add a column to the header.
setExternalSegmentation($a_val)
Set external segmentation.
setFormAction($a_form_action, $a_multipart=false)
Set Form action parameter.
global $DIC
Definition: saml.php:7
$params
Definition: disable.php:11