ILIAS  release_9 Revision v9.13-25-g2c18ec4c24f
ilTestParticipantsGUI Class Reference
+ Collaboration diagram for ilTestParticipantsGUI:

Public Member Functions

 __construct (protected ilObjTest $test_obj, protected ilTestQuestionSetConfig $question_set_config, protected ilAccess $access, protected ilGlobalTemplateInterface $main_tpl, protected UIFactory $ui_factory, protected UIRenderer $ui_renderer, protected ilLanguage $lng, protected ilCtrl $ctrl, protected ilDBInterface $db, protected ilTabsGUI $tabs, protected ilToolbarGUI $toolbar, protected InternalRequestService $testrequest)
 
 getTestObj ()
 
 setTestObj (ilObjTest $test_obj)
 
 getQuestionSetConfig ()
 
 setQuestionSetConfig (ilTestQuestionSetConfig $question_set_config)
 
 getObjectiveParent ()
 
 setObjectiveParent (ilTestObjectiveOrientedContainer $objective_parent)
 
 getTestAccess ()
 
 setTestAccess (ilTestAccess $test_access)
 
 executeCommand ()
 
 addParticipants ($user_ids=[])
 
 showCmd ()
 

Data Fields

const CMD_SHOW = 'show'
 
const CMD_SET_FILTER = 'setFilter'
 
const CMD_RESET_FILTER = 'resetFilter'
 
const CMD_SAVE_CLIENT_IP = 'saveClientIp'
 
const CALLBACK_ADD_PARTICIPANT = 'addParticipants'
 

Protected Member Functions

 buildTableGUI ()
 
 setFilterCmd ()
 
 resetFilterCmd ()
 
 applyFilterCriteria (array $in_rows)
 
 initToolbarControls (ilTestParticipantList $participant_list)
 
 addUserSearchControls (ilToolbarGUI $toolbar)
 
 addFinishAllPassesButton (ilToolbarGUI $toolbar)
 
 saveClientIpCmd ()
 
 removeParticipantsCmd ()
 

Protected Attributes

ilTestObjectiveOrientedContainer $objective_parent
 
ilTestAccess $test_access
 
ilTestParticipantAccessFilterFactory $participant_access_filter
 

Detailed Description

Definition at line 38 of file class.ilTestParticipantsGUI.php.

Constructor & Destructor Documentation

◆ __construct()

ilTestParticipantsGUI::__construct ( protected ilObjTest  $test_obj,
protected ilTestQuestionSetConfig  $question_set_config,
protected ilAccess  $access,
protected ilGlobalTemplateInterface  $main_tpl,
protected UIFactory  $ui_factory,
protected UIRenderer  $ui_renderer,
protected ilLanguage  $lng,
protected ilCtrl  $ctrl,
protected ilDBInterface  $db,
protected ilTabsGUI  $tabs,
protected ilToolbarGUI  $toolbar,
protected InternalRequestService  $testrequest 
)

Definition at line 52 of file class.ilTestParticipantsGUI.php.

65  {
66  $this->participant_access_filter = new ilTestParticipantAccessFilterFactory($access);
67  }

Member Function Documentation

◆ addFinishAllPassesButton()

ilTestParticipantsGUI::addFinishAllPassesButton ( ilToolbarGUI  $toolbar)
protected

Definition at line 311 of file class.ilTestParticipantsGUI.php.

References $DIC, and ilToolbarGUI\addComponent().

Referenced by initToolbarControls().

311  : void
312  {
313  global $DIC; /* @var ILIAS\DI\Container $DIC */
314 
315  $finish_all_user_passes_btn = $DIC->ui()->factory()->button()->standard(
316  $DIC->language()->txt('finish_all_user_passes'),
317  $DIC->ctrl()->getLinkTargetByClass('iltestevaluationgui', 'finishAllUserPasses')
318  );
319  $toolbar->addComponent($finish_all_user_passes_btn);
320  }
addComponent(\ILIAS\UI\Component\Component $a_comp)
global $DIC
Definition: feed.php:28
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ addParticipants()

ilTestParticipantsGUI::addParticipants (   $user_ids = [])

Definition at line 144 of file class.ilTestParticipantsGUI.php.

