ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
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'
 Command/Callback Constants. More...
 
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
 

Detailed Description

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

Constructor & Destructor Documentation

◆ __construct()

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

ilTestParticipantsGUI constructor.

Parameters
ilObjTest$testObj

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

References $questionSetConfig, and $testObj.

55  {
56  $this->testObj = $testObj;
57  $this->questionSetConfig = $questionSetConfig;
58  }

Member Function Documentation

◆ addFinishAllPassesButton()

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

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

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

Referenced by initToolbarControls().

390  {
391  global $DIC; /* @var ILIAS\DI\Container $DIC */
392 
393  $finish_all_user_passes_btn = ilLinkButton::getInstance();
394  $finish_all_user_passes_btn->setCaption('finish_all_user_passes');
395  $finish_all_user_passes_btn->setUrl($DIC->ctrl()->getLinkTargetByClass('iltestevaluationgui', 'finishAllUserPasses'));
396  $toolbar->addButtonInstance($finish_all_user_passes_btn);
397  }
global $DIC
Definition: saml.php:7
addButtonInstance(ilButtonBase $a_button)
Add button instance.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ addParticipants()

ilTestParticipantsGUI::addParticipants (   $a_user_ids = array())
Parameters
array$a_user_ids
Returns
bool

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

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

177  {
178  global $DIC; /* @var ILIAS\DI\Container $DIC */
179 
180  require_once 'Modules/Test/classes/class.ilTestParticipantAccessFilter.php';
181  $filterCallback = ilTestParticipantAccessFilter::getManageParticipantsUserFilter($this->getTestObj()->getRefId());
182  $a_user_ids = call_user_func_array($filterCallback, [$a_user_ids]);
183 
184  $countusers = 0;
185  // add users
186  if (is_array($a_user_ids)) {
187  $i = 0;
188  foreach ($a_user_ids as $user_id) {
189  $client_ip = $_POST["client_ip"][$i];
190  $this->getTestObj()->inviteUser($user_id, $client_ip);
191  $countusers++;
192  $i++;
193  }
194  }
195  $message = "";
196  if ($countusers) {
197  $message = $DIC->language()->txt("tst_invited_selected_users");
198  }
199  if (strlen($message)) {
200  ilUtil::sendInfo($message, true);
201  } else {
202  ilUtil::sendInfo($DIC->language()->txt("tst_invited_nobody"), true);
203  return false;
204  }
205 
206  $DIC->ctrl()->redirect($this, self::CMD_SHOW);
207  }
global $DIC
Definition: saml.php:7
static sendInfo($a_info="", $a_keep=false)
Send Info Message to Screen.
catch(Exception $e) $message
$i
Definition: disco.tpl.php:19
$_POST["username"]
+ Here is the call graph for this function:

◆ addUserSearchControls()

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

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

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

Referenced by initToolbarControls().

363  {
364  global $DIC; /* @var ILIAS\DI\Container $DIC */
365 
366  // search button
367  include_once './Services/Search/classes/class.ilRepositorySearchGUI.php';
369  $this,
370  $toolbar,
371  array(
372  'auto_complete_name' => $DIC->language()->txt('user'),
373  'submit_name' => $DIC->language()->txt('add')
374  )
375  );
376 
377  require_once 'Services/UIComponent/Button/classes/class.ilLinkButton.php';
378  $search_btn = ilLinkButton::getInstance();
379  $search_btn->setCaption('tst_search_users');
380  $search_btn->setUrl($DIC->ctrl()->getLinkTargetByClass('ilRepositorySearchGUI', 'start'));
381 
382  $toolbar->addSeparator();
383  $toolbar->addButtonInstance($search_btn);
384  }
global $DIC
Definition: saml.php:7
addButtonInstance(ilButtonBase $a_button)
Add button instance.
addSeparator()
Add separator.
static fillAutoCompleteToolbar($parent_object, ilToolbarGUI $toolbar=null, $a_options=array(), $a_sticky=false)
fill toolbar with
+ 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 304 of file class.ilTestParticipantsGUI.php.

