ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
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
5include_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 $this->addColumn($lng->txt("name"), 'lastname', '100%');
61 } else {
62 $this->addColumn($lng->txt("lastname"), 'lastname', '');
63 $this->addColumn($lng->txt("firstname"), 'firstname', '');
64 $this->addColumn($lng->txt("login"), 'login', '');
65 }
66
67 $this->addColumn('', '', '1%');
68 }
69
70 private function initOrdering()
71 {
72 $this->enable('sort');
73
74 $this->setDefaultOrderField("lastname");
75 $this->setDefaultOrderDirection("asc");
76 }
77
78 public function initFilter()
79 {
80 global $lng;
81
82 $this->setDisableFilterHiding(true);
83
84 include_once 'Services/Form/classes/class.ilSelectInputGUI.php';
85 $participantStatus = new ilSelectInputGUI($lng->txt('tst_participant_status'), 'participant_status');
86
87 $statusOptions = array();
88 $statusOptions[ilTestScoringGUI::PART_FILTER_ALL_USERS] = $lng->txt("all_users");
89 $statusOptions[ilTestScoringGUI::PART_FILTER_MANSCORING_NONE] = $lng->txt("manscoring_none");
90 $statusOptions[ilTestScoringGUI::PART_FILTER_MANSCORING_DONE] = $lng->txt("manscoring_done");
91 $statusOptions[ilTestScoringGUI::PART_FILTER_ACTIVE_ONLY] = $lng->txt("usr_active_only");
92 $statusOptions[ilTestScoringGUI::PART_FILTER_INACTIVE_ONLY] = $lng->txt("usr_inactive_only");
93 //$statusOptions[ ilTestScoringGUI::PART_FILTER_MANSCORING_PENDING ] = $lng->txt("manscoring_pending");
94
95 $participantStatus->setOptions($statusOptions);
96
97 $this->addFilterItem($participantStatus);
98
99 $participantStatus->readFromSession();
100
101 if (!$participantStatus->getValue()) {
102 $participantStatus->setValue(ilTestScoringGUI::PART_FILTER_MANSCORING_NONE);
103 }
104 }
105
111 public function fillRow($row)
112 {
113 //vd($row);
114
115 global $ilCtrl, $lng;
116
117 $ilCtrl->setParameter($this->parent_obj, 'active_id', $row['active_id']);
118
119 if (!$this->parent_obj->object->getAnonymity()) {
120 $this->tpl->setCurrentBlock('personal');
121 $this->tpl->setVariable("PARTICIPANT_FIRSTNAME", $row['firstname']);
122 $this->tpl->setVariable("PARTICIPANT_LOGIN", $row['login']);
123 $this->tpl->parseCurrentBlock();
124 }
125
126 $this->tpl->setVariable("PARTICIPANT_LASTNAME", $row['lastname']);
127
128 $this->tpl->setVariable("HREF_SCORE_PARTICIPANT", $ilCtrl->getLinkTarget($this->parent_obj, self::PARENT_EDIT_SCORING_CMD));
129 $this->tpl->setVariable("TXT_SCORE_PARTICIPANT", $lng->txt('tst_edit_scoring'));
130 }
131
133 {
135
136 return ilUtil::sortArray(
137 $this->getData(),
138 $this->getOrderField(),
139 $this->getOrderDirection(),
140 $this->numericOrdering($this->getOrderField())
141 );
142 }
143}
An exception for terminatinating execution or to throw for unit testing.
This class represents a selection list property in a property form.
Class ilTable2GUI.
setDisableFilterHiding($a_val=true)
Set disable filter hiding.
setPrefix($a_prefix)
set prefix for sort and offset fields (if you have two or more tables on a page that you want to sort...
determineOffsetAndOrder($a_omit_offset=false)
Determine offset and order.
setResetCommand($a_val, $a_caption=null)
Set reset filter command.
setRowTemplate($a_template, $a_template_dir="")
Set row template.
addFilterItem($a_input_item, $a_optional=false)
Add filter item.
setDefaultOrderField($a_defaultorderfield)
Set Default order field.
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.
setId($a_val)
Set id.
setFormName($a_formname="")
Set Form name.
setFormAction($a_form_action, $a_multipart=false)
Set Form action parameter.
setDefaultOrderDirection($a_defaultorderdirection)
Set Default order direction.
setFilterCommand($a_val, $a_caption=null)
Set filter command.
numericOrdering($a_field)
Should this field be sorted numeric?
getOrderDirection()
Get order direction.
setStyle($a_element, $a_style)
enable($a_module_name)
enables particular modules of table
__construct($parentObj)
@global ilCtrl $ilCtrl @global ilLanguage $lng
fillRow($row)
@global ilCtrl $ilCtrl @global ilLanguage $lng
static sortArray( $array, $a_array_sortby, $a_array_sortorder=0, $a_numeric=false, $a_keep_keys=false)
sortArray
global $ilCtrl
Definition: ilias.php:18