6 include_once 
'Modules/Test/exceptions/class.ilTestException.php';
 
    7 include_once 
"./Services/Object/classes/class.ilObjectGUI.php";
 
    8 include_once 
"./Modules/Test/classes/inc.AssessmentConstants.php";
 
    9 include_once 
"./Modules/Test/classes/class.ilObjAssessmentFolderGUI.php";
 
   10 include_once 
'Modules/Test/classes/class.ilTestExpressPage.php';
 
   57                 $lng->loadLanguageModule(
"assessment");
 
   60                 $this->ctrl->saveParameter($this, array(
"ref_id", 
"test_ref_id", 
"calling_test", 
"test_express_mode", 
"q_id"));
 
   63                 if((
int) 
$_GET[
'crs_show_result'])
 
   65                         $this->ctrl->saveParameter($this,
'crs_show_result',(
int) $_GET[
'crs_show_result']);
 
   76                 if ((!$ilAccess->checkAccess(
"read", 
"", 
$_GET[
"ref_id"])) && (!$ilAccess->checkAccess(
"visible", 
"", 
$_GET[
"ref_id"])))
 
   79                         $ilias->raiseError($this->lng->txt(
"permission_denied"), $ilias->error_obj->MESSAGE);
 
   82                 $cmd = $this->ctrl->getCmd(
"properties");
 
   84                 $cmdsDisabledDueToOfflineStatus = array(
 
   85                         'resume', 
'start', 
'outUserResultsOverview', 
'outUserListOfAnswerPasses'                 
   88                 if( !$this->
getCreationMode() && !$this->object->isOnline() && in_array(
$cmd, $cmdsDisabledDueToOfflineStatus) )
 
   93                 $next_class = $this->ctrl->getNextClass($this);
 
   94                 $this->ctrl->setReturn($this, 
"properties");
 
   96                 if (method_exists($this->
object, 
"getTestStyleLocation")) $this->tpl->addCss($this->object->getTestStyleLocation(
"output"), 
"screen");
 
  100                         $ilAccess->checkAccess(
"read", 
"", 
$_GET[
"ref_id"]))
 
  102                         $ilNavigationHistory->addItem(
$_GET[
"ref_id"],
 
  103                                 "ilias.php?baseClass=ilObjTestGUI&cmd=infoScreen&ref_id=".
$_GET[
"ref_id"], 
"tst");
 
  108                         if(IS_PAYMENT_ENABLED)
 
  110                                 include_once 
'Services/Payment/classes/class.ilPaymentObject.php';
 
  114                                         $this->tpl->getStandardTemplate();
 
  116                                         include_once 
'Services/Payment/classes/class.ilShopPurchaseGUI.php';
 
  118                                         $ret = $this->ctrl->forwardCommand($pp);
 
  127                     global $___prev_question_id;
 
  128                     $___prev_question_id = 
$_REQUEST[
'prev_qid'];
 
  129                     $this->ctrl->setParameter($this, 
'prev_qid', 
$_REQUEST[
'prev_qid']);
 
  134                         case "ilinfoscreengui":
 
  139                         case 'ilmdeditorgui':           
 
  140                                 if(!$ilAccess->checkAccess(
'write',
'',$this->object->getRefId()))
 
  142                                         $ilErr->raiseError($this->lng->txt(
'permission_denied'),$ilErr->WARNING);
 
  147                                 include_once 
'Services/MetaData/classes/class.ilMDEditorGUI.php';
 
  148                                 $md_gui =& 
new ilMDEditorGUI($this->object->getId(), 0, $this->
object->getType());
 
  149                                 $md_gui->
addObserver($this->
object,
'MDUpdateListener',
'General');
 
  151                                 $this->ctrl->forwardCommand($md_gui);
 
  153                         case "iltestoutputgui":                         
 
  154                                 include_once 
"./Modules/Test/classes/class.ilTestOutputGUI.php";
 
  157                                 $this->ctrl->forwardCommand($output_gui);
 
  160                         case "iltestevaluationgui":
 
  163                                 include_once 
"./Modules/Test/classes/class.ilTestEvaluationGUI.php";
 
  165                                 $this->ctrl->forwardCommand($evaluation_gui);
 
  168                         case "iltestservicegui":
 
  171                                 include_once 
"./Modules/Test/classes/class.ilTestServiceGUI.php";
 
  173                                 $this->ctrl->forwardCommand($serviceGUI);
 
  176                         case 'ilpermissiongui':
 
  179                                 include_once(
"Services/AccessControl/classes/class.ilPermissionGUI.php");
 
  181                                 $ret =& $this->ctrl->forwardCommand($perm_gui);
 
  184                         case "illearningprogressgui":
 
  187                                 include_once 
'./Services/Tracking/classes/class.ilLearningProgressGUI.php';
 
  189                                 $this->ctrl->forwardCommand($new_gui);
 
  193                         case "ilcertificategui":
 
  196                                 include_once 
"./Services/Certificate/classes/class.ilCertificateGUI.php";
 
  197                                 include_once 
"./Modules/Test/classes/class.ilTestCertificateAdapter.php";
 
  199                                 $this->ctrl->forwardCommand($output_gui);
 
  202                         case "iltestscoringgui":
 
  205                                 include_once 
"./Modules/Test/classes/class.ilTestScoringGUI.php";
 
  207                                 $this->ctrl->forwardCommand($output_gui);
 
  210                         case 'ilobjectcopygui':
 
  213                                 include_once 
