ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
class.ilTestManScoringParticipantsTableGUI.php
Go to the documentation of this file.
1 <?php
2 /* Copyright (c) 1998-2013 ILIAS open source, Extended GPL, see docs/LICENSE */
3 
4 
5 include_once('./Services/Table/classes/class.ilTable2GUI.php');
6 
16 {
17  const PARENT_DEFAULT_CMD = 'showManScoringParticipantsTable';
18  const PARENT_APPLY_FILTER_CMD = 'applyManScoringParticipantsFilter';
19  const PARENT_RESET_FILTER_CMD = 'resetManScoringParticipantsFilter';
20 
21  const PARENT_EDIT_SCORING_CMD = 'showManScoringParticipantScreen';
22 
28  public function __construct($parentObj)
29  {
30  $this->setPrefix('manScorePartTable');
31  $this->setId('manScorePartTable');
32 
33  parent::__construct($parentObj, self::PARENT_DEFAULT_CMD);
34 
35  $this->setFilterCommand(self::PARENT_APPLY_FILTER_CMD);
36  $this->setResetCommand(self::PARENT_RESET_FILTER_CMD);
37 
38  global $DIC;
39  $ilCtrl = $DIC['ilCtrl'];
40 
41  $this->setFormName('manScorePartTable');
42  $this->setStyle('table', 'fullwidth');
43 
44  $this->enable('header');
45 
46  $this->setFormAction($ilCtrl->getFormAction($parentObj, self::PARENT_DEFAULT_CMD));
47 
48  $this->setRowTemplate("tpl.il_as_tst_man_scoring_participant_tblrow.html", "Modules/Test");
49 
50  $this->initColumns();
51  $this->initOrdering();
52 
53  $this->initFilter();
54  }
55 
56  private function initColumns()
57  {
58  global $DIC;
59  $lng = $DIC['lng'];
60 
61  if ($this->parent_obj->object->getAnonymity()) {
62  $this->addColumn($lng->txt("name"), 'lastname', '100%');
63  } else {
64  $this->addColumn($lng->txt("lastname"), 'lastname', '');
65  $this->addColumn($lng->txt("firstname"), 'firstname', '');
66  $this->addColumn($lng->txt("login"), 'login', '');
67  }
68 
69  $this->addColumn('', '', '1%');
70  }
71 
72  private function initOrdering()
73  {
74  $this->enable('sort');
75 
76  $this->setDefaultOrderField("lastname");
77  $this->setDefaultOrderDirection("asc");
78  }
79 
80  public function initFilter()
81  {
82  global $DIC;
83  $lng = $DIC['lng'];
84 
85  $this->setDisableFilterHiding(true);
86 
87  include_once 'Services/Form/classes/class.ilSelectInputGUI.php';
88  $participantStatus = new ilSelectInputGUI($lng->txt('tst_participant_status'), 'participant_status');
89 
90  $statusOptions = array();
91  $statusOptions[ilTestScoringGUI::PART_FILTER_ALL_USERS] = $lng->txt("all_users");
92  $statusOptions[ilTestScoringGUI::PART_FILTER_MANSCORING_NONE] = $lng->txt("manscoring_none");
93  $statusOptions[ilTestScoringGUI::PART_FILTER_MANSCORING_DONE] = $lng->txt("manscoring_done");
94  $statusOptions[ilTestScoringGUI::PART_FILTER_ACTIVE_ONLY] = $lng->txt("usr_active_only");
95  $statusOptions[ilTestScoringGUI::PART_FILTER_INACTIVE_ONLY] = $lng->txt("usr_inactive_only");
96  //$statusOptions[ ilTestScoringGUI::PART_FILTER_MANSCORING_PENDING ] = $lng->txt("manscoring_pending");
97 
98  $participantStatus->setOptions($statusOptions);
99 
100  $this->addFilterItem($participantStatus);
101 
102  $participantStatus->readFromSession();
103 
104  if (!$participantStatus->getValue()) {
105  $participantStatus->setValue(ilTestScoringGUI::PART_FILTER_MANSCORING_NONE);
106  }
107  }
108 
114  public function fillRow($row)
115  {
116  //vd($row);
117 
118  global $DIC;
119  $ilCtrl = $DIC['ilCtrl'];
120  $lng = $DIC['lng'];
121 
122  $ilCtrl->setParameter($this->parent_obj, 'active_id', $row['active_id']);
123 
124  if (!$this->parent_obj->object->getAnonymity()) {
125  $this->tpl->setCurrentBlock('personal');
126  $this->tpl->setVariable("PARTICIPANT_FIRSTNAME", $row['firstname']);
127  $this->tpl->setVariable("PARTICIPANT_LOGIN", $row['login']);
128  $this->tpl->parseCurrentBlock();
129  }
130 
131  $this->tpl->setVariable("PARTICIPANT_LASTNAME", $row['lastname']);
132 
133  $this->tpl->setVariable("HREF_SCORE_PARTICIPANT", $ilCtrl->getLinkTarget($this->parent_obj, self::PARENT_EDIT_SCORING_CMD));
134  $this->tpl->setVariable("TXT_SCORE_PARTICIPANT", $lng->txt('tst_edit_scoring'));
135  }
136 
138  {
139  $this->determineOffsetAndOrder();
140 
141  return ilUtil::sortArray(
142  $this->getData(),
143  $this->getOrderField(),
144  $this->getOrderDirection(),
145  $this->numericOrdering($this->getOrderField())
146  );
147  }
148 }
static sortArray( $array, $a_array_sortby, $a_array_sortorder=0, $a_numeric=false, $a_keep_keys=false)
sortArray
setDefaultOrderField($a_defaultorderfield)
Set Default order field.
This class represents a selection list property in a property form.
setStyle($a_element, $a_style)
global $DIC
Definition: saml.php:7
addFilterItem($a_input_item, $a_optional=false)
Add filter item.
getOrderDirection()
Get order direction.
setId($a_val)
Set id.
global $ilCtrl
Definition: ilias.php:18
setDefaultOrderDirection($a_defaultorderdirection)
Set Default order direction.
Class ilTable2GUI.
setResetCommand($a_val, $a_caption=null)
Set reset filter command.
setDisableFilterHiding($a_val=true)
Set disable filter hiding.
numericOrdering($a_field)
Should this field be sorted numeric?
enable($a_module_name)
enables particular modules of table
setPrefix($a_prefix)
setRowTemplate($a_template, $a_template_dir="")
Set row template.
$row
determineOffsetAndOrder($a_omit_offset=false)
Determine offset and order.
setFormAction($a_form_action, $a_multipart=false)
Set Form action parameter.
setFormName($a_formname="")
Set Form name.
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.
__construct($parentObj)
ilCtrl $ilCtrl ilLanguage $lng
setFilterCommand($a_val, $a_caption=null)
Set filter command.