References $message, ILIAS\Repository\ctrl(), getTestObj(), and ILIAS\Repository\lng().

144  : ?bool
145  {
146  $filter_closure = $this->participant_access_filter->getManageParticipantsUserFilter($this->getTestObj()->getRefId());
147  $filtered_user_ids = $filter_closure($user_ids);
148 
149  $countusers = 0;
150  foreach ($filtered_user_ids as $user_id) {
151  $client_ip = $_POST["client_ip"][$countusers] ?? '';
152  $this->getTestObj()->inviteUser($user_id, $client_ip);
153  $countusers++;
154  }
155 
156  $message = "";
157  if ($countusers) {
158  $message = $this->lng->txt("tst_invited_selected_users");
159  }
160  if (strlen($message)) {
161  $this->main_tpl->setOnScreenMessage('info', $message, true);
162  } else {
163  $this->main_tpl->setOnScreenMessage('info', $this->lng->txt("tst_invited_nobody"), true);
164  return false;
165  }
166 
167  $this->ctrl->redirect($this, self::CMD_SHOW);
168  return null;
169  }
$message
Definition: xapiexit.php:32
+ Here is the call graph for this function:

◆ addUserSearchControls()

ilTestParticipantsGUI::addUserSearchControls ( ilToolbarGUI  $toolbar)
protected

Definition at line 292 of file class.ilTestParticipantsGUI.php.

References ilToolbarGUI\addComponent(), ilToolbarGUI\addSeparator(), ILIAS\Repository\ctrl(), ilRepositorySearchGUI\fillAutoCompleteToolbar(), and ILIAS\Repository\lng().

Referenced by initToolbarControls().