References $_SESSION, $DIC, $result, $row, and getTestObj().

Referenced by showCmd().

305  {
306  global $DIC; /* @var ILIAS\DI\Container $DIC */
307 
308  $sess_filter = $_SESSION['form_tst_participants_' . $this->getTestObj()->getRefId()]['selection'];
309  $sess_filter = str_replace('"', '', $sess_filter);
310  $sess_filter = explode(':', $sess_filter);
311  $filter = substr($sess_filter[2], 0, strlen($sess_filter[2]) - 1);
312 
313  if ($filter == 'all' || $filter == false) {
314  return $in_rows; #unchanged - no filter.
315  }
316 
317  $with_result = array();
318  $without_result = array();
319  foreach ($in_rows as $row) {
320  $result = $DIC->database()->query(
321  'SELECT count(solution_id) count
322  FROM tst_solutions
323  WHERE active_fi = ' . $DIC->database()->quote($row['active_id'])
324  );
325  $count = $DIC->database()->fetchAssoc($result);
326  $count = $count['count'];
327 
328  if ($count == 0) {
329  $without_result[] = $row;
330  } else {
331  $with_result[] = $row;
332  }
333  }
334 
335  if ($filter == 'withSolutions') {
336  return $with_result;
337  }
338  return $without_result;
339  }
$_SESSION["AccountId"]
$result
global $DIC
Definition: saml.php:7
$row
+ 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 212 of file class.ilTestParticipantsGUI.php.

References $DIC, and getTestObj().

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

213  {
214  global $DIC; /* @var ILIAS\DI\Container $DIC */
215 
216  require_once 'Modules/Test/classes/tables/class.ilTestParticipantsTableGUI.php';
217  $tableGUI = new ilTestParticipantsTableGUI($this, self::CMD_SHOW);
218 
219  $tableGUI->setParticipantHasSolutionsFilterEnabled(
220  $this->getTestObj()->getFixedParticipants()
221  );
222 
223  if ($this->getTestObj()->getFixedParticipants()) {
224  $tableGUI->setTitle($DIC->language()->txt('tst_tbl_invited_users'));
225  } else {
226  $tableGUI->setTitle($DIC->language()->txt('tst_tbl_participants'));
227  }
228 
229  return $tableGUI;
230  }
global $DIC
Definition: saml.php:7
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ executeCommand()

ilTestParticipantsGUI::executeCommand ( )

Execute Command.

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

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

128  {
129  global $DIC; /* @var ILIAS\DI\Container $DIC */
130 
131 
132  switch ($DIC->ctrl()->getNextClass($this)) {
133  case 'ilrepositorysearchgui':
134 
135  require_once 'Modules/Test/classes/class.ilTestParticipantAccessFilter.php';
136  require_once 'Services/Search/classes/class.ilRepositorySearchGUI.php';
137 
138  $gui = new ilRepositorySearchGUI();
139  $gui->setCallback($this, self::CALLBACK_ADD_PARTICIPANT, array());
140 
141  $gui->addUserAccessFilterCallable(ilTestParticipantAccessFilter::getManageParticipantsUserFilter(
142  $this->getTestObj()->getRefId()
143  ));
144 
145 
146  $DIC->ctrl()->setReturn($this, self::CMD_SHOW);
147  $DIC->ctrl()->forwardCommand($gui);
148 
149  break;
150 
151  case "iltestevaluationgui":
152 
153  require_once 'Modules/Test/classes/class.ilTestEvaluationGUI.php';
154 
155  $gui = new ilTestEvaluationGUI($this->getTestObj());
156  $gui->setObjectiveOrientedContainer($this->getObjectiveParent());
157  $gui->setTestAccess($this->getTestAccess());
158  $DIC->tabs()->clearTargets();
159  $DIC->tabs()->clearSubTabs();
160 
161  $DIC->ctrl()->forwardCommand($gui);
162 
163  break;
164 
165  default:
166 
167  $command = $DIC->ctrl()->getCmd(self::CMD_SHOW) . 'Cmd';
168  $this->{$command}();
169  }
170  }
global $DIC
Definition: saml.php:7
Output class for assessment test evaluation.
+ Here is the call graph for this function:

