00001 <?php
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00041 include_once "./classes/class.ilObjectGUI.php";
00042 include_once "./Modules/Test/classes/inc.AssessmentConstants.php";
00043
00044 class ilObjTestGUI extends ilObjectGUI
00045 {
00050 function ilObjTestGUI()
00051 {
00052 global $lng, $ilCtrl;
00053 $lng->loadLanguageModule("assessment");
00054 $this->type = "tst";
00055 $this->ctrl =& $ilCtrl;
00056 $this->ctrl->saveParameter($this, "ref_id");
00057 $this->ilObjectGUI("",$_GET["ref_id"], true, false);
00058
00059 if((int) $_GET['crs_show_result'])
00060 {
00061 $this->ctrl->saveParameter($this,'crs_show_result',(int) $_GET['crs_show_result']);
00062 }
00063 }
00064
00068 function &executeCommand()
00069 {
00070 global $ilAccess, $ilNavigationHistory;
00071
00072 if ((!$ilAccess->checkAccess("read", "", $_GET["ref_id"])) && (!$ilAccess->checkAccess("visible", "", $_GET["ref_id"])))
00073 {
00074 global $ilias;
00075 $ilias->raiseError($this->lng->txt("permission_denied"), $ilias->error_obj->MESSAGE);
00076 }
00077 $this->prepareOutput();
00078 $cmd = $this->ctrl->getCmd("properties");
00079 $next_class = $this->ctrl->getNextClass($this);
00080 $this->ctrl->setReturn($this, "properties");
00081 $this->tpl->addCss(ilUtil::getStyleSheetLocation("output", "ta.css", "Modules/Test"), "screen");
00082
00083
00084 if (!$this->getCreationMode() &&
00085 $ilAccess->checkAccess("read", "", $_GET["ref_id"]))
00086 {
00087 $ilNavigationHistory->addItem($_GET["ref_id"],
00088 "ilias.php?baseClass=ilObjTestGUI&cmd=infoScreen&ref_id=".$_GET["ref_id"], "tst");
00089 }
00090 switch($next_class)
00091 {
00092 case "ilinfoscreengui":
00093 $this->infoScreen();
00094 break;
00095 case 'ilmdeditorgui':
00096 include_once 'Services/MetaData/classes/class.ilMDEditorGUI.php';
00097
00098 $md_gui =& new ilMDEditorGUI($this->object->getId(), 0, $this->object->getType());
00099 $md_gui->addObserver($this->object,'MDUpdateListener','General');
00100
00101 $this->ctrl->forwardCommand($md_gui);
00102 break;
00103 case "iltestoutputgui":
00104 include_once "./Modules/Test/classes/class.ilTestOutputGUI.php";
00105
00106 $output_gui =& new ilTestOutputGUI($this->object);
00107 $this->ctrl->forwardCommand($output_gui);
00108 break;
00109 case "iltestevaluationgui":
00110 include_once "./Modules/Test/classes/class.ilTestEvaluationGUI.php";
00111 $evaluation_gui =& new ilTestEvaluationGUI($this->object);
00112 $this->ctrl->forwardCommand($evaluation_gui);
00113 break;
00114
00115 case "iltestservicegui":
00116 include_once "./Modules/Test/classes/class.ilTestServiceGUI.php";
00117 $serviceGUI =& new ilTestServiceGUI($this->object);
00118 $this->ctrl->forwardCommand($serviceGUI);
00119 break;
00120
00121 case 'ilpermissiongui':
00122 include_once("./classes/class.ilPermissionGUI.php");
00123 $perm_gui =& new ilPermissionGUI($this);
00124 $ret =& $this->ctrl->forwardCommand($perm_gui);
00125 break;
00126
00127 case "illearningprogressgui":
00128 include_once './Services/Tracking/classes/class.ilLearningProgressGUI.php';
00129
00130 $new_gui =& new ilLearningProgressGUI(LP_MODE_REPOSITORY,$this->object->getRefId());
00131 $this->ctrl->forwardCommand($new_gui);
00132
00133 break;
00134
00135 case "iltestcertificategui":
00136 include_once "./Modules/Test/classes/class.ilTestCertificateGUI.php";
00137 $output_gui = new ilTestCertificateGUI($this->object);
00138 $this->ctrl->forwardCommand($output_gui);
00139 break;
00140
00141 case "iltestscoringgui":
00142 include_once "./Modules/Test/classes/class.ilTestScoringGUI.php";
00143 $output_gui = new ilTestScoringGUI($this->object);
00144 $this->ctrl->forwardCommand($output_gui);
00145 break;
00146
00147 default:
00148 if (preg_match("/deleteqpl_\d+/", $cmd))
00149 {
00150 $cmd = "randomQuestions";
00151 }
00152 if ((strcmp($cmd, "properties") == 0) && ($_GET["browse"]))
00153 {
00154 $this->questionBrowser();
00155 return;
00156 }
00157 if ((strcmp($cmd, "properties") == 0) && ($_GET["up"] || $_GET["down"]))
00158 {
00159 $this->questionsObject();
00160 return;
00161 }
00162 $cmd.= "Object";
00163 $ret =& $this->$cmd();
00164 break;
00165 }
00166 if (strtolower($_GET["baseClass"]) != "iladministrationgui" &&
00167 $this->getCreationMode() != true)
00168 {
00169 $this->tpl->show();
00170 }
00171 }
00172
00173 function runObject()
00174 {
00175 $this->ctrl->redirect($this, "infoScreen");
00176 }
00177
00178 function outEvaluationObject()
00179 {
00180 $this->ctrl->redirectByClass("iltestevaluationgui", "outEvaluation");
00181 }
00182
00186 function importFileObject()
00187 {
00188 if ($_POST["qpl"] < 1)
00189 {
00190 ilUtil::sendInfo($this->lng->txt("tst_select_questionpools"));
00191 $this->createObject();
00192 return;
00193 }
00194 if (strcmp($_FILES["xmldoc"]["tmp_name"], "") == 0)
00195 {
00196 ilUtil::sendInfo($this->lng->txt("tst_select_file_for_import"));
00197 $this->createObject();
00198 return;
00199 }
00200 $this->ctrl->setParameter($this, "new_type", $this->type);
00201 $this->uploadTstObject();
00202 }
00203
00208 function saveObject()
00209 {
00210 global $rbacadmin;
00211
00212
00213 $newObj = parent::saveObject();
00214 if ($_POST["defaults"] > 0)
00215 {
00216 $newObj->applyDefaults($_POST["defaults"]);
00217 }
00218
00219
00220 ilUtil::sendInfo($this->lng->txt("object_added"),true);
00221 ilUtil::redirect("ilias.php?baseClass=ilObjTestGUI&ref_id=".$newObj->getRefId()."&cmd=properties");
00222 }
00223
00224 function backToRepositoryObject()
00225 {
00226 include_once "./Services/Utilities/classes/class.ilUtil.php";
00227 $path = $this->tree->getPathFull($this->object->getRefID());
00228 ilUtil::redirect($this->getReturnLocation("cancel","./repository.php?cmd=frameset&ref_id=" . $path[count($path) - 2]["child"]));
00229 }
00230
00231 function backToCourseObject()
00232 {
00233 include_once "./Services/Utilities/classes/class.ilUtil.php";
00234 ilUtil::redirect($this->getReturnLocation("cancel","./repository.php?ref_id=".(int) $_GET['crs_show_result']));
00235 }
00236
00237
00238
00239
00240 function exportObject()
00241 {
00242 global $tree;
00243 global $ilAccess;
00244 if (!$ilAccess->checkAccess("write", "", $this->ref_id))
00245 {
00246
00247 ilUtil::sendInfo($this->lng->txt("cannot_edit_test"), true);
00248 $this->ctrl->redirect($this, "infoScreen");
00249 }
00250
00251
00252 $this->tpl->addBlockfile("BUTTONS", "buttons", "tpl.buttons.html");
00253
00254 if ($this->object->isRandomTest())
00255 {
00256 ilUtil::sendInfo($this->lng->txt("tst_no_export_randomtest"));
00257 }
00258 else
00259 {
00260
00261 $this->tpl->setCurrentBlock("btn_cell");
00262 $this->tpl->setVariable("BTN_LINK", $this->ctrl->getLinkTarget($this, "createExportFile")."&mode=xml");
00263 $this->tpl->setVariable("BTN_TXT", $this->lng->txt("ass_create_export_file"));
00264 $this->tpl->parseCurrentBlock();
00265 }
00266
00267
00268 $this->tpl->setCurrentBlock("btn_cell");
00269 $this->tpl->setVariable("BTN_LINK", $this->ctrl->getLinkTarget($this, "createExportfile")."&mode=results");
00270 $this->tpl->setVariable("BTN_TXT", $this->lng->txt("ass_create_export_test_results"));
00271 $this->tpl->parseCurrentBlock();
00272
00273 $export_dir = $this->object->getExportDirectory();
00274
00275 $export_files = $this->object->getExportFiles($export_dir);
00276
00277
00278 include_once("./Services/Table/classes/class.ilTableGUI.php");
00279 $tbl = new ilTableGUI();
00280
00281
00282 $this->tpl->addBlockfile("ADM_CONTENT", "adm_content", "tpl.table.html");
00283
00284
00285 $this->tpl->addBlockfile("TBL_CONTENT", "tbl_content", "tpl.export_file_row.html", "Modules/Test");
00286
00287 $num = 0;
00288
00289 $this->tpl->setVariable("FORMACTION", $this->ctrl->getFormAction($this));
00290
00291 $tbl->setTitle($this->lng->txt("ass_export_files"));
00292
00293 $tbl->setHeaderNames(array("", $this->lng->txt("ass_file"),
00294 $this->lng->txt("ass_size"), $this->lng->txt("date") ));
00295
00296 $tbl->enabled["sort"] = false;
00297 $tbl->setColumnWidth(array("1%", "49%", "25%", "25%"));
00298
00299
00300 $tbl->setOrderColumn($_GET["sort_by"]);
00301 $tbl->setOrderDirection($_GET["sort_order"]);
00302 $tbl->setLimit($_GET["limit"]);
00303 $tbl->setOffset($_GET["offset"]);
00304 $tbl->setMaxCount($this->maxcount);
00305 $header_params = $this->ctrl->getParameterArray($this, "export");
00306 $tbl->setHeaderVars(array("", "file", "size", "date"), $header_params);
00307
00308
00309
00310 $tbl->setFooter("tblfooter",$this->lng->txt("previous"),$this->lng->txt("next"));
00311
00312
00313 $tbl->setMaxCount(count($export_files));
00314 $export_files = array_slice($export_files, $_GET["offset"], $_GET["limit"]);
00315
00316 $tbl->render();
00317 if(count($export_files) > 0)
00318 {
00319 $this->tpl->setVariable("COLUMN_COUNTS", 4);
00320
00321 $i=0;
00322 foreach($export_files as $exp_file)
00323 {
00324 $this->tpl->setCurrentBlock("tbl_content");
00325 $this->tpl->setVariable("TXT_FILENAME", $exp_file);
00326
00327 $css_row = ilUtil::switchColor($i++, "tblrow1", "tblrow2");
00328 $this->tpl->setVariable("CSS_ROW", $css_row);
00329
00330 $this->tpl->setVariable("TXT_SIZE", filesize($export_dir."/".$exp_file));
00331 $this->tpl->setVariable("CHECKBOX_ID", $exp_file);
00332
00333 $file_arr = explode("__", $exp_file);
00334 $this->tpl->setVariable("TXT_DATE", date("Y-m-d H:i:s",$file_arr[0]));
00335
00336 $this->tpl->parseCurrentBlock();
00337 }
00338 $this->tpl->setCurrentBlock("selectall");
00339 $this->tpl->setVariable("SELECT_ALL", $this->lng->txt("select_all"));
00340 $this->tpl->setVariable("CSS_ROW", $css_row);
00341 $this->tpl->parseCurrentBlock();
00342
00343 $this->tpl->setVariable("IMG_ARROW", ilUtil::getImagePath("arrow_downright.gif"));
00344 $this->tpl->setCurrentBlock("tbl_action_btn");
00345 $this->tpl->setVariable("BTN_NAME", "confirmDeleteExportFile");
00346 $this->tpl->setVariable("BTN_VALUE", $this->lng->txt("delete"));
00347 $this->tpl->parseCurrentBlock();
00348
00349 $this->tpl->setCurrentBlock("tbl_action_btn");
00350 $this->tpl->setVariable("BTN_NAME", "downloadExportFile");
00351 $this->tpl->setVariable("BTN_VALUE", $this->lng->txt("download"));
00352 $this->tpl->parseCurrentBlock();
00353 }
00354 else
00355 {
00356 $this->tpl->setCurrentBlock("notfound");
00357 $this->tpl->setVariable("TXT_OBJECT_NOT_FOUND", $this->lng->txt("obj_not_found"));
00358 $this->tpl->setVariable("NUM_COLS", 3);
00359 $this->tpl->parseCurrentBlock();
00360 }
00361
00362 $this->tpl->parseCurrentBlock();
00363 }
00364
00365
00369 function createExportFileObject()
00370 {
00371 global $ilAccess;
00372
00373 if ($ilAccess->checkAccess("write", "", $this->ref_id))
00374 {
00375 include_once("./Modules/Test/classes/class.ilTestExport.php");
00376 $test_exp = new ilTestExport($this->object, $_GET["mode"]);
00377 $test_exp->buildExportFile();
00378 }
00379 else
00380 {
00381 ilUtil::sendInfo("cannot_export_test", TRUE);
00382 }
00383 $this->ctrl->redirect($this, "export");
00384 }
00385
00386
00390 function downloadExportFileObject()
00391 {
00392 if(!isset($_POST["file"]))
00393 {
00394 ilUtil::sendInfo($this->lng->txt("no_checkbox"), true);
00395 $this->ctrl->redirect($this, "export");
00396 }
00397
00398 if (count($_POST["file"]) > 1)
00399 {
00400 ilUtil::sendInfo($this->lng->txt("select_max_one_item"), true);
00401 $this->ctrl->redirect($this, "export");
00402 }
00403
00404
00405 $export_dir = $this->object->getExportDirectory();
00406 ilUtil::deliverFile($export_dir."/".$_POST["file"][0],
00407 $_POST["file"][0]);
00408 }
00409
00413 function confirmDeleteExportFileObject()
00414 {
00415 if(!isset($_POST["file"]))
00416 {
00417 ilUtil::sendInfo($this->lng->txt("no_checkbox"), true);
00418 $this->ctrl->redirect($this, "export");
00419 }
00420
00421
00422 $_SESSION["ilExportFiles"] = $_POST["file"];
00423
00424 $this->tpl->addBlockFile("ADM_CONTENT", "adm_content", "tpl.confirm_deletion.html", "Modules/Test");
00425
00426 ilUtil::sendInfo($this->lng->txt("info_delete_sure"));
00427
00428 $this->tpl->setVariable("FORMACTION", $this->ctrl->getFormAction($this));
00429
00430
00431 $this->tpl->setCurrentBlock("table_header");
00432 $this->tpl->setVariable("TEXT",$this->lng->txt("objects"));
00433 $this->tpl->parseCurrentBlock();
00434
00435
00436 $counter = 0;
00437 foreach($_POST["file"] as $file)
00438 {
00439 $this->tpl->setCurrentBlock("table_row");
00440 $this->tpl->setVariable("CSS_ROW",ilUtil::switchColor(++$counter,"tblrow1","tblrow2"));
00441 $this->tpl->setVariable("TEXT_CONTENT", $file);
00442 $this->tpl->parseCurrentBlock();
00443 }
00444
00445
00446 $this->tpl->setVariable("IMG_ARROW",ilUtil::getImagePath("arrow_downright.gif"));
00447 $buttons = array( "cancelDeleteExportFile" => $this->lng->txt("cancel"),
00448 "deleteExportFile" => $this->lng->txt("confirm"));
00449 foreach ($buttons as $name => $value)
00450 {
00451 $this->tpl->setCurrentBlock("operation_btn");
00452 $this->tpl->setVariable("BTN_NAME",$name);
00453 $this->tpl->setVariable("BTN_VALUE",$value);
00454 $this->tpl->parseCurrentBlock();
00455 }
00456 }
00457
00463 function cancelObject($in_rep = false)
00464 {
00465 ilUtil::sendInfo($this->lng->txt("msg_cancel"),true);
00466 ilUtil::redirect("repository.php?cmd=frameset&ref_id=".$_GET["ref_id"]);
00467 }
00468
00472 function cancelDeleteExportFileObject()
00473 {
00474 session_unregister("ilExportFiles");
00475 $this->ctrl->redirect($this, "export");
00476 }
00477
00478
00482 function deleteExportFileObject()
00483 {
00484 $export_dir = $this->object->getExportDirectory();
00485 foreach($_SESSION["ilExportFiles"] as $file)
00486 {
00487 $exp_file = $export_dir."/".$file;
00488 $exp_dir = $export_dir."/".substr($file, 0, strlen($file) - 4);
00489 if (@is_file($exp_file))
00490 {
00491 unlink($exp_file);
00492 }
00493 if (@is_dir($exp_dir))
00494 {
00495 ilUtil::delDir($exp_dir);
00496 }
00497 }
00498 $this->ctrl->redirect($this, "export");
00499 }
00500
00506 function importObject()
00507 {
00508 $this->getTemplateFile("import", "tst");
00509 $this->tpl->setCurrentBlock("option_qpl");
00510 include_once("./Modules/Test/classes/class.ilObjTest.php");
00511 $tst = new ilObjTest();
00512 $questionpools =& $tst->getAvailableQuestionpools(TRUE, FALSE, FALSE, TRUE);
00513 if (count($questionpools) == 0)
00514 {
00515 }
00516 else
00517 {
00518 foreach ($questionpools as $key => $value)
00519 {
00520 $this->tpl->setCurrentBlock("option_qpl");
00521 $this->tpl->setVariable("OPTION_VALUE", $key);
00522 $this->tpl->setVariable("TXT_OPTION", $value["title"]);
00523 $this->tpl->parseCurrentBlock();
00524 }
00525 }
00526 $this->tpl->setVariable("TXT_SELECT_QUESTIONPOOL", $this->lng->txt("select_questionpool"));
00527 $this->tpl->setVariable("OPTION_SELECT_QUESTIONPOOL", $this->lng->txt("select_questionpool_option"));
00528 $this->tpl->setVariable("FORMACTION", $this->ctrl->getFormAction($this));
00529 $this->tpl->setVariable("BTN_NAME", "uploadTst");
00530 $this->tpl->setVariable("TXT_UPLOAD", $this->lng->txt("upload"));
00531 $this->tpl->setVariable("NEW_TYPE", $this->type);
00532 $this->tpl->setVariable("TXT_IMPORT_TST", $this->lng->txt("import_tst"));
00533 $this->tpl->setVariable("TXT_SELECT_MODE", $this->lng->txt("select_mode"));
00534 $this->tpl->setVariable("TXT_SELECT_FILE", $this->lng->txt("select_file"));
00535
00536 }
00537
00541 function uploadTstObject()
00542 {
00543 if ($_POST["qpl"] < 1)
00544 {
00545 ilUtil::sendInfo($this->lng->txt("tst_select_questionpools"));
00546 $this->importObject();
00547 return;
00548 }
00549
00550 if ($_FILES["xmldoc"]["error"] > UPLOAD_ERR_OK)
00551 {
00552 ilUtil::sendInfo($this->lng->txt("error_upload"));
00553 $this->importObject();
00554 return;
00555 }
00556 include_once("./Modules/Test/classes/class.ilObjTest.php");
00557
00558 ilObjTest::_createImportDirectory();
00559
00560
00561 $file = pathinfo($_FILES["xmldoc"]["name"]);
00562 $full_path = ilObjTest::_getImportDirectory()."/".$_FILES["xmldoc"]["name"];
00563 ilUtil::moveUploadedFile($_FILES["xmldoc"]["tmp_name"], $_FILES["xmldoc"]["name"], $full_path);
00564
00565
00566 ilUtil::unzip($full_path);
00567
00568
00569 $subdir = basename($file["basename"],".".$file["extension"]);
00570 $xml_file = ilObjTest::_getImportDirectory()."/".$subdir."/".$subdir.".xml";
00571 $qti_file = ilObjTest::_getImportDirectory()."/".$subdir."/". str_replace("test", "qti", $subdir).".xml";
00572
00573 include_once "./Services/QTI/classes/class.ilQTIParser.php";
00574 $qtiParser = new ilQTIParser($qti_file, IL_MO_VERIFY_QTI, 0, "");
00575 $result = $qtiParser->startParsing();
00576 $founditems =& $qtiParser->getFoundItems();
00577
00578 if (count($founditems) == 0)
00579 {
00580
00581
00582
00583 ilUtil::delDir(ilObjTest::_getImportDirectory());
00584
00585 ilUtil::sendInfo($this->lng->txt("tst_import_no_items"));
00586 $this->importObject();
00587 return;
00588 }
00589
00590 $complete = 0;
00591 $incomplete = 0;
00592 foreach ($founditems as $item)
00593 {
00594 if (strlen($item["type"]))
00595 {
00596 $complete++;
00597 }
00598 else
00599 {
00600 $incomplete++;
00601 }
00602 }
00603
00604 if ($complete == 0)
00605 {
00606
00607 ilUtil::delDir(ilObjTest::_getImportDirectory());
00608
00609 ilUtil::sendInfo($this->lng->txt("qpl_import_non_ilias_files"));
00610 $this->importObject();
00611 return;
00612 }
00613
00614 $_SESSION["tst_import_xml_file"] = $xml_file;
00615 $_SESSION["tst_import_qti_file"] = $qti_file;
00616 $_SESSION["tst_import_subdir"] = $subdir;
00617
00618 $this->tpl->addBlockFile("ADM_CONTENT", "adm_content", "tpl.tst_import_verification.html");
00619 $row_class = array("tblrow1", "tblrow2");
00620 $counter = 0;
00621 foreach ($founditems as $item)
00622 {
00623 $this->tpl->setCurrentBlock("verification_row");
00624 $this->tpl->setVariable("ROW_CLASS", $row_class[$counter++ % 2]);
00625 $this->tpl->setVariable("QUESTION_TITLE", $item["title"]);
00626 $this->tpl->setVariable("QUESTION_IDENT", $item["ident"]);
00627 include_once "./Services/QTI/classes/class.ilQTIItem.php";
00628 switch ($item["type"])
00629 {
00630 case "MULTIPLE CHOICE QUESTION":
00631 case QT_MULTIPLE_CHOICE_MR:
00632 $this->tpl->setVariable("QUESTION_TYPE", $this->lng->txt("qt_multiple_choice"));
00633 break;
00634 case "SINGLE CHOICE QUESTION":
00635 case QT_MULTIPLE_CHOICE_SR:
00636 $this->tpl->setVariable("QUESTION_TYPE", $this->lng->txt("assSingleChoice"));
00637 break;
00638 case "NUMERIC QUESTION":
00639 case QT_NUMERIC:
00640 $this->tpl->setVariable("QUESTION_TYPE", $this->lng->txt("assNumeric"));
00641 break;
00642 case "TEXTSUBSET QUESTION":
00643 case QT_TEXTSUBSET:
00644 $this->tpl->setVariable("QUESTION_TYPE", $this->lng->txt("assTextSubset"));
00645 break;
00646 case "CLOZE QUESTION":
00647 case QT_CLOZE:
00648 $this->tpl->setVariable("QUESTION_TYPE", $this->lng->txt("assClozeTest"));
00649 break;
00650 case "IMAGE MAP QUESTION":
00651 case QT_IMAGEMAP:
00652 $this->tpl->setVariable("QUESTION_TYPE", $this->lng->txt("assImagemapQuestion"));
00653 break;
00654 case "JAVA APPLET QUESTION":
00655 case QT_JAVAAPPLET:
00656 $this->tpl->setVariable("QUESTION_TYPE", $this->lng->txt("assJavaApplet"));
00657 break;
00658 case "MATCHING QUESTION":
00659 case QT_MATCHING:
00660 $this->tpl->setVariable("QUESTION_TYPE", $this->lng->txt("assMatchingQuestion"));
00661 break;
00662 case "ORDERING QUESTION":
00663 case QT_ORDERING:
00664 $this->tpl->setVariable("QUESTION_TYPE", $this->lng->txt("assOrderingQuestion"));
00665 break;
00666 case "TEXT QUESTION":
00667 case QT_TEXT:
00668 $this->tpl->setVariable("QUESTION_TYPE", $this->lng->txt("assTextQuestion"));
00669 break;
00670 }
00671 $this->tpl->parseCurrentBlock();
00672 }
00673 $this->tpl->setCurrentBlock("adm_content");
00674 $this->tpl->setVariable("TEXT_TYPE", $this->lng->txt("question_type"));
00675 $this->tpl->setVariable("TEXT_TITLE", $this->lng->txt("question_title"));
00676 $this->tpl->setVariable("FOUND_QUESTIONS_INTRODUCTION", $this->lng->txt("tst_import_verify_found_questions"));
00677 $this->tpl->setVariable("VERIFICATION_HEADING", $this->lng->txt("import_tst"));
00678 $this->tpl->setVariable("FORMACTION", $this->ctrl->getFormAction($this));
00679 $this->tpl->setVariable("ARROW", ilUtil::getImagePath("arrow_downright.gif"));
00680 $this->tpl->setVariable("QUESTIONPOOL_ID", $_POST["qpl"]);
00681 $this->tpl->setVariable("VALUE_IMPORT", $this->lng->txt("import"));
00682 $this->tpl->setVariable("VALUE_CANCEL", $this->lng->txt("cancel"));
00683 $this->tpl->parseCurrentBlock();
00684 }
00685
00689 function importVerifiedFileObject()
00690 {
00691 include_once "./Modules/Test/classes/class.ilObjTest.php";
00692
00693 $newObj = new ilObjTest(0, true);
00694
00695 $newObj->setType($_GET["new_type"]);
00696
00697 $newObj->setTitle("dummy");
00698
00699 $newObj->setDescription("test import");
00700
00701 $newObj->create(true);
00702
00703 $newObj->createReference();
00704
00705 $newObj->putInTree($_GET["ref_id"]);
00706
00707 $newObj->setPermissions($_GET["ref_id"]);
00708
00709 $newObj->notify("new",$_GET["ref_id"],$_GET["parent_non_rbac_id"],$_GET["ref_id"],$newObj->getRefId());
00710
00711 $newObj->mark_schema->flush();
00712
00713
00714 include_once "./Services/QTI/classes/class.ilQTIParser.php";
00715 $qtiParser = new ilQTIParser($_SESSION["tst_import_qti_file"], IL_MO_PARSE_QTI, $_POST["qpl_id"], $_POST["ident"]);
00716 $qtiParser->setTestObject($newObj);
00717 $result = $qtiParser->startParsing();
00718 $newObj->saveToDb();
00719
00720
00721
00722
00723 include_once ("./Modules/LearningModule/classes/class.ilContObjParser.php");
00724 $contParser = new ilContObjParser($newObj, $_SESSION["tst_import_xml_file"], $_SESSION["tst_import_subdir"]);
00725 $contParser->setQuestionMapping($qtiParser->getImportMapping());
00726 $contParser->startParsing();
00727
00728
00729 ilUtil::delDir(ilObjTest::_getImportDirectory());
00730 ilUtil::sendInfo($this->lng->txt("object_imported"),true);
00731 ilUtil::redirect("ilias.php?ref_id=".$newObj->getRefId().
00732 "&baseClass=ilObjTestGUI");
00733 }
00734
00735 function cancelImportObject()
00736 {
00737 $this->ctrl->redirect($this, "cancel");
00738
00739 }
00740
00741
00748 function uploadObject($redirect = true)
00749 {
00750 $this->uploadTstObject();
00751 }
00752
00762 function confirmChangeProperties($direction = 0)
00763 {
00764 $this->tpl->addBlockFile("ADM_CONTENT", "adm_content", "tpl.il_as_tst_properties_save_confirmation.html", "Modules/Test");
00765 $information = "";
00766 switch ($direction)
00767 {
00768 case 0:
00769 $information = $this->lng->txt("change_properties_from_random_to_standard");
00770 break;
00771 default:
00772 $information = $this->lng->txt("change_properties_from_standard_to_random");
00773 break;
00774 }
00775 foreach ($_POST as $key => $value)
00776 {
00777 if (strcmp($key, "cmd") != 0)
00778 {
00779 if (is_array($value))
00780 {
00781 foreach ($value as $k => $v)
00782 {
00783 $this->tpl->setCurrentBlock("hidden_variable");
00784 $this->tpl->setVariable("HIDDEN_KEY", $key . "[" . $k . "]");
00785 $this->tpl->setVariable("HIDDEN_VALUE", $v);
00786 $this->tpl->parseCurrentBlock();
00787 }
00788 }
00789 else
00790 {
00791 $this->tpl->setCurrentBlock("hidden_variable");
00792 $this->tpl->setVariable("HIDDEN_KEY", $key);
00793 $this->tpl->setVariable("HIDDEN_VALUE", $value);
00794 $this->tpl->parseCurrentBlock();
00795 }
00796 }
00797 }
00798 $this->tpl->setCurrentBlock("hidden_variable");
00799 $this->tpl->setVariable("HIDDEN_KEY", "tst_properties_confirmation");
00800 $this->tpl->setVariable("HIDDEN_VALUE", "1");
00801 $this->tpl->parseCurrentBlock();
00802 $this->tpl->setCurrentBlock("adm_content");
00803 $this->tpl->setVariable("TXT_CONFIRMATION", $this->lng->txt("confirmation"));
00804 $this->tpl->setVariable("TXT_INFORMATION", $information);
00805 $this->tpl->setVariable("FORM_ACTION", $this->ctrl->getFormAction($this));
00806 $this->tpl->setVariable("BTN_CONFIRM", $this->lng->txt("confirm"));
00807 $this->tpl->setVariable("BTN_CANCEL", $this->lng->txt("cancel"));
00808 $this->tpl->parseCurrentBlock();
00809 }
00810
00818 function savePropertiesObject()
00819 {
00820 $total = $this->object->evalTotalPersons();
00821 $randomtest_switch = false;
00822
00823 if (!$total)
00824 {
00825 if (!array_key_exists("tst_properties_confirmation", $_POST))
00826 {
00827 if (($this->object->isRandomTest()) && (count($this->object->getRandomQuestionpools()) > 0))
00828 {
00829 if (!$_POST["chb_random"])
00830 {
00831
00832 $this->confirmChangeProperties(0);
00833 return;
00834 }
00835 }
00836 if ((!$this->object->isRandomTest()) && (count($this->object->questions) > 0))
00837 {
00838 if ($_POST["chb_random"])
00839 {
00840
00841 $this->confirmChangeProperties(1);
00842 return;
00843 }
00844 }
00845 }
00846
00847 if (!strlen($_POST["chb_random"]))
00848 {
00849 $data["random_test"] = 0;
00850 }
00851 else
00852 {
00853 $data["random_test"] = ilUtil::stripSlashes($_POST["chb_random"]);
00854 }
00855 }
00856 else
00857 {
00858 $data["random_test"] = $this->object->random_test;
00859 }
00860 if ($data["random_test"] != $this->object->random_test)
00861 {
00862 $randomtest_switch = true;
00863 }
00864 $data["anonymity"] = $_POST["anonymity"];
00865 if ($total)
00866 {
00867 $data["anonymity"] = $this->object->getAnonymity();
00868 }
00869 $data["show_cancel"] = $_POST["show_cancel"];
00870 $data["password"] = $_POST["password"];
00871 $data["allowedUsers"] = $_POST["allowedUsers"];
00872 $data["show_cancel"] = $_POST["chb_show_cancel"];
00873 $data["show_marker"] = ($_POST["chb_show_marker"] ? 1 : 0);
00874 $data["allowedUsersTimeGap"] = $_POST["allowedUsersTimeGap"];
00875 include_once "./classes/class.ilObjAdvancedEditing.php";
00876 $introduction = ilUtil::stripSlashes($_POST["introduction"], false, ilObjAdvancedEditing::_getUsedHTMLTagsAsString("assessment"));
00877 $data["introduction"] = $introduction;
00878 $data["sequence_settings"] = ilUtil::stripSlashes($_POST["chb_postpone"]);
00879 $data["shuffle_questions"] = 0;
00880 if ($_POST["chb_shuffle_questions"])
00881 {
00882 $data["shuffle_questions"] = $_POST["chb_shuffle_questions"];
00883 }
00884 $data["list_of_questions"] = 0;
00885 if ($_POST["list_of_questions"] == 1)
00886 {
00887 $data["list_of_questions"] = 1;
00888 }
00889 $data["list_of_questions_start"] = 0;
00890 if ($_POST["chb_list_of_questions_start"] == 1)
00891 {
00892 $data["list_of_questions_start"] = 1;
00893 }
00894 $data["list_of_questions_end"] = 0;
00895 if ($_POST["chb_list_of_questions_end"] == 1)
00896 {
00897 $data["list_of_questions_end"] = 1;
00898 }
00899 $data["list_of_questions_with_description"] = 0;
00900 if ($_POST["chb_list_of_questions_with_description"] == 1)
00901 {
00902 $data["list_of_questions_with_description"] = 1;
00903 }
00904 $data["nr_of_tries"] = ilUtil::stripSlashes($_POST["nr_of_tries"]);
00905 $data["processing_time"] = ilUtil::stripSlashes($_POST["processing_time"]);
00906 if (!$_POST["chb_starting_time"])
00907 {
00908 $data["starting_time"] = "";
00909 }
00910 else
00911 {
00912 $data["starting_time"] = sprintf("%04d%02d%02d%02d%02d%02d",
00913 $_POST["starting_date"]["y"],
00914 $_POST["starting_date"]["m"],
00915 $_POST["starting_date"]["d"],
00916 $_POST["starting_time"]["h"],
00917 $_POST["starting_time"]["m"],
00918 0
00919 );
00920 }
00921 if (!$_POST["chb_ending_time"])
00922 {
00923 $data["ending_time"] = "";
00924 }
00925 else
00926 {
00927 $data["ending_time"] = sprintf("%04d%02d%02d%02d%02d%02d",
00928 $_POST["ending_date"]["y"],
00929 $_POST["ending_date"]["m"],
00930 $_POST["ending_date"]["d"],
00931 $_POST["ending_time"]["h"],
00932 $_POST["ending_time"]["m"],
00933 0
00934 );
00935 }
00936
00937 if ($_POST["chb_processing_time"])
00938 {
00939 $data["enable_processing_time"] = "1";
00940 }
00941 else
00942 {
00943 $data["enable_processing_time"] = "0";
00944 }
00945 $data["reset_processing_time"] = "0";
00946 if ($_POST["chb_processing_time"])
00947 {
00948 if ($_POST["chb_reset_processing_time"])
00949 {
00950 $data["reset_processing_time"] = "1";
00951 }
00952 }
00953 if ($_POST["chb_use_previous_answers"])
00954 {
00955 $data["use_previous_answers"] = "1";
00956 }
00957 else
00958 {
00959 $data["use_previous_answers"] = "0";
00960 }
00961
00962 $data["title_output"] = $_POST["title_output"];
00963
00964 if ($data["enable_processing_time"])
00965 {
00966 $data["processing_time"] = sprintf("%02d:%02d:%02d",
00967 $_POST["processing_time"]["h"],
00968 $_POST["processing_time"]["m"],
00969 $_POST["processing_time"]["s"]
00970 );
00971 }
00972 else
00973 {
00974 $proc_time = $this->object->getEstimatedWorkingTime();
00975 $data["processing_time"] = sprintf("%02d:%02d:%02d",
00976 $proc_time["h"],
00977 $proc_time["m"],
00978 $proc_time["s"]
00979 );
00980 }
00981
00982 if ($data["nr_of_tries"] == 1)
00983 {
00984 $data["pass_scoring"] = SCORE_LAST_PASS;
00985 }
00986 $this->object->setIntroduction($data["introduction"]);
00987 $this->object->setSequenceSettings($data["sequence_settings"]);
00988 $this->object->setAnonymity($data["anonymity"]);
00989 $this->object->setShowCancel($data["show_cancel"]);
00990 $this->object->setShowMarker($data["show_marker"]);
00991 $this->object->setPassword($data["password"]);
00992 $this->object->setAllowedUsers($data["allowedUsers"]);
00993 $this->object->setAllowedUsersTimeGap($data["allowedUsersTimeGap"]);
00994 $this->object->setNrOfTries($data["nr_of_tries"]);
00995 $this->object->setStartingTime($data["starting_time"]);
00996 $this->object->setEndingTime($data["ending_time"]);
00997 $this->object->setProcessingTime($data["processing_time"]);
00998 $this->object->setRandomTest($data["random_test"]);
00999 $this->object->setEnableProcessingTime($data["enable_processing_time"]);
01000 $this->object->setResetProcessingTime($data["reset_processing_time"]);
01001 $this->object->setUsePreviousAnswers($data["use_previous_answers"]);
01002 $this->object->setTitleOutput($data["title_output"]);
01003
01004 if ($this->object->isRandomTest())
01005 {
01006 $this->object->setUsePreviousAnswers(0);
01007 $this->object->setRandomTest(1);
01008 }
01009 if ($data["shuffle_questions"])
01010 {
01011 $this->object->setShuffleQuestions(TRUE);
01012 }
01013 else
01014 {
01015 $this->object->setShuffleQuestions(FALSE);
01016 }
01017 $this->object->setListOfQuestions($data["list_of_questions"]);
01018 $this->object->setListOfQuestionsStart($data["list_of_questions_start"]);
01019 $this->object->setListOfQuestionsEnd($data["list_of_questions_end"]);
01020 $this->object->setListOfQuestionsDescription($data["list_of_questions_with_description"]);
01021
01022 $this->object->saveToDb(true);
01023
01024 ilUtil::sendInfo($this->lng->txt("msg_obj_modified"));
01025 if ($randomtest_switch)
01026 {
01027 if ($this->object->isRandomTest())
01028 {
01029 $this->object->removeNonRandomTestData();
01030 }
01031 else
01032 {
01033 $this->object->removeRandomTestData();
01034 }
01035 }
01036 $this->ctrl->redirect($this, "properties");
01037 }
01038
01046 function saveScoringObject()
01047 {
01048 $total = $this->object->evalTotalPersons();
01049
01050 if (!$total)
01051 {
01052 $data["count_system"] = $_POST["count_system"];
01053 $data["mc_scoring"] = $_POST["mc_scoring"];
01054 $data["score_cutting"] = $_POST["score_cutting"];
01055 $data["pass_scoring"] = $_POST["pass_scoring"];
01056 }
01057 else
01058 {
01059 $data["count_system"] = $this->object->getCountSystem();
01060 $data["mc_scoring"] = $this->object->getMCScoring();
01061 $data["score_cutting"] = $this->object->getScoreCutting();
01062 $data["pass_scoring"] = $this->object->getPassScoring();
01063 }
01064
01065 $data["instant_feedback_solution"] = $_POST["chb_instant_feedback_solution"];
01066 $data["answer_feedback"] = ($_POST["chb_instant_feedback_answer"]) ? 1 : 0;
01067 $data["answer_feedback_points"] = ($_POST["chb_instant_feedback_results"]) ? 1 : 0;
01068
01069 $data["show_solution_printview"] = ($_POST["chb_show_solution_printview"] == 1) ? 1 : 0;
01070 $data["show_solution_feedback"] = ($_POST["chb_show_solution_feedback"] == 1) ? 1 : 0;
01071 $data["show_solution_details"] = $_POST["chb_show_solution_details"];
01072 $data["show_solution_answers_only"] = $_POST["chb_show_solution_answers_only"];
01073 $data["show_solution_signature"] = $_POST["chb_show_solution_signature"];
01074 $data["show_pass_details"] = $_POST["chb_show_pass_details"];
01075 $data["results_access"] = $_POST["results_access"];
01076
01077 $this->object->setCountSystem($data["count_system"]);
01078 $this->object->setMCScoring($data["mc_scoring"]);
01079 $this->object->setScoreCutting($data["score_cutting"]);
01080 $this->object->setPassScoring($data["pass_scoring"]);
01081 $this->object->setInstantFeedbackSolution($data["instant_feedback_solution"]);
01082 $this->object->setAnswerFeedback($data["answer_feedback"]);
01083 $this->object->setAnswerFeedbackPoints($data["answer_feedback_points"]);
01084 $this->object->setShowSolutionDetails($data["show_solution_details"]);
01085 $this->object->setShowSolutionAnswersOnly($data["show_solution_answers_only"]);
01086 $this->object->setShowSolutionSignature($data["show_solution_signature"]);
01087 $this->object->setShowPassDetails($data["show_pass_details"]);
01088 $this->object->setScoreReporting($data["results_access"]);
01089 $this->object->setShowSolutionPrintview($data["show_solution_printview"]);
01090 $this->object->setShowSolutionFeedback($data["show_solution_feedback"]);
01091 if ($data["results_access"] == REPORT_AFTER_DATE)
01092 {
01093 $data["reporting_date"] = sprintf("%04d%02d%02d%02d%02d%02d",
01094 $_POST["reporting_date"]["y"],
01095 $_POST["reporting_date"]["m"],
01096 $_POST["reporting_date"]["d"],
01097 $_POST["reporting_time"]["h"],
01098 $_POST["reporting_time"]["m"],
01099 0
01100 );
01101 $this->object->setReportingDate($data["reporting_date"]);
01102 }
01103 else
01104 {
01105 $this->object->setReportingDate("");
01106 }
01107 $this->object->saveToDb(true);
01108 ilUtil::sendInfo($this->lng->txt("msg_obj_modified"), TRUE);
01109
01110 $this->ctrl->redirect($this, "scoring");
01111 }
01112
01120 function scoringObject()
01121 {
01122 global $ilAccess;
01123 if (!$ilAccess->checkAccess("write", "", $this->ref_id))
01124 {
01125
01126 ilUtil::sendInfo($this->lng->txt("cannot_edit_test"), true);
01127 $this->ctrl->redirect($this, "infoScreen");
01128 }
01129
01130 $data["count_system"] = $this->object->getCountSystem();
01131 $data["mc_scoring"] = $this->object->getMCScoring();
01132 $data["score_cutting"] = $this->object->getScoreCutting();
01133 $data["pass_scoring"] = $this->object->getPassScoring();
01134 $data["instant_feedback_solution"] = $this->object->getInstantFeedbackSolution();
01135 $data["answer_feedback"] = $this->object->getAnswerFeedback();
01136 $data["answer_feedback_points"] = $this->object->getAnswerFeedbackPoints();
01137 $data["show_solution_printview"] = $this->object->getShowSolutionPrintview();
01138 $data["show_solution_feedback"] = $this->object->getShowSolutionFeedback();
01139 $data["show_solution_details"] = $this->object->getShowSolutionDetails();
01140 $data["show_solution_answers_only"] = $this->object->getShowSolutionAnswersOnly();
01141 $data["show_solution_signature"] = $this->object->getShowSolutionSignature();
01142 $data["show_pass_details"] = $this->object->getShowPassDetails();
01143 $data["results_access"] = $this->object->getScoreReporting();
01144
01145 $total = $this->object->evalTotalPersons();
01146
01147 $this->tpl->addBlockFile("ADM_CONTENT", "adm_content", "tpl.il_as_tst_scoring.html", "Modules/Test");
01148
01149 $this->lng->loadLanguageModule("jscalendar");
01150 $this->tpl->addBlockFile("CALENDAR_LANG_JAVASCRIPT", "calendar_javascript", "tpl.calendar.html");
01151 $this->tpl->setCurrentBlock("calendar_javascript");
01152 $this->tpl->setVariable("FULL_SUNDAY", $this->lng->txt("l_su"));
01153 $this->tpl->setVariable("FULL_MONDAY", $this->lng->txt("l_mo"));
01154 $this->tpl->setVariable("FULL_TUESDAY", $this->lng->txt("l_tu"));
01155 $this->tpl->setVariable("FULL_WEDNESDAY", $this->lng->txt("l_we"));
01156 $this->tpl->setVariable("FULL_THURSDAY", $this->lng->txt("l_th"));
01157 $this->tpl->setVariable("FULL_FRIDAY", $this->lng->txt("l_fr"));
01158 $this->tpl->setVariable("FULL_SATURDAY", $this->lng->txt("l_sa"));
01159 $this->tpl->setVariable("SHORT_SUNDAY", $this->lng->txt("s_su"));
01160 $this->tpl->setVariable("SHORT_MONDAY", $this->lng->txt("s_mo"));
01161 $this->tpl->setVariable("SHORT_TUESDAY", $this->lng->txt("s_tu"));
01162 $this->tpl->setVariable("SHORT_WEDNESDAY", $this->lng->txt("s_we"));
01163 $this->tpl->setVariable("SHORT_THURSDAY", $this->lng->txt("s_th"));
01164 $this->tpl->setVariable("SHORT_FRIDAY", $this->lng->txt("s_fr"));
01165 $this->tpl->setVariable("SHORT_SATURDAY", $this->lng->txt("s_sa"));
01166 $this->tpl->setVariable("FULL_JANUARY", $this->lng->txt("l_01"));
01167 $this->tpl->setVariable("FULL_FEBRUARY", $this->lng->txt("l_02"));
01168 $this->tpl->setVariable("FULL_MARCH", $this->lng->txt("l_03"));
01169 $this->tpl->setVariable("FULL_APRIL", $this->lng->txt("l_04"));
01170 $this->tpl->setVariable("FULL_MAY", $this->lng->txt("l_05"));
01171 $this->tpl->setVariable("FULL_JUNE", $this->lng->txt("l_06"));
01172 $this->tpl->setVariable("FULL_JULY", $this->lng->txt("l_07"));
01173 $this->tpl->setVariable("FULL_AUGUST", $this->lng->txt("l_08"));
01174 $this->tpl->setVariable("FULL_SEPTEMBER", $this->lng->txt("l_09"));
01175 $this->tpl->setVariable("FULL_OCTOBER", $this->lng->txt("l_10"));
01176 $this->tpl->setVariable("FULL_NOVEMBER", $this->lng->txt("l_11"));
01177 $this->tpl->setVariable("FULL_DECEMBER", $this->lng->txt("l_12"));
01178 $this->tpl->setVariable("SHORT_JANUARY", $this->lng->txt("s_01"));
01179 $this->tpl->setVariable("SHORT_FEBRUARY", $this->lng->txt("s_02"));
01180 $this->tpl->setVariable("SHORT_MARCH", $this->lng->txt("s_03"));
01181 $this->tpl->setVariable("SHORT_APRIL", $this->lng->txt("s_04"));
01182 $this->tpl->setVariable("SHORT_MAY", $this->lng->txt("s_05"));
01183 $this->tpl->setVariable("SHORT_JUNE", $this->lng->txt("s_06"));
01184 $this->tpl->setVariable("SHORT_JULY", $this->lng->txt("s_07"));
01185 $this->tpl->setVariable("SHORT_AUGUST", $this->lng->txt("s_08"));
01186 $this->tpl->setVariable("SHORT_SEPTEMBER", $this->lng->txt("s_09"));
01187 $this->tpl->setVariable("SHORT_OCTOBER", $this->lng->txt("s_10"));
01188 $this->tpl->setVariable("SHORT_NOVEMBER", $this->lng->txt("s_11"));
01189 $this->tpl->setVariable("SHORT_DECEMBER", $this->lng->txt("s_12"));
01190 $this->tpl->setVariable("ABOUT_CALENDAR", $this->lng->txt("about_calendar"));
01191 $this->tpl->setVariable("ABOUT_CALENDAR_LONG", $this->lng->txt("about_calendar_long"));
01192 $this->tpl->setVariable("ABOUT_TIME_LONG", $this->lng->txt("about_time"));
01193 $this->tpl->setVariable("PREV_YEAR", $this->lng->txt("prev_year"));
01194 $this->tpl->setVariable("PREV_MONTH", $this->lng->txt("prev_month"));
01195 $this->tpl->setVariable("GO_TODAY", $this->lng->txt("go_today"));
01196 $this->tpl->setVariable("NEXT_MONTH", $this->lng->txt("next_month"));
01197 $this->tpl->setVariable("NEXT_YEAR", $this->lng->txt("next_year"));
01198 $this->tpl->setVariable("SEL_DATE", $this->lng->txt("select_date"));
01199 $this->tpl->setVariable("DRAG_TO_MOVE", $this->lng->txt("drag_to_move"));
01200 $this->tpl->setVariable("PART_TODAY", $this->lng->txt("part_today"));
01201 $this->tpl->setVariable("DAY_FIRST", $this->lng->txt("day_first"));
01202 $this->tpl->setVariable("CLOSE", $this->lng->txt("close"));
01203 $this->tpl->setVariable("TODAY", $this->lng->txt("today"));
01204 $this->tpl->setVariable("TIME_PART", $this->lng->txt("time_part"));
01205 $this->tpl->setVariable("DEF_DATE_FORMAT", $this->lng->txt("def_date_format"));
01206 $this->tpl->setVariable("TT_DATE_FORMAT", $this->lng->txt("tt_date_format"));
01207 $this->tpl->setVariable("WK", $this->lng->txt("wk"));
01208 $this->tpl->setVariable("TIME", $this->lng->txt("time"));
01209 $this->tpl->parseCurrentBlock();
01210 $this->tpl->setCurrentBlock("CalendarJS");
01211 $this->tpl->setVariable("LOCATION_JAVASCRIPT_CALENDAR", "./Modules/Test/js/calendar/calendar.js");
01212 $this->tpl->setVariable("LOCATION_JAVASCRIPT_CALENDAR_SETUP", "./Modules/Test/js/calendar/calendar-setup.js");
01213 $this->tpl->setVariable("LOCATION_JAVASCRIPT_CALENDAR_STYLESHEET", "./Modules/Test/js/calendar/calendar.css");
01214 $this->tpl->parseCurrentBlock();
01215 $this->tpl->setCurrentBlock("javascript_call_calendar");
01216 $this->tpl->setVariable("INPUT_FIELDS_REPORTING_DATE", "reporting_date");
01217 $this->tpl->parseCurrentBlock();
01218
01219 $this->tpl->setVariable("HEADING_SCORING_AND_RESULTS", $this->lng->txt("scoring"));
01220 $this->tpl->setVariable("DEFAULT", "(" . $this->lng->txt("default") . ")");
01221 $this->tpl->setVariable("TEXT_COUNT_SYSTEM", $this->lng->txt("tst_text_count_system"));
01222 $this->tpl->setVariable("COUNT_PARTIAL_SOLUTIONS", $this->lng->txt("tst_count_partial_solutions"));
01223 $this->tpl->setVariable("COUNT_CORRECT_SOLUTIONS", $this->lng->txt("tst_count_correct_solutions"));
01224 $this->tpl->setVariable("COUNT_SYSTEM_DESCRIPTION", $this->lng->txt("tst_count_system_description"));
01225 switch ($data["count_system"])
01226 {
01227 case COUNT_CORRECT_SOLUTIONS:
01228 $this->tpl->setVariable("CHECKED_COUNT_CORRECT_SOLUTIONS", " checked=\"checked\"");
01229 break;
01230 case COUNT_PARTIAL_SOLUTIONS:
01231 default:
01232 $this->tpl->setVariable("CHECKED_COUNT_PARTIAL_SOLUTIONS", " checked=\"checked\"");
01233 break;
01234 }
01235 if ($total)
01236 {
01237 $this->tpl->setVariable("DISABLED_COUNT_CORRECT_SOLUTIONS", " disabled=\"disabled\"");
01238 $this->tpl->setVariable("DISABLED_COUNT_PARTIAL_SOLUTIONS", " disabled=\"disabled\"");
01239 }
01240
01241 $this->tpl->setVariable("TEXT_SCORE_MCMR", $this->lng->txt("tst_score_mcmr_questions"));
01242 $this->tpl->setVariable("ZERO_POINTS_WHEN_UNANSWERED", $this->lng->txt("tst_score_mcmr_zero_points_when_unanswered"));
01243 $this->tpl->setVariable("USE_SCORING_SYSTEM", $this->lng->txt("tst_score_mcmr_use_scoring_system"));
01244 $this->tpl->setVariable("TEXT_SCORE_MCMR_DESCRIPTION", $this->lng->txt("tst_score_mcmr_questions_description"));
01245 switch ($data["mc_scoring"])
01246 {
01247 case SCORE_ZERO_POINTS_WHEN_UNANSWERED:
01248 $this->tpl->setVariable("CHECKED_ZERO_POINTS_WHEN_UNANSWERED", " checked=\"checked\"");
01249 break;
01250 case SCORE_STANDARD_SCORE_SYSTEM:
01251 default:
01252 $this->tpl->setVariable("CHECKED_USE_SCORING_SYSTEM", " checked=\"checked\"");
01253 break;
01254 }
01255 if ($total)
01256 {
01257 $this->tpl->setVariable("DISABLED_ZERO_POINTS_WHEN_UNANSWERED", " disabled=\"disabled\"");
01258 $this->tpl->setVariable("DISABLED_USE_SCORING_SYSTEM", " disabled=\"disabled\"");
01259 }
01260
01261 $this->tpl->setVariable("TEXT_SCORE_CUTTING", $this->lng->txt("tst_score_cutting"));
01262 $this->tpl->setVariable("TEXT_CUT_QUESTION", $this->lng->txt("tst_score_cut_question"));
01263 $this->tpl->setVariable("TEXT_CUT_TEST", $this->lng->txt("tst_score_cut_test"));
01264 $this->tpl->setVariable("TEXT_SCORE_CUTTING_DESCRIPTION", $this->lng->txt("tst_score_cutting_description"));
01265 switch ($data["score_cutting"])
01266 {
01267 case SCORE_CUT_QUESTION:
01268 $this->tpl->setVariable("CHECKED_CUT_QUESTION", " checked=\"checked\"");
01269 break;
01270 case SCORE_CUT_TEST:
01271 default:
01272 $this->tpl->setVariable("CHECKED_CUT_TEST", " checked=\"checked\"");
01273 break;
01274 }
01275 if ($total)
01276 {
01277 $this->tpl->setVariable("DISABLED_CUT_QUESTION", " disabled=\"disabled\"");
01278 $this->tpl->setVariable("DISABLED_CUT_TEST", " disabled=\"disabled\"");
01279 }
01280
01281 $this->tpl->setVariable("TEXT_PASS_SCORING", $this->lng->txt("tst_pass_scoring"));
01282 $this->tpl->setVariable("TEXT_LASTPASS", $this->lng->txt("tst_pass_last_pass"));
01283 $this->tpl->setVariable("TEXT_BESTPASS", $this->lng->txt("tst_pass_best_pass"));
01284 $this->tpl->setVariable("TEXT_PASS_SCORING_DESCRIPTION", $this->lng->txt("tst_pass_scoring_description"));
01285 switch ($data["pass_scoring"])
01286 {
01287 case SCORE_BEST_PASS:
01288 $this->tpl->setVariable("CHECKED_BESTPASS", " checked=\"checked\"");
01289 break;
01290 case SCORE_LAST_PASS:
01291 default:
01292 $this->tpl->setVariable("CHECKED_LASTPASS", " checked=\"checked\"");
01293 break;
01294 }
01295 if ($total)
01296 {
01297 $this->tpl->setVariable("DISABLED_BESTPASS", " disabled=\"disabled\"");
01298 $this->tpl->setVariable("DISABLED_LASTPASS", " disabled=\"disabled\"");
01299 }
01300
01301 $this->tpl->setVariable("TEXT_INSTANT_FEEDBACK", $this->lng->txt("tst_instant_feedback"));
01302 $this->tpl->setVariable("TEXT_ANSWER_SPECIFIC_FEEDBACK", $this->lng->txt("tst_instant_feedback_answer_specific"));
01303 $this->tpl->setVariable("TEXT_SHOW_RESULTS", $this->lng->txt("tst_instant_feedback_results"));
01304 if ($data["answer_feedback_points"])
01305 {
01306 $this->tpl->setVariable("CHECKED_SHOW_RESULTS", " checked=\"checked\"");
01307 }
01308 $this->tpl->setVariable("TEXT_SHOW_SOLUTION", $this->lng->txt("tst_instant_feedback_solution"));
01309 $this->tpl->setVariable("TEXT_INSTANT_FEEDBACK_DESCRIPTION", $this->lng->txt("tst_instant_feedback_description"));
01310 if ($data["instant_feedback_solution"])
01311 {
01312 $this->tpl->setVariable("CHECKED_SHOW_SOLUTION", " checked=\"checked\"");
01313 }
01314 if ($data["answer_feedback"])
01315 {
01316 $this->tpl->setVariable("CHECKED_ANSWER_SPECIFIC_FEEDBACK", " checked=\"checked\"");
01317 }
01318 $this->tpl->setVariable("TEXT_RESULTS_PRESENTATION", $this->lng->txt("tst_results_presentation"));
01319 $this->tpl->setVariable("TEXT_SHOW_PASS_DETAILS", $this->lng->txt("tst_show_pass_details"));
01320 if ($data["show_pass_details"])
01321 {
01322 $this->tpl->setVariable("CHECKED_SHOW_PASS_DETAILS", " checked=\"checked\"");
01323 }
01324 $this->tpl->setVariable("TEXT_SHOW_SOLUTION_DETAILS", $this->lng->txt("tst_show_solution_details"));
01325 if ($data["show_solution_details"])
01326 {
01327 $this->tpl->setVariable("CHECKED_SHOW_SOLUTION_DETAILS", " checked=\"checked\"");
01328 }
01329 $this->tpl->setVariable("TEXT_SHOW_SOLUTION_ANSWERS_ONLY", $this->lng->txt("tst_show_solution_answers_only"));
01330 if ($data["show_solution_answers_only"])
01331 {
01332 $this->tpl->setVariable("CHECKED_SHOW_SOLUTION_ANSWERS_ONLY", " checked=\"checked\"");
01333 }
01334 $this->tpl->setVariable("TEXT_SHOW_SOLUTION_SIGNATURE", $this->lng->txt("tst_show_solution_signature"));
01335 if ($this->object->getAnonymity())
01336 {
01337 $this->tpl->setVariable("DISABLED_SHOW_SOLUTION_SIGNATURE", " disabled=\"disabled\"");
01338 }
01339 else
01340 {
01341 if ($data["show_solution_signature"])
01342 {
01343 $this->tpl->setVariable("CHECKED_SHOW_SOLUTION_SIGNATURE", " checked=\"checked\"");
01344 }
01345 }
01346
01347 $this->tpl->setVariable("TEXT_SHOW_SOLUTION_FEEDBACK", $this->lng->txt("tst_show_solution_feedback"));
01348 if ($data["show_solution_feedback"])
01349 {
01350 $this->tpl->setVariable("CHECKED_SHOW_SOLUTION_FEEDBACK", " checked=\"checked\"");
01351 }
01352
01353 $this->tpl->setVariable("TEXT_SHOW_SOLUTION_PRINTVIEW", $this->lng->txt("tst_show_solution_printview"));
01354 $this->tpl->setVariable("TEXT_RESULTS_PRESENTATION_DESCRIPTION", $this->lng->txt("tst_results_presentation_description"));
01355 if ($data["show_solution_printview"])
01356 {
01357 $this->tpl->setVariable("CHECKED_SHOW_SOLUTION_PRINTVIEW", " checked=\"checked\"");
01358 }
01359
01360 $this->tpl->setVariable("TEXT_RESULTS_ACCESS", $this->lng->txt("tst_results_access"));
01361 $this->tpl->setVariable("TEXT_RESULTS_FINISHED", $this->lng->txt("tst_results_access_finished"));
01362 $this->tpl->setVariable("TEXT_RESULTS_DATE", $this->lng->txt("tst_results_access_date"));
01363 if ($data["results_access"] != REPORT_AFTER_DATE)
01364 {
01365 $report = getdate(time()+60*60*24*7);
01366 $date_input = ilUtil::makeDateSelect("reporting_date", $report["year"], $report["mon"], $report["mday"]);
01367 $time_input = ilUtil::makeTimeSelect("reporting_time", true, "12", "0", "0");
01368 } else {
01369 preg_match("/(\d{4})(\d{2})(\d{2})(\d{2})(\d{2})(\d{2})/", $this->object->getReportingDate(), $matches);
01370 $date_input = ilUtil::makeDateSelect("reporting_date", $matches[1], sprintf("%d", $matches[2]), sprintf("%d", $matches[3]));
01371 $time_input = ilUtil::makeTimeSelect("reporting_time", true, sprintf("%d", $matches[4]), sprintf("%d", $matches[5]), sprintf("%d", $matches[6]));
01372 }
01373 switch ($data["results_access"])
01374 {
01375 case REPORT_ALWAYS:
01376 $this->tpl->setVariable("CHECKED_RESULTS_ALWAYS", " checked=\"checked\"");
01377 break;
01378 case REPORT_AFTER_DATE:
01379 $this->tpl->setVariable("CHECKED_RESULTS_DATE", " checked=\"checked\"");
01380 break;
01381 case REPORT_AFTER_TEST:
01382 default:
01383 $this->tpl->setVariable("CHECKED_RESULTS_FINISHED", " checked=\"checked\"");
01384 break;
01385 }
01386 $this->tpl->setVariable("INPUT_REPORTING_DATE", $this->lng->txt("date") . ": " . $date_input . $this->lng->txt("time") . ": " . $time_input);
01387 $this->tpl->setVariable("IMG_REPORTING_DATE_CALENDAR", ilUtil::getImagePath("calendar.png"));
01388 $this->tpl->setVariable("TXT_REPORTING_DATE_CALENDAR", $this->lng->txt("open_calendar"));
01389 $this->tpl->setVariable("TEXT_RESULTS_ALWAYS", $this->lng->txt("tst_results_access_always"));
01390 $this->tpl->setVariable("TEXT_RESULTS_ACCESS_DESCRIPTION", $this->lng->txt("tst_results_access_description"));
01391
01392 $this->tpl->setVariable("FORMACTION", $this->ctrl->getFormAction($this));
01393 if ($ilAccess->checkAccess("write", "", $this->ref_id))
01394 {
01395 $this->tpl->setVariable("SAVE", $this->lng->txt("save"));
01396 }
01397
01398 $this->tpl->parseCurrentBlock();
01399 }
01400
01408 function propertiesObject()
01409 {
01410 global $ilAccess;
01411 if (!$ilAccess->checkAccess("write", "", $this->ref_id))
01412 {
01413
01414 ilUtil::sendInfo($this->lng->txt("cannot_edit_test"), true);
01415 $this->ctrl->redirect($this, "infoScreen");
01416 }
01417
01418 if (strlen($this->ctrl->getCmdClass()) == 0) $this->ctrl->setCmdClass("ilobjtestgui");
01419 include_once "./Services/RTE/classes/class.ilRTE.php";
01420 $rtestring = ilRTE::_getRTEClassname();
01421 include_once "./Services/RTE/classes/class.$rtestring.php";
01422 $rte = new $rtestring();
01423 include_once "./classes/class.ilObject.php";
01424 $obj_id = ilObject::_lookupObjectId($_GET["ref_id"]);
01425 $obj_type = ilObject::_lookupType($_GET["ref_id"], TRUE);
01426 $rte->addRTESupport($obj_id, $obj_type, "assessment");
01427
01428 $this->tpl->addBlockFile("ADM_CONTENT", "adm_content", "tpl.il_as_tst_properties.html", "Modules/Test");
01429 $total = $this->object->evalTotalPersons();
01430 if ($total == 0)
01431 {
01432 $this->tpl->setCurrentBlock("change_button");
01433 $this->tpl->setVariable("BTN_CHANGE", $this->lng->txt("change"));
01434 $this->tpl->parseCurrentBlock();
01435 }
01436 $this->lng->loadLanguageModule("jscalendar");
01437 $this->tpl->addBlockFile("CALENDAR_LANG_JAVASCRIPT", "calendar_javascript", "tpl.calendar.html");
01438 $this->tpl->setCurrentBlock("calendar_javascript");
01439 $this->tpl->setVariable("FULL_SUNDAY", $this->lng->txt("l_su"));
01440 $this->tpl->setVariable("FULL_MONDAY", $this->lng->txt("l_mo"));
01441 $this->tpl->setVariable("FULL_TUESDAY", $this->lng->txt("l_tu"));
01442 $this->tpl->setVariable("FULL_WEDNESDAY", $this->lng->txt("l_we"));
01443 $this->tpl->setVariable("FULL_THURSDAY", $this->lng->txt("l_th"));
01444 $this->tpl->setVariable("FULL_FRIDAY", $this->lng->txt("l_fr"));
01445 $this->tpl->setVariable("FULL_SATURDAY", $this->lng->txt("l_sa"));
01446 $this->tpl->setVariable("SHORT_SUNDAY", $this->lng->txt("s_su"));
01447 $this->tpl->setVariable("SHORT_MONDAY", $this->lng->txt("s_mo"));
01448 $this->tpl->setVariable("SHORT_TUESDAY", $this->lng->txt("s_tu"));
01449 $this->tpl->setVariable("SHORT_WEDNESDAY", $this->lng->txt("s_we"));
01450 $this->tpl->setVariable("SHORT_THURSDAY", $this->lng->txt("s_th"));
01451 $this->tpl->setVariable("SHORT_FRIDAY", $this->lng->txt("s_fr"));
01452 $this->tpl->setVariable("SHORT_SATURDAY", $this->lng->txt("s_sa"));
01453 $this->tpl->setVariable("FULL_JANUARY", $this->lng->txt("l_01"));
01454 $this->tpl->setVariable("FULL_FEBRUARY", $this->lng->txt("l_02"));
01455 $this->tpl->setVariable("FULL_MARCH", $this->lng->txt("l_03"));
01456 $this->tpl->setVariable("FULL_APRIL", $this->lng->txt("l_04"));
01457 $this->tpl->setVariable("FULL_MAY", $this->lng->txt("l_05"));
01458 $this->tpl->setVariable("FULL_JUNE", $this->lng->txt("l_06"));
01459 $this->tpl->setVariable("FULL_JULY", $this->lng->txt("l_07"));
01460 $this->tpl->setVariable("FULL_AUGUST", $this->lng->txt("l_08"));
01461 $this->tpl->setVariable("FULL_SEPTEMBER", $this->lng->txt("l_09"));
01462 $this->tpl->setVariable("FULL_OCTOBER", $this->lng->txt("l_10"));
01463 $this->tpl->setVariable("FULL_NOVEMBER", $this->lng->txt("l_11"));
01464 $this->tpl->setVariable("FULL_DECEMBER", $this->lng->txt("l_12"));
01465 $this->tpl->setVariable("SHORT_JANUARY", $this->lng->txt("s_01"));
01466 $this->tpl->setVariable("SHORT_FEBRUARY", $this->lng->txt("s_02"));
01467 $this->tpl->setVariable("SHORT_MARCH", $this->lng->txt("s_03"));
01468 $this->tpl->setVariable("SHORT_APRIL", $this->lng->txt("s_04"));
01469 $this->tpl->setVariable("SHORT_MAY", $this->lng->txt("s_05"));
01470 $this->tpl->setVariable("SHORT_JUNE", $this->lng->txt("s_06"));
01471 $this->tpl->setVariable("SHORT_JULY", $this->lng->txt("s_07"));
01472 $this->tpl->setVariable("SHORT_AUGUST", $this->lng->txt("s_08"));
01473 $this->tpl->setVariable("SHORT_SEPTEMBER", $this->lng->txt("s_09"));
01474 $this->tpl->setVariable("SHORT_OCTOBER", $this->lng->txt("s_10"));
01475 $this->tpl->setVariable("SHORT_NOVEMBER", $this->lng->txt("s_11"));
01476 $this->tpl->setVariable("SHORT_DECEMBER", $this->lng->txt("s_12"));
01477 $this->tpl->setVariable("ABOUT_CALENDAR", $this->lng->txt("about_calendar"));
01478 $this->tpl->setVariable("ABOUT_CALENDAR_LONG", $this->lng->txt("about_calendar_long"));
01479 $this->tpl->setVariable("ABOUT_TIME_LONG", $this->lng->txt("about_time"));
01480 $this->tpl->setVariable("PREV_YEAR", $this->lng->txt("prev_year"));
01481 $this->tpl->setVariable("PREV_MONTH", $this->lng->txt("prev_month"));
01482 $this->tpl->setVariable("GO_TODAY", $this->lng->txt("go_today"));
01483 $this->tpl->setVariable("NEXT_MONTH", $this->lng->txt("next_month"));
01484 $this->tpl->setVariable("NEXT_YEAR", $this->lng->txt("next_year"));
01485 $this->tpl->setVariable("SEL_DATE", $this->lng->txt("select_date"));
01486 $this->tpl->setVariable("DRAG_TO_MOVE", $this->lng->txt("drag_to_move"));
01487 $this->tpl->setVariable("PART_TODAY", $this->lng->txt("part_today"));
01488 $this->tpl->setVariable("DAY_FIRST", $this->lng->txt("day_first"));
01489 $this->tpl->setVariable("CLOSE", $this->lng->txt("close"));
01490 $this->tpl->setVariable("TODAY", $this->lng->txt("today"));
01491 $this->tpl->setVariable("TIME_PART", $this->lng->txt("time_part"));
01492 $this->tpl->setVariable("DEF_DATE_FORMAT", $this->lng->txt("def_date_format"));
01493 $this->tpl->setVariable("TT_DATE_FORMAT", $this->lng->txt("tt_date_format"));
01494 $this->tpl->setVariable("WK", $this->lng->txt("wk"));
01495 $this->tpl->setVariable("TIME", $this->lng->txt("time"));
01496 $this->tpl->parseCurrentBlock();
01497 $this->tpl->setCurrentBlock("CalendarJS");
01498 $this->tpl->setVariable("LOCATION_JAVASCRIPT_CALENDAR", "./Modules/Test/js/calendar/calendar.js");
01499 $this->tpl->setVariable("LOCATION_JAVASCRIPT_CALENDAR_SETUP", "./Modules/Test/js/calendar/calendar-setup.js");
01500 $this->tpl->setVariable("LOCATION_JAVASCRIPT_CALENDAR_STYLESHEET", "./Modules/Test/js/calendar/calendar.css");
01501 $this->tpl->parseCurrentBlock();
01502 $this->tpl->setCurrentBlock("javascript_call_calendar");
01503 $this->tpl->setVariable("INPUT_FIELDS_STARTING_DATE", "starting_date");
01504 $this->tpl->setVariable("INPUT_FIELDS_ENDING_DATE", "ending_date");
01505 $this->tpl->parseCurrentBlock();
01506
01507 $total = $this->object->evalTotalPersons();
01508 $data["anonymity"] = $this->object->getAnonymity();
01509 $data["show_cancel"] = $this->object->getShowCancel();
01510 $data["show_marker"] = $this->object->getShowMarker();
01511 $data["introduction"] = $this->object->getIntroduction();
01512 $data["sequence_settings"] = $this->object->getSequenceSettings();
01513 $data["nr_of_tries"] = $this->object->getNrOfTries();
01514 $data["use_previous_answers"] = $this->object->getUsePreviousAnswers();
01515 $data["title_output"] = $this->object->getTitleOutput();
01516 $data["enable_processing_time"] = $this->object->getEnableProcessingTime();
01517 $data["reset_processing_time"] = $this->object->getResetProcessingTime();
01518 $data["processing_time"] = $this->object->getProcessingTime();
01519 $data["random_test"] = $this->object->isRandomTest();
01520 $data["password"] = $this->object->getPassword();
01521 $data["allowedUsers"] = $this->object->getAllowedUsers();
01522 $data["allowedUsersTimeGap"] = $this->object->getAllowedUsersTimeGap();
01523 if (!$this->object->getEnableProcessingTime())
01524 {
01525 $proc_time = $this->object->getEstimatedWorkingTime();
01526 $data["processing_time"] = sprintf("%02d:%02d:%02d",
01527 $proc_time["h"],
01528 $proc_time["m"],
01529 $proc_time["s"]
01530 );
01531 }
01532 $data["starting_time"] = $this->object->getStartingTime();
01533 $data["ending_time"] = $this->object->getEndingTime();
01534
01535 $this->tpl->setCurrentBlock("starting_time");
01536 $this->tpl->setVariable("TEXT_STARTING_TIME", $this->lng->txt("tst_starting_time"));
01537 if (!$data["starting_time"])
01538 {
01539 $date_input = ilUtil::makeDateSelect("starting_date");
01540 $time_input = ilUtil::makeTimeSelect("starting_time");
01541 }
01542 else
01543 {
01544 preg_match("/(\d{4})(\d{2})(\d{2})(\d{2})(\d{2})(\d{2})/", $data["starting_time"], $matches);
01545 $date_input = ilUtil::makeDateSelect("starting_date", $matches[1], sprintf("%d", $matches[2]), sprintf("%d", $matches[3]));
01546 $time_input = ilUtil::makeTimeSelect("starting_time", true, sprintf("%d", $matches[4]), sprintf("%d", $matches[5]), sprintf("%d", $matches[6]));
01547 }
01548 $this->tpl->setVariable("IMG_STARTING_TIME_CALENDAR", ilUtil::getImagePath("calendar.png"));
01549 $this->tpl->setVariable("TXT_STARTING_TIME_CALENDAR", $this->lng->txt("open_calendar"));
01550 $this->tpl->setVariable("TXT_ENABLED", $this->lng->txt("enabled"));
01551 if ($data["starting_time"])
01552 {
01553 $this->tpl->setVariable("CHECKED_STARTING_TIME", " checked=\"checked\"");
01554 }
01555 $this->tpl->setVariable("INPUT_STARTING_TIME", $this->lng->txt("date") . ": " . $date_input . $this->lng->txt("time") . ": " . $time_input);
01556 $this->tpl->parseCurrentBlock();
01557
01558 $this->tpl->setCurrentBlock("ending_time");
01559 $this->tpl->setVariable("TEXT_ENDING_TIME", $this->lng->txt("tst_ending_time"));
01560 if (!$data["ending_time"])
01561 {
01562 $date_input = ilUtil::makeDateSelect("ending_date");
01563 $time_input = ilUtil::makeTimeSelect("ending_time");
01564 }
01565 else
01566 {
01567 preg_match("/(\d{4})(\d{2})(\d{2})(\d{2})(\d{2})(\d{2})/", $data["ending_time"], $matches);
01568 $date_input = ilUtil::makeDateSelect("ending_date", $matches[1], sprintf("%d", $matches[2]), sprintf("%d", $matches[3]));
01569 $time_input = ilUtil::makeTimeSelect("ending_time", true, sprintf("%d", $matches[4]), sprintf("%d", $matches[5]), sprintf("%d", $matches[6]));
01570 }
01571 $this->tpl->setVariable("IMG_ENDING_TIME_CALENDAR", ilUtil::getImagePath("calendar.png"));
01572 $this->tpl->setVariable("TXT_ENDING_TIME_CALENDAR", $this->lng->txt("open_calendar"));
01573 $this->tpl->setVariable("TXT_ENABLED", $this->lng->txt("enabled"));
01574 if ($data["ending_time"])
01575 {
01576 $this->tpl->setVariable("CHECKED_ENDING_TIME", " checked=\"checked\"");
01577 }
01578 $this->tpl->setVariable("INPUT_ENDING_TIME", $this->lng->txt("date") . ": " . $date_input . $this->lng->txt("time") . ": " . $time_input);
01579 $this->tpl->parseCurrentBlock();
01580
01581 $this->tpl->setCurrentBlock("adm_content");
01582 $this->tpl->setVariable("ACTION_PROPERTIES", $this->ctrl->getFormAction($this));
01583 if ($ilAccess->checkAccess("write", "", $this->ref_id))
01584 {
01585 $this->tpl->setVariable("SUBMIT_TYPE", $this->lng->txt("change"));
01586 }
01587 $this->tpl->setVariable("HEADING_GENERAL", $this->lng->txt("tst_general_properties"));
01588 $this->tpl->setVariable("TEXT_ANONYMITY", $this->lng->txt("tst_anonymity"));
01589 $this->tpl->setVariable("DESCRIPTION_ANONYMITY", $this->lng->txt("tst_anonymity_description"));
01590 if ($data["anonymity"])
01591 {
01592 $this->tpl->setVariable("CHECKED_ANONYMITY", " checked=\"checked\"");
01593 }
01594 if ($total)
01595 {
01596 $this->tpl->setVariable("DISABLED_ANONYMITY", " disabled=\"disabled\"");
01597 }
01598
01599 $this->tpl->setVariable("TEXT_SHOW_MARKER", $this->lng->txt("question_marking"));
01600 $this->tpl->setVariable("TEXT_SHOW_MARKER_DESCRIPTION", $this->lng->txt("question_marking_description"));
01601 if ($data["show_marker"])
01602 {
01603 $this->tpl->setVariable("CHECKED_SHOW_MARKER", " checked=\"checked\"");
01604 }
01605
01606 $this->tpl->setVariable("TEXT_SHOW_CANCEL", $this->lng->txt("tst_show_cancel"));
01607 $this->tpl->setVariable("TEXT_SHOW_CANCEL_DESCRIPTION", $this->lng->txt("tst_show_cancel_description"));
01608 if ($data["show_cancel"])
01609 {
01610 $this->tpl->setVariable("CHECKED_SHOW_CANCEL", " checked=\"checked\"");
01611 }
01612 $this->tpl->setVariable("TEXT_INTRODUCTION", $this->lng->txt("tst_introduction"));
01613 $this->tpl->setVariable("VALUE_INTRODUCTION", ilUtil::prepareFormOutput($this->object->prepareTextareaOutput($data["introduction"])));
01614 $this->tpl->setVariable("HEADING_SEQUENCE", $this->lng->txt("tst_sequence_properties"));
01615 $this->tpl->setVariable("TEXT_POSTPONE", $this->lng->txt("tst_postpone"));
01616 $this->tpl->setVariable("TEXT_POSTPONE_DESCRIPTION", $this->lng->txt("tst_postpone_description"));
01617 if ($data["sequence_settings"] == 1)
01618 {
01619 $this->tpl->setVariable("CHECKED_POSTPONE", " checked=\"checked\"");
01620 }
01621 $this->tpl->setVariable("TEXT_SHUFFLE_QUESTIONS", $this->lng->txt("tst_shuffle_questions"));
01622 $this->tpl->setVariable("TEXT_SHUFFLE_QUESTIONS_DESCRIPTION", $this->lng->txt("tst_shuffle_questions_description"));
01623 if ($this->object->getShuffleQuestions())
01624 {
01625 $this->tpl->setVariable("CHECKED_SHUFFLE_QUESTIONS", " checked=\"checked\"");
01626 }
01627
01628 $this->tpl->setVariable("TEXT_SHOW_SUMMARY", $this->lng->txt("tst_show_summary"));
01629 $this->tpl->setVariable("TEXT_SHOW_SUMMARY_DESCRIPTION", $this->lng->txt("tst_show_summary_description"));
01630 $this->tpl->setVariable("TEXT_NO", $this->lng->txt("no"));
01631 $this->tpl->setVariable("TEXT_YES", $this->lng->txt("tst_list_of_questions_yes"));
01632 $this->tpl->setVariable("TEXT_LIST_OF_QUESTIONS_START", $this->lng->txt("tst_list_of_questions_start"));
01633 $this->tpl->setVariable("TEXT_LIST_OF_QUESTIONS_END", $this->lng->txt("tst_list_of_questions_end"));
01634 $this->tpl->setVariable("TEXT_LIST_OF_QUESTIONS_WITH_DESCRIPTION", $this->lng->txt("tst_list_of_questions_with_description"));
01635 if ($this->object->getListOfQuestions())
01636 {
01637 $this->tpl->setVariable("CHECKED_LIST_OF_QUESTIONS_YES", " checked=\"checked\"");
01638 if ($this->object->getListOfQuestionsStart())
01639 {
01640 $this->tpl->setVariable("CHECKED_LIST_OF_QUESTIONS_START", " checked=\"checked\"");
01641 }
01642 if ($this->object->getListOfQuestionsEnd())
01643 {
01644 $this->tpl->setVariable("CHECKED_LIST_OF_QUESTIONS_END", " checked=\"checked\"");
01645 }
01646 if ($this->object->getListOfQuestionsDescription())
01647 {
01648 $this->tpl->setVariable("CHECKED_LIST_OF_QUESTIONS_WITH_DESCRIPTION", " checked=\"checked\"");
01649 }
01650 }
01651 else
01652 {
01653 $this->tpl->setVariable("CHECKED_LIST_OF_QUESTIONS_NO", " checked=\"checked\"");
01654 }
01655
01656 $this->tpl->setVariable("TEXT_USE_PREVIOUS_ANSWERS", $this->lng->txt("tst_use_previous_answers"));
01657 $this->tpl->setVariable("TEXT_USE_PREVIOUS_ANSWERS_DESCRIPTION", $this->lng->txt("tst_use_previous_answers_description"));
01658 $this->tpl->setVariable("TEXT_TITLE_OUTPUT", $this->lng->txt("tst_title_output"));
01659 $this->tpl->setVariable("TEXT_TITLE_OUTPUT_FULL", $this->lng->txt("tst_title_output_full"));
01660 $this->tpl->setVariable("TEXT_TITLE_OUTPUT_HIDE_POINTS", $this->lng->txt("tst_title_output_hide_points"));
01661 $this->tpl->setVariable("TEXT_TITLE_OUTPUT_NO_TITLE", $this->lng->txt("tst_title_output_no_title"));
01662 $this->tpl->setVariable("TEXT_TITLE_OUTPUT_DESCRIPTION", $this->lng->txt("tst_title_output_description"));
01663 switch ($data["title_output"])
01664 {
01665 case 1:
01666 $this->tpl->setVariable("CHECKED_TITLE_OUTPUT_HIDE_POINTS", " checked=\"checked\"");
01667 break;
01668 case 2:
01669 $this->tpl->setVariable("CHECKED_TITLE_OUTPUT_NO_TITLE", " checked=\"checked\"");
01670 break;
01671 case 0:
01672 default:
01673 $this->tpl->setVariable("CHECKED_TITLE_OUTPUT_FULL", " checked=\"checked\"");
01674 break;
01675 }
01676 if ($data["random_test"])
01677 {
01678 $data["use_previous_answers"] = 0;
01679 }
01680 if ($data["use_previous_answers"])
01681 {
01682 $this->tpl->setVariable("CHECKED_USE_PREVIOUS_ANSWERS", " checked=\"checked\"");
01683 }
01684 if ($data["random_test"])
01685 {
01686 $this->tpl->setVariable("DISABLE_USE_PREVIOUS_ANSWERS", " disabled=\"disabled\"");
01687 }
01688 $this->tpl->setVariable("HEADING_SESSION", $this->lng->txt("tst_session_settings"));
01689 $this->tpl->setVariable("TEXT_NR_OF_TRIES", $this->lng->txt("tst_nr_of_tries"));
01690 $this->tpl->setVariable("VALUE_NR_OF_TRIES", $data["nr_of_tries"]);
01691 $this->tpl->setVariable("COMMENT_NR_OF_TRIES", $this->lng->txt("0_unlimited"));
01692 $this->tpl->setVariable("TXT_ENABLED", $this->lng->txt("enabled"));
01693 $this->tpl->setVariable("TXT_RESET_PROCESSING_TIME", $this->lng->txt("tst_reset_processing_time"));
01694 $this->tpl->setVariable("TEXT_RESET_PROCESSING_TIME_DESC", $this->lng->txt("tst_reset_processing_time_desc"));
01695 $this->tpl->setVariable("TEXT_PROCESSING_TIME", $this->lng->txt("tst_processing_time"));
01696 $this->tpl->setVariable("TEXT_PROCESSING_TIME_DESC", $this->lng->txt("tst_processing_time_desc"));
01697 $time_input = ilUtil::makeTimeSelect("processing_time", false, substr($data["processing_time"], 0, 2), substr($data["processing_time"], 3, 2), substr($data["processing_time"], 6, 2));
01698 $this->tpl->setVariable("MAX_PROCESSING_TIME", $time_input . " (hh:mm:ss)");
01699 if ($data["enable_processing_time"]) {
01700 $this->tpl->setVariable("CHECKED_PROCESSING_TIME", " checked=\"checked\"");
01701 }
01702 if ($data["reset_processing_time"])
01703 {
01704 $this->tpl->setVariable("CHECKED_RESET_PROCESSING_TIME", " checked=\"checked\"");
01705 }
01706 $this->tpl->setVariable("TEXT_RANDOM_TEST", $this->lng->txt("tst_random_selection"));
01707 $this->tpl->setVariable("TEXT_RANDOM_TEST_DESCRIPTION", $this->lng->txt("tst_random_test_description"));
01708 if ($data["random_test"])
01709 {
01710 $this->tpl->setVariable("CHECKED_RANDOM_TEST", " checked=\"checked\"");
01711 }
01712
01713 $this->tpl->setVariable("TEXT_MAX_ALLOWED_USERS", $this->lng->txt("tst_max_allowed_users"));
01714 $this->tpl->setVariable("TEXT_ALLOWED_USERS", $this->lng->txt("tst_allowed_users"));
01715 $this->tpl->setVariable("TEXT_ALLOWED_USERS_TIME_GAP", $this->lng->txt("tst_allowed_users_time_gap"));
01716 if ($data["allowedUsers"] > 0)
01717 {
01718 $this->tpl->setVariable("VALUE_ALLOWED_USERS", " value=\"" . $data["allowedUsers"] . "\"");
01719 }
01720 $this->tpl->setVariable("TEXT_ALLOWED_USERS_TIME_GAP", $this->lng->txt("tst_allowed_users_time_gap"));
01721 if ($data["allowedUsersTimeGap"] > 0)
01722 {
01723 $this->tpl->setVariable("VALUE_ALLOWED_USERS_TIME_GAP", " value=\"" . $data["allowedUsersTimeGap"] . "\"");
01724 }
01725 $this->tpl->setVariable("SECONDS", $this->lng->txt("seconds"));
01726 $this->tpl->setVariable("TEXT_PASSWORD", $this->lng->txt("tst_password"));
01727 $this->tpl->setVariable("TEXT_PASSWORD_DETAILS", $this->lng->txt("tst_password_details"));
01728 if (strlen($data["password"]))
01729 {
01730 $this->tpl->setVariable("VALUE_PASSWORD", " value=\"". ilUtil::prepareFormOutput($data["password"])."\"");
01731 }
01732 if ($ilAccess->checkAccess("write", "", $this->ref_id))
01733 {
01734 $this->tpl->setVariable("SAVE", $this->lng->txt("save"));
01735 }
01736 if ($total > 0)
01737 {
01738 $this->tpl->setVariable("ENABLED_RANDOM_TEST", " disabled=\"disabled\"");
01739 }
01740 $this->tpl->parseCurrentBlock();
01741 }
01742
01746 function downloadFileObject()
01747 {
01748 $file = explode("_", $_GET["file_id"]);
01749 include_once("./Modules/File/classes/class.ilObjFile.php");
01750 $fileObj =& new ilObjFile($file[count($file) - 1], false);
01751 $fileObj->sendFile();
01752 exit;
01753 }
01754
01758 function fullscreenObject()
01759 {
01760 include_once("./Services/COPage/classes/class.ilPageObjectGUI.php");
01761 $page =& new ilPageObject("qpl", $_GET["pg_id"]);
01762 $page_gui =& new ilPageObjectGUI($page);
01763 $page_gui->showMediaFullscreen();
01764
01765 }
01766
01770 function download_paragraphObject()
01771 {
01772 include_once("./Services/COPage/classes/class.ilPageObject.php");
01773 $pg_obj =& new ilPageObject("qpl", $_GET["pg_id"]);
01774 $pg_obj->send_paragraph ($_GET["par_id"], $_GET["downloadtitle"]);
01775 exit;
01776 }
01777
01785 function filterObject()
01786 {
01787 $this->questionBrowser();
01788 }
01789
01797 function resetFilterObject()
01798 {
01799 $this->questionBrowser();
01800 }
01801
01809 function backObject()
01810 {
01811 $this->ctrl->redirect($this, "questions");
01812 }
01813
01821 function insertQuestionsObject()
01822 {
01823
01824 $selected_array = array();
01825 foreach ($_POST as $key => $value)
01826 {
01827 if (preg_match("/cb_(\d+)/", $key, $matches))
01828 {
01829 array_push($selected_array, $matches[1]);
01830 }
01831 }
01832 if (!count($selected_array))
01833 {
01834 ilUtil::sendInfo($this->lng->txt("tst_insert_missing_question"), true);
01835 $this->ctrl->setParameterByClass(get_class($this), "sel_filter_type", $_POST["sel_filter_type"]);
01836 $this->ctrl->setParameterByClass(get_class($this), "sel_question_type", $_POST["sel_question_type"]);
01837 $this->ctrl->setParameterByClass(get_class($this), "sel_questionpool", $_POST["sel_questionpool"]);
01838 $this->ctrl->setParameterByClass(get_class($this), "filter_text", $_POST["filter_text"]);
01839 $this->ctrl->redirect($this, "browseForQuestions");
01840 }
01841 else
01842 {
01843 include_once "./Modules/TestQuestionPool/classes/class.assQuestion.php";
01844 $manscoring = FALSE;
01845 foreach ($selected_array as $key => $value)
01846 {
01847 $this->object->insertQuestion($value);
01848 if (!$manscoring)
01849 {
01850 $manscoring = $manscoring | assQuestion::_needsManualScoring($value);
01851 }
01852 }
01853 $this->object->saveCompleteStatus();
01854 if ($manscoring)
01855 {
01856 ilUtil::sendInfo($this->lng->txt("manscoring_hint"), TRUE);
01857 }
01858 else
01859 {
01860 ilUtil::sendInfo($this->lng->txt("tst_questions_inserted"), TRUE);
01861 }
01862 $this->ctrl->redirect($this, "questions");
01863 return;
01864 }
01865 }
01866
01874 function questionBrowser()
01875 {
01876 global $ilAccess;
01877
01878 $this->ctrl->setParameterByClass(get_class($this), "browse", "1");
01879 $textfilters = array();
01880 if (strcmp($this->ctrl->getCmd(), "resetFilter") == 0)
01881 {
01882 $filter_type = "";
01883 $filter_question_type = "";
01884 $filter_questionpool = "";
01885 $filter_text = "";
01886 }
01887 else
01888 {
01889 $filter_question_type = (array_key_exists("sel_question_type", $_POST)) ? $_POST["sel_question_type"] : $_GET["sel_question_type"];
01890 $filter_type = (array_key_exists("sel_filter_type", $_POST)) ? $_POST["sel_filter_type"] : $_GET["sel_filter_type"];
01891 $filter_questionpool = (array_key_exists("sel_questionpool", $_POST)) ? $_POST["sel_questionpool"] : $_GET["sel_questionpool"];
01892 $filter_text = (array_key_exists("filter_text", $_POST)) ? $_POST["filter_text"] : $_GET["filter_text"];
01893 }
01894
01895 $filter_title = (array_key_exists("filter_title", $_POST)) ? $_POST["filter_title"] : $_GET["filter_title"];
01896 if (strlen($filter_title)) $textfilters["title"] = $filter_title;
01897 $filter_qpl = (array_key_exists("filter_qpl", $_POST)) ? $_POST["filter_qpl"] : $_GET["filter_qpl"];
01898 if (strlen($filter_qpl)) $textfilters["qpl"] = $filter_qpl;
01899 $filter_comment = (array_key_exists("filter_comment", $_POST)) ? $_POST["filter_comment"] : $_GET["filter_comment"];
01900 if (strlen($filter_comment)) $textfilters["comment"] = $filter_comment;
01901 $filter_author = (array_key_exists("filter_author", $_POST)) ? $_POST["filter_author"] : $_GET["filter_author"];
01902 if (strlen($filter_author)) $textfilters["author"] = $filter_author;
01903
01904 $this->ctrl->setParameterByClass(get_class($this), "sel_filter_type", $filter_type);
01905 $this->ctrl->setParameterByClass(get_class($this), "sel_question_type", $filter_question_type);
01906 $this->ctrl->setParameterByClass(get_class($this), "sel_questionpool", $filter_questionpool);
01907 $this->ctrl->setParameterByClass(get_class($this), "filter_text", $filter_text);
01908 $this->ctrl->setParameterByClass(get_class($this), "filter_title", $filter_title);
01909 $this->ctrl->setParameterByClass(get_class($this), "filter_qpl", $filter_qpl);
01910 $this->ctrl->setParameterByClass(get_class($this), "filter_comment", $filter_comment);
01911 $this->ctrl->setParameterByClass(get_class($this), "filter_author", $filter_author);
01912
01913 $this->tpl->addBlockFile("ADM_CONTENT", "adm_content", "tpl.il_as_tst_questionbrowser.html", "Modules/Test");
01914 $this->tpl->addBlockFile("A_BUTTONS", "a_buttons", "tpl.il_as_qpl_action_buttons.html", "Modules/Test");
01915 $this->tpl->addBlockFile("FILTER_QUESTION_MANAGER", "filter_questions", "tpl.il_as_tst_filter_questions.html", "Modules/Test");
01916
01917 $questionpools =& $this->object->getAvailableQuestionpools(true);
01918 $filter_fields = array(
01919 "title" => $this->lng->txt("title"),
01920 "comment" => $this->lng->txt("description"),
01921 "author" => $this->lng->txt("author"),
01922 );
01923 $this->tpl->setCurrentBlock("filterrow");
01924 foreach ($filter_fields as $key => $value) {
01925 $this->tpl->setVariable("VALUE_FILTER_TYPE", "$key");
01926 $this->tpl->setVariable("NAME_FILTER_TYPE", "$value");
01927 if (strcmp($this->ctrl->getCmd(), "resetFilter") != 0)
01928 {
01929 if (strcmp($filter_type, $key) == 0)
01930 {
01931 $this->tpl->setVariable("VALUE_FILTER_SELECTED", " selected=\"selected\"");
01932 }
01933 }
01934 $this->tpl->parseCurrentBlock();
01935 }
01936
01937 include_once "./Modules/TestQuestionPool/classes/class.ilObjQuestionPool.php";
01938 $questiontypes =& ilObjQuestionPool::_getQuestionTypes();
01939 foreach ($questiontypes as $key => $value)
01940 {
01941 $this->tpl->setCurrentBlock("questiontype_row");
01942 $this->tpl->setVariable("VALUE_QUESTION_TYPE", $value["type_tag"]);
01943 $this->tpl->setVariable("TEXT_QUESTION_TYPE", $this->lng->txt($value["type_tag"]));
01944 if (strcmp($filter_question_type, $value["type_tag"]) == 0)
01945 {
01946 $this->tpl->setVariable("SELECTED_QUESTION_TYPE", " selected=\"selected\"");
01947 }
01948 $this->tpl->parseCurrentBlock();
01949 }
01950
01951 foreach ($questionpools as $key => $value)
01952 {
01953 $this->tpl->setCurrentBlock("questionpool_row");
01954 $this->tpl->setVariable("VALUE_QUESTIONPOOL", $key);
01955 $this->tpl->setVariable("TEXT_QUESTIONPOOL", $value["title"]);
01956 if (strcmp($filter_questionpool, $key) == 0)
01957 {
01958 $this->tpl->setVariable("SELECTED_QUESTIONPOOL", " selected=\"selected\"");
01959 }
01960 $this->tpl->parseCurrentBlock();
01961 }
01962
01963 $this->tpl->setCurrentBlock("filter_questions");
01964 $this->tpl->setVariable("SHOW_QUESTION_TYPES", $this->lng->txt("filter_show_question_types"));
01965 $this->tpl->setVariable("TEXT_ALL_QUESTION_TYPES", $this->lng->txt("filter_all_question_types"));
01966 $this->tpl->setVariable("SHOW_QUESTIONPOOLS", $this->lng->txt("filter_show_questionpools"));
01967 $this->tpl->setVariable("TEXT_ALL_QUESTIONPOOLS", $this->lng->txt("filter_all_questionpools"));
01968 $this->tpl->setVariable("FILTER_TEXT", $this->lng->txt("filter"));
01969 $this->tpl->setVariable("TEXT_FILTER_BY", $this->lng->txt("by"));
01970 if (strcmp($this->ctrl->getCmd(), "resetFilter") != 0)
01971 {
01972 $this->tpl->setVariable("VALUE_FILTER_TEXT", $filter_text);
01973 }
01974 $this->tpl->setVariable("VALUE_SUBMIT_FILTER", $this->lng->txt("set_filter"));
01975 $this->tpl->setVariable("VALUE_RESET_FILTER", $this->lng->txt("reset_filter"));
01976 $this->tpl->parseCurrentBlock();
01977
01978 $startrow = 0;
01979 if ($_GET["prevrow"])
01980 {
01981 $startrow = $_GET["prevrow"];
01982 }
01983 if ($_GET["nextrow"])
01984 {
01985 $startrow = $_GET["nextrow"];
01986 }
01987 if ($_GET["startrow"])
01988 {
01989 $startrow = $_GET["startrow"];
01990 }
01991 $sort = ($_GET["sort"]) ? $_GET["sort"] : "title";
01992 $sortorder = ($_GET["sortorder"]) ? $_GET["sortorder"] : "ASC";
01993 $this->ctrl->setParameter($this, "sort", $sort);
01994 $this->ctrl->setParameter($this, "sortorder", $sortorder);
01995 if (strlen($filter_text) && strlen($filter_type)) $textfilters[$filter_type] = $filter_text;
01996 $table = $this->object->getQuestionsTable($sort, $sortorder, $textfilters, $startrow, 1, $filter_question_type, $filter_questionpool);
01997
01998 $colors = array("tblrow1", "tblrow2");
01999 $counter = 0;
02000 $existing_questions =& $this->object->getExistingQuestions();
02001 if ((is_array($table["rows"])) && (count($table["rows"])))
02002 {
02003 foreach ($table["rows"] as $data)
02004 {
02005 if (!in_array($data["question_id"], $existing_questions))
02006 {
02007 if ($data["complete"])
02008 {
02009
02010 $this->tpl->setCurrentBlock("checkable");
02011 $this->tpl->setVariable("QUESTION_ID", $data["question_id"]);
02012 $this->tpl->parseCurrentBlock();
02013 }
02014 $this->tpl->setCurrentBlock("QTab");
02015 $this->tpl->setVariable("QUESTION_ID", $data["question_id"]);
02016 $this->tpl->setVariable("QUESTION_TITLE", "<strong>" . $data["title"] . "</strong>");
02017 $this->tpl->setVariable("PREVIEW", "[<a href=\"" . $this->ctrl->getLinkTarget($this, "questions") . "&preview=" . $data["question_id"] . "\">" . $this->lng->txt("preview") . "</a>]");
02018 $this->tpl->setVariable("QUESTION_COMMENT", $data["comment"]);
02019 $this->tpl->setVariable("QUESTION_TYPE", $this->lng->txt($data["type_tag"]));
02020 $this->tpl->setVariable("QUESTION_AUTHOR", $data["author"]);
02021 $this->tpl->setVariable("QUESTION_CREATED", ilFormat::formatDate(ilFormat::ftimestamp2dateDB($data["created"]), "date"));
02022 $this->tpl->setVariable("QUESTION_UPDATED", ilFormat::formatDate(ilFormat::ftimestamp2dateDB($data["TIMESTAMP14"]), "date"));
02023 $this->tpl->setVariable("COLOR_CLASS", $colors[$counter % 2]);
02024 $this->tpl->setVariable("QUESTION_POOL", $questionpools[$data["obj_fi"]]["title"]);
02025 $this->tpl->parseCurrentBlock();
02026 $counter++;
02027 }
02028 }
02029
02030 if ($table["rowcount"] > count($table["rows"]))
02031 {
02032 $nextstep = $table["nextrow"] + $table["step"];
02033 if ($nextstep > $table["rowcount"])
02034 {
02035 $nextstep = $table["rowcount"];
02036 }
02037 $counter = 1;
02038 for ($i = 0; $i < $table["rowcount"]; $i += $table["step"])
02039 {
02040 $this->tpl->setCurrentBlock("pages");
02041 if ($table["startrow"] == $i)
02042 {
02043 $this->tpl->setVariable("PAGE_NUMBER", "<span class=\"inactivepage\">$counter</span>");
02044 }
02045 else
02046 {
02047 $this->tpl->setVariable("PAGE_NUMBER", "<a href=\"" . $this->ctrl->getLinkTarget($this, "browseForQuestions") . "&nextrow=$i" . "\">$counter</a>");
02048 }
02049 $this->tpl->parseCurrentBlock();
02050 $counter++;
02051 }
02052 $this->tpl->setCurrentBlock("navigation_bottom");
02053 $this->tpl->setVariable("TEXT_ITEM", $this->lng->txt("item"));
02054 $this->tpl->setVariable("TEXT_ITEM_START", $table["startrow"] + 1);
02055 $end = $table["startrow"] + $table["step"];
02056 if ($end > $table["rowcount"])
02057 {
02058 $end = $table["rowcount"];
02059 }
02060 $this->tpl->setVariable("TEXT_ITEM_END", $end);
02061 $this->tpl->setVariable("TEXT_OF", strtolower($this->lng->txt("of")));
02062 $this->tpl->setVariable("TEXT_ITEM_COUNT", $table["rowcount"]);
02063 $this->tpl->setVariable("TEXT_PREVIOUS", $this->lng->txt("previous"));
02064 $this->tpl->setVariable("TEXT_NEXT", $this->lng->txt("next"));
02065 $this->tpl->setVariable("HREF_PREV_ROWS", $this->ctrl->getLinkTarget($this, "browseForQuestions") . "&prevrow=" . $table["prevrow"]);
02066 $this->tpl->setVariable("HREF_NEXT_ROWS", $this->ctrl->getLinkTarget($this, "browseForQuestions") . "&nextrow=" . $table["nextrow"]);
02067 $this->tpl->parseCurrentBlock();
02068 }
02069 }
02070
02071
02072 if (!((is_array($table["rows"])) && (count($table["rows"]))))
02073 {
02074 $this->tpl->setCurrentBlock("Emptytable");
02075 $this->tpl->setVariable("TEXT_EMPTYTABLE", $this->lng->txt("no_questions_available"));
02076 $this->tpl->parseCurrentBlock();
02077 }
02078 else
02079 {
02080
02081 $this->tpl->setCurrentBlock("selection");
02082 $this->tpl->setVariable("INSERT", $this->lng->txt("insert"));
02083 $this->tpl->parseCurrentBlock();
02084
02085 $this->tpl->setCurrentBlock("selectall");
02086 $this->tpl->setVariable("SELECT_ALL", $this->lng->txt("select_all"));
02087 $counter++;
02088 $this->tpl->setVariable("COLOR_CLASS", $colors[$counter % 2]);
02089 $this->tpl->parseCurrentBlock();
02090
02091 $this->tpl->setCurrentBlock("Footer");
02092 $this->tpl->setVariable("ARROW", "<img src=\"" . ilUtil::getImagePath("arrow_downright.gif") . "\" alt=\"".$this->lng->txt("arrow_downright")."\"/>");
02093 $this->tpl->parseCurrentBlock();
02094 }
02095
02096 $sortarray = array(
02097 "title" => (strcmp($sort, "title") == 0) ? $sortorder : "",
02098 "comment" => (strcmp($sort, "comment") == 0) ? $sortorder : "",
02099 "type" => (strcmp($sort, "type") == 0) ? $sortorder : "",
02100 "author" => (strcmp($sort, "author") == 0) ? $sortorder : "",
02101 "created" => (strcmp($sort, "created") == 0) ? $sortorder : "",
02102 "updated" => (strcmp($sort, "updated") == 0) ? $sortorder : "",
02103 "qpl" => (strcmp($sort, "qpl") == 0) ? $sortorder : ""
02104 );
02105 foreach ($sortarray as $key => $value)
02106 {
02107 if (strcmp($value, "ASC") == 0)
02108 {
02109 $sortarray[$key] = "DESC";
02110 }
02111 else
02112 {
02113 $sortarray[$key] = "ASC";
02114 }
02115 }
02116
02117
02118 include_once "./Services/YUI/classes/class.ilYuiUtil.php";
02119 ilYuiUtil::initMenu();
02120 $this->tpl->addCss(ilUtil::getStyleSheetLocation("output", "tpl.text_filter.css", "Modules/TestQuestionPool"));
02121
02122
02123 $titlefilter = new ilTemplate("tpl.text_filter.js", TRUE, TRUE, "Modules/TestQuestionPool");
02124 $titlefilter->setVariable("FILTERELEMENTID", "titlefilter");
02125 $titlefilter->setVariable("OVERLAY_WIDTH", "500px");
02126 $titlefilter->setVariable("OVERLAY_HEIGHT", "5em");
02127 $titlefilter->setVariable("TEXTFIELD_NAME", "filter_title");
02128 $titlefilter->setVariable("IMAGE_CLOSE", ilUtil::getImagePath("icon_close2_s.gif"));
02129 $titlefilter->setVariable("ALT_CLOSE", $this->lng->txt("close"));
02130 $titlefilter->setVariable("TITLE_CLOSE", $this->lng->txt("close"));
02131 $titlefilter->setVariable("FORMACTION", $this->ctrl->getFormAction($this, "filter"));
02132 $titlefilter->setVariable("VALUE_FILTER_TEXT", $filter_title);
02133 $titlefilter->setVariable("VALUE_SUBMIT_FILTER", $this->lng->txt("set_filter"));
02134 $titlefilter->setVariable("VALUE_RESET_FILTER", $this->lng->txt("reset_filter"));
02135 $this->tpl->setCurrentBlock("HeadContent");
02136 $this->tpl->setVariable("CONTENT_BLOCK", $titlefilter->get());
02137 $this->tpl->parseCurrentBlock();
02138
02139
02140 $filtermenu = new ilTemplate("tpl.question_type_menu.js", TRUE, TRUE, "Modules/TestQuestionPool");
02141 if (strcmp($filter_question_type, "") == 0)
02142 {
02143 $filtermenu->setCurrentBlock("selected");
02144 $filtermenu->touchBlock("selected");
02145 $filtermenu->parseCurrentBlock();
02146 }
02147 $filtermenu->setCurrentBlock("menuitem");
02148 $filtermenu->setVariable("ITEM_TEXT", $this->lng->txt("filter_all_question_types"));
02149 $this->ctrl->setParameter($this, "sel_question_type", "");
02150 $this->ctrl->setParameter($this, "sort", $sort);
02151 $this->ctrl->setParameter($this, "sortorder", $sortorder);
02152 $filtermenu->setVariable("ITEM_URL", $this->ctrl->getLinkTarget($this, "browseForQuestions"));
02153 $filtermenu->parseCurrentBlock();
02154 foreach ($questiontypes as $key => $value)
02155 {
02156 if (strcmp($filter_question_type, $value["type_tag"]) == 0)
02157 {
02158 $filtermenu->setCurrentBlock("selected");
02159 $filtermenu->touchBlock("selected");
02160 $filtermenu->parseCurrentBlock();
02161 }
02162 $filtermenu->setCurrentBlock("menuitem");
02163 $filtermenu->setVariable("VALUE_QUESTION_TYPE", $value["type_tag"]);
02164 $filtermenu->setVariable("ITEM_TEXT", $this->lng->txt($value["type_tag"]));
02165 $this->ctrl->setParameter($this, "sel_question_type", $value["type_tag"]);
02166 $filtermenu->setVariable("ITEM_URL", $this->ctrl->getLinkTarget($this, "browseForQuestions"));
02167 $filtermenu->parseCurrentBlock();
02168 }
02169 $this->ctrl->setParameter($this, "sel_question_type", $filter_question_type);
02170 $this->tpl->setCurrentBlock("HeadContent");
02171 $this->tpl->setVariable("CONTENT_BLOCK", $filtermenu->get());
02172 $this->tpl->parseCurrentBlock();
02173
02174
02175 $commenttextfilter = new ilTemplate("tpl.text_filter.js", TRUE, TRUE, "Modules/TestQuestionPool");
02176 $commenttextfilter->setVariable("FILTERELEMENTID", "commenttextfilter");
02177 $commenttextfilter->setVariable("OVERLAY_WIDTH", "500px");
02178 $commenttextfilter->setVariable("OVERLAY_HEIGHT", "5em");
02179 $commenttextfilter->setVariable("TEXTFIELD_NAME", "filter_comment");
02180 $commenttextfilter->setVariable("IMAGE_CLOSE", ilUtil::getImagePath("icon_close2_s.gif"));
02181 $commenttextfilter->setVariable("ALT_CLOSE", $this->lng->txt("close"));
02182 $commenttextfilter->setVariable("TITLE_CLOSE", $this->lng->txt("close"));
02183 $commenttextfilter->setVariable("FORMACTION", $this->ctrl->getFormAction($this, "filter"));
02184 $commenttextfilter->setVariable("VALUE_FILTER_TEXT", $filter_comment);
02185 $commenttextfilter->setVariable("VALUE_SUBMIT_FILTER", $this->lng->txt("set_filter"));
02186 $commenttextfilter->setVariable("VALUE_RESET_FILTER", $this->lng->txt("reset_filter"));
02187 $this->tpl->setCurrentBlock("HeadContent");
02188 $this->tpl->setVariable("CONTENT_BLOCK", $commenttextfilter->get());
02189 $this->tpl->parseCurrentBlock();
02190
02191
02192 $authortextfilter = new ilTemplate("tpl.text_filter.js", TRUE, TRUE, "Modules/TestQuestionPool");
02193 $authortextfilter->setVariable("FILTERELEMENTID", "authortextfilter");
02194 $authortextfilter->setVariable("OVERLAY_WIDTH", "500px");
02195 $authortextfilter->setVariable("OVERLAY_HEIGHT", "5em");
02196 $authortextfilter->setVariable("TEXTFIELD_NAME", "filter_author");
02197 $authortextfilter->setVariable("IMAGE_CLOSE", ilUtil::getImagePath("icon_close2_s.gif"));
02198 $authortextfilter->setVariable("ALT_CLOSE", $this->lng->txt("close"));
02199 $authortextfilter->setVariable("TITLE_CLOSE", $this->lng->txt("close"));
02200 $authortextfilter->setVariable("FORMACTION", $this->ctrl->getFormAction($this, "filter"));
02201 $authortextfilter->setVariable("VALUE_FILTER_TEXT", $filter_author);
02202 $authortextfilter->setVariable("VALUE_SUBMIT_FILTER", $this->lng->txt("set_filter"));
02203 $authortextfilter->setVariable("VALUE_RESET_FILTER", $this->lng->txt("reset_filter"));
02204 $this->tpl->setCurrentBlock("HeadContent");
02205 $this->tpl->setVariable("CONTENT_BLOCK", $authortextfilter->get());
02206 $this->tpl->parseCurrentBlock();
02207
02208
02209 $qpltextfilter = new ilTemplate("tpl.text_filter.js", TRUE, TRUE, "Modules/TestQuestionPool");
02210 $qpltextfilter->setVariable("FILTERELEMENTID", "qpltextfilter");
02211 $qpltextfilter->setVariable("OVERLAY_WIDTH", "500px");
02212 $qpltextfilter->setVariable("OVERLAY_HEIGHT", "5em");
02213 $qpltextfilter->setVariable("TEXTFIELD_NAME", "filter_qpl");
02214 $qpltextfilter->setVariable("IMAGE_CLOSE", ilUtil::getImagePath("icon_close2_s.gif"));
02215 $qpltextfilter->setVariable("ALT_CLOSE", $this->lng->txt("close"));
02216 $qpltextfilter->setVariable("TITLE_CLOSE", $this->lng->txt("close"));
02217 $qpltextfilter->setVariable("FORMACTION", $this->ctrl->getFormAction($this, "filter"));
02218 $qpltextfilter->setVariable("VALUE_FILTER_TEXT", $filter_qpl);
02219 $qpltextfilter->setVariable("VALUE_SUBMIT_FILTER", $this->lng->txt("set_filter"));
02220 $qpltextfilter->setVariable("VALUE_RESET_FILTER", $this->lng->txt("reset_filter"));
02221 $this->tpl->setCurrentBlock("HeadContent");
02222 $this->tpl->setVariable("CONTENT_BLOCK", $qpltextfilter->get());
02223 $this->tpl->parseCurrentBlock();
02224
02225 $this->tpl->setCurrentBlock("adm_content");
02226 $this->ctrl->setCmd("questionBrowser");
02227 $this->ctrl->setParameterByClass(get_class($this), "startrow", $table["startrow"]);
02228 $template = new ilTemplate("tpl.image.html", true, true);
02229 if (strlen($filter_title))
02230 {
02231 $template->setVariable("IMAGE_SOURCE", ilUtil::getImagePath("search-filter-locked.png"));
02232 }
02233 else
02234 {
02235 $template->setVariable("IMAGE_SOURCE", ilUtil::getImagePath("search-filter.png"));
02236 }
02237 $template->setVariable("IMAGE_TITLE", $this->lng->txt("filter"));
02238 $template->setVariable("IMAGE_ALT", $this->lng->txt("filter"));
02239 $template->setVariable("ID", "titlefilter");
02240 $template->setVariable("STYLE", "visibility: hidden; cursor: pointer");
02241 $this->ctrl->setParameter($this, "sort", "title");
02242 $this->ctrl->setParameter($this, "sortorder", $sortarray["title"]);
02243 $questiontitle = "<a href=\"" . $this->ctrl->getLinkTarget($this, "browseForQuestions") . "\">" . $this->lng->txt("title") . "</a>";
02244 $questiontitle .= $template->get();
02245 $questiontitle .= $table["images"]["title"];
02246 $this->tpl->setVariable("QUESTION_TITLE", $questiontitle);
02247 $this->ctrl->setParameter($this, "sort", "comment");
02248 $this->ctrl->setParameter($this, "sortorder", $sortarray["comment"]);
02249 $template = new ilTemplate("tpl.image.html", true, true);
02250 if (strlen($filter_comment))
02251 {
02252 $template->setVariable("IMAGE_SOURCE", ilUtil::getImagePath("search-filter-locked.png"));
02253 }
02254 else
02255 {
02256 $template->setVariable("IMAGE_SOURCE", ilUtil::getImagePath("search-filter.png"));
02257 }
02258 $template->setVariable("IMAGE_TITLE", $this->lng->txt("filter"));
02259 $template->setVariable("IMAGE_ALT", $this->lng->txt("filter"));
02260 $template->setVariable("ID", "commenttextfilter");
02261 $template->setVariable("STYLE", "visibility: hidden; cursor: pointer");
02262 $this->ctrl->setParameter($this, "sort", "comment");
02263 $this->ctrl->setParameter($this, "sortorder", $sortarray["comment"]);
02264 $questiontype = "<a href=\"" . $this->ctrl->getLinkTarget($this, "browseForQuestions") . "\">" . $this->lng->txt("description") . "</a>";
02265 $questiontype .= $template->get();
02266 $questiontype .= $table["images"]["comment"];
02267 $this->tpl->setVariable("QUESTION_COMMENT", $questiontype);
02268 $template = new ilTemplate("tpl.image.html", true, true);
02269 if (strlen($filter_question_type))
02270 {
02271 $template->setVariable("IMAGE_SOURCE", ilUtil::getImagePath("search-filter-locked.png"));
02272 }
02273 else
02274 {
02275 $template->setVariable("IMAGE_SOURCE", ilUtil::getImagePath("search-filter.png"));
02276 }
02277 $template->setVariable("IMAGE_TITLE", $this->lng->txt("filter"));
02278 $template->setVariable("IMAGE_ALT", $this->lng->txt("filter"));
02279 $template->setVariable("ID", "filter");
02280 $template->setVariable("STYLE", "visibility: hidden; cursor: pointer");
02281 $this->ctrl->setParameter($this, "sort", "type");
02282 $this->ctrl->setParameter($this, "sortorder", $sortarray["type"]);
02283 $questiontype = "<a href=\"" . $this->ctrl->getLinkTarget($this, "browseForQuestions") . "\">" . $this->lng->txt("question_type") . "</a>";
02284 $questiontype .= $template->get();
02285 $questiontype .= $table["images"]["type"];
02286 $this->tpl->setVariable("QUESTION_TYPE", $questiontype);
02287 $template = new ilTemplate("tpl.image.html", true, true);
02288 if (strlen($filter_author))
02289 {
02290 $template->setVariable("IMAGE_SOURCE", ilUtil::getImagePath("search-filter-locked.png"));
02291 }
02292 else
02293 {
02294 $template->setVariable("IMAGE_SOURCE", ilUtil::getImagePath("search-filter.png"));
02295 }
02296 $template->setVariable("IMAGE_TITLE", $this->lng->txt("filter"));
02297 $template->setVariable("IMAGE_ALT", $this->lng->txt("filter"));
02298 $template->setVariable("ID", "authortextfilter");
02299 $template->setVariable("STYLE", "visibility: hidden; cursor: pointer;");
02300 $this->ctrl->setParameter($this, "sort", "author");
02301 $this->ctrl->setParameter($this, "sortorder", $sortarray["author"]);
02302 $questiontype = "<a href=\"" . $this->ctrl->getLinkTarget($this, "browseForQuestions") . "\">" . $this->lng->txt("author") . "</a>";
02303 $questiontype .= $template->get();
02304 $questiontype .= $table["images"]["author"];
02305 $this->tpl->setVariable("QUESTION_AUTHOR", $questiontype);
02306 $this->ctrl->setParameter($this, "sort", "created");
02307 $this->ctrl->setParameter($this, "sortorder", $sortarray["created"]);
02308 $this->tpl->setVariable("QUESTION_CREATED", "<a href=\"" . $this->ctrl->getLinkTarget($this, "browseForQuestions") . "\">" . $this->lng->txt("create_date") . "</a>" . $table["images"]["created"]);
02309 $this->ctrl->setParameter($this, "sort", "updated");
02310 $this->ctrl->setParameter($this, "sortorder", $sortarray["updated"]);
02311 $this->tpl->setVariable("QUESTION_UPDATED", "<a href=\"" . $this->ctrl->getLinkTarget($this, "browseForQuestions") . "\">" . $this->lng->txt("last_update") . "</a>" . $table["images"]["updated"]);
02312 $template = new ilTemplate("tpl.image.html", true, true);
02313 if (strlen($filter_qpl))
02314 {
02315 $template->setVariable("IMAGE_SOURCE", ilUtil::getImagePath("search-filter-locked.png"));
02316 }
02317 else
02318 {
02319 $template->setVariable("IMAGE_SOURCE", ilUtil::getImagePath("search-filter.png"));
02320 }
02321 $template->setVariable("IMAGE_TITLE", $this->lng->txt("filter"));
02322 $template->setVariable("IMAGE_ALT", $this->lng->txt("filter"));
02323 $template->setVariable("ID", "qpltextfilter");
02324 $template->setVariable("STYLE", "visibility: hidden; cursor: pointer");
02325 $this->ctrl->setParameter($this, "sort", "qpl");
02326 $this->ctrl->setParameter($this, "sortorder", $sortarray["qpl"]);
02327 $qpfilter = "<a href=\"" . $this->ctrl->getLinkTarget($this, "browseForQuestions") . "\">" . $this->lng->txt("obj_qpl") . "</a>";
02328 $qpfilter .= $template->get();
02329 $qpfilter .= $table["images"]["qpl"];
02330 $this->tpl->setVariable("QUESTION_POOL", $qpfilter);
02331 $this->tpl->setVariable("BUTTON_BACK", $this->lng->txt("back"));
02332 $this->ctrl->setParameter($this, "sort", $sort);
02333 $this->ctrl->setParameter($this, "sortorder", $sortorder);
02334 $this->tpl->setVariable("ACTION_QUESTION_FORM", $this->ctrl->getFormAction($this));
02335 $this->tpl->parseCurrentBlock();
02336 }
02337
02346 function createQuestionPool($name = "dummy")
02347 {
02348 global $tree;
02349 $parent_ref = $tree->getParentId($this->object->getRefId());
02350 include_once "./Modules/TestQuestionPool/classes/class.ilObjQuestionPool.php";
02351 $qpl = new ilObjQuestionPool();
02352 $qpl->setType("qpl");
02353 $qpl->setTitle($name);
02354 $qpl->setDescription("");
02355 $qpl->create();
02356 $qpl->createReference();
02357 $qpl->putInTree($parent_ref);
02358 $qpl->setPermissions($parent_ref);
02359 $qpl->setOnline(1);
02360 $qpl->saveToDb();
02361 return $qpl->getRefId();
02362 }
02363
02371 function randomselectObject()
02372 {
02373 global $ilUser;
02374 $this->getQuestionsSubTabs();
02375 $this->tpl->addBlockFile("ADM_CONTENT", "adm_content", "tpl.il_as_tst_random_select.html", "Modules/Test");
02376 $questionpools =& $this->object->getAvailableQuestionpools(FALSE, FALSE, FALSE, TRUE);
02377 $this->tpl->setCurrentBlock("option");
02378 $this->tpl->setVariable("VALUE_OPTION", "0");
02379 $this->tpl->setVariable("TEXT_OPTION", $this->lng->txt("all_available_question_pools"));
02380 $this->tpl->parseCurrentBlock();
02381 foreach ($questionpools as $key => $value)
02382 {
02383 $this->tpl->setCurrentBlock("option");
02384 $this->tpl->setVariable("VALUE_OPTION", $key);
02385 $this->tpl->setVariable("TEXT_OPTION", $value["title"]);
02386 $this->tpl->parseCurrentBlock();
02387 }
02388 $this->tpl->setCurrentBlock("hidden");
02389 $this->tpl->setVariable("HIDDEN_NAME", "sel_question_types");
02390 $this->tpl->setVariable("HIDDEN_VALUE", $_POST["sel_question_types"]);
02391 $this->tpl->parseCurrentBlock();
02392 $this->tpl->setCurrentBlock("adm_content");
02393 $this->tpl->setVariable("FORM_ACTION", $this->ctrl->getFormAction($this));
02394 $this->tpl->setVariable("TXT_QPL_SELECT", $this->lng->txt("tst_random_select_questionpool"));
02395 $this->tpl->setVariable("TXT_NR_OF_QUESTIONS", $this->lng->txt("tst_random_nr_of_questions"));
02396 $this->tpl->setVariable("BTN_SUBMIT", $this->lng->txt("submit"));
02397 $this->tpl->setVariable("BTN_CANCEL", $this->lng->txt("cancel"));
02398 $this->tpl->parseCurrentBlock();
02399 }
02400
02408 function cancelRandomSelectObject()
02409 {
02410 $this->ctrl->redirect($this, "questions");
02411 }
02412
02420 function createRandomSelectionObject()
02421 {
02422 $this->getQuestionsSubTabs();
02423 $question_array = $this->object->randomSelectQuestions($_POST["nr_of_questions"], $_POST["sel_qpl"]);
02424 $this->tpl->addBlockFile("ADM_CONTENT", "adm_content", "tpl.il_as_tst_random_question_offer.html", "Modules/Test");
02425 $color_class = array("tblrow1", "tblrow2");
02426 $counter = 0;
02427 $questionpools =& $this->object->getAvailableQuestionpools(true);
02428 foreach ($question_array as $question_id)
02429 {
02430 $dataset = $this->object->getQuestionDataset($question_id);
02431 $this->tpl->setCurrentBlock("QTab");
02432 $this->tpl->setVariable("COLOR_CLASS", $color_class[$counter % 2]);
02433 $this->tpl->setVariable("QUESTION_TITLE", $dataset->title);
02434 $this->tpl->setVariable("QUESTION_COMMENT", $dataset->comment);
02435 $this->tpl->setVariable("QUESTION_TYPE", $this->lng->txt($dataset->type_tag));
02436 $this->tpl->setVariable("QUESTION_AUTHOR", $dataset->author);
02437 $this->tpl->setVariable("QUESTION_POOL", $questionpools[$dataset->obj_fi]["title"]);
02438 $this->tpl->parseCurrentBlock();
02439 $counter++;
02440 }
02441 if (count($question_array) == 0)
02442 {
02443 $this->tpl->setCurrentBlock("Emptytable");
02444 $this->tpl->setVariable("TEXT_NO_QUESTIONS_AVAILABLE", $this->lng->txt("no_questions_available"));
02445 $this->tpl->parseCurrentBlock();
02446 }
02447 else
02448 {
02449 $this->tpl->setCurrentBlock("Selectionbuttons");
02450 $this->tpl->setVariable("BTN_YES", $this->lng->txt("random_accept_sample"));
02451 $this->tpl->setVariable("BTN_NO", $this->lng->txt("random_another_sample"));
02452 $this->tpl->parseCurrentBlock();
02453 }
02454 $chosen_questions = join($question_array, ",");
02455 $this->tpl->setCurrentBlock("adm_content");
02456 $this->tpl->setVariable("FORM_ACTION", $this->ctrl->getFormAction($this));
02457 $this->tpl->setVariable("QUESTION_TITLE", $this->lng->txt("tst_question_title"));
02458 $this->tpl->setVariable("QUESTION_COMMENT", $this->lng->txt("description"));
02459 $this->tpl->setVariable("QUESTION_TYPE", $this->lng->txt("tst_question_type"));
02460 $this->tpl->setVariable("QUESTION_AUTHOR", $this->lng->txt("author"));
02461 $this->tpl->setVariable("QUESTION_POOL", $this->lng->txt("qpl"));
02462 $this->tpl->setVariable("VALUE_CHOSEN_QUESTIONS", $chosen_questions);
02463 $this->tpl->setVariable("VALUE_QUESTIONPOOL_SELECTION", $_POST["sel_qpl"]);
02464 $this->tpl->setVariable("VALUE_NR_OF_QUESTIONS", $_POST["nr_of_questions"]);
02465 $this->tpl->setVariable("TEXT_QUESTION_OFFER", $this->lng->txt("tst_question_offer"));
02466 $this->tpl->setVariable("BTN_CANCEL", $this->lng->txt("cancel"));
02467 $this->tpl->parseCurrentBlock();
02468 }
02469
02477 function insertRandomSelectionObject()
02478 {
02479 $selected_array = split(",", $_POST["chosen_questions"]);
02480 if (!count($selected_array))
02481 {
02482 ilUtil::sendInfo($this->lng->txt("tst_insert_missing_question"));
02483 }
02484 else
02485 {
02486 $total = $this->object->evalTotalPersons();
02487 if ($total)
02488 {
02489
02490 ilUtil::sendInfo(sprintf($this->lng->txt("tst_insert_questions_and_results"), $total));
02491 }
02492 else
02493 {
02494 ilUtil::sendInfo($this->lng->txt("tst_insert_questions"));
02495 }
02496 foreach ($selected_array as $key => $value)
02497 {
02498 $this->object->insertQuestion($value);
02499 }
02500 $this->object->saveCompleteStatus();
02501 ilUtil::sendInfo($this->lng->txt("tst_questions_inserted"), true);
02502 $this->ctrl->redirect($this, "questions");
02503 return;
02504 }
02505 }
02506
02507 function saveRandomQuestionsObject()
02508 {
02509 $this->randomQuestionsObject();
02510 }
02511
02512 function addQuestionpoolObject()
02513 {
02514 $this->randomQuestionsObject();
02515 }
02516
02517 function randomQuestionsObject()
02518 {
02519 global $ilUser;
02520 $selection_mode = $ilUser->getPref("tst_question_selection_mode_equal");
02521 $total = $this->object->evalTotalPersons();
02522 $available_qpl =& $this->object->getAvailableQuestionpools(TRUE, $selection_mode, FALSE, TRUE, TRUE);
02523 include_once "./Modules/TestQuestionPool/classes/class.ilObjQuestionPool.php";
02524 $qpl_question_count = array();
02525 foreach ($available_qpl as $key => $value)
02526 {
02527 if ($value["count"] > 0)
02528 {
02529 $qpl_question_count[$key] = $value["count"];
02530 }
02531 else
02532 {
02533 unset($available_qpl[$key]);
02534 }
02535 }
02536 $this->tpl->addBlockFile("ADM_CONTENT", "adm_content", "tpl.il_as_tst_random_questions.html", "Modules/Test");
02537 $found_qpls = array();
02538 if (count($_POST) == 0)
02539 {
02540 $found_qpls = $this->object->getRandomQuestionpools();
02541 }
02542 $qpl_unselected = 0;
02543 foreach ($_POST as $key => $value)
02544 {
02545 if (preg_match("/countqpl_(\d+)/", $key, $matches))
02546 {
02547 $questioncount = $qpl_question_count[$_POST["qpl_" . $matches[1]]];
02548 if ((strlen($questioncount) > 0) && ($value > $questioncount))
02549 {
02550 $value = $questioncount;
02551 ilUtil::sendInfo($this->lng->txt("tst_random_selection_question_count_too_high"));
02552 }
02553 $found_qpls[$matches[1]] = array(
02554 "index" => $matches[1],
02555 "count" => sprintf("%d", $value),
02556 "qpl" => $_POST["qpl_" . $matches[1]],
02557 "title" => $available_qpl[$_POST["qpl_" . $matches[1]]]["title"]
02558 );
02559 if ($_POST["qpl_" . $matches[1]] == -1)
02560 {
02561 $qpl_unselected = 1;
02562 }
02563 }
02564 }
02565 $commands = $_POST["cmd"];
02566 if (is_array($commands))
02567 {
02568 foreach ($commands as $key => $value)
02569 {
02570 if (preg_match("/deleteqpl_(\d+)/", $key, $matches))
02571 {
02572 unset($found_qpls[$matches[1]]);
02573 }
02574 }
02575 }
02576 sort($found_qpls);
02577 $found_qpls = array_values($found_qpls);
02578 if (count($found_qpls) == 0)
02579 {
02580 foreach ($available_qpl as $key => $value)
02581 {
02582 $this->tpl->setCurrentBlock("qpl_value");
02583 $this->tpl->setVariable("QPL_ID", $key);
02584 $this->tpl->setVariable("QPL_TEXT", $value["title"]);
02585 $this->tpl->parseCurrentBlock();
02586 }
02587 $this->tpl->setCurrentBlock("questionpool_row");
02588 $this->tpl->setVariable("COUNTQPL", "0");
02589 $this->tpl->setVariable("VALUE_COUNTQPL", $_POST["countqpl_0"]);
02590 $this->tpl->setVariable("TEXT_SELECT_QUESTIONPOOL", $this->lng->txt("select_questionpool_option"));
02591 $this->tpl->setVariable("TEXT_QUESTIONS_FROM", $this->lng->txt("questions_from"));
02592 $this->tpl->setVariable("BTNCOUNTQPL", 0);
02593 $this->tpl->setVariable("BTN_DELETE", $this->lng->txt("delete"));
02594 $this->tpl->parseCurrentBlock();
02595 }
02596 $counter = 0;
02597 foreach ($found_qpls as $key => $value)
02598 {
02599 $pools = $available_qpl;
02600 foreach ($found_qpls as $pkey => $pvalue)
02601 {
02602 if ($pvalue["qpl"] != $value["qpl"])
02603 {
02604 unset($pools[$pvalue["qpl"]]);
02605 }
02606 }
02607
02608 foreach ($pools as $pkey => $pvalue)
02609 {
02610 $this->tpl->setCurrentBlock("qpl_value");
02611 $this->tpl->setVariable("QPL_ID", $pkey);
02612 $this->tpl->setVariable("QPL_TEXT", $pvalue["title"]);
02613 if ($pkey == $value["qpl"])
02614 {
02615 $this->tpl->setVariable("SELECTED_QPL", " selected=\"selected\"");
02616 }
02617 $this->tpl->parseCurrentBlock();
02618 }
02619 $this->tpl->setCurrentBlock("questionpool_row");
02620 $this->tpl->setVariable("COUNTQPL", $counter);
02621 $this->tpl->setVariable("VALUE_COUNTQPL", $value["count"]);
02622 $this->tpl->setVariable("TEXT_SELECT_QUESTIONPOOL", $this->lng->txt("select_questionpool_option"));
02623 $this->tpl->setVariable("TEXT_QUESTIONS_FROM", $this->lng->txt("questions_from"));
02624 $this->tpl->setVariable("BTNCOUNTQPL", $counter);
02625 $this->tpl->setVariable("BTN_DELETE", $this->lng->txt("delete"));
02626 $this->tpl->parseCurrentBlock();
02627 $counter++;
02628 }
02629 if ($_POST["cmd"]["addQuestionpool"])
02630 {
02631 if ($qpl_unselected)
02632 {
02633 ilUtil::sendInfo($this->lng->txt("tst_random_qpl_unselected"));
02634 }
02635 else
02636 {
02637 $pools = $available_qpl;
02638 foreach ($found_qpls as $pkey => $pvalue)
02639 {
02640 unset($pools[$pvalue["qpl"]]);
02641 }
02642 if (count($pools) == 0)
02643 {
02644 ilUtil::sendInfo($this->lng->txt("tst_no_more_available_questionpools"));
02645 }
02646 else
02647 {
02648 foreach ($pools as $key => $value)
02649 {
02650 $this->tpl->setCurrentBlock("qpl_value");
02651 $this->tpl->setVariable("QPL_ID", $key);
02652 $this->tpl->setVariable("QPL_TEXT", $value["title"]);
02653 $this->tpl->parseCurrentBlock();
02654 }
02655 $this->tpl->setCurrentBlock("questionpool_row");
02656 $this->tpl->setVariable("COUNTQPL", "$counter");
02657 $this->tpl->setVariable("TEXT_SELECT_QUESTIONPOOL", $this->lng->txt("select_questionpool_option"));
02658 $this->tpl->setVariable("TEXT_QUESTIONS_FROM", $this->lng->txt("questions_from"));
02659 $this->tpl->setVariable("BTNCOUNTQPL", $counter);
02660 $this->tpl->setVariable("BTN_DELETE", $this->lng->txt("delete"));
02661 $this->tpl->parseCurrentBlock();
02662 }
02663 }
02664 }
02665 if ($_POST["cmd"]["saveRandomQuestions"])
02666 {
02667 $this->object->saveRandomQuestionCount($_POST["total_questions"]);
02668 $this->object->saveRandomQuestionpools($found_qpls);
02669 $this->object->saveCompleteStatus();
02670 }
02671 $this->tpl->setCurrentBlock("adm_content");
02672 $this->tpl->setVariable("TEXT_SELECT_RANDOM_QUESTIONS", $this->lng->txt("tst_select_random_questions"));
02673 $this->tpl->setVariable("TEXT_TOTAL_QUESTIONS", $this->lng->txt("tst_total_questions"));
02674 $this->tpl->setVariable("TEXT_TOTAL_QUESTIONS_DESCRIPTION", $this->lng->txt("tst_total_questions_description"));
02675 $total_questions = $this->object->getRandomQuestionCount();
02676 if (array_key_exists("total_questions", $_POST))
02677 {
02678 $total_questions = $_POST["total_questions"];
02679 }
02680 if ($total_questions > 0)
02681 {
02682 $sum = 0;
02683 foreach ($found_qpls as $key => $value)
02684 {
02685 $sum += $qpl_question_count[$value["qpl"]];
02686 }
02687 if ($total_questions > $sum)
02688 {
02689 $total_questions = $sum;
02690 if ($_POST["cmd"]["saveRandomQuestions"])
02691 {
02692 $this->object->saveRandomQuestionCount($total_questions);
02693 }
02694 ilUtil::sendInfo($this->lng->txt("tst_random_selection_question_total_count_too_high"));
02695 }
02696 }
02697 $this->tpl->setVariable("VALUE_TOTAL_QUESTIONS", $total_questions);
02698 $this->tpl->setVariable("TEXT_QUESTIONPOOLS", $this->lng->txt("tst_random_questionpools"));
02699 if (!$total)
02700 {
02701 $this->tpl->setVariable("BTN_SAVE", $this->lng->txt("save"));
02702 $this->tpl->setVariable("BTN_ADD_QUESTIONPOOL", $this->lng->txt("add_questionpool"));
02703 }
02704 $this->tpl->setVariable("FORM_ACTION", $this->ctrl->getFormAction($this));
02705
02706 $this->tpl->setVariable("TEXT_QUESTION_SELECTION", $this->lng->txt("tst_question_selection"));
02707 $this->tpl->setVariable("VALUE_QUESTION_SELECTION", $this->lng->txt("tst_question_selection_equal"));
02708 $this->tpl->setVariable("CMD_QUESTION_SELECTION", "setEqualQplSelection");
02709 $this->tpl->setVariable("TEXT_QUESTION_SELECTION_DESCRIPTION", $this->lng->txt("tst_question_selection_description"));
02710 $this->tpl->setVariable("BUTTON_SAVE", $this->lng->txt("change"));
02711 if ($selection_mode == 1)
02712 {
02713 $this->tpl->setVariable("CHECKED_QUESTION_SELECTION_MODE", " checked=\"checked\"");
02714 }
02715 $this->tpl->parseCurrentBlock();
02716 }
02717
02718 function saveQuestionSelectionModeObject()
02719 {
02720 global $ilUser;
02721 if ($_POST["chbQuestionSelectionMode"])
02722 {
02723 $ilUser->setPref("tst_question_selection_mode_equal", 1);
02724 $ilUser->writePref("tst_question_selection_mode_equal", 1);
02725 }
02726 else
02727 {
02728 $ilUser->setPref("tst_question_selection_mode_equal", 0);
02729 $ilUser->writePref("tst_question_selection_mode_equal", 0);
02730 }
02731 $this->randomQuestionsObject();
02732 }
02733
02734 function browseForQuestionsObject()
02735 {
02736 $this->questionBrowser();
02737 }
02738
02746 function executeCreateQuestionObject()
02747 {
02748 $qpl_ref_id = $_POST["sel_qpl"];
02749 if ((strcmp($_POST["txt_qpl"], "") == 0) && (strcmp($qpl_ref_id, "") == 0))
02750 {
02751 ilUtil::sendInfo($this->lng->txt("questionpool_not_entered"));
02752 $this->createQuestionObject();
02753 return;
02754 }
02755 else
02756 {
02757 $_SESSION["test_id"] = $this->object->getRefId();
02758 if (strcmp($_POST["txt_qpl"], "") != 0)
02759 {
02760
02761 $qpl_ref_id = $this->createQuestionPool($_POST["txt_qpl"]);
02762 }
02763 include_once "./Modules/TestQuestionPool/classes/class.ilObjQuestionPoolGUI.php";
02764 ilUtil::redirect("ilias.php?baseClass=ilObjQuestionPoolGUI&ref_id=" . $qpl_ref_id . "&cmd=createQuestionForTest&test_ref_id=".$_GET["ref_id"]."&sel_question_types=" . $_POST["sel_question_types"]);
02765 exit();
02766 }
02767 }
02768
02776 function cancelCreateQuestionObject()
02777 {
02778 $this->ctrl->redirect($this, "questions");
02779 }
02780
02788 function createQuestionObject()
02789 {
02790 global $ilUser;
02791 $this->getQuestionsSubTabs();
02792 $this->tpl->addBlockFile("ADM_CONTENT", "adm_content", "tpl.il_as_tst_qpl_select.html", "Modules/Test");
02793 $questionpools =& $this->object->getAvailableQuestionpools(FALSE, FALSE, FALSE, TRUE, FALSE, "write");
02794 if (count($questionpools) == 0)
02795 {
02796 $this->tpl->setCurrentBlock("option");
02797 $this->tpl->setVariable("VALUE_QPL", "");
02798 $this->tpl->parseCurrentBlock();
02799 }
02800 else
02801 {
02802 foreach ($questionpools as $key => $value)
02803 {
02804 $this->tpl->setCurrentBlock("option");
02805 $this->tpl->setVariable("VALUE_OPTION", $key);
02806 $this->tpl->setVariable("TEXT_OPTION", $value["title"]);
02807 $this->tpl->parseCurrentBlock();
02808 }
02809 }
02810 $this->tpl->setCurrentBlock("hidden");
02811 $this->tpl->setVariable("HIDDEN_NAME", "sel_question_types");
02812 $this->tpl->setVariable("HIDDEN_VALUE", $_POST["sel_question_types"]);
02813 $this->tpl->parseCurrentBlock();
02814 $this->tpl->setCurrentBlock("adm_content");
02815 $this->tpl->setVariable("FORM_ACTION", $this->ctrl->getFormAction($this));
02816
02817 if (count($questionpools) == 0)
02818 {
02819 $this->tpl->setVariable("TXT_QPL_SELECT", $this->lng->txt("tst_enter_questionpool"));
02820 }
02821 else
02822 {
02823 $this->tpl->setVariable("TXT_QPL_SELECT", $this->lng->txt("tst_select_questionpool"));
02824 }
02825 $this->tpl->setVariable("BTN_SUBMIT", $this->lng->txt("submit"));
02826 $this->tpl->setVariable("BTN_CANCEL", $this->lng->txt("cancel"));
02827 $this->tpl->parseCurrentBlock();
02828 }
02829
02837 function confirmRemoveQuestionsObject()
02838 {
02839 ilUtil::sendInfo($this->lng->txt("tst_questions_removed"));
02840 $checked_questions = array();
02841 foreach ($_POST as $key => $value) {
02842 if (preg_match("/id_(\d+)/", $key, $matches)) {
02843 array_push($checked_questions, $matches[1]);
02844 }
02845 }
02846 foreach ($checked_questions as $key => $value) {
02847 $this->object->removeQuestion($value);
02848 }
02849 $this->object->saveCompleteStatus();
02850 $this->ctrl->redirect($this, "questions");
02851 }
02852
02860 function cancelRemoveQuestionsObject()
02861 {
02862 $this->ctrl->redirect($this, "questions");
02863 }
02864
02872 function removeQuestionsForm($checked_questions)
02873 {
02874 ilUtil::sendInfo();
02875 $this->tpl->addBlockFile("ADM_CONTENT", "adm_content", "tpl.il_as_tst_remove_questions.html", "Modules/Test");
02876 $removablequestions =& $this->object->getTestQuestions();
02877 $colors = array("tblrow1", "tblrow2");
02878 $counter = 0;
02879 if (count($removablequestions))
02880 {
02881 foreach ($removablequestions as $data)
02882 {
02883 if (in_array($data["question_id"], $checked_questions))
02884 {
02885 $this->tpl->setCurrentBlock("row");
02886 $this->tpl->setVariable("COLOR_CLASS", $colors[$counter % 2]);
02887 $this->tpl->setVariable("TXT_TITLE", $data["title"]);
02888 $this->tpl->setVariable("TXT_DESCRIPTION", $data["comment"]);
02889 $this->tpl->setVariable("TXT_TYPE", $this->lng->txt($data["type_tag"]));
02890 $this->tpl->parseCurrentBlock();
02891 $counter++;
02892 }
02893 }
02894 }
02895 foreach ($checked_questions as $id)
02896 {
02897 $this->tpl->setCurrentBlock("hidden");
02898 $this->tpl->setVariable("HIDDEN_NAME", "id_$id");
02899 $this->tpl->setVariable("HIDDEN_VALUE", "1");
02900 $this->tpl->parseCurrentBlock();
02901 }
02902
02903 $this->tpl->setCurrentBlock("adm_content");
02904 $this->tpl->setVariable("TXT_TITLE", $this->lng->txt("tst_question_title"));
02905 $this->tpl->setVariable("TXT_DESCRIPTION", $this->lng->txt("description"));
02906 $this->tpl->setVariable("TXT_TYPE", $this->lng->txt("tst_question_type"));
02907 $this->tpl->setVariable("BTN_CONFIRM", $this->lng->txt("confirm"));
02908 $this->tpl->setVariable("BTN_CANCEL", $this->lng->txt("cancel"));
02909 $this->tpl->setVariable("FORM_ACTION", $this->ctrl->getFormAction($this));
02910 $this->tpl->parseCurrentBlock();
02911 }
02912
02920 function removeQuestionsObject()
02921 {
02922 $this->getQuestionsSubTabs();
02923 $checked_questions = array();
02924 foreach ($_POST as $key => $value) {
02925 if (preg_match("/cb_(\d+)/", $key, $matches)) {
02926 array_push($checked_questions, $matches[1]);
02927 }
02928 }
02929 if (count($checked_questions) > 0) {
02930 $total = $this->object->evalTotalPersons();
02931 if ($total) {
02932
02933 ilUtil::sendInfo(sprintf($this->lng->txt("tst_remove_questions_and_results"), $total));
02934 } else {
02935 ilUtil::sendInfo($this->lng->txt("tst_remove_questions"));
02936 }
02937 $this->removeQuestionsForm($checked_questions);
02938 return;
02939 } elseif (count($checked_questions) == 0) {
02940 ilUtil::sendInfo($this->lng->txt("tst_no_question_selected_for_removal"), true);
02941 $this->ctrl->redirect($this, "questions");
02942 }
02943 }
02944
02952 function moveQuestionsObject()
02953 {
02954 $this->questionsObject();
02955 }
02956
02964 function insertQuestionsBeforeObject()
02965 {
02966
02967 $move_questions = array();
02968 foreach ($_POST as $key => $value)
02969 {
02970 if (preg_match("/^move_(\d+)$/", $key, $matches))
02971 {
02972 array_push($move_questions, $value);
02973 }
02974 }
02975
02976 $insert_id = -1;
02977 foreach ($_POST as $key => $value)
02978 {
02979 if (preg_match("/^cb_(\d+)$/", $key, $matches))
02980 {
02981 if ($insert_id < 0)
02982 {
02983 $insert_id = $matches[1];
02984 }
02985 }
02986 }
02987 if ($insert_id <= 0)
02988 {
02989 ilUtil::sendInfo($this->lng->txt("no_target_selected_for_move"), true);
02990 }
02991 else
02992 {
02993 $insert_mode = 0;
02994 $this->object->moveQuestions($move_questions, $insert_id, $insert_mode);
02995 }
02996 $this->ctrl->redirect($this, "questions");
02997 }
02998
03006 function insertQuestionsAfterObject()
03007 {
03008
03009 $move_questions = array();
03010 foreach ($_POST as $key => $value)
03011 {
03012 if (preg_match("/^move_(\d+)$/", $key, $matches))
03013 {
03014 array_push($move_questions, $value);
03015 }
03016 }
03017
03018 $insert_id = -1;
03019 foreach ($_POST as $key => $value)
03020 {
03021 if (preg_match("/^cb_(\d+)$/", $key, $matches))
03022 {
03023 if ($insert_id < 0)
03024 {
03025 $insert_id = $matches[1];
03026 }
03027 }
03028 }
03029 if ($insert_id <= 0)
03030 {
03031 ilUtil::sendInfo($this->lng->txt("no_target_selected_for_move"), true);
03032 }
03033 else
03034 {
03035 $insert_mode = 1;
03036 $this->object->moveQuestions($move_questions, $insert_id, $insert_mode);
03037 }
03038 $this->ctrl->redirect($this, "questions");
03039 }
03040
03041 function questionsObject()
03042 {
03043 global $ilAccess;
03044 if (!$ilAccess->checkAccess("write", "", $this->ref_id))
03045 {
03046
03047 ilUtil::sendInfo($this->lng->txt("cannot_edit_test"), true);
03048 $this->ctrl->redirect($this, "infoScreen");
03049 }
03050
03051 $this->getQuestionsSubTabs();
03052 if ($this->object->isRandomTest())
03053 {
03054 $this->randomQuestionsObject();
03055 return;
03056 }
03057
03058 if ($_GET["eqid"] and $_GET["eqpl"])
03059 {
03060 ilUtil::redirect("ilias.php?baseClass=ilObjQuestionPoolGUI&ref_id=" . $_GET["eqpl"] . "&cmd=editQuestionForTest&calling_test=".$_GET["ref_id"]."&q_id=" . $_GET["eqid"]);
03061 }
03062
03063 if ($_GET["up"] > 0)
03064 {
03065 $this->object->questionMoveUp($_GET["up"]);
03066 }
03067 if ($_GET["down"] > 0)
03068 {
03069 $this->object->questionMoveDown($_GET["down"]);
03070 }
03071
03072 if ($_GET["add"])
03073 {
03074 $selected_array = array();
03075 array_push($selected_array, $_GET["add"]);
03076 $total = $this->object->evalTotalPersons();
03077 if ($total)
03078 {
03079
03080 ilUtil::sendInfo(sprintf($this->lng->txt("tst_insert_questions_and_results"), $total));
03081 }
03082 else
03083 {
03084 ilUtil::sendInfo($this->lng->txt("tst_insert_questions"));
03085 }
03086 $this->insertQuestions($selected_array);
03087 return;
03088 }
03089
03090 $this->tpl->addBlockFile("ADM_CONTENT", "adm_content", "tpl.il_as_tst_questions.html", "Modules/Test");
03091 $this->tpl->addBlockFile("A_BUTTONS", "question_buttons", "tpl.il_as_tst_question_buttons.html", "Modules/Test");
03092
03093 if (strcmp($this->ctrl->getCmd(), "moveQuestions") == 0)
03094 {
03095 $checked_move = 0;
03096 foreach ($_POST as $key => $value)
03097 {
03098 if (preg_match("/cb_(\d+)/", $key, $matches))
03099 {
03100 $checked_move++;
03101 $this->tpl->setCurrentBlock("move");
03102 $this->tpl->setVariable("MOVE_COUNTER", $matches[1]);
03103 $this->tpl->setVariable("MOVE_VALUE", $matches[1]);
03104 $this->tpl->parseCurrentBlock();
03105 }
03106 }
03107 if ($checked_move)
03108 {
03109 ilUtil::sendInfo($this->lng->txt("select_target_position_for_move_question"));
03110 $this->tpl->setCurrentBlock("move_buttons");
03111 $this->tpl->setVariable("INSERT_BEFORE", $this->lng->txt("insert_before"));
03112 $this->tpl->setVariable("INSERT_AFTER", $this->lng->txt("insert_after"));
03113 $this->tpl->parseCurrentBlock();
03114 }
03115 else
03116 {
03117 ilUtil::sendInfo($this->lng->txt("no_question_selected_for_move"));
03118 }
03119 }
03120
03121 $testquestions =& $this->object->getTestQuestions();
03122 $colors = array("tblrow1", "tblrow2");
03123 $counter = 0;
03124 $questionpools = array();
03125 $total_points = 0;
03126 $total = $this->object->evalTotalPersons();
03127 if (count($testquestions) > 0)
03128 {
03129 foreach ($testquestions as $data)
03130 {
03131 if (!array_key_exists($data->obj_fi, $questionpools))
03132 {
03133 $pooltitle = $this->object->_lookupTitle($data["obj_fi"]);
03134 $questionpools[$data["obj_fi"]] = $pooltitle;
03135 }
03136 $this->tpl->setCurrentBlock("QTab");
03137 $this->tpl->setVariable("QUESTION_ID", $data["question_id"]);
03138 if (($ilAccess->checkAccess("write", "", $this->ref_id) and ($total == 0)))
03139 {
03140 $q_id = $data["question_id"];
03141 $qpl_ref_id = $this->object->_getRefIdFromObjId($data["obj_fi"]);
03142 $this->tpl->setVariable("QUESTION_TITLE", "<a href=\"" . $this->ctrl->getLinkTarget($this, "questions") . "&eqid=$q_id&eqpl=$qpl_ref_id" . "\">" . $data["title"] . "</a>");
03143 } else {
03144 $this->tpl->setVariable("QUESTION_TITLE", $data["title"]);
03145 }
03146 $this->tpl->setVariable("QUESTION_SEQUENCE", $this->lng->txt("tst_sequence"));
03147
03148 if (($ilAccess->checkAccess("write", "", $this->ref_id) and ($total == 0)))
03149 {
03150 if ($data["question_id"] != $this->object->questions[1])
03151 {
03152 $this->tpl->setVariable("BUTTON_UP", "<a href=\"" . $this->ctrl->getLinkTarget($this, "questions") . "&up=".$data["question_id"]."\"><img src=\"" . ilUtil::getImagePath("a_up.gif") . "\" alt=\"" . $this->lng->txt("up") . "\" border=\"0\" /></a>");
03153 }
03154 if ($data["question_id"] != $this->object->questions[count($this->object->questions)])
03155 {
03156 $this->tpl->setVariable("BUTTON_DOWN", "<a href=\"" . $this->ctrl->getLinkTarget($this, "questions") . "&down=".$data["question_id"]."\"><img src=\"" . ilUtil::getImagePath("a_down.gif") . "\" alt=\"" . $this->lng->txt("down") . "\" border=\"0\" /></a>");
03157 }
03158 }
03159 $this->tpl->setVariable("QUESTION_COMMENT", $data["comment"]);
03160 $this->tpl->setVariable("QUESTION_TYPE", $this->lng->txt($data["type_tag"]));
03161 $this->tpl->setVariable("QUESTION_POINTS", $data["points"]);
03162 $total_points += $data["points"];
03163 $this->tpl->setVariable("QUESTION_AUTHOR", $data["author"]);
03164 $this->tpl->setVariable("QUESTION_POOL", $questionpools[$data["obj_fi"]]);
03165 $this->tpl->setVariable("COLOR_CLASS", $colors[$counter % 2]);
03166 $this->tpl->parseCurrentBlock();
03167 $counter++;
03168 }
03169 }
03170 if ($counter == 0)
03171 {
03172 $this->tpl->setCurrentBlock("Emptytable");
03173 $this->tpl->setVariable("TEXT_EMPTYTABLE", $this->lng->txt("tst_no_questions_available"));
03174 $this->tpl->parseCurrentBlock();
03175 }
03176 else
03177 {
03178 if (($ilAccess->checkAccess("write", "", $this->ref_id) and ($total == 0)))
03179 {
03180 $this->tpl->setCurrentBlock("selectall");
03181 $this->tpl->setVariable("SELECT_ALL", $this->lng->txt("select_all"));
03182 $counter++;
03183 $this->tpl->setVariable("COLOR_CLASS", $colors[$counter % 2]);
03184 $this->tpl->setVariable("TOTAL_POINTS", $total_points);
03185 $this->tpl->parseCurrentBlock();
03186 $this->tpl->setCurrentBlock("QFooter");
03187 $this->tpl->setVariable("ARROW", "<img src=\"" . ilUtil::getImagePath("arrow_downright.gif") . "\" alt=\"".$this->lng->txt("arrow_downright")."\"/>");
03188 $this->tpl->setVariable("REMOVE", $this->lng->txt("remove_question"));
03189 $this->tpl->setVariable("MOVE", $this->lng->txt("move"));
03190 $this->tpl->parseCurrentBlock();
03191 }
03192 }
03193
03194 if (($ilAccess->checkAccess("write", "", $this->ref_id) and ($total == 0)))
03195 {
03196 global $ilUser;
03197 $lastquestiontype = $ilUser->getPref("tst_lastquestiontype");
03198 $this->tpl->setCurrentBlock("QTypes");
03199 include_once "./Modules/TestQuestionPool/classes/class.ilObjQuestionPool.php";
03200 $question_types =& ilObjQuestionPool::_getQuestionTypes();
03201 foreach ($question_types as $data)
03202 {
03203 if ($data["type_tag"] == $lastquestiontype)
03204 {
03205 $this->tpl->setVariable("QUESTION_TYPE_SELECTED", " selected=\"selected\"");
03206 }
03207 $this->tpl->setVariable("QUESTION_TYPE_ID", $data["type_tag"]);
03208 $this->tpl->setVariable("QUESTION_TYPE", $this->lng->txt($data["type_tag"]));
03209 $this->tpl->parseCurrentBlock();
03210 }
03211 $this->tpl->parseCurrentBlock();
03212 }
03213 $this->tpl->setCurrentBlock("adm_content");
03214 $this->tpl->setVariable("ACTION_QUESTION_FORM", $this->ctrl->getFormAction($this));
03215 $this->tpl->setVariable("QUESTION_TITLE", $this->lng->txt("tst_question_title"));
03216 $this->tpl->setVariable("QUESTION_COMMENT", $this->lng->txt("description"));
03217 $this->tpl->setVariable("QUESTION_TYPE", $this->lng->txt("tst_question_type"));
03218 $this->tpl->setVariable("QUESTION_POINTS", $this->lng->txt("points"));
03219 $this->tpl->setVariable("QUESTION_AUTHOR", $this->lng->txt("author"));
03220 $this->tpl->setVariable("QUESTION_POOL", $this->lng->txt("qpl"));
03221
03222 if (($ilAccess->checkAccess("write", "", $this->ref_id) and ($total == 0)))
03223 {
03224 $this->tpl->setVariable("BUTTON_INSERT_QUESTION", $this->lng->txt("tst_browse_for_questions"));
03225 $this->tpl->setVariable("TEXT_CREATE_NEW", " " . strtolower($this->lng->txt("or")) . " " . $this->lng->txt("create_new"));
03226 $this->tpl->setVariable("BUTTON_CREATE_QUESTION", $this->lng->txt("create"));
03227 $this->tpl->setVariable("TXT_OR", $this->lng->txt("or"));
03228 $this->tpl->setVariable("TEXT_RANDOM_SELECT", $this->lng->txt("random_selection"));
03229 }
03230
03231 $this->tpl->parseCurrentBlock();
03232 }
03233
03234 function takenObject() {
03235 }
03236
03244 function addMarkStepObject()
03245 {
03246 $this->saveMarkSchemaFormData();
03247 $this->object->mark_schema->addMarkStep();
03248 $this->marksObject();
03249 }
03250
03258 function saveMarkSchemaFormData()
03259 {
03260 $this->object->mark_schema->flush();
03261 foreach ($_POST as $key => $value) {
03262 if (preg_match("/mark_short_(\d+)/", $key, $matches))
03263 {
03264 $this->object->mark_schema->addMarkStep($_POST["mark_short_$matches[1]"], $_POST["mark_official_$matches[1]"], $_POST["mark_percentage_$matches[1]"], $_POST["passed_$matches[1]"]);
03265 }
03266 }
03267 $this->object->ects_grades["A"] = $_POST["ects_grade_a"];
03268 $this->object->ects_grades["B"] = $_POST["ects_grade_b"];
03269 $this->object->ects_grades["C"] = $_POST["ects_grade_c"];
03270 $this->object->ects_grades["D"] = $_POST["ects_grade_d"];
03271 $this->object->ects_grades["E"] = $_POST["ects_grade_e"];
03272 if ($_POST["chbUseFX"])
03273 {
03274 $this->object->ects_fx = $_POST["percentFX"];
03275 }
03276 else
03277 {
03278 $this->object->ects_fx = "";
03279 }
03280 $this->object->ects_output = $_POST["chbECTS"];
03281 }
03282
03290 function addSimpleMarkSchemaObject()
03291 {
03292 $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);
03293 $this->marksObject();
03294 }
03295
03303 function deleteMarkStepsObject()
03304 {
03305 $this->saveMarkSchemaFormData();
03306 $delete_mark_steps = array();
03307 foreach ($_POST as $key => $value) {
03308 if (preg_match("/cb_(\d+)/", $key, $matches)) {
03309 array_push($delete_mark_steps, $matches[1]);
03310 }
03311 }
03312 if (count($delete_mark_steps)) {
03313 $this->object->mark_schema->deleteMarkSteps($delete_mark_steps);
03314 } else {
03315 ilUtil::sendInfo($this->lng->txt("tst_delete_missing_mark"));
03316 }
03317 $this->marksObject();
03318 }
03319
03327 function cancelMarksObject()
03328 {
03329 ilUtil::sendInfo($this->lng->txt("msg_cancel"), true);
03330 $this->ctrl->redirect($this, "marks");
03331 }
03332
03340 function saveMarksObject()
03341 {
03342 $this->saveMarkSchemaFormData();
03343
03344 $mark_check = $this->object->checkMarks();
03345 if ($mark_check !== true)
03346 {
03347 ilUtil::sendInfo($this->lng->txt($mark_check));
03348 }
03349 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)))
03350 {
03351 ilUtil::sendInfo($this->lng->txt("ects_fill_out_all_values"), true);
03352 }
03353 elseif (($_POST["ects_grade_a"] > 100) or ($_POST["ects_grade_a"] < 0))
03354 {
03355 ilUtil::sendInfo($this->lng->txt("ects_range_error_a"), true);
03356 }
03357 elseif (($_POST["ects_grade_b"] > 100) or ($_POST["ects_grade_b"] < 0))
03358 {
03359 ilUtil::sendInfo($this->lng->txt("ects_range_error_b"), true);
03360 }
03361 elseif (($_POST["ects_grade_c"] > 100) or ($_POST["ects_grade_c"] < 0))
03362 {
03363 ilUtil::sendInfo($this->lng->txt("ects_range_error_c"), true);
03364 }
03365 elseif (($_POST["ects_grade_d"] > 100) or ($_POST["ects_grade_d"] < 0))
03366 {
03367 ilUtil::sendInfo($this->lng->txt("ects_range_error_d"), true);
03368 }
03369 elseif (($_POST["ects_grade_e"] > 100) or ($_POST["ects_grade_e"] < 0))
03370 {
03371 ilUtil::sendInfo($this->lng->txt("ects_range_error_e"), true);
03372 }
03373 else
03374 {
03375 $this->object->mark_schema->saveToDb($this->object->getTestId());
03376 $this->object->saveCompleteStatus();
03377 if ($this->object->getReportingDate())
03378 {
03379 $fxpercent = "";
03380 if ($_POST["chbUseFX"])
03381 {
03382 $fxpercent = ilUtil::stripSlashes($_POST["percentFX"]);
03383 }
03384 $this->object->saveECTSStatus($_POST["chbECTS"], $fxpercent, $this->object->ects_grades["A"], $this->object->ects_grades["B"], $this->object->ects_grades["C"], $this->object->ects_grades["D"], $this->object->ects_grades["E"]);
03385 }
03386 ilUtil::sendInfo($this->lng->txt("msg_obj_modified"), true);
03387 }
03388 $this->marksObject();
03389 }
03390
03391 function marksObject()
03392 {
03393 global $ilAccess;
03394 if (!$ilAccess->checkAccess("write", "", $this->ref_id))
03395 {
03396
03397 ilUtil::sendInfo($this->lng->txt("cannot_edit_test"), true);
03398 $this->ctrl->redirect($this, "infoScreen");
03399 }
03400
03401 if (!$this->object->canEditMarks())
03402 {
03403 ilUtil::sendInfo($this->lng->txt("cannot_edit_marks"));
03404 }
03405
03406 $this->object->mark_schema->sort();
03407
03408 $this->tpl->addBlockFile("ADM_CONTENT", "adm_content", "tpl.il_as_tst_marks.html", "Modules/Test");
03409 $marks = $this->object->mark_schema->mark_steps;
03410 $rows = array("tblrow1", "tblrow2");
03411 $counter = 0;
03412 foreach ($marks as $key => $value) {
03413 $this->tpl->setCurrentBlock("markrow");
03414 $this->tpl->setVariable("MARK_SHORT", $value->getShortName());
03415 $this->tpl->setVariable("MARK_OFFICIAL", $value->getOfficialName());
03416 $this->tpl->setVariable("MARK_PERCENTAGE", sprintf("%.2f", $value->getMinimumLevel()));
03417 $this->tpl->setVariable("MARK_PASSED", strtolower($this->lng->txt("tst_mark_passed")));
03418 $this->tpl->setVariable("MARK_ID", "$key");
03419 $this->tpl->setVariable("ROW_CLASS", $rows[$counter % 2]);
03420 if ($value->getPassed()) {
03421 $this->tpl->setVariable("MARK_PASSED_CHECKED", " checked=\"checked\"");
03422 }
03423 $this->tpl->parseCurrentBlock();
03424 $counter++;
03425 }
03426 if (count($marks) == 0)
03427 {
03428 $this->tpl->setCurrentBlock("Emptyrow");
03429 $this->tpl->setVariable("EMPTY_ROW", $this->lng->txt("tst_no_marks_defined"));
03430 $this->tpl->setVariable("ROW_CLASS", $rows[$counter % 2]);
03431 $this->tpl->parseCurrentBlock();
03432 }
03433 else
03434 {
03435 if ($ilAccess->checkAccess("write", "", $this->ref_id) && $this->object->canEditMarks())
03436 {
03437 $this->tpl->setCurrentBlock("selectall");
03438 $counter++;
03439 $this->tpl->setVariable("ROW_CLASS", $rows[$counter % 2]);
03440 $this->tpl->setVariable("SELECT_ALL", $this->lng->txt("select_all"));
03441 $this->tpl->parseCurrentBlock();
03442 $this->tpl->setCurrentBlock("Footer");
03443 $this->tpl->setVariable("ARROW", "<img src=\"" . ilUtil::getImagePath("arrow_downright.gif") . "\" alt=\"".$this->lng->txt("arrow_downright")."\"/>");
03444 $this->tpl->setVariable("BUTTON_EDIT", $this->lng->txt("edit"));
03445 $this->tpl->setVariable("BUTTON_DELETE", $this->lng->txt("delete"));
03446 $this->tpl->parseCurrentBlock();
03447 }
03448 }
03449
03450 if ($this->object->getReportingDate())
03451 {
03452 $this->tpl->setCurrentBlock("ects");
03453 if ($this->object->ects_output)
03454 {
03455 $this->tpl->setVariable("CHECKED_ECTS", " checked=\"checked\"");
03456 }
03457 $this->tpl->setVariable("TEXT_OUTPUT_ECTS_GRADES", $this->lng->txt("ects_output_of_ects_grades"));
03458 $this->tpl->setVariable("TEXT_ALLOW_ECTS_GRADES", $this->lng->txt("ects_allow_ects_grades"));
03459 $this->tpl->setVariable("TEXT_USE_FX", $this->lng->txt("ects_use_fx_grade"));
03460 if (preg_match("/\d+/", $this->object->ects_fx))
03461 {
03462 $this->tpl->setVariable("CHECKED_FX", " checked=\"checked\"");
03463 $this->tpl->setVariable("VALUE_PERCENT_FX", sprintf("value=\"%s\" ", $this->object->ects_fx));
03464 }
03465 $this->tpl->setVariable("TEXT_PERCENT", $this->lng->txt("ects_use_fx_grade_part2"));
03466 $this->tpl->setVariable("ECTS_GRADE", $this->lng->txt("ects_grade"));
03467 $this->tpl->setVariable("PERCENTILE", $this->lng->txt("percentile"));
03468 $this->tpl->setVariable("ECTS_GRADE_A", "A - " . $this->lng->txt("ects_grade_a_short"));
03469 $this->tpl->setVariable("VALUE_GRADE_A", $this->object->ects_grades["A"]);
03470 $this->tpl->setVariable("ECTS_GRADE_B", "B - " . $this->lng->txt("ects_grade_b_short"));
03471 $this->tpl->setVariable("VALUE_GRADE_B", $this->object->ects_grades["B"]);
03472 $this->tpl->setVariable("ECTS_GRADE_C", "C - " . $this->lng->txt("ects_grade_c_short"));
03473 $this->tpl->setVariable("VALUE_GRADE_C", $this->object->ects_grades["C"]);
03474 $this->tpl->setVariable("ECTS_GRADE_D", "D - " . $this->lng->txt("ects_grade_d_short"));
03475 $this->tpl->setVariable("VALUE_GRADE_D", $this->object->ects_grades["D"]);
03476 $this->tpl->setVariable("ECTS_GRADE_E", "E - " . $this->lng->txt("ects_grade_e_short"));
03477 $this->tpl->setVariable("VALUE_GRADE_E", $this->object->ects_grades["E"]);
03478
03479 $this->tpl->parseCurrentBlock();
03480 }
03481
03482 $this->tpl->setCurrentBlock("adm_content");
03483 $this->tpl->setVariable("ACTION_MARKS", $this->ctrl->getFormAction($this));
03484 $this->tpl->setVariable("HEADER_SHORT", $this->lng->txt("tst_mark_short_form"));
03485 $this->tpl->setVariable("HEADER_OFFICIAL", $this->lng->txt("tst_mark_official_form"));
03486 $this->tpl->setVariable("HEADER_PERCENTAGE", $this->lng->txt("tst_mark_minimum_level"));
03487 $this->tpl->setVariable("HEADER_PASSED", $this->lng->txt("tst_mark_passed"));
03488 if ($ilAccess->checkAccess("write", "", $this->ref_id) && $this->object->canEditMarks())
03489 {
03490 $this->tpl->setVariable("BUTTON_NEW", $this->lng->txt("tst_mark_create_new_mark_step"));
03491 $this->tpl->setVariable("BUTTON_NEW_SIMPLE", $this->lng->txt("tst_mark_create_simple_mark_schema"));
03492 $this->tpl->setVariable("SAVE", $this->lng->txt("save"));
03493 $this->tpl->setVariable("CANCEL", $this->lng->txt("cancel"));
03494 }
03495 $this->tpl->parseCurrentBlock();
03496 }
03497
03505 function confirmDeleteAllUserResultsObject()
03506 {
03507 $this->object->removeAllTestEditings();
03508 ilUtil::sendInfo($this->lng->txt("tst_all_user_data_deleted"), true);
03509 $this->ctrl->redirect($this, "participants");
03510 }
03511
03519 function confirmDeleteSelectedUserDataObject()
03520 {
03521 $active_ids = array();
03522 foreach ($_POST["chbUser"] as $active_id)
03523 {
03524 if ($this->object->getFixedParticipants())
03525 {
03526 array_push($active_ids, $this->object->getActiveIdOfUser($active_id));
03527 }
03528 else
03529 {
03530 array_push($active_ids, $active_id);
03531 }
03532 }
03533 $this->object->removeSelectedTestResults($active_ids);
03534 ilUtil::sendInfo($this->lng->txt("tst_selected_user_data_deleted"), true);
03535 $this->ctrl->redirect($this, "participants");
03536 }
03537
03545 function cancelDeleteSelectedUserDataObject()
03546 {
03547 $this->ctrl->redirect($this, "participants");
03548 }
03549
03557 function deleteAllUserDataObject()
03558 {
03559 ilUtil::sendInfo($this->lng->txt("confirm_delete_all_user_data"));
03560 $this->tpl->addBlockFile("ADM_CONTENT", "adm_content", "tpl.il_as_tst_maintenance.html", "Modules/Test");
03561
03562 $this->tpl->setCurrentBlock("confirm_delete");
03563 $this->tpl->setVariable("BTN_CONFIRM_DELETE_ALL", $this->lng->txt("confirm"));
03564 $this->tpl->setVariable("BTN_CANCEL_DELETE_ALL", $this->lng->txt("cancel"));
03565 $this->tpl->parseCurrentBlock();
03566
03567 $this->tpl->setCurrentBlock("adm_content");
03568 $this->tpl->setVariable("FORM_ACTION", $this->ctrl->getFormAction($this));
03569 $this->tpl->parseCurrentBlock();
03570 }
03571
03579 function deleteAllUserResultsObject()
03580 {
03581 $this->tpl->addBlockFile("ADM_CONTENT", "adm_content", "tpl.confirm_deletion.html", "Modules/Test");
03582 $this->tpl->setVariable("FORMACTION", $this->ctrl->getFormAction($this, "participants"));
03583 $this->tpl->setCurrentBlock("table_header");
03584 $this->tpl->setVariable("TEXT", $this->lng->txt("delete_all_user_data"));
03585 $this->tpl->parseCurrentBlock();
03586
03587 $this->tpl->setCurrentBlock("table_row");
03588 $this->tpl->setVariable("CSS_ROW", "tblrow1");
03589 $this->tpl->setVariable("TEXT_CONTENT", $this->lng->txt("delete_all_user_data_confirmation"));
03590 $this->tpl->parseCurrentBlock();
03591
03592
03593 $buttons = array( "confirmDeleteAllUserResults" => $this->lng->txt("proceed"),
03594 "participants" => $this->lng->txt("cancel"));
03595 foreach ($buttons as $name => $value)
03596 {
03597 $this->tpl->setCurrentBlock("operation_btn");
03598 $this->tpl->setVariable("BTN_NAME",$name);
03599 $this->tpl->setVariable("BTN_VALUE",$value);
03600 $this->tpl->parseCurrentBlock();
03601 }
03602 }
03603
03611 function deleteSingleUserResultsObject()
03612 {
03613 if (count($_POST["chbUser"]) == 0)
03614 {
03615 ilUtil::sendInfo($this->lng->txt("select_one_user"), TRUE);
03616 $this->ctrl->redirect($this, "participants");
03617 }
03618 ilUtil::sendInfo($this->lng->txt("confirm_delete_single_user_data"));
03619 $this->tpl->addBlockFile("ADM_CONTENT", "adm_content", "tpl.il_as_tst_maintenance.html", "Modules/Test");
03620
03621 foreach ($_POST["chbUser"] as $key => $value)
03622 {
03623 $this->tpl->setCurrentBlock("hidden");
03624 $this->tpl->setVariable("USER_ID", $value);
03625 $this->tpl->parseCurrentBlock();
03626 }
03627
03628 include_once './Services/User/classes/class.ilObjUser.php';
03629 $color_class = array("tblrow1", "tblrow2");
03630 $counter = 0;
03631 foreach ($_POST["chbUser"] as $key => $active_id)
03632 {
03633 if ($this->object->getFixedParticipants())
03634 {
03635 $user_id = $active_id;
03636 }
03637 else
03638 {
03639 $user_id = $this->object->_getUserIdFromActiveId($active_id);
03640 }
03641 $user = ilObjUser::_lookupName($user_id);
03642 $this->tpl->setCurrentBlock("row");
03643 $this->tpl->setVariable("USER_ICON", ilUtil::getImagePath("icon_usr.gif"));
03644 $this->tpl->setVariable("USER_ALT", $this->lng->txt("usr"));
03645 $this->tpl->setVariable("USER_TITLE", $this->lng->txt("usr"));
03646 if ($this->object->getAnonymity())
03647 {
03648 $this->tpl->setVariable("TXT_FIRSTNAME", "");
03649 $this->tpl->setVariable("TXT_LASTNAME", $this->lng->txt("unknown"));
03650 $this->tpl->setVariable("TXT_LOGIN", "");
03651 }
03652 else
03653 {
03654 $this->tpl->setVariable("TXT_FIRSTNAME", $user["firstname"]);
03655 if (strlen($user["lastname"]))
03656 {
03657 $this->tpl->setVariable("TXT_LASTNAME", $user["lastname"]);
03658 }
03659 else
03660 {
03661 $this->tpl->setVariable("TXT_LASTNAME", $this->lng->txt("deleted_user"));
03662 }
03663 $this->tpl->setVariable("TXT_LOGIN", ilObjUser::_lookupLogin($user_id));
03664 }
03665 $this->tpl->setVariable("ROW_CLASS", $color_class[$counter % 2]);
03666 $this->tpl->parseCurrentBlock();
03667 $counter++;
03668 }
03669 $this->tpl->setCurrentBlock("selectedusers");
03670 $this->tpl->setVariable("HEADER_TXT_FIRSTNAME", $this->lng->txt("firstname"));
03671 $this->tpl->setVariable("HEADER_TXT_LASTNAME", $this->lng->txt("lastname"));
03672 $this->tpl->setVariable("HEADER_TXT_LOGIN", $this->lng->txt("login"));
03673 $this->tpl->setVariable("BTN_CONFIRM_DELETE_SELECTED", $this->lng->txt("confirm"));
03674 $this->tpl->setVariable("BTN_CANCEL_DELETE_SELECTED", $this->lng->txt("cancel"));
03675 $this->tpl->parseCurrentBlock();
03676
03677 $this->tpl->setCurrentBlock("adm_content");
03678 $this->tpl->setVariable("FORM_ACTION", $this->ctrl->getFormAction($this));
03679 $this->tpl->parseCurrentBlock();
03680 }
03681
03689 function historyObject()
03690 {
03691 global $ilAccess;
03692 if (!$ilAccess->checkAccess("write", "", $this->ref_id))
03693 {
03694
03695 ilUtil::sendInfo($this->lng->txt("cannot_edit_test"), true);
03696 $this->ctrl->redirect($this, "infoScreen");
03697 }
03698
03699 $this->tpl->addBlockFile("ADM_CONTENT", "adm_content", "tpl.il_as_tst_status.html", "Modules/Test");
03700 if ($ilAccess->checkAccess("write", "", $this->ref_id))
03701 {
03702 include_once "./classes/class.ilObjAssessmentFolder.php";
03703 $log =& ilObjAssessmentFolder::_getLog("19700101000000", strftime("%Y%m%d%H%M%S"), $this->object->getId(), TRUE);
03704 if (count($log))
03705 {
03706 $tblrow = array("tblrow1", "tblrow2");
03707 $counter = 0;
03708 include_once './Services/User/classes/class.ilObjUser.php';
03709 foreach ($log as $entry)
03710 {
03711 $this->tpl->setCurrentBlock("changelog_row");
03712 $this->tpl->setVariable("ROW_CLASS", $tblrow[$counter % 2]);
03713 $username = $this->object->userLookupFullName($entry["user_fi"], TRUE);
03714 $this->tpl->setVariable("TXT_USER", $username);
03715 $this->tpl->setVariable("TXT_DATETIME", ilFormat::formatDate(ilFormat::ftimestamp2datetimeDB($entry["TIMESTAMP14"]), "datetime"));
03716 if (strlen($entry["ref_id"]) && strlen($entry["href"]))
03717 {
03718 $this->tpl->setVariable("TXT_TEST_REFERENCE", $this->lng->txt("perma_link"));
03719 $this->tpl->setVariable("HREF_REFERENCE", $entry["href"]);
03720 }
03721 $this->tpl->setVariable("TXT_LOGTEXT", trim(ilUtil::prepareFormOutput($entry["logtext"])));
03722 $this->tpl->parseCurrentBlock();
03723 $counter++;
03724 }
03725 $this->tpl->setCurrentBlock("changelog");
03726 $this->tpl->setVariable("HEADER_DATETIME", $this->lng->txt("assessment_log_datetime"));
03727 $this->tpl->setVariable("HEADER_USER", $this->lng->txt("user"));
03728 $this->tpl->setVariable("HEADER_LOGTEXT", $this->lng->txt("assessment_log_text"));
03729 $this->tpl->setVariable("HEADER_TEST_REFERENCE", $this->lng->txt("location"));
03730 $this->tpl->setVariable("HEADING_CHANGELOG", $this->lng->txt("changelog_heading"));
03731 $this->tpl->setVariable("DESCRIPTION_CHANGELOG", $this->lng->txt("changelog_description"));
03732 $this->tpl->parseCurrentBlock();
03733 }
03734 }
03735
03736 $this->tpl->setCurrentBlock("adm_content");
03737 $this->tpl->parseCurrentBlock();
03738 }
03739
03743 function createObject()
03744 {
03745 global $rbacsystem;
03746 $new_type = $_POST["new_type"] ? $_POST["new_type"] : $_GET["new_type"];
03747 if (!$rbacsystem->checkAccess("create", $_GET["ref_id"], $new_type))
03748 {
03749 $this->ilias->raiseError($this->lng->txt("permission_denied"),$this->ilias->error_obj->MESSAGE);
03750 }
03751 else
03752 {
03753 $this->getTemplateFile("create", $new_type);
03754
03755 include_once("./Modules/Test/classes/class.ilObjTest.php");
03756 $tst = new ilObjTest();
03757 $questionpools =& $tst->getAvailableQuestionpools(TRUE, FALSE, TRUE, TRUE);
03758 if (count($questionpools) == 0)
03759 {
03760 }
03761 else
03762 {
03763 foreach ($questionpools as $key => $value)
03764 {
03765 $this->tpl->setCurrentBlock("option_qpl");
03766 $this->tpl->setVariable("OPTION_VALUE", $key);
03767 $this->tpl->setVariable("TXT_OPTION", $value["title"]);
03768 if ($_POST["qpl"] == $key)
03769 {
03770 $this->tpl->setVariable("OPTION_SELECTED", " selected=\"selected\"");
03771 }
03772 $this->tpl->parseCurrentBlock();
03773 }
03774 }
03775
03776 $defaults =& $tst->getAvailableDefaults();
03777 if (count($defaults))
03778 {
03779 foreach ($defaults as $row)
03780 {
03781 $this->tpl->setCurrentBlock("defaults_row");
03782 $this->tpl->setVariable("DEFAULTS_VALUE", $row["test_defaults_id"]);
03783 $this->tpl->setVariable("DEFAULTS_NAME", ilUtil::prepareFormOutput($row["name"]));
03784 $this->tpl->parseCurrentBlock();
03785 }
03786 $this->tpl->setCurrentBlock("defaults");
03787 $this->tpl->setVariable("TXT_DEFAULTS", $this->lng->txt("defaults"));
03788 $this->tpl->setVariable("TEXT_NO_DEFAULTS", $this->lng->txt("tst_defaults_dont_use"));
03789 $this->tpl->parseCurrentBlock();
03790 }
03791
03792 $this->fillCloneTemplate('DUPLICATE','tst');
03793 $this->tpl->setCurrentBlock("adm_content");
03794
03795
03796 $data = array();
03797 $data["fields"] = array();
03798 $data["fields"]["title"] = ilUtil::prepareFormOutput($_SESSION["error_post_vars"]["Fobject"]["title"],true);
03799 $data["fields"]["desc"] = ilUtil::stripSlashes($_SESSION["error_post_vars"]["Fobject"]["desc"]);
03800 foreach ($data["fields"] as $key => $val)
03801 {
03802 $this->tpl->setVariable("TXT_".strtoupper($key), $this->lng->txt($key));
03803 $this->tpl->setVariable(strtoupper($key), $val);
03804
03805 if ($this->prepare_output)
03806 {
03807 $this->tpl->parseCurrentBlock();
03808 }
03809 }
03810 $this->ctrl->setParameter($this, "new_type", $this->type);
03811 $this->tpl->setVariable("FORMACTION", $this->ctrl->getFormAction($this));
03812 $this->tpl->setVariable("TXT_HEADER", $this->lng->txt($new_type."_new"));
03813 $this->tpl->setVariable("TXT_SELECT_QUESTIONPOOL", $this->lng->txt("select_questionpool"));
03814 $this->tpl->setVariable("OPTION_SELECT_QUESTIONPOOL", $this->lng->txt("select_questionpool_option"));
03815 $this->tpl->setVariable("TXT_CANCEL", $this->lng->txt("cancel"));
03816 $this->tpl->setVariable("TXT_SUBMIT", $this->lng->txt($new_type."_add"));
03817 $this->tpl->setVariable("CMD_SUBMIT", "save");
03818 $this->tpl->setVariable("TARGET", ' target="'. ilFrameTargetInfo::_getFrame("MainContent").'" ');
03819 $this->tpl->setVariable("TXT_REQUIRED_FLD", $this->lng->txt("required_field"));
03820
03821 $this->tpl->setVariable("TXT_IMPORT_TST", $this->lng->txt("import_tst"));
03822 $this->tpl->setVariable("TXT_TST_FILE", $this->lng->txt("tst_upload_file"));
03823 $this->tpl->setVariable("TXT_IMPORT", $this->lng->txt("import"));
03824
03825 $this->tpl->setVariable("TYPE_IMG", ilUtil::getImagePath('icon_tst.gif'));
03826 $this->tpl->setVariable("ALT_IMG",$this->lng->txt("obj_tst"));
03827 $this->tpl->setVariable("TYPE_IMG2", ilUtil::getImagePath('icon_tst.gif'));
03828 $this->tpl->setVariable("ALT_IMG2",$this->lng->txt("obj_tst"));
03829 $this->tpl->setVariable("NEW_TYPE", $this->type);
03830 $this->tpl->parseCurrentBlock();
03831
03832 }
03833 }
03834
03842 function cancelFixedParticipantsStatusChangeObject()
03843 {
03844 $this->ctrl->redirect($this, "inviteParticipants");
03845 }
03846
03854 function confirmFixedParticipantsStatusChangeObject()
03855 {
03856 $fixed_participants = 0;
03857 $invited_users = $this->object->getInvitedUsers();
03858 foreach ($invited_users as $user_object)
03859 {
03860 $this->object->disinviteUser($user_object->usr_id);
03861 }
03862 $this->object->setFixedParticipants($fixed_participants);
03863 $this->object->saveToDb();
03864 $this->ctrl->redirect($this, "inviteParticipants");
03865 }
03866
03874 function confirmFixedParticipantsStatusChange()
03875 {
03876 $this->tpl->addBlockFile("ADM_CONTENT", "adm_content", "tpl.confirm_deletion.html", "Modules/Test");
03877
03878 $this->tpl->setVariable("FORMACTION", $this->ctrl->getFormAction($this));
03879
03880 $this->tpl->setCurrentBlock("table_header");
03881 $this->tpl->setVariable("TEXT", $this->lng->txt("tst_fixed_participants_disable"));
03882 $this->tpl->parseCurrentBlock();
03883
03884 $this->tpl->setCurrentBlock("table_row");
03885 $this->tpl->setVariable("CSS_ROW", "tblrow1");
03886 $this->tpl->setVariable("TEXT_CONTENT", $this->lng->txt("tst_fixed_participants_disable_description"));
03887 $this->tpl->parseCurrentBlock();
03888
03889
03890 $buttons = array( "confirmFixedParticipantsStatusChange" => $this->lng->txt("proceed"),
03891 "cancelFixedParticipantsStatusChange" => $this->lng->txt("cancel"));
03892 foreach ($buttons as $name => $value)
03893 {
03894 $this->tpl->setCurrentBlock("operation_btn");
03895 $this->tpl->setVariable("BTN_NAME",$name);
03896 $this->tpl->setVariable("BTN_VALUE",$value);
03897 $this->tpl->parseCurrentBlock();
03898 }
03899 }
03900
03908 function saveFixedParticipantsStatusObject()
03909 {
03910 $fixed_participants = 0;
03911 if (array_key_exists("chb_fixed_participants", $_POST))
03912 {
03913 if ($_POST["chb_fixed_participants"])
03914 {
03915 $fixed_participants = 1;
03916 }
03917 }
03918 $invited_users = $this->object->getInvitedUsers();
03919 if ($this->object->getFixedParticipants() && !$fixed_participants && count($invited_users))
03920 {
03921 $this->confirmFixedParticipantsStatusChange();
03922 }
03923 else
03924 {
03925 $this->object->setFixedParticipants($fixed_participants);
03926 $this->object->saveToDb();
03927 $this->ctrl->redirect($this, "inviteParticipants");
03928 }
03929 }
03930
03938 function inviteParticipantsObject()
03939 {
03940 global $ilAccess;
03941 if (!$ilAccess->checkAccess("write", "", $this->ref_id))
03942 {
03943
03944 ilUtil::sendInfo($this->lng->txt("cannot_edit_test"), true);
03945 $this->ctrl->redirect($this, "infoScreen");
03946 }
03947
03948 $total = $this->object->evalTotalPersons();
03949 $this->tpl->addBlockFile("ADM_CONTENT", "adm_content", "tpl.il_as_tst_fixed_users.html", "Modules/Test");
03950
03951 if ($_POST["cmd"]["cancel"])
03952 {
03953 $this->backToRepositoryObject();
03954 }
03955
03956 if (strcmp($this->ctrl->getCmd(), "searchParticipants") == 0)
03957 {
03958 if (is_array($_POST["search_for"]))
03959 {
03960 $this->tpl->setCurrentBlock("search_results_title");
03961 $this->tpl->setVariable("TEXT_SEARCH_RESULTS", $this->lng->txt("search_results"));
03962 $this->tpl->parseCurrentBlock();
03963 if (in_array("usr", $_POST["search_for"]) or in_array("grp", $_POST["search_for"]) or in_array("role", $_POST["search_for"]))
03964 {
03965 include_once './classes/class.ilSearch.php';
03966 $search =& new ilSearch($ilUser->id);
03967 $search->setSearchString($_POST["search_term"]);
03968 $search->setCombination($_POST["concatenation"]);
03969 $search->setSearchFor($_POST["search_for"]);
03970 $search->setSearchType("new");
03971 if($search->validate($message))
03972 {
03973 $search->performSearch();
03974 }
03975 if ($message)
03976 {
03977 ilUtil::sendInfo($message);
03978 }
03979
03980 if(!$search->getNumberOfResults() && $search->getSearchFor())
03981 {
03982 ilUtil::sendInfo($this->lng->txt("search_no_match"));
03983 }
03984 $buttons = array("add");
03985
03986 $invited_users =& $this->object->getInvitedUsers();
03987
03988 if ($searchresult = $search->getResultByType("usr"))
03989 {
03990 $users = array();
03991 foreach ($searchresult as $result_array)
03992 {
03993 if (!array_key_exists($result_array["id"], $invited_users))
03994 {
03995 array_push($users, $result_array["id"]);
03996 }
03997 }
03998
03999 $users = $this->object->getUserData($users);
04000
04001 if (count ($users))
04002 $this->outUserGroupTable("usr", $users, "user_result", "user_row", $this->lng->txt("search_user"),"TEXT_USER_TITLE", $buttons);
04003 }
04004
04005 $searchresult = array();
04006
04007 if ($searchresult = $search->getResultByType("grp"))
04008 {
04009 $groups = array();
04010
04011 foreach ($searchresult as $result_array)
04012 {
04013 array_push($groups, $result_array["id"]);
04014 }
04015 $groups = $this->object->getGroupData ($groups);
04016
04017 if (count ($groups))
04018 $this->outUserGroupTable("grp", $groups, "group_result", "group_row", $this->lng->txt("search_group"), "TEXT_GROUP_TITLE", $buttons);
04019 }
04020
04021 $searchresult = array();
04022
04023 if ($searchresult = $search->getResultByType("role"))
04024 {
04025 $roles = array();
04026
04027 foreach ($searchresult as $result_array)
04028 {
04029 array_push($roles, $result_array["id"]);
04030 }
04031
04032 $roles = $this->object->getRoleData ($roles);
04033
04034 if (count ($roles))
04035 $this->outUserGroupTable("role", $roles, "role_result", "role_row", $this->lng->txt("role"), "TEXT_ROLE_TITLE", $buttons);
04036 }
04037
04038 }
04039
04040 }
04041 else
04042 {
04043 ilUtil::sendInfo($this->lng->txt("no_user_or_group_selected"));
04044 }
04045 }
04046
04047 if ($_POST["cmd"]["save"])
04048 {
04049 $this->object->saveToDb();
04050 }
04051 $invited_users = $this->object->getInvitedUsers();
04052
04053 $buttons = array("save","remove");
04054
04055 if ($this->object->getFixedParticipants())
04056 {
04057 if ($ilAccess->checkAccess("write", "", $this->ref_id))
04058 {
04059 $this->tpl->setCurrentBlock("invitation");
04060 $this->tpl->setVariable("SEARCH_INVITATION", $this->lng->txt("search"));
04061 $this->tpl->setVariable("SEARCH_TERM", $this->lng->txt("search_term"));
04062 $this->tpl->setVariable("SEARCH_FOR", $this->lng->txt("search_for"));
04063 $this->tpl->setVariable("SEARCH_USERS", $this->lng->txt("search_users"));
04064 $this->tpl->setVariable("SEARCH_GROUPS", $this->lng->txt("search_groups"));
04065 $this->tpl->setVariable("SEARCH_ROLES", $this->lng->txt("search_roles"));
04066 $this->tpl->setVariable("TEXT_CONCATENATION", $this->lng->txt("concatenation"));
04067 $this->tpl->setVariable("TEXT_AND", $this->lng->txt("and"));
04068 $this->tpl->setVariable("TEXT_OR", $this->lng->txt("or"));
04069 $this->tpl->setVariable("VALUE_SEARCH_TERM", $_POST["search_term"]);
04070 if (is_array($_POST["search_for"]))
04071 {
04072 if (in_array("usr", $_POST["search_for"]))
04073 {
04074 $this->tpl->setVariable("CHECKED_USERS", " checked=\"checked\"");
04075 }
04076 if (in_array("grp", $_POST["search_for"]))
04077 {
04078 $this->tpl->setVariable("CHECKED_GROUPS", " checked=\"checked\"");
04079 }
04080 if (in_array("role", $_POST["search_for"]))
04081 {
04082 $this->tpl->setVariable("CHECKED_ROLES", " checked=\"checked\"");
04083 }
04084 }
04085 else
04086 {
04087 $this->tpl->setVariable("CHECKED_USERS", " checked=\"checked\"");
04088 }
04089 if (strcmp($_POST["concatenation"], "and") == 0)
04090 {
04091 $this->tpl->setVariable("CHECKED_AND", " checked=\"checked\"");
04092 }
04093 else
04094 {
04095 $this->tpl->setVariable("CHECKED_OR", " checked=\"checked\"");
04096 }
04097 $this->tpl->setVariable("SEARCH", $this->lng->txt("search"));
04098 $this->tpl->setVariable("SEARCH_INTRODUCTION", $this->lng->txt("participants_invitation_search_introduction"));
04099 $this->tpl->setVariable("TEXT_INVITATION", $this->lng->txt("invitation"));
04100 $this->tpl->setVariable("VALUE_ON", $this->lng->txt("on"));
04101 $this->tpl->setVariable("VALUE_OFF", $this->lng->txt("off"));
04102 $this->tpl->setVariable("TXT_REQUIRED_FLD", $this->lng->txt("required_field"));
04103 $this->tpl->parseCurrentBlock();
04104 }
04105 }
04106
04107 $this->tpl->setCurrentBlock("adm_content");
04108 $this->tpl->setVariable("FORM_ACTION", $this->ctrl->getFormAction($this));
04109 $this->tpl->setVariable("TEXT_ALLOW_FIXED_PARTICIPANTS", $this->lng->txt("tst_allow_fixed_participants"));
04110 $this->tpl->setVariable("BUTTON_SAVE", $this->lng->txt("save"));
04111 $this->tpl->setVariable("TEXT_FIXED_PARTICIPANTS", $this->lng->txt("participants_invitation"));
04112 $this->tpl->setVariable("TEXT_FIXED_PARTICIPANTS_DESCRIPTION", $this->lng->txt("participants_invitation_description"));
04113 if ($this->object->getFixedParticipants())
04114 {
04115 $this->tpl->setVariable("CHECKED_FIXED_PARTICIPANTS", " checked=\"checked\"");
04116 }
04117 if ($total && (count($invited_users) == 0))
04118 {
04119 ilUtil::sendInfo($this->lng->txt("tst_fixed_participants_data_exists"));
04120 $this->tpl->setVariable("DISABLED_FIXED_PARTICIPANTS", " disabled=\"disabled\"");
04121 }
04122
04123 if ($ilAccess->checkAccess("write", "", $this->ref_id))
04124 {
04125 $this->tpl->setVariable("SAVE", $this->lng->txt("save"));
04126 $this->tpl->setVariable("CANCEL", $this->lng->txt("cancel"));
04127 }
04128 $this->tpl->parseCurrentBlock();
04129 }
04130
04138 function participantsActionObject()
04139 {
04140 $command = $_POST["command"];
04141 if (strlen($command))
04142 {
04143 $method = $command . "Object";
04144 if (method_exists($this, $method))
04145 {
04146 $this->$method();
04147 return;
04148 }
04149 }
04150 $this->ctrl->redirect($this, "participants");
04151 }
04152
04160 function participantsObject()
04161 {
04162 global $ilAccess;
04163 if (!$ilAccess->checkAccess("write", "", $this->ref_id))
04164 {
04165
04166 ilUtil::sendInfo($this->lng->txt("cannot_edit_test"), true);
04167 $this->ctrl->redirect($this, "infoScreen");
04168 }
04169
04170 if ($this->object->getFixedParticipants())
04171 {
04172 $this->tpl->addBlockFile("ADM_CONTENT", "adm_content", "tpl.il_as_tst_invite.html", "Modules/Test");
04173 }
04174 else
04175 {
04176 $this->tpl->addBlockFile("ADM_CONTENT", "adm_content", "tpl.il_as_tst_participants.html", "Modules/Test");
04177 }
04178 include_once "./Services/YUI/classes/class.ilYuiUtil.php";
04179 ilYuiUtil::addYesNoDialog(
04180 "deleteAllUserResults",
04181 $this->lng->txt("delete_all_user_data"),
04182 $this->lng->txt("confirm_delete_all_user_data"),
04183 "location.href='" . $this->ctrl->getLinkTarget($this, "confirmDeleteAllUserResults") . "';",
04184 "",
04185 TRUE,
04186 $icon = "warn"
04187 );
04188 if ($_POST["cmd"]["cancel"])
04189 {
04190 $this->backToRepositoryObject();
04191 }
04192
04193 if ($_POST["cmd"]["save"])
04194 {
04195 $this->object->saveToDb();
04196 }
04197
04198 if ($ilAccess->checkAccess("write", "", $this->ref_id))
04199 {
04200 if ($this->tpl->blockExists("invitation"))
04201 {
04202 $this->tpl->setCurrentBlock("invitation");
04203 $this->tpl->setVariable("SEARCH_INVITATION", $this->lng->txt("search"));
04204 $this->tpl->setVariable("SEARCH_TERM", $this->lng->txt("search_term"));
04205 $this->tpl->setVariable("SEARCH_FOR", $this->lng->txt("search_for"));
04206 $this->tpl->setVariable("SEARCH_USERS", $this->lng->txt("search_users"));
04207 $this->tpl->setVariable("SEARCH_GROUPS", $this->lng->txt("search_groups"));
04208 $this->tpl->setVariable("SEARCH_ROLES", $this->lng->txt("search_roles"));
04209 $this->tpl->setVariable("TEXT_CONCATENATION", $this->lng->txt("concatenation"));
04210 $this->tpl->setVariable("TEXT_AND", $this->lng->txt("and"));
04211 $this->tpl->setVariable("TEXT_OR", $this->lng->txt("or"));
04212 $this->tpl->setVariable("VALUE_SEARCH_TERM", $_POST["search_term"]);
04213 if (is_array($_POST["search_for"]))
04214 {
04215 if (in_array("usr", $_POST["search_for"]))
04216 {
04217 $this->tpl->setVariable("CHECKED_USERS", " checked=\"checked\"");
04218 }
04219 if (in_array("grp", $_POST["search_for"]))
04220 {
04221 $this->tpl->setVariable("CHECKED_GROUPS", " checked=\"checked\"");
04222 }
04223 if (in_array("role", $_POST["search_for"]))
04224 {
04225 $this->tpl->setVariable("CHECKED_ROLES", " checked=\"checked\"");
04226 }
04227
04228 }
04229 if (strcmp($_POST["concatenation"], "and") == 0)
04230 {
04231 $this->tpl->setVariable("CHECKED_AND", " checked=\"checked\"");
04232 }
04233 else if (strcmp($_POST["concatenation"], "or") == 0)
04234 {
04235 $this->tpl->setVariable("CHECKED_OR", " checked=\"checked\"");
04236 }
04237 $this->tpl->setVariable("SEARCH", $this->lng->txt("search"));
04238 $this->tpl->parseCurrentBlock();
04239 }
04240 }
04241
04242 if ($this->object->getFixedParticipants())
04243 {
04244 $invited_users =& $this->object->getInvitedUsers();
04245 if (count($invited_users) == 0)
04246 {
04247 ilUtil::sendInfo($this->lng->txt("tst_participants_no_fixed"));
04248 }
04249 else
04250 {
04251 $this->tpl->setCurrentBlock("delete_all");
04252 $this->tpl->setVariable("VALUE_DELETE_ALL_USER_DATA", $this->lng->txt("delete_all_user_data"));
04253 $this->tpl->setVariable("FORMACTION_DELETEALL", $this->ctrl->getFormAction($this, "deleteAllUserResults"));
04254 $this->tpl->parseCurrentBlock();
04255 }
04256 $buttons = array(array("saveClientIP" => "save"),array("removeParticipant" => "remove_as_participant"));
04257 if (!$this->object->getAnonymity())
04258 {
04259 array_push($buttons, array("showPassOverview" => "show_pass_overview"));
04260 array_push($buttons, array("showUserAnswers" => "show_user_answers"));
04261 array_push($buttons, array("showDetailedResults" => "show_detailed_results"));
04262 }
04263 array_push($buttons, array("deleteSingleUserResults" => "delete_user_data"));
04264 if (count($invited_users))
04265 {
04266 $this->outUserGroupTable("iv_usr", $invited_users, "invited_user_result", "invited_user_row", $this->lng->txt("tst_fixed_participating_users"), "TEXT_INVITED_USER_TITLE",$buttons);
04267 }
04268 }
04269 else
04270 {
04271 $invited_users =& $this->object->getTestParticipants();
04272 if (count($invited_users) == 0)
04273 {
04274 ilUtil::sendInfo($this->lng->txt("tst_participants_no"));
04275 }
04276 else
04277 {
04278 $this->tpl->setCurrentBlock("delete_all");
04279 $this->tpl->setVariable("VALUE_DELETE_ALL_USER_DATA", $this->lng->txt("delete_all_user_data"));
04280 $this->tpl->setVariable("FORMACTION_DELETEALL", $this->ctrl->getFormAction($this, "deleteAllUserResults"));
04281 $this->tpl->parseCurrentBlock();
04282 }
04283 $buttons = array();
04284 if (!$this->object->getAnonymity())
04285 {
04286 array_push($buttons, array("showPassOverview" => "show_pass_overview"));
04287 array_push($buttons, array("showUserAnswers" => "show_user_answers"));
04288 array_push($buttons, array("showDetailedResults" => "show_detailed_results"));
04289 }
04290 array_push($buttons, array("deleteSingleUserResults" => "delete_user_data"));
04291 if (count($invited_users))
04292 {
04293 $this->outUserGroupTable("iv_participants", $invited_users, "invited_user_result", "invited_user_row", $this->lng->txt("tst_participating_users"), "TEXT_INVITED_USER_TITLE",$buttons);
04294 }
04295 }
04296
04297 if ($this->object->getFixedParticipants())
04298 {
04299 $this->tpl->setCurrentBlock("fixed_participants_hint");
04300 $this->tpl->setVariable("FIXED_PARTICIPANTS_HINT", sprintf($this->lng->txt("fixed_participants_hint"), $this->lng->txt("participants_invitation")));
04301 $this->tpl->parseCurrentBlock();
04302 }
04303
04304 $this->tpl->setCurrentBlock("adm_content");
04305 $this->tpl->setVariable("FORM_ACTION", $this->ctrl->getFormAction($this));
04306 $this->tpl->setVariable("TEXT_INVITATION", $this->lng->txt("invitation"));
04307 $this->tpl->setVariable("VALUE_ON", $this->lng->txt("on"));
04308 $this->tpl->setVariable("VALUE_OFF", $this->lng->txt("off"));
04309 $this->tpl->setVariable("TXT_REQUIRED_FLD", $this->lng->txt("required_field"));
04310
04311 if ($ilAccess->checkAccess("write", "", $this->ref_id))
04312 {
04313 $this->tpl->setVariable("SAVE", $this->lng->txt("save"));
04314 $this->tpl->setVariable("CANCEL", $this->lng->txt("cancel"));
04315 }
04316 $this->tpl->parseCurrentBlock();
04317 }
04318
04326 function showDetailedResultsObject()
04327 {
04328 if (count($_POST))
04329 {
04330 $_SESSION["show_user_results"] = $_POST["chbUser"];
04331 }
04332 $this->showUserResults($show_pass_details = TRUE, $show_answers = TRUE, $show_reached_points = TRUE);
04333 }
04334
04342 function showUserAnswersObject()
04343 {
04344 if (count($_POST))
04345 {
04346 $_SESSION["show_user_results"] = $_POST["chbUser"];
04347 }
04348 $this->showUserResults($show_pass_details = FALSE, $show_answers = TRUE);
04349 }
04350
04358 function showPassOverviewObject()
04359 {
04360 if (count($_POST))
04361 {
04362 $_SESSION["show_user_results"] = $_POST["chbUser"];
04363 }
04364 $this->showUserResults($show_pass_details = TRUE, $show_answers = FALSE);
04365 }
04366
04374 function showUserResults($show_pass_details, $show_answers, $show_reached_points = FALSE)
04375 {
04376 $template = new ilTemplate("tpl.il_as_tst_participants_result_output.html", TRUE, TRUE, "Modules/Test");
04377
04378 if (count($_SESSION["show_user_results"]) == 0)
04379 {
04380 ilUtil::sendInfo($this->lng->txt("select_one_user"), TRUE);
04381 $this->ctrl->redirect($this, "participants");
04382 }
04383
04384 include_once "./Modules/Test/classes/class.ilTestServiceGUI.php";
04385 $serviceGUI =& new ilTestServiceGUI($this->object);
04386 $count = 0;
04387 foreach ($_SESSION["show_user_results"] as $key => $active_id)
04388 {
04389 $count++;
04390 $results = "";
04391 if ($this->object->getFixedParticipants())
04392 {
04393 $active_id = $this->object->getActiveIdOfUser($active_id);
04394 }
04395 if ($active_id > 0)
04396 {
04397 $results = $serviceGUI->getResultsOfUserOutput($active_id, $this->object->_getResultPass($active_id), $show_pass_details, $show_answers, FALSE, $show_reached_points);
04398 }
04399 if ($count < count($_SESSION["show_user_results"]))
04400 {
04401 $template->touchBlock("break");
04402 }
04403 $template->setCurrentBlock("user_result");
04404 $template->setVariable("USER_RESULT", $results);
04405 $template->parseCurrentBlock();
04406 }
04407 $template->setVariable("BACK_TEXT", $this->lng->txt("back"));
04408 $template->setVariable("BACK_URL", $this->ctrl->getLinkTargetByClass("ilobjtestgui", "participants"));
04409 $template->setVariable("PRINT_TEXT", $this->lng->txt("print"));
04410 $template->setVariable("PRINT_URL", "javascript:window.print();");
04411
04412 $this->tpl->setVariable("ADM_CONTENT", $template->get());
04413 $this->tpl->addCss(ilUtil::getStyleSheetLocation("output", "test_print.css", "Modules/Test"), "print");
04414 if ($this->object->getShowSolutionAnswersOnly())
04415 {
04416 $this->tpl->addCss(ilUtil::getStyleSheetLocation("output", "test_print_hide_content.css", "Modules/Test"), "print");
04417 }
04418 }
04419
04420 function removeParticipantObject()
04421 {
04422 if (is_array($_POST["chbUser"]))
04423 {
04424 foreach ($_POST["chbUser"] as $user_id)
04425 {
04426 $this->object->disinviteUser($user_id);
04427 }
04428 }
04429 else
04430 {
04431 ilUtil::sendInfo($this->lng->txt("select_one_user"), true);
04432 }
04433 $this->ctrl->redirect($this, "participants");
04434 }
04435
04436 function saveClientIPObject()
04437 {
04438 if (is_array($_POST["chbUser"]))
04439 {
04440 foreach ($_POST["chbUser"] as $user_id)
04441 {
04442 $this->object->setClientIP($user_id, $_POST["clientip_".$user_id]);
04443 }
04444 }
04445 else
04446 {
04447 ilUtil::sendInfo($this->lng->txt("select_one_user"), true);
04448 }
04449 $this->ctrl->redirect($this, "participants");
04450 }
04451
04459 function printobject()
04460 {
04461 global $ilAccess;
04462 if (!$ilAccess->checkAccess("write", "", $this->ref_id))
04463 {
04464
04465 ilUtil::sendInfo($this->lng->txt("cannot_edit_test"), true);
04466 $this->ctrl->redirect($this, "infoScreen");
04467 }
04468 $this->getQuestionsSubTabs();
04469 $this->tpl->addBlockFile("PRINT_CONTENT", "adm_content", "tpl.il_as_tst_print_test_confirm.html", "Modules/Test");
04470 $this->tpl->addCss(ilUtil::getStyleSheetLocation("output", "test_print.css", "Modules/Test"), "print");
04471
04472 global $ilUser;
04473 $print_date = mktime(date("H"), date("i"), date("s"), date("m") , date("d"), date("Y"));
04474 $max_points= 0;
04475 $counter = 1;
04476
04477 foreach ($this->object->questions as $question)
04478 {
04479 $this->tpl->setCurrentBlock("question");
04480 $question_gui = $this->object->createQuestionGUI("", $question);
04481 $this->tpl->setVariable("COUNTER_QUESTION", $counter.".");
04482 $this->tpl->setVariable("QUESTION_TITLE", $question_gui->object->getTitle());
04483 if ($question_gui->object->getMaximumPoints() == 1)
04484 {
04485 $this->tpl->setVariable("QUESTION_POINTS", $question_gui->object->getMaximumPoints() . " " . $this->lng->txt("point"));
04486 }
04487 else
04488 {
04489 $this->tpl->setVariable("QUESTION_POINTS", $question_gui->object->getMaximumPoints() . " " . $this->lng->txt("points"));
04490 }
04491 $result_output = $question_gui->getSolutionOutput("", NULL, FALSE, TRUE, FALSE, $this->object->getShowSolutionFeedback());
04492 $this->tpl->setVariable("SOLUTION_OUTPUT", $result_output);
04493 $this->tpl->parseCurrentBlock("question");
04494 $counter ++;
04495 $max_points += $question_gui->object->getMaximumPoints();
04496 }
04497
04498 $this->tpl->setCurrentBlock("navigation_buttons");
04499 $this->tpl->setVariable("BUTTON_PRINT", $this->lng->txt("print"));
04500 $this->tpl->parseCurrentBlock();
04501
04502 $this->tpl->setCurrentBlock("adm_content");
04503 $this->tpl->setVariable("TITLE", $this->object->getTitle());
04504 $this->tpl->setVariable("PRINT_TEST", $this->lng->txt("tst_print"));
04505 $this->tpl->setVariable("TXT_PRINT_DATE", $this->lng->txt("date"));
04506 $this->tpl->setVariable("VALUE_PRINT_DATE", strftime("%c",$print_date));
04507 $this->tpl->setVariable("TXT_MAXIMUM_POINTS", $this->lng->txt("tst_maximum_points"));
04508 $this->tpl->setVariable("VALUE_MAXIMUM_POINTS", $max_points);
04509 $this->tpl->parseCurrentBlock();
04510 }
04511
04520 function outUserGroupTable($a_type, $data_array, $block_result, $block_row, $title_text, $title_label, $buttons)
04521 {
04522 global $ilAccess;
04523 $rowclass = array("tblrow1", "tblrow2");
04524 switch($a_type)
04525 {
04526 case "iv_usr":
04527 if ($ilAccess->checkAccess("write", "", $this->object->getRefId()))
04528 {
04529 foreach ($buttons as $arr)
04530 {
04531 foreach ($arr as $val => $cat)
04532 {
04533 $this->tpl->setCurrentBlock("commandoption");
04534 $this->tpl->setVariable("OPTION_NAME", $this->lng->txt($cat));
04535 $this->tpl->setVariable("OPTION_VALUE", $val);
04536 $this->tpl->parseCurrentBlock();
04537 }
04538 }
04539 $this->tpl->setCurrentBlock("user_action_buttons");
04540 $this->tpl->setVariable("ARROW", "<img src=\"" . ilUtil::getImagePath("arrow_downright.gif") . "\" alt=\"".$this->lng->txt("arrow_downright")."\"/>");
04541 $this->tpl->setVariable("VALUE_SUBMIT", $this->lng->txt("submit"));
04542 $this->tpl->parseCurrentBlock();
04543 }
04544
04545 $finished = "<img border=\"0\" align=\"middle\" src=\"".ilUtil::getImagePath("icon_ok.gif") . "\" alt=\"".$this->lng->txt("checkbox_checked")."\" />";
04546 $started = "<img border=\"0\" align=\"middle\" src=\"".ilUtil::getImagePath("icon_ok.gif") . "\" alt=\"".$this->lng->txt("checkbox_checked")."\" />" ;
04547 $counter = 0;
04548 foreach ($data_array as $data)
04549 {
04550 $maxpass = $this->object->_getMaxPass($data->active_id);
04551 if (!is_null($maxpass))
04552 {
04553 $maxpass += 1;
04554 }
04555 $passes = ($maxpass) ? (($maxpass == 1) ? sprintf($this->lng->txt("pass_finished"), $maxpass) : sprintf($this->lng->txt("passes_finished"), $maxpass)) : " ";
04556 $this->tpl->setCurrentBlock($block_row);
04557 $this->tpl->setVariable("COLOR_CLASS", $rowclass[$counter % 2]);
04558 $this->tpl->setVariable("COUNTER", $data->usr_id);
04559 $this->tpl->setVariable("VALUE_IV_USR_ID", $data->usr_id);
04560 $this->tpl->setVariable("VALUE_IV_LOGIN", $data->login);
04561 $this->tpl->setVariable("VALUE_IV_FIRSTNAME", $data->firstname);
04562 $this->tpl->setVariable("VALUE_IV_LASTNAME", $data->lastname);
04563 $this->tpl->setVariable("VALUE_IV_CLIENT_IP", $data->clientip);
04564 $this->tpl->setVariable("VALUE_IV_TEST_FINISHED", ($data->test_finished==1)?$finished.$passes:$passes);
04565 $this->tpl->setVariable("VALUE_IV_TEST_STARTED", ($data->test_started==1)?$started:" ");
04566 if (strlen($data->usr_id))
04567 {
04568 $last_access = $this->object->_getLastAccess($data->active_id);
04569 if (!strlen($last_access))
04570 {
04571 $this->tpl->setVariable("VALUE_IV_LAST_ACCESS", $this->lng->txt("not_yet_accessed"));
04572 }
04573 else
04574 {
04575 $this->tpl->setVariable("VALUE_IV_LAST_ACCESS", ilFormat::formatDate($last_access));
04576 }
04577 }
04578 else
04579 {
04580 $last_access = $this->lng->txt("not_yet_accessed");
04581 $this->tpl->setVariable("VALUE_IV_LAST_ACCESS", $last_access);
04582 }
04583 $this->ctrl->setParameter($this, "active_id", $data->active_id);
04584 if ($data->test_started)
04585 {
04586 $this->tpl->setVariable("VALUE_TST_SHOW_RESULTS", $this->lng->txt("tst_show_results"));
04587 $this->ctrl->setParameterByClass("iltestoutputgui", "active_id", $data->active_id);
04588 $this->tpl->setVariable("URL_TST_SHOW_RESULTS", $this->ctrl->getLinkTargetByClass("iltestoutputgui", "outParticipantsResultsOverview"));
04589 }
04590 $counter++;
04591 $this->tpl->parseCurrentBlock();
04592 }
04593 if (count($data_array))
04594 {
04595 $this->tpl->setCurrentBlock("selectall");
04596 $this->tpl->setVariable("SELECT_ALL", $this->lng->txt("select_all"));
04597 $counter++;
04598 $this->tpl->setVariable("COLOR_CLASS", $rowclass[$counter % 2]);
04599 $this->tpl->parseCurrentBlock();
04600 }
04601 $this->tpl->setCurrentBlock($block_result);
04602 $this->tpl->setVariable("$title_label", "<img src=\"" . ilUtil::getImagePath("icon_usr_b.gif") . "\" alt=\"".$this->lng->txt("objs_usr")."\" align=\"middle\" /> " . $title_text);
04603 $this->tpl->setVariable("TEXT_IV_LOGIN", $this->lng->txt("login"));
04604 $this->tpl->setVariable("TEXT_IV_FIRSTNAME", $this->lng->txt("firstname"));
04605 $this->tpl->setVariable("TEXT_IV_LASTNAME", $this->lng->txt("lastname"));
04606 $this->tpl->setVariable("TEXT_IV_CLIENT_IP", $this->lng->txt("clientip"));
04607 $this->tpl->setVariable("TEXT_IV_TEST_FINISHED", $this->lng->txt("tst_finished"));
04608 $this->tpl->setVariable("TEXT_IV_TEST_STARTED", $this->lng->txt("tst_started"));
04609 $this->tpl->setVariable("TEXT_IV_LAST_ACCESS", $this->lng->txt("last_access"));
04610 $this->tpl->parseCurrentBlock();
04611 break;
04612 case "iv_participants":
04613 if ($ilAccess->checkAccess("write", "", $this->object->getRefId()))
04614 {
04615 foreach ($buttons as $arr)
04616 {
04617 foreach ($arr as $val => $cat)
04618 {
04619 $this->tpl->setCurrentBlock("commandoption");
04620 $this->tpl->setVariable("OPTION_NAME", $this->lng->txt($cat));
04621 $this->tpl->setVariable("OPTION_VALUE", $val);
04622 $this->tpl->parseCurrentBlock();
04623 }
04624 }
04625 $this->tpl->setCurrentBlock("user_action_buttons");
04626 $this->tpl->setVariable("ARROW", "<img src=\"" . ilUtil::getImagePath("arrow_downright.gif") . "\" alt=\"".$this->lng->txt("arrow_downright")."\"/>");
04627 $this->tpl->setVariable("VALUE_SUBMIT", $this->lng->txt("submit"));
04628 $this->tpl->parseCurrentBlock();
04629 }
04630 $finished = "<img border=\"0\" align=\"middle\" src=\"".ilUtil::getImagePath("icon_ok.gif") . "\" alt=\"".$this->lng->txt("checkbox_checked")."\" />";
04631 $started = "<img border=\"0\" align=\"middle\" src=\"".ilUtil::getImagePath("icon_ok.gif") . "\" alt=\"".$this->lng->txt("checkbox_checked")."\" />" ;
04632 $counter = 0;
04633 foreach ($data_array as $data)
04634 {
04635 $maxpass = $this->object->_getMaxPass($data->active_id);
04636 if (!is_null($maxpass))
04637 {
04638 $maxpass += 1;
04639 }
04640 $passes = ($maxpass) ? (($maxpass == 1) ? sprintf($this->lng->txt("pass_finished"), $maxpass) : sprintf($this->lng->txt("passes_finished"), $maxpass)) : " ";
04641 $this->tpl->setCurrentBlock($block_row);
04642 $this->tpl->setVariable("COLOR_CLASS", $rowclass[$counter % 2]);
04643 $this->tpl->setVariable("COUNTER", $data->active_id);
04644 $this->tpl->setVariable("VALUE_IV_USR_ID", $data->active_id);
04645 $this->tpl->setVariable("VALUE_IV_LOGIN", $data->login);
04646 $this->tpl->setVariable("VALUE_IV_FIRSTNAME", $data->firstname);
04647 $this->tpl->setVariable("VALUE_IV_LASTNAME", $data->lastname);
04648 $this->tpl->setVariable("VALUE_IV_TEST_FINISHED", ($data->test_finished==1)?$finished.$passes:$passes);
04649 $this->tpl->setVariable("VALUE_IV_TEST_STARTED", ($data->test_started==1)?$started:" ");
04650 if (strlen($data->active_id))
04651 {
04652 $last_access = $this->object->_getLastAccess($data->active_id);
04653 $this->tpl->setVariable("VALUE_IV_LAST_ACCESS", ilFormat::formatDate($last_access));
04654 }
04655 else
04656 {
04657 $last_access = $this->lng->txt("not_yet_accessed");
04658 $this->tpl->setVariable("VALUE_IV_LAST_ACCESS", $last_access);
04659 }
04660 $this->ctrl->setParameter($this, "active_id", $data->active_id);
04661 if ($data->test_started)
04662 {
04663 $this->tpl->setVariable("VALUE_TST_SHOW_RESULTS", $this->lng->txt("tst_show_results"));
04664 $this->ctrl->setParameterByClass("iltestoutputgui", "active_id", $data->active_id);
04665 $this->tpl->setVariable("URL_TST_SHOW_RESULTS", $this->ctrl->getLinkTargetByClass("iltestoutputgui", "outParticipantsResultsOverview"));
04666 }
04667 $counter++;
04668 $this->tpl->parseCurrentBlock();
04669 }
04670 if (count($data_array))
04671 {
04672 $this->tpl->setCurrentBlock("selectall");
04673 $this->tpl->setVariable("SELECT_ALL", $this->lng->txt("select_all"));
04674 $counter++;
04675 $this->tpl->setVariable("COLOR_CLASS", $rowclass[$counter % 2]);
04676 $this->tpl->parseCurrentBlock();
04677 }
04678 $this->tpl->setCurrentBlock($block_result);
04679 $this->tpl->setVariable("$title_label", "<img src=\"" . ilUtil::getImagePath("icon_usr_b.gif") . "\" alt=\"".$this->lng->txt("objs_usr")."\" align=\"middle\" /> " . $title_text);
04680 $this->tpl->setVariable("TEXT_IV_LOGIN", $this->lng->txt("login"));
04681 $this->tpl->setVariable("TEXT_IV_FIRSTNAME", $this->lng->txt("firstname"));
04682 $this->tpl->setVariable("TEXT_IV_LASTNAME", $this->lng->txt("lastname"));
04683 $this->tpl->setVariable("TEXT_IV_TEST_FINISHED", $this->lng->txt("tst_finished"));
04684 $this->tpl->setVariable("TEXT_IV_TEST_STARTED", $this->lng->txt("tst_started"));
04685 $this->tpl->setVariable("TEXT_IV_LAST_ACCESS", $this->lng->txt("last_access"));
04686 $this->tpl->parseCurrentBlock();
04687 break;
04688 case "usr":
04689 $counter = 0;
04690 foreach ($data_array as $data)
04691 {
04692 $this->tpl->setCurrentBlock($block_row);
04693 $this->tpl->setVariable("COLOR_CLASS", $rowclass[$counter % 2]);
04694 $this->tpl->setVariable("COUNTER", $data->usr_id);
04695 $this->tpl->setVariable("VALUE_LOGIN", $data->login);
04696 $this->tpl->setVariable("VALUE_FIRSTNAME", $data->firstname);
04697 $this->tpl->setVariable("VALUE_LASTNAME", $data->lastname);
04698 $this->tpl->setVariable("VALUE_CLIENT_IP", $data->clientip);
04699 $counter++;
04700 $this->tpl->parseCurrentBlock();
04701 }
04702 if (count($data_array))
04703 {
04704 $this->tpl->setCurrentBlock("selectall_user_row");
04705 $this->tpl->setVariable("SELECT_ALL", $this->lng->txt("select_all"));
04706 $counter++;
04707 $this->tpl->setVariable("COLOR_CLASS", $rowclass[$counter % 2]);
04708 $this->tpl->parseCurrentBlock();
04709 }
04710 $this->tpl->setCurrentBlock($block_result);
04711 $this->tpl->setVariable("$title_label", "<img src=\"" . ilUtil::getImagePath("icon_usr_b.gif") . "\" alt=\"".$this->lng->txt("objs_usr")."\" align=\"middle\" /> " . $title_text);
04712 $this->tpl->setVariable("TEXT_LOGIN", $this->lng->txt("login"));
04713 $this->tpl->setVariable("TEXT_FIRSTNAME", $this->lng->txt("firstname"));
04714 $this->tpl->setVariable("TEXT_LASTNAME", $this->lng->txt("lastname"));
04715 $this->tpl->setVariable("TEXT_CLIENT_IP", $this->lng->txt("clientip"));
04716
04717 if ($ilAccess->checkAccess("write", "", $this->object->getRefId()))
04718 {
04719 foreach ($buttons as $cat)
04720 {
04721 $this->tpl->setVariable("VALUE_" . strtoupper($cat), $this->lng->txt($cat));
04722 }
04723 $this->tpl->setVariable("ARROW", "<img src=\"" . ilUtil::getImagePath("arrow_downright.gif") . "\" alt=\"".$this->lng->txt("arrow_downright")."\"/>");
04724 }
04725 $this->tpl->parseCurrentBlock();
04726 break;
04727
04728 case "role":
04729 case "grp":
04730 $counter = 0;
04731 foreach ($data_array as $key => $data)
04732 {
04733 $this->tpl->setCurrentBlock($block_row);
04734 $this->tpl->setVariable("COLOR_CLASS", $rowclass[$counter % 2]);
04735 $this->tpl->setVariable("COUNTER", $key);
04736 $this->tpl->setVariable("VALUE_TITLE", $data->title);
04737 $this->tpl->setVariable("VALUE_DESCRIPTION", $data->description);
04738 $counter++;
04739 $this->tpl->parseCurrentBlock();
04740 }
04741 if (count($data_array))
04742 {
04743 $this->tpl->setCurrentBlock("selectall_" . $a_type . "_row");
04744 $this->tpl->setVariable("SELECT_ALL", $this->lng->txt("select_all"));
04745 $counter++;
04746 $this->tpl->setVariable("COLOR_CLASS", $rowclass[$counter % 2]);
04747 $this->tpl->parseCurrentBlock();
04748 }
04749 $this->tpl->setCurrentBlock($block_result);
04750 $this->tpl->setVariable("$title_label", "<img src=\"" . ilUtil::getImagePath("icon_".$a_type."_b.gif") . "\" align=\"middle\" alt=\"".$this->lng->txt("objs_".$a_type)."\" /> " . $title_text);
04751 $this->tpl->setVariable("TEXT_TITLE", $this->lng->txt("title"));
04752 $this->tpl->setVariable("TEXT_DESCRIPTION", $this->lng->txt("description"));
04753 if ($ilAccess->checkAccess("write", "", $this->object->getRefId()))
04754 {
04755 foreach ($buttons as $cat)
04756 {
04757 $this->tpl->setVariable("VALUE_" . strtoupper($cat), $this->lng->txt($cat));
04758 }
04759 $this->tpl->setVariable("ARROW", "<img src=\"" . ilUtil::getImagePath("arrow_downright.gif") . "\" alt=\"".$this->lng->txt("arrow_downright")."\"/>");
04760 }
04761 $this->tpl->parseCurrentBlock();
04762 break;
04763 }
04764 }
04765
04766 function addParticipantsObject()
04767 {
04768 $countusers = 0;
04769 $countgroups = 0;
04770 $countroles = 0;
04771
04772 if (is_array($_POST["user_select"]))
04773 {
04774 $i = 0;
04775 foreach ($_POST["user_select"] as $user_id)
04776 {
04777 $client_ip = $_POST["client_ip"][$i];
04778 $this->object->inviteUser($user_id, $client_ip);
04779 $countusers++;
04780 $i++;
04781 }
04782 }
04783
04784 if (is_array($_POST["group_select"]))
04785 {
04786 foreach ($_POST["group_select"] as $group_id)
04787 {
04788 $this->object->inviteGroup($group_id);
04789 $countgroups++;
04790 }
04791 }
04792
04793 if (is_array($_POST["role_select"]))
04794 {
04795 foreach ($_POST["role_select"] as $role_id)
04796 {
04797 $this->object->inviteRole($role_id);
04798 $countroles++;
04799 }
04800 }
04801 $message = "";
04802 if ($countusers)
04803 {
04804 $message = $this->lng->txt("tst_invited_selected_users");
04805 }
04806 if ($countgroups)
04807 {
04808 if (strlen($message)) $message .= "<br />";
04809 $message = $this->lng->txt("tst_invited_selected_groups");
04810 }
04811 if ($countroles)
04812 {
04813 if (strlen($message)) $message .= "<br />";
04814 $message = $this->lng->txt("tst_invited_selected_roles");
04815 }
04816 if (strlen($message))
04817 {
04818 ilUtil::sendInfo($message, TRUE);
04819 }
04820 else
04821 {
04822 ilUtil::sendInfo($this->lng->txt("tst_invited_nobody"), TRUE);
04823 }
04824
04825 $this->ctrl->redirect($this, "inviteParticipants");
04826 }
04827
04828 function searchParticipantsObject()
04829 {
04830 $this->inviteParticipantsObject();
04831 }
04832
04840 function defaultsObject()
04841 {
04842 global $ilUser;
04843
04844 $this->tpl->addBlockFile("ADM_CONTENT", "adm_content", "tpl.il_as_tst_defaults.html", "Modules/Test");
04845
04846 $maxentries = $ilUser->getPref("hits_per_page");
04847 if ($maxentries < 1)
04848 {
04849 $maxentries = 9999;
04850 }
04851
04852 $offset = $_GET["offset"] ? $_GET["offset"] : 0;
04853 $sortby = $_GET["sort_by"] ? $_GET["sort_by"] : "name";
04854 $sortorder = $_GET["sort_order"] ? $_GET["sort_order"] : "asc";
04855
04856 $defaults =& $this->object->getAvailableDefaults($sortby, $sortorder);
04857 if (count($defaults) > 0)
04858 {
04859 $tablerows = array();
04860 foreach ($defaults as $row)
04861 {
04862 array_push($tablerows, array("checkbox" => "<input type=\"checkbox\" name=\"chb_defaults[]\" value=\"" . $row["test_defaults_id"] . "\"/>", "name" => $row["name"]));
04863 }
04864 $headervars = array("", "name");
04865
04866 include_once "./Services/Table/classes/class.ilTableGUI.php";
04867 $tbl = new ilTableGUI(0, FALSE);
04868 $tbl->setTitle($this->lng->txt("tst_defaults_available"));
04869 $header_names = array(
04870 "",
04871 $this->lng->txt("title")
04872 );
04873 $tbl->setHeaderNames($header_names);
04874
04875 $tbl->disable("sort");
04876 $tbl->disable("auto_sort");
04877 $tbl->enable("title");
04878 $tbl->enable("action");
04879 $tbl->enable("select_all");
04880 $tbl->setLimit($maxentries);
04881 $tbl->setOffset($offset);
04882 $tbl->setData($tablerows);
04883 $tbl->setMaxCount(count($tablerows));
04884 $tbl->setOrderDirection($sortorder);
04885 $tbl->setSelectAllCheckbox("chb_defaults");
04886 $tbl->setFormName("formDefaults");
04887 $tbl->addActionButton("deleteDefaults", $this->lng->txt("delete"));
04888 $tbl->addActionButton("applyDefaults", $this->lng->txt("apply"));
04889
04890 $header_params = $this->ctrl->getParameterArray($this, "defaults");
04891 $tbl->setHeaderVars($headervars, $header_params);
04892
04893
04894 $tbl->setFooter("tblfooter", $this->lng->txt("previous"), $this->lng->txt("next"));
04895
04896 $tableoutput = $tbl->render();
04897 $this->tpl->setVariable("TEST_DEFAULTS_TABLE", $tableoutput);
04898 }
04899 else
04900 {
04901 $this->tpl->setVariable("TEST_DEFAULTS_TABLE", $this->lng->txt("tst_defaults_not_defined"));
04902 }
04903 $this->tpl->setVariable("FORMACTION", $this->ctrl->getFormAction($this, "addDefaults"));
04904 $this->tpl->setVariable("BUTTON_ADD", $this->lng->txt("add"));
04905 $this->tpl->setVariable("TEXT_DEFAULTS_OF_TEST", $this->lng->txt("tst_defaults_defaults_of_test"));
04906 }
04907
04911 function deleteDefaultsObject()
04912 {
04913 if (count($_POST["chb_defaults"]))
04914 {
04915 foreach ($_POST["chb_defaults"] as $test_default_id)
04916 {
04917 $this->object->deleteDefaults($test_default_id);
04918 }
04919 }
04920 $this->defaultsObject();
04921 }
04922
04926 function applyDefaultsObject()
04927 {
04928 if (count($_POST["chb_defaults"]) == 1)
04929 {
04930 foreach ($_POST["chb_defaults"] as $test_default_id)
04931 {
04932 $result = $this->object->applyDefaults($test_default_id);
04933 if (!$result)
04934 {
04935 ilUtil::sendInfo($this->lng->txt("tst_defaults_apply_not_possible"));
04936 }
04937 else
04938 {
04939 ilUtil::sendInfo($this->lng->txt("tst_defaults_applied"));
04940 }
04941 }
04942 }
04943 else
04944 {
04945 ilUtil::sendInfo($this->lng->txt("tst_defaults_apply_select_one"));
04946 }
04947 $this->defaultsObject();
04948 }
04949
04953 function addDefaultsObject()
04954 {
04955 if (strlen($_POST["name"]) > 0)
04956 {
04957 $this->object->addDefaults($_POST['name']);
04958 }
04959 else
04960 {
04961 ilUtil::sendInfo($this->lng->txt("tst_defaults_enter_name"));
04962 }
04963 $this->defaultsObject();
04964 }
04965
04971 function infoScreenObject()
04972 {
04973 $this->ctrl->setCmd("showSummary");
04974 $this->ctrl->setCmdClass("ilinfoscreengui");
04975 $this->infoScreen();
04976 }
04977
04978 function redirectToInfoScreenObject()
04979 {
04980 $this->ctrl->setCmd("showSummary");
04981 $this->ctrl->setCmdClass("ilinfoscreengui");
04982 $this->infoScreen($_SESSION["lock"]);
04983 }
04984
04988 function infoScreen($session_lock = "")
04989 {
04990 global $ilAccess;
04991 global $ilUser;
04992
04993
04994
04995
04996
04997
04998
04999
05000
05001 {
05002 if ($this->object->getTestSequence()->hasHiddenQuestions())
05003 {
05004 $this->object->getTestSequence()->clearHiddenQuestions();
05005 $this->object->getTestSequence()->saveToDb();
05006 }
05007 }
05008
05009 if (!$ilAccess->checkAccess("visible", "", $this->ref_id))
05010 {
05011 $this->ilias->raiseError($this->lng->txt("msg_no_perm_read"),$this->ilias->error_obj->MESSAGE);
05012 }
05013
05014 include_once("./Services/InfoScreen/classes/class.ilInfoScreenGUI.php");
05015 $info = new ilInfoScreenGUI($this);
05016
05017 $seq = $this->object->getTestSession()->getLastSequence();
05018
05019 include_once "./Modules/Test/classes/class.ilTestOutputGUI.php";
05020 $output_gui =& new ilTestOutputGUI($this->object);
05021 $this->ctrl->setParameter($output_gui, "sequence", $seq);
05022 $info->setFormAction($this->ctrl->getFormAction($output_gui));
05023 if (strlen($session_lock))
05024 {
05025 $info->addHiddenElement("lock", $session_lock);
05026 }
05027 else
05028 {
05029 $info->addHiddenElement("lock", md5($_COOKIE['PHPSESSID'] . time()));
05030 }
05031 $online_access = false;
05032 if ($this->object->getFixedParticipants())
05033 {
05034 include_once "./Modules/Test/classes/class.ilObjTestAccess.php";
05035 $online_access_result = ilObjTestAccess::_lookupOnlineTestAccess($this->object->getId(), $ilUser->getId());
05036 if ($online_access_result === true)
05037 {
05038 $online_access = true;
05039 }
05040 else
05041 {
05042 ilUtil::sendInfo($online_access_result);
05043 }
05044 }
05045 if ($this->object->isComplete())
05046 {
05047 if ((!$this->object->getFixedParticipants() || $online_access) && $ilAccess->checkAccess("read", "", $this->ref_id))
05048 {
05049 $executable = $this->object->isExecutable($ilUser->getId(), $allowPassIncrease = TRUE);
05050 if ($executable["executable"])
05051 {
05052 if ($this->object->getTestSession()->getActiveId() > 0)
05053 {
05054
05055 $resume_text = $this->lng->txt("tst_resume_test");
05056 if (($seq < 1) || ($seq == $this->object->getTestSequence()->getFirstSequence()))
05057 {
05058 $resume_text = $this->object->getStartTestLabel($this->object->getTestSession()->getActiveId());
05059 }
05060
05061 #if(!$_GET['crs_show_result'] or $this->object->getTestSequence()->getFirstSequence())
05062 {
05063 $info->addFormButton("resume", $resume_text);
05064 }
05065 }
05066 else
05067 {
05068
05069 $info->addFormButton("start", $this->object->getStartTestLabel($this->object->getTestSession()->getActiveId()));
05070 }
05071 }
05072 else
05073 {
05074 ilUtil::sendInfo($executable["errormessage"]);
05075 }
05076 if ($this->object->getTestSession()->getActiveId() > 0)
05077 {
05078
05079 if ($this->object->canShowTestResults($ilUser->getId()))
05080 {
05081 $info->addFormButton("outUserResultsOverview", $this->lng->txt("tst_show_results"));
05082 }
05083 }
05084 }
05085 if ($this->object->getTestSession()->getActiveId() > 0)
05086 {
05087 if ($this->object->canShowSolutionPrintview($ilUser->getId()))
05088 {
05089 $info->addFormButton("outUserListOfAnswerPasses", $this->lng->txt("tst_list_of_answers_show"));
05090 }
05091 }
05092 }
05093
05094 $info->enablePrivateNotes();
05095
05096 if (strlen($this->object->getIntroduction()))
05097 {
05098 $info->addSection($this->lng->txt("tst_introduction"));
05099 $info->addProperty("", $this->object->prepareTextareaOutput($this->object->getIntroduction()));
05100 }
05101
05102 $info->addSection($this->lng->txt("tst_general_properties"));
05103 $info->addProperty($this->lng->txt("author"), $this->object->getAuthor());
05104 $info->addProperty($this->lng->txt("title"), $this->object->getTitle());
05105 if ($this->object->isComplete())
05106 {
05107 if ((!$this->object->getFixedParticipants() || $online_access) && $ilAccess->checkAccess("read", "", $this->ref_id))
05108 {
05109
05110 $checked_javascript = false;
05111 if ($this->object->getJavaScriptOutput())
05112 {
05113 $checked_javascript = true;
05114 }
05115 $info->addPropertyCheckbox($this->lng->txt("tst_test_output"), "chb_javascript", 1, $this->lng->txt("tst_use_javascript"), $checked_javascript);
05116
05117
05118 if (!$this->object->isRandomTest())
05119 {
05120 if ($this->object->getNrOfTries() != 1)
05121 {
05122 if ($this->object->getUsePreviousAnswers() == 0)
05123 {
05124 $info->addProperty($this->lng->txt("tst_use_previous_answers"), $this->lng->txt("tst_dont_use_previous_answers"));
05125 }
05126 else
05127 {
05128 $use_previous_answers = FALSE;
05129 if ($ilUser->prefs["tst_use_previous_answers"])
05130 {
05131 $checked_previous_answers = TRUE;
05132 }
05133 $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);
05134 }
05135 }
05136 }
05137 if ($_SESSION["AccountId"] == ANONYMOUS_USER_ID)
05138 {
05139 $info->addPropertyTextinput($this->lng->txt("enter_anonymous_code"), "anonymous_id", "", 8, "setAnonymousId", $this->lng->txt("submit"));
05140 }
05141 }
05142 }
05143
05144 $info->addSection($this->lng->txt("tst_sequence_properties"));
05145 $info->addProperty($this->lng->txt("tst_sequence"), $this->lng->txt(($this->object->getSequenceSettings() == TEST_FIXED_SEQUENCE)? "tst_sequence_fixed":"tst_sequence_postpone"));
05146
05147 $info->addSection($this->lng->txt("tst_heading_scoring"));
05148 $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"));
05149 $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"));
05150 if ($this->object->isRandomTest())
05151 {
05152 $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"));
05153 }
05154
05155 $info->addSection($this->lng->txt("tst_score_reporting"));
05156 $score_reporting_text = "";
05157 switch ($this->object->getScoreReporting())
05158 {
05159 case REPORT_AFTER_TEST:
05160 $score_reporting_text = $this->lng->txt("tst_report_after_test");
05161 break;
05162 case REPORT_ALWAYS:
05163 $score_reporting_text = $this->lng->txt("tst_report_after_first_question");
05164 break;
05165 case REPORT_AFTER_DATE:
05166 $score_reporting_text = $this->lng->txt("tst_report_after_date");
05167 break;
05168 }
05169 $info->addProperty($this->lng->txt("tst_score_reporting"), $score_reporting_text);
05170 $reporting_date = $this->object->getReportingDate();
05171 if ($reporting_date)
05172 {
05173 preg_match("/(\d{4})(\d{2})(\d{2})(\d{2})(\d{2})(\d{2})/", $reporting_date, $matches);
05174 $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]));
05175 $info->addProperty($this->lng->txt("tst_score_reporting_date"), $txt_reporting_date);
05176 }
05177
05178 $info->addSection($this->lng->txt("tst_session_settings"));
05179 $info->addProperty($this->lng->txt("tst_nr_of_tries"), ($this->object->getNrOfTries() == 0)?$this->lng->txt("unlimited"):$this->object->getNrOfTries());
05180 if ($this->object->getNrOfTries() != 1)
05181 {
05182 $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());
05183 }
05184
05185 if ($this->object->getEnableProcessingTime())
05186 {
05187 $info->addProperty($this->lng->txt("tst_processing_time"), $this->object->getProcessingTime());
05188 }
05189 if (strlen($this->object->getAllowedUsers()) && ($this->object->getAllowedUsersTimeGap()))
05190 {
05191 $info->addProperty($this->lng->txt("tst_allowed_users"), $this->object->getAllowedUsers());
05192 }
05193
05194 $starting_time = $this->object->getStartingTime();
05195 if ($starting_time)
05196 {
05197 preg_match("/(\d{4})(\d{2})(\d{2})(\d{2})(\d{2})(\d{2})/", $starting_time, $matches);
05198 $txt_starting_time = date($this->lng->text["lang_dateformat"] . " " . $this->lng->text["lang_timeformat"], mktime($matches[4], $matches[5], $matches[6], $matches[2], $matches[3], $matches[1]));
05199 $info->addProperty($this->lng->txt("tst_starting_time"), $txt_starting_time);
05200 }
05201 $ending_time = $this->object->getEndingTime();
05202 if ($ending_time)
05203 {
05204 preg_match("/(\d{4})(\d{2})(\d{2})(\d{2})(\d{2})(\d{2})/", $ending_time, $matches);
05205 $txt_ending_time = date($this->lng->text["lang_dateformat"] . " " . $this->lng->text["lang_timeformat"], mktime($matches[4], $matches[5], $matches[6], $matches[2], $matches[3], $matches[1]));
05206 $info->addProperty($this->lng->txt("tst_ending_time"), $txt_ending_time);
05207 }
05208 $info->addMetaDataSections($this->object->getId(),0, $this->object->getType());
05209
05210
05211 if($_GET['crs_show_result'] and !$this->object->getTestSequence()->getFirstSequence())
05212 {
05213 #ilUtil::sendInfo($this->lng->txt('crs_all_questions_answered_successfully'));
05214 }
05215
05216 $this->ctrl->forwardCommand($info);
05217 }
05218
05219 function addLocatorItems()
05220 {
05221 global $ilLocator;
05222 switch ($this->ctrl->getCmd())
05223 {
05224 case "run":
05225 case "infoScreen":
05226 case "redirectToInfoScreen":
05227 case "start":
05228 case "resume":
05229 case "previous":
05230 case "next":
05231 case "summary":
05232 case "finishTest":
05233 case "outCorrectSolution":
05234 case "passDetails":
05235 case "showAnswersOfUser":
05236 case "outUserResultsOverview":
05237 case "backFromSummary":
05238 case "show_answers":
05239 case "setsolved":
05240 case "resetsolved":
05241 case "outTestSummary":
05242 case "outQuestionSummary":
05243 case "gotoQuestion":
05244 case "selectImagemapRegion":
05245 case "confirmSubmitAnswers":
05246 case "finalSubmission":
05247 case "postpone":
05248 case "redirectQuestion":
05249 case "outUserPassDetails":
05250 case "checkPassword":
05251 $ilLocator->addItem($this->object->getTitle(), $this->ctrl->getLinkTarget($this, "infoScreen"), "", $_GET["ref_id"]);
05252 break;
05253 case "eval_stat":
05254 case "evalAllUsers":
05255 case "evalUserDetail":
05256 $ilLocator->addItem($this->object->getTitle(), $this->ctrl->getLinkTarget($this, "eval_stat"), "", $_GET["ref_id"]);
05257 break;
05258 case "create":
05259 case "save":
05260 case "cancel":
05261 case "importFile":
05262 case "cloneAll":
05263 case "importVerifiedFile":
05264 case "cancelImport":
05265 break;
05266 default:
05267 $ilLocator->addItem($this->object->getTitle(), $this->ctrl->getLinkTarget($this, ""), "", $_GET["ref_id"]);
05268 break;
05269 }
05270 }
05271
05272 function getBrowseForQuestionsTab(&$tabs_gui)
05273 {
05274 global $ilAccess;
05275 if ($ilAccess->checkAccess("write", "", $this->ref_id))
05276 {
05277
05278 $tabs_gui->setBackTarget($this->lng->txt("backtocallingtest"), $this->ctrl->getLinkTarget($this, "questions"));
05279 $tabs_gui->addTarget("tst_browse_for_questions",
05280 $this->ctrl->getLinkTarget($this, "browseForQuestions"),
05281 array("browseForQuestions", "filter", "resetFilter", "resetTextFilter", "insertQuestions"),
05282 "", "", TRUE
05283 );
05284 }
05285 }
05286
05287 function getRandomQuestionsTab(&$tabs_gui)
05288 {
05289 global $ilAccess;
05290 if ($ilAccess->checkAccess("write", "", $this->ref_id))
05291 {
05292
05293 $tabs_gui->setBackTarget($this->lng->txt("backtocallingtest"), $this->ctrl->getLinkTarget($this, "questions"));
05294 $tabs_gui->addTarget("random_selection",
05295 $this->ctrl->getLinkTarget($this, "randomQuestions"),
05296 array("randomQuestions"),
05297 "", ""
05298 );
05299 }
05300 }
05301
05302 function statisticsObject()
05303 {
05304 }
05305
05309 function certificateObject()
05310 {
05311 include_once "./Modules/Test/classes/class.ilTestCertificateGUI.php";
05312 $output_gui = new ilTestCertificateGUI($this->object);
05313 $output_gui->certificateEditor();
05314 }
05315
05316 function getQuestionsSubTabs()
05317 {
05318 global $ilTabs;
05319
05320
05321 $ilTabs->addSubTabTarget("edit_test_questions",
05322 $this->ctrl->getLinkTarget($this,'questions'),
05323 array("questions", "browseForQuestions", "questionBrowser", "createQuestion",
05324 "randomselect", "filter", "resetFilter", "insertQuestions",
05325 "back", "createRandomSelection", "cancelRandomSelect",
05326 "insertRandomSelection", "removeQuestions", "moveQuestions",
05327 "insertQuestionsBefore", "insertQuestionsAfter", "confirmRemoveQuestions",
05328 "cancelRemoveQuestions", "executeCreateQuestion", "cancelCreateQuestion",
05329 "addQuestionpool", "saveRandomQuestions", "saveQuestionSelectionMode"),
05330 "");
05331
05332
05333 if (!$this->object->isRandomTest())
05334 {
05335 $ilTabs->addSubTabTarget("print_view",
05336 $this->ctrl->getLinkTarget($this,'print'),
05337 "print", "");
05338 }
05339
05340 }
05341
05342 function getStatisticsSubTabs()
05343 {
05344 global $ilTabs;
05345
05346
05347 $ilTabs->addSubTabTarget("eval_all_users",
05348 $this->ctrl->getLinkTargetByClass("iltestevaluationgui", "outEvaluation"),
05349 array("outEvaluation", "detailedEvaluation", "exportEvaluation", "evalUserDetail", "passDetails",
05350 "outStatisticsResultsOverview", "statisticsPassDetails")
05351 , "");
05352
05353
05354 $ilTabs->addSubTabTarget("tst_results_aggregated",
05355 $this->ctrl->getLinkTargetByClass("iltestevaluationgui", "eval_a"),
05356 array("eval_a"),
05357 "", "");
05358
05359 }
05360
05361 function getParticipantsSubTabs()
05362 {
05363 global $ilTabs;
05364
05365
05366 $ilTabs->addSubTabTarget("participants_data",
05367 $this->ctrl->getLinkTarget($this,'participants'),
05368 array("participants", "saveFixedParticipantsStatus",
05369 "showParticipantAnswersForAuthor", "showResults",
05370 "confirmDeleteAllUserData",
05371 "deleteAllUserResults",
05372 "cancelDeleteAllUserData", "deleteSingleUserResults",
05373 "outParticipantsResultsOverview", "outParticipantsPassDetails",
05374 "showPassOverview", "showUserAnswers", "participantsAction"
05375 ),
05376 "", "");
05377
05378
05379 $ilTabs->addSubTabTarget("participants_invitation",
05380 $this->ctrl->getLinkTarget($this, "inviteParticipants"),
05381 array("inviteParticipants", "searchParticipants"),
05382 "", "");
05383
05384 }
05385
05386 function getSettingsSubTabs()
05387 {
05388 global $ilTabs, $ilias;
05389
05390
05391 $force_active = ($this->ctrl->getCmd() == "")
05392 ? true
05393 : false;
05394 $ilTabs->addSubTabTarget("general",
05395 $this->ctrl->getLinkTarget($this,'properties'),
05396 array("properties", "saveProperties", "cancelProperties"),
05397 array("", "ilobjtestgui", "iltestcertificategui"),
05398 "", $force_active);
05399
05400
05401 $ilTabs->addSubTabTarget(
05402 "scoring",
05403 $this->ctrl->getLinkTarget($this,'scoring'),
05404 array("scoring"),
05405 array("", "ilobjtestgui", "iltestcertificategui")
05406 );
05407
05408
05409 $ilTabs->addSubTabTarget(
05410 "mark_schema",
05411 $this->ctrl->getLinkTarget($this,'marks'),
05412 array("marks", "addMarkStep", "deleteMarkSteps", "addSimpleMarkSchema",
05413 "saveMarks", "cancelMarks"),
05414 array("", "ilobjtestgui", "iltestcertificategui")
05415 );
05416
05417 if ((strlen($ilias->getSetting("rpc_server_host"))) && (strlen($ilias->getSetting("rpc_server_port"))))
05418 {
05419
05420 $ilTabs->addSubTabTarget(
05421 "certificate",
05422 $this->ctrl->getLinkTarget($this,'certificate'),
05423 array("certificate", "certificateEditor", "certificateRemoveBackground", "certificateSave",
05424 "certificatePreview", "certificateDelete", "certificateUpload", "certificateImport"),
05425 array("", "ilobjtestgui", "iltestcertificategui")
05426 );
05427 }
05428
05429
05430 $ilTabs->addSubTabTarget(
05431 "defaults",
05432 $this->ctrl->getLinkTarget($this, "defaults"),
05433 array("defaults", "deleteDefaults", "addDefaults", "applyDefaults"),
05434 array("", "ilobjtestgui", "iltestcertificategui")
05435 );
05436 }
05437
05443 function getTabs(&$tabs_gui)
05444 {
05445 global $ilAccess,$ilUser;
05446
05447 switch ($this->ctrl->getCmd())
05448 {
05449 case "start":
05450 case "resume":
05451 case "previous":
05452 case "next":
05453 case "summary":
05454 case "directfeedback":
05455 case "finishTest":
05456 case "outCorrectSolution":
05457 case "passDetails":
05458 case "showAnswersOfUser":
05459 case "outUserResultsOverview":
05460 case "backFromSummary":
05461 case "show_answers":
05462 case "setsolved":
05463 case "resetsolved":
05464 case "confirmFinish":
05465 case "outTestSummary":
05466 case "outQuestionSummary":
05467 case "gotoQuestion":
05468 case "selectImagemapRegion":
05469 case "confirmSubmitAnswers":
05470 case "finalSubmission":
05471 case "postpone":
05472 case "redirectQuestion":
05473 case "outUserPassDetails":
05474 case "checkPassword":
05475 case "exportCertificate":
05476 case "finishListOfAnswers":
05477 case "backConfirmFinish":
05478 return;
05479 break;
05480 case "browseForQuestions":
05481 case "filter":
05482 case "resetFilter":
05483 case "resetTextFilter":
05484 case "insertQuestions":
05485 return $this->getBrowseForQuestionsTab($tabs_gui);
05486 break;
05487 case "showParticipantAnswersForAuthor":
05488 case "inviteParticipants":
05489 case "participants":
05490 case "outParticipantsPassDetails":
05491 case "outParticipantsResultsOverview":
05492 case "deleteAllUserResults":
05493 case "confirmDeleteAllUserData":
05494 case "cancelDeleteAllUserData":
05495 case "deleteSingleUserResults":
05496 case "searchParticipants":
05497 case "showPassOverview":
05498 case "showUserAnswers":
05499 $this->getParticipantsSubTabs();
05500 break;
05501 case "scoring":
05502 case "properties":
05503 case "marks":
05504 case "saveMarks":
05505 case "cancelMarks":
05506 case "addMarkStep":
05507 case "deleteMarkSteps":
05508 case "addSimpleMarkSchema":
05509 case "certificate":
05510 case "certificateImport":
05511 case "certificateUpload":
05512 case "certificateEditor":
05513 case "certificateSave":
05514 case "defaults":
05515 case "deleteDefaults":
05516 case "addDefaults":
05517 case "applyDefaults":
05518 case "":
05519 if (($ilAccess->checkAccess("write", "", $this->ref_id)) && ((strcmp($this->ctrl->getCmdClass(), "ilobjtestgui") == 0) || (strcmp($this->ctrl->getCmdClass(), "iltestcertificategui") == 0) || (strlen($this->ctrl->getCmdClass()) == 0)))
05520 {
05521 $this->getSettingsSubTabs();
05522 }
05523 break;
05524 case "export":
05525 case "print":
05526 break;
05527 case "statistics":
05528 case "eval_a":
05529 case "detailedEvaluation":
05530 case "outEvaluation":
05531 case "exportEvaluation":
05532 case "evalUserDetail":
05533 case "passDetails":
05534 case "outStatisticsResultsOverview":
05535 case "statisticsPassDetails":
05536 $this->getStatisticsSubTabs();
05537 break;
05538 }
05539
05540 if (strcmp(strtolower(get_class($this->object)), "ilobjtest") == 0)
05541 {
05542
05543 if ($ilAccess->checkAccess("write", "", $this->ref_id))
05544 {
05545 $force_active = ($_GET["up"] != "" || $_GET["down"] != "")
05546 ? true
05547 : false;
05548 if (!$force_active)
05549 {
05550 if ($_GET["browse"] == 1) $force_active = true;
05551 if (preg_match("/deleteqpl_\d+/", $this->ctrl->getCmd()))
05552 {
05553 $force_active = true;
05554 }
05555 }
05556 $tabs_gui->addTarget("assQuestions",
05557 $this->ctrl->getLinkTarget($this,'questions'),
05558 array("questions", "browseForQuestions", "questionBrowser", "createQuestion",
05559 "randomselect", "filter", "resetFilter", "insertQuestions",
05560 "back", "createRandomSelection", "cancelRandomSelect",
05561 "insertRandomSelection", "removeQuestions", "moveQuestions",
05562 "insertQuestionsBefore", "insertQuestionsAfter", "confirmRemoveQuestions",
05563 "cancelRemoveQuestions", "executeCreateQuestion", "cancelCreateQuestion",
05564 "addQuestionpool", "saveRandomQuestions", "saveQuestionSelectionMode", "print"),
05565 "", "", $force_active);
05566 }
05567
05568
05569 if ($ilAccess->checkAccess("visible", "", $this->ref_id))
05570 {
05571 $tabs_gui->addTarget("info",
05572 $this->ctrl->getLinkTarget($this,'infoScreen'),
05573 array("infoScreen", "outIntroductionPage", "showSummary",
05574 "setAnonymousId", "outUserListOfAnswerPasses", "redirectToInfoScreen"));
05575 }
05576
05577
05578 if ($ilAccess->checkAccess("write", "", $this->ref_id))
05579 {
05580 $tabs_gui->addTarget("settings",
05581 $this->ctrl->getLinkTarget($this,'properties'),
05582 array("properties", "saveProperties", "cancelProperties",
05583 "marks", "addMarkStep", "deleteMarkSteps", "addSimpleMarkSchema",
05584 "saveMarks", "cancelMarks",
05585 "certificate", "certificateEditor", "certificateRemoveBackground",
05586 "certificateSave", "certificatePreview", "certificateDelete", "certificateUpload",
05587 "certificateImport", "scoring", "defaults", "addDefaults", "deleteDefaults", "applyDefaults",
05588 ""
05589 ),
05590 array("", "ilobjtestgui", "iltestcertificategui")
05591 );
05592 }
05593
05594 if ($ilAccess->checkAccess("write", "", $this->ref_id))
05595 {
05596
05597 $tabs_gui->addTarget("meta_data",
05598 $this->ctrl->getLinkTargetByClass('ilmdeditorgui','listSection'),
05599 "", "ilmdeditorgui");
05600 }
05601
05602 if ($ilAccess->checkAccess("write", "", $this->ref_id))
05603 {
05604
05605 $tabs_gui->addTarget("participants",
05606 $this->ctrl->getLinkTarget($this,'participants'),
05607 array("participants", "searchParticipants", "addParticipants", "saveClientIP",
05608 "removeParticipant", "inviteParticipants",
05609 "saveFixedParticipantsStatus", "showParticipantAnswersForAuthor",
05610 "deleteAllUserResults",
05611 "cancelDeleteAllUserData", "deleteSingleUserResults",
05612 "outParticipantsResultsOverview", "outParticipantsPassDetails",
05613 "showPassOverview", "showUserAnswers", "participantsAction"),
05614 "");
05615
05616
05617 $tabs_gui->addTarget("export",
05618 $this->ctrl->getLinkTarget($this,'export'),
05619 array("export", "createExportFile", "confirmDeleteExportFile",
05620 "downloadExportFile", "deleteExportFile", "cancelDeleteExportFile"),
05621 "");
05622
05623 include_once "./classes/class.ilObjAssessmentFolder.php";
05624 $scoring = ilObjAssessmentFolder::_getManualScoring();
05625 if (count($scoring))
05626 {
05627
05628 $tabs_gui->addTarget("manscoring",
05629 $this->ctrl->getLinkTargetByClass("iltestscoringgui", "manscoring"),
05630 array("manscoring", "selectParticipant", "setPointsManual", "setFeedbackManual"),
05631 "");
05632 }
05633 }
05634
05635 if (($ilAccess->checkAccess("tst_statistics", "", $this->ref_id)) || ($ilAccess->checkAccess("write", "", $this->ref_id)))
05636 {
05637
05638 $tabs_gui->addTarget("statistics",
05639 $this->ctrl->getLinkTargetByClass("iltestevaluationgui", "outEvaluation"),
05640 array("statistics", "outEvaluation", "exportEvaluation", "detailedEvaluation", "eval_a", "evalUserDetail",
05641 "passDetails", "outStatisticsResultsOverview", "statisticsPassDetails")
05642 , "");
05643 }
05644
05645 if ($ilAccess->checkAccess("write", "", $this->ref_id))
05646 {
05647
05648 include_once("Services/Tracking/classes/class.ilObjUserTracking.php");
05649 if(ilObjUserTracking::_enabledLearningProgress() and $ilAccess->checkAccess("edit_learning_progress", "", $this->ref_id) and $ilUser->getId() != ANONYMOUS_USER_ID)
05650 {
05651 $tabs_gui->addTarget('learning_progress',
05652 $this->ctrl->getLinkTargetByClass(array('illearningprogressgui'),''),
05653 '',
05654 array('illplistofobjectsgui','illplistofsettingsgui','illearningprogressgui',
05655 'illplistofprogressgui')
05656 );
05657 }
05658
05659
05660 $tabs_gui->addTarget("history",
05661 $this->ctrl->getLinkTarget($this,'history'),
05662 "history", "");
05663
05664 if ($ilAccess->checkAccess("edit_permission", "", $this->ref_id))
05665 {
05666 $tabs_gui->addTarget("perm_settings",
05667 $this->ctrl->getLinkTargetByClass(array(get_class($this),'ilpermissiongui'), "perm"), array("perm","info","owner"), 'ilpermissiongui');
05668 }
05669 }
05670 }
05671 }
05672
05681 function _goto($a_target)
05682 {
05683 global $ilAccess, $ilErr, $lng;
05684
05685 if ($ilAccess->checkAccess("visible", "", $a_target))
05686 {
05687
05688 $_GET["baseClass"] = "ilObjTestGUI";
05689 $_GET["cmd"] = "infoScreen";
05690 $_GET["ref_id"] = $a_target;
05691 include_once("ilias.php");
05692 exit;
05693
05694 }
05695 else if ($ilAccess->checkAccess("read", "", ROOT_FOLDER_ID))
05696 {
05697 $_GET["cmd"] = "frameset";
05698 $_GET["target"] = "";
05699 $_GET["ref_id"] = ROOT_FOLDER_ID;
05700 ilUtil::sendInfo(sprintf($lng->txt("msg_no_perm_read_item"),
05701 ilObject::_lookupTitle(ilObject::_lookupObjId($a_target))), true);
05702 include("repository.php");
05703 exit;
05704 }
05705
05706 $ilErr->raiseError($lng->txt("msg_no_perm_read_lm"), $ilErr->FATAL);
05707 }
05708
05709 }
05710 ?>