292  : void
293  {
295  $this,
296  $toolbar,
297  array(
298  'auto_complete_name' => $this->lng->txt('user'),
299  'submit_name' => $this->lng->txt('add')
300  )
301  );
302  $toolbar->addSeparator();
303 
304  $search_btn = $this->ui_factory->button()->standard(
305  $this->lng->txt('tst_search_users'),
306  $this->ctrl->getLinkTargetByClass('ilRepositorySearchGUI', 'start')
307  );
308  $toolbar->addComponent($search_btn);
309  }
addComponent(\ILIAS\UI\Component\Component $a_comp)
static fillAutoCompleteToolbar(object $parent_object, ilToolbarGUI $toolbar=null, array $a_options=[], bool $a_sticky=false)
array( auto_complete_name = $lng->txt('user'), auto_complete_size = 15, user_type = array(ilCoursePar...
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ applyFilterCriteria()

ilTestParticipantsGUI::applyFilterCriteria ( array  $in_rows)
protected

Definition at line 245 of file class.ilTestParticipantsGUI.php.

References ilSession\get(), and getTestObj().

Referenced by showCmd().

245  : array
246  {
247  $selected_pax = ilSession::get('form_tst_participants_' . $this->getTestObj()->getRefId() . '_selection');
248 
249  if (!is_string($selected_pax)) {
250  return $in_rows;
251  }
252 
253  $filter = unserialize($selected_pax, ['allowed_classes' => false]);
254 
255  if (!is_string($filter) || $filter === 'all') {
256  return $in_rows;
257  }
258 
259  $rows = [];
260 
261  foreach ($in_rows as $row) {
262  $query = $this->db->query(
263  'SELECT count(solution_id) count
264  FROM tst_solutions
265  WHERE active_fi = ' . $this->db->quote($row['active_id'])
266  . ' HAVING count ' . ($filter === 'withSolutions' ? '>' : '=') . ' 0'
267  );
268 
269  if (is_array($this->db->fetchAssoc($query))) {
270  $rows[] = $row;
271  }
272  }
273 
274  return $rows;
275  }
static get(string $a_var)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ buildTableGUI()

ilTestParticipantsGUI::buildTableGUI ( )
protected

Definition at line 171 of file class.ilTestParticipantsGUI.php.

References getTestObj(), and ILIAS\Repository\lng().

Referenced by resetFilterCmd(), setFilterCmd(), and showCmd().

172  {
173  $table_gui = new ilTestParticipantsTableGUI($this, self::CMD_SHOW, $this->ui_factory, $this->ui_renderer);
174 
175  $table_gui->setParticipantHasSolutionsFilterEnabled(
176  $this->getTestObj()->getFixedParticipants()
177  );
178 
179  if ($this->getTestObj()->getFixedParticipants()) {
180  $table_gui->setTitle($this->lng->txt('tst_tbl_invited_users'));
181  } else {
182  $table_gui->setTitle($this->lng->txt('tst_tbl_participants'));
183  }
184 
185  return $table_gui;
186  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ executeCommand()

ilTestParticipantsGUI::executeCommand ( )

Definition at line 109 of file class.ilTestParticipantsGUI.php.

References ILIAS\Repository\ctrl(), getObjectiveParent(), getTestAccess(), getTestObj(), and ILIAS\Repository\tabs().

109  : void
110  {
111  switch ($this->ctrl->getNextClass($this)) {
112  case 'ilrepositorysearchgui':
113  $gui = new ilRepositorySearchGUI();
114  $gui->setCallback($this, self::CALLBACK_ADD_PARTICIPANT, array());
115 
116  $gui->addUserAccessFilterCallable($this->participant_access_filter->getManageParticipantsUserFilter(
117  $this->getTestObj()->getRefId()
118  ));
119 
120 
121  $this->ctrl->setReturn($this, self::CMD_SHOW);
122  $this->ctrl->forwardCommand($gui);
123 
124  break;
125 
126  case "iltestevaluationgui":
127  $gui = new ilTestEvaluationGUI($this->getTestObj());
128  $gui->setObjectiveOrientedContainer($this->getObjectiveParent());
129  $gui->setTestAccess($this->getTestAccess());
130  $this->tabs->clearTargets();
131  $this->tabs->clearSubTabs();
132 
133  $this->ctrl->forwardCommand($gui);
134 
135  break;
136 
137  default:
138 
139  $command = $this->ctrl->getCmd(self::CMD_SHOW) . 'Cmd';
140  $this->{$command}();
141  }
142  }
Output class for assessment test evaluation.
+ Here is the call graph for this function:

◆ getObjectiveParent()

ilTestParticipantsGUI::getObjectiveParent ( )

Definition at line 89 of file class.ilTestParticipantsGUI.php.

References $objective_parent.

Referenced by executeCommand().

+ Here is the caller graph for this function:

◆ getQuestionSetConfig()

ilTestParticipantsGUI::getQuestionSetConfig ( )

Definition at line 79 of file class.ilTestParticipantsGUI.php.

Referenced by showCmd().

80  {
81  return $this->question_set_config;
82  }
+ Here is the caller graph for this function:

◆ getTestAccess()

ilTestParticipantsGUI::getTestAccess ( )

Definition at line 99 of file class.ilTestParticipantsGUI.php.

References $test_access.

Referenced by executeCommand().

99  : ilTestAccess
100  {
101  return $this->test_access;
102  }
+ Here is the caller graph for this function:

◆ getTestObj()

ilTestParticipantsGUI::getTestObj ( )

Definition at line 69 of file class.ilTestParticipantsGUI.php.

Referenced by ilTestParticipantsTableGUI\__construct(), addParticipants(), applyFilterCriteria(), buildTableGUI(), executeCommand(), initToolbarControls(), removeParticipantsCmd(), saveClientIpCmd(), setFilterCmd(), and showCmd().

69  : ilObjTest
70  {
71  return $this->test_obj;
72  }
+ Here is the caller graph for this function:

◆ initToolbarControls()

ilTestParticipantsGUI::initToolbarControls ( ilTestParticipantList  $participant_list)
protected

Definition at line 277 of file class.ilTestParticipantsGUI.php.

References addFinishAllPassesButton(), addUserSearchControls(), getTestObj(), ilTestParticipantList\hasUnfinishedPasses(), and ILIAS\Repository\toolbar().

Referenced by showCmd().

277  : void
278  {
279  if ($this->getTestObj()->getFixedParticipants()) {
280  $this->addUserSearchControls($this->toolbar);
281  }
282 
283  if ($this->getTestObj()->getFixedParticipants() && $participant_list->hasUnfinishedPasses()) {
284  $this->toolbar->addSeparator();
285  }
286 
287  if ($participant_list->hasUnfinishedPasses()) {
288  $this->addFinishAllPassesButton($this->toolbar);
289  }
290  }
addUserSearchControls(ilToolbarGUI $toolbar)
addFinishAllPassesButton(ilToolbarGUI $toolbar)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ removeParticipantsCmd()

ilTestParticipantsGUI::removeParticipantsCmd ( )
protected

Definition at line 338 of file class.ilTestParticipantsGUI.php.

References ILIAS\Repository\ctrl(), getTestObj(), and ILIAS\Repository\lng().

338  : void
339  {
340  $filter_closure = $this->participant_access_filter->getManageParticipantsUserFilter($this->getTestObj()->getRefId());
341  $a_user_ids = $filter_closure((array) $_POST["chbUser"]);
342 
343  if (is_array($a_user_ids)) {
344  foreach ($a_user_ids as $user_id) {
345  $this->getTestObj()->disinviteUser($user_id);
346  }
347  } else {
348  $this->main_tpl->setOnScreenMessage('info', $this->lng->txt("select_one_user"), true);
349  }
350 
351  $this->ctrl->redirect($this, self::CMD_SHOW);
352  }
+ Here is the call graph for this function:

◆ resetFilterCmd()

ilTestParticipantsGUI::resetFilterCmd ( )
protected

Definition at line 197 of file class.ilTestParticipantsGUI.php.

References buildTableGUI(), and showCmd().

197  : void
198  {
199  $table_gui = $this->buildTableGUI();
200  $table_gui->resetFilter();
201  $table_gui->resetOffset();
202  $this->showCmd();
203  }
+ Here is the call graph for this function:

◆ saveClientIpCmd()

ilTestParticipantsGUI::saveClientIpCmd ( )
protected

Definition at line 322 of file class.ilTestParticipantsGUI.php.

References ILIAS\Repository\ctrl(), getTestObj(), and ILIAS\Repository\lng().

322  : void
323  {
324  $filter_closure = $this->participant_access_filter->getManageParticipantsUserFilter($this->getTestObj()->getRefId());
325  $selected_users = $filter_closure($this->testrequest->raw('chbUser') ?? []);
326 
327  if ($selected_users === []) {
328  $this->main_tpl->setOnScreenMessage('info', $this->lng->txt("select_one_user"), true);
329  }
330 
331  foreach ($selected_users as $user_id) {
332  $this->getTestObj()->setClientIP($user_id, $_POST["clientip_" . $user_id]);
333  }
334 
335  $this->ctrl->redirect($this, self::CMD_SHOW);
336  }
+ Here is the call graph for this function:

◆ setFilterCmd()

ilTestParticipantsGUI::setFilterCmd ( )
protected

Definition at line 188 of file class.ilTestParticipantsGUI.php.

References buildTableGUI(), getTestObj(), and showCmd().

188  : void
189  {
190  $table_gui = $this->buildTableGUI();
191  $table_gui->initFilter($this->getTestObj()->getFixedParticipants());
192  $table_gui->writeFilterToSession();
193  $table_gui->resetOffset();
194  $this->showCmd();
195  }
+ Here is the call graph for this function:

◆ setObjectiveParent()

ilTestParticipantsGUI::setObjectiveParent ( ilTestObjectiveOrientedContainer  $objective_parent)

Definition at line 94 of file class.ilTestParticipantsGUI.php.

References $objective_parent.

94  : void
95  {
96  $this->objective_parent = $objective_parent;
97  }
ilTestObjectiveOrientedContainer $objective_parent

◆ setQuestionSetConfig()

ilTestParticipantsGUI::setQuestionSetConfig ( ilTestQuestionSetConfig  $question_set_config)

Definition at line 84 of file class.ilTestParticipantsGUI.php.

84  : void
85  {
86  $this->question_set_config = $question_set_config;
87  }

◆ setTestAccess()

ilTestParticipantsGUI::setTestAccess ( ilTestAccess  $test_access)

Definition at line 104 of file class.ilTestParticipantsGUI.php.

References $test_access.

104  : void
105  {
106  $this->test_access = $test_access;
107  }

◆ setTestObj()

ilTestParticipantsGUI::setTestObj ( ilObjTest  $test_obj)

Definition at line 74 of file class.ilTestParticipantsGUI.php.

74  : void
75  {
76  $this->test_obj = $test_obj;
77  }

◆ showCmd()

ilTestParticipantsGUI::showCmd ( )

Definition at line 205 of file class.ilTestParticipantsGUI.php.

References applyFilterCriteria(), buildTableGUI(), ILIAS\Repository\ctrl(), getQuestionSetConfig(), getTestObj(), initToolbarControls(), and ILIAS\Repository\lng().

Referenced by resetFilterCmd(), and setFilterCmd().

205  : void
206  {
207  $table_gui = $this->buildTableGUI();
208 
209  if (!$this->getQuestionSetConfig()->areDepenciesBroken()) {
210  if ($this->getTestObj()->getFixedParticipants()) {
211  $participant_list = $this->getTestObj()->getInvitedParticipantList()->getAccessFilteredList(
212  $this->participant_access_filter->getManageParticipantsUserFilter($this->getTestObj()->getRefId())
213  );
214 
215  $table_gui->setData($this->applyFilterCriteria($participant_list->getParticipantsTableRows()));
216  $table_gui->setRowKeyDataField('usr_id');
217  $table_gui->setManageInviteesCommandsEnabled(true);
218  $table_gui->setDescription($this->lng->txt("fixed_participants_hint"));
219  } else {
220  $participant_list = $this->getTestObj()->getActiveParticipantList()->getAccessFilteredList(
221  $this->participant_access_filter->getManageParticipantsUserFilter($this->getTestObj()->getRefId())
222  );
223 
224  $table_gui->setData($participant_list->getParticipantsTableRows());
225  $table_gui->setRowKeyDataField('active_id');
226  }
227 
228  $table_gui->setManageResultsCommandsEnabled(true);
229 
230  $this->initToolbarControls($participant_list);
231  }
232 
233  $table_gui->setAnonymity($this->getTestObj()->getAnonymity());
234 
235  $table_gui->initColumns();
236  $table_gui->initCommands();
237 
238  $table_gui->initFilter();
239  $table_gui->setFilterCommand(self::CMD_SET_FILTER);
240  $table_gui->setResetCommand(self::CMD_RESET_FILTER);
241 
242  $this->main_tpl->setContent($this->ctrl->getHTML($table_gui));
243  }
initToolbarControls(ilTestParticipantList $participant_list)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

Field Documentation

◆ $objective_parent

ilTestObjectiveOrientedContainer ilTestParticipantsGUI::$objective_parent
protected

Definition at line 47 of file class.ilTestParticipantsGUI.php.

Referenced by getObjectiveParent(), and setObjectiveParent().

◆ $participant_access_filter

ilTestParticipantAccessFilterFactory ilTestParticipantsGUI::$participant_access_filter
protected

Definition at line 50 of file class.ilTestParticipantsGUI.php.

◆ $test_access

ilTestAccess ilTestParticipantsGUI::$test_access
protected

Definition at line 48 of file class.ilTestParticipantsGUI.php.

Referenced by getTestAccess(), and setTestAccess().

◆ CALLBACK_ADD_PARTICIPANT

const ilTestParticipantsGUI::CALLBACK_ADD_PARTICIPANT = 'addParticipants'

Definition at line 45 of file class.ilTestParticipantsGUI.php.

◆ CMD_RESET_FILTER

const ilTestParticipantsGUI::CMD_RESET_FILTER = 'resetFilter'

Definition at line 42 of file class.ilTestParticipantsGUI.php.

◆ CMD_SAVE_CLIENT_IP

const ilTestParticipantsGUI::CMD_SAVE_CLIENT_IP = 'saveClientIp'

Definition at line 43 of file class.ilTestParticipantsGUI.php.

◆ CMD_SET_FILTER

const ilTestParticipantsGUI::CMD_SET_FILTER = 'setFilter'

Definition at line 41 of file class.ilTestParticipantsGUI.php.

◆ CMD_SHOW

const ilTestParticipantsGUI::CMD_SHOW = 'show'

Definition at line 40 of file class.ilTestParticipantsGUI.php.


The documentation for this class was generated from the following file: