ILIAS  release_8 Revision v8.24
ilTestParticipantsGUI Class Reference
+ Collaboration diagram for ilTestParticipantsGUI:

Public Member Functions

 __construct (ilObjTest $testObj, ilTestQuestionSetConfig $questionSetConfig)
 ilTestParticipantsGUI constructor. More...
 
 getTestObj ()
 
 setTestObj ($testObj)
 
 getQuestionSetConfig ()
 
 setQuestionSetConfig ($questionSetConfig)
 
 getObjectiveParent ()
 
 setObjectiveParent (ilTestObjectiveOrientedContainer $objectiveParent)
 
 getTestAccess ()
 
 setTestAccess (ilTestAccess $testAccess)
 
 executeCommand ()
 Execute Command. More...
 
 addParticipants ($a_user_ids=array())
 
 showCmd ()
 show command More...
 

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 ()
 set table filter command More...
 
 resetFilterCmd ()
 reset table filter command More...
 
 applyFilterCriteria ($in_rows)
 
 initToolbarControls (ilTestParticipantList $participantList)
 
 addUserSearchControls (ilToolbarGUI $toolbar)
 
 addFinishAllPassesButton (ilToolbarGUI $toolbar)
 
 saveClientIpCmd ()
 save client ip command More...
 
 removeParticipantsCmd ()
 remove participants command More...
 

Protected Attributes

 $testObj
 
 $questionSetConfig
 
 $objectiveParent
 
 $testAccess
 

Private Attributes

ilGlobalTemplateInterface $main_tpl
 

Detailed Description

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

Constructor & Destructor Documentation

◆ __construct()

ilTestParticipantsGUI::__construct ( ilObjTest  $testObj,
ilTestQuestionSetConfig  $questionSetConfig 
)

ilTestParticipantsGUI constructor.

Parameters
ilObjTest$testObj

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

66 {
67 global $DIC;
68 $this->main_tpl = $DIC->ui()->mainTemplate();
69 $this->testObj = $testObj;
70 $this->questionSetConfig = $questionSetConfig;
71 }
global $DIC
Definition: feed.php:28

References $DIC, $questionSetConfig, and $testObj.

Member Function Documentation

◆ addFinishAllPassesButton()

ilTestParticipantsGUI::addFinishAllPassesButton ( ilToolbarGUI  $toolbar)
protected
Parameters
ilToolbarGUI$toolbar

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

397 {
398 global $DIC; /* @var ILIAS\DI\Container $DIC */
399
400 $finish_all_user_passes_btn = ilLinkButton::getInstance();
401 $finish_all_user_passes_btn->setCaption('finish_all_user_passes');
402 $finish_all_user_passes_btn->setUrl($DIC->ctrl()->getLinkTargetByClass('iltestevaluationgui', 'finishAllUserPasses'));
403 $toolbar->addButtonInstance($finish_all_user_passes_btn);
404 }
addButtonInstance(ilButtonBase $a_button)
Add button instance.

References $DIC, ilToolbarGUI\addButtonInstance(), and ilLinkButton\getInstance().

Referenced by initToolbarControls().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ addParticipants()

ilTestParticipantsGUI::addParticipants (   $a_user_ids = array())

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

185 : ?bool
186 {
187 global $DIC; /* @var ILIAS\DI\Container $DIC */
188
189 require_once 'Modules/Test/classes/class.ilTestParticipantAccessFilter.php';
191 $a_user_ids = call_user_func_array($filterCallback, [$a_user_ids]);
192
193 $countusers = 0;
194 // add users
195 if (is_array($a_user_ids)) {
196 $i = 0;
197 foreach ($a_user_ids as $user_id) {
198 $client_ip = $_POST["client_ip"][$i] ?? '';
199 $this->getTestObj()->inviteUser($user_id, $client_ip);
200 $countusers++;
201 $i++;
202 }
203 }
204 $message = "";
205 if ($countusers) {
206 $message = $DIC->language()->txt("tst_invited_selected_users");
207 }
208 if (strlen($message)) {
209 $this->main_tpl->setOnScreenMessage('info', $message, true);
210 } else {
211 $this->main_tpl->setOnScreenMessage('info', $DIC->language()->txt("tst_invited_nobody"), true);
212 return false;
213 }
214
215 $DIC->ctrl()->redirect($this, self::CMD_SHOW);
216 return null;
217 }
$i
Definition: metadata.php:41
$message
Definition: xapiexit.php:32

References $DIC, $i, $message, ilTestParticipantAccessFilter\getManageParticipantsUserFilter(), and getTestObj().

+ Here is the call graph for this function:

◆ addUserSearchControls()

ilTestParticipantsGUI::addUserSearchControls ( ilToolbarGUI  $toolbar)
protected
Parameters
ilToolbarGUI$toolbar
ilLanguage$lng

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

