ILIAS  release_5-1 Revision 5.0.0-5477-g43f3e3fab5f
class.ilObjTestGUI.php
Go to the documentation of this file.
1 <?php
2 /* Copyright (c) 1998-2013 ILIAS open source, Extended GPL, see docs/LICENSE */
3 
4 require_once './Modules/Test/exceptions/class.ilTestException.php';
5 require_once './Services/Object/classes/class.ilObjectGUI.php';
6 require_once './Modules/Test/classes/inc.AssessmentConstants.php';
7 require_once './Modules/Test/classes/class.ilObjAssessmentFolderGUI.php';
8 require_once './Modules/Test/classes/class.ilObjAssessmentFolder.php';
9 require_once './Modules/Test/classes/class.ilTestExpressPage.php';
10 
49 {
50  private static $infoScreenChildClasses = array(
51  'ilpublicuserprofilegui', 'ilobjportfoliogui'
52  );
53 
55  public $object = null;
56 
59 
61  private $testPlayerFactory = null;
62 
64  private $testSessionFactory = null;
65 
67  private $testSequenceFactory = null;
68 
73 
78  function ilObjTestGUI()
79  {
80  global $lng, $ilCtrl, $ilDB, $ilPluginAdmin, $tree;
81  $lng->loadLanguageModule("assessment");
82  $this->type = "tst";
83  $this->ctrl =& $ilCtrl;
84  $this->ctrl->saveParameter($this, array("ref_id", "test_ref_id", "calling_test", "test_express_mode", "q_id"));
85  $this->ilObjectGUI("",$_GET["ref_id"], true, false);
86 
87  if( $this->object instanceof ilObjTest )
88  {
89  require_once 'Modules/Test/classes/class.ilTestQuestionSetConfigFactory.php';
90  $this->testQuestionSetConfigFactory = new ilTestQuestionSetConfigFactory($tree, $ilDB, $ilPluginAdmin, $this->object);
91 
92  require_once 'Modules/Test/classes/class.ilTestPlayerFactory.php';
93  $this->testPlayerFactory = new ilTestPlayerFactory($this->object);
94 
95  require_once 'Modules/Test/classes/class.ilTestSessionFactory.php';
96  $this->testSessionFactory = new ilTestSessionFactory($this->object);
97 
98  require_once 'Modules/Test/classes/class.ilTestSequenceFactory.php';
99  $this->testSequenceFactory = new ilTestSequenceFactory($ilDB, $lng, $ilPluginAdmin, $this->object);
100  }
101 
102  require_once 'Modules/Test/classes/class.ilTestObjectiveOrientedContainer.php';
103  $this->objectiveOrientedContainer = new ilTestObjectiveOrientedContainer();
104  }
105 
109  function executeCommand()
110  {
111  global $ilAccess, $ilNavigationHistory, $ilCtrl, $ilErr, $tpl, $lng, $ilTabs, $ilPluginAdmin, $ilDB, $tree, $ilias, $ilUser;
112 
113  if((!$ilAccess->checkAccess("read", "", $_GET["ref_id"])))
114  {
115  $ilias->raiseError($this->lng->txt("permission_denied"), $ilias->error_obj->MESSAGE);
116  }
117 
118  $cmd = $this->ctrl->getCmd("infoScreen");
119 
120  $cmdsDisabledDueToOfflineStatus = array(
121  'resumePlayer', 'resumePlayer', 'outUserResultsOverview', 'outUserListOfAnswerPasses'
122  );
123 
124  if(!$this->getCreationMode() && !$this->object->isOnline() && in_array($cmd, $cmdsDisabledDueToOfflineStatus))
125  {
126  $cmd = 'infoScreen';
127  }
128 
129  $next_class = $this->ctrl->getNextClass($this);
130  $this->ctrl->setReturn($this, "infoScreen");
131 
132  if(method_exists($this->object, "getTestStyleLocation")) $this->tpl->addCss($this->object->getTestStyleLocation("output"), "screen");
133 
134  // add entry to navigation history
135  if(!$this->getCreationMode() &&
136  $ilAccess->checkAccess("read", "", $_GET["ref_id"])
137  )
138  {
139  $ilNavigationHistory->addItem($_GET["ref_id"],
140  "ilias.php?baseClass=ilObjTestGUI&cmd=infoScreen&ref_id=" . $_GET["ref_id"], "tst");
141  }
142 
143  if(!$this->getCreationMode())
144  {
145  if(IS_PAYMENT_ENABLED)
146  {
147  require_once 'Services/Payment/classes/class.ilPaymentObject.php';
148  if(ilPaymentObject::_requiresPurchaseToAccess($this->object->getRefId(), $type = (isset($_GET['purchasetype']) ? $_GET['purchasetype'] : NULL)))
149  {
150  $this->setLocator();
151  $this->tpl->getStandardTemplate();
152 
153  include_once 'Services/Payment/classes/class.ilShopPurchaseGUI.php';
154  $pp = new ilShopPurchaseGUI((int)$_GET['ref_id']);
155  $ret = $this->ctrl->forwardCommand($pp);
156  $this->tpl->show();
157  exit();
158  }
159  }
160  }
161 
162  // elba hack for storing question id for inserting new question after
163  if($_REQUEST['prev_qid'])
164  {
165  global $___prev_question_id;
166  $___prev_question_id = $_REQUEST['prev_qid'];
167  $this->ctrl->setParameter($this, 'prev_qid', $_REQUEST['prev_qid']);
168  }
169 
170  if( !$this->getCreationMode() && $this->testQuestionSetConfigFactory->getQuestionSetConfig()->areDepenciesBroken() )
171  {
172  if( !$this->testQuestionSetConfigFactory->getQuestionSetConfig()->isValidRequestOnBrokenQuestionSetDepencies($next_class, $cmd) )
173  {
174  $this->ctrl->redirectByClass('ilObjTestGUI', 'infoScreen');
175  }
176  }
177 
179 
180  switch($next_class)
181  {
182  case 'iltestexportgui':
183  if(!$ilAccess->checkAccess('write', '', $this->ref_id))
184  {
185  $ilErr->raiseError($this->lng->txt('permission_denied'), $ilErr->WARNING);
186  }
187 
188  $this->prepareOutput();
189  $this->addHeaderAction();
190  require_once 'Modules/Test/classes/class.ilTestExportGUI.php';
191  $ilCtrl->forwardCommand(new ilTestExportGUI($this));
192  break;
193 
194  case "ilinfoscreengui":
195  $this->prepareOutput();
196  $this->addHeaderAction();
197  $this->infoScreen(); // forwards command
198  break;
199  case 'ilobjectmetadatagui':
200  if(!$ilAccess->checkAccess('write', '', $this->object->getRefId()))
201  {
202  $ilErr->raiseError($this->lng->txt('permission_denied'), $ilErr->WARNING);
203  }
204 
205  $this->prepareOutput();
206  $this->addHeaderAction();
207  include_once 'Services/Object/classes/class.ilObjectMetaDataGUI.php';
208  $md_gui = new ilObjectMetaDataGUI($this->object);
209  $this->ctrl->forwardCommand($md_gui);
210  break;
211 
212  case "iltestplayerfixedquestionsetgui":
213  $this->trackTestObjectReadEvent();
214  require_once "./Modules/Test/classes/class.ilTestPlayerFixedQuestionSetGUI.php";
215  if(!$this->object->getKioskMode()) $this->prepareOutput();
216  $gui = new ilTestPlayerFixedQuestionSetGUI($this->object);
217  $gui->setObjectiveOrientedContainer($this->getObjectiveOrientedContainer());
218  $this->ctrl->forwardCommand($gui);
219  break;
220 
221  case "iltestplayerrandomquestionsetgui":
222  $this->trackTestObjectReadEvent();
223  require_once "./Modules/Test/classes/class.ilTestPlayerRandomQuestionSetGUI.php";
224  if(!$this->object->getKioskMode()) $this->prepareOutput();
225  $gui = new ilTestPlayerRandomQuestionSetGUI($this->object);
226  $gui->setObjectiveOrientedContainer($this->getObjectiveOrientedContainer());
227  $this->ctrl->forwardCommand($gui);
228  break;
229 
230  case "iltestplayerdynamicquestionsetgui":
231  $this->trackTestObjectReadEvent();
232  require_once "./Modules/Test/classes/class.ilTestPlayerDynamicQuestionSetGUI.php";
233  if (!$this->object->getKioskMode()) $this->prepareOutput();
234  $gui = new ilTestPlayerDynamicQuestionSetGUI($this->object);
235  $gui->setObjectiveOrientedContainer($this->getObjectiveOrientedContainer());
236  $this->ctrl->forwardCommand($gui);
237  break;
238 
239  case "iltestevaluationgui":
240  $this->forwardToEvaluationGUI();
241  break;
242 
243  case "iltestevalobjectiveorientedgui":
245  break;
246 
247  case "iltestservicegui":
248  $this->prepareOutput();
249  $this->addHeaderAction();
250  require_once "./Modules/Test/classes/class.ilTestServiceGUI.php";
251  $serviceGUI =& new ilTestServiceGUI($this->object);
252  $this->ctrl->forwardCommand($serviceGUI);
253  break;
254 
255  case 'ilpermissiongui':
256  $this->prepareOutput();
257  $this->addHeaderAction();
258  include_once("Services/AccessControl/classes/class.ilPermissionGUI.php");
259  $perm_gui =& new ilPermissionGUI($this);
260  $ret =& $this->ctrl->forwardCommand($perm_gui);
261  break;
262 
263  case "illearningprogressgui":
264  $this->prepareOutput();
265  $this->addHeaderAction();
266  require_once './Services/Tracking/classes/class.ilLearningProgressGUI.php';
267  $new_gui =& new ilLearningProgressGUI(ilLearningProgressGUI::LP_CONTEXT_REPOSITORY, $this->object->getRefId());
268  $this->ctrl->forwardCommand($new_gui);
269 
270  break;
271 
272  case "ilcertificategui":
273  $this->prepareOutput();
274  $this->addHeaderAction();
275  require_once "./Services/Certificate/classes/class.ilCertificateGUI.php";
276  require_once "./Modules/Test/classes/class.ilTestCertificateAdapter.php";
277  $output_gui = new ilCertificateGUI(new ilTestCertificateAdapter($this->object));
278  $this->ctrl->forwardCommand($output_gui);
279  break;
280 
281  case "iltestscoringgui":
282  $this->prepareOutput();
283  $this->addHeaderAction();
284  require_once "./Modules/Test/classes/class.ilTestScoringGUI.php";
285  $output_gui = new ilTestScoringGUI($this->object);
286  $this->ctrl->forwardCommand($output_gui);
287  break;
288 
289  case 'ilmarkschemagui':
290  if(!$ilAccess->checkAccess('write', '', $this->object->getRefId()))
291  {
292  ilUtil::sendInfo($this->lng->txt('cannot_edit_test'), true);
293  $this->ctrl->redirect($this, 'infoScreen');
294  }
295  $this->prepareOutput();
296  $this->addHeaderAction();
297  require_once 'Modules/Test/classes/class.ilMarkSchemaGUI.php';
298  $mark_schema_gui = new ilMarkSchemaGUI($this->object);
299  $this->ctrl->forwardCommand($mark_schema_gui);
300  break;
301 
302  case 'iltestscoringbyquestionsgui':
303  $this->prepareOutput();
304  $this->addHeaderAction();
305  include_once 'Modules/Test/classes/class.ilTestScoringByQuestionsGUI.php';
306  $output_gui = new ilTestScoringByQuestionsGUI($this->object);
307  $this->ctrl->forwardCommand($output_gui);
308  break;
309 
310  case 'ilobjtestsettingsgeneralgui':
311  $this->prepareOutput();
312  $this->addHeaderAction();
313  require_once 'Modules/Test/classes/class.ilObjTestSettingsGeneralGUI.php';
314  $gui = new ilObjTestSettingsGeneralGUI(
315  $this->ctrl, $ilAccess, $this->lng, $this->tpl, $this->tree, $ilDB, $ilPluginAdmin, $ilUser, $this
316  );
317  $this->ctrl->forwardCommand($gui);
318  break;
319 
320  case 'ilobjtestsettingsscoringresultsgui':
321  $this->prepareOutput();
322  $this->addHeaderAction();
323  require_once 'Modules/Test/classes/class.ilObjTestSettingsScoringResultsGUI.php';
325  $this->ctrl, $ilAccess, $this->lng, $this->tpl, $this->tree, $ilDB, $ilPluginAdmin, $this
326  );
327  $this->ctrl->forwardCommand($gui);
328  break;
329 
330  case 'ilobjtestdynamicquestionsetconfiggui':
331  $this->prepareOutput();
332  $this->addHeaderAction();
333  require_once 'Modules/Test/classes/class.ilObjTestDynamicQuestionSetConfigGUI.php';
334  $gui = new ilObjTestDynamicQuestionSetConfigGUI($this->ctrl, $ilAccess, $ilTabs, $this->lng, $this->tpl, $ilDB, $tree, $ilPluginAdmin, $this->object);
335  $this->ctrl->forwardCommand($gui);
336  break;
337 
338  case 'iltestrandomquestionsetconfiggui':
339  $this->prepareOutput();
340  $this->addHeaderAction();
341  require_once 'Modules/Test/classes/class.ilTestRandomQuestionSetConfigGUI.php';
342  $gui = new ilTestRandomQuestionSetConfigGUI($this->ctrl, $ilAccess, $ilTabs, $this->lng, $this->tpl, $ilDB, $tree, $ilPluginAdmin, $this->object);
343  $this->ctrl->forwardCommand($gui);
344  break;
345 
346  case 'iltestquestionbrowsertablegui':
347  $this->prepareOutput();
348  $this->addHeaderAction();
349  require_once 'Modules/Test/classes/tables/class.ilTestQuestionBrowserTableGUI.php';
350  $gui = new ilTestQuestionBrowserTableGUI($this->ctrl, $this->tpl, $ilTabs, $this->lng, $tree, $ilDB, $ilPluginAdmin, $this->object, $ilAccess);
351  $gui->setWriteAccess($ilAccess->checkAccess("write", "", $this->ref_id));
352  $gui->init();
353  $this->ctrl->forwardCommand($gui);
354  break;
355 
356  case 'iltestskilladministrationgui':
357  $this->prepareOutput();
358  $this->addHeaderAction();
359  require_once 'Modules/Test/classes/class.ilTestSkillAdministrationGUI.php';
360  $gui = new ilTestSkillAdministrationGUI($ilias, $this->ctrl, $ilAccess, $ilTabs, $this->tpl, $this->lng, $ilDB, $tree, $ilPluginAdmin, $this->object, $this->ref_id);
361  $this->ctrl->forwardCommand($gui);
362  break;
363 
364  case 'iltestskillevaluationgui':
365  $this->prepareOutput();
366  $this->addHeaderAction();
367 
368  require_once 'Modules/TestQuestionPool/classes/class.ilAssQuestionList.php';
369  if( $this->object->isDynamicTest() )
370  {
371  require_once 'Modules/Test/classes/class.ilObjTestDynamicQuestionSetConfig.php';
372  $dynamicQuestionSetConfig = new ilObjTestDynamicQuestionSetConfig($tree, $ilDB, $ilPluginAdmin, $this->object);
373  $dynamicQuestionSetConfig->loadFromDb();
374  $questionList = new ilAssQuestionList($ilDB, $this->lng, $ilPluginAdmin);
375  $questionList->setParentObjId($dynamicQuestionSetConfig->getSourceQuestionPoolId());
376  $questionList->setQuestionInstanceTypeFilter(ilAssQuestionList::QUESTION_INSTANCE_TYPE_ORIGINALS);
377  }
378  else
379  {
380  $questionList = new ilAssQuestionList($ilDB, $this->lng, $ilPluginAdmin);
381  $questionList->setParentObjId($this->object->getId());
382  $questionList->setQuestionInstanceTypeFilter(ilAssQuestionList::QUESTION_INSTANCE_TYPE_DUPLICATES);
383  }
384  $questionList->load();
385 
386  require_once 'Modules/Test/classes/class.ilTestSessionFactory.php';
387  $testSessionFactory = new ilTestSessionFactory($this->object);
388  $testSession = $testSessionFactory->getSession();
389  $testResults = $this->object->getTestResult($testSession->getActiveId(), $testSession->getPass(), true);
390 
391  require_once 'Modules/Test/classes/class.ilTestSkillEvaluationGUI.php';
392  $gui = new ilTestSkillEvaluationGUI($this->ctrl, $ilTabs, $this->tpl, $this->lng, $ilDB, $this->object->getTestId(),$this->object->getRefId(), $this->object->getId());
393  $gui->setQuestionList($questionList);
394  $gui->setTestSession($testSession);
395  $gui->setTestResults($testResults);
396  $gui->setObjectiveOrientedContainer($this->getObjectiveOrientedContainer());
397  $this->ctrl->forwardCommand($gui);
398  break;
399 
400  case 'ilobjectcopygui':
401  $this->prepareOutput();
402  $this->addHeaderAction();
403  require_once './Services/Object/classes/class.ilObjectCopyGUI.php';
404  $cp = new ilObjectCopyGUI($this);
405  $cp->setType('tst');
406  $this->ctrl->forwardCommand($cp);
407  break;
408 
409  case 'ilrepositorysearchgui':
410  $this->prepareOutput();
411  $this->addHeaderAction();
412  require_once './Services/Search/classes/class.ilRepositorySearchGUI.php';
413  $rep_search =& new ilRepositorySearchGUI();
414  $rep_search->setCallback($this,
415  'addParticipantsObject',
416  array()
417  );
418 
419  // Set tabs
420  $this->ctrl->setReturn($this, 'participants');
421  $ret =& $this->ctrl->forwardCommand($rep_search);
422  $this->tabs_gui->setTabActive('participants');
423  break;
424 
425  case 'ilpageeditorgui':
426  case 'iltestexpresspageobjectgui':
427 
428  require_once 'Modules/TestQuestionPool/classes/class.ilAssIncompleteQuestionPurger.php';
429  $incompleteQuestionPurger = new ilAssIncompleteQuestionPurger($ilDB);
430  $incompleteQuestionPurger->setOwnerId($ilUser->getId());
431  $incompleteQuestionPurger->purge();
432 
433  $qid = $_REQUEST['q_id'];
434 
435  // :FIXME: does not work
436  // $this->ctrl->saveParameterByClass(array('iltestexpresspageobjectgui', 'assorderingquestiongui', 'ilpageeditorgui', 'ilpcquestion', 'ilpcquestiongui'), 'test_express_mode');
437 
438  if(!$qid || $qid == 'Array')
439  {
440  $questions = $this->object->getQuestionTitlesAndIndexes();
441  if(!is_array($questions))
442  $questions = array();
443 
444  $keys = array_keys($questions);
445  $qid = $keys[0];
446 
447  $_REQUEST['q_id'] = $qid;
448  $_GET['q_id'] = $qid;
449  $_POST['q_id'] = $qid;
450  }
451 
452  $this->prepareOutput();
453  if(!in_array($cmd, array('addQuestion', 'browseForQuestions')))
454  {
455  $this->buildPageViewToolbar($qid);
456  }
457 
458  if(!$qid || in_array($cmd, array('insertQuestions', 'browseForQuestions')))
459  {
460  require_once "./Modules/Test/classes/class.ilTestExpressPageObjectGUI.php";
461  $pageObject = new ilTestExpressPageObjectGUI (0);
462  $pageObject->test_object = $this->object;
463  $ret =& $this->ctrl->forwardCommand($pageObject);
464  break;
465  }
466  require_once "./Services/Style/classes/class.ilObjStyleSheet.php";
467  $this->tpl->setCurrentBlock("ContentStyle");
468  $this->tpl->setVariable("LOCATION_CONTENT_STYLESHEET",
470  $this->tpl->parseCurrentBlock();
471 
472  // syntax style
473  $this->tpl->setCurrentBlock("SyntaxStyle");
474  $this->tpl->setVariable("LOCATION_SYNTAX_STYLESHEET",
476  $this->tpl->parseCurrentBlock();
477  require_once "./Modules/TestQuestionPool/classes/class.assQuestionGUI.php";
478 
479  $q_gui = assQuestionGUI::_getQuestionGUI("", $qid);
480  if(!($q_gui instanceof assQuestionGUI))
481  {
482  $this->ctrl->setParameterByClass('iltestexpresspageobjectgui', 'q_id', '');
483  $this->ctrl->redirectByClass('iltestexpresspageobjectgui', $this->ctrl->getCmd());
484  }
485 
486  $q_gui->outAdditionalOutput();
487  $q_gui->object->setObjId($this->object->getId());
488 
489  $q_gui->setTargetGuiClass(null);
490  $q_gui->setQuestionActionCmd(null);
491 
492  $question = $q_gui->object;
493  $this->ctrl->saveParameter($this, "q_id");
494 
495  #$this->lng->loadLanguageModule("content");
496  $this->ctrl->setReturnByClass("ilTestExpressPageObjectGUI", "view");
497  $this->ctrl->setReturn($this, "questions");
498 
499  require_once "./Modules/TestQuestionPool/classes/class.ilAssQuestionPage.php";
500  require_once "./Modules/Test/classes/class.ilTestExpressPageObjectGUI.php";
501 
502  $page_gui = new ilTestExpressPageObjectGUI($qid);
503  $page_gui->test_object = $this->object;
504  $page_gui->setEditPreview(true);
505  $page_gui->setEnabledTabs(false);
506  if(strlen($this->ctrl->getCmd()) == 0)
507  {
508  $this->ctrl->setCmdClass(get_class($page_gui));
509  $this->ctrl->setCmd("preview");
510  }
511 
512  $page_gui->setQuestionHTML(array($q_gui->object->getId() => $q_gui->getPreview(TRUE)));
513  $page_gui->setTemplateTargetVar("ADM_CONTENT");
514 
515  $page_gui->setOutputMode($this->object->evalTotalPersons() == 0 ? "edit" : 'preview');
516 
517  $page_gui->setHeader($question->getTitle());
518  $page_gui->setFileDownloadLink($this->ctrl->getLinkTarget($this, "downloadFile"));
519  $page_gui->setFullscreenLink($this->ctrl->getLinkTarget($this, "fullscreen"));
520  $page_gui->setSourcecodeDownloadScript($this->ctrl->getLinkTarget($this));
521  $page_gui->setPresentationTitle($question->getTitle() . ' ['. $this->lng->txt('question_id_short') . ': ' . $question->getId() . ']');
522  $ret =& $this->ctrl->forwardCommand($page_gui);
523 
524  global $ilTabs;
525  $ilTabs->activateTab('assQuestions');
526 
527  $this->tpl->setContent($ret);
528  break;
529 
530  case 'ilassquestionpreviewgui':
531 
532  $this->prepareOutput();
533 
534  $this->ctrl->saveParameter($this, "q_id");
535 
536  require_once 'Modules/TestQuestionPool/classes/class.ilAssQuestionPreviewGUI.php';
537  $gui = new ilAssQuestionPreviewGUI($this->ctrl, $this->tabs_gui, $this->tpl, $this->lng, $ilDB, $ilUser);
538 
539  $gui->initQuestion((int)$_GET['q_id'], $this->object->getId());
540  $gui->initPreviewSettings($this->object->getRefId());
541  $gui->initPreviewSession($ilUser->getId(), (int)$_GET['q_id']);
542  $gui->initHintTracking();
543  $gui->initStyleSheets();
544 
545  $this->ctrl->forwardCommand($gui);
546 
547  break;
548 
549  case 'ilassquestionpagegui':
550  require_once "./Modules/TestQuestionPool/classes/class.ilAssQuestionPageGUI.php";
551  //echo $_REQUEST['prev_qid'];
552  if($_REQUEST['prev_qid'])
553  {
554  $this->ctrl->setParameter($this, 'prev_qid', $_REQUEST['prev_qid']);
555  }
556 
557  $this->prepareOutput();
558  //global $___test_express_mode;
559  //$___test_express_mode = true;
560  $_GET['calling_test'] = $this->object->getRefId();
561  include_once("./Services/Style/classes/class.ilObjStyleSheet.php");
562  $this->tpl->setCurrentBlock("ContentStyle");
563  $this->tpl->setVariable("LOCATION_CONTENT_STYLESHEET",
565  $this->tpl->parseCurrentBlock();
566 
567  // syntax style
568  $this->tpl->setCurrentBlock("SyntaxStyle");
569  $this->tpl->setVariable("LOCATION_SYNTAX_STYLESHEET",
571  $this->tpl->parseCurrentBlock();
572  require_once "./Modules/TestQuestionPool/classes/class.assQuestionGUI.php";
573  $q_gui = assQuestionGUI::_getQuestionGUI("", $_GET["q_id"]);
574  $q_gui->setQuestionTabs();
575  $q_gui->outAdditionalOutput();
576  $q_gui->object->setObjId($this->object->getId());
577  $question =& $q_gui->object;
578  $this->ctrl->saveParameter($this, "q_id");
579  $this->lng->loadLanguageModule("content");
580  $this->ctrl->setReturnByClass("ilAssQuestionPageGUI", "view");
581  $this->ctrl->setReturn($this, "questions");
582  $page_gui = new ilAssQuestionPageGUI($_GET["q_id"]);
583  $page_gui->setEditPreview(true);
584  if(strlen($this->ctrl->getCmd()) == 0)
585  {
586  $this->ctrl->setCmdClass(get_class($page_gui));
587  $this->ctrl->setCmd("preview");
588  }
589  $page_gui->setQuestionHTML(array($q_gui->object->getId() => $q_gui->getPreview(TRUE)));
590  $page_gui->setTemplateTargetVar("ADM_CONTENT");
591  $page_gui->setOutputMode($this->object->evalTotalPersons() == 0 ? "edit" : 'preview');
592  $page_gui->setHeader($question->getTitle());
593  $page_gui->setPresentationTitle($question->getTitle() . ' ['. $this->lng->txt('question_id_short') . ': ' . $question->getId() . ']');
594  $ret =& $this->ctrl->forwardCommand($page_gui);
595  $this->tpl->setContent($ret);
596  break;
597 
598  case 'ilassspecfeedbackpagegui':
599  require_once "./Modules/TestQuestionPool/classes/feedback/class.ilAssSpecFeedbackPageGUI.php";
600  $pg_gui = new ilAssSpecFeedbackPageGUI((int) $_GET["feedback_id"]);
601  $this->ctrl->forwardCommand($pg_gui);
602  break;
603 
604  case 'ilassgenfeedbackpagegui':
605  require_once "./Modules/TestQuestionPool/classes/feedback/class.ilAssGenFeedbackPageGUI.php";
606  $pg_gui = new ilAssGenFeedbackPageGUI((int) $_GET["feedback_id"]);
607  $this->ctrl->forwardCommand($pg_gui);
608  break;
609 
610  case 'illocalunitconfigurationgui':
611  $this->prepareSubGuiOutput();
612 
613  // set return target
614  $this->ctrl->setReturn($this, "questions");
615 
616  // set context tabs
617  require_once 'Modules/TestQuestionPool/classes/class.assQuestionGUI.php';
618  $questionGUI = assQuestionGUI::_getQuestionGUI('', $_GET['q_id']);
619  $questionGUI->object->setObjId($this->object->getId());
620  $questionGUI->setQuestionTabs();
621 
622  require_once 'Modules/TestQuestionPool/classes/class.ilLocalUnitConfigurationGUI.php';
623  require_once 'Modules/TestQuestionPool/classes/class.ilUnitConfigurationRepository.php';
624  $gui = new ilLocalUnitConfigurationGUI(
625  new ilUnitConfigurationRepository((int)$_GET['q_id'])
626  );
627  $this->ctrl->forwardCommand($gui);
628  break;
629 
630  case "ilcommonactiondispatchergui":
631  require_once "Services/Object/classes/class.ilCommonActionDispatcherGUI.php";
633  $this->ctrl->forwardCommand($gui);
634  break;
635 
636  case 'ilassquestionhintsgui':
637 
638  $this->prepareSubGuiOutput();
639 
640  // set return target
641  $this->ctrl->setReturn($this, "questions");
642 
643  // set context tabs
644  require_once 'Modules/TestQuestionPool/classes/class.assQuestionGUI.php';
645  $questionGUI =& assQuestionGUI::_getQuestionGUI($q_type, $_GET['q_id']);
646  $questionGUI->object->setObjId($this->object->getId());
647  $questionGUI->setQuestionTabs();
648 
649  // forward to ilAssQuestionHintsGUI
650  require_once 'Modules/TestQuestionPool/classes/class.ilAssQuestionHintsGUI.php';
651  $gui = new ilAssQuestionHintsGUI($questionGUI);
652  $ilCtrl->forwardCommand($gui);
653 
654  break;
655 
656  case 'ilassquestionfeedbackeditinggui':
657 
658  $this->prepareSubGuiOutput();
659 
660  // set return target
661  $this->ctrl->setReturn($this, "questions");
662 
663  // set context tabs
664  require_once 'Modules/TestQuestionPool/classes/class.assQuestionGUI.php';
665  $questionGUI = assQuestionGUI::_getQuestionGUI('', $_GET['q_id']);
666  $questionGUI->object->setObjId($this->object->getId());
667  $questionGUI->setQuestionTabs();
668 
669  // forward to ilAssQuestionFeedbackGUI
670  require_once 'Modules/TestQuestionPool/classes/class.ilAssQuestionFeedbackEditingGUI.php';
671  $gui = new ilAssQuestionFeedbackEditingGUI($questionGUI, $ilCtrl, $ilAccess, $tpl, $ilTabs, $lng);
672  $ilCtrl->forwardCommand($gui);
673 
674  break;
675 
676  case 'iltesttoplistgui':
677  $this->prepareOutput();
678  require_once './Modules/Test/classes/class.ilTestToplistGUI.php';
679  $gui = new ilTestToplistGUI($this);
680  $this->ctrl->forwardCommand($gui);
681  break;
682 
683  case 'ilscoringadjustmentgui':
684  $this->prepareOutput();
685  require_once './Modules/Test/classes/class.ilScoringAdjustmentGUI.php';
686  $gui = new ilScoringAdjustmentGUI($this->object);
687  $this->ctrl->forwardCommand($gui);
688  break;
689 
690  case '':
691  case 'ilobjtestgui':
692  $this->prepareOutput();
693  $this->addHeaderAction();
694  if((strcmp($cmd, "properties") == 0) && ($_GET["browse"]))
695  {
696  $this->questionBrowser();
697  return;
698  }
699  if((strcmp($cmd, "properties") == 0) && ($_GET["up"] || $_GET["down"]))
700  {
701  $this->questionsObject();
702  return;
703  }
704  $cmd .= "Object";
705  $ret =& $this->$cmd();
706  break;
707  default:
708  // elba hack for storing question id for inserting new question after
709  if($_REQUEST['prev_qid'])
710  {
711  global $___prev_question_id;
712  $___prev_question_id = $_REQUEST['prev_qid'];
713  $this->ctrl->setParameterByClass('ilassquestionpagegui', 'prev_qid', $_REQUEST['prev_qid']);
714  $this->ctrl->setParameterByClass($_GET['sel_question_types'] . 'gui', 'prev_qid', $_REQUEST['prev_qid']);
715  }
716  $this->create_question_mode = true;
717  $this->prepareOutput();
718 
719  $this->ctrl->setReturn($this, "questions");
720  require_once "./Modules/TestQuestionPool/classes/class.assQuestionGUI.php";
721  $q_gui =& assQuestionGUI::_getQuestionGUI($_GET['sel_question_types'], $_GET["q_id"]);
722  $q_gui->object->setObjId($this->object->getId());
723  if(!$_GET['sel_question_types'])
724  $qType = assQuestion::getQuestionTypeFromDb($_GET['q_id']);
725  else
726  {
727  $qType = $_GET['sel_question_types'];
728  }
729  $this->ctrl->setParameterByClass($qType . "GUI", 'prev_qid', $_REQUEST['prev_qid']);
730  $this->ctrl->setParameterByClass($qType . "GUI", 'test_ref_id', $_REQUEST['ref_id']);
731  $this->ctrl->setParameterByClass($qType . "GUI", 'q_id', $_REQUEST['q_id']);
732  if($_REQUEST['test_express_mode'])
733  $this->ctrl->setParameterByClass($qType . "GUI", 'test_express_mode', 1);
734 
735  #global $___test_express_mode;
736  #$___test_express_mode = true;
737  if(!$q_gui->isSaveCommand())
738  $_GET['calling_test'] = $this->object->getRefId();
739 
740  $q_gui->setQuestionTabs();
741  #unset($___test_express_mode);
742  $ret =& $this->ctrl->forwardCommand($q_gui);
743  break;
744  }
745  if ( !in_array(strtolower($_GET["baseClass"]), array('iladministrationgui', 'ilrepositorygui')) &&
746  $this->getCreationMode() != true)
747  {
748  $this->tpl->show();
749  }
750  }
751 
752  protected function trackTestObjectReadEvent()
753  {
754  $ilUser = isset($GLOBALS['DIC']) ? $GLOBALS['DIC']['ilUser'] : $GLOBALS['ilUser'];
755  require_once 'Services/Tracking/classes/class.ilChangeEvent.php';
756 
758  $this->object->getType(), $this->object->getRefId(),
759  $this->object->getId(), $ilUser->getId()
760  );
761  }
762 
767  protected function exportObject()
768  {
769  global $DIC; /* @var ILIAS\DI\Container $DIC */
770  $DIC->ctrl()->redirectByClass('ilTestExportGUI');
771  }
772 
773  private function questionsTabGatewayObject()
774  {
775  switch( $this->object->getQuestionSetType() )
776  {
778  $this->ctrl->redirectByClass('ilTestExpressPageObjectGUI', 'showPage');
779 
781  $this->ctrl->redirectByClass('ilTestRandomQuestionSetConfigGUI');
782 
784  $this->ctrl->redirectByClass('ilObjTestDynamicQuestionSetConfigGUI');
785  }
786  }
787 
788  private function userResultsGatewayObject()
789  {
790  $this->ctrl->setCmdClass('ilTestEvaluationGUI');
791  $this->ctrl->setCmd('outUserResultsOverview');
792  $this->tabs_gui->clearTargets();
793 
794  $this->forwardToEvaluationGUI();
795  }
796 
797  private function forwardToEvaluationGUI()
798  {
799  $this->prepareOutput();
800  $this->addHeaderAction();
801 
802  require_once 'Modules/Test/classes/class.ilTestEvaluationGUI.php';
803  $gui = new ilTestEvaluationGUI($this->object);
804  $gui->setObjectiveOrientedContainer($this->getObjectiveOrientedContainer());
805 
806  $this->ctrl->forwardCommand($gui);
807  }
808 
810  {
811  $this->prepareOutput();
812  $this->addHeaderAction();
813 
814  require_once 'Modules/Test/classes/class.ilTestEvalObjectiveOrientedGUI.php';
815  $gui = new ilTestEvalObjectiveOrientedGUI($this->object);
816  $gui->setObjectiveOrientedContainer($this->getObjectiveOrientedContainer());
817 
818  $this->ctrl->forwardCommand($gui);
819  }
820 
829  public function createUserResults($show_pass_details, $show_answers, $show_reached_points, $show_user_results)
830  {
831  global $ilTabs, $ilDB;
832 
833  $ilTabs->setBackTarget(
834  $this->lng->txt('back'), $this->ctrl->getLinkTarget($this, 'participants')
835  );
836 
837  if( $this->getObjectiveOrientedContainer()->isObjectiveOrientedPresentationRequired() )
838  {
839  require_once 'Services/Link/classes/class.ilLink.php';
840  $courseLink = ilLink::_getLink($this->getObjectiveOrientedContainer()->getRefId());
841  $ilTabs->setBack2Target($this->lng->txt('back_to_objective_container'), $courseLink);
842  }
843 
844  $template = new ilTemplate("tpl.il_as_tst_participants_result_output.html", TRUE, TRUE, "Modules/Test");
845 
846  require_once 'Modules/Test/classes/toolbars/class.ilTestResultsToolbarGUI.php';
847  $toolbar = new ilTestResultsToolbarGUI($this->ctrl, $this->tpl, $this->lng);
848 
849  $this->ctrl->setParameter($this, 'pdf', '1');
850  $toolbar->setPdfExportLinkTarget( $this->ctrl->getLinkTarget($this, $this->ctrl->getCmd()) );
851  $this->ctrl->setParameter($this, 'pdf', '');
852 
853  if( $show_answers )
854  {
855  if( isset($_GET['show_best_solutions']) )
856  {
857  $_SESSION['tst_results_show_best_solutions'] = true;
858  }
859  elseif( isset($_GET['hide_best_solutions']) )
860  {
861  $_SESSION['tst_results_show_best_solutions'] = false;
862  }
863  elseif( !isset($_SESSION['tst_results_show_best_solutions']) )
864  {
865  $_SESSION['tst_results_show_best_solutions'] = false;
866  }
867 
868  if( $_SESSION['tst_results_show_best_solutions'] )
869  {
870  $this->ctrl->setParameter($this, 'hide_best_solutions', '1');
871  $toolbar->setHideBestSolutionsLinkTarget($this->ctrl->getLinkTarget($this, $this->ctrl->getCmd()));
872  $this->ctrl->setParameter($this, 'hide_best_solutions', '');
873  }
874  else
875  {
876  $this->ctrl->setParameter($this, 'show_best_solutions', '1');
877  $toolbar->setShowBestSolutionsLinkTarget($this->ctrl->getLinkTarget($this, $this->ctrl->getCmd()));
878  $this->ctrl->setParameterByClass('', 'show_best_solutions', '');
879  }
880  }
881 
882  require_once 'Modules/Test/classes/class.ilTestParticipantData.php';
883  $participantData = new ilTestParticipantData($ilDB, $this->lng);
884  if( $this->object->getFixedParticipants() )
885  {
886  $participantData->setUserIds($show_user_results);
887  }
888  else
889  {
890  $participantData->setActiveIds($show_user_results);
891  }
892  $participantData->load($this->object->getTestId());
893  $toolbar->setParticipantSelectorOptions($participantData->getOptionArray($show_user_results));
894 
895  $toolbar->build();
896  $template->setVariable('RESULTS_TOOLBAR', $this->ctrl->getHTML($toolbar));
897 
898  include_once "./Modules/Test/classes/class.ilTestServiceGUI.php";
899  $serviceGUI = new ilTestServiceGUI($this->object);
900  $serviceGUI->setObjectiveOrientedContainer($this->getObjectiveOrientedContainer());
901  $serviceGUI->setParticipantData($participantData);
902 
903  $count = 0;
904  foreach ($show_user_results as $key => $active_id)
905  {
906  $count++;
907  $results = "";
908  if ($this->object->getFixedParticipants())
909  {
910  $active_id = $this->object->getActiveIdOfUser( $active_id );
911  }
912  if ($active_id > 0)
913  {
914  $results = $serviceGUI->getResultsOfUserOutput(
915  $this->testSessionFactory->getSession( $active_id ),
916  $active_id,
917  $this->object->_getResultPass( $active_id ),
918  $this,
919  $show_pass_details,
920  $show_answers,
921  FALSE,
922  $show_reached_points
923  );
924  }
925  if ($count < count( $show_user_results ))
926  {
927  $template->touchBlock( "break" );
928  }
929  $template->setCurrentBlock( "user_result" );
930  $template->setVariable( "USER_RESULT", $results );
931  $template->parseCurrentBlock();
932  }
933 
934  if( $this->isPdfDeliveryRequest() )
935  {
936  require_once 'class.ilTestPDFGenerator.php';
937 
939  $template->get(), ilTestPDFGenerator::PDF_OUTPUT_DOWNLOAD, $this->object->getTitle()
940  );
941  }
942  else
943  {
944  return $template;
945  }
946  }
947 
949  {
950  require_once 'Modules/Test/classes/class.ilObjTestSettingsGeneralGUI.php';
951  $this->ctrl->redirectByClass('ilObjTestSettingsGeneralGUI', ilObjTestSettingsGeneralGUI::CMD_SHOW_FORM);
952  }
953 
962  private function prepareSubGuiOutput()
963  {
964  global $ilUser;
965 
966  $this->tpl->getStandardTemplate();
967 
968  // set locator
969  $this->setLocator();
970 
971  // catch feedback message
973 
974  // set title and description and title icon
975  $this->setTitleAndDescription();
976 
977  // BEGIN WebDAV: Display Mount Webfolder icon.
978  require_once 'Services/WebDAV/classes/class.ilDAVServer.php';
979  if (ilDAVServer::_isActive() && $ilUser->getId() != ANONYMOUS_USER_ID)
980  {
981  $this->showMountWebfolderIcon();
982  }
983  // END WebDAV: Display Mount Webfolder icon.
984  }
985 
986  function runObject()
987  {
988  $this->ctrl->redirect($this, "infoScreen");
989  }
990 
992  {
993  $this->ctrl->redirectByClass("iltestevaluationgui", "outEvaluation");
994  }
995 
999  function importFileObject()
1000  {
1001  $form = $this->initImportForm($_REQUEST["new_type"]);
1002  if($form->checkInput())
1003  {
1004  $this->ctrl->setParameter($this, "new_type", $this->type);
1005  $this->uploadTstObject();
1006  }
1007 
1008  // display form to correct errors
1009  $form->setValuesByPost();
1010  $this->tpl->setContent($form->getHTML());
1011  }
1012 
1013  function addDidacticTemplateOptions(array &$a_options)
1014  {
1015  include_once("./Modules/Test/classes/class.ilObjTest.php");
1016  $tst = new ilObjTest();
1017  $defaults = $tst->getAvailableDefaults();
1018  if (count($defaults))
1019  {
1020  foreach ($defaults as $row)
1021  {
1022  $a_options["tstdef_".$row["test_defaults_id"]] = array($row["name"],
1023  $this->lng->txt("tst_default_settings"));
1024  }
1025  }
1026 
1027  // using template?
1028  include_once "Services/Administration/classes/class.ilSettingsTemplate.php";
1029  $templates = ilSettingsTemplate::getAllSettingsTemplates("tst");
1030  if($templates)
1031  {
1032  foreach($templates as $item)
1033  {
1034  $a_options["tsttpl_".$item["id"]] = array($item["title"],
1035  nl2br(trim($item["description"])));
1036  }
1037  }
1038  }
1039 
1044  function afterSave(ilObject $a_new_object)
1045  {
1046  $tstdef = $this->getDidacticTemplateVar("tstdef");
1047  if ($tstdef)
1048  {
1049  $testDefaultsId = $tstdef;
1050  $testDefaults = ilObjTest::_getTestDefaults($testDefaultsId);
1051  $a_new_object->applyDefaults($testDefaults);
1052  }
1053 
1054  $template_id = $this->getDidacticTemplateVar("tsttpl");
1055  if($template_id)
1056  {
1057  include_once "Services/Administration/classes/class.ilSettingsTemplate.php";
1059 
1060  $template_settings = $template->getSettings();
1061  if($template_settings)
1062  {
1063  $this->applyTemplate($template_settings, $a_new_object);
1064  }
1065 
1066  $a_new_object->setTemplate($template_id);
1067  }
1068 
1069  $a_new_object->saveToDb();
1070 
1071  // always send a message
1072  ilUtil::sendSuccess($this->lng->txt("object_added"),true);
1073  $this->ctrl->setParameter($this, 'ref_id', $a_new_object->getRefId());
1074  $this->ctrl->redirectByClass('ilObjTestSettingsGeneralGUI');
1075  }
1076 
1078  {
1079  include_once "./Services/Utilities/classes/class.ilUtil.php";
1080  $path = $this->tree->getPathFull($this->object->getRefID());
1081  ilUtil::redirect($this->getReturnLocation("cancel","./ilias.php?baseClass=ilRepositoryGUI&cmd=frameset&ref_id=" . $path[count($path) - 2]["child"]));
1082  }
1083 
1087  function uploadTstObject()
1088  {
1089  if ($_FILES["xmldoc"]["error"] > UPLOAD_ERR_OK)
1090  {
1091  ilUtil::sendFailure($this->lng->txt("error_upload"));
1092  $this->createObject();
1093  return;
1094  }
1095  include_once("./Modules/Test/classes/class.ilObjTest.php");
1096  // create import directory
1097  $basedir = ilObjTest::_createImportDirectory();
1098 
1099  // copy uploaded file to import directory
1100  $file = pathinfo($_FILES["xmldoc"]["name"]);
1101  $full_path = $basedir."/".$_FILES["xmldoc"]["name"];
1102  ilUtil::moveUploadedFile($_FILES["xmldoc"]["tmp_name"], $_FILES["xmldoc"]["name"], $full_path);
1103 
1104  // unzip file
1105  ilUtil::unzip($full_path);
1106 
1107  // determine filenames of xml files
1108  $subdir = basename($file["basename"],".".$file["extension"]);
1110  $xml_file = ilObjTest::_getImportDirectory().'/'.$subdir.'/'.$subdir.".xml";
1111  $qti_file = ilObjTest::_getImportDirectory().'/'.$subdir.'/'. preg_replace("/test|tst/", "qti", $subdir).".xml";
1112  $results_file = ilObjTest::_getImportDirectory().'/'.$subdir.'/'. preg_replace("/test|tst/", "results", $subdir).".xml";
1113 
1114  if(!is_file($qti_file))
1115  {
1116  ilUtil::delDir($basedir);
1117  ilUtil::sendFailure($this->lng->txt("tst_import_non_ilias_zip"));
1118  $this->createObject();
1119  return;
1120  }
1121 
1122  // start verification of QTI files
1123  include_once "./Services/QTI/classes/class.ilQTIParser.php";
1124  $qtiParser = new ilQTIParser($qti_file, IL_MO_VERIFY_QTI, 0, "");
1125  $result = $qtiParser->startParsing();
1126  $founditems =& $qtiParser->getFoundItems();
1127 
1128  if (count($founditems) == 0)
1129  {
1130  // nothing found
1131 
1132  // delete import directory
1133  ilUtil::delDir($basedir);
1134 
1135  ilUtil::sendInfo($this->lng->txt("tst_import_no_items"));
1136  $this->createObject();
1137  return;
1138  }
1139 
1140  $complete = 0;
1141  $incomplete = 0;
1142  foreach ($founditems as $item)
1143  {
1144  if (strlen($item["type"]))
1145  {
1146  $complete++;
1147  }
1148  else
1149  {
1150  $incomplete++;
1151  }
1152  }
1153 
1154  if ($complete == 0)
1155  {
1156  // delete import directory
1157  ilUtil::delDir($basedir);
1158 
1159  ilUtil::sendInfo($this->lng->txt("qpl_import_non_ilias_files"));
1160  $this->createObject();
1161  return;
1162  }
1163 
1164  $_SESSION["tst_import_results_file"] = $results_file;
1165  $_SESSION["tst_import_xml_file"] = $xml_file;
1166  $_SESSION["tst_import_qti_file"] = $qti_file;
1167  $_SESSION["tst_import_subdir"] = $subdir;
1168  // display of found questions
1169  $this->tpl->addBlockFile("ADM_CONTENT", "adm_content", "tpl.tst_import_verification.html", "Modules/Test");
1170  $row_class = array("tblrow1", "tblrow2");
1171  $counter = 0;
1172  foreach ($founditems as $item)
1173  {
1174  $this->tpl->setCurrentBlock("verification_row");
1175  $this->tpl->setVariable("ROW_CLASS", $row_class[$counter++ % 2]);
1176  $this->tpl->setVariable("QUESTION_TITLE", $item["title"]);
1177  $this->tpl->setVariable("QUESTION_IDENT", $item["ident"]);
1178  include_once "./Services/QTI/classes/class.ilQTIItem.php";
1179  switch ($item["type"])
1180  {
1182  case QT_MULTIPLE_CHOICE_MR:
1183  $this->tpl->setVariable("QUESTION_TYPE", $this->lng->txt("assMultipleChoice"));
1184  break;
1186  case QT_MULTIPLE_CHOICE_SR:
1187  $this->tpl->setVariable("QUESTION_TYPE", $this->lng->txt("assSingleChoice"));
1188  break;
1190  case QT_KPRIM_CHOICE:
1191  $this->tpl->setVariable("QUESTION_TYPE", $this->lng->txt("assKprimChoice"));
1192  break;
1194  case QT_LONG_MENU:
1195  $this->tpl->setVariable("QUESTION_TYPE", $this->lng->txt("assLongMenu"));
1196  break;
1198  case QT_NUMERIC:
1199  $this->tpl->setVariable("QUESTION_TYPE", $this->lng->txt("assNumeric"));
1200  break;
1202  case QT_FORMULA:
1203  $this->tpl->setVariable("QUESTION_TYPE", $this->lng->txt("assFormulaQuestion"));
1204  break;
1206  case QT_TEXTSUBSET:
1207  $this->tpl->setVariable("QUESTION_TYPE", $this->lng->txt("assTextSubset"));
1208  break;
1209  case CLOZE_TEST_IDENTIFIER:
1210  case QT_CLOZE:
1211  $this->tpl->setVariable("QUESTION_TYPE", $this->lng->txt("assClozeTest"));
1212  break;
1213  case ERROR_TEXT_IDENTIFIER:
1214  case QT_ERRORTEXT:
1215  $this->tpl->setVariable("QUESTION_TYPE", $this->lng->txt("assErrorText"));
1216  break;
1218  case QT_IMAGEMAP:
1219  $this->tpl->setVariable("QUESTION_TYPE", $this->lng->txt("assImagemapQuestion"));
1220  break;
1222  case QT_JAVAAPPLET:
1223  $this->tpl->setVariable("QUESTION_TYPE", $this->lng->txt("assJavaApplet"));
1224  break;
1226  case QT_FLASHAPPLET:
1227  $this->tpl->setVariable("QUESTION_TYPE", $this->lng->txt("assFlashApplet"));
1228  break;
1230  case QT_MATCHING:
1231  $this->tpl->setVariable("QUESTION_TYPE", $this->lng->txt("assMatchingQuestion"));
1232  break;
1234  case QT_ORDERING:
1235  $this->tpl->setVariable("QUESTION_TYPE", $this->lng->txt("assOrderingQuestion"));
1236  break;
1239  $this->tpl->setVariable("QUESTION_TYPE", $this->lng->txt("assOrderingHorizontal"));
1240  break;
1242  case QT_TEXT:
1243  $this->tpl->setVariable("QUESTION_TYPE", $this->lng->txt("assTextQuestion"));
1244  break;
1246  case QT_FILEUPLOAD:
1247  $this->tpl->setVariable("QUESTION_TYPE", $this->lng->txt("assFileUpload"));
1248  break;
1249  }
1250  $this->tpl->parseCurrentBlock();
1251  }
1252 
1253  // on import creation screen the pool was chosen (-1 for no pool)
1254  // BUT when no pool is available the input on creation screen is missing, so the field value -1 for no pool is not submitted.
1255  $QplOrTstID = isset($_POST["qpl"]) && (int)$_POST["qpl"] != 0 ? $_POST["qpl"] : -1;
1256 
1257  $this->tpl->setCurrentBlock("adm_content");
1258  $this->tpl->setVariable("TEXT_TYPE", $this->lng->txt("question_type"));
1259  $this->tpl->setVariable("TEXT_TITLE", $this->lng->txt("question_title"));
1260  $this->tpl->setVariable("FOUND_QUESTIONS_INTRODUCTION", $this->lng->txt("tst_import_verify_found_questions"));
1261  $this->tpl->setVariable("VERIFICATION_HEADING", $this->lng->txt("import_tst"));
1262  $this->tpl->setVariable("FORMACTION", $this->ctrl->getFormAction($this));
1263  $this->tpl->setVariable("ARROW", ilUtil::getImagePath("arrow_downright.svg"));
1264  $this->tpl->setVariable("QUESTIONPOOL_ID", $QplOrTstID);
1265  $this->tpl->setVariable("VALUE_IMPORT", $this->lng->txt("import"));
1266  $this->tpl->setVariable("VALUE_CANCEL", $this->lng->txt("cancel"));
1267  $this->tpl->parseCurrentBlock();
1268  }
1269 
1274  {
1275  include_once "./Modules/Test/classes/class.ilObjTest.php";
1276  // create new questionpool object
1277  $newObj = new ilObjTest(0, true);
1278  // set type of questionpool object
1279  $newObj->setType($_GET["new_type"]);
1280  // set title of questionpool object to "dummy"
1281  $newObj->setTitle("dummy");
1282  // set description of questionpool object
1283  $newObj->setDescription("test import");
1284  // create the questionpool class in the ILIAS database (object_data table)
1285  $newObj->create(true);
1286  // create a reference for the questionpool object in the ILIAS database (object_reference table)
1287  $newObj->createReference();
1288  // put the questionpool object in the administration tree
1289  $newObj->putInTree($_GET["ref_id"]);
1290  // get default permissions and set the permissions for the questionpool object
1291  $newObj->setPermissions($_GET["ref_id"]);
1292  // notify the questionpool object and all its parent objects that a "new" object was created
1293  $newObj->notify("new",$_GET["ref_id"],$_GET["parent_non_rbac_id"],$_GET["ref_id"],$newObj->getRefId());
1294  // empty mark schema
1295  $newObj->mark_schema->flush();
1296 
1297  // start parsing of QTI files
1298  include_once "./Services/QTI/classes/class.ilQTIParser.php";
1299 
1300  // Handle selection of "no questionpool" as qpl_id = -1 -> use test object id instead.
1301  if (!isset($_POST["qpl"]) || "-1" === (string)$_POST["qpl"])
1302  {
1303  $qpl_id = $newObj->getId();
1304  }
1305  else
1306  {
1307  $qpl_id = $_POST["qpl"];
1308  }
1309 
1310  $qtiParser = new ilQTIParser($_SESSION["tst_import_qti_file"], IL_MO_PARSE_QTI, $qpl_id, $_POST["ident"]);
1311  if( !isset($_POST["ident"]) || !is_array($_POST["ident"]) || !count($_POST["ident"]) )
1312  {
1313  $qtiParser->setIgnoreItemsEnabled(true);
1314  }
1315  $qtiParser->setTestObject($newObj);
1316  $result = $qtiParser->startParsing();
1317  $newObj->saveToDb();
1318 
1319  // import page data
1320  include_once ("./Modules/LearningModule/classes/class.ilContObjParser.php");
1321  $contParser = new ilContObjParser($newObj, $_SESSION["tst_import_xml_file"], $_SESSION["tst_import_subdir"]);
1322  $contParser->setQuestionMapping($qtiParser->getImportMapping());
1323  $contParser->startParsing();
1324 
1325  if( isset($_POST["ident"]) && is_array($_POST["ident"]) && count($_POST["ident"]) == $qtiParser->getFoundItems() )
1326  {
1327  // import test results
1328  if (@file_exists($_SESSION["tst_import_results_file"]))
1329  {
1330  include_once ("./Modules/Test/classes/class.ilTestResultsImportParser.php");
1331  $results = new ilTestResultsImportParser($_SESSION["tst_import_results_file"], $newObj);
1332  $results->startParsing();
1333  }
1334  }
1335 
1336  // delete import directory
1338  ilUtil::sendSuccess($this->lng->txt("object_imported"),true);
1339 
1340  $newObj->updateMetaData();
1341 
1342  ilUtil::redirect("ilias.php?ref_id=".$newObj->getRefId().
1343  "&baseClass=ilObjTestGUI");
1344  }
1345 
1352  function uploadObject($redirect = true)
1353  {
1354  $this->uploadTstObject();
1355  }
1356 
1361  {
1362  $file = explode("_", $_GET["file_id"]);
1363  include_once("./Modules/File/classes/class.ilObjFile.php");
1364  $fileObj =& new ilObjFile($file[count($file) - 1], false);
1365  $fileObj->sendFile();
1366  exit;
1367  }
1368 
1372  function fullscreenObject()
1373  {
1374  include_once("./Modules/TestQuestionPool/classes/class.ilAssQuestionPageGUI.php");
1375  $page_gui = new ilAssQuestionPageGUI($_GET["pg_id"]);
1376  $page_gui->showMediaFullscreen();
1377 
1378  }
1379 
1384  {
1385  include_once("./Modules/TestQuestionPool/classes/class.ilAssQuestionPage.php");
1386  $pg_obj = new ilAssQuestionPage($_GET["pg_id"]);
1387  $pg_obj->send_paragraph ($_GET["par_id"], $_GET["downloadtitle"]);
1388  exit;
1389  }
1390 
1398  function filterObject()
1399  {
1400  $this->questionBrowser();
1401  }
1402 
1411  {
1412  $this->questionBrowser();
1413  }
1414 
1422  function backObject()
1423  {
1424  $this->ctrl->redirect($this, "questions");
1425  }
1426 
1435  function createQuestionPool($name = "dummy", $description = "")
1436  {
1437  global $tree;
1438  $parent_ref = $tree->getParentId($this->object->getRefId());
1439  include_once "./Modules/TestQuestionPool/classes/class.ilObjQuestionPool.php";
1440  $qpl = new ilObjQuestionPool();
1441  $qpl->setType("qpl");
1442  $qpl->setTitle($name);
1443  $qpl->setDescription($description);
1444  $qpl->create();
1445  $qpl->createReference();
1446  $qpl->putInTree($parent_ref);
1447  $qpl->setPermissions($parent_ref);
1448  $qpl->setOnline(1); // must be online to be available
1449  $qpl->saveToDb();
1450  return $qpl->getRefId();
1451  }
1452 
1456  public function randomselectObject()
1457  {
1458  global $ilUser;
1459  $this->getQuestionsSubTabs();
1460  $this->tpl->addBlockFile("ADM_CONTENT", "adm_content", "tpl.il_as_tst_random_select.html", "Modules/Test");
1461  $questionpools =& $this->object->getAvailableQuestionpools(FALSE, FALSE, FALSE, TRUE);
1462  $this->tpl->setCurrentBlock("option");
1463  $this->tpl->setVariable("VALUE_OPTION", "0");
1464  $this->tpl->setVariable("TEXT_OPTION", $this->lng->txt("all_available_question_pools"));
1465  $this->tpl->parseCurrentBlock();
1466  foreach ($questionpools as $key => $value)
1467  {
1468  $this->tpl->setCurrentBlock("option");
1469  $this->tpl->setVariable("VALUE_OPTION", $key);
1470  $this->tpl->setVariable("TEXT_OPTION", $value["title"]);
1471  $this->tpl->parseCurrentBlock();
1472  }
1473  $this->tpl->setCurrentBlock("hidden");
1474  $this->tpl->setVariable("HIDDEN_NAME", "sel_question_types");
1475  $this->tpl->setVariable("HIDDEN_VALUE", $_POST["sel_question_types"]);
1476  $this->tpl->parseCurrentBlock();
1477  $this->tpl->setCurrentBlock("adm_content");
1478  $this->tpl->setVariable("FORM_ACTION", $this->ctrl->getFormAction($this));
1479  $this->tpl->setVariable("TXT_QPL_SELECT", $this->lng->txt("tst_random_select_questionpool"));
1480  $this->tpl->setVariable("TXT_NR_OF_QUESTIONS", $this->lng->txt("tst_random_nr_of_questions"));
1481  $this->tpl->setVariable("BTN_SUBMIT", $this->lng->txt("submit"));
1482  $this->tpl->setVariable("BTN_CANCEL", $this->lng->txt("cancel"));
1483  $this->tpl->parseCurrentBlock();
1484  }
1485 
1494  {
1495  $this->ctrl->redirect($this, "questions");
1496  }
1497 
1506  {
1507  $this->getQuestionsSubTabs();
1508  $question_array = $this->object->randomSelectQuestions($_POST["nr_of_questions"], $_POST["sel_qpl"]);
1509  $this->tpl->addBlockFile("ADM_CONTENT", "adm_content", "tpl.il_as_tst_random_question_offer.html", "Modules/Test");
1510  $color_class = array("tblrow1", "tblrow2");
1511  $counter = 0;
1512  $questionpools =& $this->object->getAvailableQuestionpools(true);
1513  include_once "./Modules/TestQuestionPool/classes/class.assQuestion.php";
1514  foreach ($question_array as $question_id)
1515  {
1516  $dataset = $this->object->getQuestionDataset($question_id);
1517  $this->tpl->setCurrentBlock("QTab");
1518  $this->tpl->setVariable("COLOR_CLASS", $color_class[$counter % 2]);
1519  $this->tpl->setVariable("QUESTION_TITLE", $dataset->title);
1520  $this->tpl->setVariable("QUESTION_COMMENT", $dataset->description);
1521  $this->tpl->setVariable("QUESTION_TYPE", assQuestion::_getQuestionTypeName($dataset->type_tag));
1522  $this->tpl->setVariable("QUESTION_AUTHOR", $dataset->author);
1523  $this->tpl->setVariable("QUESTION_POOL", $questionpools[$dataset->obj_fi]["title"]);
1524  $this->tpl->parseCurrentBlock();
1525  $counter++;
1526  }
1527  if (count($question_array) == 0)
1528  {
1529  $this->tpl->setCurrentBlock("Emptytable");
1530  $this->tpl->setVariable("TEXT_NO_QUESTIONS_AVAILABLE", $this->lng->txt("no_questions_available"));
1531  $this->tpl->parseCurrentBlock();
1532  }
1533  else
1534  {
1535  $this->tpl->setCurrentBlock("Selectionbuttons");
1536  $this->tpl->setVariable("BTN_YES", $this->lng->txt("random_accept_sample"));
1537  $this->tpl->setVariable("BTN_NO", $this->lng->txt("random_another_sample"));
1538  $this->tpl->parseCurrentBlock();
1539  }
1540  $chosen_questions = join($question_array, ",");
1541  $this->tpl->setCurrentBlock("adm_content");
1542  $this->tpl->setVariable("FORM_ACTION", $this->ctrl->getFormAction($this));
1543  $this->tpl->setVariable("QUESTION_TITLE", $this->lng->txt("tst_question_title"));
1544  $this->tpl->setVariable("QUESTION_COMMENT", $this->lng->txt("description"));
1545  $this->tpl->setVariable("QUESTION_TYPE", $this->lng->txt("tst_question_type"));
1546  $this->tpl->setVariable("QUESTION_AUTHOR", $this->lng->txt("author"));
1547  $this->tpl->setVariable("QUESTION_POOL", $this->lng->txt("qpl"));
1548  $this->tpl->setVariable("VALUE_CHOSEN_QUESTIONS", $chosen_questions);
1549  $this->tpl->setVariable("VALUE_QUESTIONPOOL_SELECTION", $_POST["sel_qpl"]);
1550  $this->tpl->setVariable("VALUE_NR_OF_QUESTIONS", $_POST["nr_of_questions"]);
1551  $this->tpl->setVariable("TEXT_QUESTION_OFFER", $this->lng->txt("tst_question_offer"));
1552  $this->tpl->setVariable("BTN_CANCEL", $this->lng->txt("cancel"));
1553  $this->tpl->parseCurrentBlock();
1554  }
1555 
1564  {
1565  $selected_array = split(",", $_POST["chosen_questions"]);
1566  if (!count($selected_array))
1567  {
1568  ilUtil::sendInfo($this->lng->txt("tst_insert_missing_question"));
1569  }
1570  else
1571  {
1572  $total = $this->object->evalTotalPersons();
1573  if ($total)
1574  {
1575  // the test was executed previously
1576  ilUtil::sendInfo(sprintf($this->lng->txt("tst_insert_questions_and_results"), $total));
1577  }
1578  else
1579  {
1580  ilUtil::sendInfo($this->lng->txt("tst_insert_questions"));
1581  }
1582  foreach ($selected_array as $key => $value)
1583  {
1584  $this->object->insertQuestion( $this->testQuestionSetConfigFactory->getQuestionSetConfig(), $value );
1585  }
1586  $this->object->saveCompleteStatus( $this->testQuestionSetConfigFactory->getQuestionSetConfig() );
1587  ilUtil::sendSuccess($this->lng->txt("tst_questions_inserted"), true);
1588  $this->ctrl->redirect($this, "questions");
1589  return;
1590  }
1591  }
1592 
1594  {
1595  $this->questionBrowser();
1596  }
1597 
1606  {
1607  $qpl_ref_id = $_REQUEST["sel_qpl"];
1608 
1609  $qpl_mode = $_REQUEST['usage'];
1610 
1611  if(isset($_REQUEST['qtype']))
1612  {
1613  include_once 'Modules/TestQuestionPool/classes/class.ilObjQuestionPool.php';
1614  $sel_question_types = ilObjQuestionPool::getQuestionTypeByTypeId($_REQUEST["qtype"]);
1615  }
1616  else if(isset($_REQUEST['sel_question_types']))
1617  {
1618  $sel_question_types = $_REQUEST["sel_question_types"];
1619  }
1620 
1621  if (!$qpl_mode || ($qpl_mode == 2 && strcmp($_REQUEST["txt_qpl"], "") == 0) || ($qpl_mode == 3 && strcmp($qpl_ref_id, "") == 0))
1622  //if ((strcmp($_REQUEST["txt_qpl"], "") == 0) && (strcmp($qpl_ref_id, "") == 0))
1623  {
1624  // Mantis #14890
1625  $_REQUEST['sel_question_types'] = $sel_question_types;
1626  ilUtil::sendInfo($this->lng->txt("questionpool_not_entered"));
1627  $this->createQuestionObject();
1628  return;
1629  }
1630  else
1631  {
1632  $_SESSION["test_id"] = $this->object->getRefId();
1633  if ($qpl_mode == 2 && strcmp($_REQUEST["txt_qpl"], "") != 0)
1634  {
1635  // create a new question pool and return the reference id
1636  $qpl_ref_id = $this->createQuestionPool($_REQUEST["txt_qpl"]);
1637  }
1638  else if ($qpl_mode == 1)
1639  {
1640  $qpl_ref_id = $_GET["ref_id"];
1641  }
1642 
1643  include_once "./Modules/TestQuestionPool/classes/class.ilObjQuestionPoolGUI.php";
1644  $baselink = "ilias.php?baseClass=ilObjQuestionPoolGUI&ref_id=" . $qpl_ref_id . "&cmd=createQuestionForTest&test_ref_id=".$_GET["ref_id"]."&calling_test=".$_GET["ref_id"]."&sel_question_types=" . $sel_question_types;
1645 
1646  if (isset($_REQUEST['prev_qid']))
1647  {
1648  $baselink .= '&prev_qid=' . $_REQUEST['prev_qid'];
1649  }
1650  else if(isset($_REQUEST['position']))
1651  {
1652  $baselink .= '&prev_qid=' . $_REQUEST['position'];
1653  }
1654 
1655  if ($_REQUEST['test_express_mode']) {
1656  $baselink .= '&test_express_mode=1';
1657  }
1658 
1659  if( isset($_REQUEST['add_quest_cont_edit_mode']) )
1660  {
1662  $baselink, "add_quest_cont_edit_mode={$_REQUEST['add_quest_cont_edit_mode']}", false
1663  );
1664  }
1665 
1666 #var_dump($_REQUEST['prev_qid']);
1667  ilUtil::redirect($baselink);
1668 
1669  exit();
1670  }
1671  }
1672 
1681  {
1682  $this->ctrl->redirect($this, "questions");
1683  }
1684 
1693  {
1694  global $ilUser;
1695  $this->getQuestionsSubTabs();
1696  //$this->tpl->addBlockFile("ADM_CONTENT", "adm_content", "tpl.il_as_tst_qpl_select.html", "Modules/Test");
1697  $questionpools =& $this->object->getAvailableQuestionpools(FALSE, FALSE, FALSE, TRUE, FALSE, "write");
1698 
1699  if ($this->object->getPoolUsage()) {
1700  global $lng, $ilCtrl, $tpl;
1701 
1702  include_once "Services/Form/classes/class.ilPropertyFormGUI.php";
1703 
1704  $form = new ilPropertyFormGUI();
1705  $form->setFormAction($ilCtrl->getFormAction($this, "executeCreateQuestion"));
1706  $form->setTitle($lng->txt("ass_create_question"));
1707  include_once 'Modules/TestQuestionPool/classes/class.ilObjQuestionPool.php';
1708 
1709 
1710  $hidden = new ilHiddenInputGUI('sel_question_types');
1711  $hidden->setValue($_REQUEST["sel_question_types"]);
1712  $form->addItem($hidden);
1713 
1714  // content editing mode
1716  {
1717  $ri = new ilRadioGroupInputGUI($lng->txt("tst_add_quest_cont_edit_mode"), "add_quest_cont_edit_mode");
1718 
1719  $ri->addOption(new ilRadioOption(
1720  $lng->txt('tst_add_quest_cont_edit_mode_default'),
1722  ));
1723 
1724  $ri->addOption(new ilRadioOption(
1725  $lng->txt('tst_add_quest_cont_edit_mode_page_object'),
1727  ));
1728 
1730 
1731  $form->addItem($ri, true);
1732  }
1733  else
1734  {
1735  $hi = new ilHiddenInputGUI("question_content_editing_type");
1737  $form->addItem($hi, true);
1738  }
1739 
1740  // use pool
1741  $usage = new ilRadioGroupInputGUI($this->lng->txt("assessment_pool_selection"), "usage");
1742  $usage->setRequired(true);
1743  $no_pool = new ilRadioOption($this->lng->txt("assessment_no_pool"), 1);
1744  $usage->addOption($no_pool);
1745  $existing_pool = new ilRadioOption($this->lng->txt("assessment_existing_pool"), 3);
1746  $usage->addOption($existing_pool);
1747  $new_pool = new ilRadioOption($this->lng->txt("assessment_new_pool"), 2);
1748  $usage->addOption($new_pool);
1749  $form->addItem($usage);
1750 
1751  $usage->setValue(1);
1752 
1753  $questionpools = ilObjQuestionPool::_getAvailableQuestionpools(FALSE, FALSE, TRUE, FALSE, FALSE, "write");
1754  $pools_data = array();
1755  foreach($questionpools as $key => $p) {
1756  $pools_data[$key] = $p['title'];
1757  }
1758  $pools = new ilSelectInputGUI($this->lng->txt("select_questionpool"), "sel_qpl");
1759  $pools->setOptions($pools_data);
1760  $existing_pool->addSubItem($pools);
1761 
1762 
1763  $this->lng->loadLanguageModule('rbac');
1764  $name = new ilTextInputGUI($this->lng->txt("rbac_create_qpl"), "txt_qpl");
1765  $name->setSize(50);
1766  $name->setMaxLength(50);
1767  $new_pool->addSubItem($name);
1768 
1769  $form->addCommandButton("executeCreateQuestion", $lng->txt("submit"));
1770  $form->addCommandButton("cancelCreateQuestion", $lng->txt("cancel"));
1771 
1772  return $this->tpl->setVariable('ADM_CONTENT', $form->getHTML());
1773 
1774  }
1775  else {
1776  global $ilCtrl;
1777 
1778  $ilCtrl->setParameterByClass('iltestexpresspageobjectgui', 'sel_question_types', $_REQUEST["sel_question_types"]);
1779  $ilCtrl->setParameterByClass('iltestexpresspageobjectgui', 'add_quest_cont_edit_mode', $_REQUEST["add_quest_cont_edit_mode"]);
1780  $link = $ilCtrl->getLinkTargetByClass('iltestexpresspageobjectgui', 'handleToolbarCommand','',false,false);
1781  ilUtil::redirect($link);
1782  }
1783  }
1784 
1789  {
1790  $removeQuestionIds = (array)$_POST["q_id"];
1791 
1792  $questions = $this->object->getQuestionTitlesAndIndexes();
1793 
1794  $this->object->removeQuestions($removeQuestionIds);
1795 
1796  $this->object->saveCompleteStatus( $this->testQuestionSetConfigFactory->getQuestionSetConfig() );
1797 
1798  ilUtil::sendSuccess($this->lng->txt("tst_questions_removed"));
1799 
1800  if($_REQUEST['test_express_mode'])
1801  {
1802  $prev = null;
1803  $return_to = null;
1804  $deleted_tmp = $removeQuestionIds;
1805  $first = array_shift($deleted_tmp);
1806  foreach((array)$questions as $key => $value)
1807  {
1808  if(!in_array($key, $removeQuestionIds))
1809  {
1810  $prev = $key;
1811  if(!$first)
1812  {
1813  $return_to = $prev;
1814  break;
1815  }
1816  else continue;
1817  }
1818  else if($key == $first)
1819  {
1820  if($prev)
1821  {
1822  $return_to = $prev;
1823  break;
1824  }
1825  $first = array_shift($deleted_tmp);
1826  }
1827  }
1828 
1829  if(
1830  count($questions) == count($removeQuestionIds) ||
1831  !$return_to
1832  )
1833  {
1834  $this->ctrl->setParameter($this, 'q_id', '');
1835  $this->ctrl->redirect($this, 'showPage');
1836  }
1837 
1838  $this->ctrl->setParameter($this, 'q_id', $return_to);
1839  $this->ctrl->redirect($this, "showPage");
1840  }
1841  else
1842  {
1843  $this->ctrl->setParameter($this, 'q_id', '');
1844  $this->ctrl->redirect($this, 'questions');
1845  }
1846  }
1847 
1856  {
1857  if ($_REQUEST['test_express_mode']) {
1858  $this->ctrl->setParameter($this, 'q_id', $_REQUEST['q_id']);
1859  $this->ctrl->redirect($this, "showPage");
1860  }
1861  else {
1862  $this->ctrl->redirect($this, "questions");
1863  }
1864  }
1865 
1873  function removeQuestionsForm($checked_questions)
1874  {
1875  $total = $this->object->evalTotalPersons();
1876  if ($total)
1877  {
1878  // the test was executed previously
1879  $question = sprintf($this->lng->txt("tst_remove_questions_and_results"), $total);
1880  }
1881  else
1882  {
1883  if (count($checked_questions) == 1)
1884  {
1885  $question = $this->lng->txt("tst_remove_question");
1886  }
1887  else
1888  {
1889  $question = $this->lng->txt("tst_remove_questions");
1890  }
1891  }
1892 
1893  include_once("./Services/Utilities/classes/class.ilConfirmationGUI.php");
1894  $cgui = new ilConfirmationGUI();
1895  $cgui->setHeaderText($question);
1896 
1897  $this->ctrl->saveParameter($this, 'test_express_mode');
1898  $this->ctrl->saveParameter($this, 'q_id');
1899 
1900  $cgui->setFormAction($this->ctrl->getFormAction($this));
1901  $cgui->setCancel($this->lng->txt("cancel"), "cancelRemoveQuestions");
1902  $cgui->setConfirm($this->lng->txt("confirm"), "confirmRemoveQuestions");
1903 
1904  include_once "./Modules/TestQuestionPool/classes/class.assQuestion.php";
1905  $removablequestions =& $this->object->getTestQuestions();
1906  if (count($removablequestions))
1907  {
1908  foreach ($removablequestions as $data)
1909  {
1910  if (in_array($data["question_id"], $checked_questions))
1911  {
1912  $txt = $data["title"]." (".assQuestion::_getQuestionTypeName($data["type_tag"]).")";
1913  $txt .= ' ['. $this->lng->txt('question_id_short') . ': ' . $data['question_id'] . ']';
1914 
1915  if($data["description"])
1916  {
1917  $txt .= "<div class=\"small\">".$data["description"]."</div>";
1918  }
1919 
1920  $cgui->addItem("q_id[]", $data["question_id"], $txt);
1921  }
1922  }
1923  }
1924 
1925  $this->tpl->setContent($cgui->getHTML());
1926  }
1927 
1936  {
1937  $this->getQuestionsSubTabs();
1938  $checked_questions = $_REQUEST["q_id"];
1939  if (!is_array($checked_questions) && $checked_questions) {
1940  $checked_questions = array($checked_questions);
1941  }
1942  if (count($checked_questions) > 0)
1943  {
1944  $this->removeQuestionsForm($checked_questions);
1945  return;
1946  }
1947  elseif (count($checked_questions) == 0)
1948  {
1949  ilUtil::sendFailure($this->lng->txt("tst_no_question_selected_for_removal"), true);
1950  $this->ctrl->redirect($this, "questions");
1951  }
1952  }
1953 
1958  {
1959  $selected_questions = NULL;
1960  $selected_questions = $_POST['q_id'];
1961  if (is_array($selected_questions))
1962  {
1963  $_SESSION['tst_qst_move_' . $this->object->getTestId()] = $_POST['q_id'];
1964  ilUtil::sendSuccess($this->lng->txt("msg_selected_for_move"), true);
1965  }
1966  else
1967  {
1968  ilUtil::sendFailure($this->lng->txt('no_selection_for_move'), TRUE);
1969  }
1970  $this->ctrl->redirect($this, 'questions');
1971  }
1972 
1977  {
1978  // get all questions to move
1979  $move_questions = $_SESSION['tst_qst_move_' . $this->object->getTestId()];
1980 
1981  if (count($_POST['q_id']) == 0)
1982  {
1983  ilUtil::sendFailure($this->lng->txt("no_target_selected_for_move"), true);
1984  $this->ctrl->redirect($this, 'questions');
1985  }
1986  if (count($_POST['q_id']) > 1)
1987  {
1988  ilUtil::sendFailure($this->lng->txt("too_many_targets_selected_for_move"), true);
1989  $this->ctrl->redirect($this, 'questions');
1990  }
1991  $insert_mode = 0;
1992  $this->object->moveQuestions($_SESSION['tst_qst_move_' . $this->object->getTestId()], $_POST['q_id'][0], $insert_mode);
1993  ilUtil::sendSuccess($this->lng->txt("msg_questions_moved"), true);
1994  unset($_SESSION['tst_qst_move_' . $this->object->getTestId()]);
1995  $this->ctrl->redirect($this, "questions");
1996  }
1997 
2001  public function insertQuestionsAfterObject()
2002  {
2003  // get all questions to move
2004  $move_questions = $_SESSION['tst_qst_move_' . $this->object->getTestId()];
2005  if (count($_POST['q_id']) == 0)
2006  {
2007  ilUtil::sendFailure($this->lng->txt("no_target_selected_for_move"), true);
2008  $this->ctrl->redirect($this, 'questions');
2009  }
2010  if (count($_POST['q_id']) > 1)
2011  {
2012  ilUtil::sendFailure($this->lng->txt("too_many_targets_selected_for_move"), true);
2013  $this->ctrl->redirect($this, 'questions');
2014  }
2015  $insert_mode = 1;
2016  $this->object->moveQuestions($_SESSION['tst_qst_move_' . $this->object->getTestId()], $_POST['q_id'][0], $insert_mode);
2017  ilUtil::sendSuccess($this->lng->txt("msg_questions_moved"), true);
2018  unset($_SESSION['tst_qst_move_' . $this->object->getTestId()]);
2019  $this->ctrl->redirect($this, "questions");
2020  }
2021 
2028  {
2029  $selected_array = (is_array($_POST['q_id'])) ? $_POST['q_id'] : array();
2030  if (!count($selected_array))
2031  {
2032  ilUtil::sendInfo($this->lng->txt("tst_insert_missing_question"), true);
2033  $this->ctrl->redirect($this, "browseForQuestions");
2034  }
2035  else
2036  {
2037  include_once "./Modules/TestQuestionPool/classes/class.assQuestion.php";
2038  $manscoring = FALSE;
2039  foreach ($selected_array as $key => $value)
2040  {
2041  $this->object->insertQuestion( $this->testQuestionSetConfigFactory->getQuestionSetConfig(), $value );
2042  if (!$manscoring)
2043  {
2044  $manscoring = $manscoring | assQuestion::_needsManualScoring($value);
2045  }
2046  }
2047  $this->object->saveCompleteStatus( $this->testQuestionSetConfigFactory->getQuestionSetConfig() );
2048  if ($manscoring)
2049  {
2050  ilUtil::sendInfo($this->lng->txt("manscoring_hint"), TRUE);
2051  }
2052  else
2053  {
2054  ilUtil::sendSuccess($this->lng->txt("tst_questions_inserted"), TRUE);
2055  }
2056  $this->ctrl->redirect($this, "questions");
2057  return;
2058  }
2059  }
2060 
2061  public function addQuestionObject()
2062  {
2063  global $lng, $ilCtrl, $tpl;
2064 
2065  include_once "Services/Form/classes/class.ilPropertyFormGUI.php";
2066 
2067  $ilCtrl->setParameter($this, 'qtype', $_REQUEST['qtype']);
2068 
2069  $form = new ilPropertyFormGUI();
2070 
2071  $form->setFormAction($ilCtrl->getFormAction($this, "executeCreateQuestion"));
2072  $form->setTitle($lng->txt("ass_create_question"));
2073  include_once 'Modules/TestQuestionPool/classes/class.ilObjQuestionPool.php';
2074 
2075  $pool = new ilObjQuestionPool();
2076  $questionTypes = $pool->getQuestionTypes(false, true);
2077  $options = array();
2078 
2079  // question type
2080  foreach($questionTypes as $label => $data)
2081  {
2082  $options[$data['question_type_id']] = $label;
2083  }
2084 
2085  include_once("./Services/Form/classes/class.ilSelectInputGUI.php");
2086  $si = new ilSelectInputGUI($lng->txt("question_type"), "qtype");
2087  $si->setOptions($options);
2088  $form->addItem($si, true);
2089 
2090  // position
2091  $questions = $this->object->getQuestionTitlesAndIndexes();
2092  if($questions)
2093  {
2094  $si = new ilSelectInputGUI($lng->txt("position"), "position");
2095  $options = array('0' => $lng->txt('first'));
2096  foreach($questions as $key => $title)
2097  {
2098  $options[$key] = $lng->txt('behind') . ' '. $title . ' ['.$this->lng->txt('question_id_short') . ': '. $key .']';
2099  }
2100  $si->setOptions($options);
2101  $si->setValue($_REQUEST['q_id']);
2102  $form->addItem($si, true);
2103  }
2104 
2105  // content editing mode
2107  {
2108  $ri = new ilRadioGroupInputGUI($lng->txt("tst_add_quest_cont_edit_mode"), "add_quest_cont_edit_mode");
2109 
2110  $ri->addOption(new ilRadioOption(
2111  $lng->txt('tst_add_quest_cont_edit_mode_default'),
2113  ));
2114 
2115  $ri->addOption(new ilRadioOption(
2116  $lng->txt('tst_add_quest_cont_edit_mode_page_object'),
2118  ));
2119 
2121 
2122  $form->addItem($ri, true);
2123  }
2124  else
2125  {
2126  $hi = new ilHiddenInputGUI("question_content_editing_type");
2128  $form->addItem($hi, true);
2129  }
2130 
2131  if($this->object->getPoolUsage())
2132  {
2133  // use pool
2134  $usage = new ilRadioGroupInputGUI($this->lng->txt("assessment_pool_selection"), "usage");
2135  $usage->setRequired(true);
2136  $no_pool = new ilRadioOption($this->lng->txt("assessment_no_pool"), 1);
2137  $usage->addOption($no_pool);
2138  $existing_pool = new ilRadioOption($this->lng->txt("assessment_existing_pool"), 3);
2139  $usage->addOption($existing_pool);
2140  $new_pool = new ilRadioOption($this->lng->txt("assessment_new_pool"), 2);
2141  $usage->addOption($new_pool);
2142  $form->addItem($usage);
2143 
2144  $usage->setValue(1);
2145 
2146  $questionpools = ilObjQuestionPool::_getAvailableQuestionpools(FALSE, FALSE, TRUE, FALSE, FALSE, "write");
2147  $pools_data = array();
2148  foreach($questionpools as $key => $p)
2149  {
2150  $pools_data[$key] = $p['title'];
2151  }
2152  $pools = new ilSelectInputGUI($this->lng->txt("select_questionpool"), "sel_qpl");
2153  $pools->setOptions($pools_data);
2154  $existing_pool->addSubItem($pools);
2155 
2156  $name = new ilTextInputGUI($this->lng->txt("name"), "txt_qpl");
2157  $name->setSize(50);
2158  $name->setMaxLength(50);
2159  $new_pool->addSubItem($name);
2160  }
2161 
2162  $form->addCommandButton("executeCreateQuestion", $lng->txt("create"));
2163  $form->addCommandButton("questions", $lng->txt("cancel"));
2164 
2165  return $tpl->setContent($form->getHTML());
2166  }
2167 
2168  function questionsObject()
2169  {
2170  global $ilAccess, $ilTabs;
2171 
2172  $ilTabs->activateTab('assQuestions');
2173 
2174  // #12590
2175  $this->ctrl->setParameter($this, 'test_express_mode', '');
2176 
2177  if (!$ilAccess->checkAccess("write", "", $this->ref_id))
2178  {
2179  // allow only write access
2180  ilUtil::sendInfo($this->lng->txt("cannot_edit_test"), true);
2181  $this->ctrl->redirect($this, "infoScreen");
2182  }
2183 
2184  if ($_GET['browse'])
2185  {
2186  return $this->questionbrowser();
2187  }
2188 
2189  $this->getQuestionsSubTabs();
2190 
2191  // #11631, #12994
2192  $this->ctrl->setParameter($this, 'q_id', '');
2193 
2194  if ($_GET["eqid"] && $_GET["eqpl"])
2195  {
2196  ilUtil::redirect("ilias.php?baseClass=ilObjQuestionPoolGUI&ref_id=" . $_GET["eqpl"] . "&cmd=editQuestionForTest&calling_test=".$_GET["ref_id"]."&q_id=" . $_GET["eqid"]);
2197  }
2198 
2199  if ($_GET["up"] > 0)
2200  {
2201  $this->object->questionMoveUp($_GET["up"]);
2202  }
2203  if ($_GET["down"] > 0)
2204  {
2205  $this->object->questionMoveDown($_GET["down"]);
2206  }
2207 
2208  if ($_GET["add"])
2209  {
2210  $selected_array = array();
2211  array_push($selected_array, $_GET["add"]);
2212  $total = $this->object->evalTotalPersons();
2213  if ($total)
2214  {
2215  // the test was executed previously
2216  ilUtil::sendInfo(sprintf($this->lng->txt("tst_insert_questions_and_results"), $total));
2217  }
2218  else
2219  {
2220  ilUtil::sendInfo($this->lng->txt("tst_insert_questions"));
2221  }
2222  $this->insertQuestions($selected_array);
2223  return;
2224  }
2225 
2226  $this->tpl->addBlockFile("ADM_CONTENT", "adm_content", "tpl.il_as_tst_questions.html", "Modules/Test");
2227 
2228  $total = $this->object->evalTotalPersons();
2229  if ($ilAccess->checkAccess("write", "", $this->ref_id))
2230  {
2231  if($total != 0)
2232  {
2233  $link = $this->ctrl->getLinkTarget($this, "participants");
2234  $link = "<a href=\"".$link."\">".$this->lng->txt("test_has_datasets_warning_page_view_link")."</a>";
2235  ilUtil::sendInfo($this->lng->txt("test_has_datasets_warning_page_view")." ".$link);
2236  }
2237  else {
2238  global $ilToolbar;
2239 
2240  $ilToolbar->addButton($this->lng->txt("ass_create_question"), $this->ctrl->getLinkTarget($this, "addQuestion"));
2241 
2242  if( $this->object->getPoolUsage() )
2243  {
2244  $ilToolbar->addSeparator();
2245 
2246  require_once 'Modules/Test/classes/tables/class.ilTestQuestionBrowserTableGUI.php';
2247 
2249  }
2250 
2251  $ilToolbar->addSeparator();
2252  $ilToolbar->addButton($this->lng->txt("random_selection"), $this->ctrl->getLinkTarget($this, "randomselect"));
2253 
2254 
2255  global $ilAccess, $ilUser, $lng, $ilCtrl;
2256  $online_access = false;
2257  if ($this->object->getFixedParticipants())
2258  {
2259  include_once "./Modules/Test/classes/class.ilObjTestAccess.php";
2260  $online_access_result = ilObjTestAccess::_lookupOnlineTestAccess($this->object->getId(), $ilUser->getId());
2261  if ($online_access_result === true)
2262  {
2263  $online_access = true;
2264  }
2265  }
2266 
2267  if( $this->object->isOnline() && $this->object->isComplete( $this->testQuestionSetConfigFactory->getQuestionSetConfig() ) )
2268  {
2269  if ((!$this->object->getFixedParticipants() || $online_access) && $ilAccess->checkAccess("read", "", $this->ref_id))
2270  {
2271  $testSession = $this->testSessionFactory->getSession();
2272  $testSequence = $this->testSequenceFactory->getSequenceByTestSession($testSession);
2273 
2274  $testPlayerGUI = $this->testPlayerFactory->getPlayerGUI();
2275 
2276  $executable = $this->object->isExecutable($testSession, $ilUser->getId(), $allowPassIncrease = TRUE);
2277 
2278  if ($executable["executable"])
2279  {
2280  if ($testSession->getActiveId() > 0)
2281  {
2282  // resume test
2283 
2284  if ($testSequence->hasStarted($testSession))
2285  {
2286  $execTestLabel = $this->lng->txt("tst_resume_test");
2287  $execTestLink = $this->ctrl->getLinkTarget($testPlayerGUI, 'resumePlayer');
2288  }
2289  else
2290  {
2291  $execTestLabel = $this->object->getStartTestLabel($testSession->getActiveId());
2292  $execTestLink = $this->ctrl->getLinkTarget($testPlayerGUI, 'startPlayer');
2293  }
2294  }
2295  else
2296  {
2297  // start new test
2298 
2299  $execTestLabel = $this->object->getStartTestLabel($testSession->getActiveId());
2300  $execTestLink = $this->ctrl->getLinkTarget($testPlayerGUI, 'startPlayer');
2301  }
2302 
2303  $ilToolbar->addSeparator();
2304  $ilToolbar->addButton($execTestLabel, $execTestLink);
2305  }
2306  }
2307  }
2308 
2309 
2310  }
2311  }
2312 
2313  $this->tpl->setCurrentBlock("adm_content");
2314  include_once "./Modules/Test/classes/tables/class.ilTestQuestionsTableGUI.php";
2315  $checked_move = is_array($_SESSION['tst_qst_move_' . $this->object->getTestId()]) && (count($_SESSION['tst_qst_move_' . $this->object->getTestId()]));
2316  $table_gui = new ilTestQuestionsTableGUI($this, 'questions', (($ilAccess->checkAccess("write", "", $this->ref_id) ? true : false)), $checked_move, $total);
2317  $data = $this->object->getTestQuestions();
2318  $table_gui->setData($data);
2319  $this->tpl->setVariable('QUESTIONBROWSER', $table_gui->getHTML());
2320  $this->tpl->setVariable("ACTION_QUESTION_FORM", $this->ctrl->getFormAction($this));
2321  $this->tpl->parseCurrentBlock();
2322  }
2323 
2328  private function populateQuestionBrowserToolbarButtons(ilToolbarGUI $toolbar, $context)
2329  {
2330  require_once 'Modules/Test/classes/tables/class.ilTestQuestionBrowserTableGUI.php';
2331 
2332  $this->ctrl->setParameterByClass('ilTestQuestionBrowserTableGUI', ilTestQuestionBrowserTableGUI::CONTEXT_PARAMETER, $context);
2333 
2334  $this->ctrl->setParameterByClass('ilTestQuestionBrowserTableGUI', ilTestQuestionBrowserTableGUI::MODE_PARAMETER, ilTestQuestionBrowserTableGUI::MODE_BROWSE_POOLS);
2335 
2336  $toolbar->addButton($this->lng->txt("tst_browse_for_qpl_questions"), $this->ctrl->getLinkTargetByClass('ilTestQuestionBrowserTableGUI', ilTestQuestionBrowserTableGUI::CMD_BROWSE_QUESTIONS));
2337 
2338  $this->ctrl->setParameterByClass('ilTestQuestionBrowserTableGUI', ilTestQuestionBrowserTableGUI::MODE_PARAMETER, ilTestQuestionBrowserTableGUI::MODE_BROWSE_TESTS);
2339 
2340  $toolbar->addButton($this->lng->txt("tst_browse_for_tst_questions"), $this->ctrl->getLinkTargetByClass('ilTestQuestionBrowserTableGUI', ilTestQuestionBrowserTableGUI::CMD_BROWSE_QUESTIONS));
2341  }
2342 
2343  function takenObject() {
2344  }
2345 
2354  {
2355  global $ilDB, $lng;
2356 
2357  require_once 'Modules/Test/classes/class.ilTestParticipantData.php';
2358 
2359  $participantData = new ilTestParticipantData($ilDB, $lng);
2360  $participantData->load($this->object->getTestId());
2361 
2362  $this->object->removeTestResults($participantData);
2363 
2364  ilUtil::sendSuccess($this->lng->txt("tst_all_user_data_deleted"), true);
2365  $this->ctrl->redirect($this, "participants");
2366  }
2367 
2376  {
2377  global $ilDB, $lng;
2378 
2379  require_once 'Modules/Test/classes/class.ilTestParticipantData.php';
2380  $participantData = new ilTestParticipantData($ilDB, $lng);
2381 
2382  if( $this->object->getFixedParticipants() )
2383  {
2384  $participantData->setUserIds($_POST["chbUser"]);
2385  }
2386  else
2387  {
2388  $participantData->setActiveIds($_POST["chbUser"]);
2389  }
2390 
2391  $participantData->load($this->object->getTestId());
2392 
2393  $this->object->removeTestResults($participantData);
2394 
2395  ilUtil::sendSuccess($this->lng->txt("tst_selected_user_data_deleted"), true);
2396  $this->ctrl->redirect($this, "participants");
2397  }
2398 
2407  {
2408  $this->ctrl->redirect($this, "participants");
2409  }
2410 
2421  {
2422  ilUtil::sendQuestion($this->lng->txt("confirm_delete_all_user_data"));
2423  $this->tpl->addBlockFile("ADM_CONTENT", "adm_content", "tpl.il_as_tst_maintenance.html", "Modules/Test");
2424 
2425  $this->tpl->setCurrentBlock("confirm_delete");
2426  $this->tpl->setVariable("BTN_CONFIRM_DELETE_ALL", $this->lng->txt("confirm"));
2427  $this->tpl->setVariable("BTN_CANCEL_DELETE_ALL", $this->lng->txt("cancel"));
2428  $this->tpl->parseCurrentBlock();
2429 
2430  $this->tpl->setCurrentBlock("adm_content");
2431  $this->tpl->setVariable("FORM_ACTION", $this->ctrl->getFormAction($this));
2432  $this->tpl->parseCurrentBlock();
2433  }
2434 
2438  public function deleteAllUserResultsObject()
2439  {
2440  // display confirmation message
2441  include_once("./Services/Utilities/classes/class.ilConfirmationGUI.php");
2442  $cgui = new ilConfirmationGUI();
2443  $cgui->setFormAction($this->ctrl->getFormAction($this, "participants"));
2444  $cgui->setHeaderText($this->lng->txt("delete_all_user_data_confirmation"));
2445  $cgui->setCancel($this->lng->txt("cancel"), "participants");
2446  $cgui->setConfirm($this->lng->txt("proceed"), "confirmDeleteAllUserResults");
2447 
2448  $this->tpl->setContent($cgui->getHTML());
2449  }
2450 
2459  {
2460  if (count($_POST["chbUser"]) == 0)
2461  {
2462  ilUtil::sendInfo($this->lng->txt("select_one_user"), TRUE);
2463  $this->ctrl->redirect($this, "participants");
2464  }
2465 
2466  include_once("./Services/Utilities/classes/class.ilConfirmationGUI.php");
2467  $cgui = new ilConfirmationGUI();
2468  $cgui->setHeaderText($this->lng->txt("confirm_delete_single_user_data"));
2469 
2470  $cgui->setFormAction($this->ctrl->getFormAction($this));
2471  $cgui->setCancel($this->lng->txt("cancel"), "cancelDeleteSelectedUserData");
2472  $cgui->setConfirm($this->lng->txt("confirm"), "confirmDeleteSelectedUserData");
2473 
2474  include_once './Services/User/classes/class.ilObjUser.php';
2475  foreach ($_POST["chbUser"] as $key => $active_id)
2476  {
2477  if ($this->object->getFixedParticipants())
2478  {
2479  $user_id = $active_id;
2480  }
2481  else
2482  {
2483  $user_id = $this->object->_getUserIdFromActiveId($active_id);
2484  }
2485  $user = ilObjUser::_lookupName($user_id);
2486 
2487  if ($this->object->getAnonymity())
2488  {
2489  $name = $this->lng->txt("anonymous");
2490  }
2491  else if($user["lastname"])
2492  {
2493  $name = $user["lastname"].", ".$user["firstname"]." (".
2494  $user["login"].")";
2495  }
2496  else
2497  {
2498  $name = $this->lng->txt("deleted_user");
2499  }
2500 
2501  $cgui->addItem("chbUser[]", $active_id, $name,
2502  ilUtil::getImagePath("icon_usr.svg"), $this->lng->txt("usr"));
2503  }
2504 
2505  $this->tpl->setContent($cgui->getHTML());
2506  }
2507 
2515  function historyObject()
2516  {
2517  include_once "./Modules/Test/classes/tables/class.ilTestHistoryTableGUI.php";
2518  $table_gui = new ilTestHistoryTableGUI($this, 'history');
2519  $table_gui->setTestObject($this->object);
2520  include_once "./Modules/Test/classes/class.ilObjAssessmentFolder.php";
2521  $log =& ilObjAssessmentFolder::_getLog(0, time(), $this->object->getId(), TRUE);
2522  $table_gui->setData($log);
2523  $this->tpl->setVariable('ADM_CONTENT', $table_gui->getHTML());
2524  }
2525 
2526  function initImportForm($a_new_type)
2527  {
2528  include_once("Services/Form/classes/class.ilPropertyFormGUI.php");
2529  $form = new ilPropertyFormGUI();
2530  $form->setTarget("_top");
2531  $new_type = $_POST["new_type"] ? $_POST["new_type"] : $_GET["new_type"];
2532  $this->ctrl->setParameter($this, "new_type", $new_type);
2533  $form->setFormAction($this->ctrl->getFormAction($this));
2534  $form->setTitle($this->lng->txt("import_tst"));
2535 
2536  // file
2537  include_once("./Services/Form/classes/class.ilFileInputGUI.php");
2538  $fi = new ilFileInputGUI($this->lng->txt("import_file"), "xmldoc");
2539  $fi->setSuffixes(array("zip"));
2540  $fi->setRequired(true);
2541  $form->addItem($fi);
2542 
2543  // question pool
2544  include_once("./Modules/Test/classes/class.ilObjTest.php");
2545  $tst = new ilObjTest();
2546  $questionpools = $tst->getAvailableQuestionpools(TRUE, FALSE, TRUE, TRUE);
2547  if (count($questionpools))
2548  {
2549  $options = array("-1" => $this->lng->txt("dont_use_questionpool"));
2550  foreach ($questionpools as $key => $value)
2551  {
2552  $options[$key] = $value["title"];
2553  }
2554 
2555  $pool = new ilSelectInputGUI($this->lng->txt("select_questionpool"), "qpl");
2556  $pool->setOptions($options);
2557  $form->addItem($pool);
2558  }
2559 
2560  $form->addCommandButton("importFile", $this->lng->txt("import"));
2561  $form->addCommandButton("cancel", $this->lng->txt("cancel"));
2562 
2563  return $form;
2564  }
2565 
2572  {
2573  $command = $_POST["command"];
2574  if (strlen($command))
2575  {
2576  $method = $command . "Object";
2577  if (method_exists($this, $method))
2578  {
2579  $this->$method();
2580  return;
2581  }
2582  }
2583  $this->ctrl->redirect($this, "participants");
2584  }
2585 
2592  {
2593  global $ilAccess, $ilToolbar, $lng;
2594 
2595  $this->getParticipantsSubTabs();
2596 
2597  if (!$ilAccess->checkAccess("write", "", $this->ref_id))
2598  {
2599  // allow only write access
2600  ilUtil::sendInfo($this->lng->txt("cannot_edit_test"), true);
2601  $this->ctrl->redirect($this, "infoScreen");
2602  }
2603 
2604  if( $this->testQuestionSetConfigFactory->getQuestionSetConfig()->areDepenciesBroken() )
2605  {
2607  $this->testQuestionSetConfigFactory->getQuestionSetConfig()->getDepenciesBrokenMessage($this->lng)
2608  );
2609  }
2610  elseif( $this->testQuestionSetConfigFactory->getQuestionSetConfig()->areDepenciesInVulnerableState() )
2611  {
2613  $this->testQuestionSetConfigFactory->getQuestionSetConfig()->getDepenciesInVulnerableStateMessage($this->lng)
2614  );
2615  }
2616 
2617  if ($this->object->getFixedParticipants())
2618  {
2619  // search button
2620  include_once './Services/Search/classes/class.ilRepositorySearchGUI.php';
2622  $this,
2623  $ilToolbar,
2624  array(
2625  'auto_complete_name' => $lng->txt('user'),
2626  'submit_name' => $lng->txt('add')
2627  )
2628  );
2629 
2630  $ilToolbar->addSeparator();
2631  $search_btn = ilLinkButton::getInstance();
2632  $search_btn->setCaption('tst_search_users');
2633  $search_btn->setUrl($this->ctrl->getLinkTargetByClass('ilRepositorySearchGUI','start'));
2634  $ilToolbar->addButtonInstance($search_btn);
2635  require_once 'Services/UIComponent/Button/classes/class.ilLinkButton.php';
2636 
2637  $participants =& $this->object->getInvitedUsers();
2638  $rows = array();
2639  foreach ($participants as $data)
2640  {
2641  $maxpass = $this->object->_getMaxPass($data["active_id"]);
2642  if (!is_null($maxpass))
2643  {
2644  $maxpass += 1;
2645  }
2646  $access = "";
2647  if (strlen($data["active_id"]))
2648  {
2649  $last_access = $this->object->_getLastAccess($data["active_id"]);
2650  $access = $last_access;
2651  }
2652  $this->ctrl->setParameterByClass('iltestevaluationgui', 'active_id', $data['active_id']);
2653 
2654  if ($data['active_id'] == null) // if no active id is set, user is invitee not participant...
2655  {
2656  if ( strlen($data["firstname"].$data["lastname"]) == 0 )
2657  {
2658  $fullname = $lng->txt("deleted_user");
2659  }
2660  else if($this->object->getAnonymity())
2661  {
2662  $fullname = $lng->txt('anonymous');
2663  }
2664  else
2665  {
2666  $fullname = trim($data["lastname"] . ", " . $data["firstname"] . " " . $data["title"]);
2667  }
2668  } else {
2669  include_once "./Modules/Test/classes/class.ilObjTestAccess.php";
2670  $fullname = ilObjTestAccess::_getParticipantData($data['active_id']);
2671  }
2672 
2673  array_push($rows, array(
2674  'usr_id' => $data["usr_id"],
2675  'active_id' => $data['active_id'],
2676  'login' => $data["login"],
2677  'clientip' => $data["clientip"],
2678  'firstname' => $data["firstname"],
2679  'lastname' => $data["lastname"],
2680  'name' => $fullname,
2681  'started' => ($data["active_id"] > 0) ? 1 : 0,
2682  'finished' => ($data["test_finished"] == 1) ? 1 : 0,
2683  'access' => $access,
2684  'maxpass' => $maxpass,
2685  'result' => $this->ctrl->getLinkTargetByClass('iltestevaluationgui', 'outParticipantsResultsOverview')
2686  ));
2687  }
2688  include_once "./Modules/Test/classes/tables/class.ilTestFixedParticipantsTableGUI.php";
2689  $table_gui = new ilTestFixedParticipantsTableGUI( $this, 'participants',
2690  $this->testQuestionSetConfigFactory->getQuestionSetConfig()->areDepenciesBroken(),
2691  $this->object->getAnonymity(), count($rows)
2692  );
2693  $table_gui->setFilterCommand('fpSetFilter');
2694  $table_gui->setResetCommand('fpResetFiler');
2695  $rows = $this->applyFilterCriteria($rows);
2696  $table_gui->setData($rows);
2697  $this->tpl->setVariable('ADM_CONTENT', $table_gui->getHTML());
2698 
2699  if(count($rows) > 0)
2700  {
2701  $ilToolbar->addSeparator();
2702  $delete_all_results_btn = ilLinkButton::getInstance();
2703  $delete_all_results_btn->setCaption('delete_all_user_data');
2704  $delete_all_results_btn->setUrl($this->ctrl->getLinkTarget($this, 'deleteAllUserResults'));
2705  $ilToolbar->addButtonInstance($delete_all_results_btn);
2706  }
2707  }
2708  else
2709  {
2710  $participants =& $this->object->getTestParticipants();
2711  $rows = array();
2712  foreach ($participants as $data)
2713  {
2714  $maxpass = $this->object->_getMaxPass($data["active_id"]);
2715  if (!is_null($maxpass))
2716  {
2717  $maxpass += 1;
2718  }
2719  $access = "";
2720  if (strlen($data["active_id"]))
2721  {
2722  $last_access = $this->object->_getLastAccess($data["active_id"]);
2723  $access = $last_access;
2724  }
2725  $this->ctrl->setParameterByClass('iltestevaluationgui', 'active_id', $data['active_id']);
2726 
2727  include_once "./Modules/Test/classes/class.ilObjTestAccess.php";
2728  $fullname = ilObjTestAccess::_getParticipantData($data['active_id']);
2729  array_push($rows, array(
2730  'usr_id' => $data["active_id"],
2731  'active_id' => $data['active_id'],
2732  'login' => $data["login"],
2733  'name' => $fullname,
2734  'firstname' => $data["firstname"],
2735  'lastname' => $data["lastname"],
2736  'started' => ($data["active_id"] > 0) ? 1 : 0,
2737  'finished' => ($data["test_finished"] == 1) ? 1 : 0,
2738  'access' => $access,
2739  'maxpass' => $maxpass,
2740  'result' => $this->ctrl->getLinkTargetByClass('iltestevaluationgui', 'outParticipantsResultsOverview')
2741  ));
2742  }
2743  include_once "./Modules/Test/classes/tables/class.ilTestParticipantsTableGUI.php";
2744  $table_gui = new ilTestParticipantsTableGUI( $this, 'participants',
2745  $this->testQuestionSetConfigFactory->getQuestionSetConfig()->areDepenciesBroken(),
2746  $this->object->getAnonymity(), count($rows)
2747  );
2748 
2749  if(count($rows) > 0)
2750  {
2751  require_once 'Services/UIComponent/Button/classes/class.ilLinkButton.php';
2752  $delete_all_results_btn = ilLinkButton::getInstance();
2753  $delete_all_results_btn->setCaption('delete_all_user_data');
2754  $delete_all_results_btn->setUrl($this->ctrl->getLinkTarget($this, 'deleteAllUserResults'));
2755  $ilToolbar->addStickyItem($delete_all_results_btn);
2756  }
2757 
2758  $table_gui->setFilterCommand('npSetFilter');
2759  $table_gui->setResetCommand('npResetFilter');
2760  $rows = $this->applyFilterCriteria($rows);
2761  $table_gui->setData($rows);
2762  $this->tpl->setVariable('ADM_CONTENT', $table_gui->getHTML());
2763  }
2764  }
2765 
2766  public function timingOverviewObject()
2767  {
2768  $this->getParticipantsSubTabs();
2769 
2770  include_once "./Modules/Test/classes/tables/class.ilTimingOverviewTableGUI.php";
2771  $table_gui = new ilTimingOverviewTableGUI($this, 'timingOverview');
2772 
2773  $participants =& $this->object->getTestParticipants();#
2774  $times = $this->object->getStartingTimeOfParticipants();
2775  $addons = $this->object->getTimeExtensionsOfParticipants();
2776 
2777  $tbl_data = array();
2778  foreach ($participants as $participant)
2779  {
2780  $tblRow = array();
2781 
2782  $started = "";
2783  if ($times[$participant['active_id']])
2784  {
2785  $started = $this->lng->txt('tst_started').': '.ilDatePresentation::formatDate(new ilDateTime($times[$participant['active_id']], IL_CAL_DATETIME));
2786  $tblRow['started'] = $started;
2787  }
2788  else
2789  {
2790  $tblRow['started'] = '';
2791  }
2792 
2793  if ($addons[$participant['active_id']] > 0)
2794  {
2795  $tblRow['extratime'] = $addons[$participant['active_id']];
2796  }
2797 
2798  $tblRow['login'] = $participant['login'];
2799 
2800  if ($this->object->getAnonymity())
2801  {
2802  $tblRow['name'] = $this->lng->txt("anonymous");
2803  }
2804  else
2805  {
2806  $tblRow['name'] = $participant['lastname'] . ', ' . $participant['firstname'];
2807  }
2808 
2809  $tbl_data[] = $tblRow;
2810  }
2811  $table_gui->setData($tbl_data);
2812 
2813  $this->tpl->setContent($table_gui->getHTML());
2814  }
2815 
2816  public function timingObject()
2817  {
2818  $this->getParticipantsSubTabs();
2819 
2820  global $ilAccess;
2821 
2822  if (!$ilAccess->checkAccess("write", "", $this->ref_id))
2823  {
2824  // allow only write access
2825  ilUtil::sendInfo($this->lng->txt("cannot_edit_test"), true);
2826  $this->ctrl->redirect($this, "infoScreen");
2827  }
2828 
2829  if ($this->object->getProcessingTimeInSeconds() > 0 && $this->object->getNrOfTries() == 1)
2830  {
2831  $form = $this->formTimingObject();
2832  if (count($_POST) && $form->checkInput())
2833  {
2834  $res = $this->object->addExtraTime($form->getInput('participant'), $form->getInput('extratime'));
2835  ilUtil::sendSuccess(sprintf($this->lng->txt('tst_extratime_added'), $form->getInput('extratime')), true);
2836  $this->ctrl->redirect($this, 'timingOverview');
2837  }
2838  else
2839  {
2840  return $this->tpl->setVariable("ADM_CONTENT", $form->getHTML());
2841  }
2842  }
2843  else
2844  {
2845  ilUtil::sendInfo($this->lng->txt("tst_extratime_notavailable"));
2846  }
2847  }
2848 
2849  private function formTimingObject()
2850  {
2851  global $ilAccess;
2852 
2853  include_once("./Services/Form/classes/class.ilPropertyFormGUI.php");
2854  $form = new ilPropertyFormGUI();
2855  $form->setFormAction($this->ctrl->getFormAction($this));
2856  $form->setTableWidth("100%");
2857  $form->setId("tst_change_workingtime");
2858  $form->setTitle($this->lng->txt("tst_change_workingtime"));
2859 
2860  // test users
2861  $participantslist = new ilSelectInputGUI($this->lng->txt('participants'), "participant");
2862  $participants =& $this->object->getTestParticipants();
2863  $times = $this->object->getStartingTimeOfParticipants();
2864  $addons = $this->object->getTimeExtensionsOfParticipants();
2865  $options = array(
2866  '' => $this->lng->txt('please_select'),
2867  '0' => $this->lng->txt('all_participants')
2868  );
2869  foreach ($participants as $participant)
2870  {
2871  $started = "";
2872 
2873  if ($this->object->getAnonymity())
2874  {
2875  $name = $this->lng->txt("anonymous");
2876  }
2877  else
2878  {
2879  $name = $participant['lastname'] . ', ' . $participant['firstname'];
2880  }
2881 
2882 
2883  if ($times[$participant['active_id']])
2884  {
2885  $started = ", ".$this->lng->txt('tst_started').': '.ilDatePresentation::formatDate(new ilDateTime($times[$participant['active_id']], IL_CAL_DATETIME));
2886  }
2887  if ($addons[$participant['active_id']] > 0) $started .= ", " . $this->lng->txt('extratime') . ': ' . $addons[$participant['active_id']] . ' ' . $this->lng->txt('minutes');
2888  $options[$participant['active_id']] = $participant['login'] . ' (' .$name. ')'.$started;
2889  }
2890  $participantslist->setRequired(true);
2891  $participantslist->setOptions($options);
2892  $form->addItem($participantslist);
2893 
2894  // extra time
2895  $extratime = new ilNumberInputGUI($this->lng->txt("extratime"), "extratime");
2896  $extratime->setInfo($this->lng->txt('tst_extratime_info'));
2897  $extratime->setRequired(true);
2898  $extratime->setMinValue(0);
2899  $extratime->setMinvalueShouldBeGreater(false);
2900  $extratime->setSuffix($this->lng->txt('minutes'));
2901  $extratime->setSize(5);
2902  $form->addItem($extratime);
2903 
2904  if (is_array($_POST) && strlen($_POST['cmd']['timing'])) $form->setValuesByArray($_POST);
2905 
2906  if ($ilAccess->checkAccess("write", "", $_GET["ref_id"])) $form->addCommandButton("timing", $this->lng->txt("save"));
2907  $form->addCommandButton('timingOverview', $this->lng->txt("cancel"));
2908  return $form;
2909  }
2910 
2911  public function showTimingFormObject()
2912  {
2913  $form = $this->formTimingObject();
2914  $this->tpl->setContent($form->getHTML());
2915  }
2916 
2917  function applyFilterCriteria($in_rows)
2918  {
2919  global $ilDB;
2920  $sess_filter = $_SESSION['form_tst_participants_' . $this->ref_id]['selection'];
2921  $sess_filter = str_replace('"','',$sess_filter);
2922  $sess_filter = explode(':', $sess_filter);
2923  $filter = substr($sess_filter[2],0, strlen($sess_filter[2])-1);
2924 
2925  if ($filter == 'all' || $filter == false)
2926  {
2927  return $in_rows; #unchanged - no filter.
2928  }
2929 
2930  $with_result = array();
2931  $without_result = array();
2932  foreach ($in_rows as $row)
2933  {
2934  $result = $ilDB->query(
2935  'SELECT count(solution_id) count
2936  FROM tst_solutions
2937  WHERE active_fi = ' . $ilDB->quote($row['active_id'])
2938  );
2939  $count = $ilDB->fetchAssoc($result);
2940  $count = $count['count'];
2941 
2942  if ($count == 0)
2943  {
2944  $without_result[] = $row;
2945  }
2946  else
2947  {
2948  $with_result[] = $row;
2949  }
2950  }
2951 
2952  if ($filter == 'withSolutions')
2953  {
2954  return $with_result;
2955  }
2956  return $without_result;
2957 
2958  }
2959 
2961  {
2962  include_once("./Modules/Test/classes/tables/class.ilTestFixedParticipantsTableGUI.php");
2963  $table_gui = new ilTestFixedParticipantsTableGUI($this, "participants", false, $this->object->getAnonymity(), 0);
2964  $table_gui->writeFilterToSession(); // writes filter to session
2965  $table_gui->resetOffset(); // sets record offest to 0 (first page)
2966  $this->participantsObject();
2967  }
2968 
2970  {
2971  include_once("./Modules/Test/classes/tables/class.ilTestFixedParticipantsTableGUI.php");
2972  $table_gui = new ilTestFixedParticipantsTableGUI(
2973  $this, "participants", false, $this->object->getAnonymity(), 0
2974  );
2975  $table_gui->resetFilter(); // writes filter to session
2976  $table_gui->resetOffset(); // sets record offest to 0 (first page)
2977  $this->participantsObject();
2978  }
2979 
2981  {
2982  include_once("./Modules/Test/classes/tables/class.ilTestParticipantsTableGUI.php");
2983  $table_gui = new ilTestParticipantsTableGUI(
2984  $this, "participants", false, $this->object->getAnonymity(), 0
2985  );
2986  $table_gui->writeFilterToSession(); // writes filter to session
2987  $table_gui->resetOffset(); // sets record offest to 0 (first page)
2988  $this->participantsObject();
2989 
2990  }
2991 
2993  {
2994  include_once("./Modules/Test/classes/tables/class.ilTestParticipantsTableGUI.php");
2995  $table_gui = new ilTestParticipantsTableGUI(
2996  $this, "participants", false, $this->object->getAnonymity(), 0
2997  );
2998  $table_gui->resetFilter(); // writes filter to session
2999  $table_gui->resetOffset(); // sets record offest to 0 (first page)
3000  $this->participantsObject();
3001 
3002  }
3003 
3010  {
3011  if (count($_POST))
3012  {
3013  $_SESSION["show_user_results"] = $_POST["chbUser"];
3014  }
3015  $this->showUserResults($show_pass_details = TRUE, $show_answers = TRUE, $show_reached_points = TRUE);
3016  }
3017 
3024  {
3025  if (count($_POST))
3026  {
3027  $_SESSION["show_user_results"] = $_POST["chbUser"];
3028  }
3029  $this->showUserResults($show_pass_details = FALSE, $show_answers = TRUE);
3030  }
3031 
3038  {
3039  if (count($_POST))
3040  {
3041  $_SESSION["show_user_results"] = $_POST["chbUser"];
3042  }
3043  $this->showUserResults($show_pass_details = TRUE, $show_answers = FALSE);
3044  }
3045 
3051  function showUserResults($show_pass_details, $show_answers, $show_reached_points = FALSE)
3052  {
3053  $show_user_results = $_SESSION["show_user_results"];
3054 
3055  if (count($show_user_results) == 0)
3056  {
3057  ilUtil::sendInfo($this->lng->txt("select_one_user"), TRUE);
3058  $this->ctrl->redirect($this, "participants");
3059  }
3060 
3061 
3062  $template = $this->createUserResults( $show_pass_details, $show_answers, $show_reached_points, $show_user_results);
3063 
3064  if($template instanceof ilTemplate)
3065  {
3066  $this->tpl->setVariable("ADM_CONTENT", $template->get());
3067  $this->tpl->addCss(ilUtil::getStyleSheetLocation("output", "test_print.css", "Modules/Test"), "print");
3068  if ($this->object->getShowSolutionAnswersOnly())
3069  {
3070  $this->tpl->addCss(ilUtil::getStyleSheetLocation("output", "test_print_hide_content.css", "Modules/Test"), "print");
3071  }
3072  }
3073  }
3074 
3076  {
3077  if (is_array($_POST["chbUser"]))
3078  {
3079  foreach ($_POST["chbUser"] as $user_id)
3080  {
3081  $this->object->disinviteUser($user_id);
3082  }
3083  }
3084  else
3085  {
3086  ilUtil::sendInfo($this->lng->txt("select_one_user"), true);
3087  }
3088  $this->ctrl->redirect($this, "participants");
3089  }
3090 
3092  {
3093  if (is_array($_POST["chbUser"]))
3094  {
3095  foreach ($_POST["chbUser"] as $user_id)
3096  {
3097  $this->object->setClientIP($user_id, $_POST["clientip_".$user_id]);
3098  }
3099  }
3100  else
3101  {
3102  ilUtil::sendInfo($this->lng->txt("select_one_user"), true);
3103  }
3104  $this->ctrl->redirect($this, "participants");
3105  }
3106 
3114  function printobject()
3115  {
3116  global $ilAccess, $ilias;
3117  if (!$ilAccess->checkAccess("write", "", $this->ref_id))
3118  {
3119  // allow only write access
3120  ilUtil::sendInfo($this->lng->txt("cannot_edit_test"), true);
3121  $this->ctrl->redirect($this, "infoScreen");
3122  }
3123 
3124  $isPdfDeliveryRequest = isset($_GET['pdf']) && $_GET['pdf'];
3125 
3126  $this->getQuestionsSubTabs();
3127  $template = new ilTemplate("tpl.il_as_tst_print_test_confirm.html", TRUE, TRUE, "Modules/Test");
3128 
3129  if(!$isPdfDeliveryRequest) // #15243
3130  {
3131  $this->ctrl->setParameter($this, "pdf", "1");
3132  $template->setCurrentBlock("pdf_export");
3133  $template->setVariable("PDF_URL", $this->ctrl->getLinkTarget($this, "print"));
3134  $this->ctrl->setParameter($this, "pdf", "");
3135  $template->setVariable("PDF_TEXT", $this->lng->txt("pdf_export"));
3136  $template->parseCurrentBlock();
3137 
3138  $template->setCurrentBlock("navigation_buttons");
3139  $template->setVariable("BUTTON_PRINT", $this->lng->txt("print"));
3140  $template->parseCurrentBlock();
3141  }
3142 
3143  $this->tpl->addCss(ilUtil::getStyleSheetLocation("output", "test_print.css", "Modules/Test"), "print");
3144 
3145  global $ilUser;
3146  $print_date = mktime(date("H"), date("i"), date("s"), date("m") , date("d"), date("Y"));
3147  $max_points= 0;
3148  $counter = 1;
3149 
3150  require_once 'Modules/Test/classes/class.ilTestQuestionHeaderBlockBuilder.php';
3151  $questionHeaderBlockBuilder = new ilTestQuestionHeaderBlockBuilder($this->lng);
3152  $questionHeaderBlockBuilder->setHeaderMode($this->object->getTitleOutput());
3153 
3154  if($isPdfDeliveryRequest)
3155  {
3156  require_once 'Services/WebAccessChecker/classes/class.ilWACSignedPath.php';
3158  }
3159 
3160  foreach ($this->object->questions as $question)
3161  {
3162  $template->setCurrentBlock("question");
3163  $question_gui = $this->object->createQuestionGUI("", $question);
3164 
3165  if( $isPdfDeliveryRequest )
3166  {
3167  $question_gui->setOutputMode(assQuestionGUI::OUTPUT_MODE_PDF);
3168  }
3169 
3170  $questionHeaderBlockBuilder->setQuestionTitle($question_gui->object->getTitle());
3171  $questionHeaderBlockBuilder->setQuestionPoints($question_gui->object->getMaximumPoints());
3172  $questionHeaderBlockBuilder->setQuestionPosition($counter);
3173  $template->setVariable("QUESTION_HEADER", $questionHeaderBlockBuilder->getHTML());
3174 
3175  $template->setVariable("TXT_QUESTION_ID", $this->lng->txt('question_id_short'));
3176  $template->setVariable("QUESTION_ID", $question_gui->object->getId());
3177  $result_output = $question_gui->getSolutionOutput("", NULL, FALSE, TRUE, FALSE, $this->object->getShowSolutionFeedback());
3178  if (strlen($result_output) == 0) $result_output = $question_gui->getPreview(FALSE);
3179  $template->setVariable("SOLUTION_OUTPUT", $result_output);
3180  $template->parseCurrentBlock("question");
3181  $counter ++;
3182  $max_points += $question_gui->object->getMaximumPoints();
3183  }
3184 
3185  $template->setVariable("TITLE", ilUtil::prepareFormOutput($this->object->getTitle()));
3186  $template->setVariable("PRINT_TEST", ilUtil::prepareFormOutput($this->lng->txt("tst_print")));
3187  $template->setVariable("TXT_PRINT_DATE", ilUtil::prepareFormOutput($this->lng->txt("date")));
3188  $template->setVariable("VALUE_PRINT_DATE", ilUtil::prepareFormOutput(strftime("%c",$print_date)));
3189  $template->setVariable("TXT_MAXIMUM_POINTS", ilUtil::prepareFormOutput($this->lng->txt("tst_maximum_points")));
3190  $template->setVariable("VALUE_MAXIMUM_POINTS", ilUtil::prepareFormOutput($max_points));
3191 
3192  if( $isPdfDeliveryRequest )
3193  {
3194  require_once 'class.ilTestPDFGenerator.php';
3195  ilTestPDFGenerator::generatePDF($template->get(), ilTestPDFGenerator::PDF_OUTPUT_DOWNLOAD, $this->object->getTitle());
3196  }
3197  else
3198  {
3199  $this->tpl->setVariable("PRINT_CONTENT", $template->get());
3200  }
3201  }
3202 
3210  function reviewobject()
3211  {
3212  global $ilAccess, $ilias;
3213  if (!$ilAccess->checkAccess("write", "", $this->ref_id))
3214  {
3215  // allow only write access
3216  ilUtil::sendInfo($this->lng->txt("cannot_edit_test"), true);
3217  $this->ctrl->redirect($this, "infoScreen");
3218  }
3219  $this->getQuestionsSubTabs();
3220  $template = new ilTemplate("tpl.il_as_tst_print_test_confirm.html", TRUE, TRUE, "Modules/Test");
3221 
3222  $this->tpl->addCss(ilUtil::getStyleSheetLocation("output", "test_print.css", "Modules/Test"), "print");
3223 
3224  $isPdfDeliveryRequest = isset($_GET['pdf']) && $_GET['pdf'];
3225 
3226  global $ilUser;
3227  $print_date = mktime(date("H"), date("i"), date("s"), date("m") , date("d"), date("Y"));
3228  $max_points= 0;
3229  $counter = 1;
3230 
3231  require_once 'Modules/Test/classes/class.ilTestQuestionHeaderBlockBuilder.php';
3232  $questionHeaderBlockBuilder = new ilTestQuestionHeaderBlockBuilder($this->lng);
3233  $questionHeaderBlockBuilder->setHeaderMode($this->object->getTitleOutput());
3234 
3235  if($isPdfDeliveryRequest)
3236  {
3237  require_once 'Services/WebAccessChecker/classes/class.ilWACSignedPath.php';
3239  }
3240 
3241  foreach ($this->object->questions as $question)
3242  {
3243  $template->setCurrentBlock("question");
3244  $question_gui = $this->object->createQuestionGUI("", $question);
3245 
3246  $questionHeaderBlockBuilder->setQuestionTitle($question_gui->object->getTitle());
3247  $questionHeaderBlockBuilder->setQuestionPoints($question_gui->object->getMaximumPoints());
3248  $questionHeaderBlockBuilder->setQuestionPosition($counter);
3249  $template->setVariable("QUESTION_HEADER", $questionHeaderBlockBuilder->getHTML());
3250 
3252  //$result_output = $question_gui->getTestOutput('', NULL, FALSE, FALSE, FALSE);
3253  $result_output = $question_gui->getPreview(false);
3254 
3255  if (strlen($result_output) == 0) $result_output = $question_gui->getPreview(FALSE);
3256  $template->setVariable("SOLUTION_OUTPUT", $result_output);
3257  $template->parseCurrentBlock("question");
3258  $counter ++;
3259  $max_points += $question_gui->object->getMaximumPoints();
3260  }
3261 
3262 
3263 
3264  $template->setVariable("TITLE", ilUtil::prepareFormOutput($this->object->getTitle()));
3265  $template->setVariable("PRINT_TEST", ilUtil::prepareFormOutput($this->lng->txt("review_view")));
3266  $template->setVariable("TXT_PRINT_DATE", ilUtil::prepareFormOutput($this->lng->txt("date")));
3267  $template->setVariable("VALUE_PRINT_DATE", ilUtil::prepareFormOutput(strftime("%c",$print_date)));
3268  $template->setVariable("TXT_MAXIMUM_POINTS", ilUtil::prepareFormOutput($this->lng->txt("tst_maximum_points")));
3269  $template->setVariable("VALUE_MAXIMUM_POINTS", ilUtil::prepareFormOutput($max_points));
3270 
3271  if($isPdfDeliveryRequest)
3272  {
3273  require_once 'class.ilTestPDFGenerator.php';
3274  ilTestPDFGenerator::generatePDF($template->get(), ilTestPDFGenerator::PDF_OUTPUT_DOWNLOAD, $this->object->getTitle());
3275  }
3276  else
3277  {
3278  $this->ctrl->setParameter($this, "pdf", "1");
3279  $template->setCurrentBlock("pdf_export");
3280  $template->setVariable("PDF_URL", $this->ctrl->getLinkTarget($this, "review"));
3281  $this->ctrl->setParameter($this, "pdf", "");
3282  $template->setVariable("PDF_TEXT", $this->lng->txt("pdf_export"));
3283  $template->parseCurrentBlock();
3284 
3285  $template->setCurrentBlock("navigation_buttons");
3286  $template->setVariable("BUTTON_PRINT", $this->lng->txt("print"));
3287  $template->parseCurrentBlock();
3288 
3289 
3290  $this->tpl->setVariable("PRINT_CONTENT", $template->get());
3291  }
3292  }
3293 
3294  function addParticipantsObject($a_user_ids = array())
3295  {
3296  $countusers = 0;
3297  // add users
3298  if (is_array($a_user_ids))
3299  {
3300  $i = 0;
3301  foreach ($a_user_ids as $user_id)
3302  {
3303  $client_ip = $_POST["client_ip"][$i];
3304  $this->object->inviteUser($user_id, $client_ip);
3305  $countusers++;
3306  $i++;
3307  }
3308  }
3309  $message = "";
3310  if ($countusers)
3311  {
3312  $message = $this->lng->txt("tst_invited_selected_users");
3313  }
3314  if (strlen($message))
3315  {
3316  ilUtil::sendInfo($message, TRUE);
3317  }
3318  else
3319  {
3320  ilUtil::sendInfo($this->lng->txt("tst_invited_nobody"), TRUE);
3321  return false;
3322  }
3323 
3324  $this->ctrl->redirect($this, "participants");
3325  }
3326 
3330  public function defaultsObject()
3331  {
3337  global $ilAccess, $ilToolbar, $tpl;
3338 
3339  if(!$ilAccess->checkAccess("write", "", $this->ref_id))
3340  {
3341  ilUtil::sendInfo($this->lng->txt("cannot_edit_test"), true);
3342  $this->ctrl->redirect($this, "infoScreen");
3343  }
3344 
3345  $ilToolbar->setFormAction($this->ctrl->getFormAction($this, 'addDefaults'));
3346  $ilToolbar->addFormButton($this->lng->txt('add'), 'addDefaults');
3347  require_once 'Services/Form/classes/class.ilTextInputGUI.php';
3348  $ilToolbar->addInputItem(new ilTextInputGUI($this->lng->txt('tst_defaults_defaults_of_test'), 'name'), true);
3349 
3350  require_once 'Modules/Test/classes/tables/class.ilTestPersonalDefaultSettingsTableGUI.php';
3351  $table = new ilTestPersonalDefaultSettingsTableGUI($this, 'defaults');
3352  $defaults = $this->object->getAvailableDefaults();
3353  $table->setData((array)$defaults);
3354  $tpl->setContent($table->getHTML());
3355  }
3356 
3360  public function deleteDefaultsObject()
3361  {
3362  if(isset($_POST['chb_defaults']) && is_array($_POST['chb_defaults']) && count($_POST['chb_defaults']))
3363  {
3364  foreach($_POST['chb_defaults'] as $test_default_id)
3365  {
3366  $this->object->deleteDefaults($test_default_id);
3367  }
3368  }
3369  else
3370  {
3371  ilUtil::sendInfo($this->lng->txt('select_one'));
3372  }
3373  $this->defaultsObject();
3374  }
3375 
3380  {
3381  $this->applyDefaultsObject(true);
3382  return;
3383  }
3384 
3388  public function applyDefaultsObject($confirmed = false)
3389  {
3390  if( count($_POST["chb_defaults"]) != 1 )
3391  {
3393  $this->lng->txt("tst_defaults_apply_select_one")
3394  );
3395 
3396  return $this->defaultsObject();
3397  }
3398 
3399  // do not apply if user datasets exist
3400  if($this->object->evalTotalPersons() > 0)
3401  {
3403  $this->lng->txt("tst_defaults_apply_not_possible")
3404  );
3405 
3406  return $this->defaultsObject();
3407  }
3408 
3409  $defaults =& $this->object->getTestDefaults($_POST["chb_defaults"][0]);
3410  $defaultSettings = unserialize($defaults["defaults"]);
3411 
3412  if( isset($defaultSettings['isRandomTest']) )
3413  {
3414  if( $defaultSettings['isRandomTest'] )
3415  {
3416  $newQuestionSetType = ilObjTest::QUESTION_SET_TYPE_RANDOM;
3417  $this->object->setQuestionSetType(ilObjTest::QUESTION_SET_TYPE_RANDOM);
3418  }
3419  else
3420  {
3421  $newQuestionSetType = ilObjTest::QUESTION_SET_TYPE_FIXED;
3422  $this->object->setQuestionSetType(ilObjTest::QUESTION_SET_TYPE_FIXED);
3423  }
3424  }
3425  elseif( isset($defaultSettings['questionSetType']) )
3426  {
3427  $newQuestionSetType = $defaultSettings['questionSetType'];
3428  }
3429  $oldQuestionSetType = $this->object->getQuestionSetType();
3430  $questionSetTypeSettingSwitched = ( $oldQuestionSetType != $newQuestionSetType );
3431 
3432  $oldQuestionSetConfig = $this->testQuestionSetConfigFactory->getQuestionSetConfigByType($oldQuestionSetType);
3433 
3434  switch( true )
3435  {
3436  case !$questionSetTypeSettingSwitched:
3437  case !$oldQuestionSetConfig->doesQuestionSetRelatedDataExist():
3438  case $confirmed:
3439 
3440  break;
3441 
3442  default:
3443 
3444  require_once 'Modules/Test/classes/confirmations/class.ilTestSettingsChangeConfirmationGUI.php';
3445  $confirmation = new ilTestSettingsChangeConfirmationGUI($this->lng, $this->object);
3446 
3447  $confirmation->setFormAction( $this->ctrl->getFormAction($this) );
3448  $confirmation->setCancel($this->lng->txt('cancel'), 'defaults');
3449  $confirmation->setConfirm($this->lng->txt('confirm'), 'confirmedApplyDefaults');
3450 
3451  $confirmation->setOldQuestionSetType($this->object->getQuestionSetType());
3452  $confirmation->setNewQuestionSetType($newQuestionSetType);
3453  $confirmation->setQuestionLossInfoEnabled(false);
3454  $confirmation->build();
3455 
3456  $confirmation->populateParametersFromPost();
3457 
3458  $this->tpl->setContent( $this->ctrl->getHTML($confirmation) );
3459 
3460  return;
3461  }
3462 
3463  if( $questionSetTypeSettingSwitched && $this->object->isOnline() )
3464  {
3465  $this->object->setOnline(false);
3466 
3467  $info = $this->lng->txt("tst_set_offline_due_to_switched_question_set_type_setting");
3468 
3469  ilUtil::sendInfo($info, true);
3470  }
3471 
3472  $this->object->applyDefaults($defaults);
3473 
3474  ilUtil::sendSuccess($this->lng->txt("tst_defaults_applied"), true);
3475 
3476  if( $questionSetTypeSettingSwitched && $oldQuestionSetConfig->doesQuestionSetRelatedDataExist() )
3477  {
3478  $oldQuestionSetConfig->removeQuestionSetRelatedData();
3479  }
3480 
3481  $this->ctrl->redirect($this, 'defaults');
3482  }
3483 
3488  {
3489  if (strlen($_POST["name"]) > 0)
3490  {
3491  $this->object->addDefaults($_POST['name']);
3492  }
3493  else
3494  {
3495  ilUtil::sendInfo($this->lng->txt("tst_defaults_enter_name"));
3496  }
3497  $this->defaultsObject();
3498  }
3499 
3501  {
3502  if( in_array($this->ctrl->getCmdClass(), self::$infoScreenChildClasses) )
3503  {
3504  return true;
3505  }
3506 
3507  return false;
3508  }
3509 
3515  function infoScreenObject()
3516  {
3517  #if( !include 'competenzenRocker.php' ) exit;
3518 
3519  $this->ctrl->setCmd("showSummary");
3520  $this->ctrl->setCmdClass("ilinfoscreengui");
3521  $this->infoScreen();
3522  }
3523 
3525  {
3526  $this->ctrl->setCmd("showSummary");
3527  $this->ctrl->setCmdClass("ilinfoscreengui");
3528  $this->infoScreen($_GET['lock']);
3529  }
3530 
3534  function infoScreen($session_lock = "")
3535  {
3541  global $ilAccess, $ilUser, $ilToolbar;
3542 
3543  require_once 'Modules/Test/classes/class.ilTestDynamicQuestionSetFilterSelection.php';
3544 
3545  require_once 'Services/UIComponent/Button/classes/class.ilLinkButton.php';
3546  require_once 'Services/UIComponent/Button/classes/class.ilSubmitButton.php';
3547 
3548  $testQuestionSetConfig = $this->testQuestionSetConfigFactory->getQuestionSetConfig();
3549  $testSession = $this->testSessionFactory->getSession();
3550  $testSequence = $this->testSequenceFactory->getSequenceByTestSession($testSession);
3551  $testSequence->loadFromDb();
3552  $testSequence->loadQuestions($testQuestionSetConfig, new ilTestDynamicQuestionSetFilterSelection());
3553  $big_button = array();
3554  $testPlayerGUI = $this->testPlayerFactory->getPlayerGUI();
3555 
3556  if ($_GET['createRandomSolutions'])
3557  {
3558  global $ilCtrl;
3559 
3560  $this->object->createRandomSolutions($_GET['createRandomSolutions']);
3561 
3562  $ilCtrl->redirect($this);
3563  }
3564 
3565  if (!$ilAccess->checkAccess("read", "", $this->ref_id))
3566  {
3567  $this->ilias->raiseError($this->lng->txt("msg_no_perm_read"),$this->ilias->error_obj->MESSAGE);
3568  }
3569 
3570  $this->trackTestObjectReadEvent();
3571 
3572  include_once("./Services/InfoScreen/classes/class.ilInfoScreenGUI.php");
3573  $info = new ilInfoScreenGUI($this);
3574 
3575  if( $this->isCommandClassAnyInfoScreenChild() )
3576  {
3577  return $this->ctrl->forwardCommand($info);
3578  }
3579 
3580  $this->ctrl->setParameter($testPlayerGUI, "sequence", $testSession->getLastSequence());
3581 
3582  $info->setFormAction($this->ctrl->getFormAction($testPlayerGUI));
3583 
3584  if (strlen($session_lock))
3585  {
3586  $info->addHiddenElement("lock", $session_lock);
3587  }
3588  else
3589  {
3590  $info->addHiddenElement("lock", md5($_COOKIE['PHPSESSID'] . time()));
3591  }
3592  $online_access = false;
3593  if ($this->object->getFixedParticipants())
3594  {
3595  include_once "./Modules/Test/classes/class.ilObjTestAccess.php";
3596  $online_access_result = ilObjTestAccess::_lookupOnlineTestAccess($this->object->getId(), $ilUser->getId());
3597  if ($online_access_result === true)
3598  {
3599  $online_access = true;
3600  }
3601  else
3602  {
3603  ilUtil::sendInfo($online_access_result);
3604  }
3605  }
3606 
3607  $enter_anonymous_code = false;
3608  if( $this->object->isOnline() && $this->object->isComplete( $this->testQuestionSetConfigFactory->getQuestionSetConfig() ) )
3609  {
3610  if ((!$this->object->getFixedParticipants() || $online_access) && $ilAccess->checkAccess("read", "", $this->ref_id))
3611  {
3612  $executable = $this->object->isExecutable($testSession, $ilUser->getId(), $allowPassIncrease = TRUE
3613  );
3614  if ($executable["executable"])
3615  {
3616  if( $this->object->areObligationsEnabled() && $this->object->hasObligations($this->object->getTestId()) )
3617  {
3618  ilUtil::sendInfo($GLOBALS['lng']->txt('tst_test_contains_obligatory_questions'));
3619  }
3620 
3621  if ($testSession->getActiveId() > 0)
3622  {
3623  // resume test
3624  require_once 'Modules/Test/classes/class.ilTestPassesSelector.php';
3625  $testPassesSelector = new ilTestPassesSelector($GLOBALS['ilDB'], $this->object);
3626  $testPassesSelector->setActiveId($testSession->getActiveId());
3627  $testPassesSelector->setLastFinishedPass($testSession->getLastFinishedPass());
3628 
3629  $closedPasses = $testPassesSelector->getClosedPasses();
3630  $existingPasses = $testPassesSelector->getExistingPasses();
3631 
3632  if ($existingPasses > $closedPasses)
3633  {
3634  $btn = ilSubmitButton::getInstance();
3635  $btn->setCaption('tst_resume_test');
3636  $btn->setCommand('resumePlayer');
3637  $btn->setPrimary(true);
3638  $big_button[] = $btn;
3639  }
3640  else
3641  {
3642  $btn = ilSubmitButton::getInstance();
3643  $btn->setCaption($this->object->getStartTestLabel($testSession->getActiveId()), false);
3644  $btn->setCommand('startPlayer');
3645  $btn->setPrimary(true);
3646  $big_button[] = $btn;
3647  }
3648  }
3649  else
3650  {
3651  // start new test
3652  $btn = ilSubmitButton::getInstance();
3653  $btn->setCaption($this->object->getStartTestLabel($testSession->getActiveId()), false);
3654  $btn->setCommand('startPlayer');
3655  $btn->setPrimary(true);
3656  $big_button[] = $btn;
3657  }
3658  }
3659  else
3660  {
3661  ilUtil::sendInfo($executable["errormessage"]);
3662  }
3663  if ($testSession->getActiveId() > 0)
3664  {
3665  // test results button
3666 
3667  require_once 'Modules/Test/classes/class.ilTestPassesSelector.php';
3668  $testPassesSelector = new ilTestPassesSelector($GLOBALS['ilDB'], $this->object);
3669  $testPassesSelector->setActiveId($testSession->getActiveId());
3670  $testPassesSelector->setLastFinishedPass($testSession->getLastFinishedPass());
3671 
3672  if ($this->object->canShowTestResults($testSession, $ilUser->getId()) && count($testPassesSelector->getReportablePasses()))
3673  {
3674  $btn = ilLinkButton::getInstance();
3675  $btn->setCaption('tst_show_results');
3676  $btn->setUrl($this->ctrl->getLinkTargetByClass('ilTestEvaluationGUI', 'outUserResultsOverview'));
3677  $btn->setPrimary(false);
3678  $big_button[] = $btn;
3679 
3680  if ($this->object->getHighscoreEnabled())
3681  {
3682  // Can also compare results then
3683  $btn = ilLinkButton::getInstance();
3684  $btn->setCaption('tst_show_toplist');
3685  $btn->setUrl($this->ctrl->getLinkTargetByClass('ilTestToplistGUI', 'outResultsToplist'));
3686  $btn->setPrimary(false);
3687  $big_button[] = $btn;
3688  }
3689 
3690  if( $this->object->isSkillServiceToBeConsidered() )
3691  {
3692  require_once 'Modules/Test/classes/class.ilTestSkillEvaluationGUI.php';
3693 
3694  $btn = ilLinkButton::getInstance();
3695  $btn->setCaption('tst_show_comp_results');
3696  $btn->setUrl($this->ctrl->getLinkTargetByClass('ilTestSkillEvaluationGUI', ilTestSkillEvaluationGUI::CMD_SHOW));
3697  $btn->setPrimary(false);
3698  $big_button[] = $btn;
3699  }
3700  }
3701 
3702  }
3703  }
3704  if ($testSession->getActiveId() > 0)
3705  {
3706  if ($this->object->canShowSolutionPrintview($ilUser->getId()))
3707  {
3708  $btn = ilLinkButton::getInstance();
3709  $btn->setCaption('tst_list_of_answers_show');
3710  $btn->setUrl($this->ctrl->getLinkTargetByClass('ilTestEvaluationGUI', 'outUserListOfAnswerPasses'));
3711  $btn->setPrimary(false);
3712  $big_button[] = $btn;
3713  }
3714  }
3715 
3716  if( $this->isDeleteDynamicTestResultsButtonRequired($testSession, $testSequence) )
3717  {
3718  $this->populateDeleteDynamicTestResultsButton($testSession, $big_button);
3719  }
3720 
3721  if($_SESSION["AccountId"] == ANONYMOUS_USER_ID)
3722  {
3723  $enter_anonymous_code = true;
3724  }
3725  }
3726 
3727  if( !$this->object->isOnline() && !$testQuestionSetConfig->areDepenciesBroken() )
3728  {
3729  $message = $this->lng->txt("test_is_offline");
3730 
3731  if($ilAccess->checkAccess("write", "", $this->ref_id))
3732  {
3733  $message .= "<br /><a href=\"".$this->ctrl->getLinkTargetByClass('ilobjtestsettingsgeneralgui')."\">".
3734  $this->lng->txt("test_edit_settings")."</a>";
3735  }
3736 
3737  ilUtil::sendInfo($message);
3738  }
3739 
3740  if( $this->object->isSkillServiceToBeConsidered() && $this->areSkillLevelThresholdsMissing() )
3741  {
3743  }
3744 
3745  if($ilAccess->checkAccess("write", "", $this->ref_id))
3746  {
3747  $testQuestionSetConfig = $this->testQuestionSetConfigFactory->getQuestionSetConfig();
3748 
3749  if( $testQuestionSetConfig->areDepenciesBroken() )
3750  {
3751  ilUtil::sendFailure( $testQuestionSetConfig->getDepenciesBrokenMessage($this->lng) );
3752 
3753  $big_button = array();
3754  $enter_anonymous_code = false;
3755  }
3756  elseif( $testQuestionSetConfig->areDepenciesInVulnerableState() )
3757  {
3758  ilUtil::sendInfo( $testQuestionSetConfig->getDepenciesInVulnerableStateMessage($this->lng) );
3759  }
3760  }
3761 
3762  if ($this->object->getShowInfo())
3763  {
3764  $info->enablePrivateNotes();
3765  }
3766 
3767  if($big_button || $enter_anonymous_code)
3768  {
3769  $ilToolbar->setFormAction($this->ctrl->getFormAction($testPlayerGUI));
3770 
3771  foreach($big_button as $button)
3772  {
3773  $ilToolbar->addButtonInstance($button);
3774  }
3775 
3776  if($enter_anonymous_code)
3777  {
3778  if($big_button)
3779  {
3780  $ilToolbar->addSeparator();
3781  }
3782 
3783  require_once 'Services/Form/classes/class.ilTextInputGUI.php';
3784  $anonymous_id = new ilTextInputGUI($this->lng->txt('enter_anonymous_code'), 'anonymous_id');
3785  $anonymous_id->setSize(8);
3786  $ilToolbar->addInputItem($anonymous_id, true);
3787  $ilToolbar->addFormButton($this->lng->txt('submit'), 'setAnonymousId');
3788  }
3789 
3790  $ilToolbar->setCloseFormTag(false);
3791  $info->setOpenFormTag(false);
3792  }
3793 
3794  if (strlen($this->object->getIntroduction()))
3795  {
3796  $info->addSection($this->lng->txt("tst_introduction"));
3797  $info->addProperty("", $this->object->prepareTextareaOutput($this->object->getIntroduction(), true).
3798  $info->getHiddenToggleButton());
3799  }
3800  else
3801  {
3802  $info->addSection("");
3803  $info->addProperty("", $info->getHiddenToggleButton());
3804  }
3805 
3806  $info->addSection($this->lng->txt("tst_general_properties"));
3807  if ($this->object->getShowInfo())
3808  {
3809  $info->addProperty($this->lng->txt("author"), $this->object->getAuthor());
3810  $info->addProperty($this->lng->txt("title"), $this->object->getTitle());
3811  }
3812  if( $this->object->isOnline() && $this->object->isComplete( $this->testQuestionSetConfigFactory->getQuestionSetConfig() ) )
3813  {
3814  if ((!$this->object->getFixedParticipants() || $online_access) && $ilAccess->checkAccess("read", "", $this->ref_id))
3815  {
3816  if ($this->object->getShowInfo() || !$this->object->getForceJS())
3817  {
3818  // use javascript
3819  $checked_javascript = false;
3820  if ($this->object->getJavaScriptOutput())
3821  {
3822  $checked_javascript = true;
3823  }
3824  }
3825  // hide previous results
3826  if(!$this->object->isRandomTest() && !$this->getObjectiveOrientedContainer()->isObjectiveOrientedPresentationRequired())
3827  {
3828  if ($this->object->getNrOfTries() != 1)
3829  {
3830  if ($this->object->getUsePreviousAnswers() == 0)
3831  {
3832  if ($this->object->getShowInfo())
3833  {
3834  $info->addProperty($this->lng->txt("tst_use_previous_answers"), $this->lng->txt("tst_dont_use_previous_answers"));
3835  }
3836  }
3837  else
3838  {
3839  $use_previous_answers = FALSE;
3840  if ($ilUser->prefs["tst_use_previous_answers"])
3841  {
3842  $checked_previous_answers = TRUE;
3843  }
3844  $info->addPropertyCheckbox($this->lng->txt("tst_use_previous_answers"), "chb_use_previous_answers", 1, $this->lng->txt("tst_use_previous_answers_user"), $checked_previous_answers);
3845  }
3846  }
3847  }
3848  }
3849  }
3850 
3851  $info->hideFurtherSections(false);
3852 
3853  if ($this->object->getShowInfo())
3854  {
3855  $info->addSection($this->lng->txt("tst_sequence_properties"));
3856  $info->addProperty($this->lng->txt("tst_sequence"), $this->lng->txt(($this->object->getSequenceSettings() == TEST_FIXED_SEQUENCE)? "tst_sequence_fixed":"tst_sequence_postpone"));
3857 
3858  $info->addSection($this->lng->txt("tst_heading_scoring"));
3859  $info->addProperty($this->lng->txt("tst_text_count_system"), $this->lng->txt(($this->object->getCountSystem() == COUNT_PARTIAL_SOLUTIONS)? "tst_count_partial_solutions":"tst_count_correct_solutions"));
3860  $info->addProperty($this->lng->txt("tst_score_mcmr_questions"), $this->lng->txt(($this->object->getMCScoring() == SCORE_ZERO_POINTS_WHEN_UNANSWERED)? "tst_score_mcmr_zero_points_when_unanswered":"tst_score_mcmr_use_scoring_system"));
3861  if ($this->object->isRandomTest())
3862  {
3863  $info->addProperty($this->lng->txt("tst_pass_scoring"), $this->lng->txt(($this->object->getPassScoring() == SCORE_BEST_PASS)? "tst_pass_best_pass":"tst_pass_last_pass"));
3864  }
3865 
3866  $info->addSection($this->lng->txt("tst_score_reporting"));
3867  $score_reporting_text = "";
3868  switch ($this->object->getScoreReporting())
3869  {
3870  case REPORT_AFTER_TEST:
3871  $score_reporting_text = $this->lng->txt("tst_report_after_test");
3872  break;
3873  case REPORT_ALWAYS:
3874  $score_reporting_text = $this->lng->txt("tst_report_after_first_question");
3875  break;
3876  case REPORT_AFTER_DATE:
3877  $score_reporting_text = $this->lng->txt("tst_report_after_date");
3878  break;
3879  case 4:
3880  $score_reporting_text = $this->lng->txt("tst_report_never");
3881  break;
3882  }
3883  $info->addProperty($this->lng->txt("tst_score_reporting"), $score_reporting_text);
3884  $reporting_date = $this->object->getReportingDate();
3885  if ($reporting_date)
3886  {
3887  #preg_match("/(\d{4})(\d{2})(\d{2})(\d{2})(\d{2})(\d{2})/", $reporting_date, $matches);
3888  #$txt_reporting_date = date($this->lng->text["lang_dateformat"] . " " . $this->lng->text["lang_timeformat"], mktime($matches[4], $matches[5], $matches[6], $matches[2], $matches[3], $matches[1]));
3889  #$info->addProperty($this->lng->txt("tst_score_reporting_date"), $txt_reporting_date);
3890  $info->addProperty($this->lng->txt('tst_score_reporting_date'),
3892  }
3893 
3894  $info->addSection($this->lng->txt("tst_session_settings"));
3895  $info->addProperty($this->lng->txt("tst_nr_of_tries"), ($this->object->getNrOfTries() == 0)?$this->lng->txt("unlimited"):$this->object->getNrOfTries());
3896  if ($this->object->getNrOfTries() != 1)
3897  {
3898  $info->addProperty($this->lng->txt("tst_nr_of_tries_of_user"), ($testSession->getPass() == false)?$this->lng->txt("tst_no_tries"):$testSession->getPass());
3899  }
3900 
3901  if ($this->object->getEnableProcessingTime())
3902  {
3903  $info->addProperty($this->lng->txt("tst_processing_time"), $this->object->getProcessingTime());
3904  }
3905  if (strlen($this->object->getAllowedUsers()) && ($this->object->getAllowedUsersTimeGap()))
3906  {
3907  $info->addProperty($this->lng->txt("tst_allowed_users"), $this->object->getAllowedUsers());
3908  }
3909 
3910  $starting_time = $this->object->getStartingTime();
3911  if ($starting_time && $this->object->isStartingTimeEnabled())
3912  {
3913  $info->addProperty($this->lng->txt("tst_starting_time"),
3915  }
3916  $ending_time = $this->object->getEndingTime();
3917  if ($ending_time && $this->object->isEndingTimeEnabled())
3918  {
3919  $info->addProperty($this->lng->txt("tst_ending_time"),
3921  }
3922  $info->addMetaDataSections($this->object->getId(),0, $this->object->getType());
3923  // forward the command
3924  }
3925 
3926  $this->ctrl->forwardCommand($info);
3927  }
3928 
3929  function addLocatorItems()
3930  {
3931  global $ilLocator;
3932  switch ($this->ctrl->getCmd())
3933  {
3934  case "run":
3935  case "infoScreen":
3936  case "redirectToInfoScreen":
3937  case "start":
3938  case "resume":
3939  case "previous":
3940  case "next":
3941  case "summary":
3942  case "finishTest":
3943  case "outCorrectSolution":
3944  case "passDetails":
3945  case "showAnswersOfUser":
3946  case "outUserResultsOverview":
3947  case "backFromSummary":
3948  case "show_answers":
3949  case "setsolved":
3950  case "resetsolved":
3951  case "outTestSummary":
3952  case "outQuestionSummary":
3953  case "gotoQuestion":
3954  case "selectImagemapRegion":
3955  case "confirmSubmitAnswers":
3956  case "finalSubmission":
3957  case "postpone":
3958  case "outUserPassDetails":
3959  case "checkPassword":
3960  $ilLocator->addItem($this->object->getTitle(), $this->ctrl->getLinkTarget($this, "infoScreen"), "", $_GET["ref_id"]);
3961  break;
3962  case "eval_stat":
3963  case "evalAllUsers":
3964  case "evalUserDetail":
3965  $ilLocator->addItem($this->object->getTitle(), $this->ctrl->getLinkTarget($this, "eval_stat"), "", $_GET["ref_id"]);
3966  break;
3967  case "create":
3968  case "save":
3969  case "cancel":
3970  case "importFile":
3971  case "cloneAll":
3972  case "importVerifiedFile":
3973  case "cancelImport":
3974  break;
3975  default:
3976  $ilLocator->addItem($this->object->getTitle(), $this->ctrl->getLinkTarget($this, ""), "", $_GET["ref_id"]);
3977  break;
3978  }
3979  }
3980 
3981  function getBrowseForQuestionsTab(&$tabs_gui)
3982  {
3983  global $ilAccess;
3984  if ($ilAccess->checkAccess("write", "", $this->ref_id))
3985  {
3986  $this->ctrl->saveParameterByClass($this->ctrl->getCmdClass(), 'q_id');
3987  // edit page
3988  $tabs_gui->setBackTarget($this->lng->txt("backtocallingtest"), $this->ctrl->getLinkTargetByClass($this->ctrl->getCmdClass(), "questions"));
3989  $tabs_gui->addTarget("tst_browse_for_questions",
3990  $this->ctrl->getLinkTarget($this, "browseForQuestions"),
3991  array("browseForQuestions", "filter", "resetFilter", "resetTextFilter", "insertQuestions"),
3992  "", "", TRUE
3993  );
3994  }
3995  }
3996 
3997  function getRandomQuestionsTab(&$tabs_gui)
3998  {
3999  global $ilAccess;
4000  if ($ilAccess->checkAccess("write", "", $this->ref_id))
4001  {
4002  // edit page
4003  $tabs_gui->setBackTarget($this->lng->txt("backtocallingtest"), $this->ctrl->getLinkTarget($this, "questions"));
4004  $tabs_gui->addTarget("random_selection",
4005  $this->ctrl->getLinkTarget($this, "randomQuestions"),
4006  array("randomQuestions"),
4007  "", ""
4008  );
4009  }
4010  }
4011 
4012  function statisticsObject()
4013  {
4014  }
4015 
4020  {
4021  include_once "./Services/Certificate/classes/class.ilCertificateGUI.php";
4022  include_once "./Modules/Test/classes/class.ilTestCertificateAdapter.php";
4023  $output_gui = new ilCertificateGUI(new ilTestCertificateAdapter($this->object));
4024  $output_gui->certificateEditor();
4025  }
4026 
4028  {
4029  global $ilTabs, $ilCtrl;
4030  $ilTabs->activateTab('assQuestions');
4031  $a_cmd = $ilCtrl->getCmd();
4032 
4033  if (!$this->object->isRandomTest())
4034  {
4035  #if (in_array($this->object->getEnabledViewMode(), array('both', 'express'))) {
4036  $questions_per_page = ($a_cmd == 'questions_per_page' || ($a_cmd == 'removeQuestions' && $_REQUEST['test_express_mode'])) ? true : false;
4037 
4038  $this->tabs_gui->addSubTabTarget(
4039  "questions_per_page_view",
4040  $this->ctrl->getLinkTargetByClass('iltestexpresspageobjectgui', 'showPage'),
4041  "", "", "", $questions_per_page);
4042  #}
4043  }
4044  include_once "Services/Administration/classes/class.ilSettingsTemplate.php";
4045  $template = new ilSettingsTemplate($this->object->getTemplate(), ilObjAssessmentFolderGUI::getSettingsTemplateConfig());
4046 
4047  if (!in_array('questions', $template->getHiddenTabs())) {
4048  // questions subtab
4049  $ilTabs->addSubTabTarget("edit_test_questions",
4050  $this->ctrl->getLinkTarget($this,'questions'),
4051  array("questions", "browseForQuestions", "questionBrowser", "createQuestion",
4052  "randomselect", "filter", "resetFilter", "insertQuestions",
4053  "back", "createRandomSelection", "cancelRandomSelect",
4054  "insertRandomSelection", "removeQuestions", "moveQuestions",
4055  "insertQuestionsBefore", "insertQuestionsAfter", "confirmRemoveQuestions",
4056  "cancelRemoveQuestions", "executeCreateQuestion", "cancelCreateQuestion",
4057  "addQuestionpool", "saveRandomQuestions", "saveQuestionSelectionMode"),
4058  "");
4059 
4060  if (in_array($a_cmd, array('questions', 'createQuestion')) || ($a_cmd == 'removeQuestions' && !$_REQUEST['test_express_mode']))
4061  $this->tabs_gui->activateSubTab('edit_test_questions');
4062  }
4063  #}
4064 
4065  // print view subtab
4066  if (!$this->object->isRandomTest())
4067  {
4068  $ilTabs->addSubTabTarget("print_view",
4069  $this->ctrl->getLinkTarget($this,'print'),
4070  "print", "", "", $this->ctrl->getCmd() == 'print');
4071  $ilTabs->addSubTabTarget('review_view',
4072  $this->ctrl->getLinkTarget($this, 'review'),
4073  'review', '', '', $this->ctrl->getCmd() == 'review');
4074  }
4075 
4076 
4077  }
4078 
4080  {
4081  global $ilTabs;
4082 
4083  // user results subtab
4084  $ilTabs->addSubTabTarget("eval_all_users",
4085  $this->ctrl->getLinkTargetByClass("iltestevaluationgui", "outEvaluation"),
4086  array("outEvaluation", "detailedEvaluation", "exportEvaluation", "evalUserDetail", "passDetails",
4087  "outStatisticsResultsOverview", "statisticsPassDetails")
4088  , "");
4089 
4090  // aggregated results subtab
4091  $ilTabs->addSubTabTarget("tst_results_aggregated",
4092  $this->ctrl->getLinkTargetByClass("iltestevaluationgui", "eval_a"),
4093  array("eval_a"),
4094  "", "");
4095 
4096  // question export
4097  $ilTabs->addSubTabTarget("tst_single_results",
4098  $this->ctrl->getLinkTargetByClass("iltestevaluationgui", "singleResults"),
4099  array("singleResults"),
4100  "", "");
4101  }
4102 
4103  function getSettingsSubTabs($hiddenTabs = array())
4104  {
4108  global $ilTabs, $ilias;
4109 
4110  // general subtab
4111  $ilTabs->addSubTabTarget('general', $this->ctrl->getLinkTargetByClass('ilObjTestSettingsGeneralGUI'),
4112  '', // auto activation regardless from cmd
4113  array('ilobjtestsettingsgeneralgui') // auto activation for ilObjTestSettingsGeneralGUI
4114  );
4115 
4116  if(!in_array('mark_schema', $hiddenTabs))
4117  {
4118  $ilTabs->addSubTabTarget(
4119  'mark_schema',
4120  $this->ctrl->getLinkTargetByClass('ilmarkschemagui', 'showMarkSchema'),
4121  '',
4122  array('ilmarkschemagui')
4123  );
4124  }
4125 
4126  // scoring subtab
4127  $ilTabs->addSubTabTarget('scoring', $this->ctrl->getLinkTargetByClass('ilObjTestSettingsScoringResultsGUI'),
4128  '', // auto activation regardless from cmd
4129  array('ilobjtestsettingsscoringresultsgui') // auto activation for ilObjTestSettingsScoringResultsGUI
4130  );
4131 
4132  // certificate subtab
4133  include_once "Services/Certificate/classes/class.ilCertificate.php";
4134  if( !in_array('certificate', $hiddenTabs) && ilCertificate::isActive())
4135  {
4136  $ilTabs->addSubTabTarget(
4137  "certificate",
4138  $this->ctrl->getLinkTarget($this,'certificate'),
4139  array("certificate", "certificateEditor", "certificateRemoveBackground", "certificateSave",
4140  "certificatePreview", "certificateDelete", "certificateUpload", "certificateImport"),
4141  array("", "ilobjtestgui", "ilcertificategui")
4142  );
4143  }
4144 
4145  if (!in_array('defaults', $hiddenTabs)) {
4146  // defaults subtab
4147  $ilTabs->addSubTabTarget(
4148  "tst_default_settings",
4149  $this->ctrl->getLinkTarget($this, "defaults"),
4150  array("defaults", "deleteDefaults", "addDefaults", "applyDefaults"),
4151  array("", "ilobjtestgui", "ilcertificategui")
4152  );
4153  }
4154  }
4155 
4157  {
4158  global $ilTabs;
4159 
4160  // participants subtab
4161  $ilTabs->addSubTabTarget( "participants",
4162  $this->ctrl->getLinkTarget($this,'participants'),
4163  array(
4164  "participants", "saveClientIP",
4165  "removeParticipant",
4166  "showParticipantAnswersForAuthor",
4167  "deleteAllUserResults",
4168  "cancelDeleteAllUserData", "deleteSingleUserResults",
4169  "outParticipantsResultsOverview", "outParticipantsPassDetails",
4170  "showPassOverview", "showUserAnswers", "participantsAction",
4171  "showDetailedResults",
4172  'npResetFilter', 'npSetFilter'
4173  ),
4174  ""
4175  );
4176 
4177  if( !$this->testQuestionSetConfigFactory->getQuestionSetConfig()->areDepenciesBroken() )
4178  {
4179  if($this->object->getProcessingTimeInSeconds() > 0 && $this->object->getNrOfTries() == 1)
4180  {
4181  // extratime subtab
4182  $ilTabs->addSubTabTarget( "timing",
4183  $this->ctrl->getLinkTarget($this,'timingOverview'),
4184  array("timing", "timingOverview"), "", ""
4185  );
4186  }
4187  }
4188  }
4189 
4195  function getTabs(&$tabs_gui)
4196  {
4197  global $ilAccess, $ilUser, $ilHelp;
4198 
4199  if (preg_match('/^ass(.*?)gui$/i', $this->ctrl->getNextClass($this))) {
4200  return;
4201  }
4202  else if ($this->ctrl->getNextClass($this) == 'ilassquestionpagegui') {
4203  return;
4204  }
4205 
4206  $ilHelp->setScreenIdComponent("tst");
4207 
4208  $hidden_tabs = array();
4209 
4210  $template = $this->object->getTemplate();
4211  if($template)
4212  {
4213  include_once "Services/Administration/classes/class.ilSettingsTemplate.php";
4215 
4216  $hidden_tabs = $template->getHiddenTabs();
4217  }
4218 
4219  // for local use in this fucking sledge hammer method
4220  $curUserHasWriteAccess = $ilAccess->checkAccess("write", "", $this->ref_id);
4221 
4222  switch($this->ctrl->getCmdClass())
4223  {
4224  // no tabs .. no subtabs .. during test pass
4225  case 'iltestoutputgui':
4226 
4227  // tab handling happens within GUIs
4228  case 'iltestevaluationgui':
4229  $nonSelfTabbingCommands = array(
4230  'outParticipantsResultsOverview', 'outEvaluation',
4231  'eval_a', 'singleResults', 'detailedEvaluation'
4232  );
4233  if( in_array($this->ctrl->getCmd(), $nonSelfTabbingCommands) )
4234  {
4235  break;
4236  }
4237  case 'iltestevalobjectiveorientedgui':
4238  return;
4239 
4240  case 'ilmarkschemagui':
4241  case 'ilobjtestsettingsgeneralgui':
4242  case 'ilobjtestsettingsscoringresultsgui':
4243 
4244  if( $curUserHasWriteAccess )
4245  {
4246  $this->getSettingsSubTabs($hidden_tabs);
4247  }
4248 
4249  break;
4250  }
4251 
4252  if( $this->getObjectiveOrientedContainer()->isObjectiveOrientedPresentationRequired() )
4253  {
4254  require_once 'Services/Link/classes/class.ilLink.php';
4255  $courseLink = ilLink::_getLink($this->getObjectiveOrientedContainer()->getRefId());
4256  $tabs_gui->setBack2Target($this->lng->txt('back_to_objective_container'), $courseLink);
4257  }
4258 
4259  switch($this->ctrl->getCmd())
4260  {
4261  case "resume":
4262  case "previous":
4263  case "next":
4264  case "summary":
4265  case "directfeedback":
4266  case "finishTest":
4267  case "outCorrectSolution":
4268  case "passDetails":
4269  case "showAnswersOfUser":
4270  case "outUserResultsOverview":
4271  case "backFromSummary":
4272  case "show_answers":
4273  case "setsolved":
4274  case "resetsolved":
4275  case "confirmFinish":
4276  case "outTestSummary":
4277  case "outQuestionSummary":
4278  case "gotoQuestion":
4279  case "selectImagemapRegion":
4280  case "confirmSubmitAnswers":
4281  case "finalSubmission":
4282  case "postpone":
4283  case "outUserPassDetails":
4284  case "checkPassword":
4285  case "exportCertificate":
4286  case "finishListOfAnswers":
4287  case "backConfirmFinish":
4288  case "showFinalStatement":
4289  return;
4290  break;
4291  case "browseForQuestions":
4292  case "filter":
4293  case "resetFilter":
4294  case "resetTextFilter":
4295  case "insertQuestions":
4296  // #8497: resetfilter is also used in lp
4297  if($this->ctrl->getNextClass($this) != "illearningprogressgui")
4298  {
4299  return $this->getBrowseForQuestionsTab($tabs_gui);
4300  }
4301  break;
4302  case "scoring":
4303  case "certificate":
4304  case "certificateservice":
4305  case "certificateImport":
4306  case "certificateUpload":
4307  case "certificateEditor":
4308  case "certificateDelete":
4309  case "certificateSave":
4310  case "defaults":
4311  case "deleteDefaults":
4312  case "addDefaults":
4313  case "applyDefaults":
4314  case "inviteParticipants":
4315  case "searchParticipants":
4316  if( $curUserHasWriteAccess && in_array($this->ctrl->getCmdClass(), array('ilobjtestgui', 'ilcertificategui')) )
4317  {
4318  $this->getSettingsSubTabs($hidden_tabs);
4319  }
4320  break;
4321  case "export":
4322  case "print":
4323  break;
4324  case "statistics":
4325  case "eval_a":
4326  case "detailedEvaluation":
4327  case "outEvaluation":
4328  case "singleResults":
4329  case "exportEvaluation":
4330  case "evalUserDetail":
4331  case "outStatisticsResultsOverview":
4332  case "statisticsPassDetails":
4333  $this->getStatisticsSubTabs();
4334  break;
4335  }
4336 
4337  if (strcmp(strtolower(get_class($this->object)), "ilobjtest") == 0)
4338  {
4339  // questions tab
4340  if ($ilAccess->checkAccess("write", "", $this->ref_id) && !in_array('assQuestions', $hidden_tabs))
4341  {
4342  $force_active = ($_GET["up"] != "" || $_GET["down"] != "")
4343  ? true
4344  : false;
4345  if (!$force_active)
4346  {
4347  if ($_GET["browse"] == 1) $force_active = true;
4348  }
4349 
4350  switch( $this->object->getQuestionSetType() )
4351  {
4353  $target = $this->ctrl->getLinkTargetByClass('iltestexpresspageobjectgui','showPage');
4354  break;
4355 
4357  $target = $this->ctrl->getLinkTargetByClass('ilTestRandomQuestionSetConfigGUI');
4358  break;
4359 
4361  $target = $this->ctrl->getLinkTargetByClass('ilObjTestDynamicQuestionSetConfigGUI');
4362  break;
4363  }
4364 
4365  $tabs_gui->addTarget("assQuestions",
4366  //$this->ctrl->getLinkTarget($this,'questions'),
4367  $target,
4368  array("questions", "browseForQuestions", "questionBrowser", "createQuestion",
4369  "randomselect", "filter", "resetFilter", "insertQuestions",
4370  "back", "createRandomSelection", "cancelRandomSelect",
4371  "insertRandomSelection", "removeQuestions", "moveQuestions",
4372  "insertQuestionsBefore", "insertQuestionsAfter", "confirmRemoveQuestions",
4373  "cancelRemoveQuestions", "executeCreateQuestion", "cancelCreateQuestion",
4374  "addQuestionpool", "saveRandomQuestions", "saveQuestionSelectionMode", "print",
4375  "addsource", "removesource", "randomQuestions"),
4376  "", "", $force_active);
4377  }
4378 
4379  // info tab
4380  if ($ilAccess->checkAccess("read", "", $this->ref_id) && !in_array('info_short', $hidden_tabs))
4381  {
4382  $tabs_gui->addTarget("info_short",
4383  $this->ctrl->getLinkTarget($this,'infoScreen'),
4384  array("infoScreen", "outIntroductionPage", "showSummary",
4385  "setAnonymousId", "outUserListOfAnswerPasses", "redirectToInfoScreen"));
4386  }
4387 
4388  // settings tab
4389  if ($ilAccess->checkAccess("write", "", $this->ref_id))
4390  {
4391  if (!in_array('settings', $hidden_tabs))
4392  {
4393  $settingsCommands = array(
4394  "marks", "showMarkSchema","addMarkStep", "deleteMarkSteps", "addSimpleMarkSchema", "saveMarks",
4395  "certificate", "certificateEditor", "certificateRemoveBackground", "certificateSave",
4396  "certificatePreview", "certificateDelete", "certificateUpload", "certificateImport",
4397  "scoring", "defaults", "addDefaults", "deleteDefaults", "applyDefaults",
4398  "inviteParticipants", "saveFixedParticipantsStatus", "searchParticipants", "addParticipants" // ARE THEY RIGHT HERE
4399  );
4400 
4401  require_once 'Modules/Test/classes/class.ilObjTestSettingsGeneralGUI.php';
4402  $reflection = new ReflectionClass('ilObjTestSettingsGeneralGUI');
4403  foreach($reflection->getConstants() as $name => $value)
4404  if(substr($name, 0, 4) == 'CMD_') $settingsCommands[] = $value;
4405 
4406  require_once 'Modules/Test/classes/class.ilObjTestSettingsScoringResultsGUI.php';
4407  $reflection = new ReflectionClass('ilObjTestSettingsScoringResultsGUI');
4408  foreach($reflection->getConstants() as $name => $value)
4409  if(substr($name, 0, 4) == 'CMD_') $settingsCommands[] = $value;
4410 
4411  $settingsCommands[] = ""; // DO NOT KNOW WHAT THIS IS DOING, BUT IT'S REQUIRED
4412 
4413  $tabs_gui->addTarget("settings",
4414  $this->ctrl->getLinkTargetByClass('ilObjTestSettingsGeneralGUI'),
4415  $settingsCommands,
4416  array("ilmarkschemagui", "ilobjtestsettingsgeneralgui", "ilobjtestsettingsscoringresultsgui", "ilobjtestgui", "ilcertificategui")
4417  );
4418  }
4419 
4420  // skill service
4421  if( $this->object->isSkillServiceEnabled() && ilObjTest::isSkillManagementGloballyActivated() )
4422  {
4423  require_once 'Modules/TestQuestionPool/classes/class.ilAssQuestionSkillAssignmentsGUI.php';
4424 
4425  $link = $this->ctrl->getLinkTargetByClass(
4426  array('ilTestSkillAdministrationGUI', 'ilAssQuestionSkillAssignmentsGUI'),
4428  );
4429 
4430  $tabs_gui->addTarget('tst_tab_competences', $link, array(), array());
4431  }
4432 
4433  if (!in_array('participants', $hidden_tabs))
4434  {
4435  // participants
4436  $tabs_gui->addTarget("participants",
4437  $this->ctrl->getLinkTarget($this,'participants'),
4438  array(
4439  "participants", "saveClientIP",
4440  "removeParticipant",
4441  "showParticipantAnswersForAuthor",
4442  "deleteAllUserResults",
4443  "cancelDeleteAllUserData", "deleteSingleUserResults",
4444  "outParticipantsResultsOverview", "outParticipantsPassDetails",
4445  "showPassOverview", "showUserAnswers", "participantsAction",
4446  "showDetailedResults",
4447  'timing', 'timingOverview', 'npResetFilter', 'npSetFilter', 'showTimingForm'
4448  ),
4449  ""
4450  );
4451  }
4452  }
4453 
4454  include_once './Services/Tracking/classes/class.ilLearningProgressAccess.php';
4455  if(ilLearningProgressAccess::checkAccess($this->object->getRefId()) && !in_array('learning_progress', $hidden_tabs))
4456  {
4457  $tabs_gui->addTarget('learning_progress',
4458  $this->ctrl->getLinkTargetByClass(array('illearningprogressgui'),''),
4459  '',
4460  array('illplistofobjectsgui','illplistofsettingsgui','illearningprogressgui','illplistofprogressgui'));
4461  }
4462 
4463  if ($ilAccess->checkAccess("write", "", $this->ref_id) && !in_array('manscoring', $hidden_tabs))
4464  {
4465  include_once "./Modules/Test/classes/class.ilObjAssessmentFolder.php";
4467  if (count($scoring))
4468  {
4469  // scoring tab
4470  $tabs_gui->addTarget(
4471  "manscoring", $this->ctrl->getLinkTargetByClass('ilTestScoringGUI', 'showManScoringParticipantsTable'),
4472  array(
4473  'showManScoringParticipantsTable', 'applyManScoringParticipantsFilter', 'resetManScoringParticipantsFilter', 'showManScoringParticipantScreen',
4474  'showManScoringByQuestionParticipantsTable', 'applyManScoringByQuestionFilter', 'resetManScoringByQuestionFilter', 'saveManScoringByQuestion'
4475 
4476  ), ''
4477  );
4478  }
4479  }
4480 
4481  // Scoring Adjustment
4482  $setting = new ilSetting('assessment');
4483  $scoring_adjust_active = (bool) $setting->get('assessment_adjustments_enabled', false);
4484  if ($ilAccess->checkAccess("write", "", $this->ref_id) && $scoring_adjust_active && !in_array('scoringadjust', $hidden_tabs))
4485  {
4486  // scoring tab
4487  $tabs_gui->addTarget(
4488  "scoringadjust", $this->ctrl->getLinkTargetByClass('ilScoringAdjustmentGUI', 'showquestionlist'),
4489  array(
4490  'showquestionlist',
4491  'savescoringfortest',
4492  'adjustscoringfortest'
4493  ), ''
4494  );
4495  }
4496 
4497  if ((($ilAccess->checkAccess("tst_statistics", "", $this->ref_id)) || ($ilAccess->checkAccess("write", "", $this->ref_id))) && !in_array('statistics', $hidden_tabs))
4498  {
4499  // statistics tab
4500  $tabs_gui->addTarget(
4501  "statistics",
4502  $this->ctrl->getLinkTargetByClass("iltestevaluationgui", "outEvaluation"),
4503  array(
4504  "statistics", "outEvaluation", "exportEvaluation", "detailedEvaluation", "eval_a", "evalUserDetail",
4505  "passDetails", "outStatisticsResultsOverview", "statisticsPassDetails", "singleResults"
4506  ),
4507  ""
4508  );
4509  }
4510 
4511  if ($ilAccess->checkAccess("write", "", $this->ref_id))
4512  {
4513  if (!in_array('history', $hidden_tabs)) {
4514 
4515  // history
4516  $tabs_gui->addTarget("history",
4517  $this->ctrl->getLinkTarget($this,'history'),
4518  "history", "");
4519  }
4520 
4521  if (!in_array('meta_data', $hidden_tabs)) {
4522  // meta data
4523  include_once "Services/Object/classes/class.ilObjectMetaDataGUI.php";
4524  $mdgui = new ilObjectMetaDataGUI($this->object);
4525  $mdtab = $mdgui->getTab();
4526  if($mdtab)
4527  {
4528  $tabs_gui->addTarget("meta_data",
4529  $mdtab,
4530  "", "ilmdeditorgui");
4531  }
4532  }
4533 
4534  if(!in_array('export', $hidden_tabs))
4535  {
4536  // export tab
4537  $tabs_gui->addTarget(
4538  "export",
4539  $this->ctrl->getLinkTargetByClass('iltestexportgui' ,''),
4540  '',
4541  array('iltestexportgui')
4542  );
4543  }
4544  }
4545 
4546  if ($ilAccess->checkAccess("edit_permission", "", $this->ref_id)&& !in_array('permissions', $hidden_tabs))
4547  {
4548  $tabs_gui->addTarget("perm_settings",
4549  $this->ctrl->getLinkTargetByClass(array(get_class($this),'ilpermissiongui'), "perm"), array("perm","info","owner"), 'ilpermissiongui');
4550  }
4551  }
4552 
4553  if( $this->testQuestionSetConfigFactory->getQuestionSetConfig()->areDepenciesBroken() )
4554  {
4555  $hideTabs = $this->testQuestionSetConfigFactory->getQuestionSetConfig()->getHiddenTabsOnBrokenDepencies();
4556 
4557  foreach($hideTabs as $tabId)
4558  {
4559  $tabs_gui->removeTab($tabId);
4560  }
4561  }
4562  }
4563 
4572  public static function _goto($a_target)
4573  {
4574  global $ilAccess, $ilErr, $lng;
4575 
4576  if ($ilAccess->checkAccess("read", "", $a_target))
4577  {
4578  //include_once "./Services/Utilities/classes/class.ilUtil.php";
4579  $_GET["baseClass"] = "ilObjTestGUI";
4580  $_GET["cmd"] = "infoScreen";
4581  $_GET["ref_id"] = $a_target;
4582  include_once("ilias.php");
4583  exit;
4584  //ilUtil::redirect("ilias.php?baseClass=ilObjTestGUI&cmd=infoScreen&ref_id=$a_target");
4585  }
4586  else if ($ilAccess->checkAccess("read", "", ROOT_FOLDER_ID))
4587  {
4588  ilUtil::sendInfo(sprintf($lng->txt("msg_no_perm_read_item"),
4589  ilObject::_lookupTitle(ilObject::_lookupObjId($a_target))), true);
4591  }
4592 
4593  $ilErr->raiseError($lng->txt("msg_no_perm_read_lm"), $ilErr->FATAL);
4594  }
4595 
4602  function buildPageViewToolbar($qid = 0)
4603  {
4604  if($this->create_question_mode)
4605  return;
4606 
4607  global $ilToolbar, $ilCtrl, $lng;
4608 
4609  require_once 'Services/UIComponent/Button/classes/class.ilLinkButton.php';
4610 
4611  $this->getQuestionsSubTabs();
4612 
4613  $ilCtrl->saveParameter($this, 'q_mode');
4614 
4615  $ilCtrl->setParameterByClass('iltestexpresspageobjectgui', 'test_express_mode', 1);
4616  $ilCtrl->setParameter($this, 'test_express_mode', 1);
4617  $ilCtrl->setParameterByClass('iltestexpresspageobjectgui', 'q_id', $_REQUEST['q_id']);
4618  $ilCtrl->setParameter($this, 'q_id', $_REQUEST['q_id']);
4619  $ilToolbar->setFormAction($ilCtrl->getFormActionByClass('iltestexpresspageobjectgui', 'edit'));
4620 
4621  if($this->object->evalTotalPersons() == 0)
4622  {
4623  /*
4624  include_once 'Modules/TestQuestionPool/classes/class.ilObjQuestionPool.php';
4625  $pool = new ilObjQuestionPool();
4626  $questionTypes = $pool->getQuestionTypes();$options = array();
4627  foreach($questionTypes as $label => $data) {
4628  $options[$data['question_type_id']] = $label;
4629  }
4630 
4631  include_once("./Services/Form/classes/class.ilSelectInputGUI.php");
4632  $si = new ilSelectInputGUI($lng->txt("test_add_new_question"), "qtype");
4633  $si->setOptions($options);
4634  $ilToolbar->addInputItem($si, true);
4635  /*
4636  // use pool
4637  if ($this->object->isExpressModeQuestionPoolAllowed()) {
4638  include_once("./Services/Form/classes/class.ilCheckboxInputGUI.php");
4639  $cb = new ilCheckboxInputGUI($lng->txt("test_use_pool"), "use_pool");
4640  $ilToolbar->addInputItem($cb, true);
4641  }
4642  */
4643  $ilToolbar->addFormButton($lng->txt("ass_create_question"), "addQuestion");
4644 
4645  $ilToolbar->addSeparator();
4646 
4647  if($this->object->getPoolUsage())
4648  {
4649  require_once 'Modules/Test/classes/tables/class.ilTestQuestionBrowserTableGUI.php';
4650 
4652 
4653  $show_separator = true;
4654  }
4655  }
4656 
4657  $questions = $this->object->getQuestionTitlesAndIndexes();
4658 
4659  // desc
4660  $options = array();
4661  foreach($questions as $id => $label)
4662  {
4663  $options[$id] = $label . ' ['. $this->lng->txt('question_id_short') . ': ' . $id . ']';
4664  }
4665 
4666  $optionKeys = array_keys($options);
4667 
4668  if(!$options)
4669  {
4670  $options[] = $lng->txt('none');
4671  }
4672  //else if (count($options) > 1) {
4673 // $addSeparator = false;
4674 // if ($optionKeys[0] != $qid) {
4675 // //$ilToolbar->addFormButton($lng->txt("test_prev_question"), "prevQuestion");
4676 // $ilToolbar->addLink($lng->txt("test_prev_question"), $ilCtrl->getLinkTargetByClass('iltestexpresspageobjectgui', 'prevQuestion'));
4677 // $addSeparator = true;
4678 // }
4679 // else {
4680 // $ilToolbar->addSpacer(45);
4681 // }
4682 //
4683 // if ($optionKeys[count($optionKeys)-1] != $qid) {
4684 // //$ilToolbar->addFormButton($lng->txt("test_next_question"), "nextQuestion");
4685 // $ilToolbar->addLink($lng->txt("test_next_question"), $ilCtrl->getLinkTargetByClass('iltestexpresspageobjectgui', 'nextQuestion'));
4686 // $addSeparator = true;
4687 // }
4688 // else {
4689 // $ilToolbar->addSpacer(45);
4690 // }
4691 //
4692 // //if ($addSeparator) {
4693 // $ilToolbar->addSeparator();
4694 // //}
4695 
4696  if(count($questions))
4697  {
4698  if(isset($show_separator) && $show_separator)
4699  {
4700  $ilToolbar->addSeparator();
4701  }
4702 
4703  $btn = ilLinkButton::getInstance();
4704  $btn->setCaption("test_prev_question");
4705  $btn->setUrl($ilCtrl->getLinkTargetByClass('iltestexpresspageobjectgui', 'prevQuestion'));
4706  $ilToolbar->addButtonInstance($btn);
4707 
4708  if( count($options) <= 1 || $optionKeys[0] == $qid )
4709  {
4710  $btn->setDisabled(true);
4711  }
4712 
4713  $btn = ilLinkButton::getInstance();
4714  $btn->setCaption("test_next_question");
4715  $btn->setUrl($ilCtrl->getLinkTargetByClass('iltestexpresspageobjectgui', 'nextQuestion'));
4716  $ilToolbar->addButtonInstance($btn);
4717 
4718  if( count($options) <= 1 || $optionKeys[count($optionKeys) - 1] == $qid )
4719  {
4720  $btn->setDisabled(true);
4721  }
4722  }
4723 
4724  if(count($questions) > 1)
4725  {
4726 
4727  $ilToolbar->addSeparator();
4728 
4729  include_once("./Services/Form/classes/class.ilSelectInputGUI.php");
4730  $si = new ilSelectInputGUI($lng->txt("test_jump_to"), "q_id");
4731  $si->addCustomAttribute("onChange=\"forms['ilToolbar'].submit();\"");
4732  $si->setOptions($options);
4733 
4734  if($qid)
4735  {
4736  $si->setValue($qid);
4737  }
4738 
4739  $ilToolbar->addInputItem($si, true);
4740  }
4741 
4742  $total = $this->object->evalTotalPersons();
4743 
4744  /*if (count($options)) {
4745  include_once("./Services/Form/classes/class.ilSelectInputGUI.php");
4746  $si = new ilSelectInputGUI($lng->txt("test_jump_to"), "q_id");
4747  $si->addCustomAttribute("onChange=\"forms['ilToolbar'].submit();\"");
4748  $si->setOptions($options);
4749 
4750  if ($qid) {
4751  $si->setValue($qid);
4752  }
4753 
4754  $ilToolbar->addInputItem($si, true);
4755  }*/
4756 
4757  if(count($questions) && !$total)
4758  {
4759  $ilCtrl->setParameter($this, 'q_id', $_REQUEST['q_id']);
4760  $ilToolbar->addSeparator();
4761  $ilToolbar->addButton($lng->txt("test_delete_page"), $ilCtrl->getLinkTarget($this, "removeQuestions"));
4762  }
4763 
4764  if(count($questions) > 1 && !$total)
4765  {
4766  $ilToolbar->addSeparator();
4767  $ilToolbar->addButton($lng->txt("test_move_page"), $ilCtrl->getLinkTarget($this, "movePageForm"));
4768  }
4769 
4770  global $ilAccess, $ilUser;
4771 
4772  $online_access = false;
4773  if($this->object->getFixedParticipants())
4774  {
4775  include_once "./Modules/Test/classes/class.ilObjTestAccess.php";
4776  $online_access_result = ilObjTestAccess::_lookupOnlineTestAccess($this->object->getId(), $ilUser->getId());
4777  if($online_access_result === true)
4778  {
4779  $online_access = true;
4780  }
4781  }
4782 
4783  if($this->object->isOnline() && $this->object->isComplete( $this->testQuestionSetConfigFactory->getQuestionSetConfig() ))
4784  {
4785  if((!$this->object->getFixedParticipants() || $online_access) && $ilAccess->checkAccess("read", "", $this->ref_id))
4786  {
4787  $testSession = $this->testSessionFactory->getSession();
4788 
4789  $executable = $this->object->isExecutable($testSession, $ilUser->getId(), $allowPassIncrease = TRUE);
4790 
4791  if($executable["executable"])
4792  {
4793  $player_factory = new ilTestPlayerFactory($this->object);
4794  $player_instance = $player_factory->getPlayerGUI();
4795 
4796  if ($testSession->getActiveId() > 0)
4797  {
4798  $ilToolbar->addSeparator();
4799  $ilToolbar->addButton($lng->txt('tst_resume_test'), $ilCtrl->getLinkTarget($player_instance, 'resumePlayer'));
4800  }
4801  else
4802  {
4803  $ilToolbar->addSeparator();
4804  $ilToolbar->addButton($lng->txt('tst_start_test'), $ilCtrl->getLinkTarget($player_instance, 'startTest'));
4805  }
4806  }
4807  }
4808  }
4809  }
4810 
4811  public function copyQuestionsToPoolObject()
4812  {
4813  $this->copyQuestionsToPool($_REQUEST['q_id'], $_REQUEST['sel_qpl']);
4814  $this->ctrl->redirect($this, 'questions');
4815  }
4816 
4817  public function copyQuestionsToPool($questionIds, $qplId)
4818  {
4819  $newIds = array();
4820  foreach($questionIds as $q_id)
4821  {
4822  $newId = $this->copyQuestionToPool($q_id, $qplId);
4823  $newIds[$q_id] = $newId;
4824  }
4825 
4826  $result = new stdClass();
4827  $result->ids = $newIds;
4828  $result->qpoolid = $qplId;
4829 
4830  return $result;
4831  }
4832 
4833  public function copyQuestionToPool($sourceQuestionId, $targetParentId)
4834  {
4835  require_once 'Modules/TestQuestionPool/classes/class.assQuestion.php';
4836  $question_gui = assQuestion::instantiateQuestionGUI($sourceQuestionId);
4837 
4838  $newtitle = $question_gui->object->getTitle();
4839  if ($question_gui->object->questionTitleExists($targetParentId, $question_gui->object->getTitle()))
4840  {
4841  $counter = 2;
4842  while ($question_gui->object->questionTitleExists($targetParentId, $question_gui->object->getTitle() . " ($counter)"))
4843  {
4844  $counter++;
4845  }
4846  $newtitle = $question_gui->object->getTitle() . " ($counter)";
4847  }
4848 
4849  return $question_gui->object->createNewOriginalFromThisDuplicate($targetParentId, $newtitle);
4850  }
4851 
4856  {
4857  global $ilObjDataCache;
4858 
4859  $qplId = $ilObjDataCache->lookupObjId($_REQUEST['sel_qpl']);
4860  $result = $this->copyQuestionsToPool($_REQUEST['q_id'], $qplId);
4861 
4862  foreach($result->ids as $oldId => $newId)
4863  {
4864  $questionInstance = assQuestion::_instanciateQuestion($oldId);
4865 
4866  if( assQuestion::originalQuestionExists($questionInstance->getOriginalId()) )
4867  {
4868  $oldOriginal = assQuestion::_instanciateQuestion($questionInstance->getOriginalId());
4869  $oldOriginal->delete($oldOriginal->getId());
4870  }
4871 
4872  $questionInstance->setNewOriginalId($newId);
4873  }
4874 
4875  $this->ctrl->redirect($this, 'questions');
4876  }
4877 
4878  private function getQuestionpoolCreationForm()
4879  {
4880  global $lng;
4881  include_once 'Services/Form/classes/class.ilPropertyFormGUI.php';
4882  $form = new ilPropertyFormGUI();
4883 
4884  $title = new ilTextInputGUI($lng->txt('title'), 'title');
4885  $title->setRequired(true);
4886  $form->addItem($title);
4887 
4888  $description = new ilTextAreaInputGUI($lng->txt('description'), 'description');
4889  $form->addItem($description);
4890 
4891  $form->addCommandButton('createQuestionPoolAndCopy', $lng->txt('create'));
4892 
4893  if(isset($_REQUEST['q_id']) && is_array($_REQUEST['q_id']))
4894  {
4895  foreach($_REQUEST['q_id'] as $id)
4896  {
4897  $hidden = new ilHiddenInputGUI('q_id[]');
4898  $hidden->setValue($id);
4899  $form->addItem($hidden);
4900  }
4901  }
4902 
4903  return $form;
4904  }
4905 
4906  public function copyToQuestionpoolObject()
4907  {
4908  $this->createQuestionpoolTargetObject('copyQuestionsToPool');
4909  }
4910 
4912  {
4913  global $lng;
4914 
4915  require_once 'Modules/TestQuestionPool/classes/class.assQuestion.php';
4916 
4917  // #13761; All methods use for this request should be revised, thx japo ;-)
4918  if(
4919  'copyAndLinkToQuestionpool' == $this->ctrl->getCmd() &&
4920  (!isset($_REQUEST['q_id']) || !is_array($_REQUEST['q_id']))
4921  )
4922  {
4923  ilUtil::sendFailure($this->lng->txt('tst_no_question_selected_for_moving_to_qpl'), true);
4924  $this->ctrl->redirect($this, 'questions');
4925  }
4926 
4927  if(isset($_REQUEST['q_id']) && is_array($_REQUEST['q_id']))
4928  {
4929  foreach($_REQUEST['q_id'] as $q_id)
4930  {
4932  {
4933  continue;
4934  }
4935 
4937 
4938  if($type !== 'tst')
4939  {
4940  ilUtil::sendFailure($lng->txt('tst_link_only_unassigned'), true);
4941  $this->ctrl->redirect($this, 'questions');
4942  return;
4943  }
4944  }
4945  }
4946 
4947  $this->createQuestionpoolTargetObject('copyAndLinkQuestionsToPool');
4948  }
4949 
4951  {
4952  $form = $this->getQuestionpoolCreationForm();
4953 
4954  if ($_REQUEST['title'])
4955  {
4956  $title = $_REQUEST['title'];
4957  }
4958  else
4959  {
4960  $title = $_REQUEST['txt_qpl'];
4961  }
4962 
4963  if (!$title)
4964  {
4965  ilUtil::sendInfo($this->lng->txt("questionpool_not_entered"));
4966  return $this->copyAndLinkToQuestionpoolObject();
4967  }
4968 
4969  $ref_id = $this->createQuestionPool($title, $_REQUEST['description']);
4970  $_REQUEST['sel_qpl'] = $ref_id;
4971 
4972  //if ($_REQUEST['link'])
4973  //{
4975  //}
4976  //else
4977  //{
4978  // $this->copyQuestionsToPoolObject();
4979  //}
4980  }
4981 
4989  {
4990  global $ilUser, $ilTabs;
4991  $this->getQuestionsSubTabs();
4992  $ilTabs->activateSubTab('edit_test_questions');
4993 
4994  $this->tpl->addBlockFile("ADM_CONTENT", "adm_content", "tpl.il_as_tst_qpl_select_copy.html", "Modules/Test");
4995  $questionpools =& $this->object->getAvailableQuestionpools(FALSE, FALSE, FALSE, TRUE, FALSE, "write");
4996  if(count($questionpools) == 0)
4997  {
4998  $this->tpl->setCurrentBlock("option");
4999  $this->tpl->setVariable("VALUE_QPL", "");
5000  $this->tpl->parseCurrentBlock();
5001  }
5002  else
5003  {
5004  foreach($questionpools as $key => $value)
5005  {
5006  $this->tpl->setCurrentBlock("option");
5007  $this->tpl->setVariable("VALUE_OPTION", $key);
5008  $this->tpl->setVariable("TEXT_OPTION", $value["title"]);
5009  $this->tpl->parseCurrentBlock();
5010  }
5011  }
5012 
5013  if(isset($_REQUEST['q_id']) && is_array($_REQUEST['q_id']))
5014  {
5015  foreach($_REQUEST['q_id'] as $id)
5016  {
5017  $this->tpl->setCurrentBlock("hidden");
5018  $this->tpl->setVariable("HIDDEN_NAME", "q_id[]");
5019  $this->tpl->setVariable("HIDDEN_VALUE", $id);
5020  $this->tpl->parseCurrentBlock();
5021  $this->tpl->setCurrentBlock("adm_content");
5022  }
5023  }
5024  $this->tpl->setVariable("FORM_ACTION", $this->ctrl->getFormAction($this));
5025 
5026  if(count($questionpools) == 0)
5027  {
5028  $this->tpl->setVariable("TXT_QPL_SELECT", $this->lng->txt("tst_enter_questionpool"));
5029  $cmd = 'createQuestionPoolAndCopy';
5030  }
5031  else
5032  {
5033  $this->tpl->setVariable("TXT_QPL_SELECT", $this->lng->txt("tst_select_questionpool"));
5034  }
5035 
5036  $this->tpl->setVariable("CMD_SUBMIT", $cmd);
5037  $this->tpl->setVariable("BTN_SUBMIT", $this->lng->txt("submit"));
5038  $this->tpl->setVariable("BTN_CANCEL", $this->lng->txt("cancel"));
5039 
5040  $createForm = $this->getQuestionpoolCreationForm();
5041  switch($cmd)
5042  {
5043  case 'copyAndLinkQuestionsToPool':
5044  $hidden = new ilHiddenInputGUI('link');
5045  $hidden->setValue(1);
5046  $createForm->addItem($hidden);
5047  break;
5048  case 'copyQuestionsToPool':
5049  break;
5050  }
5051  $createForm->setFormAction($this->ctrl->getFormAction($this));
5052 
5053  $this->tpl->parseCurrentBlock();
5054  }
5055 
5056  // begin-patch lok
5057  public function applyTemplate($templateData, $object)
5058  // end-patch lok
5059  {
5060  // map formFieldName => setterName
5061  $simpleSetters = array(
5062 
5063  // general properties
5064  'use_pool' => 'setPoolUsage',
5065  'question_set_type' => 'setQuestionSetType',
5066 
5067  // test intro properties
5068  'intro_enabled' => 'setIntroductionEnabled',
5069  'showinfo' => 'setShowInfo',
5070 
5071  // test access properties
5072  'chb_starting_time' => 'setStartingTimeEnabled',
5073  'chb_ending_time' => 'setEndingTimeEnabled',
5074  'password_enabled' => 'setPasswordEnabled',
5075  'fixedparticipants' => 'setFixedParticipants',
5076  'limitUsers' => 'setLimitUsersEnabled',
5077 
5078  // test run properties
5079  'nr_of_tries' => 'setNrOfTries',
5080  'chb_processing_time' => 'setEnableProcessingTime',
5081  'kiosk' => 'setKiosk',
5082  'examid_in_test_pass' => 'setShowExamIdInTestPassEnabled',
5083 
5084  // question behavior properties
5085  'title_output' => 'setTitleOutput',
5086  'autosave' => null, // handled specially in loop below
5087  'chb_shuffle_questions' => 'setShuffleQuestions',
5088  'offer_hints' => 'setOfferingQuestionHintsEnabled',
5089  'instant_feedback' => 'setScoringFeedbackOptionsByArray',
5090  'obligations_enabled' => 'setObligationsEnabled',
5091 
5092  // test sequence properties
5093  'chb_use_previous_answers' => 'setUsePreviousAnswers',
5094  'chb_show_cancel' => 'setShowCancel',
5095  'chb_postpone' => 'setPostponingEnabled',
5096  'list_of_questions' => 'setListOfQuestionsSettings',
5097  'chb_show_marker' => 'setShowMarker',
5098 
5099  // test finish properties
5100  'enable_examview' => 'setEnableExamview',
5101  'showfinalstatement' => 'setShowFinalStatement',
5102  'redirection_enabled' => null, // handled specially in loop below
5103  'sign_submission' => 'setSignSubmission',
5104  'mailnotification' => 'setMailNotification',
5105 
5106  // scoring options properties
5107  'count_system' => 'setCountSystem',
5108  'mc_scoring' => 'setMCScoring',
5109  'score_cutting' => 'setScoreCutting',
5110  'pass_scoring' => 'setPassScoring',
5111  'pass_deletion_allowed' => 'setPassDeletionAllowed',
5112 
5113  // result summary properties
5114  'results_access_enabled' => 'setScoreReporting',
5115  'grading_status' => 'setShowGradingStatusEnabled',
5116  'grading_mark' => 'setShowGradingMarkEnabled',
5117 
5118  // result details properties
5119  'solution_details' => 'setShowSolutionDetails',
5120  'solution_feedback' => 'setShowSolutionFeedback',
5121  'solution_suggested' => 'setShowSolutionSuggested',
5122  'solution_printview' => 'setShowSolutionPrintview',
5123  'highscore_enabled' => 'setHighscoreEnabled',
5124  'solution_signature' => 'setShowSolutionSignature',
5125  'examid_in_test_res' => 'setShowExamIdInTestResultsEnabled',
5126  'exp_sc_short' => 'setExportSettingsSingleChoiceShort',
5127 
5128  // misc scoring & result properties
5129  'anonymity' => 'setAnonymity',
5130  'enable_archiving' => 'setEnableArchiving'
5131  );
5132 
5133  if (!$templateData['results_presentation']['value'])
5134  {
5135  $templateData['results_presentation']['value'] = array();
5136  }
5137 
5138  foreach($simpleSetters as $field => $setter)
5139  {
5140  if($templateData[$field] && strlen($setter))
5141  {
5142  $object->$setter($templateData[$field]['value']);
5143  continue;
5144  }
5145 
5146  switch($field)
5147  {
5148  case 'autosave':
5149  if( $templateData[$field]['value'] > 0 )
5150  {
5151  $object->setAutosave(true);
5152  $object->setAutosaveIval($templateData[$field]['value'] * 1000);
5153  }
5154  else
5155  {
5156  $object->setAutosave(false);
5157  }
5158  break;
5159 
5160  case 'redirection_enabled':
5161  /* if( $templateData[$field]['value'] > REDIRECT_NONE )
5162  {
5163  $object->setRedirectionMode($templateData[$field]['value']);
5164  }
5165  else
5166  {
5167  $object->setRedirectionMode(REDIRECT_NONE);
5168  } */
5169  if( strlen($templateData[$field]['value']) )
5170  {
5171  $object->setRedirectionMode(REDIRECT_ALWAYS);
5172  $object->setRedirectionUrl($templateData[$field]['value']);
5173  }
5174  else
5175  {
5176  $object->setRedirectionMode(REDIRECT_NONE);
5177  $object->setRedirectionUrl('');
5178  }
5179  }
5180  }
5181  }
5182 
5184  {
5185  global $ilAccess;
5186  if (!$ilAccess->checkAccess("write", "", $this->ref_id))
5187  {
5188  // allow only write access
5189  ilUtil::sendInfo($this->lng->txt("cannot_edit_test"), true);
5190  $this->ctrl->redirect($this, "infoScreen");
5191  }
5192 
5193  global $ilCtrl;
5194 
5195  $orders = $obligations = array();
5196 
5197  foreach($_REQUEST['order'] as $qId => $order)
5198  {
5199  $id = (int)str_replace('q_', '', $qId);
5200 
5201  $orders[$id] = $order;
5202  }
5203 
5204  if( $this->object->areObligationsEnabled() && isset($_REQUEST['obligatory']) && is_array($_REQUEST['obligatory']) )
5205  {
5206  foreach($_REQUEST['obligatory'] as $qId => $obligation)
5207  {
5208  $id = (int)str_replace('q_', '', $qId);
5209 
5211  {
5212  $obligations[$id] = $obligation;
5213  }
5214  }
5215  }
5216 
5217  $this->object->setQuestionOrderAndObligations(
5218  $orders, $obligations
5219  );
5220 
5221  ilUtil::sendSuccess($this->lng->txt('saved_successfully'), true);
5222  $ilCtrl->redirect($this, 'questions');
5223  }
5224 
5228  protected function movePageFormObject()
5229  {
5230  global $lng, $ilCtrl, $tpl;
5231 
5232  include_once "Services/Form/classes/class.ilPropertyFormGUI.php";
5233  $form = new ilPropertyFormGUI();
5234  $form->setFormAction($ilCtrl->getFormAction($this, "movePage"));
5235  $form->setTitle($lng->txt("test_move_page"));
5236 
5237  $old_pos = new ilHiddenInputGUI("q_id");
5238  $old_pos->setValue($_REQUEST['q_id']);
5239  $form->addItem($old_pos);
5240 
5241  $questions = $this->object->getQuestionTitlesAndIndexes();
5242  if (!is_array($questions))
5243  $questions = array();
5244 
5245  foreach($questions as $k => $q) {
5246  if ($k == $_REQUEST['q_id']) {
5247  unset($questions[$k]);
5248  continue;
5249  }
5250  $questions[$k] = $lng->txt('behind') . ' '. $q;
5251  }
5252  #$questions['0'] = $lng->txt('first');
5253 
5254  $options = array(
5255  0 => $lng->txt('first')
5256  );
5257  foreach($questions as $k => $q) {
5258  $options[$k] = $q . ' ['. $this->lng->txt('question_id_short') . ': ' . $k . ']';
5259  }
5260 
5261  $pos = new ilSelectInputGUI($lng->txt("position"), "position_after");
5262  $pos->setOptions($options);
5263  $form->addItem($pos);
5264 
5265  $form->addCommandButton("movePage", $lng->txt("submit"));
5266  $form->addCommandButton("showPage", $lng->txt("cancel"));
5267 
5268  return $tpl->setContent($form->getHTML());
5269  }
5270 
5271  public function movePageObject() {
5272  global $ilAccess;
5273  if (!$ilAccess->checkAccess("write", "", $this->ref_id))
5274  {
5275  // allow only write access
5276  ilUtil::sendInfo($this->lng->txt("cannot_edit_test"), true);
5277  $this->ctrl->redirect($this, "infoScreen");
5278  }
5279 
5280  $this->object->moveQuestionAfter($_REQUEST['q_id'], $_REQUEST['position_after']);
5281  $this->showPageObject();
5282  }
5283 
5284  public function showPageObject() {
5285  global $ilCtrl;
5286 
5287  $ilCtrl->setParameterByClass('iltestexpresspageobjectgui', 'q_id', $_REQUEST['q_id']);
5288  $ilCtrl->redirectByClass('iltestexpresspageobjectgui', 'showPage');
5289  }
5290 
5291  public function copyQuestionObject() {
5292  global $ilAccess;
5293  if (!$ilAccess->checkAccess("write", "", $this->ref_id))
5294  {
5295  // allow only write access
5296  ilUtil::sendInfo($this->lng->txt("cannot_edit_test"), true);
5297  $this->ctrl->redirect($this, "infoScreen");
5298  }
5299 
5300  if ($_REQUEST['q_id'] && !is_array($_REQUEST['q_id']))
5301  $ids = array($_REQUEST['q_id']);
5302  else if ($_REQUEST['q_id'])
5303  $ids = $_REQUEST['q_id'];
5304  else
5305  {
5306  ilUtil::sendFailure( $this->lng->txt('copy_no_questions_selected'), true );
5307  $this->ctrl->redirect($this, 'questions');
5308  }
5309 
5310  $copy_count = 0;
5311 
5312  $questionTitles = $this->object->getQuestionTitles();
5313 
5314  foreach($ids as $id)
5315  {
5316  include_once "./Modules/TestQuestionPool/classes/class.assQuestion.php";
5317  $question = assQuestion::_instanciateQuestionGUI($id);
5318  if ($question)
5319  {
5320  $title = $question->object->getTitle();
5321  $i = 2;
5322  while( in_array( $title . ' (' . $i . ')', $questionTitles ))
5323  $i++;
5324 
5325  $title .= ' (' . $i . ')';
5326 
5327  $questionTitles[] = $title;
5328 
5329  $new_id = $question->object->duplicate(false, $title);
5330 
5331  $clone = assQuestion::_instanciateQuestionGUI($new_id);
5332  $clone->object->setObjId($this->object->getId());
5333  $clone->object->saveToDb();
5334 
5335  $this->object->insertQuestion( $this->testQuestionSetConfigFactory->getQuestionSetConfig(), $new_id, true );
5336 
5337  $copy_count++;
5338  }
5339  }
5340 
5341  ilUtil::sendSuccess($this->lng->txt('copy_questions_success'), true);
5342 
5343  $this->ctrl->redirect($this, 'questions');
5344  }
5345 
5351  private function isDeleteDynamicTestResultsButtonRequired($testSession, $testSequence)
5352  {
5353  if( !$testSession->getActiveId() )
5354  {
5355  return false;
5356  }
5357 
5358  if( !$this->object->isDynamicTest() )
5359  {
5360  return false;
5361  }
5362 
5363  if( !$this->object->isPassDeletionAllowed() )
5364  {
5365  return false;
5366  }
5367 
5368  if( !$testSequence->hasStarted($testSession) )
5369  {
5370  return false;
5371  }
5372 
5373  return true;
5374  }
5375 
5380  private function populateDeleteDynamicTestResultsButton($testSession, &$big_button)
5381  {
5382  require_once 'Modules/Test/classes/confirmations/class.ilTestPassDeletionConfirmationGUI.php';
5383  require_once 'Services/UIComponent/Button/classes/class.ilLinkButton.php';
5384 
5385  $this->ctrl->setParameterByClass(
5386  'iltestevaluationgui', 'context',
5388  );
5389 
5390  $this->ctrl->setParameterByClass('iltestevaluationgui', 'active_id', $testSession->getActiveId());
5391  $this->ctrl->setParameterByClass('iltestevaluationgui', 'pass', $testSession->getPass());
5392 
5393  $btn = ilLinkButton::getInstance();
5394  $btn->setCaption('tst_delete_dyn_test_results_btn');
5395  $btn->setUrl($this->ctrl->getLinkTargetByClass('iltestevaluationgui', 'confirmDeletePass'));
5396  $btn->setPrimary(false);
5397  $big_button[] = $btn;
5398  }
5399 
5403  private function isPdfDeliveryRequest()
5404  {
5405  if( !isset($_GET['pdf']) )
5406  {
5407  return false;
5408  }
5409 
5410  if( !(bool)$_GET['pdf'] )
5411  {
5412  return false;
5413  }
5414 
5415  return true;
5416  }
5417 
5419  {
5420  require_once 'Modules/Course/classes/Objectives/class.ilLOSettings.php';
5421  $containerObjId = (int)ilLOSettings::isObjectiveTest($this->ref_id);
5422 
5423  $containerRefId = current(ilObject::_getAllReferences($containerObjId));
5424 
5425  $this->objectiveOrientedContainer->setObjId($containerObjId);
5426  $this->objectiveOrientedContainer->setRefId($containerRefId);
5427  }
5428 
5429  protected function getObjectiveOrientedContainer()
5430  {
5432  }
5433 
5435  {
5436  if( !$this->object->isSkillServiceEnabled() )
5437  {
5438  return false;
5439  }
5440 
5441  if( $this->object->isDynamicTest() )
5442  {
5443  $questionSetConfig = $this->testQuestionSetConfigFactory->getQuestionSetConfig();
5444  $questionContainerId = $questionSetConfig->getSourceQuestionPoolId();
5445  }
5446  else
5447  {
5448  $questionContainerId = $this->object->getId();
5449  }
5450 
5451  global $ilDB;
5452 
5453  require_once 'Modules/TestQuestionPool/classes/class.ilAssQuestionSkillAssignmentList.php';
5454  require_once 'Modules/Test/classes/class.ilTestSkillLevelThreshold.php';
5455 
5456  $assignmentList = new ilAssQuestionSkillAssignmentList($ilDB);
5457  $assignmentList->setParentObjId($questionContainerId);
5458  $assignmentList->loadFromDb();
5459 
5460  foreach($assignmentList->getUniqueAssignedSkills() as $data)
5461  {
5462  foreach($data['skill']->getLevelData() as $level)
5463  {
5464  $treshold = new ilTestSkillLevelThreshold($ilDB);
5465  $treshold->setTestId($this->object->getTestId());
5466  $treshold->setSkillBaseId($data['skill_base_id']);
5467  $treshold->setSkillTrefId($data['skill_tref_id']);
5468  $treshold->setSkillLevelId($level['id']);
5469 
5470  if( !$treshold->dbRecordExists() )
5471  {
5472  return true;
5473  }
5474  }
5475  }
5476 
5477  return false;
5478  }
5479 
5481  {
5482  require_once 'Modules/Test/classes/class.ilTestSkillLevelThresholdsGUI.php';
5483 
5484  $link = $this->ctrl->getLinkTargetByClass(
5485  array('ilTestSkillAdministrationGUI', 'ilTestSkillLevelThresholdsGUI'),
5487  );
5488 
5489  $msg = $this->lng->txt('tst_skl_level_thresholds_missing');
5490  $msg .= '<br /><a href="'.$link.'">'.$this->lng->txt('tst_skl_level_thresholds_link').'</a>';
5491 
5492  return $msg;
5493  }
5494 }
const MATCHING_QUESTION_IDENTIFIER
const MULTIPLE_CHOICE_QUESTION_IDENTIFIER
const QT_MATCHING
static sendSuccess($a_info="", $a_keep=false)
Send Success Message to Screen.
static _lookupName($a_user_id)
lookup user name
Scoring class for tests.
const QT_FORMULA
static prepareFormOutput($a_str, $a_strip=false)
prepares string output for html forms public
applyTemplate($templateData, $object)
This class represents an option in a radio group.
const REPORT_AFTER_TEST
ILIAS Setting Class.
ilObjTestGUI()
Constructor public.
Class ilObjectMetaDataGUI.
print $file
const REPORT_AFTER_DATE
static getAllSettingsTemplates($a_type, $a_include_auto_generated=false)
Get all settings templates of type.
static _instanciateQuestion($question_id)
Creates an instance of a question with a given question id.
static _getOriginalId($question_id)
Returns the original id of a question.
Content Object Parser.
const QT_FILEUPLOAD
exit
Definition: login.php:54
Class ilInfoScreenGUI.
const ERROR_TEXT_IDENTIFIER
$_POST['username']
Definition: cron.php:12
$template_id
Definition: example_062.php:89
createQuestionObject()
Called when a new question should be created from a test.
const IL_CAL_DATETIME
isDeleteDynamicTestResultsButtonRequired($testSession, $testSequence)
Export User Interface Class.
Class ilObjTestGUI.
$_SESSION["AccountId"]
This class represents a selection list property in a property form.
$result
_getImportDirectory()
Get the import directory location of the test.
const QT_TEXT
This class represents a property form user interface.
fullscreenObject()
show fullscreen view
GUI class for the workflow of copying objects.
static originalQuestionExists($questionId)
const QUESTION_SET_TYPE_RANDOM
type setting value for random question set
getTabs(&$tabs_gui)
adds tabs to tab gui object
copyQuestionToPool($sourceQuestionId, $targetParentId)
uploadObject($redirect=true)
display status information or report errors messages in case of error
const ADDITIONAL_CONTENT_EDITING_MODE_PAGE_OBJECT
constant for additional content editing mode "pageobject"
Generic feedback page GUI class.
static getStyleSheetLocation($mode="output", $a_css_name="", $a_css_location="")
get full style sheet file name (path inclusive) of current user
$_GET["client_id"]
cancelCreateQuestionObject()
Called when the creation of a new question is cancelled.
This class represents a file property in a property form.
buildPageViewToolbar($qid=0)
Questions per page.
addButton($a_txt, $a_cmd, $a_target="", $a_acc_key="", $a_additional_attrs='', $a_id="", $a_class='submit')
Add button to toolbar.
showDetailedResultsObject()
Shows the pass overview and the answers of one ore more users for the scored pass.
Class ilObject Basic functions for all objects.
static getQuestionTypeByTypeId($type_id)
applyFilterCriteria($in_rows)
static & _instanciateQuestionGUI($question_id)
Creates an instance of a question gui with a given question id.
insertQuestionsBeforeObject()
Insert checked questions before the actual selection.
$_COOKIE["ilClientId"]
Definition: cron.php:11
Class ilShopPurchaseGUI.
addDidacticTemplateOptions(array &$a_options)
const QT_ORDERING_HORIZONTAL
$cmd
Definition: sahs_server.php:35
const KPRIM_CHOICE_QUESTION_IDENTIFIER
static _requiresPurchaseToAccess($a_ref_id, $a_purchasetype='')
this function should be used by all buyable repository objects !!
static _getQuestionTypeName($type_tag)
Return the translation for a given question type tag.
static _gotoRepositoryRoot($a_raise_error=false)
Goto repository root.
static unzip($a_file, $overwrite=false, $a_flat=false)
unzip file
const LONG_MENU_QUESTION_IDENTIFIER
static isObjectiveTest($a_trst_ref_id)
Check if test ref_id is used in an objective course.
Class ilUnitConfigurationRepository.
const TEXTSUBSET_QUESTION_IDENTIFIER
deleteSingleUserResultsObject()
Asks for a confirmation to delete selected user data of the test object.
static _goto($a_target)
Redirect script to call a test with the test reference id.
Question page object.
static _isActive()
Static getter.
ilObjectGUI($a_data, $a_id=0, $a_call_by_reference=true, $a_prepare_output=true)
Constructor public.
static _lookupTitle($a_id)
lookup object title
const REDIRECT_NONE
Redirect after finishing test constants.
const QT_KPRIM_CHOICE
showUserResults($show_pass_details, $show_answers, $show_reached_points=FALSE)
Shows the pass overview of the scored pass for one ore more users.
historyObject()
Creates the change history for a test.
downloadFileObject()
download file
createQuestionpoolTargetObject($cmd)
Called when a new question should be created from a test Important: $cmd may be overwritten if no que...
createObject()
create new object form
insertRandomSelectionObject()
Inserts a random selection into the test.
const QT_IMAGEMAP
redirectTo_ilObjTestSettingsGeneralGUI_showForm_Object()
Scoring class for tests.
confirmRemoveQuestionsObject()
Remove questions from the test after confirmation.
static lookupParentObjId($questionId)
ilDB $ilDB
cancelDeleteSelectedUserDataObject()
Cancels the deletion of all user data for the test object.
Question page GUI class.
static $infoScreenChildClasses
getSyntaxStylePath()
get syntax style path
static _getAllReferences($a_id)
get all reference ids of object
addDefaultsObject()
Adds the defaults of this test to the defaults.
deleteAllUserDataObject()
Asks for a confirmation to delete all user data of the test object.
createUserResults($show_pass_details, $show_answers, $show_reached_points, $show_user_results)
participantsActionObject()
Evaluates the actions on the participants page.
afterSave(ilObject $a_new_object)
save object public
const FILE_UPLOAD_IDENTIFIER
const QT_MULTIPLE_CHOICE_SR
const JAVAAPPLET_QUESTION_IDENTIFIER
global $ilCtrl
Definition: ilias.php:18
confirmDeleteSelectedUserDataObject()
Deletes the selected user data for the test object.
cancelRemoveQuestionsObject()
Cancels the removal of questions from the test.
setInfo($a_info)
Set Information Text.
static sendInfo($a_info="", $a_keep=false)
Send Info Message to Screen.
const REDIRECT_ALWAYS
deleteAllUserResultsObject()
Asks for a confirmation to delete all user data of the test object.
static checkAccess($a_ref_id, $a_allow_only_read=true)
check access to learning progress
prepareSubGuiOutput()
prepares ilias to get output rendered by sub gui class
copyAndLinkQuestionsToPoolObject()
ilObjectDataCache $ilObjDataCache
This class represents a hidden form property in a property form.
$info
Definition: example_052.php:80
showUserAnswersObject()
Shows the answers of one ore more users for the scored pass.
_lookupOnlineTestAccess($a_test_id, $a_user_id)
Checks if a user is allowd to run an online exam.
static appendUrlParameterString($a_url, $a_par, $xml_style=false)
append URL parameter string ("par1=value1&par2=value2...") to given URL string
This class represents a property in a property form.
addOption($a_option)
Add Option.
const QT_LONG_MENU
getBrowseForQuestionsTab(&$tabs_gui)
setValue($a_value)
Set Value.
const NUMERIC_QUESTION_IDENTIFIER
if(!is_array($argv)) $options
const IL_MO_PARSE_QTI
removeQuestionsObject()
Called when a selection of questions should be removed from the test.
const ORDERING_HORIZONTAL_IDENTIFIER
const SCORE_ZERO_POINTS_WHEN_UNANSWERED
initImportForm($a_new_type)
_createImportDirectory()
creates data directory for import files (data_dir/tst_data/tst_<id>/import, depending on data directo...
static getImagePath($img, $module_path="", $mode="output", $offline=false)
get image path (for images located in a template directory)
This class represents a number property in a property form.
Class ilTimingOverviewTableGUI.
confirmDeleteAllUserResultsObject()
Deletes all user data for the test object.
const COUNT_PARTIAL_SOLUTIONS
applyDefaultsObject($confirmed=false)
Applies the selected test defaults.
download_paragraphObject()
download source code paragraph
static moveUploadedFile($a_file, $a_name, $a_target, $a_raise_errors=true, $a_mode="move_uploaded")
move uploaded file
Class ilObjectGUI Basic methods of all Output classes.
static _lookupObjId($a_id)
const ORDERING_QUESTION_IDENTIFIER
insertQuestionsAfterObject()
Insert checked questions after the actual selection.
special template class to simplify handling of ITX/PEAR
populateDeleteDynamicTestResultsButton($testSession, &$big_button)
createQuestionPool($name="dummy", $description="")
Creates a new questionpool and returns the reference id.
_setImportDirectory($a_import_dir=null)
set import directory
Class ilObjFile.
setSize($a_size)
Set Size.
& _getQuestionGUI($question_type, $question_id=-1)
Creates a question gui representation and returns the alias to the question gui note: please do not u...
This class represents a text property in a property form.
static formatDate(ilDateTime $date)
Format a date public.
Output class for assessment test evaluation.
GUI class to create PDF certificates.
static infoPanel($a_keep=true)
Date and time handling
redirection script todo: (a better solution should control the processing via a xml file) ...
static isSkillManagementGloballyActivated()
setTitleAndDescription()
called by prepare output
$results
infoScreenObject()
this one is called from the info button in the repository not very nice to set cmdClass/Cmd manually...
static sendQuestion($a_info="", $a_keep=false)
Send Question to Screen.
setOptions($a_options)
Set Options.
const TEXT_QUESTION_IDENTIFIER
Basic GUI class for assessment questions.
$txt
Definition: error.php:12
_getParticipantData($active_id)
Retrieves a participant name from active id.
static isQuestionObligationPossible($questionId)
checks wether the obligation for question with given id is possible or not
prepareOutput()
prepare output
static _lookupType($a_id, $a_reference=false)
lookup object type
_needsManualScoring($question_id)
filterObject()
Sets the filter for the question browser.
static sendFailure($a_info="", $a_keep=false)
Send Failure Message to Screen.
participantsObject()
Creates the output of the test participants.
const QT_JAVAAPPLET
const FLASHAPPLET_QUESTION_IDENTIFIER
writeFilterToSession()
Write filter values to session.
const TEST_FIXED_SEQUENCE
Test constants.
const ADDITIONAL_CONTENT_EDITING_MODE_DEFAULT
constant for additional content editing mode "default"
executeCommand()
execute command
exportObject()
Gateway for exports initiated from workspace, as there is a generic forward to {objTypeMainGUI}::expo...
_recordReadEvent($a_type, $a_ref_id, $obj_id, $usr_id, $isCatchupWriteEvents=true, $a_ext_rc=false, $a_ext_time=false)
Records a read event and catches up with write events.
const QT_NUMERIC
Specific feedback page GUI class.
randomselectObject()
Creates a form for random selection of questions.
importVerifiedFileObject()
imports question(s) into the questionpool (after verification)
$redirect
Definition: index.php:18
const QT_TEXTSUBSET
createRandomSelectionObject()
Offers a random selection for insertion in the test.
certificateObject()
Shows the certificate editor.
global $ilUser
Definition: imgupload.php:15
const QT_FLASHAPPLET
getContentStylePath($a_style_id)
get content style path
cancelRandomSelectObject()
Cancels the form for random selection of questions.
$path
Definition: index.php:22
This class represents a text area property in a property form.
static generatePDF($pdf_output, $output_mode, $filename=null)
executeCreateQuestionObject()
Called when a new question should be created from a test after confirmation.
global $ilDB
static isAdditionalQuestionContentEditingModePageObjectEnabled()
returns the fact wether content editing with ilias page editor is enabled for questions or not ...
const QUESTION_SET_TYPE_FIXED
type setting value for fixed question set
getCreationMode()
get creation mode
getQuestionTypeFromDb($question_id)
get question type for question id
movePageFormObject()
Move current page.
getRefId()
get reference id public
Class ilLocalUnitConfigurationGUI.
getDidacticTemplateVar($a_type)
Get didactic template setting from creation screen.
moveQuestionsObject()
Marks selected questions for moving.
& _getAvailableQuestionpools($use_object_id=FALSE, $equal_points=FALSE, $could_be_offline=FALSE, $showPath=FALSE, $with_questioncount=FALSE, $permission="read", $usr_id="")
Returns the available question pools for the active user.
populateQuestionBrowserToolbarButtons(ilToolbarGUI $toolbar, $context)
New PermissionGUI (extends from old ilPermission2GUI) RBAC related output.
const REPORT_ALWAYS
static setTokenMaxLifetimeInSeconds($token_max_lifetime_in_seconds)
Service GUI class for tests.
insertQuestionsObject()
Insert questions from the questionbrowser into the test.
if($_REQUEST['ilias_path']) define('ILIAS_HTTP_PATH' $_REQUEST['ilias_path']
Definition: index.php:7
static fillAutoCompleteToolbar($parent_object, ilToolbarGUI $toolbar=null, $a_options=array(), $a_sticky=false)
fill toolbar with
printobject()
Print tab to create a print of all questions with points and solutions.
const IL_CAL_TIMESTAMP
const QT_CLOZE
const QT_MULTIPLE_CHOICE_MR
$GLOBALS['PHPCAS_CLIENT']
This global variable is used by the interface class phpCAS.
Definition: CAS.php:276
const IL_MO_VERIFY_QTI
Class ilScoringAdjustmentGUI.
uploadTstObject()
imports test and question(s)
deleteDefaultsObject()
Deletes selected test defaults.
backObject()
Called when the back button in the question browser was pressed.
static redirect($a_script)
http redirect to other script
const QUESTION_SET_TYPE_DYNAMIC
type setting value for dynamic question set (continues testing mode)
const SINGLE_CHOICE_QUESTION_IDENTIFIER
const QT_ORDERING
addHeaderAction()
Add header action menu.
static delDir($a_dir, $a_clean_only=false)
removes a dir and all its content (subdirs and files) recursively
copyQuestionsToPool($questionIds, $qplId)
& _getLog($ts_from, $ts_to, $test_id, $test_only=FALSE)
Retrieve assessment log datasets from the database.
getRandomQuestionsTab(&$tabs_gui)
setSuffixes($a_suffixes)
Set Accepted Suffixes.
ilTestExpressPageObjectGUI: assMultipleChoiceGUI, assClozeTestGUI, assMatchingQuestionGUI ilTestExpr...
Class ilObjUserTrackingGUI.
getReturnLocation($a_cmd, $a_location="")
get return location for command (command is method name without "Object", e.g.
resetFilter()
Reset filter.
Settings template application class.
const CLOZE_TEST_IDENTIFIER
Question identifier constants.
static instantiateQuestionGUI($a_question_id)
Creates an instance of a question gui with a given question id.
const SCORE_BEST_PASS
setRequired($a_required)
Set Required.
showPassOverviewObject()
Shows the pass overview of the scored pass for one ore more users.
static getInstanceFromAjaxCall()
(Re-)Build instance from ajax call
_getManualScoring()
Retrieve the manual scoring settings.
static _getTestDefaults($test_defaults_id)
setLocator()
set Locator
resetFilterObject()
Resets the filter for the question browser.
Confirmation screen class.
const IMAGEMAP_QUESTION_IDENTIFIER
importFileObject()
form for new test object import
const QT_ERRORTEXT
const FORMULA_QUESTION_IDENTIFIER
addParticipantsObject($a_user_ids=array())
setFilterCommand($a_val, $a_caption=null)
Set filter command.
removeQuestionsForm($checked_questions)
Displays a form to confirm the removal of questions from the test.