◆ getObjectiveParent()

ilTestParticipantsGUI::getObjectiveParent ( )

◆ getQuestionSetConfig()

ilTestParticipantsGUI::getQuestionSetConfig ( )
Returns
ilTestQuestionSetConfig

Definition at line 79 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 111 of file class.ilTestParticipantsGUI.php.

References $testAccess.

Referenced by executeCommand().

+ Here is the caller graph for this function:

◆ getTestObj()

ilTestParticipantsGUI::getTestObj ( )

◆ initToolbarControls()

ilTestParticipantsGUI::initToolbarControls ( ilTestParticipantList  $participantList)
protected

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

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

Referenced by showCmd().

342  {
343  global $DIC; /* @var ILIAS\DI\Container $DIC */
344 
345  if ($this->getTestObj()->getFixedParticipants()) {
346  $this->addUserSearchControls($DIC->toolbar());
347  }
348 
349  if ($this->getTestObj()->getFixedParticipants() && $participantList->hasUnfinishedPasses()) {
350  $DIC->toolbar()->addSeparator();
351  }
352 
353  if ($participantList->hasUnfinishedPasses()) {
354  $this->addFinishAllPassesButton($DIC->toolbar());
355  }
356  }
global $DIC
Definition: saml.php:7
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

remove participants command

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

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

424  {
425  global $DIC; /* @var ILIAS\DI\Container $DIC */
426 
427  require_once 'Modules/Test/classes/class.ilTestParticipantAccessFilter.php';
428  $filterCallback = ilTestParticipantAccessFilter::getManageParticipantsUserFilter($this->getTestObj()->getRefId());
429  $a_user_ids = call_user_func_array($filterCallback, [(array) $_POST["chbUser"]]);
430 
431  if (is_array($a_user_ids)) {
432  foreach ($a_user_ids as $user_id) {
433  $this->getTestObj()->disinviteUser($user_id);
434  }
435  } else {
436  ilUtil::sendInfo($DIC->language()->txt("select_one_user"), true);
437  }
438 
439  $DIC->ctrl()->redirect($this, self::CMD_SHOW);
440  }
global $DIC
Definition: saml.php:7
static sendInfo($a_info="", $a_keep=false)
Send Info Message to Screen.
$_POST["username"]
+ Here is the call graph for this function:

◆ resetFilterCmd()

ilTestParticipantsGUI::resetFilterCmd ( )
protected

reset table filter command

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

References buildTableGUI(), and showCmd().

248  {
249  $tableGUI = $this->buildTableGUI();
250  $tableGUI->resetFilter();
251  $tableGUI->resetOffset();
252  $this->showCmd();
253  }
+ Here is the call graph for this function:

◆ saveClientIpCmd()

ilTestParticipantsGUI::saveClientIpCmd ( )
protected

save client ip command

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

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

403  {
404  global $DIC; /* @var ILIAS\DI\Container $DIC */
405 
406  require_once 'Modules/Test/classes/class.ilTestParticipantAccessFilter.php';
407  $filterCallback = ilTestParticipantAccessFilter::getManageParticipantsUserFilter($this->getTestObj()->getRefId());
408  $a_user_ids = call_user_func_array($filterCallback, [(array) $_POST["chbUser"]]);
409 
410  if (is_array($a_user_ids)) {
411  foreach ($a_user_ids as $user_id) {
412  $this->getTestObj()->setClientIP($user_id, $_POST["clientip_" . $user_id]);
413  }
414  } else {
415  ilUtil::sendInfo($DIC->language()->txt("select_one_user"), true);
416  }
417  $DIC->ctrl()->redirect($this, self::CMD_SHOW);
418  }
global $DIC
Definition: saml.php:7
static sendInfo($a_info="", $a_keep=false)
Send Info Message to Screen.
$_POST["username"]
+ Here is the call graph for this function:

◆ setFilterCmd()

ilTestParticipantsGUI::setFilterCmd ( )
protected

