ILIAS  release_5-0 Revision 5.0.0-1144-gc4397b1f87
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 $ilCtrl;
39 
40  $this->setFormName('manScorePartTable');
41  $this->setStyle('table', 'fullwidth');
42 
43  $this->enable('header');
44 
45  $this->setFormAction($ilCtrl->getFormAction($parentObj, self::PARENT_DEFAULT_CMD));
46 
47  $this->setRowTemplate("tpl.il_as_tst_man_scoring_participant_tblrow.html", "Modules/Test");
48 
49  $this->initColumns();
50  $this->initOrdering();
51 
52  $this->initFilter();
53  }
54 
55  private function initColumns()
56  {
57  global $lng;
58 
59  if( $this->parent_obj->object->getAnonymity() )
60  {
61  $this->addColumn($lng->txt("name"),'lastname', '100%');
62  }
63  else
64  {
65  $this->addColumn($lng->txt("lastname"),'lastname', '');
66  $this->addColumn($lng->txt("firstname"),'firstname', '');
67  $this->addColumn($lng->txt("login"),'login', '');
68  }
69 
70  $this->addColumn('','', '1%');
71  }
72 
73  private function initOrdering()
74  {
75  $this->enable('sort');
76 
77  $this->setDefaultOrderField("lastname");
78  $this->setDefaultOrderDirection("asc");
79  }
80 
81  public function initFilter()
82  {
83  global $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_ACTIVE_ONLY ] = $lng->txt("usr_active_only");
93  $statusOptions[ ilTestScoringGUI::PART_FILTER_INACTIVE_ONLY ] = $lng->txt("usr_inactive_only");
94  $statusOptions[ ilTestScoringGUI::PART_FILTER_MANSCORING_DONE ] = $lng->txt("manscoring_done");
95  $statusOptions[ ilTestScoringGUI::PART_FILTER_MANSCORING_NONE ] = $lng->txt("manscoring_none");
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  {
106  $participantStatus->setValue(ilTestScoringGUI::PART_FILTER_ALL_USERS);
107  }
108 
109  }
110 
116  public function fillRow($row)
117  {
118  //vd($row);
119 
120  global $ilCtrl, $lng;
121 
122  $ilCtrl->setParameter($this->parent_obj, 'active_id', $row['active_id']);
123 
124  if( !$this->parent_obj->object->getAnonymity() )
125  {
126  $this->tpl->setCurrentBlock('personal');
127  $this->tpl->setVariable("PARTICIPANT_FIRSTNAME", $row['firstname']);
128  $this->tpl->setVariable("PARTICIPANT_LOGIN", $row['login']);
129  $this->tpl->parseCurrentBlock();
130  }
131 
132  $this->tpl->setVariable("PARTICIPANT_LASTNAME", $row['lastname']);
133 
134  $this->tpl->setVariable("HREF_SCORE_PARTICIPANT", $ilCtrl->getLinkTarget($this->parent_obj, self::PARENT_EDIT_SCORING_CMD));
135  $this->tpl->setVariable("TXT_SCORE_PARTICIPANT", $lng->txt('tst_edit_scoring'));
136  }
137 
139  {
140  $this->determineOffsetAndOrder();
141 
142  return ilUtil::sortArray(
143  $this->getData(), $this->getOrderField(), $this->getOrderDirection(), $this->numericOrdering($this->getOrderField())
144  );
145  }
146 }
setFormName($a_formname)
Set Form name.
setDefaultOrderField($a_defaultorderfield)
Set Default order field.
This class represents a selection list property in a property form.
setStyle($a_element, $a_style)
addFilterItem($a_input_item, $a_optional=false)
Add filter item.
getOrderDirection()
Get order direction.
static sortArray($array, $a_array_sortby, $a_array_sortorder=0, $a_numeric=false, $a_keep_keys=false)
sortArray
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.
addColumn($a_text, $a_sort_field="", $a_width="", $a_is_checkbox_action_column=false, $a_class="", $a_tooltip="")
Add a column to the header.
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)
setOptions($a_options)
Set Options.
setRowTemplate($a_template, $a_template_dir="")
Set row template.
determineOffsetAndOrder($a_omit_offset=false)
Determine offset and order.
setFormAction($a_form_action, $a_multipart=false)
Set Form action parameter.
global $lng
Definition: privfeed.php:40
__construct($parentObj)
ilCtrl $ilCtrl ilLanguage $lng
setFilterCommand($a_val, $a_caption=null)
Set filter command.