ILIAS  release_10 Revision v10.1-43-ga1241a92c2f
TestScoringByParticipantTableGUI.php
Go to the documentation of this file.
1 <?php
2 
19 declare(strict_types=1);
20 
22 
32 {
33  public const PARENT_DEFAULT_CMD = 'showManScoringParticipantsTable';
34  public const PARENT_APPLY_FILTER_CMD = 'applyManScoringParticipantsFilter';
35  public const PARENT_RESET_FILTER_CMD = 'resetManScoringParticipantsFilter';
36 
37  public const PARENT_EDIT_SCORING_CMD = 'showManScoringParticipantScreen';
38 
40  {
41  $this->setPrefix('manScorePartTable');
42  $this->setId('manScorePartTable');
43 
44  parent::__construct($parent_obj, self::PARENT_DEFAULT_CMD);
45 
46  $this->setFilterCommand(self::PARENT_APPLY_FILTER_CMD);
47  $this->setResetCommand(self::PARENT_RESET_FILTER_CMD);
48 
49  $this->setFormName('manScorePartTable');
50  $this->setStyle('table', 'fullwidth');
51 
52  $this->enable('header');
53 
54  $this->setFormAction($this->ctrl->getFormAction($parent_obj, self::PARENT_DEFAULT_CMD));
55 
56  $this->setRowTemplate("tpl.il_as_tst_man_scoring_participant_tblrow.html", "components/ILIAS/Test");
57 
58  $this->initColumns();
59  $this->initOrdering();
60 
61  $this->initFilter();
62  }
63 
64  private function initColumns(): void
65  {
66  if ($this->parent_obj->getObject()->getAnonymity()) {
67  $this->addColumn($this->lng->txt("name"), 'lastname', '100%');
68  } else {
69  $this->addColumn($this->lng->txt("lastname"), 'lastname', '');
70  $this->addColumn($this->lng->txt("firstname"), 'firstname', '');
71  $this->addColumn($this->lng->txt("login"), 'login', '');
72  }
73 
74  $this->addColumn($this->lng->txt('actions'), '', '1%');
75  }
76 
77  private function initOrdering(): void
78  {
79  $this->enable('sort');
80 
81  $this->setDefaultOrderField("lastname");
82  $this->setDefaultOrderDirection("asc");
83  }
84 
85  public function initFilter(): void
86  {
87  $this->setDisableFilterHiding(true);
88 
89  $participantStatus = new \ilSelectInputGUI($this->lng->txt('tst_participant_status'), 'participant_status');
90 
91  $statusOptions = [];
92  $statusOptions[TestScoringByParticipantGUI::PART_FILTER_ALL_USERS] = $this->lng->txt("all_users");
93  $statusOptions[TestScoringByParticipantGUI::PART_FILTER_MANSCORING_NONE] = $this->lng->txt("manscoring_none");
94  $statusOptions[TestScoringByParticipantGUI::PART_FILTER_MANSCORING_DONE] = $this->lng->txt("manscoring_done");
95 
96  $participantStatus->setOptions($statusOptions);
97 
98  $this->addFilterItem($participantStatus);
99 
100  $participantStatus->readFromSession();
101 
102  if (!$participantStatus->getValue()) {
103  $participantStatus->setValue((string) TestScoringByParticipantGUI::PART_FILTER_MANSCORING_NONE);
104  }
105  }
106 
107  public function fillRow(array $a_set): void
108  {
109  $this->ctrl->setParameter($this->parent_obj, 'active_id', $a_set['active_id']);
110 
111  if (!$this->parent_obj->getObject()->getAnonymity()) {
112  $this->tpl->setCurrentBlock('personal');
113  $this->tpl->setVariable("PARTICIPANT_FIRSTNAME", $a_set['firstname']);
114  $this->tpl->setVariable("PARTICIPANT_LOGIN", $a_set['login']);
115  $this->tpl->parseCurrentBlock();
116  }
117 
118  $this->tpl->setVariable("PARTICIPANT_LASTNAME", $a_set['lastname']);
119 
120  $this->tpl->setVariable("HREF_SCORE_PARTICIPANT", $this->ctrl->getLinkTarget($this->parent_obj, self::PARENT_EDIT_SCORING_CMD));
121  $this->tpl->setVariable("TXT_SCORE_PARTICIPANT", $this->lng->txt('tst_edit_scoring'));
122  }
123 
124  public function getInternalyOrderedDataValues(): array
125  {
126  $this->determineOffsetAndOrder();
127 
128  return \ilArrayUtil::sortArray(
129  $this->getData(),
130  $this->getOrderField(),
131  $this->getOrderDirection(),
132  $this->numericOrdering($this->getOrderField())
133  );
134  }
135 }
numericOrdering(string $a_field)
Should this field be sorted numeric?
enable(string $a_module_name)
setFormAction(string $a_form_action, bool $a_multipart=false)
addFilterItem(ilTableFilterItem $a_input_item, bool $a_optional=false)
setResetCommand(string $a_val, string $a_caption="")
setDisableFilterHiding(bool $a_val=true)
setFormName(string $a_name="")
setId(string $a_val)
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...
setDefaultOrderField(string $a_defaultorderfield)
setRowTemplate(string $a_template, string $a_template_dir="")
Set row template.
setFilterCommand(string $a_val, string $a_caption="")
setDefaultOrderDirection(string $a_defaultorderdirection)
__construct(Container $dic, ilPlugin $plugin)
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)
determineOffsetAndOrder(bool $a_omit_offset=false)
setPrefix(string $a_prefix)