set table filter command

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

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

236  {
237  $tableGUI = $this->buildTableGUI();
238  $tableGUI->initFilter($this->getTestObj()->getFixedParticipants());
239  $tableGUI->writeFilterToSession();
240  $tableGUI->resetOffset();
241  $this->showCmd();
242  }
+ Here is the call graph for this function:

◆ setObjectiveParent()

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

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

References $objectiveParent.

104  {
105  $this->objectiveParent = $objectiveParent;
106  }

◆ setQuestionSetConfig()

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

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

References $questionSetConfig.

88  {
89  $this->questionSetConfig = $questionSetConfig;
90  }

◆ setTestAccess()

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

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

References $testAccess.

120  {
121  $this->testAccess = $testAccess;
122  }

◆ setTestObj()

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

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

References $testObj.

72  {
73  $this->testObj = $testObj;
74  }

◆ showCmd()

ilTestParticipantsGUI::showCmd ( )

show command

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

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

Referenced by resetFilterCmd(), and setFilterCmd().

259  {
260  global $DIC; /* @var ILIAS\DI\Container $DIC */
261 
262  $tableGUI = $this->buildTableGUI();
263 
264  if (!$this->getQuestionSetConfig()->areDepenciesBroken()) {
265  if ($this->getTestObj()->getFixedParticipants()) {
266  $participantList = $this->getTestObj()->getInvitedParticipantList()->getAccessFilteredList(
268  );
269 
270  $tableGUI->setData($this->applyFilterCriteria($participantList->getParticipantsTableRows()));
271  $tableGUI->setRowKeyDataField('usr_id');
272  $tableGUI->setManageInviteesCommandsEnabled(true);
273  $tableGUI->setDescription($DIC->language()->txt("fixed_participants_hint"));
274  } else {
275  $participantList = $this->getTestObj()->getActiveParticipantList()->getAccessFilteredList(
277  );
278 
279  $tableGUI->setData($participantList->getParticipantsTableRows());
280  $tableGUI->setRowKeyDataField('active_id');
281  }
282 
283  $tableGUI->setManageResultsCommandsEnabled(true);
284 
285  $this->initToolbarControls($participantList);
286  }
287 
288  $tableGUI->setAnonymity($this->getTestObj()->getAnonymity());
289 
290  $tableGUI->initColumns();
291  $tableGUI->initCommands();
292 
293  $tableGUI->initFilter();
294  $tableGUI->setFilterCommand(self::CMD_SET_FILTER);
295  $tableGUI->setResetCommand(self::CMD_RESET_FILTER);
296 
297  $DIC->ui()->mainTemplate()->setContent($DIC->ctrl()->getHTML($tableGUI));
298  }
global $DIC
Definition: saml.php:7
initToolbarControls(ilTestParticipantList $participantList)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

Field Documentation

◆ $objectiveParent

ilTestParticipantsGUI::$objectiveParent
protected

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

Referenced by getObjectiveParent(), and setObjectiveParent().

◆ $questionSetConfig

ilTestParticipantsGUI::$questionSetConfig
protected

◆ $testAccess

ilTestParticipantsGUI::$testAccess
protected

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

Referenced by getTestAccess(), and setTestAccess().

◆ $testObj

ilTestParticipantsGUI::$testObj
protected

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

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

◆ CALLBACK_ADD_PARTICIPANT

const ilTestParticipantsGUI::CALLBACK_ADD_PARTICIPANT = 'addParticipants'

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

◆ CMD_RESET_FILTER

const ilTestParticipantsGUI::CMD_RESET_FILTER = 'resetFilter'

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

◆ CMD_SAVE_CLIENT_IP

const ilTestParticipantsGUI::CMD_SAVE_CLIENT_IP = 'saveClientIp'

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

◆ CMD_SET_FILTER

const ilTestParticipantsGUI::CMD_SET_FILTER = 'setFilter'

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

◆ CMD_SHOW

const ilTestParticipantsGUI::CMD_SHOW = 'show'

Command/Callback Constants.

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


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