370 {
371 global $DIC; /* @var ILIAS\DI\Container $DIC */
372
373 // search button
374 include_once './Services/Search/classes/class.ilRepositorySearchGUI.php';
376 $this,
377 $toolbar,
378 array(
379 'auto_complete_name' => $DIC->language()->txt('user'),
380 'submit_name' => $DIC->language()->txt('add')
381 )
382 );
383
384 require_once 'Services/UIComponent/Button/classes/class.ilLinkButton.php';
385 $search_btn = ilLinkButton::getInstance();
386 $search_btn->setCaption('tst_search_users');
387 $search_btn->setUrl($DIC->ctrl()->getLinkTargetByClass('ilRepositorySearchGUI', 'start'));
388
389 $toolbar->addSeparator();
390 $toolbar->addButtonInstance($search_btn);
391 }
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...

References $DIC, ilToolbarGUI\addButtonInstance(), ilToolbarGUI\addSeparator(), ilRepositorySearchGUI\fillAutoCompleteToolbar(), and ilLinkButton\getInstance().

Referenced by initToolbarControls().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ applyFilterCriteria()

ilTestParticipantsGUI::applyFilterCriteria (   $in_rows)
protected
Parameters
array$in_rows
Returns
array

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

314 : array
315 {
316 global $DIC; /* @var ILIAS\DI\Container $DIC */
317
318 $selected_pax = ilSession::get('form_tst_participants_' . $this->getTestObj()->getRefId() . '_selection');
319
320 if (!is_string($selected_pax)) {
321 return $in_rows;
322 }
323
324 $filter = unserialize($selected_pax, ['allowed_classes' => false]);
325
326 if (!is_string($filter) || $filter === 'all') {
327 return $in_rows;
328 }
329
330 $rows = [];
331
332 foreach ($in_rows as $row) {
333 $query = $DIC->database()->query(
334 'SELECT count(solution_id) count
335 FROM tst_solutions
336 WHERE active_fi = ' . $DIC->database()->quote($row['active_id'])
337 . ' HAVING count ' . ($filter === 'withSolutions' ? '>' : '=') . ' 0'
338 );
339
340 if (is_array($DIC->database()->fetchAssoc($query))) {
341 $rows[] = $row;
342 }
343 }
344
345 return $rows;
346 }
static get(string $a_var)
$query
$rows
Definition: xhr_table.php:10

References $DIC, $query, $rows, ilSession\get(), and getTestObj().

Referenced by showCmd().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ buildTableGUI()

ilTestParticipantsGUI::buildTableGUI ( )
protected
Returns
ilTestParticipantsTableGUI

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

223 {
224 global $DIC; /* @var ILIAS\DI\Container $DIC */
225
226 require_once 'Modules/Test/classes/tables/class.ilTestParticipantsTableGUI.php';
227 $tableGUI = new ilTestParticipantsTableGUI($this, self::CMD_SHOW);
228
229 $tableGUI->setParticipantHasSolutionsFilterEnabled(
230 (bool) $this->getTestObj()->getFixedParticipants()
231 );
232
233 if ($this->getTestObj()->getFixedParticipants()) {
234 $tableGUI->setTitle($DIC->language()->txt('tst_tbl_invited_users'));
235 } else {
236 $tableGUI->setTitle($DIC->language()->txt('tst_tbl_participants'));
237 }
238
239 return $tableGUI;
240 }
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...

References $DIC, and getTestObj().

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

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ executeCommand()

ilTestParticipantsGUI::executeCommand ( )

Execute Command.

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

141 {
142 global $DIC; /* @var ILIAS\DI\Container $DIC */
143
144
145 switch ($DIC->ctrl()->getNextClass($this)) {
146 case 'ilrepositorysearchgui':
147
148 require_once 'Modules/Test/classes/class.ilTestParticipantAccessFilter.php';
149 require_once 'Services/Search/classes/class.ilRepositorySearchGUI.php';
150
151 $gui = new ilRepositorySearchGUI();
152 $gui->setCallback($this, self::CALLBACK_ADD_PARTICIPANT, array());
153
155 $this->getTestObj()->getRefId()
156 ));
157
158
159 $DIC->ctrl()->setReturn($this, self::CMD_SHOW);
160 $DIC->ctrl()->forwardCommand($gui);
161
162 break;
163
164 case "iltestevaluationgui":
165
166 require_once 'Modules/Test/classes/class.ilTestEvaluationGUI.php';
167
168 $gui = new ilTestEvaluationGUI($this->getTestObj());
169 $gui->setObjectiveOrientedContainer($this->getObjectiveParent());
170 $gui->setTestAccess($this->getTestAccess());
171 $DIC->tabs()->clearTargets();
172 $DIC->tabs()->clearSubTabs();
173
174 $DIC->ctrl()->forwardCommand($gui);
175
176 break;
177
178 default:
179
180 $command = $DIC->ctrl()->getCmd(self::CMD_SHOW) . 'Cmd';
181 $this->{$command}();
182 }
183 }
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...

