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