'./Services/Object/classes/class.ilObjectCopyGUI.php';
 
  216                                 $this->ctrl->forwardCommand($cp);
 
  219                         case 'ilrepositorysearchgui':
 
  222                                 include_once(
'./Services/Search/classes/class.ilRepositorySearchGUI.php');
 
  224                                 $rep_search->setCallback($this,
 
  225                                         'addParticipantsObject',
 
  231                                 $this->ctrl->setReturn($this,
'participants');
 
  232                                 $ret =& $this->ctrl->forwardCommand($rep_search);
 
  233                                 $this->tabs_gui->setTabActive(
'participants');
 
  236                         case 'ilpageeditorgui':
 
  237                         case 'iltestexpresspageobjectgui':
 
  239                                         require_once 
'Modules/TestQuestionPool/classes/class.ilAssIncompleteQuestionPurger.php';
 
  241                                         $incompleteQuestionPurger->setOwnerId($ilUser->getId());
 
  242                                         $incompleteQuestionPurger->purge();
 
  249                                                         if (!$qid || $qid == 
'Array') {
 
  250                                 $questions = $this->
object->getQuestionTitlesAndIndexes();
 
  251                                 if (!is_array($questions))
 
  252                                     $questions = array();
 
  254                                 $keys = array_keys($questions);
 
  258                                 $_GET[
'q_id'] = $qid;
 
  265                             if (!in_array(
$cmd, array(
'addQuestion', 
'browseForQuestions'))) {
 
  269                             if (!$qid || in_array(
$cmd, array(
'insertQuestions', 
'browseForQuestions'))) {
 
  270                                 include_once(
"./Modules/Test/classes/class.ilTestExpressPageObjectGUI.php");
 
  273                                 $ret =& $this->ctrl->forwardCommand($pageObject);
 
  276                             include_once(
"./Services/Style/classes/class.ilObjStyleSheet.php");
 
  277                             $this->tpl->setCurrentBlock(
"ContentStyle");
 
  278                             $this->tpl->setVariable(
"LOCATION_CONTENT_STYLESHEET",
 
  280                             $this->tpl->parseCurrentBlock();
 
  283                             $this->tpl->setCurrentBlock(
"SyntaxStyle");
 
  284                             $this->tpl->setVariable(
"LOCATION_SYNTAX_STYLESHEET",
 
  286                             $this->tpl->parseCurrentBlock();
 
  287                             include_once 
"./Modules/TestQuestionPool/classes/class.assQuestionGUI.php";
 
  291                                                         $q_gui->outAdditionalOutput();
 
  292                                                         $q_gui->object->setObjId($this->object->getId());
 
  293                                                         $question =& $q_gui->object;
 
  294                                                         $this->ctrl->saveParameter($this, 
"q_id");
 
  296                             #$this->lng->loadLanguageModule("content"); 
  297                             $this->ctrl->setReturnByClass(
"ilTestExpressPageObjectGUI", 
"view");
 
  298                             $this->ctrl->setReturn($this, 
"questions");
 
  301                             include_once(
"./Services/COPage/classes/class.ilPageObject.php");
 
  302                             include_once(
"./Modules/Test/classes/class.ilTestExpressPageObjectGUI.php");
 
  306                             $page_gui->setEditPreview(
true);
 
  307                             $page_gui->setEnabledTabs(
false);
 
  308                             $page_gui->setEnabledInternalLinks(
false);
 
  309                             if (strlen($this->ctrl->getCmd()) == 0)
 
  311                                     $this->ctrl->setCmdClass(get_class($page_gui));
 
  312                                     $this->ctrl->setCmd(
"preview");
 
  315                             $page_gui->setQuestionHTML(array($q_gui->object->getId() => $q_gui->getPreview(TRUE)));
 
  316                             $page_gui->setTemplateTargetVar(
"ADM_CONTENT");
 
  318                             $page_gui->setOutputMode($this->object->evalTotalPersons() == 0 ? 
"edit" : 
'preview');
 
  320                             $page_gui->setHeader($question->getTitle());
 
  321                             $page_gui->setFileDownloadLink($this->ctrl->getLinkTarget($this, 
"downloadFile"));
 
  322                             $page_gui->setFullscreenLink($this->ctrl->getLinkTarget($this, 
"fullscreen"));
 
  323                             $page_gui->setSourcecodeDownloadScript($this->ctrl->getLinkTarget($this));
 
  324                             $page_gui->setPresentationTitle($question->getTitle());
 
  325                             $ret =& $this->ctrl->forwardCommand($page_gui);
 
  328                             $ilTabs->activateTab(
'assQuestions');
 
  330                             $this->tpl->setContent(
$ret);
 
  333                         case 'ilpageobjectgui':
 
  334                             include_once (
"./Services/COPage/classes/class.ilPageObjectGUI.php");
 
  337                                     $this->ctrl->setParameter($this, 
'prev_qid', 
$_REQUEST[
'prev_qid']);
 
  343                                 $_GET[
'calling_test'] = $this->
object->getRefId();
 
  344                                 include_once(
"./Services/Style/classes/class.ilObjStyleSheet.php");
 
  345                                 $this->tpl->setCurrentBlock(
"ContentStyle");
 
  346                                 $this->tpl->setVariable(
"LOCATION_CONTENT_STYLESHEET",
 
  348                                 $this->tpl->parseCurrentBlock();
 
  351                                 $this->tpl->setCurrentBlock(
"SyntaxStyle");
 
  352                                 $this->tpl->setVariable(
"LOCATION_SYNTAX_STYLESHEET",
 
  354                                 $this->tpl->parseCurrentBlock();
 
  355                                 include_once 
"./Modules/TestQuestionPool/classes/class.assQuestionGUI.php";
 
  357                                 $q_gui->setQuestionTabs();
 
  358                                 $q_gui->outAdditionalOutput();
 
  359                                 $q_gui->object->setObjId($this->object->getId());
 
  360                                 $question =& $q_gui->object;
 
  361                                 $this->ctrl->saveParameter($this, 
"q_id");
 
  362                                 include_once(
"./Services/COPage/classes/class.ilPageObject.php");
 
  363                                 include_once(
"./Services/COPage/classes/class.ilPageObjectGUI.php");
 
  364                                 $this->lng->loadLanguageModule(
"content");
 
  365                                 $this->ctrl->setReturnByClass(
"ilPageObjectGUI", 
"view");
 
  366                                 $this->ctrl->setReturn($this, 
"questions");
 
  369                                 $page_gui->setEditPreview(
true);
 
  370                                 $page_gui->setEnabledTabs(
false);
 
  371                                 $page_gui->setEnabledInternalLinks(
false);
 
  372                                 if (strlen($this->ctrl->getCmd()) == 0)
 
  374                                         $this->ctrl->setCmdClass(get_class($page_gui));
 
  375                                         $this->ctrl->setCmd(
"preview");
 
  378                                 $page_gui->setQuestionHTML(array($q_gui->object->getId() => $q_gui->getPreview(TRUE)));
 
  379                                 $page_gui->setTemplateTargetVar(
"ADM_CONTENT");
 
  380                                 $page_gui->setOutputMode($this->object->evalTotalPersons() == 0 ? 
"edit" : 
'preview');
 
  381                                 $page_gui->setHeader($question->getTitle());
 
  382                                 $page_gui->setFileDownloadLink($this->ctrl->getLinkTarget($this, 
"downloadFile"));
 
  383                                 $page_gui->setFullscreenLink($this->ctrl->getLinkTarget($this, 
"fullscreen"));
 
  384                                 $page_gui->setSourcecodeDownloadScript($this->ctrl->getLinkTarget($this));
 
  385                                 $page_gui->setPresentationTitle($question->getTitle());
 
  386                                 $ret =& $this->ctrl->forwardCommand($page_gui);
 
  387                                 $this->tpl->setContent(
$ret);
 
  391                         case "ilcommonactiondispatchergui":
 
  392                                 include_once(
"Services/Object/classes/class.ilCommonActionDispatcherGUI.php");
 
  394                                 $this->ctrl->forwardCommand($gui);
 
  397                         case 'ilassquestionhintsgui':
 
  402                                 $this->ctrl->setReturn($this, 
"questions");
 
  405                                 require_once 
'Modules/TestQuestionPool/classes/class.assQuestionGUI.php';
 
  407                                 $questionGUI->object->setObjId($this->object->getId());
 
  408                                 $questionGUI->setQuestionTabs();
 
  411                                 require_once 
'Modules/TestQuestionPool/classes/class.ilAssQuestionHintsGUI.php';
 
  413                                 $ilCtrl->forwardCommand($gui);
 
  417                         case 'iltesttoplistgui':
 
  421                                 require_once 
'Modules/Test/classes/class.ilTestToplistGUI.php';
 
  424                                 $this->ctrl->forwardCommand($gui);              
 
  432                                 if (preg_match(
"/deleteqpl_\d+/", 
$cmd))
 
  434                                         $cmd = 
"randomQuestions";
 
  436                                 if ((strcmp(
$cmd, 
"properties") == 0) && (
$_GET[
"browse"]))
 
  441                                 if ((strcmp(
$cmd, 
"properties") == 0) && (
$_GET[
"up"] || 
$_GET[
"down"]))
 
  452                                     global $___prev_question_id;
 
  453                                     $___prev_question_id = 
$_REQUEST[
'prev_qid'];
 
  454                                     $this->ctrl->setParameterByClass(
'ilpageobjectgui', 
'prev_qid', 
$_REQUEST[
'prev_qid']);
 
  455                                     $this->ctrl->setParameterByClass(
$_GET[
'sel_question_types'] . 
'gui', 
'prev_qid', 
$_REQUEST[
'prev_qid']);
 
  457                                 $this->create_question_mode = 
true;
 
  460                                 $this->ctrl->setReturn($this, 
"questions");
 
  461                                 include_once 
"./Modules/TestQuestionPool/classes/class.assQuestionGUI.php";
 
  463                                 $q_gui->object->setObjId($this->object->getId());
 
  464                                 if (!
$_GET[
'sel_question_types'])
 
  467                                     $qType = 
$_GET[
'sel_question_types'];
 
  469                                 $this->ctrl->setParameterByClass($qType . 
"GUI", 
'prev_qid', 
$_REQUEST[
'prev_qid']);
 
  470                                 $this->ctrl->setParameterByClass($qType . 
"GUI", 
'test_ref_id', 
$_REQUEST[
'ref_id']);
 
  471                                 $this->ctrl->setParameterByClass($qType . 
"GUI", 
'q_id', 
$_REQUEST[
'q_id']);
 
  473                                     $this->ctrl->setParameterByClass($qType . 
"GUI", 
'test_express_mode', 1);
 
  475                                 #global $___test_express_mode; 
  476                                 #$___test_express_mode = true; 
  477                                 if (!$q_gui->isSaveCommand())
 
  478                                     $_GET[
'calling_test'] = $this->object->getRefId();
 
  480                                 $q_gui->setQuestionTabs();
 
  481                                 #unset($___test_express_mode); 
  482                                 $ret =& $this->ctrl->forwardCommand($q_gui);
 
  485                 if (strtolower(
$_GET[
"baseClass"]) != 
"iladministrationgui" &&
 
  504                 $this->tpl->getStandardTemplate();
 
  516                 require_once 
'Services/WebDAV/classes/class.ilDAVServer.php';
 
  526                 $this->ctrl->redirect($this, 
"infoScreen");
 
  531                 $this->ctrl->redirectByClass(
"iltestevaluationgui", 
"outEvaluation");
 
  540                 if($form->checkInput())
 
  542                         $this->ctrl->setParameter($this, 
"new_type", $this->type);
 
  547                 $form->setValuesByPost();
 
  548                 $this->tpl->setContent($form->getHTML());
 
  553                 include_once(
"./Modules/Test/classes/class.ilObjTest.php");
 
  555                 $defaults = $tst->getAvailableDefaults();
 
  556                 if (count($defaults))
 
  558                         foreach ($defaults as 
$row)
 
  560                                 $a_options[
"tstdef_".$row[
"test_defaults_id"]] = array($row[
"name"],
 
  561                                         $this->lng->txt(
"tst_default_settings"));
 
  566                 include_once 
"Services/Administration/classes/class.ilSettingsTemplate.php";
 
  570                         foreach($templates as $item)
 
  572                                 $a_options[
"tsttpl_".$item[
"id"]] = array($item[
"title"],
 
  573                                         nl2br(trim($item[
"description"])));
 
  587                         $testDefaultsId = $tstdef;
 
  589                         $a_new_object->applyDefaults($testDefaults);
 
  595                         include_once 
"Services/Administration/classes/class.ilSettingsTemplate.php";
 
  598                         $template_settings = $template->getSettings();
 
  599                         if($template_settings)
 
  604                         $a_new_object->setTemplate($template_id);
 
  607                 $a_new_object->saveToDb();
 
  612                         $a_new_object->
getRefId().
"&cmd=properties");
 
  617                 include_once 
"./Services/Utilities/classes/class.ilUtil.php";
 
  618                 $path = $this->tree->getPathFull($this->object->getRefID());
 
  624                 include_once 
"./Services/Utilities/classes/class.ilUtil.php";
 
  635                 if (!$ilAccess->checkAccess(
"write", 
"", $this->ref_id)) 
 
  639                         $this->ctrl->redirect($this, 
"infoScreen");
 
  642                 $export_dir = $this->
object->getExportDirectory();
 
  643                 $export_files = $this->
object->getExportFiles($export_dir);
 
  645                 if(count($export_files) > 0)
 
  647                         foreach($export_files as $exp_file)
 
  649                                 $file_arr = explode(
"__", $exp_file);
 
  650                                 array_push(
$data, array(
 
  652                                         'size' => filesize($export_dir.
"/".$exp_file),
 
  653                                         'date' => $file_arr[0]
 
  658                 include_once 
"./Modules/Test/classes/tables/class.ilTestExportTableGUI.php";
 
  660                 $table_gui->setData(
$data);
 
  661                 $this->tpl->setVariable(
'ADM_CONTENT', $table_gui->getHTML());  
 
  671                 if ($ilAccess->checkAccess(
"write", 
"", $this->ref_id))
 
  673                         include_once(
"./Modules/Test/classes/class.ilTestExport.php");
 
  675                         $test_exp->buildExportFile();
 
  681                 $this->ctrl->redirect($this, 
"export");
 
  691                 if ($ilAccess->checkAccess(
"write", 
"", $this->ref_id))
 
  693                         include_once(
"./Modules/Test/classes/class.ilTestExport.php");
 
  695                         $test_exp->buildExportFile();
 
  701                 $this->ctrl->redirect($this, 
"export");
 
  711                 if( !$ilAccess->checkAccess(
'write', 
'', $this->ref_id) )
 
  714                         $this->ctrl->redirect($this, 
'infoScreen');
 
  717                 if(!isset(
$_POST[
"file"]))
 
  720                         $this->ctrl->redirect($this, 
"export");
 
  723                 if (count(
$_POST[
"file"]) > 1)
 
  726                         $this->ctrl->redirect($this, 
"export");
 
  732                 if( !file_exists(
$file) )
 
  734                         $this->ctrl->redirect($this, 
'export');
 
  746                 if( !$ilAccess->checkAccess(
'write', 
'', $this->ref_id) )
 
  749                         $this->ctrl->redirect($this, 
'infoScreen');
 
  752                 if (!isset(
$_POST[
"file"]))
 
  755                         $this->ctrl->redirect($this, 
"export");
 
  760                 $export_dir = $this->
object->getExportDirectory();
 
  761                 $export_files = $this->
object->getExportFiles($export_dir);
 
  763                 if (count(
$_POST[
"file"]) > 0)
 
  765                         foreach (
$_POST[
"file"] as $exp_file)
 
  767                                 $file_arr = explode(
"__", $exp_file);
 
  768                                 array_push(
$data, array(
 
  770                                         'size' => filesize($export_dir.
"/".$exp_file),
 
  771                                         'date' => $file_arr[0]
 
  776                 include_once 
"./Modules/Test/classes/tables/class.ilTestExportTableGUI.php";
 
  778                 $table_gui->setData(
$data);
 
  779                 $this->tpl->setVariable(
'ADM_CONTENT', $table_gui->getHTML());  
 
  788                 if( !$ilAccess->checkAccess(
'write', 
'', $this->ref_id) )
 
  791                         $this->ctrl->redirect($this, 
'infoScreen');
 
  795                 $this->ctrl->redirect($this, 
"export");
 
  805                 if( !$ilAccess->checkAccess(
'write', 
'', $this->ref_id) )
 
  808                         $this->ctrl->redirect($this, 
'infoScreen');
 
  811                 $export_dir = $this->
object->getExportDirectory();
 
  814                         $file = basename($file);
 
  815                         $dir = substr($file, 0, strlen($file) - 4);
 
  817                         if( !strlen($file) || !strlen($dir) )
 
  822                         $exp_file = $export_dir.
"/".
$file;
 
  823                         $exp_dir = $export_dir.
"/".$dir;
 
  824                         if (@is_file($exp_file))
 
  828                         if (@is_dir($exp_dir))
 
  834                 $this->ctrl->redirect($this, 
"export");
 
  842                 if ($_FILES[
"xmldoc"][
"error"] > UPLOAD_ERR_OK)
 
  848                 include_once(
"./Modules/Test/classes/class.ilObjTest.php");
 
  853                 $file = pathinfo($_FILES[
"xmldoc"][
"name"]);
 
  854                 $full_path = $basedir.
"/".$_FILES[
"xmldoc"][
"name"];
 
  861                 $subdir = basename(
$file[
"basename"],
".".
$file[
"extension"]);
 
  868                 include_once 
"./Services/QTI/classes/class.ilQTIParser.php";
 
  870                 $result = $qtiParser->startParsing();
 
  871                 $founditems =& $qtiParser->getFoundItems();
 
  873                 if (count($founditems) == 0)
 
  887                 foreach ($founditems as $item)
 
  889                         if (strlen($item[
"type"]))
 
  909                 $_SESSION[
"tst_import_results_file"] = $results_file;
 
  910                 $_SESSION[
"tst_import_xml_file"] = $xml_file;
 
  911                 $_SESSION[
"tst_import_qti_file"] = $qti_file;
 
  912                 $_SESSION[
"tst_import_subdir"] = $subdir;
 
  914                 $this->tpl->addBlockFile(
"ADM_CONTENT", 
"adm_content", 
"tpl.tst_import_verification.html", 
"Modules/Test");
 
  915                 $row_class = array(
"tblrow1", 
"tblrow2");
 
  917                 foreach ($founditems as $item)
 
  919                         $this->tpl->setCurrentBlock(
"verification_row");
 
  920                         $this->tpl->setVariable(
"ROW_CLASS", $row_class[$counter++ % 2]);
 
  921                         $this->tpl->setVariable(
"QUESTION_TITLE", $item[
"title"]);
 
  922                         $this->tpl->setVariable(
"QUESTION_IDENT", $item[
"ident"]);
 
  923                         include_once 
"./Services/QTI/classes/class.ilQTIItem.php";
 
  924                         switch ($item[
"type"])
 
  926                                 case "MULTIPLE CHOICE QUESTION":
 
  928                                         $this->tpl->setVariable(
"QUESTION_TYPE", $this->lng->txt(
"qt_multiple_choice"));
 
  930                                 case "SINGLE CHOICE QUESTION":
 
  932                                         $this->tpl->setVariable(
"QUESTION_TYPE", $this->lng->txt(
"assSingleChoice"));
 
  934                                 case "NUMERIC QUESTION":
 
  936                                         $this->tpl->setVariable(
"QUESTION_TYPE", $this->lng->txt(
"assNumeric"));
 
  938                                 case "TEXTSUBSET QUESTION":
 
  940                                         $this->tpl->setVariable(
"QUESTION_TYPE", $this->lng->txt(
"assTextSubset"));
 
  942                                 case "CLOZE QUESTION":
 
  944                                         $this->tpl->setVariable(
"QUESTION_TYPE", $this->lng->txt(
"assClozeTest"));
 
  946                                 case "IMAGE MAP QUESTION":
 
  948                                         $this->tpl->setVariable(
"QUESTION_TYPE", $this->lng->txt(
"assImagemapQuestion"));
 
  950                                 case "JAVA APPLET QUESTION":
 
  952                                         $this->tpl->setVariable(
"QUESTION_TYPE", $this->lng->txt(
"assJavaApplet"));
 
  954                                 case "MATCHING QUESTION":
 
  956                                         $this->tpl->setVariable(
"QUESTION_TYPE", $this->lng->txt(
"assMatchingQuestion"));
 
  958                                 case "ORDERING QUESTION":
 
  960                                         $this->tpl->setVariable(
"QUESTION_TYPE", $this->lng->txt(
"assOrderingQuestion"));
 
  962                                 case "TEXT QUESTION":
 
  964                                         $this->tpl->setVariable(
"QUESTION_TYPE", $this->lng->txt(
"assTextQuestion"));
 
  967                         $this->tpl->parseCurrentBlock();
 
  974                 $this->tpl->setCurrentBlock(
"adm_content");
 
  975                 $this->tpl->setVariable(
"TEXT_TYPE", $this->lng->txt(
"question_type"));
 
  976                 $this->tpl->setVariable(
"TEXT_TITLE", $this->lng->txt(
"question_title"));
 
  977                 $this->tpl->setVariable(
"FOUND_QUESTIONS_INTRODUCTION", $this->lng->txt(
"tst_import_verify_found_questions"));
 
  978                 $this->tpl->setVariable(
"VERIFICATION_HEADING", $this->lng->txt(
"import_tst"));
 
  979                 $this->tpl->setVariable(
"FORMACTION", $this->ctrl->getFormAction($this));
 
  981                 $this->tpl->setVariable(
"QUESTIONPOOL_ID", $QplOrTstID);
 
  982                 $this->tpl->setVariable(
"VALUE_IMPORT", $this->lng->txt(
"import"));
 
  983                 $this->tpl->setVariable(
"VALUE_CANCEL", $this->lng->txt(
"cancel"));
 
  984                 $this->tpl->parseCurrentBlock();
 
  992                 include_once 
"./Modules/Test/classes/class.ilObjTest.php";
 
  996                 $newObj->setType(
$_GET[
"new_type"]);
 
  998                 $newObj->setTitle(
"dummy");
 
 1000                 $newObj->setDescription(
"test import");
 
 1002                 $newObj->create(
true);
 
 1004                 $newObj->createReference();
 
 1006                 $newObj->putInTree(
$_GET[
"ref_id"]);
 
 1008                 $newObj->setPermissions(
$_GET[
"ref_id"]);
 
 1010                 $newObj->notify(
"new",
$_GET[
"ref_id"],
$_GET[
"parent_non_rbac_id"],
$_GET[
"ref_id"],$newObj->getRefId());
 
 1012                 $newObj->mark_schema->flush();
 
 1015                 include_once 
"./Services/QTI/classes/class.ilQTIParser.php";
 
 1019                 if (
$_POST[
"qpl_id"] == 
"-1")
 
 1021                         $qpl_id = $newObj->id;
 
 1025                         $qpl_id = 
$_POST[
"qpl_id"];
 
 1029                 $qtiParser->setTestObject($newObj);
 
 1030                 $result = $qtiParser->startParsing();
 
 1031                 $newObj->saveToDb();
 
 1034                 include_once (
"./Modules/LearningModule/classes/class.ilContObjParser.php");
 
 1036                 $contParser->setQuestionMapping($qtiParser->getImportMapping());
 
 1037                 $contParser->startParsing();
 
 1040                 if (@file_exists(
$_SESSION[
"tst_import_results_file"]))
 
 1042                         include_once (
"./Modules/Test/classes/class.ilTestResultsImportParser.php");
 
 1051                 $newObj->updateMetaData();
 
 1054                                 "&baseClass=ilObjTestGUI");
 
 1079         function confirmChangeProperties($direction = self::SWITCH_RANDOM_TEST_SETTING_TO_DISABLED, $confirmCmd = 
'saveProperties', $cancelCmd = 
'properties')
 
 1081                 $this->tpl->addBlockFile(
"ADM_CONTENT", 
"adm_content", 
"tpl.il_as_tst_properties_save_confirmation.html", 
"Modules/Test");
 
 1085                         case self::SWITCH_RANDOM_TEST_SETTING_TO_DISABLED:
 
 1086                                 $information = $this->lng->txt(
"change_properties_from_random_to_standard");
 
 1088                         case self::SWITCH_RANDOM_TEST_SETTING_TO_ENABLED:
 
 1090                                 $information = $this->lng->txt(
"change_properties_from_standard_to_random");
 
 1093                 foreach (
$_POST as $key => $value)
 
 1095                         if (strcmp($key, 
"cmd") != 0)
 
 1097                                 if (is_array($value))
 
 1099                                         foreach ($value as $k => $v)
 
 1101                                                 $this->tpl->setCurrentBlock(
"hidden_variable");
 
 1102                                                 $this->tpl->setVariable(
"HIDDEN_KEY", $key . 
"[" . $k . 
"]");
 
 1103                                                 $this->tpl->setVariable(
"HIDDEN_VALUE", $v);
 
 1104                                                 $this->tpl->parseCurrentBlock();
 
 1109                                         $this->tpl->setCurrentBlock(
"hidden_variable");
 
 1110                                         $this->tpl->setVariable(
"HIDDEN_KEY", $key);
 
 1111                                         $this->tpl->setVariable(
"HIDDEN_VALUE", $value);
 
 1112                                         $this->tpl->parseCurrentBlock();
 
 1116                 $this->tpl->setCurrentBlock(
"hidden_variable");
 
 1117                 $this->tpl->setVariable(
"HIDDEN_KEY", 
"tst_properties_confirmation");
 
 1118                 $this->tpl->setVariable(
"HIDDEN_VALUE", 
"1");
 
 1119                 $this->tpl->parseCurrentBlock();
 
 1120                 $this->tpl->setCurrentBlock(
"adm_content");
 
 1121                 $this->tpl->setVariable(
"TXT_CONFIRMATION", $this->lng->txt(
"confirmation"));
 
 1122                 $this->tpl->setVariable(
"TXT_INFORMATION", $information);
 
 1123                 $this->tpl->setVariable(
"FORM_ACTION", $this->ctrl->getFormAction($this));
 
 1124                 $this->tpl->setVariable(
"CMD_CONFIRM", $confirmCmd);
 
 1125                 $this->tpl->setVariable(
"BTN_CONFIRM", $this->lng->txt(
"confirm"));
 
 1126                 $this->tpl->setVariable(
"CMD_CANCEL", $cancelCmd);
 
 1127                 $this->tpl->setVariable(
"BTN_CANCEL", $this->lng->txt(
"cancel"));
 
 1128                 $this->tpl->parseCurrentBlock();
 
 1141                         $total = $this->
object->evalTotalPersons();
 
 1145                                 $this->
object->setCountSystem(
$_POST[
"count_system"]);
 
 1146                                 $this->
object->setMCScoring(
$_POST[
"mc_scoring"]);
 
 1147                                 $this->
object->setScoreCutting(
$_POST[
"score_cutting"]);
 
 1148                                 $this->
object->setPassScoring(
$_POST[
"pass_scoring"]);
 
 1150                                 if( isset(
$_POST[
'obligations_enabled']) && 
$_POST[
'obligations_enabled'] )
 
 1152                                         $this->
object->setObligationsEnabled(
true);
 
 1156                                         $this->
object->setObligationsEnabled(
false);
 
 1159                                 if( isset(
$_POST[
'offer_hints']) && 
$_POST[
'offer_hints'] )
 
 1161                                         $this->
object->setOfferingQuestionHintsEnabled(
true);
 
 1165                                         $this->
object->setOfferingQuestionHintsEnabled(
false);
 
 1179                         $this->
object->setScoringFeedbackOptionsByArray(
$_POST[
'instant_feedback']);
 
 1182                         $this->
object->setScoreReporting(
$_POST[
"results_access"]);
 
 1185                                 $this->
object->setReportingDate(str_replace(array(
':', 
'-'), 
'', 
$_POST[
"reporting_date"][
'date'].
$_POST[
"reporting_date"][
'time']));
 
 1189                                 $this->
object->setReportingDate(
'');
 
 1192                         $this->
object->setShowPassDetails((is_array(
$_POST[
'results_presentation']) && in_array(
'pass_details', 
$_POST[
'results_presentation'])) ? 1 : 0);
 
 1193                         $this->
object->setShowSolutionDetails((is_array(
$_POST[
'results_presentation']) && in_array(
'solution_details', 
$_POST[
'results_presentation'])) ? 1 : 0);
 
 1194                         $this->
object->setShowSolutionPrintview((is_array(
$_POST[
'results_presentation']) && in_array(
'solution_printview', 
$_POST[
'results_presentation'])) ? 1 : 0);
 
 1195                         $this->
object->setShowSolutionFeedback((is_array(
$_POST[
'results_presentation']) && in_array(
'solution_feedback', 
$_POST[
'results_presentation'])) ? 1 : 0);
 
 1196                         $this->
object->setShowSolutionAnswersOnly((is_array(
$_POST[
'results_presentation']) && in_array(
'solution_answers_only', 
$_POST[
'results_presentation'])) ? 1 : 0);
 
 1197                         $this->
object->setShowSolutionSignature((is_array(
$_POST[
'results_presentation']) && in_array(
'solution_signature', 
$_POST[
'results_presentation'])) ? 1 : 0);
 
 1198                         $this->
object->setShowSolutionSuggested((is_array(
$_POST[
'results_presentation']) && in_array(
'solution_suggested', 
$_POST[
'results_presentation'])) ? 1 : 0);
 
 1200                         $this->
object->setExportSettingsSingleChoiceShort((is_array(
$_POST[
'export_settings']) && in_array(
'exp_sc_short', 
$_POST[
'export_settings'])) ? 1 : 0);
 
 1202                         $this->
object->setPrintBestSolutionWithResult((
int) 
$_POST[
'print_bs_with_res'] ? 
true : 
false);
 
 1204                         $this->
object->setPassDeletionAllowed((
bool)$_POST[
'pass_deletion_allowed']);
 
 1206                         $this->
object->saveToDb(
true);
 
 1208                         $this->ctrl->redirect($this, 
"scoring");
 
 1220                 if (!$ilAccess->checkAccess(
"write", 
"", $this->ref_id)) 
 
 1224                         $this->ctrl->redirect($this, 
"infoScreen");
 
 1229                 $template_settings = null;
 
 1230                 $template = $this->
object->getTemplate();
 
 1234                         include_once 
"Services/Administration/classes/class.ilSettingsTemplate.php";
 
 1235                         include_once 
"Modules/Test/classes/class.ilObjAssessmentFolderGUI.php";
 
 1239                         $template_settings = $template->getSettings();
 
 1242                 $save = (strcmp($this->ctrl->getCmd(), 
"saveScoring") == 0) ? TRUE : FALSE;
 
 1243                 $total = $this->
object->evalTotalPersons();
 
 1244                 $this->tpl->addJavascript(
"./Services/JavaScript/js/Basic.js");
 
 1246                 include_once(
"./Services/Form/classes/class.ilPropertyFormGUI.php");
 
 1248                 $form->setFormAction($this->ctrl->getFormAction($this));
 
 1249                 $form->setTableWidth(
"100%");
 
 1250                 $form->setId(
"test_properties_scoring");
 
 1254                 $header->setTitle($this->lng->txt(
"scoring"));
 
 1255                 $form->addItem($header);
 
 1258                 $count_system = 
new ilRadioGroupInputGUI($this->lng->txt(
"tst_text_count_system"), 
"count_system");
 
 1260                 $count_system->addOption(
new ilRadioOption($this->lng->txt(
"tst_count_correct_solutions"), 1, 
''));
 
 1261                 $count_system->setValue($this->object->getCountSystem());
 
 1262                 $count_system->setInfo($this->lng->txt(
"tst_count_system_description"));
 
 1265                         $count_system->setDisabled(
true);
 
 1267                 $form->addItem($count_system);
 
 1270                 $mc_scoring = 
new ilRadioGroupInputGUI($this->lng->txt(
"tst_score_mcmr_questions"), 
"mc_scoring");
 
 1271                 $mc_scoring->
addOption(
new ilRadioOption($this->lng->txt(
"tst_score_mcmr_zero_points_when_unanswered"), 0, 
''));
 
 1272                 $mc_scoring->addOption(
new ilRadioOption($this->lng->txt(
"tst_score_mcmr_use_scoring_system"), 1, 
''));
 
 1273                 $mc_scoring->setValue($this->object->getMCScoring());
 
 1274                 $mc_scoring->setInfo($this->lng->txt(
"tst_score_mcmr_questions_description"));
 
 1277                         $mc_scoring->setDisabled(
true);
 
 1279                 $form->addItem($mc_scoring);
 
 1282                 $score_cutting = 
new ilRadioGroupInputGUI($this->lng->txt(
"tst_score_cutting"), 
"score_cutting");
 
 1284                 $score_cutting->addOption(
new ilRadioOption($this->lng->txt(
"tst_score_cut_test"), 1, 
''));
 
 1285                 $score_cutting->setValue($this->object->getScoreCutting());
 
 1286                 $score_cutting->setInfo($this->lng->txt(
"tst_score_cutting_description"));
 
 1289                         $score_cutting->setDisabled(
true);
 
 1291                 $form->addItem($score_cutting);
 
 1296                 $pass_scoring->addOption(
new ilRadioOption($this->lng->txt(
"tst_pass_best_pass"), 1, 
''));
 
 1297                 $pass_scoring->setValue($this->object->getPassScoring());
 
 1298                 $pass_scoring->setInfo($this->lng->txt(
"tst_pass_scoring_description"));
 
 1301                         $pass_scoring->setDisabled(
true);
 
 1303                 $form->addItem($pass_scoring);
 
 1306                 $checkBoxEnableObligations = 
new ilCheckboxInputGUI($this->lng->txt(
"tst_setting_enable_obligations_label"), 
"obligations_enabled");
 
 1307                 $checkBoxEnableObligations->
setChecked($this->object->areObligationsEnabled());
 
 1308                 $checkBoxEnableObligations->setInfo($this->lng->txt(
"tst_setting_enable_obligations_info"));
 
 1311                         $checkBoxEnableObligations->setDisabled(
true);
 
 1313                 $form->addItem($checkBoxEnableObligations);
 
 1317                 $checkBoxOfferHints = 
new ilCheckboxInputGUI($this->lng->txt(
"tst_setting_offer_hints_label"), 
"offer_hints");
 
 1318                 $checkBoxOfferHints->
setChecked($this->object->isOfferingQuestionHintsEnabled());
 
 1319                 $checkBoxOfferHints->setInfo($this->lng->txt(
"tst_setting_offer_hints_info"));
 
 1322                         $checkBoxOfferHints->setDisabled(
true);
 
 1324                 $form->addItem($checkBoxOfferHints);
 
 1328                 $instant_feedback->
addOption(
new ilCheckboxOption($this->lng->txt(
"tst_instant_feedback_answer_specific"), 
'instant_feedback_specific', 
''));
 
 1329                 $instant_feedback->addOption(
new ilCheckboxOption($this->lng->txt(
"tst_instant_feedback_answer_generic"), 
'instant_feedback_generic', 
''));
 
 1330                 $instant_feedback->addOption(
new ilCheckboxOption($this->lng->txt(
"tst_instant_feedback_results"), 
'instant_feedback_points', 
''));
 
 1331                 $instant_feedback->addOption(
new ilCheckboxOption($this->lng->txt(
"tst_instant_feedback_solution"), 
'instant_feedback_solution', 
''));
 
 1333                 if ($this->object->getSpecificAnswerFeedback()) array_push($values, 
'instant_feedback_specific');
 
 1334                 if ($this->object->getGenericAnswerFeedback()) array_push($values, 
'instant_feedback_generic');
 
 1335                 if ($this->object->getAnswerFeedbackPoints()) array_push($values, 
'instant_feedback_points');
 
 1336                 if ($this->object->getInstantFeedbackSolution()) array_push($values, 
'instant_feedback_solution');
 
 1337                 $instant_feedback->setValue($values);
 
 1338                 $instant_feedback->setInfo($this->lng->txt(
"tst_instant_feedback_description"));
 
 1339                 $form->addItem($instant_feedback);
 
 1342                 $results_access = 
new ilRadioGroupInputGUI($this->lng->txt(
"tst_results_access"), 
"results_access");
 
 1344                 $results_access->addOption(
new ilRadioOption($this->lng->txt(
"tst_results_access_finished"), 1, 
''));
 
 1345                 $results_access_date_limitation = 
new ilRadioOption($this->lng->txt(
"tst_results_access_date"), 3, 
'');
 
 1346                 $results_access->addOption($results_access_date_limitation);            
 
 1347                 $results_access->addOption(
new ilRadioOption($this->lng->txt(
"tst_results_access_never"), 4, 
''));
 
 1348                 $results_access->
setValue($this->object->getScoreReporting());
 
 1349                 $results_access->setInfo($this->lng->txt(
"tst_results_access_description"));
 
 1353                 $reporting_date->setShowDate(
true);
 
 1354                 $reporting_date->setShowTime(
true);
 
 1355                 if (strlen($this->object->getReportingDate()))
 
 1363                 $results_access_date_limitation->addSubItem($reporting_date);
 
 1364                 $form->addItem($results_access);
 
 1366                 $results_print_best_solution = 
new ilCheckboxInputGUI($this->lng->txt(
"tst_results_print_best_solution"), 
"print_bs_with_res");
 
 1367                 $results_print_best_solution->
setInfo($this->lng->txt(
'tst_results_print_best_solution_info'));
 
 1368                 $results_print_best_solution->setValue(1);
 
 1369                 $results_print_best_solution->setChecked((
bool) $this->object->isBestSolutionPrintedWithResult());
 
 1370                 $form->addItem($results_print_best_solution);
 
 1373                 $results_presentation = 
new ilCheckboxGroupInputGUI($this->lng->txt(
"tst_results_presentation"), 
"results_presentation");
 
 1375                 $results_presentation->addOption(
new ilCheckboxOption($this->lng->txt(
"tst_show_solution_details"), 
'solution_details', 
''));
 
 1376                 $results_presentation->addOption(
new ilCheckboxOption($this->lng->txt(
"tst_show_solution_printview"), 
'solution_printview', 
''));
 
 1377                 $results_presentation->addOption(
new ilCheckboxOption($this->lng->txt(
"tst_show_solution_feedback"), 
'solution_feedback', 
''));
 
 1378                 $results_presentation->addOption(
new ilCheckboxOption($this->lng->txt(
"tst_show_solution_answers_only"), 
'solution_answers_only', 
''));
 
 1379                 $signatureOption = 
new ilCheckboxOption($this->lng->txt(
"tst_show_solution_signature"), 
'solution_signature', 
'');
 
 1380                 $results_presentation->addOption($signatureOption);
 
 1381                 $results_presentation->addOption(
new ilCheckboxOption($this->lng->txt(
"tst_show_solution_suggested"), 
'solution_suggested', 
''));
 
 1383                 if ($this->object->getShowPassDetails()) array_push($values, 
'pass_details');
 
 1384                 if ($this->object->getShowSolutionDetails()) array_push($values, 
'solution_details');
 
 1385                 if ($this->object->getShowSolutionPrintview()) array_push($values, 
'solution_printview');
 
 1386                 if ($this->object->getShowSolutionFeedback()) array_push($values, 
'solution_feedback');
 
 1387                 if ($this->object->getShowSolutionAnswersOnly()) array_push($values, 
'solution_answers_only');
 
 1388                 if ($this->object->getShowSolutionSignature()) array_push($values, 
'solution_signature');
 
 1389                 if ($this->object->getShowSolutionSuggested()) array_push($values, 
'solution_suggested');
 
 1390                 $results_presentation->setValue($values);
 
 1391                 $results_presentation->setInfo($this->lng->txt(
"tst_results_presentation_description"));
 
 1392                 if ($this->object->getAnonymity())
 
 1394                         $signatureOption->setDisabled(
true);
 
 1396                 $form->addItem($results_presentation);
 
 1399                 $passDeletion = 
new ilRadioGroupInputGUI($this->lng->txt(
"tst_pass_deletion"), 
"pass_deletion_allowed");
 
 1401                 $passDeletion->addOption(
new ilRadioOption($this->lng->txt(
"tst_pass_deletion_allowed"), 1, 
''));
 
 1402                 $passDeletion->setValue($this->object->isPassDeletionAllowed());
 
 1403                 $form->addItem($passDeletion);
 
 1409                 if ($this->object->getExportSettingsSingleChoiceShort()) array_push($values, 
'exp_sc_short');
 
 1410                 $export_settings->setValue($values);
 
 1411                 $form->addItem($export_settings);
 
 1413                 if ($ilAccess->checkAccess(
"write", 
"", 
$_GET[
"ref_id"])) $form->addCommandButton(
"saveScoring", $this->lng->txt(
"save"));
 
 1416                 if($template_settings)
 
 1418                         foreach($template_settings as $id => $item)
 
 1422                                         $form->removeItemByPostVar($id);
 
 1431                         $errors = !$form->checkInput();
 
 1432                         $form->setValuesByPost();
 
 1433                         if (
$errors) $checkonly = 
false;
 
 1435                 if (!$checkonly) $this->tpl->setVariable(
"ADM_CONTENT", $form->getHTML());
 
 1447                 if (!$ilAccess->checkAccess(
"write", 
"", $this->ref_id)) 
 
 1451                         $this->ctrl->redirect($this, 
"infoScreen");
 
 1455                 $template_settings = null;
 
 1456                 $template = $this->
object->getTemplate();
 
 1460                         include_once 
"Services/Administration/classes/class.ilSettingsTemplate.php";
 
 1463                         $template_settings = $template->getSettings();
 
 1464                         $hide_rte_switch = $template_settings[
"rte_switch"][
"hide"];
 
 1467                 $save = (strcmp($this->ctrl->getCmd(), 
"saveProperties") == 0) ? TRUE : FALSE;
 
 1468                 $total = $this->
object->evalTotalPersons();
 
 1469                 $this->tpl->addJavascript(
"./Services/JavaScript/js/Basic.js");
 
 1471                 include_once(
"./Services/Form/classes/class.ilPropertyFormGUI.php");
 
 1473                 $form->setFormAction($this->ctrl->getFormAction($this));
 
 1474                 $form->setTableWidth(
"100%");
 
 1475                 $form->setId(
"test_properties");
 
 1480                     $header->setTitle($this->lng->txt(
"tst_general_properties"));
 
 1481                     $form->addItem($header);
 
 1486                 include_once 
'Services/MetaData/classes/class.ilMD.php';
 
 1487                 $md_obj = 
new ilMD($this->object->getId(), 0, 
"tst");
 
 1491                 $title->setRequired(
true);
 
 1492                 $title->setValue($md_section->getTitle());
 
 1495                 $ids = $md_section->getDescriptionIds();
 
 1498                         $desc_obj = $md_section->getDescription(array_pop($ids));
 
 1503                         $desc->setValue($desc_obj->getDescription());
 
 1504                         $form->addItem($desc);
 
 1510                 $rb = 
new ilRadioOption($this->lng->txt(
'tst_anonymity_no_anonymization'), 0);
 
 1511                 $anonymity->addOption($rb);
 
 1512                 $rb = 
new ilRadioOption($this->lng->txt(
'tst_anonymity_anonymous_test'), 1);
 
 1513                 $anonymity->addOption($rb);
 
 1514                 $anonymity->
setValue((
int)$this->object->getAnonymity());
 
 1515                 $form->addItem($anonymity);
 
 1518                 $random = 
new ilCheckboxInputGUI($this->lng->txt(
"tst_random_selection"), 
"random_test");
 
 1520                 if (
$total) $random->setDisabled(
true);
 
 1521                 $random->setChecked($this->object->isRandomTest());
 
 1523                 $info = $this->lng->txt(
"tst_random_test_description");
 
 1524                 if ($this->object->hasQuestionsWithoutQuestionpool()) {
 
 1525                     $info .= $this->lng->txt(
"tst_random_test_description_warning");
 
 1527                 $random->setInfo($info);
 
 1528                 $form->addItem($random);
 
 1531                 $pool_usage = 
new ilCheckboxInputGUI($this->lng->txt(
"test_question_pool_usage"), 
"use_pool");
 
 1533                 $pool_usage->setChecked($this->object->getPoolUsage());
 
 1534                 $form->addItem($pool_usage);
 
 1539                 include_once 
"Services/Object/classes/class.ilObjectActivation.php";
 
 1540                 $this->lng->loadLanguageModule(
'rep');
 
 1543                 $section->setTitle($this->lng->txt(
'rep_activation_availability'));
 
 1547                 $act_obj_info = $act_ref_info = 
"";
 
 1550                         $act_obj_info = 
' '.$this->lng->txt(
'rep_activation_online_object_info');
 
 1551                         $act_ref_info = $this->lng->txt(
'rep_activation_access_ref_info');
 
 1555                 $online->
setChecked($this->object->isOnline());
 
 1556                 $online->setInfo($this->lng->txt(
'tst_activation_online_info').$act_obj_info);
 
 1557                 $form->addItem($online);                                
 
 1559                 $act_type = 
new ilRadioGroupInputGUI($this->lng->txt(
'rep_activation_access'),
'activation_type');
 
 1560                 $act_type->
setInfo($act_ref_info);
 
 1561                 $act_type->setValue($this->object->isActivationLimited() ? 
 
 1565                         $opt->
setInfo($this->lng->txt(
'tst_availability_limitless_info'));
 
 1566                         $act_type->addOption($opt);
 
 1569                         $opt->
setInfo($this->lng->txt(
'tst_availability_until_info'));
 
 1571                                 $date = $this->
object->getActivationStartingTime();                             
 
 1573                                 $start = 
new ilDateTimeInputGUI($this->lng->txt(
'rep_activation_limited_start'),
'act_starting_time');
 
 1574                                 #$start->setMode(ilDateTimeInputGUI::MODE_INPUT); 
 1577                                 $opt->addSubItem($start);
 
 1579                                 $date = $this->
object->getActivationEndingTime();
 
 1581                                 $end = 
new ilDateTimeInputGUI($this->lng->txt(
'rep_activation_limited_end'),
'act_ending_time');
 
 1582                                 #$end->setMode(ilDateTimeInputGUI::MODE_INPUT); 
 1585                                 $opt->addSubItem($end);
 
 1587                                 $visible = 
new ilCheckboxInputGUI($this->lng->txt(
'rep_activation_limited_visibility'), 
'activation_visibility');
 
 1588                                 $visible->
setInfo($this->lng->txt(
'tst_activation_limited_visibility_info'));
 
 1589                             $visible->setChecked($this->object->getActivationVisibility());
 
 1590                                 $opt->addSubItem($visible);
 
 1592                         $act_type->addOption($opt);
 
 1594                 $form->addItem($act_type);
 
 1600                     $header->setTitle($this->lng->txt(
"tst_beginning_ending_information"));
 
 1601                     $form->addItem($header);
 
 1605                 $intro = 
new ilTextAreaInputGUI($this->lng->txt(
"tst_introduction"), 
"introduction");
 
 1606                 $intro->
setValue($this->object->prepareTextareaOutput($this->object->getIntroduction()));
 
 1607                 $intro->setRows(10);
 
 1608                 $intro->setCols(80);
 
 1609                 $intro->setUseRte(TRUE);
 
 1610                 $intro->addPlugin(
"latex");
 
 1611                 $intro->addButton(
"latex");
 
 1612                 $intro->setRTESupport($this->object->getId(), 
"tst", 
'assessment', null, 
false, 
'3.4.7');
 
 1613                 $intro->setRteTagSet(
'full');
 
 1614                 $intro->setInfo($this->lng->txt(
'intro_desc'));
 
 1617                 $showinfo->setValue(1);
 
 1618                 $showinfo->setChecked($this->object->getShowInfo());
 
 1619                 $showinfo->setOptionTitle($this->lng->txt(
"showinfo"));
 
 1620                 $showinfo->setInfo($this->lng->txt(
"showinfo_desc"));
 
 1621                 $intro->addSubItem($showinfo);
 
 1622                 $form->addItem($intro);
 
 1625                 $finalstatement = 
new ilTextAreaInputGUI($this->lng->txt(
"final_statement"), 
"finalstatement");
 
 1626                 $finalstatement->
setValue($this->object->prepareTextareaOutput($this->object->getFinalStatement()));
 
 1627                 $finalstatement->setRows(10);
 
 1628                 $finalstatement->setCols(80);
 
 1629                 $finalstatement->setUseRte(TRUE);
 
 1630                 $finalstatement->addPlugin(
"latex");
 
 1631                 $finalstatement->addButton(
"latex");
 
 1632                 $finalstatement->setRTESupport($this->object->getId(), 
"tst", 
"assessment", null, 
false, 
'3.4.7');
 
 1633                 $finalstatement->setRteTagSet(
'full');
 
 1636                 $showfinal->setValue(1);
 
 1637                 $showfinal->setChecked($this->object->getShowFinalStatement());
 
 1638                 $showfinal->setOptionTitle($this->lng->txt(
"final_statement_show"));
 
 1639                 $showfinal->setInfo($this->lng->txt(
"final_statement_show_desc"));
 
 1640                 $finalstatement->addSubItem($showfinal);
 
 1641                 $form->addItem($finalstatement);
 
 1646                     $sessionheader->setTitle($this->lng->txt(
"tst_session_settings"));
 
 1647                     $form->addItem($sessionheader);
 
 1651                 $nr_of_tries = 
new ilTextInputGUI($this->lng->txt(
"tst_nr_of_tries"), 
"nr_of_tries");
 
 1653                 $nr_of_tries->setValue($this->object->getNrOfTries());
 
 1654                 $nr_of_tries->setRequired(
true);
 
 1655                 $nr_of_tries->setSuffix($this->lng->txt(
"0_unlimited"));
 
 1656                 if (
$total) $nr_of_tries->setDisabled(
true);
 
 1657                 $form->addItem($nr_of_tries);
 
 1660                 $processing = 
new ilCheckboxInputGUI($this->lng->txt(
"tst_processing_time"), 
"chb_processing_time");
 
 1664                 if ($template_settings && $template_settings[
'chb_processing_time'] && $template_settings[
'chb_processing_time'][
'value'])
 
 1665                     $processing->setChecked(
true);
 
 1667                     $processing->setChecked($this->object->getEnableProcessingTime());
 
 1671                 $ptime = $this->
object->getProcessingTimeAsArray();
 
 1672                 $processingtime->setHours($ptime[
'hh']);
 
 1673                 $processingtime->setMinutes($ptime[
'mm']);
 
 1674                 $processingtime->setSeconds($ptime[
'ss']);
 
 1675                 $processingtime->setShowMonths(
false);
 
 1676                 $processingtime->setShowDays(
false);
 
 1677                 $processingtime->setShowHours(
true);
 
 1678                 $processingtime->setShowMinutes(
true);
 
 1679                 $processingtime->setShowSeconds(
true);
 
 1680                 $processingtime->setInfo($this->lng->txt(
"tst_processing_time_desc"));
 
 1681                 $processing->addSubItem($processingtime);
 
 1685                 $resetprocessing->setValue(1);
 
 1686                 $resetprocessing->setOptionTitle($this->lng->txt(
"tst_reset_processing_time"));
 
 1687                 $resetprocessing->setChecked($this->object->getResetProcessingTime());
 
 1688                 $resetprocessing->setInfo($this->lng->txt(
"tst_reset_processing_time_desc"));
 
 1689                 $processing->addSubItem($resetprocessing);
 
 1690                 $form->addItem($processing);
 
 1693                 $enablestartingtime = 
new ilCheckboxInputGUI($this->lng->txt(
"tst_starting_time"), 
"chb_starting_time");
 
 1697                 if ($template_settings && $template_settings[
'chb_starting_time'] && $template_settings[
'chb_starting_time'][
'value'])
 
 1698                     $enablestartingtime->setChecked(
true);
 
 1700                     $enablestartingtime->setChecked(strlen($this->object->getStartingTime()));
 
 1703                 $startingtime->setShowDate(
true);
 
 1704                 $startingtime->setShowTime(
true);
 
 1705                 if (strlen($this->object->getStartingTime()))
 
 1713                 $enablestartingtime->addSubItem($startingtime);
 
 1714                 if (
$total) $enablestartingtime->setDisabled(
true);
 
 1715                 if (
$total) $startingtime->setDisabled(
true);
 
 1716                 $form->addItem($enablestartingtime);
 
 1719                 $enableendingtime = 
new ilCheckboxInputGUI($this->lng->txt(
"tst_ending_time"), 
"chb_ending_time");
 
 1722                 if ($template_settings && $template_settings[
'chb_ending_time'] && $template_settings[
'chb_ending_time'][
'value'])
 
 1723                     $enableendingtime->setChecked(
true);
 
 1725                     $enableendingtime->setChecked(strlen($this->object->getEndingTime()));
 
 1728                 $endingtime->setShowDate(
true);
 
 1729                 $endingtime->setShowTime(
true);
 
 1730                 if (strlen($this->object->getEndingTime()))
 
 1738                 $enableendingtime->addSubItem($endingtime);
 
 1739                 $form->addItem($enableendingtime);
 
 1742                 $password = 
new ilTextInputGUI($this->lng->txt(
"tst_password"), 
"password");
 
 1744                 $password->setValue($this->object->getPassword());
 
 1745                 $password->setInfo($this->lng->txt(
"tst_password_details"));
 
 1746                 $form->addItem($password);
 
 1751                     $seqheader->setTitle($this->lng->txt(
"tst_presentation_properties"));
 
 1752                     $form->addItem($seqheader);
 
 1756                 $prevanswers = 
new ilCheckboxInputGUI($this->lng->txt(
"tst_use_previous_answers"), 
"chb_use_previous_answers");
 
 1758                 $prevanswers->setChecked($this->object->getUsePreviousAnswers());
 
 1759                 $prevanswers->setInfo($this->lng->txt(
"tst_use_previous_answers_description"));
 
 1760                 $form->addItem($prevanswers);
 
 1765                 $forcejs->setChecked($this->object->getForceJS());
 
 1766                 $forcejs->setOptionTitle($this->lng->txt(
"forcejs"));
 
 1767                 $forcejs->setInfo($this->lng->txt(
"forcejs_desc"));
 
 1768                 $form->addItem($forcejs);
 
 1773                 $title_output->addOption(
new ilRadioOption($this->lng->txt(
"tst_title_output_hide_points"), 1, 
''));
 
 1774                 $title_output->addOption(
new ilRadioOption($this->lng->txt(
"tst_title_output_no_title"), 2, 
''));
 
 1775                 $title_output->setValue($this->object->getTitleOutput());
 
 1776                 $title_output->setInfo($this->lng->txt(
"tst_title_output_description"));
 
 1777                 $form->addItem($title_output);
 
 1782                 $autosave_output->setChecked($this->object->getAutosave());
 
 1783                 $autosave_output->setInfo($this->lng->txt(
'autosave_info'));
 
 1785                 $autosave_interval = 
new ilTextInputGUI($this->lng->txt(
'autosave_ival'), 
'autosave_ival');
 
 1786                 $autosave_interval->
setSize(10);
 
 1787                 $autosave_interval->setValue($this->object->getAutosaveIval() / 1000);
 
 1788                 $autosave_interval->setInfo($this->lng->txt(
'autosave_ival_info'));
 
 1789                 $autosave_output->addSubItem($autosave_interval);
 
 1790                 $form->addItem($autosave_output);
 
 1795                     $seqheader->setTitle($this->lng->txt(
"tst_sequence_properties"));
 
 1796                     $form->addItem($seqheader);
 
 1802                 $postpone->setChecked($this->object->getSequenceSettings());
 
 1803                 $postpone->setInfo($this->lng->txt(
"tst_postpone_description"));
 
 1804                 $form->addItem($postpone);
 
 1807                 $shuffle = 
new ilCheckboxInputGUI($this->lng->txt(
"tst_shuffle_questions"), 
"chb_shuffle_questions");
 
 1809                 $shuffle->setChecked($this->object->getShuffleQuestions());
 
 1810                 $shuffle->setInfo($this->lng->txt(
"tst_shuffle_questions_description"));
 
 1811                 $form->addItem($shuffle);
 
 1814                 $list_of_questions = 
new ilCheckboxInputGUI($this->lng->txt(
"tst_show_summary"), 
"list_of_questions");
 
 1817                 $list_of_questions->setChecked($this->object->getListOfQuestions());
 
 1818                 $list_of_questions->setInfo($this->lng->txt(
"tst_show_summary_description"));
 
 1821                 $list_of_questions_options->addOption(
new ilCheckboxOption($this->lng->txt(
"tst_list_of_questions_start"), 
'chb_list_of_questions_start', 
''));
 
 1822                 $list_of_questions_options->addOption(
new ilCheckboxOption($this->lng->txt(
"tst_list_of_questions_end"), 
'chb_list_of_questions_end', 
''));
 
 1823                 $list_of_questions_options->addOption(
new ilCheckboxOption($this->lng->txt(
"tst_list_of_questions_with_description"), 
'chb_list_of_questions_with_description', 
''));
 
 1825                 if ($this->object->getListOfQuestionsStart()) array_push($values, 
'chb_list_of_questions_start');
 
 1826                 if ($this->object->getListOfQuestionsEnd()) array_push($values, 
'chb_list_of_questions_end');
 
 1827                 if ($this->object->getListOfQuestionsDescription()) array_push($values, 
'chb_list_of_questions_with_description');
 
 1828                 $list_of_questions_options->setValue($values);
 
 1830                 $list_of_questions->addSubItem($list_of_questions_options);
 
 1831                 $form->addItem($list_of_questions);
 
 1834                 $marking = 
new ilCheckboxInputGUI($this->lng->txt(
"question_marking"), 
"chb_show_marker");
 
 1836                 $marking->setChecked($this->object->getShowMarker());
 
 1837                 $marking->setInfo($this->lng->txt(
"question_marking_description"));
 
 1838                 $form->addItem($marking);
 
 1841                 $cancel = 
new ilCheckboxInputGUI($this->lng->txt(
"tst_show_cancel"), 
"chb_show_cancel");
 
 1843                 $cancel->setChecked($this->object->getShowCancel());
 
 1844                 $cancel->setInfo($this->lng->txt(
"tst_show_cancel_description"));
 
 1845                 $form->addItem($cancel);
 
 1850                     $notifications->setTitle($this->lng->txt(
"tst_mail_notification"));
 
 1851                     $form->addItem($notifications);
 
 1855                 $mailnotification = 
new ilRadioGroupInputGUI($this->lng->txt(
"tst_finish_notification"), 
"mailnotification");
 
 1857                 $mailnotification->addOption(
new ilRadioOption($this->lng->txt(
"tst_finish_notification_simple"), 1, 
''));
 
 1858                 $mailnotification->addOption(
new ilRadioOption($this->lng->txt(
"tst_finish_notification_advanced"), 2, 
''));
 
 1859                 $mailnotification->setValue($this->object->getMailNotification());
 
 1860                 $form->addItem($mailnotification);
 
 1863                 $mailnottype->setValue(1);
 
 1864                 $mailnottype->setOptionTitle($this->lng->txt(
"mailnottype"));
 
 1865                 $mailnottype->setChecked($this->object->getMailNotificationType());
 
 1866                 $form->addItem($mailnottype);
 
 1870                 $highscore_head->setTitle($this->lng->txt(
"tst_highscore_options"));
 
 1871                 $form->addItem($highscore_head);                
 
 1873                 $highscore = 
new ilCheckboxInputGUI($this->lng->txt(
"tst_highscore_enabled"), 
"highscore_enabled");
 
 1875                 $highscore->setChecked($this->object->getHighscoreEnabled());
 
 1876                 $highscore->setInfo($this->lng->txt(
"tst_highscore_description"));
 
 1877                 $form->addItem($highscore);
 
 1879                 $highscore_anon = 
new ilCheckboxInputGUI($this->lng->txt(
"tst_highscore_anon"), 
"highscore_anon");
 
 1881                 $highscore_anon->setChecked($this->object->getHighscoreAnon());
 
 1882                 $highscore_anon->setInfo($this->lng->txt(
"tst_highscore_anon_description"));
 
 1883                 $highscore->addSubItem($highscore_anon);
 
 1885                 $highscore_achieved_ts = 
new ilCheckboxInputGUI($this->lng->txt(
"tst_highscore_achieved_ts"), 
"highscore_achieved_ts");
 
 1886                 $highscore_achieved_ts->
setValue(1);
 
 1887                 $highscore_achieved_ts->setChecked($this->object->getHighscoreAchievedTS());
 
 1888                 $highscore_achieved_ts->setInfo($this->lng->txt(
"tst_highscore_achieved_ts_description"));
 
 1889                 $highscore->addSubItem($highscore_achieved_ts);
 
 1891                 $highscore_score = 
new ilCheckboxInputGUI($this->lng->txt(
"tst_highscore_score"), 
"highscore_score");
 
 1893                 $highscore_score->setChecked($this->object->getHighscoreScore());
 
 1894                 $highscore_score->setInfo($this->lng->txt(
"tst_highscore_score_description"));
 
 1895                 $highscore->addSubItem($highscore_score);
 
 1897                 $highscore_percentage = 
new ilCheckboxInputGUI($this->lng->txt(
"tst_highscore_percentage"), 
"highscore_percentage");
 
 1898                 $highscore_percentage->
setValue(1);
 
 1899                 $highscore_percentage->setChecked($this->object->getHighscorePercentage());
 
 1900                 $highscore_percentage->setInfo($this->lng->txt(
"tst_highscore_percentage_description"));
 
 1901                 $highscore->addSubItem($highscore_percentage);
 
 1903                 $highscore_hints = 
new ilCheckboxInputGUI($this->lng->txt(
"tst_highscore_hints"), 
"highscore_hints");
 
 1905                 $highscore_hints->setChecked($this->object->getHighscoreHints()); 
 
 1906                 $highscore_hints->setInfo($this->lng->txt(
"tst_highscore_hints_description"));
 
 1907                 $highscore->addSubItem($highscore_hints);
 
 1909                 $highscore_wtime = 
new ilCheckboxInputGUI($this->lng->txt(
"tst_highscore_wtime"), 
"highscore_wtime");
 
 1911                 $highscore_wtime->setChecked($this->object->getHighscoreWTime());
 
 1912                 $highscore_wtime->setInfo($this->lng->txt(
"tst_highscore_wtime_description"));
 
 1913                 $highscore->addSubItem($highscore_wtime);
 
 1915                 $highscore_own_table = 
new ilCheckboxInputGUI($this->lng->txt(
"tst_highscore_own_table"), 
"highscore_own_table");
 
 1917                 $highscore_own_table->setChecked($this->object->getHighscoreOwnTable());
 
 1918                 $highscore_own_table->setInfo($this->lng->txt(
"tst_highscore_own_table_description"));
 
 1919                 $highscore->addSubItem($highscore_own_table);
 
 1921                 $highscore_top_table = 
new ilCheckboxInputGUI($this->lng->txt(
"tst_highscore_top_table"), 
"highscore_top_table");
 
 1923                 $highscore_top_table->setChecked($this->object->getHighscoreTopTable());
 
 1924                 $highscore_top_table->setInfo($this->lng->txt(
"tst_highscore_top_table_description"));
 
 1925                 $highscore->addSubItem($highscore_top_table);
 
 1927                 $highscore_top_num = 
new ilTextInputGUI($this->lng->txt(
"tst_highscore_top_num"), 
"highscore_top_num");
 
 1928                 $highscore_top_num->
setSize(4);
 
 1929                 $highscore_top_num->setSuffix($this->lng->txt(
"tst_highscore_top_num_unit"));
 
 1930                 $highscore_top_num->setValue($this->object->getHighscoreTopNum());
 
 1931                 $highscore_top_table->setInfo($this->lng->txt(
"tst_highscore_top_num_description"));
 
 1932                 $highscore->addSubItem($highscore_top_num);
 
 1937                     $kioskheader->setTitle($this->lng->txt(
"kiosk"));
 
 1938                     $form->addItem($kioskheader);
 
 1944                 $kiosk->setChecked($this->object->getKioskMode());
 
 1945                 $kiosk->setInfo($this->lng->txt(
"kiosk_description"));
 
 1950                 $kiosktitle->addOption(
new ilCheckboxOption($this->lng->txt(
"kiosk_show_participant"), 
'kiosk_participant', 
''));
 
 1952                 if ($this->object->getShowKioskModeTitle()) array_push($values, 
'kiosk_title');
 
 1953                 if ($this->object->getShowKioskModeParticipant()) array_push($values, 
'kiosk_participant');
 
 1954                 $kiosktitle->setValue($values);
 
 1955                 $kiosktitle->setInfo($this->lng->txt(
"kiosk_options_desc"));
 
 1956                 $kiosk->addSubItem($kiosktitle);
 
 1958                 $form->addItem($kiosk);
 
 1963                     $restrictions->setTitle($this->lng->txt(
"tst_max_allowed_users"));
 
 1964                     $form->addItem($restrictions);
 
 1967                 $fixedparticipants = 
new ilCheckboxInputGUI($this->lng->txt(
'participants_invitation'), 
"fixedparticipants");
 
 1969                 $fixedparticipants->setChecked($this->object->getFixedParticipants());
 
 1970                 $fixedparticipants->setOptionTitle($this->lng->txt(
"tst_allow_fixed_participants"));
 
 1971                 $fixedparticipants->setInfo($this->lng->txt(
"participants_invitation_description"));
 
 1972                 $invited_users = $this->
object->getInvitedUsers();
 
 1973                 if (
$total && (count($invited_users) == 0))
 
 1975                         $fixedparticipants->setDisabled(
true);
 
 1977                 $form->addItem($fixedparticipants);
 
 1981                 $simul = 
new ilTextInputGUI($this->lng->txt(
"tst_allowed_users"), 
"allowedUsers");
 
 1983                 $simul->setValue(($this->object->getAllowedUsers()) ? $this->object->getAllowedUsers() : 
'');
 
 1984                 $form->addItem($simul);
 
 1987                 $idle = 
new ilTextInputGUI($this->lng->txt(
"tst_allowed_users_time_gap"), 
"allowedUsersTimeGap");
 
 1989                 $idle->setSuffix($this->lng->txt(
"seconds"));
 
 1990                 $idle->setValue(($this->object->getAllowedUsersTimeGap()) ? $this->object->getAllowedUsersTimeGap() : 
'');
 
 1991                 $form->addItem($idle);
 
 1994                 include_once 
'Modules/Test/classes/class.ilECSTestSettings.php';
 
 1996                 $ecs->addSettingsToForm($form, 
'tst');
 
 1998                 if ($ilAccess->checkAccess(
"write", 
"", 
$_GET[
"ref_id"])) $form->addCommandButton(
"saveProperties", $this->lng->txt(
"save"));
 
 2001                 if($template_settings)
 
 2003                         foreach($template_settings as $id => $item)
 
 2007                                         $form->removeItemByPostVar($id);
 
 2016                         $errors = !$form->checkInput();
 
 2020                         $form->setValuesByPost();
 
 2021                         if( $online->getChecked() && !$this->
object->isComplete() )
 
 2023                                 $online->setAlert($this->lng->txt(
"cannot_switch_to_online_no_questions_andor_no_mark_steps"));
 
 2027                         if (
$errors) $checkonly = 
false;                        
 
 2038                                 $link = $this->ctrl->getLinkTarget($this, 
"confirmResetTemplate");
 
 2039                                 $link = 
"<a href=\"".$link.
"\">".$this->lng->txt(
"test_using_template_link").
"</a>";
 
 2040                                 $message = 
"<div style=\"margin-top:10px\">".
 
 2041                                         $tpl->getMessageHTML(sprintf($this->lng->txt(
"test_using_template"), $template->getTitle(), $link), 
"info").
 
 2045                         $this->tpl->setVariable(
"ADM_CONTENT", $form->getHTML().$message);
 
 2053                 $fields = array(
'act_starting_time', 
'act_ending_time', 
'starting_time', 
'ending_time');
 
 2055                 foreach($fields as $field)
 
 2078                 if (!array_key_exists(
"tst_properties_confirmation", 
$_POST))
 
 2088             $template_settings = null;
 
 2089                         $template = $this->
object->getTemplate();
 
 2092                                 include_once 
"Services/Administration/classes/class.ilSettingsTemplate.php";
 
 2095                                 $template_settings = $template->getSettings();
 
 2100                         include_once 
'Services/MetaData/classes/class.ilMD.php';
 
 2101                         $md_obj =& 
new ilMD($this->object->getId(), 0, 
"tst");
 
 2109                         $md_desc_ids = $md_section->getDescriptionIds();
 
 2112                                 $md_desc = $md_section->getDescription(array_pop($md_desc_ids));
 
 2117                             $md_desc = $md_section->addDescription();
 
 2124                         $this->
object->update();
 
 2126                         $total = $this->
object->evalTotalPersons();
 
 2127                         $randomtest_switch = 
false;
 
 2131                                 if (!strlen(
$_POST[
"random_test"]))
 
 2137                                         $random_test = 
$_POST[
"random_test"];
 
 2140                                 if (!array_key_exists(
"tst_properties_confirmation", 
$_POST))
 
 2142                                         if( !$random_test && $this->object->areRandomTestQuestionpoolsConfigured() )
 
 2148                                         elseif( $random_test && $this->object->doesNonRandomTestQuestionsExist() )
 
 2158                                 $random_test = $this->
object->isRandomTest();
 
 2164                         $online = 
$_POST[
"online"];
 
 2170                                 if( $randomtest_switch && $this->object->isOnline() && $online )
 
 2176                                         $info = $this->lng->txt(
 
 2177                                                 "tst_set_offline_due_to_switched_random_test_setting" 
 2183                                 $this->
object->setAnonymity(
$_POST[
"anonymity"]);
 
 2184                                 $this->
object->setRandomTest($random_test);
 
 2185                                 $this->
object->setNrOfTries(
$_POST[
"nr_of_tries"]);                     
 
 2189                         $this->
object->setOnline($online);                      
 
 2194                                 $this->
object->setActivationLimited(
true);                                                                                      
 
 2195                                 $this->
object->setActivationVisibility(
$_POST[
"activation_visibility"]);
 
 2198                                 $this->
object->setActivationStartingTime($date->get(
IL_CAL_UNIX));
 
 2201                                 $this->
object->setActivationEndingTime($date->get(
IL_CAL_UNIX));                                                        
 
 2205                                 $this->
object->setActivationLimited(
false);
 
 2208                         include_once 
"./Services/AdvancedEditing/classes/class.ilObjAdvancedEditing.php";
 
 2210                         $this->
object->setShowInfo((
$_POST[
"showinfo"]) ? 1 : 0);
 
 2212                         $this->
object->setShowFinalStatement((
$_POST[
"showfinalstatement"]) ? 1 : 0);
 
 2213                         $this->
object->setSequenceSettings((
$_POST[
"chb_postpone"]) ? 1 : 0);
 
 2214                         $this->
object->setShuffleQuestions((
$_POST[
"chb_shuffle_questions"]) ? 1 : 0);
 
 2215                         $this->
object->setListOfQuestions(
$_POST[
"list_of_questions"]);
 
 2216                         if (is_array(
$_POST[
"list_of_questions_options"]))
 
 2218                                 $this->
object->setListOfQuestionsStart((in_array(
'chb_list_of_questions_start', 
$_POST[
"list_of_questions_options"])) ? 1 : 0);
 
 2219                                 $this->
object->setListOfQuestionsEnd((in_array(
'chb_list_of_questions_end', 
$_POST[
"list_of_questions_options"])) ? 1 : 0);
 
 2220                                 $this->
object->setListOfQuestionsDescription((in_array(
'chb_list_of_questions_with_description', 
$_POST[
"list_of_questions_options"])) ? 1 : 0);
 
 2224                                 $this->
object->setListOfQuestionsStart(0);
 
 2225                                 $this->
object->setListOfQuestionsEnd(0);
 
 2226                                 $this->
object->setListOfQuestionsDescription(0);
 
 2228                         $this->
object->setMailNotification(
$_POST[
"mailnotification"]);
 
 2229                         $this->
object->setMailNotificationType(
$_POST[
"mailnottype"]);
 
 2230                         $this->
object->setShowMarker((
$_POST[
"chb_show_marker"]) ? 1 : 0);
 
 2231                         $this->
object->setShowCancel((
$_POST[
"chb_show_cancel"]) ? 1 : 0);
 
 2232                         $this->
object->setKioskMode((
$_POST[
"kiosk"]) ? 1 : 0);
 
 2233                         $this->
object->setShowKioskModeTitle((is_array(
$_POST[
"kiosk_options"]) && in_array(
'kiosk_title', 
$_POST[
"kiosk_options"])) ? 1 : 0);
 
 2234                         $this->
object->setShowKioskModeParticipant((is_array(
$_POST[
"kiosk_options"]) && in_array(
'kiosk_participant', 
$_POST[
"kiosk_options"])) ? 1 : 0);
 
 2235                         $this->
object->setEnableProcessingTime((
$_POST[
"chb_processing_time"]) ? 1 : 0);
 
 2236                         if ($this->object->getEnableProcessingTime())
 
 2238                                 $this->
object->setProcessingTime(sprintf(
"%02d:%02d:%02d",
 
 2239                                         $_POST[
"processing_time"][
"hh"],
 
 2240                                         $_POST[
"processing_time"][
"mm"],
 
 2241                                         $_POST[
"processing_time"][
"ss"]
 
 2246                                 $this->
object->setProcessingTime(
'');
 
 2248                         $this->
object->setResetProcessingTime((
$_POST[
"chb_reset_processing_time"]) ? 1 : 0);   
 
 2252                                 if( 
$_POST[
'chb_starting_time'] )
 
 2256                                 elseif( !
$_POST[
'chb_starting_time'] )
 
 2258                                         $this->
object->setStartingTime(
'');
 
 2262                         if (
$_POST[
'chb_ending_time'])
 
 2268                                 $this->
object->setEndingTime(
'');
 
 2271                         $this->
object->setUsePreviousAnswers((
$_POST[
"chb_use_previous_answers"]) ? 1 : 0);
 
 2272                         $this->
object->setForceJS((
$_POST[
"forcejs"]) ? 1 : 0);
 
 2273                         $this->
object->setTitleOutput(
$_POST[
"title_output"]);
 
 2274                         $this->
object->setPassword(
$_POST[
"password"]);
 
 2275                         $this->
object->setAllowedUsers(
$_POST[
"allowedUsers"]);
 
 2276                         $this->
object->setAllowedUsersTimeGap(
$_POST[
"allowedUsersTimeGap"]);
 
 2278                         $this->
object->setAutosave(
$_POST[
'autosave']);
 
 2279                         $this->
object->setAutosaveIval(((
int)
$_POST[
'autosave_ival']) * 1000);
 
 2281                         if ($this->object->isRandomTest())
 
 2283                                 $this->
object->setUsePreviousAnswers(0);
 
 2286                         $invited_users = $this->
object->getInvitedUsers();
 
 2287                         if (!(
$total && (count($invited_users) == 0)))
 
 2289                                 $fixed_participants = 0;
 
 2290                                 if (array_key_exists(
"fixedparticipants", $_POST))
 
 2292                                         if ($_POST[
"fixedparticipants"])
 
 2294                                                 $fixed_participants = 1;
 
 2297                                 $this->
object->setFixedParticipants($fixed_participants);
 
 2298                                 if (!$fixed_participants)
 
 2300                                         $invited_users = $this->
object->getInvitedUsers();
 
 2301                                         foreach ($invited_users as $user_object)
 
 2303                                                 $this->
object->disinviteUser($user_object[
"usr_id"]);
 
 2308                         $this->
object->setHighscoreEnabled((
bool) $_POST[
'highscore_enabled']);
 
 2309                         $this->
object->setHighscoreAnon((
bool) $_POST[
'highscore_anon']);
 
 2310                         $this->
object->setHighscoreAchievedTS((
bool) $_POST[
'highscore_achieved_ts']);
 
 2311                         $this->
object->setHighscoreScore((
bool) $_POST[
'highscore_score']);
 
 2312                         $this->
object->setHighscorePercentage((
bool) $_POST[
'highscore_percentage']);
 
 2313                         $this->
object->setHighscoreHints((
bool) $_POST[
'highscore_hints']);
 
 2314                         $this->
object->setHighscoreWTime((
bool) $_POST[
'highscore_wtime']);
 
 2315                         $this->
object->setHighscoreOwnTable((
bool) $_POST[
'highscore_own_table']);
 
 2316                         $this->
object->setHighscoreTopTable((
bool) $_POST[
'highscore_top_table']);
 
 2317                         $this->
object->setHighscoreTopNum((
int) $_POST[
'highscore_top_num']);
 
 2320             $this->
object->setEnabledViewMode($_POST[
'enabled_view_mode']);
 
 2321             $this->
object->setPoolUsage($_POST[
'use_pool']);
 
 2323                         $this->
object->saveToDb(
true);
 
 2326                         include_once 
'Modules/Test/classes/class.ilECSTestSettings.php';        
 
 2328                         $ecs->handleSettingsUpdate();   
 
 2331                         if ($randomtest_switch)
 
 2333                                 if($this->object->isRandomTest())
 
 2335                                         $this->
object->removeNonRandomTestData();
 
 2339                                         $this->
object->removeRandomTestData();
 
 2343                         $this->ctrl->redirect($this, 
'properties');
 
 2353                 include_once(
"./Modules/File/classes/class.ilObjFile.php");
 
 2355                 $fileObj->sendFile();
 
 2364                 include_once(
"./Services/COPage/classes/class.ilPageObjectGUI.php");
 
 2367                 $page_gui->showMediaFullscreen();
 
 2376                 include_once(
"./Services/COPage/classes/class.ilPageObject.php");
 
 2378                 $pg_obj->send_paragraph (
$_GET[
"par_id"], 
$_GET[
"downloadtitle"]);
 
 2415                 $this->ctrl->redirect($this, 
"questions");
 
 2429                 $parent_ref = $tree->getParentId($this->object->getRefId());
 
 2430                 include_once 
"./Modules/TestQuestionPool/classes/class.ilObjQuestionPool.php";
 
 2432                 $qpl->setType(
"qpl");
 
 2433                 $qpl->setTitle($name);
 
 2434                 $qpl->setDescription($description);
 
 2436                 $qpl->createReference();
 
 2437                 $qpl->putInTree($parent_ref);
 
 2438                 $qpl->setPermissions($parent_ref);
 
 2441                 return $qpl->getRefId();
 
 2451                 $this->tpl->addBlockFile(
"ADM_CONTENT", 
"adm_content", 
"tpl.il_as_tst_random_select.html", 
"Modules/Test");
 
 2452                 $questionpools =& $this->
object->getAvailableQuestionpools(FALSE, FALSE, FALSE, TRUE);
 
 2453                 $this->tpl->setCurrentBlock(
"option");
 
 2454                 $this->tpl->setVariable(
"VALUE_OPTION", 
"0");
 
 2455                 $this->tpl->setVariable(
"TEXT_OPTION", $this->lng->txt(
"all_available_question_pools"));
 
 2456                 $this->tpl->parseCurrentBlock();
 
 2457                 foreach ($questionpools as $key => $value)
 
 2459                         $this->tpl->setCurrentBlock(
"option");
 
 2460                         $this->tpl->setVariable(
"VALUE_OPTION", $key);
 
 2461                         $this->tpl->setVariable(
"TEXT_OPTION", $value[
"title"]);
 
 2462                         $this->tpl->parseCurrentBlock();
 
 2464                 $this->tpl->setCurrentBlock(
"hidden");
 
 2465                 $this->tpl->setVariable(
"HIDDEN_NAME", 
"sel_question_types");
 
 2466                 $this->tpl->setVariable(
"HIDDEN_VALUE", 
$_POST[
"sel_question_types"]);
 
 2467                 $this->tpl->parseCurrentBlock();
 
 2468                 $this->tpl->setCurrentBlock(
"adm_content");
 
 2469                 $this->tpl->setVariable(
"FORM_ACTION", $this->ctrl->getFormAction($this));
 
 2470                 $this->tpl->setVariable(
"TXT_QPL_SELECT", $this->lng->txt(
"tst_random_select_questionpool"));
 
 2471                 $this->tpl->setVariable(
"TXT_NR_OF_QUESTIONS", $this->lng->txt(
"tst_random_nr_of_questions"));
 
 2472                 $this->tpl->setVariable(
"BTN_SUBMIT", $this->lng->txt(
"submit"));
 
 2473                 $this->tpl->setVariable(
"BTN_CANCEL", $this->lng->txt(
"cancel"));
 
 2474                 $this->tpl->parseCurrentBlock();
 
 2486                 $this->ctrl->redirect($this, 
"questions");
 
 2499                 $question_array = $this->
object->randomSelectQuestions(
$_POST[
"nr_of_questions"], 
$_POST[
"sel_qpl"]);
 
 2500                 $this->tpl->addBlockFile(
"ADM_CONTENT", 
"adm_content", 
"tpl.il_as_tst_random_question_offer.html", 
"Modules/Test");
 
 2501                 $color_class = array(
"tblrow1", 
"tblrow2");
 
 2503                 $questionpools =& $this->
object->getAvailableQuestionpools(
true);
 
 2504                 include_once 
"./Modules/TestQuestionPool/classes/class.assQuestion.php";
 
 2505                 foreach ($question_array as $question_id)
 
 2507                         $dataset = $this->
object->getQuestionDataset($question_id);
 
 2508                         $this->tpl->setCurrentBlock(
"QTab");
 
 2509                         $this->tpl->setVariable(
"COLOR_CLASS", $color_class[$counter % 2]);
 
 2510                         $this->tpl->setVariable(
"QUESTION_TITLE", $dataset->title);
 
 2511                         $this->tpl->setVariable(
"QUESTION_COMMENT", $dataset->description);
 
 2513                         $this->tpl->setVariable(
"QUESTION_AUTHOR", $dataset->author);
 
 2514                         $this->tpl->setVariable(
"QUESTION_POOL", $questionpools[$dataset->obj_fi][
"title"]);
 
 2515                         $this->tpl->parseCurrentBlock();
 
 2518                 if (count($question_array) == 0)
 
 2520                         $this->tpl->setCurrentBlock(
"Emptytable");
 
 2521                         $this->tpl->setVariable(
"TEXT_NO_QUESTIONS_AVAILABLE", $this->lng->txt(
"no_questions_available"));
 
 2522                         $this->tpl->parseCurrentBlock();
 
 2526                         $this->tpl->setCurrentBlock(
"Selectionbuttons");
 
 2527                         $this->tpl->setVariable(
"BTN_YES", $this->lng->txt(
"random_accept_sample"));
 
 2528                         $this->tpl->setVariable(
"BTN_NO", $this->lng->txt(
"random_another_sample"));
 
 2529                         $this->tpl->parseCurrentBlock();
 
 2531                 $chosen_questions = join($question_array, 
",");
 
 2532                 $this->tpl->setCurrentBlock(
"adm_content");
 
 2533                 $this->tpl->setVariable(
"FORM_ACTION", $this->ctrl->getFormAction($this));
 
 2534                 $this->tpl->setVariable(
"QUESTION_TITLE", $this->lng->txt(
"tst_question_title"));
 
 2535                 $this->tpl->setVariable(
"QUESTION_COMMENT", $this->lng->txt(
"description"));
 
 2536                 $this->tpl->setVariable(
"QUESTION_TYPE", $this->lng->txt(
"tst_question_type"));
 
 2537                 $this->tpl->setVariable(
"QUESTION_AUTHOR", $this->lng->txt(
"author"));
 
 2538                 $this->tpl->setVariable(
"QUESTION_POOL", $this->lng->txt(
"qpl"));
 
 2539                 $this->tpl->setVariable(
"VALUE_CHOSEN_QUESTIONS", $chosen_questions);
 
 2540                 $this->tpl->setVariable(
"VALUE_QUESTIONPOOL_SELECTION", 
$_POST[
"sel_qpl"]);
 
 2541                 $this->tpl->setVariable(
"VALUE_NR_OF_QUESTIONS", 
$_POST[
"nr_of_questions"]);
 
 2542                 $this->tpl->setVariable(
"TEXT_QUESTION_OFFER", $this->lng->txt(
"tst_question_offer"));
 
 2543                 $this->tpl->setVariable(
"BTN_CANCEL", $this->lng->txt(
"cancel"));
 
 2544                 $this->tpl->parseCurrentBlock();
 
 2556                 $selected_array = split(
",", 
$_POST[
"chosen_questions"]);
 
 2557                 if (!count($selected_array))
 
 2563                         $total = $this->
object->evalTotalPersons();
 
 2573                         foreach ($selected_array as $key => $value) 
 
 2575                                 $this->
object->insertQuestion($value);
 
 2577                         $this->
object->saveCompleteStatus();
 
 2579                         $this->ctrl->redirect($this, 
"questions");
 
 2601                         $ilUser->setPref(
"tst_question_selection_mode_equal", (
$_POST[
'chbQuestionSelectionMode']) ? 1 : 0);
 
 2602                         $ilUser->writePref(
"tst_question_selection_mode_equal", (
$_POST[
'chbQuestionSelectionMode']) ? 1 : 0);
 
 2603                         $this->
object->setRandomQuestionCount(
$_POST[
'total_questions']);
 
 2604                         if (is_array(
$_POST[
'source'][
'qpl']) && count(array_unique(
$_POST[
'source'][
'qpl'])) == count(
$_POST[
'source'][
'qpl']))
 
 2607                                 include_once 
"./Modules/Test/classes/class.ilRandomTestData.php";
 
 2608                                 foreach (
$_POST[
'source'][
'qpl'] as $idx => $qpl)
 
 2612                                 $this->
object->setRandomQuestionpoolData(
$data);
 
 2623                         $this->
object->saveRandomQuestionCount($this->object->getRandomQuestionCount());
 
 2624                         $this->
object->saveRandomQuestionpools();
 
 2625                         $this->
object->saveCompleteStatus();
 
 2627                         $this->ctrl->redirect($this, 
'randomQuestions');
 
 2634                 $position = key(
$_POST[
'cmd'][
'addsource']);
 
 2635                 $this->
object->addRandomQuestionpoolData(0, 0, $position+1);
 
 2642                 $position = key(
$_POST[
'cmd'][
'removesource']);
 
 2643                 $this->
object->removeRandomQuestionpoolData($position);
 
 2651                 $total = $this->
object->evalTotalPersons();
 
 2652                 $save = (strcmp($this->ctrl->getCmd(), 
"saveRandomQuestions") == 0) ? TRUE : FALSE;
 
 2654                 include_once(
"./Services/Form/classes/class.ilPropertyFormGUI.php");
 
 2656                 $form->setFormAction($this->ctrl->getFormAction($this, 
'randomQuestions'));
 
 2657                 $form->setTitle($this->lng->txt(
'random_selection'));
 
 2658                 $form->setDescription($this->lng->txt(
'tst_select_random_questions'));
 
 2659                 $form->setMultipart(FALSE);
 
 2660                 $form->setTableWidth(
"100%");
 
 2661                 $form->setId(
"randomSelectionForm");
 
 2664                 $selection_mode = ($save) ? 
$_POST[
'chbQuestionSelectionMode'] : $ilUser->getPref(
"tst_question_selection_mode_equal");
 
 2665                 $question_selection = 
new ilCheckboxInputGUI($this->lng->txt(
"tst_question_selection"), 
"chbQuestionSelectionMode");
 
 2667                 $question_selection->setChecked($selection_mode);
 
 2668                 $question_selection->setOptionTitle($this->lng->txt(
'tst_question_selection_equal'));
 
 2669                 $question_selection->setInfo($this->lng->txt(
'tst_question_selection_description'));
 
 2670                 $question_selection->setRequired(
false);
 
 2671                 $form->addItem($question_selection);
 
 2674                 $total_questions = 
new ilNumberInputGUI($this->lng->txt(
'tst_total_questions'), 
'total_questions');
 
 2675                 $total_questions->
setValue($this->object->getRandomQuestionCount());
 
 2676                 $total_questions->setSize(3);
 
 2677                 $total_questions->setInfo($this->lng->txt(
'tst_total_questions_description'));
 
 2678                 $total_questions->setRequired(
false);
 
 2679                 $form->addItem($total_questions);
 
 2683                         $found_qpls = $this->
object->getRandomQuestionpoolData();
 
 2684                         include_once 
"./Modules/Test/classes/class.ilRandomTestData.php";
 
 2685                         if (count($found_qpls) == 0)
 
 2689                         $available_qpl =& $this->
object->getAvailableQuestionpools(TRUE, $selection_mode, FALSE, TRUE, TRUE);
 
 2690                         include_once 
'./Modules/Test/classes/class.ilRandomTestInputGUI.php';
 
 2693                         $source->setRandomQuestionPools($available_qpl);
 
 2694                         $source->setUseQuestionCount((array_key_exists(
'total_questions', 
$_POST)) ? (
$_POST[
'total_questions'] < 1) : ($this->object->getRandomQuestionCount() < 1));
 
 2695                         $source->setValues($found_qpls);
 
 2696                         $form->addItem($source);
 
 2700                         $qpls = $this->
object->getUsedRandomQuestionpools();
 
 2701                         include_once 
'./Modules/Test/classes/class.ilRandomTestROInputGUI.php';
 
 2704                         $form->addItem($source);
 
 2707                 if (
$total == 0) $form->addCommandButton(
"saveRandomQuestions", $this->lng->txt(
"save"));
 
 2713                         $form->setValuesByPost();
 
 2714                         $errors = !$form->checkInput();
 
 2718                                 if (
$_POST[
'total_questions'] > 0)
 
 2721                                         foreach (
$_POST[
'source'][
'qpl'] as $idx => $qpl)
 
 2723                                                 $totalcount += $available_qpl[$qpl][
'count'];
 
 2725                                         if (
$_POST[
'total_questions'] > $totalcount)
 
 2727                                                 $total_questions->setAlert($this->lng->txt(
'msg_total_questions_too_high'));
 
 2732                         if (
$errors) $checkonly = 
false;
 
 2735                 if (!$checkonly) $this->tpl->setVariable(
"ADM_CONTENT", $form->getHTML());
 
 2742                 if (
$_POST[
"chbQuestionSelectionMode"])
 
 2744                         $ilUser->setPref(
"tst_question_selection_mode_equal", 1);
 
 2745                         $ilUser->writePref(
"tst_question_selection_mode_equal", 1);
 
 2749                         $ilUser->setPref(
"tst_question_selection_mode_equal", 0);
 
 2750                         $ilUser->writePref(
"tst_question_selection_mode_equal", 0);
 
 2773                 if (!$qpl_mode || ($qpl_mode == 2 && strcmp(
$_REQUEST[
"txt_qpl"], 
"") == 0) || ($qpl_mode == 3 && strcmp($qpl_ref_id, 
"") == 0))
 
 2782                         $_SESSION[
"test_id"] = $this->
object->getRefId();
 
 2783                         if ($qpl_mode == 2 && strcmp(
$_REQUEST[
"txt_qpl"], 
"") != 0)
 
 2788                         else if ($qpl_mode == 1)
 
 2790                             $qpl_ref_id = 
$_GET[
"ref_id"];
 
 2793                         include_once 
"./Modules/TestQuestionPool/classes/class.ilObjQuestionPoolGUI.php";
 
 2795                         $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=" . 
$_REQUEST[
"sel_question_types"];
 
 2798                             $baselink .= 
'&q_id=' . 
$_REQUEST[
'q_id'];
 
 2801                             $baselink .= 
'&prev_qid=' . 
$_REQUEST[
'prev_qid'];
 
 2804                             $baselink .= 
'&test_express_mode=1';
 
 2806 #var_dump($_REQUEST['prev_qid']); 
 2822                 $this->ctrl->redirect($this, 
"questions");
 
 2837                 $questionpools =& $this->
object->getAvailableQuestionpools(FALSE, FALSE, FALSE, TRUE, FALSE, 
"write");
 
 2838                 if ($this->object->getPoolUsage()) {
 
 2841                     include_once 
"Services/Form/classes/class.ilPropertyFormGUI.php";
 
 2844                     $form->setFormAction($ilCtrl->getFormAction($this, 
"executeCreateQuestion"));
 
 2845                     $form->setTitle($lng->txt(
"test_create_question"));
 
 2846                     include_once 
'Modules/TestQuestionPool/classes/class.ilObjQuestionPool.php';
 
 2850                     $hidden->setValue(
$_REQUEST[
"sel_question_types"]);
 
 2851                     $form->addItem($hidden);
 
 2856                     $no_pool = 
new ilRadioOption($this->lng->txt(
"assessment_no_pool"), 1);
 
 2857                     $usage->addOption($no_pool);
 
 2858                     $existing_pool = 
new ilRadioOption($this->lng->txt(
"assessment_existing_pool"), 3);
 
 2859                     $usage->addOption($existing_pool);
 
 2860                     $new_pool = 
new ilRadioOption($this->lng->txt(
"assessment_new_pool"), 2);
 
 2861                     $usage->addOption($new_pool);
 
 2862                     $form->addItem($usage);
 
 2867                     $pools_data = array();
 
 2868                     foreach($questionpools as $key => $p) {
 
 2869                         $pools_data[$key] = $p[
'title'];
 
 2871                     $pools = 
new ilSelectInputGUI($this->lng->txt(
"select_questionpool"), 
"sel_qpl");
 
 2873                     $existing_pool->addSubItem($pools);
 
 2876                     $name = 
new ilTextInputGUI($this->lng->txt(
"cat_create_qpl"), 
"txt_qpl");
 
 2878                     $name->setMaxLength(50);
 
 2879                     $new_pool->addSubItem($name);
 
 2881                     $form->addCommandButton(
"executeCreateQuestion", $lng->txt(
"submit"));
 
 2882                     $form->addCommandButton(
"cancelCreateQuestion", $lng->txt(
"cancel"));
 
 2884                     return $this->tpl->setVariable(
'ADM_CONTENT', $form->getHTML());
 
 2890                     $ilCtrl->setParameterByClass(
'iltestexpresspageobjectgui', 
'sel_question_types', 
$_REQUEST[
"sel_question_types"]);
 
 2891                     $link = $ilCtrl->getLinkTargetByClass(
'iltestexpresspageobjectgui', 
'handleToolbarCommand',
'',
false,
false);
 
 2901                 $checked_questions = 
$_POST[
"q_id"];
 
 2903                 $questions = $this->
object->getQuestionTitlesAndIndexes();
 
 2905                 foreach((array)$checked_questions as $value)
 
 2907                         $this->
object->removeQuestion($value);
 
 2908                         $deleted[] = $value;
 
 2911                 $this->
object->saveCompleteStatus();
 
 2919                         $deleted_tmp = $deleted;
 
 2920                         $first       = array_shift($deleted_tmp);
 
 2921                         foreach((array)$questions as $key => $value)
 
 2923                                 if(!in_array($key, $deleted))
 
 2933                                 else if($key == $first)
 
 2940                                         $first = array_shift($deleted_tmp);
 
 2945                                 count($questions) == count($checked_questions) ||
 
 2949                                 $this->ctrl->setParameter($this, 
'q_id', 
'');
 
 2950                                 $this->ctrl->redirect($this, 
'showPage');
 
 2953                         $this->ctrl->setParameter($this, 
'q_id', $return_to);
 
 2954                         $this->ctrl->redirect($this, 
"showPage");
 
 2958                         $this->ctrl->setParameter($this, 
'q_id', 
'');
 
 2959                         $this->ctrl->redirect($this, 
'questions');
 
 2973                     $this->ctrl->setParameter($this, 
'q_id', 
$_REQUEST[
'q_id']);
 
 2974                     $this->ctrl->redirect($this, 
"showPage");
 
 2977                     $this->ctrl->redirect($this, 
"questions");
 
 2990                 $total = $this->
object->evalTotalPersons();
 
 2994                         $question = sprintf($this->lng->txt(
"tst_remove_questions_and_results"), 
$total);
 
 2998                         if (count($checked_questions) == 1)
 
 3000                                 $question = $this->lng->txt(
"tst_remove_question");
 
 3004                                 $question = $this->lng->txt(
"tst_remove_questions");
 
 3008                 include_once(
"./Services/Utilities/classes/class.ilConfirmationGUI.php");
 
 3010                 $cgui->setHeaderText($question);
 
 3012                 $this->ctrl->saveParameter($this, 
'test_express_mode');
 
 3013                 $this->ctrl->saveParameter($this, 
'q_id');
 
 3015                 $cgui->setFormAction($this->ctrl->getFormAction($this));
 
 3016                 $cgui->setCancel($this->lng->txt(
"cancel"), 
"cancelRemoveQuestions");
 
 3017                 $cgui->setConfirm($this->lng->txt(
"confirm"), 
"confirmRemoveQuestions");
 
 3019                 include_once 
"./Modules/TestQuestionPool/classes/class.assQuestion.php";
 
 3020                 $removablequestions =& $this->
object->getTestQuestions();                               
 
 3021                 if (count($removablequestions))
 
 3023                         foreach ($removablequestions as 
$data)
 
 3025                                 if (in_array($data[
"question_id"], $checked_questions))
 
 3028                                         if($data[
"description"])
 
 3030                                                 $txt .= 
"<div class=\"small\">".$data[
"description"].
"</div>";
 
 3033                                         $cgui->addItem(
"q_id[]", $data[
"question_id"], $txt);
 
 3038                 $this->tpl->setContent($cgui->getHTML());               
 
 3052                 if (!is_array($checked_questions) && $checked_questions) {
 
 3053                     $checked_questions = array($checked_questions);
 
 3055                 if (count($checked_questions) > 0) 
 
 3060                 elseif (count($checked_questions) == 0) 
 
 3062                         ilUtil::sendInfo($this->lng->txt(
"tst_no_question_selected_for_removal"), 
true);
 
 3063                         $this->ctrl->redirect($this, 
"questions");
 
 3072                 $selected_questions = NULL;
 
 3073                 $selected_questions = 
$_POST[
'q_id'];
 
 3074                 if (is_array($selected_questions))
 
 3076                         $_SESSION[
'tst_qst_move_' . $this->
object->getTestId()] = 
$_POST[
'q_id'];
 
 3083                 $this->ctrl->redirect($this, 
'questions');
 
 3092                 $move_questions = 
$_SESSION[
'tst_qst_move_' . $this->
object->getTestId()];
 
 3094                 if (count(
$_POST[
'q_id']) == 0)
 
 3097                         $this->ctrl->redirect($this, 
'questions');
 
 3099                 if (count(
$_POST[
'q_id']) > 1)
 
 3102                         $this->ctrl->redirect($this, 
'questions');
 
 3105                 $this->
object->moveQuestions(
$_SESSION[
'tst_qst_move_' . $this->object->getTestId()], 
$_POST[
'q_id'][0], $insert_mode);
 
 3107                 unset(
$_SESSION[
'tst_qst_move_' . $this->object->getTestId()]);
 
 3108                 $this->ctrl->redirect($this, 
"questions");
 
 3117                 $move_questions = 
$_SESSION[
'tst_qst_move_' . $this->
object->getTestId()];
 
 3118                 if (count(
$_POST[
'q_id']) == 0)
 
 3121                         $this->ctrl->redirect($this, 
'questions');
 
 3123                 if (count(
$_POST[
'q_id']) > 1)
 
 3126                         $this->ctrl->redirect($this, 
'questions');
 
 3129                 $this->
object->moveQuestions(
$_SESSION[
'tst_qst_move_' . $this->object->getTestId()], 
$_POST[
'q_id'][0], $insert_mode);
 
 3131                 unset(
$_SESSION[
'tst_qst_move_' . $this->object->getTestId()]);
 
 3132                 $this->ctrl->redirect($this, 
"questions");
 
 3142                 $selected_array = (is_array(
$_POST[
'q_id'])) ? 
$_POST[
'q_id'] : array();
 
 3143                 if (!count($selected_array))
 
 3146                         $this->ctrl->redirect($this, 
"browseForQuestions");
 
 3150                         include_once 
"./Modules/TestQuestionPool/classes/class.assQuestion.php";
 
 3151                         $manscoring = FALSE;
 
 3152                         foreach ($selected_array as $key => $value) 
 
 3154                                 $this->
object->insertQuestion($value);
 
 3160                         $this->
object->saveCompleteStatus();
 
 3169                         $this->ctrl->redirect($this, 
"questions");
 
 3176                 include_once 
"./Modules/Test/classes/tables/class.ilTestQuestionBrowserTableGUI.php";
 
 3178                 $table_gui->writeFilterToSession();
 
 3179                 $this->ctrl->redirect($this, 
"browseForQuestions");
 
 3184                 include_once 
"./Modules/Test/classes/tables/class.ilTestQuestionBrowserTableGUI.php";
 
 3186                 $table_gui->resetFilter();
 
 3187                 $this->ctrl->redirect($this, 
"browseForQuestions");
 
 3199                 $this->ctrl->setParameterByClass(get_class($this), 
"browse", 
"1");
 
 3201                 include_once 
"./Modules/Test/classes/tables/class.ilTestQuestionBrowserTableGUI.php";
 
 3202                 $table_gui = 
new ilTestQuestionBrowserTableGUI($this, 
'browseForQuestions', (($ilAccess->checkAccess(
"write", 
"", $this->ref_id) ? 
true : 
false)));
 
 3203                 $arrFilter = array();
 
 3204                 foreach ($table_gui->getFilterItems() as $item)
 
 3206                         if ($item->getValue() !== 
false)
 
 3208                                 $arrFilter[$item->getPostVar()] = $item->getValue();
 
 3211                 $data = $this->
object->getAvailableQuestions($arrFilter, 1);
 
 3212                 $table_gui->setData(
$data);
 
 3213                 $this->tpl->setVariable(
'ADM_CONTENT', $table_gui->getHTML());  
 
 3218                 global $ilAccess, $ilTabs;
 
 3221                 $this->ctrl->setParameter($this, 
'test_express_mode', 
'');
 
 3223                 $ilTabs->activateTab(
'assQuestions');
 
 3225                 if (!$ilAccess->checkAccess(
"write", 
"", $this->ref_id)) 
 
 3229                         $this->ctrl->redirect($this, 
"infoScreen");
 
 3232                 if (
$_GET[
'browse'])
 
 3234                         return $this->questionbrowser();
 
 3240                 $this->ctrl->setParameter($this, 
'q_id', 
'');
 
 3242                 if ($this->object->isRandomTest())
 
 3250                         ilUtil::redirect(
"ilias.php?baseClass=ilObjQuestionPoolGUI&ref_id=" . 
$_GET[
"eqpl"] . 
"&cmd=editQuestionForTest&calling_test=".
$_GET[
"ref_id"].
"&q_id=" . 
$_GET[
"eqid"]);
 
 3253                 if (
$_GET[
"up"] > 0)
 
 3255                         $this->
object->questionMoveUp(
$_GET[
"up"]);
 
 3257                 if (
$_GET[
"down"] > 0)
 
 3259                         $this->
object->questionMoveDown(
$_GET[
"down"]);
 
 3264                         $selected_array = array();
 
 3265                         array_push($selected_array, 
$_GET[
"add"]);
 
 3266                         $total = $this->
object->evalTotalPersons();
 
 3276                         $this->insertQuestions($selected_array);
 
 3280                 $this->tpl->addBlockFile(
"ADM_CONTENT", 
"adm_content", 
"tpl.il_as_tst_questions.html", 
"Modules/Test");
 
 3282                 $total = $this->
object->evalTotalPersons();
 
 3283                 if ($ilAccess->checkAccess(
"write", 
"", $this->ref_id))
 
 3287                                 $link = $this->ctrl->getLinkTarget($this, 
"participants");
 
 3288                                 $link = 
"<a href=\"".$link.
"\">".$this->lng->txt(
"test_has_datasets_warning_page_view_link").
"</a>";
 
 3289                                 ilUtil::sendInfo($this->lng->txt(
"test_has_datasets_warning_page_view").
" ".$link);
 
 3295                                 include_once 
"./Modules/TestQuestionPool/classes/class.ilObjQuestionPool.php";
 
 3298                                         $qtypes[
$data[
'type_tag']] = $trans;
 
 3300                                 $ilToolbar->setFormAction($this->ctrl->getFormAction($this));
 
 3301                                 include_once 
"Services/Form/classes/class.ilPropertyFormGUI.php";
 
 3302                                 $types = 
new ilSelectInputGUI($this->lng->txt(
"create_new"), 
"sel_question_types");
 
 3305                                 $ilToolbar->addInputItem($types);
 
 3306                                 $ilToolbar->addFormButton($this->lng->txt(
"test_create_question"), 
"createQuestion");
 
 3308                                 if ($this->object->getPoolUsage()) {
 
 3309                                         $ilToolbar->addSeparator();
 
 3310                                         $ilToolbar->addButton($this->lng->txt(
"tst_browse_for_questions"), $this->ctrl->getLinkTarget($this, 
'browseForQuestions'));
 
 3313                                 $ilToolbar->addSeparator();
 
 3314                                 $ilToolbar->addButton($this->lng->txt(
"random_selection"), $this->ctrl->getLinkTarget($this, 
"randomselect"));
 
 3318                                 $seq = $this->
object->getTestSession()->getLastSequence();
 
 3319                                 $online_access = 
false;
 
 3320                                 if ($this->object->getFixedParticipants())
 
 3322                                         include_once 
"./Modules/Test/classes/class.ilObjTestAccess.php";
 
 3324                                         if ($online_access_result === 
true)
 
 3326                                                 $online_access = 
true;
 
 3330                                 if( $this->object->isOnline() && $this->
object->isComplete() )
 
 3332                                         if ((!$this->object->getFixedParticipants() || $online_access) && $ilAccess->checkAccess(
"read", 
"", $this->ref_id))
 
 3334                                                 $executable = $this->
object->isExecutable($ilUser->getId(), $allowPassIncrease = TRUE);
 
 3335                                                 if ($executable[
"executable"])
 
 3337                                                         if ($this->object->getTestSession()->getActiveId() > 0)
 
 3339                                                                 $ilToolbar->addSeparator();
 
 3340                                                                 $ilToolbar->addButton($lng->txt(
'tst_resume_test'), $ilCtrl->getLinkTargetByClass(
'iltestoutputgui', 
'resume'));
 
 3344                                                                 $ilToolbar->addSeparator();
 
 3345                                                                 $ilToolbar->addButton($lng->txt(
'tst_start_test'), $ilCtrl->getLinkTargetByClass(
'iltestoutputgui', 
'startTest'));
 
 3355                 $this->tpl->setCurrentBlock(
"adm_content");
 
 3356                 include_once 
"./Modules/Test/classes/tables/class.ilTestQuestionsTableGUI.php";
 
 3357                 $checked_move = is_array(
$_SESSION[
'tst_qst_move_' . $this->object->getTestId()]) && (count(
$_SESSION[
'tst_qst_move_' . $this->object->getTestId()]));
 
 3358                 $table_gui = 
new ilTestQuestionsTableGUI($this, 
'questions', (($ilAccess->checkAccess(
"write", 
"", $this->ref_id) ? 
true : 
false)), $checked_move, 
$total);
 
 3359                 $data = $this->
object->getTestQuestions();
 
 3360                 $table_gui->setData($data);
 
 3361                 $this->tpl->setVariable(
'QUESTIONBROWSER', $table_gui->getHTML());      
 
 3362                 $this->tpl->setVariable(
"ACTION_QUESTION_FORM", $this->ctrl->getFormAction($this));
 
 3363                 $this->tpl->parseCurrentBlock();
 
 3379                 $this->
object->mark_schema->addMarkStep();
 
 3392                 $this->
object->mark_schema->flush();
 
 3393                 foreach (
$_POST as $key => $value) {
 
 3394                         if (preg_match(
"/mark_short_(\d+)/", $key, $matches)) 
 
 3399                 $this->
object->ects_grades[
"A"] = 
$_POST[
"ects_grade_a"];
 
 3400                 $this->
object->ects_grades[
"B"] = 
$_POST[
"ects_grade_b"];
 
 3401                 $this->
object->ects_grades[
"C"] = 
$_POST[
"ects_grade_c"];
 
 3402                 $this->
object->ects_grades[
"D"] = 
$_POST[
"ects_grade_d"];
 
 3403                 $this->
object->ects_grades[
"E"] = 
$_POST[
"ects_grade_e"];
 
 3406                         $this->
object->ects_fx = 
$_POST[
"percentFX"];
 
 3410                         $this->
object->ects_fx = 
"";
 
 3412                 $this->
object->ects_output = 
$_POST[
"chbECTS"];
 
 3424                 $this->
object->mark_schema->createSimpleSchema($this->lng->txt(
"failed_short"), $this->lng->txt(
"failed_official"), 0, 0, $this->lng->txt(
"passed_short"), $this->lng->txt(
"passed_official"), 50, 1);
 
 3438                 $delete_mark_steps = array();
 
 3439                 foreach (
$_POST as $key => $value) {
 
 3440                         if (preg_match(
"/cb_(\d+)/", $key, $matches)) {
 
 3441                                 array_push($delete_mark_steps, $matches[1]);
 
 3444                 if (count($delete_mark_steps)) {
 
 3445                         $this->
object->mark_schema->deleteMarkSteps($delete_mark_steps);
 
 3461                 $this->ctrl->redirect($this, 
"marks");
 
 3476                         $mark_check = $this->
object->checkMarks();
 
 3480                         $mark_check = $this->lng->txt(
'mark_schema_invalid');
 
 3483                 if ($mark_check !== 
true)
 
 3487                 elseif (
$_POST[
"chbECTS"] && ((strcmp(
$_POST[
"ects_grade_a"], 
"") == 0) or (strcmp(
$_POST[
"ects_grade_b"], 
"") == 0) or (strcmp(
$_POST[
"ects_grade_c"], 
"") == 0) or (strcmp(
$_POST[
"ects_grade_d"], 
"") == 0) or (strcmp(
$_POST[
"ects_grade_e"], 
"") == 0)))
 
 3491                 elseif ((
$_POST[
"ects_grade_a"] > 100) or (
$_POST[
"ects_grade_a"] < 0))
 
 3495                 elseif ((
$_POST[
"ects_grade_b"] > 100) or (
$_POST[
"ects_grade_b"] < 0))
 
 3499                 elseif ((
$_POST[
"ects_grade_c"] > 100) or (
$_POST[
"ects_grade_c"] < 0))
 
 3503                 elseif ((
$_POST[
"ects_grade_d"] > 100) or (
$_POST[
"ects_grade_d"] < 0))
 
 3507                 elseif ((
$_POST[
"ects_grade_e"] > 100) or (
$_POST[
"ects_grade_e"] < 0))
 
 3513                         $this->
object->mark_schema->saveToDb($this->object->getTestId());
 
 3514                         $this->
object->saveCompleteStatus();
 
 3515                         if ($this->object->getReportingDate())
 
 3532                 if (!$ilAccess->checkAccess(
"write", 
"", $this->ref_id)) 
 
 3536                         $this->ctrl->redirect($this, 
"infoScreen");
 
 3539                 if (!$this->object->canEditMarks())
 
 3544                 $this->
object->mark_schema->sort();
 
 3546                 $this->tpl->addBlockFile(
"ADM_CONTENT", 
"adm_content", 
"tpl.il_as_tst_marks.html", 
"Modules/Test");
 
 3547                 $marks = $this->
object->mark_schema->mark_steps;
 
 3548                 $rows = array(
"tblrow1", 
"tblrow2");
 
 3550                 foreach ($marks as $key => $value)
 
 3552                         $this->tpl->setCurrentBlock(
"markrow");
 
 3553                         $this->tpl->setVariable(
"MARK_SHORT", $value->getShortName());
 
 3554                         $this->tpl->setVariable(
"MARK_OFFICIAL", $value->getOfficialName());
 
 3555                         $this->tpl->setVariable(
"MARK_PERCENTAGE", sprintf(
"%.2f", $value->getMinimumLevel()));
 
 3556                         $this->tpl->setVariable(
"MARK_PASSED", strtolower($this->lng->txt(
"tst_mark_passed")));
 
 3557                         $this->tpl->setVariable(
"MARK_ID", 
"$key");
 
 3558                         $this->tpl->setVariable(
"ROW_CLASS", $rows[$counter % 2]);
 
 3560                         if( $value->getPassed() )
 
 3562                                 $this->tpl->setVariable(
"MARK_PASSED_CHECKED", 
" checked=\"checked\"");
 
 3565                         $this->tpl->parseCurrentBlock();
 
 3568                 if (count($marks) == 0) 
 
 3570                         $this->tpl->setCurrentBlock(
"Emptyrow");
 
 3571                         $this->tpl->setVariable(
"EMPTY_ROW", $this->lng->txt(
"tst_no_marks_defined"));
 
 3572                         $this->tpl->setVariable(
"ROW_CLASS", $rows[$counter % 2]);
 
 3573                         $this->tpl->parseCurrentBlock();
 
 3577                         if ($ilAccess->checkAccess(
"write", 
"", $this->ref_id) && $this->
object->canEditMarks()) 
 
 3579                                 $this->tpl->setCurrentBlock(
"selectall");
 
 3581                                 $this->tpl->setVariable(
"ROW_CLASS", $rows[$counter % 2]);
 
 3582                                 $this->tpl->setVariable(
"SELECT_ALL", $this->lng->txt(
"select_all"));
 
 3583                                 $this->tpl->parseCurrentBlock();
 
 3584                                 $this->tpl->setCurrentBlock(
"Footer");
 
 3585                                 $this->tpl->setVariable(
"ARROW", 
"<img src=\"" . 
ilUtil::getImagePath(
"arrow_downright.png") . 
"\" alt=\"".$this->lng->txt(
"arrow_downright").
"\"/>");
 
 3586                                 $this->tpl->setVariable(
"BUTTON_EDIT", $this->lng->txt(
"edit"));
 
 3587                                 $this->tpl->setVariable(
"BUTTON_DELETE", $this->lng->txt(
"delete"));
 
 3588                                 $this->tpl->parseCurrentBlock();
 
 3592                 if ($this->object->getReportingDate())
 
 3594                         $this->tpl->setCurrentBlock(
"ects");
 
 3595                         if ($this->object->ects_output)
 
 3597                                 $this->tpl->setVariable(
"CHECKED_ECTS", 
" checked=\"checked\"");
 
 3599                         $this->tpl->setVariable(
"TEXT_OUTPUT_ECTS_GRADES", $this->lng->txt(
"ects_output_of_ects_grades"));
 
 3600                         $this->tpl->setVariable(
"TEXT_ALLOW_ECTS_GRADES", $this->lng->txt(
"ects_allow_ects_grades"));
 
 3601                         $this->tpl->setVariable(
"TEXT_USE_FX", $this->lng->txt(
"ects_use_fx_grade"));
 
 3602                         if (preg_match(
"/\d+/", $this->object->ects_fx))
 
 3604                                 $this->tpl->setVariable(
"CHECKED_FX", 
" checked=\"checked\"");
 
 3605                                 $this->tpl->setVariable(
"VALUE_PERCENT_FX", sprintf(
"value=\"%s\" ", $this->object->ects_fx));
 
 3607                         $this->tpl->setVariable(
"TEXT_PERCENT", $this->lng->txt(
"ects_use_fx_grade_part2"));
 
 3608                         $this->tpl->setVariable(
"ECTS_GRADE", $this->lng->txt(
"ects_grade"));
 
 3609                         $this->tpl->setVariable(
"PERCENTILE", $this->lng->txt(
"percentile"));
 
 3610                         $this->tpl->setVariable(
"ECTS_GRADE_A", 
"A - " . $this->lng->txt(
"ects_grade_a_short"));
 
 3611                         $this->tpl->setVariable(
"VALUE_GRADE_A", $this->object->ects_grades[
"A"]);
 
 3612                         $this->tpl->setVariable(
"ECTS_GRADE_B", 
"B - " . $this->lng->txt(
"ects_grade_b_short"));
 
 3613                         $this->tpl->setVariable(
"VALUE_GRADE_B", $this->object->ects_grades[
"B"]);
 
 3614                         $this->tpl->setVariable(
"ECTS_GRADE_C", 
"C - " . $this->lng->txt(
"ects_grade_c_short"));
 
 3615                         $this->tpl->setVariable(
"VALUE_GRADE_C", $this->object->ects_grades[
"C"]);
 
 3616                         $this->tpl->setVariable(
"ECTS_GRADE_D", 
"D - " . $this->lng->txt(
"ects_grade_d_short"));
 
 3617                         $this->tpl->setVariable(
"VALUE_GRADE_D", $this->object->ects_grades[
"D"]);
 
 3618                         $this->tpl->setVariable(
"ECTS_GRADE_E", 
"E - " . $this->lng->txt(
"ects_grade_e_short"));
 
 3619                         $this->tpl->setVariable(
"VALUE_GRADE_E", $this->object->ects_grades[
"E"]);
 
 3621                         $this->tpl->parseCurrentBlock();
 
 3624                 $this->tpl->setCurrentBlock(
"adm_content");
 
 3625                 $this->tpl->setVariable(
"ACTION_MARKS", $this->ctrl->getFormAction($this));
 
 3626                 $this->tpl->setVariable(
"HEADER_SHORT", $this->lng->txt(
"tst_mark_short_form"));
 
 3627                 $this->tpl->setVariable(
"HEADER_OFFICIAL", $this->lng->txt(
"tst_mark_official_form"));
 
 3628                 $this->tpl->setVariable(
"HEADER_PERCENTAGE", $this->lng->txt(
"tst_mark_minimum_level"));
 
 3629                 $this->tpl->setVariable(
"HEADER_PASSED", $this->lng->txt(
"tst_mark_passed"));
 
 3630                 if ($ilAccess->checkAccess(
"write", 
"", $this->ref_id) && $this->
object->canEditMarks()) 
 
 3632                         $this->tpl->setVariable(
"BUTTON_NEW", $this->lng->txt(
"tst_mark_create_new_mark_step"));
 
 3633                         $this->tpl->setVariable(
"BUTTON_NEW_SIMPLE", $this->lng->txt(
"tst_mark_create_simple_mark_schema"));
 
 3634                         $this->tpl->setVariable(
"SAVE", $this->lng->txt(
"save"));
 
 3635                         $this->tpl->setVariable(
"CANCEL", $this->lng->txt(
"cancel"));
 
 3637                 $this->tpl->parseCurrentBlock();
 
 3651                 require_once 
'Modules/Test/classes/class.ilTestParticipantData.php';
 
 3653                 $participantData->load($this->object->getTestId());
 
 3655                 $this->
object->removeTestResults($participantData);
 
 3660                 include_once 
'./Services/Tracking/classes/class.ilLPStatusWrapper.php';
 
 3663                 $this->
object->removeTestActives($participantData->getActiveIds());
 
 3665                 #$this->object->removeAllTestEditings(); 
 3668                 $this->ctrl->redirect($this, 
"participants");
 
 3675                 $ilDB->manipulate(
"DELETE FROM ut_lp_marks".
 
 3676                         " WHERE obj_id = ".$ilDB->quote($a_obj_id, 
"integer").
 
 3677                         " AND ".$ilDB->in(
"usr_id", $a_user_ids, 
"", 
"integer"));
 
 3684                 $ilDB->manipulate(
"DELETE FROM read_event".
 
 3685                         " WHERE obj_id = ".$ilDB->quote($a_obj_id, 
"integer").
 
 3686                         " AND ".$ilDB->in(
"usr_id", $a_user_ids, 
"", 
"integer"));
 
 3700                 require_once 
'Modules/Test/classes/class.ilTestParticipantData.php';
 
 3703                 if( $this->object->getFixedParticipants() )
 
 3705                         $participantData->setUserIds(
$_POST[
"chbUser"]);
 
 3709                         $participantData->setActiveIds(
$_POST[
"chbUser"]);
 
 3712                 $participantData->load($this->object->getTestId());
 
 3714                 $this->
object->removeTestResults($participantData);
 
 3716                 if( count($participantData->getUserIds()) )
 
 3721                         include_once 
'./Services/Tracking/classes/class.ilLPStatusWrapper.php';
 
 3725                 $this->
object->removeTestActives($participantData->getActiveIds());
 
 3727                 #$this->object->removeSelectedTestResults($active_ids); 
 3730                 $this->ctrl->redirect($this, 
"participants");
 
 3742                 $this->ctrl->redirect($this, 
"participants");
 
 3757                 $this->tpl->addBlockFile(
"ADM_CONTENT", 
"adm_content", 
"tpl.il_as_tst_maintenance.html", 
"Modules/Test");
 
 3759                 $this->tpl->setCurrentBlock(
"confirm_delete");
 
 3760                 $this->tpl->setVariable(
"BTN_CONFIRM_DELETE_ALL", $this->lng->txt(
"confirm"));
 
 3761                 $this->tpl->setVariable(
"BTN_CANCEL_DELETE_ALL", $this->lng->txt(
"cancel"));
 
 3762                 $this->tpl->parseCurrentBlock();
 
 3764                 $this->tpl->setCurrentBlock(
"adm_content");
 
 3765                 $this->tpl->setVariable(
"FORM_ACTION", $this->ctrl->getFormAction($this));
 
 3766                 $this->tpl->parseCurrentBlock();
 
 3775                 include_once(
"./Services/Utilities/classes/class.ilConfirmationGUI.php");
 
 3777                 $cgui->setFormAction($this->ctrl->getFormAction($this, 
"participants"));
 
 3778                 $cgui->setHeaderText($this->lng->txt(
"delete_all_user_data_confirmation"));
 
 3779                 $cgui->setCancel($this->lng->txt(
"cancel"), 
"participants");
 
 3780                 $cgui->setConfirm($this->lng->txt(
"proceed"), 
"confirmDeleteAllUserResults");
 
 3782                 $this->tpl->setContent($cgui->getHTML());
 
 3794                 if (count(
$_POST[
"chbUser"]) == 0)
 
 3797                         $this->ctrl->redirect($this, 
"participants");
 
 3800                 include_once(
"./Services/Utilities/classes/class.ilConfirmationGUI.php");
 
 3802                 $cgui->setHeaderText($this->lng->txt(
"confirm_delete_single_user_data"));
 
 3804                 $cgui->setFormAction($this->ctrl->getFormAction($this));
 
 3805                 $cgui->setCancel($this->lng->txt(
"cancel"), 
"cancelDeleteSelectedUserData");
 
 3806                 $cgui->setConfirm($this->lng->txt(
"confirm"), 
"confirmDeleteSelectedUserData");
 
 3808                 include_once 
'./Services/User/classes/class.ilObjUser.php';     
 
 3809                 foreach (
$_POST[
"chbUser"] as $key => $active_id)
 
 3811                         if ($this->object->getFixedParticipants())
 
 3813                                 $user_id = $active_id;
 
 3817                                 $user_id = $this->
object->_getUserIdFromActiveId($active_id);
 
 3821                         if ($this->object->getAnonymity())
 
 3823                                 $name = $this->lng->txt(
"anonymous");
 
 3825                         else if($user[
"lastname"])
 
 3827                                 $name = $user[
"lastname"].
", ".$user[
"firstname"].
" (".
 
 3832                                 $name = $this->lng->txt(
"deleted_user");                                
 
 3835                         $cgui->addItem(
"chbUser[]", $active_id, $name,
 
 3839                 $this->tpl->setContent($cgui->getHTML());
 
 3851                 include_once 
"./Modules/Test/classes/tables/class.ilTestHistoryTableGUI.php";
 
 3853                 $table_gui->setTestObject($this->
object);
 
 3854                 include_once 
"./Modules/Test/classes/class.ilObjAssessmentFolder.php";
 
 3856                 $table_gui->setData(
$log);
 
 3857                 $this->tpl->setVariable(
'ADM_CONTENT', $table_gui->getHTML());  
 
 3862                 include_once(
"Services/Form/classes/class.ilPropertyFormGUI.php");
 
 3864                 $form->setTarget(
"_top");
 
 3866                 $this->ctrl->setParameter($this, 
"new_type", $new_type);
 
 3867                 $form->setFormAction($this->ctrl->getFormAction($this));
 
 3868                 $form->setTitle($this->lng->txt(
"import_tst"));
 
 3871                 include_once(
"./Services/Form/classes/class.ilFileInputGUI.php");
 
 3872                 $fi = 
new ilFileInputGUI($this->lng->txt(
"import_file"), 
"xmldoc");
 
 3874                 $fi->setRequired(
true);
 
 3875                 $form->addItem($fi);
 
 3878                 include_once(
"./Modules/Test/classes/class.ilObjTest.php");
 
 3880                 $questionpools = $tst->getAvailableQuestionpools(TRUE, FALSE, TRUE, TRUE);
 
 3881                 if (count($questionpools))
 
 3883                         $options = array(
"-1" => $this->lng->txt(
"dont_use_questionpool"));
 
 3884                         foreach ($questionpools as $key => $value)
 
 3886                                 $options[$key] = $value[
"title"];
 
 3889                         $pool = 
new ilSelectInputGUI($this->lng->txt(
"select_questionpool"), 
"qpl");
 
 3891                         $form->addItem($pool);
 
 3894                 $form->addCommandButton(
"importFile", $this->lng->txt(
"import"));
 
 3895                 $form->addCommandButton(
"cancel", $this->lng->txt(
"cancel"));
 
 3907                 $command = 
$_POST[
"command"];
 
 3908                 if (strlen($command))
 
 3910                         $method = $command . 
"Object";
 
 3911                         if (method_exists($this, $method))
 
 3917                 $this->ctrl->redirect($this, 
"participants");
 
 3927                 global $ilAccess, $ilToolbar, 
$lng;
 
 3929                 if (!$ilAccess->checkAccess(
"write", 
"", $this->ref_id)) 
 
 3933                         $this->ctrl->redirect($this, 
"infoScreen");
 
 3936                 if ($this->object->getFixedParticipants())
 
 3939                         include_once 
'./Services/Search/classes/class.ilRepositorySearchGUI.php';
 
 3944                                         'auto_complete_name'    => $lng->txt(
'user'),
 
 3945                                         'submit_name'                   => $lng->txt(
'add')
 
 3950                         $ilToolbar->addButton($this->lng->txt(
"tst_search_users"),
 
 3951                                 $this->ctrl->getLinkTargetByClass(
'ilRepositorySearchGUI',
'start'));
 
 3954                         $participants =& $this->
object->getInvitedUsers();
 
 3956                         foreach ($participants as 
$data)
 
 3958                                 $maxpass = $this->
object->_getMaxPass($data[
"active_id"]);
 
 3959                                 if (!is_null($maxpass))
 
 3964                                 if (strlen($data[
"active_id"]))
 
 3966                                         $last_access = $this->
object->_getLastAccess($data[
"active_id"]);
 
 3967                                         $access = $last_access;
 
 3969                                 $this->ctrl->setParameterByClass(
'iltestevaluationgui', 
'active_id', $data[
'active_id']);
 
 3971                                 if ($data[
'active_id'] == null) 
 
 3973                                         if ( strlen($data[
"firstname"].$data[
"lastname"]) == 0 )
 
 3975                                                 $fullname = $lng->txt(
"deleted_user");
 
 3979                                                 $fullname = trim($data[
"lastname"] . 
", " . $data[
"firstname"] . 
" " . $data[
"title"]);
 
 3982                                         include_once 
"./Modules/Test/classes/class.ilObjTestAccess.php";
 
 3986                                 array_push($rows, array(
 
 3987                                         'usr_id' => $data[
"usr_id"],
 
 3988                                         'active_id' => $data[
'active_id'],
 
 3989                                         'login' => $data[
"login"],
 
 3990                                         'clientip' => $data[
"clientip"],
 
 3991                                         'firstname' => $data[
"firstname"],
 
 3992                                         'lastname' => $data[
"lastname"],
 
 3993                                         'name' => $fullname,
 
 3994                                         'started' => ($data[
"active_id"] > 0) ? 1 : 0,
 
 3995                                         'finished' => ($data[
"test_finished"] == 1) ? 1 : 0,
 
 3996                                         'access' => $access,
 
 3997                                         'maxpass' => $maxpass,
 
 3998                                         'result' => $this->ctrl->getLinkTargetByClass(
'iltestevaluationgui', 
'outParticipantsResultsOverview')
 
 4001                         include_once 
"./Modules/Test/classes/tables/class.ilTestFixedParticipantsTableGUI.php";
 
 4004                         $table_gui->setResetCommand(
'fpResetFiler');
 
 4006                         $table_gui->setData($rows);
 
 4007                         $this->tpl->setVariable(
'ADM_CONTENT', $table_gui->getHTML());  
 
 4011                         $participants =& $this->
object->getTestParticipants();
 
 4013                         foreach ($participants as 
$data)
 
 4015                                 $maxpass = $this->
object->_getMaxPass($data[
"active_id"]);
 
 4016                                 if (!is_null($maxpass))
 
 4021                                 if (strlen($data[
"active_id"]))
 
 4023                                         $last_access = $this->
object->_getLastAccess($data[
"active_id"]);
 
 4024                                         $access = $last_access;
 
 4026                                 $this->ctrl->setParameterByClass(
'iltestevaluationgui', 
'active_id', $data[
'active_id']);
 
 4028                                 include_once 
"./Modules/Test/classes/class.ilObjTestAccess.php";
 
 4030                                 array_push($rows, array(
 
 4031                                         'usr_id' => $data[
"active_id"],
 
 4032                                         'active_id' => $data[
'active_id'],
 
 4033                                         'login' => $data[
"login"],
 
 4034                                         'name' => $fullname,
 
 4035                                         'firstname' => $data[
"firstname"],
 
 4036                                         'lastname' => $data[
"lastname"],
 
 4037                                         'started' => ($data[
"active_id"] > 0) ? 1 : 0,
 
 4038                                         'finished' => ($data[
"test_finished"] == 1) ? 1 : 0,
 
 4039                                         'access' => $access,
 
 4040                                         'maxpass' => $maxpass,
 
 4041                                         'result' => $this->ctrl->getLinkTargetByClass(
'iltestevaluationgui', 
'outParticipantsResultsOverview')
 
 4044                         include_once 
"./Modules/Test/classes/tables/class.ilTestParticipantsTableGUI.php";
 
 4047                         $table_gui->setResetCommand(
'npResetFilter');
 
 4049                         $table_gui->setData($rows);
 
 4050                         $this->tpl->setVariable(
'ADM_CONTENT', $table_gui->getHTML());  
 
 4058                 $sess_filter = 
$_SESSION[
'form_'][
'selection'];
 
 4059                 $sess_filter = str_replace(
'"',
'',$sess_filter);
 
 4060                 $sess_filter = explode(
':', $sess_filter);
 
 4061                 $filter = substr($sess_filter[2],0, strlen($sess_filter[2])-1);
 
 4063                 if ($filter == 
'all' || $filter == 
false)
 
 4065                         return $in_rows; #unchanged - no filter.
 
 4068                 $with_result = array();
 
 4069                 $without_result = array();
 
 4070                 foreach ($in_rows as 
$row)
 
 4073                                 'SELECT count(solution_id) count 
 4075                                 WHERE active_fi = ' . $ilDB->quote($row[
'active_id'])
 
 4077                         $count = $ilDB->fetchAssoc(
$result);
 
 4078                         $count = $count[
'count'];
 
 4082                                 $without_result[] = 
$row;
 
 4086                                 $with_result[] = 
$row;
 
 4090                 if ($filter == 
'withSolutions')
 
 4092                         return $with_result;
 
 4094                 return $without_result;
 
 4100                 include_once(
"./Modules/Test/classes/tables/class.ilTestFixedParticipantsTableGUI.php");
 
 4103                 $table_gui->resetOffset();                
 
 4109                 include_once(
"./Modules/Test/classes/tables/class.ilTestFixedParticipantsTableGUI.php");
 
 4112                 $table_gui->resetOffset();                
 
 4118                 include_once(
"./Modules/Test/classes/tables/class.ilTestParticipantsTableGUI.php");
 
 4121                 $table_gui->resetOffset();                
 
 4128                 include_once(
"./Modules/Test/classes/tables/class.ilTestParticipantsTableGUI.php");
 
 4131                 $table_gui->resetOffset();                
 
 4147                 $this->
showUserResults($show_pass_details = TRUE, $show_answers = TRUE, $show_reached_points = TRUE);
 
 4161                 $this->
showUserResults($show_pass_details = FALSE, $show_answers = TRUE);
 
 4175                 $this->
showUserResults($show_pass_details = TRUE, $show_answers = FALSE);
 
 4185                 $template = 
new ilTemplate(
"tpl.il_as_tst_participants_result_output.html", TRUE, TRUE, 
"Modules/Test");
 
 4187                 if (count(
$_SESSION[
"show_user_results"]) == 0)
 
 4190                         $this->ctrl->redirect($this, 
"participants");
 
 4193                 include_once 
"./Modules/Test/classes/class.ilTestServiceGUI.php";
 
 4196                 foreach (
$_SESSION[
"show_user_results"] as $key => $active_id)
 
 4200                         if ($this->object->getFixedParticipants())
 
 4202                                 $active_id = $this->
object->getActiveIdOfUser($active_id);
 
 4206                                 $results = $serviceGUI->getResultsOfUserOutput($active_id, $this->object->_getResultPass($active_id), $show_pass_details, $show_answers, FALSE, $show_reached_points);
 
 4208                         if ($count < count(
$_SESSION[
"show_user_results"]))
 
 4210                                 $template->touchBlock(
"break");
 
 4212                         $template->setCurrentBlock(
"user_result");
 
 4213                         $template->setVariable(
"USER_RESULT", 
$results);
 
 4214                         $template->parseCurrentBlock();
 
 4216                 $template->setVariable(
"BACK_TEXT", $this->lng->txt(
"back"));
 
 4217                 $template->setVariable(
"BACK_URL", $this->ctrl->getLinkTargetByClass(
"ilobjtestgui", 
"participants"));
 
 4218                 $template->setVariable(
"PRINT_TEXT", $this->lng->txt(
"print"));
 
 4219                 $template->setVariable(
"PRINT_URL", 
"javascript:window.print();");
 
 4221                 $this->tpl->setVariable(
"ADM_CONTENT", $template->get());
 
 4223                 if ($this->object->getShowSolutionAnswersOnly())
 
 4231                 if (is_array(
$_POST[
"chbUser"])) 
 
 4233                         foreach (
$_POST[
"chbUser"] as $user_id)
 
 4235                                 $this->
object->disinviteUser($user_id);
 
 4242                 $this->ctrl->redirect($this, 
"participants");
 
 4247                 if (is_array(
$_POST[
"chbUser"])) 
 
 4249                         foreach (
$_POST[
"chbUser"] as $user_id)
 
 4251                                 $this->
object->setClientIP($user_id, 
$_POST[
"clientip_".$user_id]);
 
 4258                 $this->ctrl->redirect($this, 
"participants");
 
 4270                 global $ilAccess, 
$ilias;
 
 4271                 if (!$ilAccess->checkAccess(
"write", 
"", $this->ref_id)) 
 
 4275                         $this->ctrl->redirect($this, 
"infoScreen");
 
 4278                 $template = 
new ilTemplate(
"tpl.il_as_tst_print_test_confirm.html", TRUE, TRUE, 
"Modules/Test");
 
 4280                 include_once 
'./Services/WebServices/RPC/classes/class.ilRPCServerSettings.php';
 
 4283                         $this->ctrl->setParameter($this, 
"pdf", 
"1");
 
 4284                         $template->setCurrentBlock(
"pdf_export");
 
 4285                         $template->setVariable(
"PDF_URL", $this->ctrl->getLinkTarget($this, 
"print"));
 
 4286                         $this->ctrl->setParameter($this, 
"pdf", 
"");
 
 4287                         $template->setVariable(
"PDF_TEXT", $this->lng->txt(
"pdf_export"));
 
 4288                         $template->setVariable(
"PDF_IMG_ALT", $this->lng->txt(
"pdf_export"));
 
 4290                         $template->parseCurrentBlock();
 
 4296                 $print_date = mktime(date(
"H"), date(
"i"), date(
"s"), date(
"m")  , date(
"d"), date(
"Y"));
 
 4300                 foreach ($this->object->questions as $question) 
 
 4302                         $template->setCurrentBlock(
"question");
 
 4303                         $question_gui = $this->
object->createQuestionGUI(
"", $question);
 
 4304                         $template->setVariable(
"COUNTER_QUESTION", $counter.
".");
 
 4306                         if ($question_gui->object->getMaximumPoints() == 1)
 
 4308                                 $template->setVariable(
"QUESTION_POINTS", $question_gui->object->getMaximumPoints() . 
" " . $this->lng->txt(
"point"));
 
 4312                                 $template->setVariable(
"QUESTION_POINTS", $question_gui->object->getMaximumPoints() . 
" " . $this->lng->txt(
"points"));
 
 4314                         $result_output = $question_gui->getSolutionOutput(
"", NULL, FALSE, TRUE, FALSE, $this->object->getShowSolutionFeedback());
 
 4315                         if (strlen($result_output) == 0) $result_output = $question_gui->getPreview(FALSE);
 
 4316                         $template->setVariable(
"SOLUTION_OUTPUT", $result_output);
 
 4317                         $template->parseCurrentBlock(
"question");
 
 4319                         $max_points += $question_gui->object->getMaximumPoints();
 
 4322                 $template->setCurrentBlock(
"navigation_buttons");
 
 4323                 $template->setVariable(
"BUTTON_PRINT", $this->lng->txt(
"print"));
 
 4324                 $template->parseCurrentBlock();
 
 4333                 if (array_key_exists(
"pdf", 
$_GET) && (
$_GET[
"pdf"] == 1))
 
 4335                         $this->
object->deliverPDFfromHTML($template->get(), $this->
object->getTitle());
 
 4339                         $this->tpl->setVariable(
"PRINT_CONTENT", $template->get());
 
 4347                 if (is_array($a_user_ids))
 
 4350                         foreach ($a_user_ids as $user_id)
 
 4352                                 $client_ip = 
$_POST[
"client_ip"][$i];
 
 4353                                 $this->
object->inviteUser($user_id, $client_ip);
 
 4361                         $message = $this->lng->txt(
"tst_invited_selected_users");
 
 4363                 if (strlen($message))
 
 4373                 $this->ctrl->redirect($this, 
"participants");
 
 4386                 if (!$ilAccess->checkAccess(
"write", 
"", $this->ref_id)) 
 
 4390                         $this->ctrl->redirect($this, 
"infoScreen");
 
 4393                 $this->tpl->addBlockFile(
"ADM_CONTENT", 
"adm_content", 
"tpl.il_as_tst_defaults.html", 
"Modules/Test");
 
 4395                 $maxentries = $ilUser->getPref(
"hits_per_page");
 
 4396                 if ($maxentries < 1)
 
 4401                 $offset = 
$_GET[
"offset"] ? 
$_GET[
"offset"] : 0;
 
 4402                 $sortby = 
$_GET[
"sort_by"] ? 
$_GET[
"sort_by"] : 
"name";
 
 4403                 $sortorder = 
$_GET[
"sort_order"] ? 
$_GET[
"sort_order"] : 
"asc";
 
 4405                 $defaults =& $this->
object->getAvailableDefaults($sortby, $sortorder);
 
 4406                 if (count($defaults) > 0)
 
 4408                         $tablerows = array();
 
 4409                         foreach ($defaults as 
$row)
 
 4411                                 array_push($tablerows, array(
"checkbox" => 
"<input type=\"checkbox\" name=\"chb_defaults[]\" value=\"" . $row[
"test_defaults_id"] . 
"\"/>", 
"name" => $row[
"name"]));
 
 4413                         $headervars = array(
"", 
"name");
 
 4415                         include_once 
"./Services/Table/classes/class.ilTableGUI.php";
 
 4417                         $tbl->setTitle($this->lng->txt(
"tst_defaults_available"));
 
 4418                         $header_names = array(
 
 4420                                 $this->lng->txt(
"title")
 
 4422                         $tbl->setHeaderNames($header_names);
 
 4424                         $tbl->disable(
"sort");
 
 4425                         $tbl->disable(
"auto_sort");
 
 4426                         $tbl->enable(
"title");
 
 4427                         $tbl->enable(
"action");
 
 4428                         $tbl->enable(
"select_all");
 
 4429                         $tbl->setLimit($maxentries);
 
 4430                         $tbl->setOffset($offset);
 
 4431                         $tbl->setData($tablerows);
 
 4432                         $tbl->setMaxCount(count($tablerows));
 
 4433                         $tbl->setOrderDirection($sortorder);
 
 4434                         $tbl->setSelectAllCheckbox(
"chb_defaults");
 
 4435                         $tbl->setFormName(
"formDefaults");
 
 4436                         $tbl->addActionButton(
"deleteDefaults", $this->lng->txt(
"delete"));
 
 4437                         $tbl->addActionButton(
"applyDefaults", $this->lng->txt(
"apply"));
 
 4439                         $header_params = $this->ctrl->getParameterArray($this, 
"defaults");
 
 4440                         $tbl->setHeaderVars($headervars, $header_params);
 
 4443                         $tbl->setFooter(
"tblfooter", $this->lng->txt(
"previous"), $this->lng->txt(
"next"));
 
 4445                         $tableoutput = $tbl->render();
 
 4446                         $this->tpl->setVariable(
"TEST_DEFAULTS_TABLE", $tableoutput);
 
 4450                         $this->tpl->setVariable(
"TEST_DEFAULTS_TABLE", $this->lng->txt(
"tst_defaults_not_defined"));
 
 4452                 $this->tpl->setVariable(
"FORMACTION", $this->ctrl->getFormAction($this, 
"addDefaults"));
 
 4453                 $this->tpl->setVariable(
"BUTTON_ADD", $this->lng->txt(
"add"));
 
 4454                 $this->tpl->setVariable(
"TEXT_DEFAULTS_OF_TEST", $this->lng->txt(
"tst_defaults_defaults_of_test"));
 
 4462                 if (count(
$_POST[
"chb_defaults"]))
 
 4464                         foreach (
$_POST[
"chb_defaults"] as $test_default_id)
 
 4466                                 $this->
object->deleteDefaults($test_default_id);
 
 4482                 if( count(
$_POST[
"chb_defaults"]) != 1 )
 
 4485                                 $this->lng->txt(
"tst_defaults_apply_select_one")
 
 4492                 if($this->object->evalTotalPersons() > 0)
 
 4495                                 $this->lng->txt(
"tst_defaults_apply_not_possible")
 
 4501                 $defaults =& $this->
object->getTestDefaults(
$_POST[
"chb_defaults"][0]);
 
 4502                 $defaultSettings = unserialize($defaults[
"defaults"]);
 
 4505                         $defaultSettings[
"isRandomTest"]
 
 4510                         case !$randomTestSettingSwitched:
 
 4511                         case $this->
object->getQuestionCount() == 0:
 
 4518                                 if( !$defaultSettings[
"isRandomTest"] ) 
 
 4521                                         $this->
confirmChangeProperties(self::SWITCH_RANDOM_TEST_SETTING_TO_DISABLED, 
'confirmedApplyDefaults', 
'defaults');
 
 4524                                 elseif( $defaultSettings[
"isRandomTest"] ) 
 
 4527                                         $this->
confirmChangeProperties(self::SWITCH_RANDOM_TEST_SETTING_TO_ENABLED, 
'confirmedApplyDefaults', 
'defaults');
 
 4532                 if( $randomTestSettingSwitched && $this->object->isOnline() )
 
 4534                         $this->
object->setOnline(
false);
 
 4536                         $info = $this->lng->txt(
 
 4537                                 "tst_set_offline_due_to_switched_random_test_setting" 
 4543                 $this->
object->applyDefaults($defaults);
 
 4547                 if($randomTestSettingSwitched)
 
 4549                         if($this->object->isRandomTest())
 
 4551                                 $this->
object->removeNonRandomTestData();
 
 4555                                 $this->
object->removeRandomTestData();
 
 4559                 $this->ctrl->redirect($this, 
'defaults');
 
 4567                 if (strlen(
$_POST[
"name"]) > 0)
 
 4569                         $this->
object->addDefaults(
$_POST[
'name']);
 
 4585                 $this->ctrl->setCmd(
"showSummary");
 
 4586                 $this->ctrl->setCmdClass(
"ilinfoscreengui");
 
 4592                 $this->ctrl->setCmd(
"showSummary");
 
 4593                 $this->ctrl->setCmdClass(
"ilinfoscreengui");
 
 4606                 if (
$_GET[
'crs_show_result'])
 
 4608                         $this->
object->hideCorrectAnsweredQuestions();
 
 4612                         if ($this->object->getTestSequence()->hasHiddenQuestions())
 
 4614                                 $this->
object->getTestSequence()->clearHiddenQuestions();
 
 4615                                 $this->
object->getTestSequence()->saveToDb();
 
 4619                 if (
$_GET[
'createRandomSolutions'])
 
 4621                         $this->
object->createRandomSolutions(
$_GET[
'createRandomSolutions']);
 
 4624                 if (!$ilAccess->checkAccess(
"visible", 
"", $this->ref_id))
 
 4626                         $this->ilias->raiseError($this->lng->txt(
"msg_no_perm_read"),$this->ilias->error_obj->MESSAGE);
 
 4629                 include_once(
"./Services/InfoScreen/classes/class.ilInfoScreenGUI.php");
 
 4632                 $seq = $this->
object->getTestSession()->getLastSequence();
 
 4634                 include_once 
"./Modules/Test/classes/class.ilTestOutputGUI.php";
 
 4636                 $this->ctrl->setParameter($output_gui, 
"sequence", $seq);
 
 4637                 $info->setFormAction($this->ctrl->getFormAction($output_gui));
 
 4638                 if (strlen($session_lock))
 
 4640                         $info->addHiddenElement(
"lock", $session_lock);
 
 4644                         $info->addHiddenElement(
"lock", md5(
$_COOKIE[
'PHPSESSID'] . time()));
 
 4646                 $online_access = 
false;
 
 4647                 if ($this->object->getFixedParticipants())
 
 4649                         include_once 
"./Modules/Test/classes/class.ilObjTestAccess.php";
 
 4651                         if ($online_access_result === 
true)
 
 4653                                 $online_access = 
true;
 
 4660                 if( $this->object->isOnline() && $this->
object->isComplete() )
 
 4662                         if ((!$this->object->getFixedParticipants() || $online_access) && $ilAccess->checkAccess(
"read", 
"", $this->ref_id))
 
 4664                                 $executable = $this->
object->isExecutable($ilUser->getId(), $allowPassIncrease = TRUE);
 
 4665                                 if ($executable[
"executable"])
 
 4667                                         if( $this->object->areObligationsEnabled() && $this->
object->hasObligations($this->object->getTestId()) )
 
 4672                                         if ($this->object->getTestSession()->getActiveId() > 0)
 
 4675                                                 $resume_text = $this->lng->txt(
"tst_resume_test");
 
 4676                                                 if (($seq < 1) || ($seq == $this->object->getTestSequence()->getFirstSequence()))
 
 4678                                                         $resume_text = $this->
object->getStartTestLabel($this->object->getTestSession()->getActiveId());
 
 4681                                                 #if(!$_GET['crs_show_result'] or $this->object->getTestSequence()->getFirstSequence()) 
 4684                                                         $big_button[] = array(
'resume', $resume_text);
 
 4691                                                 $big_button[] = array(
"start", $this->object->getStartTestLabel($this->object->getTestSession()->getActiveId()));
 
 4698                                 if ($this->object->getTestSession()->getActiveId() > 0)
 
 4701                                         if ($this->object->canShowTestResults($ilUser->getId())) 
 
 4704                                                 $big_button[] = array(
"outUserResultsOverview", $this->lng->txt(
"tst_show_results"));
 
 4705                                                 if ($this->object->getHighscoreEnabled())
 
 4708                                                         $big_button[] = array(
"outResultsToplist", $this->lng->txt(
"tst_show_toplist"));
 
 4713                         if ($this->object->getTestSession()->getActiveId() > 0)
 
 4715                                 if ($this->object->canShowSolutionPrintview($ilUser->getId()))
 
 4718                                         $big_button[] = array(
"outUserListOfAnswerPasses", $this->lng->txt(
"tst_list_of_answers_show"));
 
 4723                 if( !$this->object->isOnline() )
 
 4725                         $message = $this->lng->txt(
"test_is_offline");
 
 4727                         if($ilAccess->checkAccess(
"write", 
"", $this->ref_id))
 
 4729                                 $message .= 
"<br /><a href=\"".$this->ctrl->getLinkTarget($this, 
"properties").
"\">".
 
 4730                                         $this->lng->txt(
"test_edit_settings").
"</a>";
 
 4736                 if ($this->object->getShowInfo())
 
 4738                         $info->enablePrivateNotes();
 
 4749                     $out = 
'<div class="il_ButtonGroup il_BigButton">';
 
 4750                     foreach($big_button as $button) {
 
 4751                         $out .= 
'<input type="submit" class="submit il_BigButton" name="cmd['.$button[0].
']" value="'.
 
 4758                 if (strlen($this->object->getIntroduction()))
 
 4760                         $introduction = $this->
object->getIntroduction();
 
 4761                         $info->addSection($this->lng->txt(
"tst_introduction"));
 
 4762                         $info->addProperty(
"", $this->object->prepareTextareaOutput($this->object->getIntroduction()).
 
 4763                                         $big_button.
"<br />".$info->getHiddenToggleButton());
 
 4767                         $info->addSection(
"");
 
 4768                         $info->addProperty(
"", $big_button.$info->getHiddenToggleButton());
 
 4773                 $info->addSection($this->lng->txt(
"tst_general_properties"));
 
 4774                 if ($this->object->getShowInfo())
 
 4776                         $info->addProperty($this->lng->txt(
"author"), $this->
object->getAuthor());
 
 4777                         $info->addProperty($this->lng->txt(
"title"), $this->
object->getTitle());
 
 4779                 if( $this->object->isOnline() && $this->
object->isComplete() )
 
 4781                         if ((!$this->object->getFixedParticipants() || $online_access) && $ilAccess->checkAccess(
"read", 
"", $this->ref_id))
 
 4783                                 if ($this->object->getShowInfo() || !$this->
object->getForceJS())
 
 4786                                         $checked_javascript = 
false;
 
 4787                                         if ($this->object->getJavaScriptOutput())
 
 4789                                                 $checked_javascript = 
true;
 
 4791                                         if ($this->object->getForceJS())
 
 4793                                                 $info->addProperty($this->lng->txt(
"tst_test_output"), $this->lng->txt(
"tst_use_javascript"));
 
 4797                                                 $info->addPropertyCheckbox($this->lng->txt(
"tst_test_output"), 
"chb_javascript", 1, $this->lng->txt(
"tst_use_javascript"), $checked_javascript);
 
 4801                                 if( !$this->object->isRandomTest() )
 
 4803                                         if ($this->object->getNrOfTries() != 1)
 
 4805                                                 if ($this->object->getUsePreviousAnswers() == 0)
 
 4807                                                         if ($this->object->getShowInfo())
 
 4809                                                                 $info->addProperty($this->lng->txt(
"tst_use_previous_answers"), $this->lng->txt(
"tst_dont_use_previous_answers"));
 
 4814                                                         $use_previous_answers = FALSE;
 
 4815                                                         if ($ilUser->prefs[
"tst_use_previous_answers"])
 
 4817                                                                 $checked_previous_answers = TRUE;
 
 4819                                                         $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);
 
 4823                                 if (
$_SESSION[
"AccountId"] == ANONYMOUS_USER_ID)
 
 4825                                         $info->addPropertyTextinput($this->lng->txt(
"enter_anonymous_code"), 
"anonymous_id", 
"", 8, 
"setAnonymousId", $this->lng->txt(
"submit"));
 
 4830                 $info->hideFurtherSections(
false);
 
 4832                 if ($this->object->getShowInfo())
 
 4834                         $info->addSection($this->lng->txt(
"tst_sequence_properties"));
 
 4835                         $info->addProperty($this->lng->txt(
"tst_sequence"), $this->lng->txt(($this->object->getSequenceSettings() == 
TEST_FIXED_SEQUENCE)? 
"tst_sequence_fixed":
"tst_sequence_postpone"));
 
 4837                         $info->addSection($this->lng->txt(
"tst_heading_scoring"));
 
 4838                         $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"));
 
 4839                         $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"));
 
 4840                         if ($this->object->isRandomTest())
 
 4842                                 $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"));
 
 4845                         $info->addSection($this->lng->txt(
"tst_score_reporting"));
 
 4846                         $score_reporting_text = 
"";
 
 4847                         switch ($this->object->getScoreReporting())
 
 4850                                         $score_reporting_text = $this->lng->txt(
"tst_report_after_test");
 
 4853                                         $score_reporting_text = $this->lng->txt(
"tst_report_after_first_question");
 
 4856                                         $score_reporting_text = $this->lng->txt(
"tst_report_after_date");
 
 4859                                         $score_reporting_text = $this->lng->txt(
"tst_report_never");
 
 4862                         $info->addProperty($this->lng->txt(
"tst_score_reporting"), $score_reporting_text); 
 
 4863                         $reporting_date = $this->
object->getReportingDate();
 
 4864                         if ($reporting_date)
 
 4866                                 #preg_match("/(\d{4})(\d{2})(\d{2})(\d{2})(\d{2})(\d{2})/", $reporting_date, $matches); 
 4867                                 #$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])); 
 4868                                 #$info->addProperty($this->lng->txt("tst_score_reporting_date"), $txt_reporting_date); 
 4869                                 $info->addProperty($this->lng->txt(
'tst_score_reporting_date'),
 
 4873                         $info->addSection($this->lng->txt(
"tst_session_settings"));
 
 4874                         $info->addProperty($this->lng->txt(
"tst_nr_of_tries"), ($this->
object->getNrOfTries() == 0)?$this->lng->txt(
"unlimited"):$this->
object->getNrOfTries());
 
 4875                         if ($this->object->getNrOfTries() != 1)
 
 4877                                 $info->addProperty($this->lng->txt(
"tst_nr_of_tries_of_user"), ($this->
object->getTestSession()->getPass() == 
false)?$this->lng->txt(
"tst_no_tries"):$this->
object->getTestSession()->getPass());
 
 4880                         if ($this->object->getEnableProcessingTime())
 
 4882                                 $info->addProperty($this->lng->txt(
"tst_processing_time"), $this->
object->getProcessingTime());
 
 4884                         if (strlen($this->object->getAllowedUsers()) && ($this->object->getAllowedUsersTimeGap()))
 
 4886                                 $info->addProperty($this->lng->txt(
"tst_allowed_users"), $this->
object->getAllowedUsers());
 
 4889                         $starting_time = $this->
object->getStartingTime();
 
 4892                                 $info->addProperty($this->lng->txt(
"tst_starting_time"),
 
 4895                         $ending_time = $this->
object->getEndingTime();
 
 4898                                 $info->addProperty($this->lng->txt(
"tst_ending_time"),
 
 4901                         $info->addMetaDataSections($this->object->getId(),0, $this->
object->getType());
 
 4904                         if(
$_GET[
'crs_show_result'] and !$this->object->getTestSequence()->getFirstSequence())
 
 4906                                 #ilUtil::sendInfo($this->lng->txt('crs_all_questions_answered_successfully')); 
 4910                 $this->ctrl->forwardCommand($info);
 
 4916                 switch ($this->ctrl->getCmd())
 
 4920                         case "redirectToInfoScreen":
 
 4927                         case "outCorrectSolution":
 
 4929                         case "showAnswersOfUser":
 
 4930                         case "outUserResultsOverview":
 
 4931                         case "backFromSummary":
 
 4932                         case "show_answers":
 
 4935                         case "outTestSummary":
 
 4936                         case "outQuestionSummary":
 
 4937                         case "gotoQuestion":
 
 4938                         case "selectImagemapRegion":
 
 4939                         case "confirmSubmitAnswers":
 
 4940                         case "finalSubmission":
 
 4942                         case "redirectQuestion":
 
 4943                         case "outUserPassDetails":
 
 4944                         case "checkPassword":
 
 4945                                 $ilLocator->addItem($this->object->getTitle(), $this->ctrl->getLinkTarget($this, 
"infoScreen"), 
"", 
$_GET[
"ref_id"]);
 
 4948                         case "evalAllUsers":
 
 4949                         case "evalUserDetail":
 
 4950                                 $ilLocator->addItem($this->object->getTitle(), $this->ctrl->getLinkTarget($this, 
"eval_stat"), 
"", 
$_GET[
"ref_id"]);
 
 4957                         case "importVerifiedFile":
 
 4958                         case "cancelImport":
 
 4961                                 $ilLocator->addItem($this->object->getTitle(), $this->ctrl->getLinkTarget($this, 
""), 
"", 
$_GET[
"ref_id"]);
 
 4969                 if ($ilAccess->checkAccess(
"write", 
"", $this->ref_id))
 
 4971                         $this->ctrl->saveParameterByClass($this->ctrl->getCmdClass(), 
'q_id');
 
 4973                         $tabs_gui->setBackTarget($this->lng->txt(
"backtocallingtest"), $this->ctrl->getLinkTargetByClass($this->ctrl->getCmdClass(), 
"questions"));
 
 4974                         $tabs_gui->addTarget(
"tst_browse_for_questions",
 
 4975                                 $this->ctrl->getLinkTarget($this, 
"browseForQuestions"),
 
 4976                                 array(
"browseForQuestions", 
"filter", 
"resetFilter", 
"resetTextFilter", 
"insertQuestions"),
 
 4985                 if ($ilAccess->checkAccess(
"write", 
"", $this->ref_id))
 
 4988                         $tabs_gui->setBackTarget($this->lng->txt(
"backtocallingtest"), $this->ctrl->getLinkTarget($this, 
"questions"));
 
 4989                         $tabs_gui->addTarget(
"random_selection",
 
 4990                                 $this->ctrl->getLinkTarget($this, 
"randomQuestions"),
 
 4991                                 array(
"randomQuestions"),
 
 5006                 include_once 
"./Services/Certificate/classes/class.ilCertificateGUI.php";
 
 5007                 include_once 
"./Modules/Test/classes/class.ilTestCertificateAdapter.php";
 
 5009                 $output_gui->certificateEditor();
 
 5015                 $ilTabs->activateTab(
'assQuestions');
 
 5016                 $a_cmd = $ilCtrl->getCmd();
 
 5018                 if (!$this->object->isRandomTest())
 
 5020                 #if (in_array($this->object->getEnabledViewMode(), array('both', 'express'))) { 
 5021                     $questions_per_page = ($a_cmd == 
'questions_per_page' || ($a_cmd == 
'removeQuestions' && 
$_REQUEST[
'test_express_mode'])) ? 
true : 
false;
 
 5023                     $this->tabs_gui->addSubTabTarget(
 
 5024                             "questions_per_page_view",
 
 5025                             $this->ctrl->getLinkTargetByClass(
'iltestexpresspageobjectgui', 
'showPage'),
 
 5026                             "", 
"", 
"", $questions_per_page);
 
 5029                 include_once 
"Services/Administration/classes/class.ilSettingsTemplate.php";
 
 5032                 if (!in_array(
'questions', $template->getHiddenTabs())) {
 
 5034                     $ilTabs->addSubTabTarget(
"edit_test_questions",
 
 5035                              $this->ctrl->getLinkTarget($this,
'questions'),
 
 5036                              array(
"questions", 
"browseForQuestions", 
"questionBrowser", 
"createQuestion",
 
 5037                              "randomselect", 
"filter", 
"resetFilter", 
"insertQuestions",
 
 5038                              "back", 
"createRandomSelection", 
"cancelRandomSelect",
 
 5039                              "insertRandomSelection", 
"removeQuestions", 
"moveQuestions",
 
 5040                              "insertQuestionsBefore", 
"insertQuestionsAfter", 
"confirmRemoveQuestions",
 
 5041                              "cancelRemoveQuestions", 
"executeCreateQuestion", 
"cancelCreateQuestion",
 
 5042                              "addQuestionpool", 
"saveRandomQuestions", 
"saveQuestionSelectionMode"),
 
 5045                     if (in_array($a_cmd, array(
'questions', 
'createQuestion')) || ($a_cmd == 
'removeQuestions' && !
$_REQUEST[
'test_express_mode']))
 
 5046                             $this->tabs_gui->activateSubTab(
'edit_test_questions');
 
 5051                 if (!$this->object->isRandomTest())
 
 5053                         $ilTabs->addSubTabTarget(
"print_view",
 
 5054                                  $this->ctrl->getLinkTarget($this,
'print'),
 
 5055                                  "print", 
"", 
"", $this->ctrl->getCmd() == 
'print');
 
 5065                 $ilTabs->addSubTabTarget(
"eval_all_users",
 
 5066                          $this->ctrl->getLinkTargetByClass(
"iltestevaluationgui", 
"outEvaluation"),
 
 5067                          array(
"outEvaluation", 
"detailedEvaluation", 
"exportEvaluation", 
"evalUserDetail", 
"passDetails",
 
 5068                                 "outStatisticsResultsOverview", 
"statisticsPassDetails")
 
 5072                 $ilTabs->addSubTabTarget(
"tst_results_aggregated",
 
 5073                         $this->ctrl->getLinkTargetByClass(
"iltestevaluationgui", 
"eval_a"),
 
 5078                 $ilTabs->addSubTabTarget(
"tst_single_results",
 
 5079                         $this->ctrl->getLinkTargetByClass(
"iltestevaluationgui", 
"singleResults"),
 
 5080                         array(
"singleResults"),
 
 5089                 $force_active = ($this->ctrl->getCmd() == 
"")
 
 5092                 $ilTabs->addSubTabTarget(
"general",
 
 5093                          $this->ctrl->getLinkTarget($this,
'properties'),
 
 5094                          array(
"properties", 
"saveProperties", 
"cancelProperties"),
 
 5095                          array(
"", 
"ilobjtestgui", 
"ilcertificategui"),
 
 5098                 if (!in_array(
'mark_schema', $hiddenTabs)) {
 
 5100                     $ilTabs->addSubTabTarget(
 
 5102                             $this->ctrl->getLinkTarget($this,
'marks'),
 
 5103                             array(
"marks", 
"addMarkStep", 
"deleteMarkSteps", 
"addSimpleMarkSchema",
 
 5104                                     "saveMarks", 
"cancelMarks"),
 
 5105                             array(
"", 
"ilobjtestgui", 
"ilcertificategui")
 
 5110                 $ilTabs->addSubTabTarget(
 
 5112                         $this->ctrl->getLinkTarget($this,
'scoring'),
 
 5114                         array(
"", 
"ilobjtestgui", 
"ilcertificategui")
 
 5118                 include_once 
"Services/Certificate/classes/class.ilCertificate.php";
 
 5121                         $ilTabs->addSubTabTarget(
 
 5123                                 $this->ctrl->getLinkTarget($this,
'certificate'),
 
 5124                                 array(
"certificate", 
"certificateEditor", 
"certificateRemoveBackground", 
"certificateSave",
 
 5125                                         "certificatePreview", 
"certificateDelete", 
"certificateUpload", 
"certificateImport"),
 
 5126                                 array(
"", 
"ilobjtestgui", 
"ilcertificategui")
 
 5130                 if (!in_array(
'defaults', $hiddenTabs)) {
 
 5132                     $ilTabs->addSubTabTarget(
 
 5133                             "tst_default_settings",
 
 5134                             $this->ctrl->getLinkTarget($this, 
"defaults"),
 
 5135                             array(
"defaults", 
"deleteDefaults", 
"addDefaults", 
"applyDefaults"),
 
 5136                             array(
"", 
"ilobjtestgui", 
"ilcertificategui")
 
 5148                 global $ilAccess,
$ilUser, $ilHelp;
 
 5150                 if (preg_match(
'/^ass(.*?)gui$/i', $this->ctrl->getNextClass($this))) {
 
 5153                 else if ($this->ctrl->getNextClass($this) == 
'ilpageobjectgui') {
 
 5157                 $ilHelp->setScreenIdComponent(
"tst");
 
 5159                 $hidden_tabs = array();
 
 5161                 $template = $this->
object->getTemplate();
 
 5164                         include_once 
"Services/Administration/classes/class.ilSettingsTemplate.php";
 
 5167                         $hidden_tabs = $template->getHiddenTabs();
 
 5170                 if( $this->ctrl->getNextClass($this) == 
'iltestoutputgui')
 
 5175                 switch ($this->ctrl->getCmd())
 
 5181                         case "directfeedback":
 
 5183                         case "outCorrectSolution":
 
 5185                         case "showAnswersOfUser":
 
 5186                         case "outUserResultsOverview":
 
 5187                         case "backFromSummary":
 
 5188                         case "show_answers":
 
 5191                         case "confirmFinish":
 
 5192                         case "outTestSummary":
 
 5193                         case "outQuestionSummary":
 
 5194                         case "gotoQuestion":
 
 5195                         case "selectImagemapRegion":
 
 5196                         case "confirmSubmitAnswers":
 
 5197                         case "finalSubmission":
 
 5199                         case "redirectQuestion":
 
 5200                         case "outUserPassDetails":
 
 5201                         case "checkPassword":
 
 5202                         case "exportCertificate":
 
 5203                         case "finishListOfAnswers":
 
 5204                         case "backConfirmFinish":
 
 5205                         case "showFinalStatement":
 
 5208                         case "browseForQuestions":
 
 5211                         case "resetTextFilter":
 
 5212                         case "insertQuestions":
 
 5214                                 if($this->ctrl->getNextClass($this) != 
"illearningprogressgui")
 
 5225                         case "deleteMarkSteps":
 
 5226                         case "addSimpleMarkSchema":
 
 5228                         case "certificateservice":
 
 5229                         case "certificateImport":
 
 5230                         case "certificateUpload":
 
 5231                         case "certificateEditor":
 
 5232                         case "certificateDelete":
 
 5233                         case "certificateSave":
 
 5235                         case "deleteDefaults":
 
 5237                         case "applyDefaults":
 
 5238                         case "inviteParticipants":
 
 5239                         case "searchParticipants":
 
 5241                                 if (($ilAccess->checkAccess(
"write", 
"", $this->ref_id)) && ((strcmp($this->ctrl->getCmdClass(), 
"ilobjtestgui") == 0) || (strcmp($this->ctrl->getCmdClass(), 
"ilcertificategui") == 0) || (strlen($this->ctrl->getCmdClass()) == 0)))
 
 5251                         case "detailedEvaluation":
 
 5252                         case "outEvaluation":
 
 5253                         case "singleResults":
 
 5254                         case "exportEvaluation":
 
 5255                         case "evalUserDetail":
 
 5257                         case "outStatisticsResultsOverview":
 
 5258                         case "statisticsPassDetails":
 
 5263                 if (strcmp(strtolower(get_class($this->
object)), 
"ilobjtest") == 0)
 
 5266                         if ($ilAccess->checkAccess(
"write", 
"", $this->ref_id) && !in_array(
'assQuestions', $hidden_tabs))
 
 5268                                 $force_active = (
$_GET[
"up"] != 
"" || 
$_GET[
"down"] != 
"")
 
 5273                                         if (
$_GET[
"browse"] == 1) $force_active = 
true;
 
 5274                                         if (preg_match(
"/deleteqpl_\d+/", $this->ctrl->getCmd()))
 
 5276                                                 $force_active = 
true;
 
 5280                                 if ($this->object->isRandomTest()) {
 
 5281                                     $target = $this->ctrl->getLinkTarget($this,
'questions');
 
 5284                                     $target = $this->ctrl->getLinkTargetByClass(
'iltestexpresspageobjectgui',
'showPage');
 
 5287                                 $tabs_gui->addTarget(
"assQuestions",
 
 5290                                          array(
"questions", 
"browseForQuestions", 
"questionBrowser", 
"createQuestion", 
 
 5291                                          "randomselect", 
"filter", 
"resetFilter", 
"insertQuestions",
 
 5292                                          "back", 
"createRandomSelection", 
"cancelRandomSelect",
 
 5293                                          "insertRandomSelection", 
"removeQuestions", 
"moveQuestions",
 
 5294                                          "insertQuestionsBefore", 
"insertQuestionsAfter", 
"confirmRemoveQuestions",
 
 5295                                          "cancelRemoveQuestions", 
"executeCreateQuestion", 
"cancelCreateQuestion",
 
 5296                                          "addQuestionpool", 
"saveRandomQuestions", 
"saveQuestionSelectionMode", 
"print",
 
 5297                                         "addsource", 
"removesource", 
"randomQuestions"), 
 
 5298                                          "", 
"", $force_active);
 
 5302                         if ($ilAccess->checkAccess(
"visible", 
"", $this->ref_id) && !in_array(
'info_short', $hidden_tabs))
 
 5304                                 $tabs_gui->addTarget(
"info_short",
 
 5305                                          $this->ctrl->getLinkTarget($this,
'infoScreen'),
 
 5306                                          array(
"infoScreen", 
"outIntroductionPage", 
"showSummary", 
 
 5307                                          "setAnonymousId", 
"outUserListOfAnswerPasses", 
"redirectToInfoScreen"));
 
 5311                         if ($ilAccess->checkAccess(
"write", 
"", $this->ref_id))
 
 5313                             if (!in_array(
'settings', $hidden_tabs)) {
 
 5314                                 $tabs_gui->addTarget(
"settings",
 
 5315                                         $this->ctrl->getLinkTarget($this,
'properties'),
 
 5316                                                 array(
"properties", 
"saveProperties", 
"cancelProperties",
 
 5317                                                         "marks", 
"addMarkStep", 
"deleteMarkSteps", 
"addSimpleMarkSchema",
 
 5318                                                         "saveMarks", 
"cancelMarks", 
 
 5319                                                         "certificate", 
"certificateEditor", 
"certificateRemoveBackground",
 
 5320                                                         "certificateSave", 
"certificatePreview", 
"certificateDelete", 
"certificateUpload",
 
 5321                                                         "certificateImport", 
"scoring", 
"defaults", 
"addDefaults", 
"deleteDefaults", 
"applyDefaults",
 
 5322                                                         "inviteParticipants", 
"saveFixedParticipantsStatus", 
"searchParticipants", 
"addParticipants", 
 
 5325                                          array(
"", 
"ilobjtestgui", 
"ilcertificategui")
 
 5329                             if (!in_array(
'participants', $hidden_tabs)) {
 
 5331                                 $tabs_gui->addTarget(
"participants",
 
 5332                                          $this->ctrl->getLinkTarget($this,
'participants'),
 
 5333                                          array(
"participants", 
"saveClientIP",
 
 5334                                          "removeParticipant", 
 
 5335                                          "showParticipantAnswersForAuthor",
 
 5336                                          "deleteAllUserResults",
 
 5337                                          "cancelDeleteAllUserData", 
"deleteSingleUserResults",
 
 5338                                          "outParticipantsResultsOverview", 
"outParticipantsPassDetails",
 
 5339                                          "showPassOverview", 
"showUserAnswers", 
"participantsAction",
 
 5340                                         "showDetailedResults"), 
 
 5345                         include_once 
'./Services/Tracking/classes/class.ilLearningProgressAccess.php';
 
 5348                                 $tabs_gui->addTarget(
'learning_progress',
 
 5349                                                                          $this->ctrl->getLinkTargetByClass(array(
'illearningprogressgui'),
''),
 
 5351                                                                          array(
'illplistofobjectsgui',
'illplistofsettingsgui',
'illearningprogressgui',
'illplistofprogressgui'));
 
 5354                         if ($ilAccess->checkAccess(
"write", 
"", $this->ref_id)  && !in_array(
'manscoring', $hidden_tabs))
 
 5356                                 include_once 
"./Modules/Test/classes/class.ilObjAssessmentFolder.php";
 
 5358                                 if (count($scoring))
 
 5361                                         $tabs_gui->addTarget(
 
 5362                                                         "manscoring", $this->ctrl->getLinkTargetByClass(
'ilTestScoringGUI', 
'showManScoringParticipantsTable'),
 
 5363                                                         array(
'showManScoringParticipantsTable', 
'applyManScoringParticipantsFilter', 
'resetManScoringParticipantsFilter', 
'showManScoringParticipantScreen'), 
'' 
 5368                         if ((($ilAccess->checkAccess(
"tst_statistics", 
"", $this->ref_id)) || ($ilAccess->checkAccess(
"write", 
"", $this->ref_id)))  && !in_array(
'statistics', $hidden_tabs))
 
 5371                                 $tabs_gui->addTarget(
"statistics",
 
 5372                                          $this->ctrl->getLinkTargetByClass(
"iltestevaluationgui", 
"outEvaluation"),
 
 5373                                          array(
"statistics", 
"outEvaluation", 
"exportEvaluation", 
"detailedEvaluation", 
"eval_a", 
"evalUserDetail",
 
 5374                                                 "passDetails", 
"outStatisticsResultsOverview", 
"statisticsPassDetails", 
"singleResults")
 
 5378                         if ($ilAccess->checkAccess(
"write", 
"", $this->ref_id))
 
 5380                              if (!in_array(
'history', $hidden_tabs)) {
 
 5383                                 $tabs_gui->addTarget(
"history",
 
 5384                                          $this->ctrl->getLinkTarget($this,
'history'),
 
 5388                              if (!in_array(
'meta_data', $hidden_tabs)) {
 
 5390                                 $tabs_gui->addTarget(
"meta_data",
 
 5391                                          $this->ctrl->getLinkTargetByClass(
'ilmdeditorgui',
'listSection'),
 
 5392                                          "", 
"ilmdeditorgui");
 
 5395                              if (!in_array(
'export', $hidden_tabs)) {
 
 5397                                 $tabs_gui->addTarget(
"export",
 
 5398                                          $this->ctrl->getLinkTarget($this,
'export'),
 
 5399                                          array(
"export", 
"createExportFile", 
"confirmDeleteExportFile",
 
 5400                                          "downloadExportFile", 
"deleteExportFile", 
"cancelDeleteExportFile"),
 
 5405                         if ($ilAccess->checkAccess(
"edit_permission", 
"", $this->ref_id)&& !in_array(
'permissions', $hidden_tabs))
 
 5407                                 $tabs_gui->addTarget(
"perm_settings",
 
 5408                                 $this->ctrl->getLinkTargetByClass(array(get_class($this),
'ilpermissiongui'), 
"perm"), array(
"perm",
"info",
"owner"), 
'ilpermissiongui');
 
 5425                 if ($ilAccess->checkAccess(
"visible", 
"", $a_target))
 
 5428                         $_GET[
"baseClass"] = 
"ilObjTestGUI";
 
 5429                         $_GET[
"cmd"] = 
"infoScreen";
 
 5430                         $_GET[
"ref_id"] = $a_target;
 
 5431                         include_once(
"ilias.php");
 
 5435                 else if ($ilAccess->checkAccess(
"read", 
"", ROOT_FOLDER_ID))
 
 5442                 $ilErr->raiseError($lng->txt(
"msg_no_perm_read_lm"), $ilErr->FATAL);
 
 5457             if ($this->create_question_mode)
 
 5464                 $ilCtrl->saveParameter($this, 
'q_mode');
 
 5466                 $ilCtrl->setParameterByClass(
'iltestexpresspageobjectgui', 
'test_express_mode', 1);
 
 5467                 $ilCtrl->setParameter($this, 
'test_express_mode', 1);
 
 5468                 $ilCtrl->setParameterByClass(
'iltestexpresspageobjectgui', 
'q_id', 
$_REQUEST[
'q_id']);
 
 5469                 $ilCtrl->setParameter($this, 
'q_id', 
$_REQUEST[
'q_id']);
 
 5470                 $ilToolbar->setFormAction($ilCtrl->getFormActionByClass(
'iltestexpresspageobjectgui', 
'edit'));
 
 5472                 if ($this->object->evalTotalPersons() == 0) {
 
 5493                     $ilToolbar->addFormButton($lng->txt(
"test_create_question"), 
"addQuestion");
 
 5495                     $ilToolbar->addSeparator();             
 
 5497                     if ($this->object->getPoolUsage()) {
 
 5498                             $ilToolbar->addFormButton($lng->txt(
"tst_browse_for_questions"), 
"browseForQuestions");
 
 5500                             $show_separator = 
true;
 
 5504                 $questions = $this->
object->getQuestionTitlesAndIndexes();
 
 5508                 foreach($questions as $id => $label) {
 
 5509                     $options[$id] = $label;
 
 5512                 $optionKeys = array_keys($options);
 
 5515                     $options[] = $lng->txt(
'none');
 
 5541                 if (count($questions)) {
 
 5542                     if (isset($show_separator) && $show_separator) {
 
 5543                         $ilToolbar->addSeparator();
 
 5546                     $ilToolbar->addLink($lng->txt(
"test_prev_question"), $ilCtrl->getLinkTargetByClass(
'iltestexpresspageobjectgui', 
'prevQuestion'), !(count($options) > 1 && $optionKeys[0] != $qid));
 
 5547                     $ilToolbar->addLink($lng->txt(
"test_next_question"), $ilCtrl->getLinkTargetByClass(
'iltestexpresspageobjectgui', 
'nextQuestion'), !(count($options) > 1 && $optionKeys[count($optionKeys)-1] != $qid));
 
 5550                 if (count($questions) > 1) {
 
 5552                     $ilToolbar->addSeparator();
 
 5554                     include_once(
"./Services/Form/classes/class.ilSelectInputGUI.php");
 
 5556                     $si->addCustomAttribute(
"onChange=\"forms['ilToolbar'].submit();\"");
 
 5557                     $si->setOptions($options);
 
 5560                         $si->setValue($qid);
 
 5563                     $ilToolbar->addInputItem(
$si, 
true);
 
 5566                 $total = $this->
object->evalTotalPersons();
 
 5581                 if (count($questions) && !
$total) {
 
 5582                     $ilCtrl->setParameter($this, 
'q_id', 
$_REQUEST[
'q_id']);
 
 5583                     $ilToolbar->addSeparator();
 
 5584                     $ilToolbar->addButton($lng->txt(
"test_delete_page"), $ilCtrl->getLinkTarget($this, 
"removeQuestions"));
 
 5587                 if (count($questions) > 1 && !
$total) {
 
 5588                     $ilToolbar->addSeparator();
 
 5589                     $ilToolbar->addButton($lng->txt(
"test_move_page"), $ilCtrl->getLinkTarget($this, 
"movePageForm"));
 
 5593                 $seq = $this->
object->getTestSession()->getLastSequence();
 
 5594                 $online_access = 
false;
 
 5595                 if ($this->object->getFixedParticipants())
 
 5597                         include_once 
"./Modules/Test/classes/class.ilObjTestAccess.php";
 
 5599                         if ($online_access_result === 
true)
 
 5601                                 $online_access = 
true;
 
 5605                 if( $this->object->isOnline() && $this->
object->isComplete() )
 
 5607                         if ((!$this->object->getFixedParticipants() || $online_access) && $ilAccess->checkAccess(
"read", 
"", $this->ref_id))
 
 5609                                 $executable = $this->
object->isExecutable($ilUser->getId(), $allowPassIncrease = TRUE);
 
 5610                                 if ($executable[
"executable"])
 
 5612                                         if ($this->object->getTestSession()->getActiveId() > 0)
 
 5614                                                 $ilToolbar->addSeparator();
 
 5615                                                 $ilToolbar->addButton($lng->txt(
'tst_resume_test'), $ilCtrl->getLinkTargetByClass(
'iltestoutputgui', 
'resume'));                                                
 
 5619                                                 $ilToolbar->addSeparator();
 
 5620                                                 $ilToolbar->addButton($lng->txt(
'tst_start_test'), $ilCtrl->getLinkTargetByClass(
'iltestoutputgui', 
'startTest'));
 
 5631             include_once 
'Modules/TestQuestionPool/classes/class.ilObjQuestionPool.php';
 
 5637                 $newId = $qpool->copyQuestion($q_id, $qpool->getId());
 
 5638                 $newIds[$q_id] = $newId;
 
 5654             foreach(
$result->ids as $oldId => $newId) {
 
 5656                 $questionInstance->setNewOriginalId($newId);
 
 5657                 $questionInstance->setObjId(
$result->qpool->getId());
 
 5658                 $questionInstance->saveToDb();
 
 5668                 include_once 
'Services/Form/classes/class.ilPropertyFormGUI.php';
 
 5672                 $title->setRequired(
true);
 
 5676                 $form->addItem($description);
 
 5678                 $form->addCommandButton(
'createQuestionPoolAndCopy', $lng->txt(
'create'));
 
 5685                                 $hidden->setValue($id);
 
 5686                                 $form->addItem($hidden);
 
 5702                 include_once 
"./Modules/TestQuestionPool/classes/class.assQuestion.php";
 
 5758                 $ilTabs->activateSubTab(
'edit_test_questions');
 
 5760                 $this->tpl->addBlockFile(
"ADM_CONTENT", 
"adm_content", 
"tpl.il_as_tst_qpl_select_copy.html", 
"Modules/Test");
 
 5761                 $questionpools =& $this->
object->getAvailableQuestionpools(FALSE, FALSE, FALSE, TRUE, FALSE, 
"write");
 
 5762                 if(count($questionpools) == 0)
 
 5764                         $this->tpl->setCurrentBlock(
"option");
 
 5765                         $this->tpl->setVariable(
"VALUE_QPL", 
"");
 
 5766                         $this->tpl->parseCurrentBlock();
 
 5770                         foreach($questionpools as $key => $value)
 
 5772                                 $this->tpl->setCurrentBlock(
"option");
 
 5773                                 $this->tpl->setVariable(
"VALUE_OPTION", $key);
 
 5774                                 $this->tpl->setVariable(
"TEXT_OPTION", $value[
"title"]);
 
 5775                                 $this->tpl->parseCurrentBlock();
 
 5783                                 $this->tpl->setCurrentBlock(
"hidden");
 
 5784                                 $this->tpl->setVariable(
"HIDDEN_NAME", 
"q_id[]");
 
 5785                                 $this->tpl->setVariable(
"HIDDEN_VALUE", $id);
 
 5786                                 $this->tpl->parseCurrentBlock();
 
 5787                                 $this->tpl->setCurrentBlock(
"adm_content");
 
 5791                 $this->tpl->setVariable(
"FORM_ACTION", $this->ctrl->getFormAction($this));
 
 5793                 if(count($questionpools) == 0)
 
 5795                         $this->tpl->setVariable(
"TXT_QPL_SELECT", $this->lng->txt(
"tst_enter_questionpool"));
 
 5796                         $cmd = 
'createQuestionPoolAndCopy';
 
 5800                         $this->tpl->setVariable(
"TXT_QPL_SELECT", $this->lng->txt(
"tst_select_questionpool"));
 
 5803                 $this->tpl->setVariable(
"CMD_SUBMIT", 
$cmd);
 
 5804                 $this->tpl->setVariable(
"BTN_SUBMIT", $this->lng->txt(
"submit"));
 
 5805                 $this->tpl->setVariable(
"BTN_CANCEL", $this->lng->txt(
"cancel"));
 
 5810                         case 'copyAndLinkQuestionsToPool':
 
 5812                                 $hidden->setValue(1);
 
 5813                                 $createForm->addItem($hidden);
 
 5815                         case 'copyQuestionsToPool':
 
 5818                 $createForm->setFormAction($this->ctrl->getFormAction($this));
 
 5820                 $this->tpl->parseCurrentBlock();
 
 5825             $simpleSetters = array(
 
 5826                 'anonymity' => 
'setAnonymity',
 
 5827                 'random_test' => 
'setRandomTest',
 
 5828                                 'use_pool' => 
'setPoolUsage',
 
 5829                 'test_enabled_views' => 
'setEnabledViewMode',
 
 5831                 'introduction' => 
'setIntroduction',
 
 5832                 'showinfo' => 
'setShowInfo',
 
 5833                 'finalstatement' => 
'setFinalStatement',
 
 5834                 'showfinalstatement' => 
'setShowFinalStatement',
 
 5835                 'chb_shuffle_questions' => 
'setShuffleQuestions',
 
 5836                 'list_of_questions' => 
'setListOfQuestionsSettings',
 
 5837                 'chb_show_marker' => 
'setShowMarker',
 
 5838                 'chb_show_cancel' => 
'setShowCancel',
 
 5839                 'kiosk' => 
'setKiosk',
 
 5840                 'nr_of_tries' => 
'setNrOfTries',
 
 5841                 'chb_processing_time' => 
'setEnableProcessingTime',
 
 5842                 'chb_use_previous_answers' => 
'setUsePreviousAnswers',
 
 5843                 'forcejs' => 
'setForceJS',
 
 5844                 'title_output' => 
'setTitleOutput',
 
 5845                 'password' => 
'setPassword',
 
 5846                 'fixedparticipants' => 
'setFixedParticipants',
 
 5847                 'allowedUsers' => 
'setAllowedUsers',
 
 5848                 'allowedUsersTimeGap' => 
'setAllowedUsersTimeGap',
 
 5849                 'mailnotification' => 
'setMailNotification',
 
 5850                 'mailnottype' => 
'setMailNotificationType',
 
 5852                 'count_system' => 
'setCountSystem',
 
 5853                 'mc_scoring' => 
'setMCScoring',
 
 5854                 'score_cutting' => 
'setScoreCutting',
 
 5855                 'pass_scoring' => 
'setScoreReporting',
 
 5857                 'instant_feedback' => 
'setScoringFeedbackOptionsByArray',
 
 5859                 'results_presentation' => 
'setResultsPresentationOptionsByArray',
 
 5860                 'export_settings' => 
'setExportSettings',
 
 5861                 'print_bs_with_res' => 
'setPrintBestSolutionWithResult',
 
 5864             if (!$templateData[
'results_presentation'][
'value']) {
 
 5865                 $templateData[
'results_presentation'][
'value'] = array();
 
 5868             foreach($simpleSetters as $field => $setter) {
 
 5869                 if($templateData[$field]) {
 
 5870                     $object->$setter($templateData[$field][
'value']);
 
 5909                 'fixedparticipants',
 
 5911                 'allowedUsersTimeGap',
 
 5925             foreach($fields as $fld) {
 
 5926                 if (isset($templateData[$fld])) {
 
 5927                     if(!$templateData[$fld][
'hide'])
 
 5943                 $this->tpl->addBlockFile(
"ADM_CONTENT", 
"adm_content", 
"tpl.il_tst_tst_confirm_resettemplate.html", 
"Modules/Test");
 
 5944                 $this->tpl->setCurrentBlock(
"adm_content");
 
 5945                 $this->tpl->setVariable(
"BTN_CONFIRM_REMOVE", $this->lng->txt(
"confirm"));
 
 5946                 $this->tpl->setVariable(
"BTN_CANCEL_REMOVE", $this->lng->txt(
"cancel"));
 
 5947                 $this->tpl->setVariable(
"FORM_ACTION", $this->ctrl->getFormAction($this, 
"resetTemplateObject"));
 
 5948                 $this->tpl->parseCurrentBlock();
 
 5956                 $this->
object->setTemplate(null);
 
 5957                 $this->
object->saveToDB();
 
 5960                 $this->ctrl->redirect($this, 
"properties");
 
 5966             if (!$ilAccess->checkAccess(
"write", 
"", $this->ref_id))
 
 5970                     $this->ctrl->redirect($this, 
"infoScreen");
 
 5975                 $orders = $obligations = array();
 
 5977                 foreach(
$_REQUEST[
'order'] as $qId => $order)
 
 5979                         $id = (int)str_replace(
'q_', 
'', $qId);
 
 5981                         $orders[$id] = $order;
 
 5984                 if( $this->object->areObligationsEnabled() && isset(
$_REQUEST[
'obligatory']) && is_array(
$_REQUEST[
'obligatory']) )
 
 5986                         foreach(
$_REQUEST[
'obligatory'] as $qId => $obligation)
 
 5988                                 $id = (int)str_replace(
'q_', 
'', $qId);
 
 5992                                         $obligations[$id] = $obligation;
 
 5997             $this->
object->setQuestionOrderAndObligations(
 
 5998                         $orders, $obligations
 
 6001             $ilCtrl->redirect($this, 
'questions');
 
 6011                 include_once 
"Services/Form/classes/class.ilPropertyFormGUI.php";
 
 6013                 $form->setFormAction($ilCtrl->getFormAction($this, 
"movePage"));
 
 6014                 $form->setTitle($lng->txt(
"test_move_page"));
 
 6018                 $form->addItem($old_pos);
 
 6020                 $questions = $this->
object->getQuestionTitlesAndIndexes();
 
 6021                 if (!is_array($questions))
 
 6022                     $questions = array();
 
 6024                 foreach($questions as $k => $q) {
 
 6026                         unset($questions[$k]);
 
 6029                     $questions[$k] = $lng->txt(
'behind') . 
' '. $q;
 
 6031                 #$questions['0'] = $lng->txt('first'); 
 6034                     0 => $lng->txt(
'first')
 
 6036                 foreach($questions as $k => $q) {
 
 6042                 $form->addItem($pos);
 
 6044                 $form->addCommandButton(
"movePage", $lng->txt(
"submit"));
 
 6045                 $form->addCommandButton(
"showPage", $lng->txt(
"cancel"));
 
 6047                 return $tpl->setContent($form->getHTML());
 
 6052             if (!$ilAccess->checkAccess(
"write", 
"", $this->ref_id))
 
 6056                     $this->ctrl->redirect($this, 
"infoScreen");
 
 6066             $ilCtrl->setParameterByClass(
'iltestexpresspageobjectgui', 
'q_id', 
$_REQUEST[
'q_id']);
 
 6067             $ilCtrl->redirectByClass(
'iltestexpresspageobjectgui', 
'showPage');
 
 6072             if (!$ilAccess->checkAccess(
"write", 
"", $this->ref_id))
 
 6076                     $this->ctrl->redirect($this, 
"infoScreen");
 
 6086                 $this->ctrl->redirect($this, 
'questions');
 
 6091             $questionTitles = $this->
object->getQuestionTitles();
 
 6093             foreach($ids as $id)
 
 6095                 include_once 
"./Modules/TestQuestionPool/classes/class.assQuestion.php";
 
 6099                     $title = $question->object->getTitle();
 
 6101                     while(  in_array( 
$title . 
' (' . $i . 
')', $questionTitles ))
 
 6104                     $title .= 
' (' . $i . 
')';
 
 6106                     $questionTitles[] = 
$title;
 
 6108                     $new_id = $question->object->duplicate(
false, 
$title);
 
 6111                     $clone->object->setObjId($this->object->getId());
 
 6112                     $clone->object->saveToDb();
 
 6114                     $this->
object->insertQuestion($new_id, 
true);
 
 6122             $this->ctrl->redirect($this, 
'questions');
 
 6127                 return ($random_test != $this->object->isRandomTest());