References $DIC, ilTestParticipantAccessFilter\getManageParticipantsUserFilter(), getObjectiveParent(), getTestAccess(), and getTestObj().

+ Here is the call graph for this function:

◆ getObjectiveParent()

ilTestParticipantsGUI::getObjectiveParent ( )

◆ getQuestionSetConfig()

ilTestParticipantsGUI::getQuestionSetConfig ( )
Returns
ilTestQuestionSetConfig

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

References $questionSetConfig.

Referenced by showCmd().

+ Here is the caller graph for this function:

◆ getTestAccess()

ilTestParticipantsGUI::getTestAccess ( )
Returns
ilTestAccess

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

References $testAccess.

Referenced by executeCommand().

+ Here is the caller graph for this function:

◆ getTestObj()

ilTestParticipantsGUI::getTestObj ( )
Returns
ilObjTest

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

76 : ilObjTest
77 {
78 return $this->testObj;
79 }

References $testObj.

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

+ Here is the caller graph for this function:

◆ initToolbarControls()

ilTestParticipantsGUI::initToolbarControls ( ilTestParticipantList  $participantList)
protected

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

349 {
350 global $DIC; /* @var ILIAS\DI\Container $DIC */
351
352 if ($this->getTestObj()->getFixedParticipants()) {
353 $this->addUserSearchControls($DIC->toolbar());
354 }
355
356 if ($this->getTestObj()->getFixedParticipants() && $participantList->hasUnfinishedPasses()) {
357 $DIC->toolbar()->addSeparator();
358 }
359
360 if ($participantList->hasUnfinishedPasses()) {
361 $this->addFinishAllPassesButton($DIC->toolbar());
362 }
363 }
addUserSearchControls(ilToolbarGUI $toolbar)
addFinishAllPassesButton(ilToolbarGUI $toolbar)

References $DIC, addFinishAllPassesButton(), addUserSearchControls(), getTestObj(), and ilTestParticipantList\hasUnfinishedPasses().

Referenced by showCmd().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ removeParticipantsCmd()

ilTestParticipantsGUI::removeParticipantsCmd ( )
protected

remove participants command

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

431 {
432 global $DIC; /* @var ILIAS\DI\Container $DIC */
433
434 require_once 'Modules/Test/classes/class.ilTestParticipantAccessFilter.php';
436 $a_user_ids = call_user_func_array($filterCallback, [(array) $_POST["chbUser"]]);
437
438 if (is_array($a_user_ids)) {
439 foreach ($a_user_ids as $user_id) {
440 $this->getTestObj()->disinviteUser($user_id);
441 }
442 } else {
443 $this->main_tpl->setOnScreenMessage('info', $DIC->language()->txt("select_one_user"), true);
444 }
445
446 $DIC->ctrl()->redirect($this, self::CMD_SHOW);
447 }

References $DIC, ilTestParticipantAccessFilter\getManageParticipantsUserFilter(), and getTestObj().

+ Here is the call graph for this function:

◆ resetFilterCmd()

ilTestParticipantsGUI::resetFilterCmd ( )
protected

reset table filter command

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

258 {
259 $tableGUI = $this->buildTableGUI();
260 $tableGUI->resetFilter();
261 $tableGUI->resetOffset();
262 $this->showCmd();
263 }

References buildTableGUI(), and showCmd().

+ Here is the call graph for this function:

◆ saveClientIpCmd()

ilTestParticipantsGUI::saveClientIpCmd ( )
protected

save client ip command

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

410 {
411 global $DIC; /* @var ILIAS\DI\Container $DIC */
412
413 require_once 'Modules/Test/classes/class.ilTestParticipantAccessFilter.php';
415 $a_user_ids = call_user_func_array($filterCallback, [(array) $_POST["chbUser"]]);
416
417 if (is_array($a_user_ids)) {
418 foreach ($a_user_ids as $user_id) {
419 $this->getTestObj()->setClientIP($user_id, $_POST["clientip_" . $user_id]);
420 }
421 } else {
422 $this->main_tpl->setOnScreenMessage('info', $DIC->language()->txt("select_one_user"), true);
423 }
424 $DIC->ctrl()->redirect($this, self::CMD_SHOW);
425 }

References $DIC, ilTestParticipantAccessFilter\getManageParticipantsUserFilter(), and getTestObj().

+ Here is the call graph for this function:

◆ setFilterCmd()

ilTestParticipantsGUI::setFilterCmd ( )
protected

set table filter command

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

