ILIAS  release_5-2 Revision v5.2.25-18-g3f80b828510
class.ilIndividualAssessmentMembersTableGUI.php
Go to the documentation of this file.
1 <?php
2 /* @author Denis Klöpfer <denis.kloepfer@concepts-and-training.de> */
3 require_once 'Services/Table/classes/class.ilTable2GUI.php';
4 require_once 'Modules/IndividualAssessment/classes/Members/class.ilIndividualAssessmentMembersStorageDB.php';
5 require_once 'Services/UIComponent/AdvancedSelectionList/classes/class.ilAdvancedSelectionListGUI.php';
6 require_once 'Services/Tracking/classes/class.ilLearningProgressBaseGUI.php';
7 require_once 'Services/Tracking/classes/class.ilLPStatus.php';
9  public function __construct($a_parent_obj, $a_parent_cmd="", $a_template_context="") {
10  parent::__construct($a_parent_obj, $a_parent_cmd, $a_template_context);
11  global $DIC;
12  $this->ctrl = $DIC['ilCtrl'];
13  $this->lng = $DIC['lng'];
14  $this->setEnableTitle(true);
15  $this->setTopCommands(true);
16  $this->setEnableHeader(true);
17  $this->setExternalSorting(false);
18  $this->setExternalSegmentation(true);
19  $this->setRowTemplate("tpl.members_table_row.html", "Modules/IndividualAssessment");
20  $this->setFormAction($this->ctrl->getFormAction($a_parent_obj, "view"));
21  $this->parent_obj = $a_parent_obj;
22  $this->may_edit = $this->userMayEditGrades();
23  $this->may_view = $this->userMayViewGrades();
24  $this->may_book = $this->userMayEditMembers();
25  $this->columns = $this->visibleColumns();
26  $this->viewer_id = $DIC['ilUser']->getId();
27  foreach ($this->columns as $lng_var => $params) {
28  $this->addColumn($this->lng->txt($lng_var), $params[0]);
29  }
30  $this->setData(iterator_to_array($a_parent_obj->object->loadMembers()));
31  }
32 
33  protected function visibleColumns() {
34  $columns = array( 'name' => array('name')
35  , 'login' => array('login'));
36  if($this->may_view || $this->may_edit) {
37  $columns['grading'] = array('lp_status');
38  $columns['iass_graded_by'] = array('iass_graded_by');
39  }
40  $columns['actions'] = array(null);
41  return $columns;
42  }
43 
44  protected function fillRow($a_set) {
45  $this->tpl->setVariable("FULLNAME", $a_set[ilIndividualAssessmentMembers::FIELD_LASTNAME].', '.$a_set[ilIndividualAssessmentMembers::FIELD_FIRSTNAME]);
46  $this->tpl->setVariable("LOGIN", $a_set[ilIndividualAssessmentMembers::FIELD_LOGIN]);
48  $this->tpl->setCurrentBlock('access_warning');
49  $this->tpl->setVariable('PARENT_ACCESS', $this->lng->txt('usr_account_inactive'));
50  $this->tpl->parseCurrentBlock();
51  }
52  if($this->may_view || $this->may_edit) {
53  $this->tpl->setCurrentBlock('lp_info');
55  $this->tpl->setVariable("LP_STATUS", $this->getEntryForStatus($status));
56  $this->tpl->setVariable("GRADED_BY",
60  : '');
61  $this->tpl->parseCurrentBlock();
62  }
63  $this->tpl->setVariable("ACTIONS",$this->buildActionDropDown($a_set));
64  }
65 
66 
67  protected function getImagetPathForStatus($a_status) {
68  switch($a_status) {
71  break;
74  break;
77  break;
78  default :
80  break;
81  }
83  }
84 
85  protected function getEntryForStatus($a_status) {
86  switch($a_status) {
88  return $this->lng->txt('iass_status_pending');
89  break;
91  return $this->lng->txt('iass_status_completed');
92  break;
94  return $this->lng->txt('iass_status_failed');
95  break;
96  }
97  }
98 
99  protected function buildActionDropDown($a_set) {
101  $l->setListTitle($this->lng->txt("actions"));
102 
103  $this->ctrl->setParameterByClass('ilIndividualAssessmentMemberGUI', 'usr_id', $a_set['usr_id']);
104  $edited_by_other = $this->setWasEditedByOtherUser($a_set);
105 
106  if (($a_set['finalized'] && $this->may_edit && !$edited_by_other) || $this->may_view) {
107  $target = $this->ctrl->getLinkTargetByClass('ilIndividualAssessmentMemberGUI','view');
108  $l->addItem($this->lng->txt('iass_usr_view'), 'view', $target);
109  }
110  if(!$a_set['finalized'] && $this->may_edit && !$edited_by_other) {
111  $target = $this->ctrl->getLinkTargetByClass('ilIndividualAssessmentMemberGUI','edit');
112  $l->addItem($this->lng->txt('iass_usr_edit'), 'edit', $target);
113  }
114  if(!$a_set['finalized'] && $this->may_book) {
115  $this->ctrl->setParameter($this->parent_obj, 'usr_id', $a_set['usr_id']);
116  $target = $this->ctrl->getLinkTarget($this->parent_obj,'removeUserConfirmation');
117  $this->ctrl->setParameter($this->parent_obj, 'usr_id', null);
118  $l->addItem($this->lng->txt('iass_usr_remove'), 'removeUser', $target);
119  }
120  $this->ctrl->setParameterByClass('ilIndividualAssessmentMemberGUI', 'usr_id', null);
121  return $l->getHTML();
122  }
123 
124  protected function setWasEditedByOtherUser($set) {
125  return (int)$set[ilIndividualAssessmentMembers::FIELD_EXAMINER_ID] !== (int)$this->viewer_id
127  }
128 
129  protected function userMayEditGrades() {
130  return $this->parent_obj->object->accessHandler()
131  ->checkAccessToObj($this->parent_obj->object,'edit_learning_progress');
132  }
133 
134  protected function userMayViewGrades() {
135  return $this->parent_obj->object->accessHandler()
136  ->checkAccessToObj($this->parent_obj->object,'read_learning_progress');
137  }
138 
139  protected function userMayEditMembers() {
140  return $this->parent_obj->object->accessHandler()
141  ->checkAccessToObj($this->parent_obj->object,'edit_members');
142  }
143 }
const LP_STATUS_COMPLETED_NUM
setExternalSorting($a_val)
Set external sorting.
static _getImagePathForStatus($a_status)
Get image path for status.
const LP_STATUS_NOT_ATTEMPTED
setExternalSegmentation($a_val)
Set external segmentation.
const LP_STATUS_IN_PROGRESS_NUM
setTopCommands($a_val)
Set top commands (display command buttons on top of table, too)
Class ilTable2GUI.
__construct($a_parent_obj, $a_parent_cmd="", $a_template_context="")
Play around with inserting and removing rows and columns
setRowTemplate($a_template, $a_template_dir="")
Set row template.
Create styles array
The data for the language used.
User interface class for advanced drop-down selection lists.
setFormAction($a_form_action, $a_multipart=false)
Set Form action parameter.
global $l
Definition: afr.php:30
setEnableHeader($a_enableheader)
Set Enable Header.
global $DIC
static _lookupActive($a_usr_id)
Check user account active.
setEnableTitle($a_enabletitle)
Set Enable Title.
if(! $in) $columns
Definition: Utf8Test.php:45
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.
$params
Definition: example_049.php:96
const LP_STATUS_FAILED_NUM