ILIAS  release_8 Revision v8.24
class.ilTestManScoringParticipantsTableGUI.php
Go to the documentation of this file.
1<?php
2
28{
29 public const PARENT_DEFAULT_CMD = 'showManScoringParticipantsTable';
30 public const PARENT_APPLY_FILTER_CMD = 'applyManScoringParticipantsFilter';
31 public const PARENT_RESET_FILTER_CMD = 'resetManScoringParticipantsFilter';
32
33 public const PARENT_EDIT_SCORING_CMD = 'showManScoringParticipantScreen';
34
35 public function __construct($parentObj)
36 {
37 $this->setPrefix('manScorePartTable');
38 $this->setId('manScorePartTable');
39
40 parent::__construct($parentObj, self::PARENT_DEFAULT_CMD);
41
42 $this->setFilterCommand(self::PARENT_APPLY_FILTER_CMD);
43 $this->setResetCommand(self::PARENT_RESET_FILTER_CMD);
44
45 global $DIC;
46 $ilCtrl = $DIC['ilCtrl'];
47
48 $this->setFormName('manScorePartTable');
49 $this->setStyle('table', 'fullwidth');
50
51 $this->enable('header');
52
53 $this->setFormAction($ilCtrl->getFormAction($parentObj, self::PARENT_DEFAULT_CMD));
54
55 $this->setRowTemplate("tpl.il_as_tst_man_scoring_participant_tblrow.html", "Modules/Test");
56
57 $this->initColumns();
58 $this->initOrdering();
59
60 $this->initFilter();
61 }
62
63 private function initColumns(): void
64 {
65 global $DIC;
66 $lng = $DIC['lng'];
67
68 if ($this->parent_obj->getObject()->getAnonymity()) {
69 $this->addColumn($lng->txt("name"), 'lastname', '100%');
70 } else {
71 $this->addColumn($lng->txt("lastname"), 'lastname', '');
72 $this->addColumn($lng->txt("firstname"), 'firstname', '');
73 $this->addColumn($lng->txt("login"), 'login', '');
74 }
75
76 $this->addColumn($this->lng->txt('actions'), '', '1%');
77 }
78
79 private function initOrdering(): void
80 {
81 $this->enable('sort');
82
83 $this->setDefaultOrderField("lastname");
84 $this->setDefaultOrderDirection("asc");
85 }
86
87 public function initFilter(): void
88 {
89 global $DIC;
90 $lng = $DIC['lng'];
91
92 $this->setDisableFilterHiding(true);
93
94 include_once 'Services/Form/classes/class.ilSelectInputGUI.php';
95 $participantStatus = new ilSelectInputGUI($lng->txt('tst_participant_status'), 'participant_status');
96
97 $statusOptions = array();
98 $statusOptions[ilTestScoringGUI::PART_FILTER_ALL_USERS] = $lng->txt("all_users");
99 $statusOptions[ilTestScoringGUI::PART_FILTER_MANSCORING_NONE] = $lng->txt("manscoring_none");
100 $statusOptions[ilTestScoringGUI::PART_FILTER_MANSCORING_DONE] = $lng->txt("manscoring_done");
101 $statusOptions[ilTestScoringGUI::PART_FILTER_ACTIVE_ONLY] = $lng->txt("usr_active_only");
102 $statusOptions[ilTestScoringGUI::PART_FILTER_INACTIVE_ONLY] = $lng->txt("usr_inactive_only");
103 //$statusOptions[ ilTestScoringGUI::PART_FILTER_MANSCORING_PENDING ] = $lng->txt("manscoring_pending");
104
105 $participantStatus->setOptions($statusOptions);
106
107 $this->addFilterItem($participantStatus);
108
109 $participantStatus->readFromSession();
110
111 if (!$participantStatus->getValue()) {
112 $participantStatus->setValue((string) ilTestScoringGUI::PART_FILTER_MANSCORING_NONE);
113 }
114 }
115
116 public function fillRow(array $a_set): void
117 {
118 global $DIC;
119 $ilCtrl = $DIC['ilCtrl'];
120 $lng = $DIC['lng'];
121
122 $ilCtrl->setParameter($this->parent_obj, 'active_id', $a_set['active_id']);
123
124 if (!$this->parent_obj->object->getAnonymity()) {
125 $this->tpl->setCurrentBlock('personal');
126 $this->tpl->setVariable("PARTICIPANT_FIRSTNAME", $a_set['firstname']);
127 $this->tpl->setVariable("PARTICIPANT_LOGIN", $a_set['login']);
128 $this->tpl->parseCurrentBlock();
129 }
130
131 $this->tpl->setVariable("PARTICIPANT_LASTNAME", $a_set['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
137 public function getInternalyOrderedDataValues(): array
138 {
140
142 $this->getData(),
143 $this->getOrderField(),
144 $this->getOrderDirection(),
145 $this->numericOrdering($this->getOrderField())
146 );
147 }
148}
static sortArray(array $array, string $a_array_sortby_key, string $a_array_sortorder="asc", bool $a_numeric=false, bool $a_keep_keys=false)
txt(string $a_topic, string $a_default_lang_fallback_mod="")
gets the text for a given topic if the topic is not in the list, the topic itself with "-" will be re...
This class represents a selection list property in a property form.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
setFilterCommand(string $a_val, string $a_caption="")
determineOffsetAndOrder(bool $a_omit_offset=false)
addFilterItem(ilTableFilterItem $a_input_item, bool $a_optional=false)
setFormName(string $a_name="")
setPrefix(string $a_prefix)
set prefix for sort and offset fields (if you have two or more tables on a page that you want to sort...
setFormAction(string $a_form_action, bool $a_multipart=false)
addColumn(string $a_text, string $a_sort_field="", string $a_width="", bool $a_is_checkbox_action_column=false, string $a_class="", string $a_tooltip="", bool $a_tooltip_with_html=false)
setDefaultOrderField(string $a_defaultorderfield)
setDisableFilterHiding(bool $a_val=true)
numericOrdering(string $a_field)
Should this field be sorted numeric?
setRowTemplate(string $a_template, string $a_template_dir="")
Set row template.
setId(string $a_val)
setDefaultOrderDirection(string $a_defaultorderdirection)
setResetCommand(string $a_val, string $a_caption="")
ilLanguage $lng
enable(string $a_module_name)
setStyle(string $a_element, string $a_style)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
global $DIC
Definition: feed.php:28
__construct(Container $dic, ilPlugin $plugin)
@inheritDoc