246 {
247 $tableGUI = $this->buildTableGUI();
248 $tableGUI->initFilter($this->getTestObj()->getFixedParticipants());
249 $tableGUI->writeFilterToSession();
250 $tableGUI->resetOffset();
251 $this->showCmd();
252 }

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

+ Here is the call graph for this function:

◆ setObjectiveParent()

ilTestParticipantsGUI::setObjectiveParent ( ilTestObjectiveOrientedContainer  $objectiveParent)
Parameters
ilTestObjectiveOrientedContainer$objectiveParent

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

117 {
118 $this->objectiveParent = $objectiveParent;
119 }

References $objectiveParent.

◆ setQuestionSetConfig()

ilTestParticipantsGUI::setQuestionSetConfig (   $questionSetConfig)
Parameters
ilTestQuestionSetConfig$questionSetConfig

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

101 {
102 $this->questionSetConfig = $questionSetConfig;
103 }

References $questionSetConfig.

◆ setTestAccess()

ilTestParticipantsGUI::setTestAccess ( ilTestAccess  $testAccess)
Parameters
ilTestAccess$testAccess

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

133 {
134 $this->testAccess = $testAccess;
135 }

References $testAccess.

◆ setTestObj()

ilTestParticipantsGUI::setTestObj (   $testObj)
Parameters
ilObjTest$testObj

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

85 {
86 $this->testObj = $testObj;
87 }

References $testObj.

◆ showCmd()

ilTestParticipantsGUI::showCmd ( )

show command

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

269 {
270 global $DIC; /* @var ILIAS\DI\Container $DIC */
271
272 $tableGUI = $this->buildTableGUI();
273
274 if (!$this->getQuestionSetConfig()->areDepenciesBroken()) {
275 if ($this->getTestObj()->getFixedParticipants()) {
276 $participantList = $this->getTestObj()->getInvitedParticipantList()->getAccessFilteredList(
278 );
279
280 $tableGUI->setData($this->applyFilterCriteria($participantList->getParticipantsTableRows()));
281 $tableGUI->setRowKeyDataField('usr_id');
282 $tableGUI->setManageInviteesCommandsEnabled(true);
283 $tableGUI->setDescription($DIC->language()->txt("fixed_participants_hint"));
284 } else {
285 $participantList = $this->getTestObj()->getActiveParticipantList()->getAccessFilteredList(
287 );
288
289 $tableGUI->setData($participantList->getParticipantsTableRows());
290 $tableGUI->setRowKeyDataField('active_id');
291 }
292
293 $tableGUI->setManageResultsCommandsEnabled(true);
294
295 $this->initToolbarControls($participantList);
296 }
297
298 $tableGUI->setAnonymity($this->getTestObj()->getAnonymity());
299
300 $tableGUI->initColumns();
301 $tableGUI->initCommands();
302
303 $tableGUI->initFilter();
304 $tableGUI->setFilterCommand(self::CMD_SET_FILTER);
305 $tableGUI->setResetCommand(self::CMD_RESET_FILTER);
306
307 $DIC->ui()->mainTemplate()->setContent($DIC->ctrl()->getHTML($tableGUI));
308 }
initToolbarControls(ilTestParticipantList $participantList)

References $DIC, applyFilterCriteria(), buildTableGUI(), ilTestParticipantAccessFilter\getManageParticipantsUserFilter(), getQuestionSetConfig(), getTestObj(), and initToolbarControls().

Referenced by resetFilterCmd(), and setFilterCmd().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

Field Documentation

◆ $main_tpl

ilGlobalTemplateInterface ilTestParticipantsGUI::$main_tpl
private

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

◆ $objectiveParent

ilTestParticipantsGUI::$objectiveParent
protected

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

Referenced by getObjectiveParent(), and setObjectiveParent().

◆ $questionSetConfig

ilTestParticipantsGUI::$questionSetConfig
protected

◆ $testAccess

ilTestParticipantsGUI::$testAccess
protected

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

Referenced by getTestAccess(), and setTestAccess().

◆ $testObj

ilTestParticipantsGUI::$testObj
protected

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

Referenced by __construct(), getTestObj(), and setTestObj().

◆ CALLBACK_ADD_PARTICIPANT

const ilTestParticipantsGUI::CALLBACK_ADD_PARTICIPANT = 'addParticipants'

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

◆ CMD_RESET_FILTER

const ilTestParticipantsGUI::CMD_RESET_FILTER = 'resetFilter'

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

◆ CMD_SAVE_CLIENT_IP

const ilTestParticipantsGUI::CMD_SAVE_CLIENT_IP = 'saveClientIp'

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

◆ CMD_SET_FILTER

const ilTestParticipantsGUI::CMD_SET_FILTER = 'setFilter'

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

◆ CMD_SHOW

const ilTestParticipantsGUI::CMD_SHOW = 'show'

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


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