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
00040 include_once "./classes/class.ilObjectGUI.php";
00041 include_once "./assessment/classes/inc.AssessmentConstants.php";
00042
00043 class ilObjTestGUI extends ilObjectGUI
00044 {
00049 function ilObjTestGUI()
00050 {
00051 global $lng, $ilCtrl;
00052 $lng->loadLanguageModule("assessment");
00053 $this->type = "tst";
00054 $this->ctrl =& $ilCtrl;
00055 $this->ctrl->saveParameter($this, "ref_id");
00056 $this->ilObjectGUI("",$_GET["ref_id"], true, false);
00057
00058 if((int) $_GET['crs_show_result'])
00059 {
00060 $this->ctrl->saveParameter($this,'crs_show_result',(int) $_GET['crs_show_result']);
00061 }
00062 }
00063
00067 function &executeCommand()
00068 {
00069 $this->prepareOutput();
00070 $cmd = $this->ctrl->getCmd("properties");
00071 $next_class = $this->ctrl->getNextClass($this);
00072 $this->ctrl->setReturn($this, "properties");
00073 switch($next_class)
00074 {
00075 case "ilinfoscreengui":
00076 $this->infoScreen();
00077 break;
00078 case 'ilmdeditorgui':
00079 include_once 'Services/MetaData/classes/class.ilMDEditorGUI.php';
00080
00081 $md_gui =& new ilMDEditorGUI($this->object->getId(), 0, $this->object->getType());
00082 $md_gui->addObserver($this->object,'MDUpdateListener','General');
00083
00084 $this->ctrl->forwardCommand($md_gui);
00085 break;
00086 case "iltestoutputgui":
00087 include_once "./assessment/classes/class.ilTestOutputGUI.php";
00088
00089 $output_gui =& new ilTestOutputGUI($this->object);
00090 $this->ctrl->forwardCommand($output_gui);
00091 break;
00092 case "iltestevaluationgui":
00093 include_once "./assessment/classes/class.ilTestEvaluationGUI.php";
00094
00095 $evaluation_gui =& new ilTestEvaluationGUI($this->object);
00096 $this->ctrl->forwardCommand($evaluation_gui);
00097 break;
00098
00099 case 'ilpermissiongui':
00100 include_once("./classes/class.ilPermissionGUI.php");
00101 $perm_gui =& new ilPermissionGUI($this);
00102 $ret =& $this->ctrl->forwardCommand($perm_gui);
00103 break;
00104
00105 case "illearningprogressgui":
00106 include_once './Services/Tracking/classes/class.ilLearningProgressGUI.php';
00107
00108 $new_gui =& new ilLearningProgressGUI(LP_MODE_REPOSITORY,$this->object->getRefId());
00109 $this->ctrl->forwardCommand($new_gui);
00110
00111 break;
00112
00113 default:
00114 if (preg_match("/deleteqpl_\d+/", $cmd))
00115 {
00116 $cmd = "randomQuestions";
00117 }
00118 if ((strcmp($cmd, "properties") == 0) && ($_GET["browse"]))
00119 {
00120 $this->questionBrowser();
00121 return;
00122 }
00123 if ((strcmp($cmd, "properties") == 0) && ($_GET["up"] || $_GET["down"]))
00124 {
00125 $this->questionsObject();
00126 return;
00127 }
00128 $cmd.= "Object";
00129 $ret =& $this->$cmd();
00130 break;
00131 }
00132 if (strtolower($_GET["baseClass"]) != "iladministrationgui" &&
00133 $this->getCreationMode() != true)
00134 {
00135 $this->tpl->show();
00136 }
00137 }
00138
00139 function runObject()
00140 {
00141 $this->ctrl->redirect($this, "infoScreen");
00142 }
00143
00144 function eval_aObject()
00145 {
00146 include_once "./assessment/classes/class.ilTestEvaluationGUI.php";
00147
00148 $evaluation_gui =& new ilTestEvaluationGUI($this->object);
00149 $this->ctrl->redirect($evaluation_gui, "eval_a");
00150 }
00151
00152 function eval_statObject()
00153 {
00154 include_once "./assessment/classes/class.ilTestEvaluationGUI.php";
00155
00156 $evaluation_gui =& new ilTestEvaluationGUI($this->object);
00157 $this->ctrl->redirect($evaluation_gui, "eval_stat");
00158 }
00159
00163 function importFileObject()
00164 {
00165 if ($_POST["qpl"] < 1)
00166 {
00167 sendInfo($this->lng->txt("tst_select_questionpools"));
00168 $this->createObject();
00169 return;
00170 }
00171 if (strcmp($_FILES["xmldoc"]["tmp_name"], "") == 0)
00172 {
00173 sendInfo($this->lng->txt("tst_select_file_for_import"));
00174 $this->createObject();
00175 return;
00176 }
00177 $this->ctrl->setParameter($this, "new_type", $this->type);
00178 $this->uploadTstObject();
00179 }
00180
00184 function cloneAllObject()
00185 {
00186 if ($_POST["tst"] < 1)
00187 {
00188 sendInfo($this->lng->txt("tst_select_tsts"));
00189 $this->createObject();
00190 return;
00191 }
00192 include_once "./assessment/classes/class.ilObjTest.php";
00193 $ref_id = ilObjTest::_clone($_POST["tst"]);
00194 sendInfo($this->lng->txt("object_duplicated"),true);
00195 ilUtil::redirect("ilias.php?ref_id=$ref_id&baseClass=ilObjTestGUI");
00196 }
00197
00202 function saveObject()
00203 {
00204 global $rbacadmin;
00205
00206
00207 $newObj = parent::saveObject();
00208
00209
00210 sendInfo($this->lng->txt("object_added"),true);
00211
00212 ilUtil::redirect("ilias.php?ref_id=".$newObj->getRefId().
00213 "&baseClass=ilObjTestGUI");
00214 }
00215
00216 function backToRepositoryObject()
00217 {
00218 include_once "./classes/class.ilUtil.php";
00219 $path = $this->tree->getPathFull($this->object->getRefID());
00220 ilUtil::redirect($this->getReturnLocation("cancel","./repository.php?cmd=frameset&ref_id=" . $path[count($path) - 2]["child"]));
00221 }
00222
00223 function backToCourseObject()
00224 {
00225 include_once "./classes/class.ilUtil.php";
00226 ilUtil::redirect($this->getReturnLocation("cancel","./repository.php?ref_id=".(int) $_GET['crs_show_result']));
00227 }
00228
00229
00230
00231
00232 function exportObject()
00233 {
00234 global $tree;
00235 global $rbacsystem;
00236
00237 if ((!$rbacsystem->checkAccess("read", $this->ref_id)) && (!$rbacsystem->checkAccess("write", $this->ref_id)))
00238 {
00239
00240 sendInfo($this->lng->txt("cannot_edit_test"), true);
00241 $this->backToRepositoryObject();
00242 }
00243
00244
00245
00246
00247 $this->tpl->addBlockfile("BUTTONS", "buttons", "tpl.buttons.html");
00248
00249
00250 $this->tpl->setCurrentBlock("btn_cell");
00251 $this->tpl->setVariable("BTN_LINK", $this->ctrl->getLinkTarget($this, "createExportFile")."&mode=xml");
00252 $this->tpl->setVariable("BTN_TXT", $this->lng->txt("ass_create_export_file"));
00253 $this->tpl->parseCurrentBlock();
00254
00255
00256 if ($this->object->isOnlineTest())
00257 {
00258 $this->tpl->setCurrentBlock("btn_cell");
00259 $this->tpl->setVariable("BTN_LINK", $this->ctrl->getLinkTarget($this, "createExportfile")."&mode=results");
00260 $this->tpl->setVariable("BTN_TXT", $this->lng->txt("ass_create_export_test_results"));
00261 $this->tpl->parseCurrentBlock();
00262 }
00263
00264 $export_dir = $this->object->getExportDirectory();
00265
00266 $export_files = $this->object->getExportFiles($export_dir);
00267
00268
00269 include_once("classes/class.ilTableGUI.php");
00270 $tbl = new ilTableGUI();
00271
00272
00273 $this->tpl->addBlockfile("ADM_CONTENT", "adm_content", "tpl.table.html");
00274
00275
00276 $this->tpl->addBlockfile("TBL_CONTENT", "tbl_content", "tpl.export_file_row.html", true);
00277
00278 $num = 0;
00279
00280 $this->tpl->setVariable("FORMACTION", $this->ctrl->getFormAction($this));
00281
00282 $tbl->setTitle($this->lng->txt("ass_export_files"));
00283
00284 $tbl->setHeaderNames(array("", $this->lng->txt("ass_file"),
00285 $this->lng->txt("ass_size"), $this->lng->txt("date") ));
00286
00287 $tbl->enabled["sort"] = false;
00288 $tbl->setColumnWidth(array("1%", "49%", "25%", "25%"));
00289
00290
00291 $tbl->setOrderColumn($_GET["sort_by"]);
00292 $tbl->setOrderDirection($_GET["sort_order"]);
00293 $tbl->setLimit($_GET["limit"]);
00294 $tbl->setOffset($_GET["offset"]);
00295 $tbl->setMaxCount($this->maxcount);
00296
00297
00298
00299 $tbl->setFooter("tblfooter",$this->lng->txt("previous"),$this->lng->txt("next"));
00300
00301
00302 $tbl->setMaxCount(count($export_files));
00303 $export_files = array_slice($export_files, $_GET["offset"], $_GET["limit"]);
00304
00305 $tbl->render();
00306 if(count($export_files) > 0)
00307 {
00308 $this->tpl->setVariable("COLUMN_COUNTS", 4);
00309
00310 $i=0;
00311 foreach($export_files as $exp_file)
00312 {
00313 $this->tpl->setCurrentBlock("tbl_content");
00314 $this->tpl->setVariable("TXT_FILENAME", $exp_file);
00315
00316 $css_row = ilUtil::switchColor($i++, "tblrow1", "tblrow2");
00317 $this->tpl->setVariable("CSS_ROW", $css_row);
00318
00319 $this->tpl->setVariable("TXT_SIZE", filesize($export_dir."/".$exp_file));
00320 $this->tpl->setVariable("CHECKBOX_ID", $exp_file);
00321
00322 $file_arr = explode("__", $exp_file);
00323 $this->tpl->setVariable("TXT_DATE", date("Y-m-d H:i:s",$file_arr[0]));
00324
00325 $this->tpl->parseCurrentBlock();
00326 }
00327 $this->tpl->setCurrentBlock("selectall");
00328 $this->tpl->setVariable("SELECT_ALL", $this->lng->txt("select_all"));
00329 $this->tpl->setVariable("CSS_ROW", $css_row);
00330 $this->tpl->parseCurrentBlock();
00331
00332 $this->tpl->setVariable("IMG_ARROW", ilUtil::getImagePath("arrow_downright.gif"));
00333 $this->tpl->setCurrentBlock("tbl_action_btn");
00334 $this->tpl->setVariable("BTN_NAME", "confirmDeleteExportFile");
00335 $this->tpl->setVariable("BTN_VALUE", $this->lng->txt("delete"));
00336 $this->tpl->parseCurrentBlock();
00337
00338 $this->tpl->setCurrentBlock("tbl_action_btn");
00339 $this->tpl->setVariable("BTN_NAME", "downloadExportFile");
00340 $this->tpl->setVariable("BTN_VALUE", $this->lng->txt("download"));
00341 $this->tpl->parseCurrentBlock();
00342 }
00343 else
00344 {
00345 $this->tpl->setCurrentBlock("notfound");
00346 $this->tpl->setVariable("TXT_OBJECT_NOT_FOUND", $this->lng->txt("obj_not_found"));
00347 $this->tpl->setVariable("NUM_COLS", 3);
00348 $this->tpl->parseCurrentBlock();
00349 }
00350
00351 $this->tpl->parseCurrentBlock();
00352 }
00353
00354
00358 function createExportFileObject()
00359 {
00360 global $rbacsystem;
00361
00362 if ($rbacsystem->checkAccess("write", $this->ref_id))
00363 {
00364 include_once("assessment/classes/class.ilTestExport.php");
00365 $test_exp = new ilTestExport($this->object, $_GET["mode"]);
00366 $test_exp->buildExportFile();
00367 }
00368 else
00369 {
00370 sendInfo("cannot_export_test");
00371 }
00372 $this->exportObject();
00373 }
00374
00375
00379 function downloadExportFileObject()
00380 {
00381 if(!isset($_POST["file"]))
00382 {
00383 sendInfo($this->lng->txt("no_checkbox"), true);
00384 $this->ctrl->redirect($this, "export");
00385 }
00386
00387 if (count($_POST["file"]) > 1)
00388 {
00389 sendInfo($this->lng->txt("select_max_one_item"), true);
00390 $this->ctrl->redirect($this, "export");
00391 }
00392
00393
00394 $export_dir = $this->object->getExportDirectory();
00395 ilUtil::deliverFile($export_dir."/".$_POST["file"][0],
00396 $_POST["file"][0]);
00397 }
00398
00402 function confirmDeleteExportFileObject()
00403 {
00404 if(!isset($_POST["file"]))
00405 {
00406 sendInfo($this->lng->txt("no_checkbox"), true);
00407 $this->ctrl->redirect($this, "export");
00408 }
00409
00410
00411 $_SESSION["ilExportFiles"] = $_POST["file"];
00412
00413 $this->tpl->addBlockFile("ADM_CONTENT", "adm_content", "tpl.confirm_deletion.html", true);
00414
00415 sendInfo($this->lng->txt("info_delete_sure"));
00416
00417 $this->tpl->setVariable("FORMACTION", $this->ctrl->getFormAction($this));
00418
00419
00420 $this->tpl->setCurrentBlock("table_header");
00421 $this->tpl->setVariable("TEXT",$this->lng->txt("objects"));
00422 $this->tpl->parseCurrentBlock();
00423
00424
00425 $counter = 0;
00426 foreach($_POST["file"] as $file)
00427 {
00428 $this->tpl->setCurrentBlock("table_row");
00429 $this->tpl->setVariable("CSS_ROW",ilUtil::switchColor(++$counter,"tblrow1","tblrow2"));
00430 $this->tpl->setVariable("TEXT_CONTENT", $file);
00431 $this->tpl->parseCurrentBlock();
00432 }
00433
00434
00435 $this->tpl->setVariable("IMG_ARROW",ilUtil::getImagePath("arrow_downright.gif"));
00436 $buttons = array( "cancelDeleteExportFile" => $this->lng->txt("cancel"),
00437 "deleteExportFile" => $this->lng->txt("confirm"));
00438 foreach ($buttons as $name => $value)
00439 {
00440 $this->tpl->setCurrentBlock("operation_btn");
00441 $this->tpl->setVariable("BTN_NAME",$name);
00442 $this->tpl->setVariable("BTN_VALUE",$value);
00443 $this->tpl->parseCurrentBlock();
00444 }
00445 }
00446
00452 function cancelObject($in_rep = false)
00453 {
00454 sendInfo($this->lng->txt("msg_cancel"),true);
00455 ilUtil::redirect("repository.php?cmd=frameset&ref_id=".$_GET["ref_id"]);
00456 }
00457
00461 function cancelDeleteExportFileObject()
00462 {
00463 session_unregister("ilExportFiles");
00464 $this->ctrl->redirect($this, "export");
00465 }
00466
00467
00471 function deleteExportFileObject()
00472 {
00473 $export_dir = $this->object->getExportDirectory();
00474 foreach($_SESSION["ilExportFiles"] as $file)
00475 {
00476 $exp_file = $export_dir."/".$file;
00477 $exp_dir = $export_dir."/".substr($file, 0, strlen($file) - 4);
00478 if (@is_file($exp_file))
00479 {
00480 unlink($exp_file);
00481 }
00482 if (@is_dir($exp_dir))
00483 {
00484 ilUtil::delDir($exp_dir);
00485 }
00486 }
00487 $this->ctrl->redirect($this, "export");
00488 }
00489
00495 function importObject()
00496 {
00497 $this->getTemplateFile("import", "tst");
00498 $this->tpl->setCurrentBlock("option_qpl");
00499 include_once("./assessment/classes/class.ilObjTest.php");
00500 $tst = new ilObjTest();
00501 $questionpools =& $tst->getAvailableQuestionpools(true);
00502 if (count($questionpools) == 0)
00503 {
00504 }
00505 else
00506 {
00507 foreach ($questionpools as $key => $value)
00508 {
00509 $this->tpl->setCurrentBlock("option_qpl");
00510 $this->tpl->setVariable("OPTION_VALUE", $key);
00511 $this->tpl->setVariable("TXT_OPTION", $value);
00512 $this->tpl->parseCurrentBlock();
00513 }
00514 }
00515 $this->tpl->setVariable("TXT_SELECT_QUESTIONPOOL", $this->lng->txt("select_questionpool"));
00516 $this->tpl->setVariable("OPTION_SELECT_QUESTIONPOOL", $this->lng->txt("select_questionpool_option"));
00517 $this->tpl->setVariable("FORMACTION", $this->ctrl->getFormAction($this));
00518 $this->tpl->setVariable("BTN_NAME", "uploadTst");
00519 $this->tpl->setVariable("TXT_UPLOAD", $this->lng->txt("upload"));
00520 $this->tpl->setVariable("NEW_TYPE", $this->type);
00521 $this->tpl->setVariable("TXT_IMPORT_TST", $this->lng->txt("import_tst"));
00522 $this->tpl->setVariable("TXT_SELECT_MODE", $this->lng->txt("select_mode"));
00523 $this->tpl->setVariable("TXT_SELECT_FILE", $this->lng->txt("select_file"));
00524
00525 }
00526
00530 function uploadTstObject()
00531 {
00532 if ($_POST["qpl"] < 1)
00533 {
00534 sendInfo($this->lng->txt("tst_select_questionpools"));
00535 $this->importObject();
00536 return;
00537 }
00538
00539 if ($_FILES["xmldoc"]["error"] > UPLOAD_ERR_OK)
00540 {
00541 sendInfo($this->lng->txt("error_upload"));
00542 $this->importObject();
00543 return;
00544 }
00545 include_once("./assessment/classes/class.ilObjTest.php");
00546
00547 ilObjTest::_createImportDirectory();
00548
00549
00550 $file = pathinfo($_FILES["xmldoc"]["name"]);
00551 $full_path = ilObjTest::_getImportDirectory()."/".$_FILES["xmldoc"]["name"];
00552 ilUtil::moveUploadedFile($_FILES["xmldoc"]["tmp_name"], $_FILES["xmldoc"]["name"], $full_path);
00553
00554
00555 ilUtil::unzip($full_path);
00556
00557
00558 $subdir = basename($file["basename"],".".$file["extension"]);
00559 $xml_file = ilObjTest::_getImportDirectory()."/".$subdir."/".$subdir.".xml";
00560 $qti_file = ilObjTest::_getImportDirectory()."/".$subdir."/". str_replace("test", "qti", $subdir).".xml";
00561
00562 include_once "./assessment/classes/QTI/class.ilQTIParser.php";
00563 $qtiParser = new ilQTIParser($qti_file, IL_MO_VERIFY_QTI, 0, "");
00564 $result = $qtiParser->startParsing();
00565 $founditems =& $qtiParser->getFoundItems();
00566
00567 if (count($founditems) == 0)
00568 {
00569
00570
00571
00572 ilUtil::delDir(ilObjTest::_getImportDirectory());
00573
00574 sendInfo($this->lng->txt("tst_import_no_items"));
00575 $this->importObject();
00576 return;
00577 }
00578
00579 $complete = 0;
00580 $incomplete = 0;
00581 foreach ($founditems as $item)
00582 {
00583 if (strlen($item["type"]))
00584 {
00585 $complete++;
00586 }
00587 else
00588 {
00589 $incomplete++;
00590 }
00591 }
00592
00593 if ($complete == 0)
00594 {
00595
00596 ilUtil::delDir(ilObjTest::_getImportDirectory());
00597
00598 sendInfo($this->lng->txt("qpl_import_non_ilias_files"));
00599 $this->importObject();
00600 return;
00601 }
00602
00603 $_SESSION["tst_import_xml_file"] = $xml_file;
00604 $_SESSION["tst_import_qti_file"] = $qti_file;
00605 $_SESSION["tst_import_subdir"] = $subdir;
00606
00607 $this->tpl->addBlockFile("ADM_CONTENT", "adm_content", "tpl.tst_import_verification.html");
00608 $row_class = array("tblrow1", "tblrow2");
00609 $counter = 0;
00610 foreach ($founditems as $item)
00611 {
00612 $this->tpl->setCurrentBlock("verification_row");
00613 $this->tpl->setVariable("ROW_CLASS", $row_class[$counter++ % 2]);
00614 $this->tpl->setVariable("QUESTION_TITLE", $item["title"]);
00615 $this->tpl->setVariable("QUESTION_IDENT", $item["ident"]);
00616 switch ($item["type"])
00617 {
00618 case "MULTIPLE CHOICE QUESTION":
00619 $this->tpl->setVariable("QUESTION_TYPE", $this->lng->txt("qt_multiple_choice"));
00620 break;
00621 case "CLOZE QUESTION":
00622 $this->tpl->setVariable("QUESTION_TYPE", $this->lng->txt("qt_cloze"));
00623 break;
00624 case "IMAGE MAP QUESTION":
00625 $this->tpl->setVariable("QUESTION_TYPE", $this->lng->txt("qt_imagemap"));
00626 break;
00627 case "JAVA APPLET QUESTION":
00628 $this->tpl->setVariable("QUESTION_TYPE", $this->lng->txt("qt_javaapplet"));
00629 break;
00630 case "MATCHING QUESTION":
00631 $this->tpl->setVariable("QUESTION_TYPE", $this->lng->txt("qt_matching"));
00632 break;
00633 case "ORDERING QUESTION":
00634 $this->tpl->setVariable("QUESTION_TYPE", $this->lng->txt("qt_ordering"));
00635 break;
00636 case "TEXT QUESTION":
00637 $this->tpl->setVariable("QUESTION_TYPE", $this->lng->txt("qt_text"));
00638 break;
00639 }
00640 $this->tpl->parseCurrentBlock();
00641 }
00642 $this->tpl->setCurrentBlock("adm_content");
00643 $this->tpl->setVariable("TEXT_TYPE", $this->lng->txt("question_type"));
00644 $this->tpl->setVariable("TEXT_TITLE", $this->lng->txt("question_title"));
00645 $this->tpl->setVariable("FOUND_QUESTIONS_INTRODUCTION", $this->lng->txt("tst_import_verify_found_questions"));
00646 $this->tpl->setVariable("VERIFICATION_HEADING", $this->lng->txt("import_tst"));
00647 $this->tpl->setVariable("FORMACTION", $this->ctrl->getFormAction($this));
00648 $this->tpl->setVariable("ARROW", ilUtil::getImagePath("arrow_downright.gif"));
00649 $this->tpl->setVariable("QUESTIONPOOL_ID", $_POST["qpl"]);
00650 $this->tpl->setVariable("VALUE_IMPORT", $this->lng->txt("import"));
00651 $this->tpl->setVariable("VALUE_CANCEL", $this->lng->txt("cancel"));
00652 $this->tpl->parseCurrentBlock();
00653 }
00654
00658 function importVerifiedFileObject()
00659 {
00660 include_once "./assessment/classes/class.ilObjTest.php";
00661
00662 $newObj = new ilObjTest(true);
00663
00664 $newObj->setType($_GET["new_type"]);
00665
00666 $newObj->setTitle("dummy");
00667
00668 $newObj->setDescription("test import");
00669
00670 $newObj->create(true);
00671
00672 $newObj->createReference();
00673
00674 $newObj->putInTree($_GET["ref_id"]);
00675
00676 $newObj->setPermissions($_GET["ref_id"]);
00677
00678 $newObj->notify("new",$_GET["ref_id"],$_GET["parent_non_rbac_id"],$_GET["ref_id"],$newObj->getRefId());
00679
00680 $newObj->mark_schema->flush();
00681
00682
00683 include_once "./assessment/classes/QTI/class.ilQTIParser.php";
00684 $qtiParser = new ilQTIParser($_SESSION["tst_import_qti_file"], IL_MO_PARSE_QTI, $_POST["qpl_id"], $_POST["ident"]);
00685 $qtiParser->setTestObject($newObj);
00686 $result = $qtiParser->startParsing();
00687 $newObj->saveToDb();
00688
00689
00690 include_once ("content/classes/class.ilContObjParser.php");
00691 $contParser = new ilContObjParser($newObj, $_SESSION["tst_import_xml_file"], $_SESSION["tst_import_subdir"]);
00692 $contParser->setQuestionMapping($qtiParser->getImportMapping());
00693 $contParser->startParsing();
00694
00695
00696 ilUtil::delDir(ilObjTest::_getImportDirectory());
00697 sendInfo($this->lng->txt("object_imported"),true);
00698 ilUtil::redirect("ilias.php?ref_id=".$newObj->getRefId().
00699 "&baseClass=ilObjTestGUI");
00700 }
00701
00702 function cancelImportObject()
00703 {
00704 $this->ctrl->redirect($this, "cancel");
00705
00706 }
00707
00708
00715 function uploadObject($redirect = true)
00716 {
00717 $this->uploadTstObject();
00718 }
00719
00729 function confirmChangeProperties($direction = 0)
00730 {
00731 $this->tpl->addBlockFile("ADM_CONTENT", "adm_content", "tpl.il_as_tst_properties_save_confirmation.html", true);
00732 $information = "";
00733 switch ($direction)
00734 {
00735 case 0:
00736 $information = $this->lng->txt("change_properties_from_random_to_standard");
00737 break;
00738 default:
00739 $information = $this->lng->txt("change_properties_from_standard_to_random");
00740 break;
00741 }
00742 foreach ($_POST as $key => $value)
00743 {
00744 if (strcmp($key, "cmd") != 0)
00745 {
00746 if (is_array($value))
00747 {
00748 foreach ($value as $k => $v)
00749 {
00750 $this->tpl->setCurrentBlock("hidden_variable");
00751 $this->tpl->setVariable("HIDDEN_KEY", $key . "[" . $k . "]");
00752 $this->tpl->setVariable("HIDDEN_VALUE", $v);
00753 $this->tpl->parseCurrentBlock();
00754 }
00755 }
00756 else
00757 {
00758 $this->tpl->setCurrentBlock("hidden_variable");
00759 $this->tpl->setVariable("HIDDEN_KEY", $key);
00760 $this->tpl->setVariable("HIDDEN_VALUE", $value);
00761 $this->tpl->parseCurrentBlock();
00762 }
00763 }
00764 }
00765 $this->tpl->setCurrentBlock("hidden_variable");
00766 $this->tpl->setVariable("HIDDEN_KEY", "tst_properties_confirmation");
00767 $this->tpl->setVariable("HIDDEN_VALUE", "1");
00768 $this->tpl->parseCurrentBlock();
00769 $this->tpl->setCurrentBlock("adm_content");
00770 $this->tpl->setVariable("TXT_CONFIRMATION", $this->lng->txt("confirmation"));
00771 $this->tpl->setVariable("TXT_INFORMATION", $information);
00772 $this->tpl->setVariable("FORM_ACTION", $this->ctrl->getFormAction($this));
00773 $this->tpl->setVariable("BTN_CONFIRM", $this->lng->txt("confirm"));
00774 $this->tpl->setVariable("BTN_CANCEL", $this->lng->txt("cancel"));
00775 $this->tpl->parseCurrentBlock();
00776 }
00777
00785 function savePropertiesObject()
00786 {
00787 if (!array_key_exists("tst_properties_confirmation", $_POST))
00788 {
00789 if (($this->object->isRandomTest()) && (count($this->object->getRandomQuestionpools()) > 0))
00790 {
00791 if (($_POST["sel_test_types"] == TYPE_ONLINE_TEST) || ($_POST["sel_test_types"] == TYPE_ASSESSMENT) || ($_POST["sel_test_types"] == TYPE_SELF_ASSESSMENT))
00792 {
00793
00794 $this->confirmChangeProperties(0);
00795 return;
00796 }
00797 }
00798 if ((!$this->object->isRandomTest()) && (count($this->object->questions) > 0))
00799 {
00800 if (($_POST["sel_test_types"] == TYPE_VARYING_RANDOMTEST) || (strlen($_POST["chb_random"]) > 0))
00801 {
00802
00803 $this->confirmChangeProperties(1);
00804 return;
00805 }
00806 }
00807 }
00808
00809 $total = $this->object->evalTotalPersons();
00810 $deleteuserdata = false;
00811 $randomtest_switch = false;
00812
00813 if (!$total)
00814 {
00815 $data["count_system"] = $_POST["count_system"];
00816 $data["mc_scoring"] = $_POST["mc_scoring"];
00817 $data["pass_scoring"] = $_POST["pass_scoring"];
00818 $data["sel_test_types"] = ilUtil::stripSlashes($_POST["sel_test_types"]);
00819 if (!strlen($_POST["chb_random"]))
00820 {
00821 $data["random_test"] = 0;
00822 }
00823 else
00824 {
00825 $data["random_test"] = ilUtil::stripSlashes($_POST["chb_random"]);
00826 }
00827 if ($data["sel_test_types"] == TYPE_VARYING_RANDOMTEST)
00828 {
00829 $data["random_test"] = "1";
00830 }
00831 }
00832 else
00833 {
00834 $data["sel_test_types"] = $this->object->getTestType();
00835 $data["random_test"] = $this->object->random_test;
00836 $data["count_system"] = $this->object->getCountSystem();
00837 $data["mc_scoring"] = $this->object->getMCScoring();
00838 $data["pass_scoring"] = $this->object->getPassScoring();
00839 }
00840 if ($data["sel_test_types"] != $this->object->getTestType())
00841 {
00842 $deleteuserdata = true;
00843 }
00844 if ($data["random_test"] != $this->object->random_test)
00845 {
00846 $randomtest_switch = true;
00847 }
00848 $data["title"] = ilUtil::stripSlashes($_POST["title"]);
00849 $data["description"] = ilUtil::stripSlashes($_POST["description"]);
00850 $data["author"] = ilUtil::stripSlashes($_POST["author"]);
00851 $data["introduction"] = ilUtil::stripSlashes($_POST["introduction"]);
00852 $data["sequence_settings"] = ilUtil::stripSlashes($_POST["sequence_settings"]);
00853 if ($this->object->getTestType() == TYPE_ASSESSMENT || $this->object->getTestType() == TYPE_ONLINE_TEST)
00854 {
00855 $data["score_reporting"] = REPORT_AFTER_TEST;
00856 }
00857 else
00858 {
00859 $data["score_reporting"] = ilUtil::stripSlashes($_POST["score_reporting"]);
00860 }
00861 $data["nr_of_tries"] = ilUtil::stripSlashes($_POST["nr_of_tries"]);
00862 $data["processing_time"] = ilUtil::stripSlashes($_POST["processing_time"]);
00863 if (!$_POST["chb_starting_time"])
00864 {
00865 $data["starting_time"] = "";
00866 }
00867 else
00868 {
00869 $data["starting_time"] = sprintf("%04d%02d%02d%02d%02d%02d",
00870 $_POST["starting_date"]["y"],
00871 $_POST["starting_date"]["m"],
00872 $_POST["starting_date"]["d"],
00873 $_POST["starting_time"]["h"],
00874 $_POST["starting_time"]["m"],
00875 0
00876 );
00877 }
00878 if (!$_POST["chb_ending_time"])
00879 {
00880 $data["ending_time"] = "";
00881 }
00882 else
00883 {
00884 $data["ending_time"] = sprintf("%04d%02d%02d%02d%02d%02d",
00885 $_POST["ending_date"]["y"],
00886 $_POST["ending_date"]["m"],
00887 $_POST["ending_date"]["d"],
00888 $_POST["ending_time"]["h"],
00889 $_POST["ending_time"]["m"],
00890 0
00891 );
00892 }
00893
00894 if ($_POST["chb_processing_time"])
00895 {
00896 $data["enable_processing_time"] = "1";
00897 }
00898 else
00899 {
00900 $data["enable_processing_time"] = "0";
00901 }
00902 if ($_POST["chb_hide_previous_results"])
00903 {
00904 $data["hide_previous_results"] = "1";
00905 }
00906 else
00907 {
00908 $data["hide_previous_results"] = "0";
00909 }
00910 if ($_POST["chb_hide_title_points"])
00911 {
00912 $data["hide_title_points"] = "1";
00913 }
00914 else
00915 {
00916 $data["hide_title_points"] = "0";
00917 }
00918
00919 if ($data["enable_processing_time"])
00920 {
00921 $data["processing_time"] = sprintf("%02d:%02d:%02d",
00922 $_POST["processing_time"]["h"],
00923 $_POST["processing_time"]["m"],
00924 $_POST["processing_time"]["s"]
00925 );
00926 }
00927 else
00928 {
00929 $proc_time = $this->object->getEstimatedWorkingTime();
00930 $data["processing_time"] = sprintf("%02d:%02d:%02d",
00931 $proc_time["h"],
00932 $proc_time["m"],
00933 $proc_time["s"]
00934 );
00935 }
00936
00937 if (!$_POST["chb_reporting_date"] && !$this->object->isOnlineTest())
00938 {
00939 $data["reporting_date"] = "";
00940 }
00941 else
00942 {
00943 $data["reporting_date"] = sprintf("%04d%02d%02d%02d%02d%02d",
00944 $_POST["reporting_date"]["y"],
00945 $_POST["reporting_date"]["m"],
00946 $_POST["reporting_date"]["d"],
00947 $_POST["reporting_time"]["h"],
00948 $_POST["reporting_time"]["m"],
00949 0
00950 );
00951 }
00952 if ($data["nr_of_tries"] == 1)
00953 {
00954 $data["pass_scoring"] = SCORE_LAST_PASS;
00955 }
00956 $this->object->setTestType($data["sel_test_types"]);
00957 $this->object->setTitle($data["title"]);
00958 $this->object->setDescription($data["description"]);
00959 $this->object->setAuthor($data["author"]);
00960 $this->object->setIntroduction($data["introduction"]);
00961 $this->object->setSequenceSettings($data["sequence_settings"]);
00962 $this->object->setCountSystem($data["count_system"]);
00963 $this->object->setMCScoring($data["mc_scoring"]);
00964 $this->object->setPassScoring($data["pass_scoring"]);
00965 if ($this->object->getTestType() == TYPE_ASSESSMENT || $this->object->getTestType() == TYPE_ONLINE_TEST )
00966 {
00967 $this->object->setScoreReporting(REPORT_AFTER_TEST);
00968 }
00969 else
00970 {
00971 $this->object->setScoreReporting($data["score_reporting"]);
00972 }
00973 $this->object->setReportingDate($data["reporting_date"]);
00974 $this->object->setNrOfTries($data["nr_of_tries"]);
00975 $this->object->setStartingTime($data["starting_time"]);
00976 $this->object->setEndingTime($data["ending_time"]);
00977 $this->object->setProcessingTime($data["processing_time"]);
00978 $this->object->setRandomTest($data["random_test"]);
00979 $this->object->setEnableProcessingTime($data["enable_processing_time"]);
00980 $this->object->setHidePreviousResults($data["hide_previous_results"]);
00981 $this->object->setHideTitlePoints($data["hide_title_points"]);
00982
00983 if ($this->object->getTestType() == TYPE_ONLINE_TEST)
00984 {
00985 $this->object->setScoreReporting(1);
00986 $this->object->setSequenceSettings(0);
00987 $this->object->setNrOfTries(1);
00988 $this->object->setRandomTest(0);
00989 }
00990
00991 if ($this->object->getTestType() == TYPE_VARYING_RANDOMTEST)
00992 {
00993 $this->object->setHidePreviousResults(1);
00994 $this->object->setRandomTest(1);
00995 }
00996 else
00997 {
00998 $this->object->setPassScoring(SCORE_LAST_PASS);
00999 }
01000
01001 $this->update = $this->object->update();
01002 $this->object->saveToDb(true);
01003
01004 if ($deleteuserdata)
01005 {
01006 $this->object->removeAllTestEditings();
01007 }
01008 sendInfo($this->lng->txt("msg_obj_modified"));
01009 if ($randomtest_switch)
01010 {
01011 if ($this->object->isRandomTest())
01012 {
01013 $this->object->removeNonRandomTestData();
01014 }
01015 else
01016 {
01017 $this->object->removeRandomTestData();
01018 }
01019 }
01020 $this->ctrl->redirect($this, "properties");
01021 }
01022
01030 function cancelPropertiesObject()
01031 {
01032 sendInfo($this->lng->txt("msg_cancel"), true);
01033 $this->backToRepositoryObject();
01034 }
01035
01043 function propertiesObject()
01044 {
01045 global $rbacsystem;
01046 $this->tpl->addBlockFile("ADM_CONTENT", "adm_content", "tpl.il_as_tst_properties.html", true);
01047 $total = $this->object->evalTotalPersons();
01048 if ($this->object->getTestType() == TYPE_ONLINE_TEST || $data["sel_test_types"] == TYPE_ONLINE_TEST)
01049 {
01050
01051 $this->object->setScoreReporting(1);
01052 $this->object->setSequenceSettings(0);
01053 $this->object->setNrOfTries(1);
01054 $this->object->setRandomTest(0);
01055 }
01056 if ($total == 0)
01057 {
01058 $this->tpl->setCurrentBlock("change_button");
01059 $this->tpl->setVariable("BTN_CHANGE", $this->lng->txt("change"));
01060 $this->tpl->parseCurrentBlock();
01061 }
01062 if (
01063 ($data["sel_test_types"] == TYPE_ONLINE_TEST) ||
01064 ($data["sel_test_types"] == TYPE_ASSESSMENT) ||
01065 ($data["sel_test_types"] == TYPE_VARYING_RANDOMTEST) ||
01066 (($this->object->getTestType() == TYPE_ASSESSMENT || $this->object->getTestType() == TYPE_VARYING_RANDOMTEST || $this->object->getTestType() == TYPE_ONLINE_TEST) && strlen($data["sel_test_types"]) == 0)
01067 )
01068 {
01069 $this->lng->loadLanguageModule("jscalendar");
01070 $this->tpl->addBlockFile("CALENDAR_LANG_JAVASCRIPT", "calendar_javascript", "tpl.calendar.html");
01071 $this->tpl->setCurrentBlock("calendar_javascript");
01072 $this->tpl->setVariable("FULL_SUNDAY", $this->lng->txt("l_su"));
01073 $this->tpl->setVariable("FULL_MONDAY", $this->lng->txt("l_mo"));
01074 $this->tpl->setVariable("FULL_TUESDAY", $this->lng->txt("l_tu"));
01075 $this->tpl->setVariable("FULL_WEDNESDAY", $this->lng->txt("l_we"));
01076 $this->tpl->setVariable("FULL_THURSDAY", $this->lng->txt("l_th"));
01077 $this->tpl->setVariable("FULL_FRIDAY", $this->lng->txt("l_fr"));
01078 $this->tpl->setVariable("FULL_SATURDAY", $this->lng->txt("l_sa"));
01079 $this->tpl->setVariable("SHORT_SUNDAY", $this->lng->txt("s_su"));
01080 $this->tpl->setVariable("SHORT_MONDAY", $this->lng->txt("s_mo"));
01081 $this->tpl->setVariable("SHORT_TUESDAY", $this->lng->txt("s_tu"));
01082 $this->tpl->setVariable("SHORT_WEDNESDAY", $this->lng->txt("s_we"));
01083 $this->tpl->setVariable("SHORT_THURSDAY", $this->lng->txt("s_th"));
01084 $this->tpl->setVariable("SHORT_FRIDAY", $this->lng->txt("s_fr"));
01085 $this->tpl->setVariable("SHORT_SATURDAY", $this->lng->txt("s_sa"));
01086 $this->tpl->setVariable("FULL_JANUARY", $this->lng->txt("l_01"));
01087 $this->tpl->setVariable("FULL_FEBRUARY", $this->lng->txt("l_02"));
01088 $this->tpl->setVariable("FULL_MARCH", $this->lng->txt("l_03"));
01089 $this->tpl->setVariable("FULL_APRIL", $this->lng->txt("l_04"));
01090 $this->tpl->setVariable("FULL_MAY", $this->lng->txt("l_05"));
01091 $this->tpl->setVariable("FULL_JUNE", $this->lng->txt("l_06"));
01092 $this->tpl->setVariable("FULL_JULY", $this->lng->txt("l_07"));
01093 $this->tpl->setVariable("FULL_AUGUST", $this->lng->txt("l_08"));
01094 $this->tpl->setVariable("FULL_SEPTEMBER", $this->lng->txt("l_09"));
01095 $this->tpl->setVariable("FULL_OCTOBER", $this->lng->txt("l_10"));
01096 $this->tpl->setVariable("FULL_NOVEMBER", $this->lng->txt("l_11"));
01097 $this->tpl->setVariable("FULL_DECEMBER", $this->lng->txt("l_12"));
01098 $this->tpl->setVariable("SHORT_JANUARY", $this->lng->txt("s_01"));
01099 $this->tpl->setVariable("SHORT_FEBRUARY", $this->lng->txt("s_02"));
01100 $this->tpl->setVariable("SHORT_MARCH", $this->lng->txt("s_03"));
01101 $this->tpl->setVariable("SHORT_APRIL", $this->lng->txt("s_04"));
01102 $this->tpl->setVariable("SHORT_MAY", $this->lng->txt("s_05"));
01103 $this->tpl->setVariable("SHORT_JUNE", $this->lng->txt("s_06"));
01104 $this->tpl->setVariable("SHORT_JULY", $this->lng->txt("s_07"));
01105 $this->tpl->setVariable("SHORT_AUGUST", $this->lng->txt("s_08"));
01106 $this->tpl->setVariable("SHORT_SEPTEMBER", $this->lng->txt("s_09"));
01107 $this->tpl->setVariable("SHORT_OCTOBER", $this->lng->txt("s_10"));
01108 $this->tpl->setVariable("SHORT_NOVEMBER", $this->lng->txt("s_11"));
01109 $this->tpl->setVariable("SHORT_DECEMBER", $this->lng->txt("s_12"));
01110 $this->tpl->setVariable("ABOUT_CALENDAR", $this->lng->txt("about_calendar"));
01111 $this->tpl->setVariable("ABOUT_CALENDAR_LONG", $this->lng->txt("about_calendar_long"));
01112 $this->tpl->setVariable("ABOUT_TIME_LONG", $this->lng->txt("about_time"));
01113 $this->tpl->setVariable("PREV_YEAR", $this->lng->txt("prev_year"));
01114 $this->tpl->setVariable("PREV_MONTH", $this->lng->txt("prev_month"));
01115 $this->tpl->setVariable("GO_TODAY", $this->lng->txt("go_today"));
01116 $this->tpl->setVariable("NEXT_MONTH", $this->lng->txt("next_month"));
01117 $this->tpl->setVariable("NEXT_YEAR", $this->lng->txt("next_year"));
01118 $this->tpl->setVariable("SEL_DATE", $this->lng->txt("select_date"));
01119 $this->tpl->setVariable("DRAG_TO_MOVE", $this->lng->txt("drag_to_move"));
01120 $this->tpl->setVariable("PART_TODAY", $this->lng->txt("part_today"));
01121 $this->tpl->setVariable("DAY_FIRST", $this->lng->txt("day_first"));
01122 $this->tpl->setVariable("CLOSE", $this->lng->txt("close"));
01123 $this->tpl->setVariable("TODAY", $this->lng->txt("today"));
01124 $this->tpl->setVariable("TIME_PART", $this->lng->txt("time_part"));
01125 $this->tpl->setVariable("DEF_DATE_FORMAT", $this->lng->txt("def_date_format"));
01126 $this->tpl->setVariable("TT_DATE_FORMAT", $this->lng->txt("tt_date_format"));
01127 $this->tpl->setVariable("WK", $this->lng->txt("wk"));
01128 $this->tpl->setVariable("TIME", $this->lng->txt("time"));
01129 $this->tpl->parseCurrentBlock();
01130 $this->tpl->setCurrentBlock("CalendarJS");
01131 $this->tpl->setVariable("LOCATION_JAVASCRIPT_CALENDAR", "./assessment/js/calendar/calendar.js");
01132 $this->tpl->setVariable("LOCATION_JAVASCRIPT_CALENDAR_SETUP", "./assessment/js/calendar/calendar-setup.js");
01133 $this->tpl->setVariable("LOCATION_JAVASCRIPT_CALENDAR_STYLESHEET", "./assessment/js/calendar/calendar.css");
01134 $this->tpl->parseCurrentBlock();
01135 $this->tpl->setCurrentBlock("javascript_call_calendar");
01136 $this->tpl->setVariable("INPUT_FIELDS_STARTING_DATE", "starting_date");
01137 $this->tpl->setVariable("INPUT_FIELDS_ENDING_DATE", "ending_date");
01138 $this->tpl->setVariable("INPUT_FIELDS_REPORTING_DATE", "reporting_date");
01139 $this->tpl->parseCurrentBlock();
01140 }
01141 if ((!$rbacsystem->checkAccess("read", $this->ref_id)) && (!$rbacsystem->checkAccess("write", $this->ref_id)))
01142 {
01143
01144 sendInfo($this->lng->txt("cannot_edit_test"), true);
01145 $this->backToRepositoryObject();
01146 }
01147
01148 $data["sel_test_types"] = $this->object->getTestType();
01149 $data["author"] = $this->object->getAuthor();
01150 $data["introduction"] = $this->object->getIntroduction();
01151 $data["sequence_settings"] = $this->object->getSequenceSettings();
01152 $data["score_reporting"] = $this->object->getScoreReporting();
01153 $data["reporting_date"] = $this->object->getReportingDate();
01154 $data["nr_of_tries"] = $this->object->getNrOfTries();
01155 $data["hide_previous_results"] = $this->object->getHidePreviousResults();
01156 $data["hide_title_points"] = $this->object->getHideTitlePoints();
01157 $data["enable_processing_time"] = $this->object->getEnableProcessingTime();
01158 $data["processing_time"] = $this->object->getProcessingTime();
01159 $data["random_test"] = $this->object->isRandomTest();
01160 $data["count_system"] = $this->object->getCountSystem();
01161 $data["mc_scoring"] = $this->object->getMCScoring();
01162 if ($this->object->getTestType() == TYPE_VARYING_RANDOMTEST)
01163 {
01164 $data["pass_scoring"] = $this->object->getPassScoring();
01165 }
01166 else
01167 {
01168 $data["pass_scoring"] = SCORE_LAST_PASS;
01169 }
01170 if ((int)substr($data["processing_time"], 0, 2) + (int)substr($data["processing_time"], 3, 2) + (int)substr($data["processing_time"], 6, 2) == 0)
01171 {
01172 $proc_time = $this->object->getEstimatedWorkingTime();
01173 $data["processing_time"] = sprintf("%02d:%02d:%02d",
01174 $proc_time["h"],
01175 $proc_time["m"],
01176 $proc_time["s"]
01177 );
01178 }
01179 $data["starting_time"] = $this->object->getStartingTime();
01180 $data["ending_time"] = $this->object->getEndingTime();
01181 $data["title"] = $this->object->getTitle();
01182 $data["description"] = $this->object->getDescription();
01183
01184 if ($data["sel_test_types"] == TYPE_ASSESSMENT || ($data["sel_test_types"] == TYPE_ONLINE_TEST) || ($data["sel_test_types"] == TYPE_VARYING_RANDOMTEST))
01185 {
01186 $this->tpl->setCurrentBlock("starting_time");
01187 $this->tpl->setVariable("TEXT_STARTING_TIME", $this->lng->txt("tst_starting_time"));
01188 if (!$data["starting_time"])
01189 {
01190 $date_input = ilUtil::makeDateSelect("starting_date");
01191 $time_input = ilUtil::makeTimeSelect("starting_time");
01192 }
01193 else
01194 {
01195 preg_match("/(\d{4})(\d{2})(\d{2})(\d{2})(\d{2})(\d{2})/", $data["starting_time"], $matches);
01196 $date_input = ilUtil::makeDateSelect("starting_date", $matches[1], sprintf("%d", $matches[2]), sprintf("%d", $matches[3]));
01197 $time_input = ilUtil::makeTimeSelect("starting_time", true, sprintf("%d", $matches[4]), sprintf("%d", $matches[5]), sprintf("%d", $matches[6]));
01198 }
01199 $this->tpl->setVariable("IMG_STARTING_TIME_CALENDAR", ilUtil::getImagePath("calendar.png"));
01200 $this->tpl->setVariable("TXT_STARTING_TIME_CALENDAR", $this->lng->txt("open_calendar"));
01201 $this->tpl->setVariable("TXT_ENABLED", $this->lng->txt("enabled"));
01202 if ($data["starting_time"])
01203 {
01204 $this->tpl->setVariable("CHECKED_STARTING_TIME", " checked=\"checked\"");
01205 }
01206 $this->tpl->setVariable("INPUT_STARTING_TIME", $this->lng->txt("date") . ": " . $date_input . $this->lng->txt("time") . ": " . $time_input);
01207 $this->tpl->parseCurrentBlock();
01208
01209 $this->tpl->setCurrentBlock("ending_time");
01210 $this->tpl->setVariable("TEXT_ENDING_TIME", $this->lng->txt("tst_ending_time"));
01211 if (!$data["ending_time"])
01212 {
01213 $date_input = ilUtil::makeDateSelect("ending_date");
01214 $time_input = ilUtil::makeTimeSelect("ending_time");
01215 }
01216 else
01217 {
01218 preg_match("/(\d{4})(\d{2})(\d{2})(\d{2})(\d{2})(\d{2})/", $data["ending_time"], $matches);
01219 $date_input = ilUtil::makeDateSelect("ending_date", $matches[1], sprintf("%d", $matches[2]), sprintf("%d", $matches[3]));
01220 $time_input = ilUtil::makeTimeSelect("ending_time", true, sprintf("%d", $matches[4]), sprintf("%d", $matches[5]), sprintf("%d", $matches[6]));
01221 }
01222 $this->tpl->setVariable("IMG_ENDING_TIME_CALENDAR", ilUtil::getImagePath("calendar.png"));
01223 $this->tpl->setVariable("TXT_ENDING_TIME_CALENDAR", $this->lng->txt("open_calendar"));
01224 $this->tpl->setVariable("TXT_ENABLED", $this->lng->txt("enabled"));
01225 if ($data["ending_time"])
01226 {
01227 $this->tpl->setVariable("CHECKED_ENDING_TIME", " checked=\"checked\"");
01228 }
01229 $this->tpl->setVariable("INPUT_ENDING_TIME", $this->lng->txt("date") . ": " . $date_input . $this->lng->txt("time") . ": " . $time_input);
01230 $this->tpl->parseCurrentBlock();
01231
01232 $this->tpl->setCurrentBlock("reporting_date");
01233 $this->tpl->setVariable("TEXT_SCORE_DATE", $this->lng->txt("tst_score_reporting_date"));
01234 if (!$data["reporting_date"])
01235 {
01236 $date_input = ilUtil::makeDateSelect("reporting_date");
01237 $time_input = ilUtil::makeTimeSelect("reporting_time");
01238 } else {
01239 preg_match("/(\d{4})(\d{2})(\d{2})(\d{2})(\d{2})(\d{2})/", $data["reporting_date"], $matches);
01240 $date_input = ilUtil::makeDateSelect("reporting_date", $matches[1], sprintf("%d", $matches[2]), sprintf("%d", $matches[3]));
01241 $time_input = ilUtil::makeTimeSelect("reporting_time", true, sprintf("%d", $matches[4]), sprintf("%d", $matches[5]), sprintf("%d", $matches[6]));
01242 }
01243 $this->tpl->setVariable("IMG_REPORTING_DATE_CALENDAR", ilUtil::getImagePath("calendar.png"));
01244 $this->tpl->setVariable("TXT_REPORTING_DATE_CALENDAR", $this->lng->txt("open_calendar"));
01245 $this->tpl->setVariable("TXT_ENABLED", $this->lng->txt("enabled"));
01246 if ($data["reporting_date"] || ($data["sel_test_types"] == TYPE_ONLINE_TEST)) {
01247 $this->tpl->setVariable("CHECKED_REPORTING_DATE", " checked=\"checked\"");
01248 }
01249 $this->tpl->setVariable("INPUT_REPORTING_DATE", $this->lng->txt("date") . ": " . $date_input . $this->lng->txt("time") . ": " . $time_input);
01250 if ($this->object->getTestType() == TYPE_ONLINE_TEST || $data["sel_test_types"] == TYPE_ONLINE_TEST)
01251 {
01252 $this->tpl->setVariable("DISABLE_SCORE_REPORTING_DATE_CHECKBOX", " disabled=\"disabled\"");
01253 }
01254 $this->tpl->parseCurrentBlock();
01255 }
01256
01257 $this->tpl->setCurrentBlock("test_types");
01258 foreach ($this->object->test_types as $key => $value) {
01259 $this->tpl->setVariable("VALUE_TEST_TYPE", $key);
01260 $this->tpl->setVariable("TEXT_TEST_TYPE", $this->lng->txt($value));
01261 if ($data["sel_test_types"] == $key) {
01262 $this->tpl->setVariable("SELECTED_TEST_TYPE", " selected=\"selected\"");
01263 }
01264 $this->tpl->parseCurrentBlock();
01265 }
01266 $this->tpl->setCurrentBlock("adm_content");
01267 $this->tpl->setVariable("ACTION_PROPERTIES", $this->ctrl->getFormAction($this));
01268 if ($rbacsystem->checkAccess("write", $this->ref_id)) {
01269 $this->tpl->setVariable("SUBMIT_TYPE", $this->lng->txt("change"));
01270 }
01271 $this->tpl->setVariable("HEADING_GENERAL", $this->lng->txt("tst_general_properties"));
01272 $this->tpl->setVariable("TEXT_TEST_TYPES", $this->lng->txt("tst_types"));
01273 $this->tpl->setVariable("TEST_TYPE_COMMENT", $this->lng->txt("tst_type_comment"));
01274 $this->tpl->setVariable("TEXT_TITLE", $this->lng->txt("title"));
01275 $this->tpl->setVariable("VALUE_TITLE", ilUtil::prepareFormOutput($data["title"]));
01276 $this->tpl->setVariable("TEXT_AUTHOR", $this->lng->txt("author"));
01277 $this->tpl->setVariable("VALUE_AUTHOR", ilUtil::prepareFormOutput($data["author"]));
01278 $this->tpl->setVariable("TEXT_DESCRIPTION", $this->lng->txt("description"));
01279 $this->tpl->setVariable("VALUE_DESCRIPTION", ilUtil::prepareFormOutput($data["description"]));
01280 $this->tpl->setVariable("TEXT_INTRODUCTION", $this->lng->txt("tst_introduction"));
01281 $this->tpl->setVariable("VALUE_INTRODUCTION", $data["introduction"]);
01282 $this->tpl->setVariable("HEADING_SEQUENCE", $this->lng->txt("tst_sequence_properties"));
01283 $this->tpl->setVariable("TEXT_SEQUENCE", $this->lng->txt("tst_sequence"));
01284 $this->tpl->setVariable("SEQUENCE_FIXED", $this->lng->txt("tst_sequence_fixed"));
01285 $this->tpl->setVariable("SEQUENCE_POSTPONE", $this->lng->txt("tst_sequence_postpone"));
01286 if ($data["sequence_settings"] == 0) {
01287 $this->tpl->setVariable("SELECTED_FIXED", " selected=\"selected\"");
01288 } elseif ($data["sequence_settings"] == 1) {
01289 $this->tpl->setVariable("SELECTED_POSTPONE", " selected=\"selected\"");
01290 }
01291 $this->tpl->setVariable("HEADING_SCORE", $this->lng->txt("tst_score_reporting"));
01292 $this->tpl->setVariable("TEXT_SCORE_TYPE", $this->lng->txt("tst_score_type"));
01293 $this->tpl->setVariable("REPORT_AFTER_QUESTION", $this->lng->txt("tst_report_after_question"));
01294 $this->tpl->setVariable("REPORT_AFTER_TEST", $this->lng->txt("tst_report_after_test"));
01295 if ($data["sel_test_types"] == TYPE_ASSESSMENT || ($data["sel_test_types"] == TYPE_ONLINE_TEST || $this->object->getTestType() == TYPE_ONLINE_TEST))
01296 {
01297 $this->tpl->setVariable("SELECTED_TEST", " selected=\"selected\"");
01298 $this->tpl->setVariable("DISABLE_SCORE_REPORTING", " disabled=\"disabled\"");
01299 if ($this->object->getTestType() == TYPE_ONLINE_TEST || $data["sel_test_types"] == TYPE_ONLINE_TEST)
01300 {
01301 $this->tpl->setVariable("DISABLE_SEQUENCE", " disabled=\"disabled\"");
01302 $this->tpl->setVariable("DISABLE_NR_OF_TRIES", " disabled=\"disabled\"");
01303 $this->tpl->setVariable("ENABLED_RANDOM_TEST", " disabled=\"disabled\"");
01304 }
01305 }
01306 else
01307 {
01308 if ($data["score_reporting"] == 0)
01309 {
01310 $this->tpl->setVariable("SELECTED_QUESTION", " selected=\"selected\"");
01311 }
01312 elseif ($data["score_reporting"] == 1)
01313 {
01314 $this->tpl->setVariable("SELECTED_TEST", " selected=\"selected\"");
01315 }
01316 }
01317 $this->tpl->setVariable("TEXT_HIDE_PREVIOUS_RESULTS", $this->lng->txt("tst_hide_previous_results"));
01318 $this->tpl->setVariable("TEXT_HIDE_PREVIOUS_RESULTS_DESCRIPTION", $this->lng->txt("tst_hide_previous_results_description"));
01319 $this->tpl->setVariable("TEXT_HIDE_TITLE_POINTS", $this->lng->txt("tst_hide_title_points"));
01320 $this->tpl->setVariable("TEXT_HIDE_TITLE_POINTS_DESCRIPTION", $this->lng->txt("tst_hide_title_points_description"));
01321 if ($data["hide_title_points"] == 1)
01322 {
01323 $this->tpl->setVariable("CHECKED_HIDE_TITLE_POINTS", " checked=\"checked\"");
01324 }
01325 if ($data["sel_test_types"] == TYPE_VARYING_RANDOMTEST)
01326 {
01327 $data["hide_previous_results"] = 1;
01328 }
01329 if ($data["hide_previous_results"] == 1)
01330 {
01331 $this->tpl->setVariable("CHECKED_HIDE_PREVIOUS_RESULTS", " checked=\"checked\"");
01332 }
01333 if ($data["sel_test_types"] == TYPE_VARYING_RANDOMTEST)
01334 {
01335 $this->tpl->setVariable("DISABLE_HIDE_PREVIOUS_RESULTS", " disabled=\"disabled\"");
01336 }
01337 $this->tpl->setVariable("HEADING_SESSION", $this->lng->txt("tst_session_settings"));
01338 $this->tpl->setVariable("TEXT_NR_OF_TRIES", $this->lng->txt("tst_nr_of_tries"));
01339 $this->tpl->setVariable("VALUE_NR_OF_TRIES", $data["nr_of_tries"]);
01340 $this->tpl->setVariable("COMMENT_NR_OF_TRIES", $this->lng->txt("0_unlimited"));
01341 $this->tpl->setVariable("TEXT_PROCESSING_TIME", $this->lng->txt("tst_processing_time"));
01342 $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));
01343 $this->tpl->setVariable("MAX_PROCESSING_TIME", $time_input . " (hh:mm:ss)");
01344 if ($data["enable_processing_time"]) {
01345 $this->tpl->setVariable("CHECKED_PROCESSING_TIME", " checked=\"checked\"");
01346 }
01347 $this->tpl->setVariable("TEXT_RANDOM_TEST", $this->lng->txt("tst_random_test"));
01348 $this->tpl->setVariable("TEXT_RANDOM_TEST_DESCRIPTION", $this->lng->txt("tst_random_test_description"));
01349 if ($data["random_test"])
01350 {
01351 $this->tpl->setVariable("CHECKED_RANDOM_TEST", " checked=\"checked\"");
01352 }
01353 if ($data["sel_test_types"] == TYPE_VARYING_RANDOMTEST)
01354 {
01355 $this->tpl->setVariable("CHECKED_RANDOM_TEST", " checked=\"checked\"");
01356 $this->tpl->setVariable("ENABLED_RANDOM_TEST", " disabled=\"disabled\"");
01357 }
01358
01359 $this->tpl->setVariable("HEADING_SCORING", $this->lng->txt("tst_heading_scoring"));
01360 $this->tpl->setVariable("TEXT_COUNT_SYSTEM", $this->lng->txt("tst_text_count_system"));
01361 $this->tpl->setVariable("COUNT_PARTIAL_SOLUTIONS", $this->lng->txt("tst_count_partial_solutions"));
01362 if ($data["count_system"] == COUNT_PARTIAL_SOLUTIONS)
01363 {
01364 $this->tpl->setVariable("SELECTED_PARTIAL", " selected=\"selected\"");
01365 }
01366 $this->tpl->setVariable("COUNT_CORRECT_SOLUTIONS", $this->lng->txt("tst_count_correct_solutions"));
01367 if ($data["count_system"] == COUNT_CORRECT_SOLUTIONS)
01368 {
01369 $this->tpl->setVariable("SELECTED_CORRECT", " selected=\"selected\"");
01370 }
01371 $this->tpl->setVariable("TEXT_SCORE_MCMR", $this->lng->txt("tst_score_mcmr_questions"));
01372 $this->tpl->setVariable("ZERO_POINTS_WHEN_UNANSWERED", $this->lng->txt("tst_score_mcmr_zero_points_when_unanswered"));
01373 $this->tpl->setVariable("USE_SCORING_SYSTEM", $this->lng->txt("tst_score_mcmr_use_scoring_system"));
01374 if ($data["mc_scoring"] == SCORE_ZERO_POINTS_WHEN_UNANSWERED)
01375 {
01376 $this->tpl->setVariable("SELECTED_ANTICHEAT", " selected=\"selected\"");
01377 }
01378 else
01379 {
01380 $this->tpl->setVariable("SELECTED_STANDARD", " selected=\"selected\"");
01381 }
01382
01383 $this->tpl->setVariable("TEXT_PASS_SCORING", $this->lng->txt("tst_pass_scoring"));
01384 $this->tpl->setVariable("TEXT_LASTPASS", $this->lng->txt("tst_pass_last_pass"));
01385 $this->tpl->setVariable("TEXT_BESTPASS", $this->lng->txt("tst_pass_best_pass"));
01386 if ($data["pass_scoring"] == SCORE_BEST_PASS)
01387 {
01388 $this->tpl->setVariable("SELECTED_BESTPASS", " selected=\"selected\"");
01389 }
01390 else
01391 {
01392 $this->tpl->setVariable("SELECTED_LASTPASS", " selected=\"selected\"");
01393 }
01394 if ($this->object->getTestType() != TYPE_VARYING_RANDOMTEST)
01395 {
01396 $this->tpl->setVariable("DISABLE_PASS_SCORING", " disabled=\"disabled\"");
01397 }
01398 $this->tpl->setVariable("TXT_REQUIRED_FLD", $this->lng->txt("required_field"));
01399 if ($rbacsystem->checkAccess("write", $this->ref_id)) {
01400 $this->tpl->setVariable("SAVE", $this->lng->txt("save"));
01401 $this->tpl->setVariable("CANCEL", $this->lng->txt("cancel"));
01402 }
01403 if ($total > 0)
01404 {
01405 $this->tpl->setVariable("DISABLE_COUNT_SYSTEM", " disabled=\"disabled\"");
01406 $this->tpl->setVariable("DISABLE_MC_SCORING", " disabled=\"disabled\"");
01407 $this->tpl->setVariable("DISABLE_PASS_SCORING", " disabled=\"disabled\"");
01408 $this->tpl->setVariable("ENABLED_TEST_TYPES", " disabled=\"disabled\"");
01409 $this->tpl->setVariable("ENABLED_RANDOM_TEST", " disabled=\"disabled\"");
01410 }
01411 $this->tpl->parseCurrentBlock();
01412 }
01413
01417 function downloadFileObject()
01418 {
01419 $file = explode("_", $_GET["file_id"]);
01420 include_once("classes/class.ilObjFile.php");
01421 $fileObj =& new ilObjFile($file[count($file) - 1], false);
01422 $fileObj->sendFile();
01423 exit;
01424 }
01425
01429 function fullscreenObject()
01430 {
01431 include_once("content/classes/Pages/class.ilPageObjectGUI.php");
01432 $page =& new ilPageObject("qpl", $_GET["pg_id"]);
01433 $page_gui =& new ilPageObjectGUI($page);
01434 $page_gui->showMediaFullscreen();
01435
01436 }
01437
01441 function download_paragraphObject()
01442 {
01443 include_once("content/classes/Pages/class.ilPageObject.php");
01444 $pg_obj =& new ilPageObject("qpl", $_GET["pg_id"]);
01445 $pg_obj->send_paragraph ($_GET["par_id"], $_GET["downloadtitle"]);
01446 exit;
01447 }
01448
01449
01450 function filterObject()
01451 {
01452 $filter_type = $_POST["sel_filter_type"];
01453 if (!$filter_type)
01454 {
01455 $filter_type = $_GET["sel_filter_type"];
01456 }
01457 $filter_question_type = $_POST["sel_question_type"];
01458 if (!$filter_question_type)
01459 {
01460 $filter_question_type = $_GET["sel_question_type"];
01461 }
01462 $filter_questionpool = $_POST["sel_questionpool"];
01463 if (!$filter_questionpool)
01464 {
01465 $filter_questionpool = $_GET["sel_questionpool"];
01466 }
01467 $filter_text = $_POST["filter_text"];
01468 if (!$filter_text)
01469 {
01470 $filter_text = $_GET["filter_text"];
01471 }
01472 $this->questionBrowser($filter_type, $filter_question_type, $filter_questionpool, $filter_text);
01473 }
01474
01482 function resetFilterObject()
01483 {
01484 $_GET["sel_filter_type"] = "";
01485 $_GET["sel_question_type"] = "";
01486 $_GET["sel_questionpool"] = "";
01487 $_GET["filter_text"] = "";
01488 $this->questionBrowser();
01489 }
01490
01498 function backObject()
01499 {
01500 $this->ctrl->redirect($this, "questions");
01501 }
01502
01510 function insertQuestionsObject()
01511 {
01512
01513 $selected_array = array();
01514 foreach ($_POST as $key => $value)
01515 {
01516 if (preg_match("/cb_(\d+)/", $key, $matches))
01517 {
01518 array_push($selected_array, $matches[1]);
01519 }
01520 }
01521 if (!count($selected_array))
01522 {
01523 sendInfo($this->lng->txt("tst_insert_missing_question"), true);
01524 $this->ctrl->redirect($this, "browseForQuestions");
01525 }
01526 else
01527 {
01528
01529 foreach ($selected_array as $key => $value)
01530 {
01531 $this->object->insertQuestion($value);
01532 }
01533 $this->object->saveCompleteStatus();
01534 sendInfo($this->lng->txt("tst_questions_inserted"), true);
01535 $this->ctrl->redirect($this, "questions");
01536 return;
01537 }
01538 }
01539
01547 function questionBrowser($filter_type = "", $filter_question_type = "", $filter_questionpool = "", $filter_text = "")
01548 {
01549 global $rbacsystem;
01550
01551 $this->ctrl->setParameterByClass(get_class($this), "browse", "1");
01552 if (!$filter_type)
01553 {
01554 $filter_type = $_GET["sel_filter_type"];
01555 }
01556 $this->ctrl->setParameterByClass(get_class($this), "sel_filter_type", $filter_type);
01557 if (!$filter_question_type)
01558 {
01559 $filter_question_type = $_GET["sel_question_type"];
01560 }
01561 $this->ctrl->setParameterByClass(get_class($this), "sel_question_type", $filter_question_type);
01562 if (!$filter_questionpool)
01563 {
01564 $filter_questionpool = $_GET["sel_questionpool"];
01565 }
01566 $this->ctrl->setParameterByClass(get_class($this), "sel_questionpool", $filter_questionpool);
01567 if (!$filter_text)
01568 {
01569 $filter_text = $_GET["filter_text"];
01570 }
01571 $this->ctrl->setParameterByClass(get_class($this), "filter_text", $filter_text);
01572
01573 $this->tpl->addBlockFile("ADM_CONTENT", "adm_content", "tpl.il_as_tst_questionbrowser.html", true);
01574 $this->tpl->addBlockFile("A_BUTTONS", "a_buttons", "tpl.il_as_qpl_action_buttons.html", true);
01575 $this->tpl->addBlockFile("FILTER_QUESTION_MANAGER", "filter_questions", "tpl.il_as_tst_filter_questions.html", true);
01576
01577 $questionpools =& $this->object->get_qpl_titles();
01578
01579 $filter_fields = array(
01580 "title" => $this->lng->txt("title"),
01581 "comment" => $this->lng->txt("description"),
01582 "author" => $this->lng->txt("author"),
01583 );
01584 $this->tpl->setCurrentBlock("filterrow");
01585 foreach ($filter_fields as $key => $value) {
01586 $this->tpl->setVariable("VALUE_FILTER_TYPE", "$key");
01587 $this->tpl->setVariable("NAME_FILTER_TYPE", "$value");
01588 if (strcmp($this->ctrl->getCmd(), "resetFilter") != 0)
01589 {
01590 if (strcmp($filter_type, $key) == 0)
01591 {
01592 $this->tpl->setVariable("VALUE_FILTER_SELECTED", " selected=\"selected\"");
01593 }
01594 }
01595 $this->tpl->parseCurrentBlock();
01596 }
01597
01598 $questiontypes =& $this->object->_getQuestiontypes();
01599 foreach ($questiontypes as $key => $value)
01600 {
01601 $this->tpl->setCurrentBlock("questiontype_row");
01602 $this->tpl->setVariable("VALUE_QUESTION_TYPE", $value);
01603 $this->tpl->setVariable("TEXT_QUESTION_TYPE", $this->lng->txt($value));
01604 if (strcmp($filter_question_type, $value) == 0)
01605 {
01606 $this->tpl->setVariable("SELECTED_QUESTION_TYPE", " selected=\"selected\"");
01607 }
01608 $this->tpl->parseCurrentBlock();
01609 }
01610
01611 foreach ($questionpools as $key => $value)
01612 {
01613 $this->tpl->setCurrentBlock("questionpool_row");
01614 $this->tpl->setVariable("VALUE_QUESTIONPOOL", $key);
01615 $this->tpl->setVariable("TEXT_QUESTIONPOOL", $value);
01616 if (strcmp($filter_questionpool, $key) == 0)
01617 {
01618 $this->tpl->setVariable("SELECTED_QUESTIONPOOL", " selected=\"selected\"");
01619 }
01620 $this->tpl->parseCurrentBlock();
01621 }
01622
01623 $this->tpl->setCurrentBlock("filter_questions");
01624 $this->tpl->setVariable("SHOW_QUESTION_TYPES", $this->lng->txt("filter_show_question_types"));
01625 $this->tpl->setVariable("TEXT_ALL_QUESTION_TYPES", $this->lng->txt("filter_all_question_types"));
01626 $this->tpl->setVariable("SHOW_QUESTIONPOOLS", $this->lng->txt("filter_show_questionpools"));
01627 $this->tpl->setVariable("TEXT_ALL_QUESTIONPOOLS", $this->lng->txt("filter_all_questionpools"));
01628 $this->tpl->setVariable("FILTER_TEXT", $this->lng->txt("filter"));
01629 $this->tpl->setVariable("TEXT_FILTER_BY", $this->lng->txt("by"));
01630 if (strcmp($this->ctrl->getCmd(), "resetFilter") != 0)
01631 {
01632 $this->tpl->setVariable("VALUE_FILTER_TEXT", $filter_text);
01633 }
01634 $this->tpl->setVariable("VALUE_SUBMIT_FILTER", $this->lng->txt("set_filter"));
01635 $this->tpl->setVariable("VALUE_RESET_FILTER", $this->lng->txt("reset_filter"));
01636 $this->tpl->parseCurrentBlock();
01637
01638 $this->tpl->setCurrentBlock("QTab");
01639
01640 $startrow = 0;
01641 if ($_GET["prevrow"])
01642 {
01643 $startrow = $_GET["prevrow"];
01644 }
01645 if ($_GET["nextrow"])
01646 {
01647 $startrow = $_GET["nextrow"];
01648 }
01649 if ($_GET["startrow"])
01650 {
01651 $startrow = $_GET["startrow"];
01652 }
01653 if (!$_GET["sort"])
01654 {
01655
01656 $_GET["sort"] = array("title" => "ASC");
01657 }
01658 $table = $this->object->getQuestionsTable($_GET["sort"], $filter_text, $filter_type, $startrow, 1, $filter_question_type, $filter_questionpool);
01659
01660 $colors = array("tblrow1", "tblrow2");
01661 $counter = 0;
01662 $existing_questions =& $this->object->getExistingQuestions();
01663 if ((is_array($table["rows"])) && (count($table["rows"])))
01664 {
01665 foreach ($table["rows"] as $data)
01666 {
01667 if (!in_array($data["question_id"], $existing_questions))
01668 {
01669 if ($data["complete"])
01670 {
01671
01672 $this->tpl->setVariable("QUESTION_ID", $data["question_id"]);
01673 }
01674 $this->tpl->setVariable("QUESTION_TITLE", "<strong>" . $data["title"] . "</strong>");
01675 $this->tpl->setVariable("PREVIEW", "[<a href=\"" . $this->ctrl->getLinkTarget($this, "questions") . "&preview=" . $data["question_id"] . "\">" . $this->lng->txt("preview") . "</a>]");
01676 $this->tpl->setVariable("QUESTION_COMMENT", $data["comment"]);
01677 $this->tpl->setVariable("QUESTION_TYPE", $this->lng->txt($data["type_tag"]));
01678 $this->tpl->setVariable("QUESTION_AUTHOR", $data["author"]);
01679 $this->tpl->setVariable("QUESTION_CREATED", ilFormat::formatDate(ilFormat::ftimestamp2dateDB($data["created"]), "date"));
01680 $this->tpl->setVariable("QUESTION_UPDATED", ilFormat::formatDate(ilFormat::ftimestamp2dateDB($data["TIMESTAMP14"]), "date"));
01681 $this->tpl->setVariable("COLOR_CLASS", $colors[$counter % 2]);
01682 $this->tpl->setVariable("QUESTION_POOL", $questionpools[$data["obj_fi"]]);
01683 $this->tpl->parseCurrentBlock();
01684 $counter++;
01685 }
01686 }
01687
01688 if ($table["rowcount"] > count($table["rows"]))
01689 {
01690 $nextstep = $table["nextrow"] + $table["step"];
01691 if ($nextstep > $table["rowcount"])
01692 {
01693 $nextstep = $table["rowcount"];
01694 }
01695 $sort = "";
01696 if (is_array($_GET["sort"]))
01697 {
01698 $key = key($_GET["sort"]);
01699 $sort = "&sort[$key]=" . $_GET["sort"]["$key"];
01700 }
01701 $counter = 1;
01702 for ($i = 0; $i < $table["rowcount"]; $i += $table["step"])
01703 {
01704 $this->tpl->setCurrentBlock("pages");
01705 if ($table["startrow"] == $i)
01706 {
01707 $this->tpl->setVariable("PAGE_NUMBER", "<span class=\"inactivepage\">$counter</span>");
01708 }
01709 else
01710 {
01711 $this->tpl->setVariable("PAGE_NUMBER", "<a href=\"" . $this->ctrl->getLinkTarget($this, "browseForQuestions") . "$sort&nextrow=$i" . "\">$counter</a>");
01712 }
01713 $this->tpl->parseCurrentBlock();
01714 $counter++;
01715 }
01716 $this->tpl->setCurrentBlock("navigation_bottom");
01717 $this->tpl->setVariable("TEXT_ITEM", $this->lng->txt("item"));
01718 $this->tpl->setVariable("TEXT_ITEM_START", $table["startrow"] + 1);
01719 $end = $table["startrow"] + $table["step"];
01720 if ($end > $table["rowcount"])
01721 {
01722 $end = $table["rowcount"];
01723 }
01724 $this->tpl->setVariable("TEXT_ITEM_END", $end);
01725 $this->tpl->setVariable("TEXT_OF", strtolower($this->lng->txt("of")));
01726 $this->tpl->setVariable("TEXT_ITEM_COUNT", $table["rowcount"]);
01727 $this->tpl->setVariable("TEXT_PREVIOUS", $this->lng->txt("previous"));
01728 $this->tpl->setVariable("TEXT_NEXT", $this->lng->txt("next"));
01729 $this->tpl->setVariable("HREF_PREV_ROWS", $this->ctrl->getLinkTarget($this, "browseForQuestions") . "$sort&prevrow=" . $table["prevrow"]);
01730 $this->tpl->setVariable("HREF_NEXT_ROWS", $this->ctrl->getLinkTarget($this, "browseForQuestions") . "$sort&nextrow=" . $table["nextrow"]);
01731 $this->tpl->parseCurrentBlock();
01732 }
01733 }
01734
01735
01736 if (!((is_array($table["rows"])) && (count($table["rows"]))))
01737 {
01738 $this->tpl->setCurrentBlock("Emptytable");
01739 $this->tpl->setVariable("TEXT_EMPTYTABLE", $this->lng->txt("no_questions_available"));
01740 $this->tpl->parseCurrentBlock();
01741 }
01742 else
01743 {
01744
01745 $this->tpl->setCurrentBlock("selection");
01746 $this->tpl->setVariable("INSERT", $this->lng->txt("insert"));
01747 $this->tpl->parseCurrentBlock();
01748
01749 $this->tpl->setCurrentBlock("selectall");
01750 $this->tpl->setVariable("SELECT_ALL", $this->lng->txt("select_all"));
01751 $counter++;
01752 $this->tpl->setVariable("COLOR_CLASS", $colors[$counter % 2]);
01753 $this->tpl->parseCurrentBlock();
01754
01755 $this->tpl->setCurrentBlock("Footer");
01756 $this->tpl->setVariable("ARROW", "<img src=\"" . ilUtil::getImagePath("arrow_downright.gif") . "\" alt=\"".$this->lng->txt("arrow_downright")."\"/>");
01757 $this->tpl->parseCurrentBlock();
01758 }
01759
01760 $sort = array(
01761 "title" => $_GET["sort"]["title"],
01762 "comment" => $_GET["sort"]["comment"],
01763 "type" => $_GET["sort"]["type"],
01764 "author" => $_GET["sort"]["author"],
01765 "created" => $_GET["sort"]["created"],
01766 "updated" => $_GET["sort"]["updated"],
01767 "qpl" => $_GET["sort"]["qpl"]
01768 );
01769 foreach ($sort as $key => $value) {
01770 if (strcmp($value, "ASC") == 0) {
01771 $sort[$key] = "DESC";
01772 } else {
01773 $sort[$key] = "ASC";
01774 }
01775 }
01776
01777 $this->tpl->setCurrentBlock("adm_content");
01778
01779 $this->ctrl->setCmd("questionBrowser");
01780 $this->ctrl->setParameterByClass(get_class($this), "startrow", $table["startrow"]);
01781 $this->tpl->setVariable("QUESTION_TITLE", "<a href=\"" . $this->ctrl->getLinkTarget($this, "browseForQuestions") . "&sort[title]=" . $sort["title"] . "\">" . $this->lng->txt("title") . "</a>" . $table["images"]["title"]);
01782 $this->tpl->setVariable("QUESTION_COMMENT", "<a href=\"" . $this->ctrl->getLinkTarget($this, "browseForQuestions") . "&sort[comment]=" . $sort["comment"] . "\">" . $this->lng->txt("description") . "</a>". $table["images"]["comment"]);
01783 $this->tpl->setVariable("QUESTION_TYPE", "<a href=\"" . $this->ctrl->getLinkTarget($this, "browseForQuestions") . "&sort[type]=" . $sort["type"] . "\">" . $this->lng->txt("question_type") . "</a>" . $table["images"]["type"]);
01784 $this->tpl->setVariable("QUESTION_AUTHOR", "<a href=\"" . $this->ctrl->getLinkTarget($this, "browseForQuestions") . "&sort[author]=" . $sort["author"] . "\">" . $this->lng->txt("author") . "</a>" . $table["images"]["author"]);
01785 $this->tpl->setVariable("QUESTION_CREATED", "<a href=\"" . $this->ctrl->getLinkTarget($this, "browseForQuestions") . "&sort[created]=" . $sort["created"] . "\">" . $this->lng->txt("create_date") . "</a>" . $table["images"]["created"]);
01786 $this->tpl->setVariable("QUESTION_UPDATED", "<a href=\"" . $this->ctrl->getLinkTarget($this, "browseForQuestions") . "&sort[updated]=" . $sort["updated"] . "\">" . $this->lng->txt("last_update") . "</a>" . $table["images"]["updated"]);
01787 $this->tpl->setVariable("QUESTION_POOL", "<a href=\"" . $this->ctrl->getLinkTarget($this, "browseForQuestions") . "&sort[qpl]=" . $sort["qpl"] . "\">" . $this->lng->txt("obj_qpl") . "</a>" . $table["images"]["qpl"]);
01788 $this->tpl->setVariable("BUTTON_BACK", $this->lng->txt("back"));
01789 $this->tpl->setVariable("ACTION_QUESTION_FORM", $this->ctrl->getFormAction($this));
01790 $this->tpl->parseCurrentBlock();
01791 }
01792
01801 function createQuestionPool($name = "dummy")
01802 {
01803 global $tree;
01804 $parent_ref = $tree->getParentId($this->object->getRefId());
01805 include_once "./assessment/classes/class.ilObjQuestionPool.php";
01806 $qpl = new ilObjQuestionPool();
01807 $qpl->setType("qpl");
01808 $qpl->setTitle($name);
01809 $qpl->setDescription("");
01810 $qpl->create();
01811 $qpl->createReference();
01812 $qpl->putInTree($parent_ref);
01813 $qpl->setOnline(1);
01814 $qpl->setPermissions($parent_ref);
01815 return $qpl->getRefId();
01816 }
01817
01825 function randomselectObject()
01826 {
01827 global $ilUser;
01828 $this->tpl->addBlockFile("ADM_CONTENT", "adm_content", "tpl.il_as_tst_random_select.html", true);
01829 $questionpools =& $this->object->getAvailableQuestionpools(false);
01830 $this->tpl->setCurrentBlock("option");
01831 $this->tpl->setVariable("VALUE_OPTION", "0");
01832 $this->tpl->setVariable("TEXT_OPTION", $this->lng->txt("all_available_question_pools"));
01833 $this->tpl->parseCurrentBlock();
01834 foreach ($questionpools as $key => $value)
01835 {
01836 $this->tpl->setCurrentBlock("option");
01837 $this->tpl->setVariable("VALUE_OPTION", $key);
01838 $this->tpl->setVariable("TEXT_OPTION", $value);
01839 $this->tpl->parseCurrentBlock();
01840 }
01841 $this->tpl->setCurrentBlock("hidden");
01842 $this->tpl->setVariable("HIDDEN_NAME", "sel_question_types");
01843 $this->tpl->setVariable("HIDDEN_VALUE", $_POST["sel_question_types"]);
01844 $this->tpl->parseCurrentBlock();
01845 $this->tpl->setCurrentBlock("adm_content");
01846 $this->tpl->setVariable("FORM_ACTION", $this->ctrl->getFormAction($this));
01847 $this->tpl->setVariable("TXT_QPL_SELECT", $this->lng->txt("tst_random_select_questionpool"));
01848 $this->tpl->setVariable("TXT_NR_OF_QUESTIONS", $this->lng->txt("tst_random_nr_of_questions"));
01849 $this->tpl->setVariable("BTN_SUBMIT", $this->lng->txt("submit"));
01850 $this->tpl->setVariable("BTN_CANCEL", $this->lng->txt("cancel"));
01851 $this->tpl->parseCurrentBlock();
01852 }
01853
01861 function cancelRandomSelectObject()
01862 {
01863 $this->ctrl->redirect($this, "questions");
01864 }
01865
01873 function createRandomSelectionObject()
01874 {
01875 $question_array = $this->object->randomSelectQuestions($_POST["nr_of_questions"], $_POST["sel_qpl"]);
01876 $this->tpl->addBlockFile("ADM_CONTENT", "adm_content", "tpl.il_as_tst_random_question_offer.html", true);
01877 $color_class = array("tblrow1", "tblrow2");
01878 $counter = 0;
01879 $questionpools =& $this->object->get_qpl_titles();
01880 foreach ($question_array as $question_id)
01881 {
01882 $dataset = $this->object->getQuestionDataset($question_id);
01883 $this->tpl->setCurrentBlock("QTab");
01884 $this->tpl->setVariable("COLOR_CLASS", $color_class[$counter % 2]);
01885 $this->tpl->setVariable("QUESTION_TITLE", $dataset->title);
01886 $this->tpl->setVariable("QUESTION_COMMENT", $dataset->comment);
01887 $this->tpl->setVariable("QUESTION_TYPE", $this->lng->txt($dataset->type_tag));
01888 $this->tpl->setVariable("QUESTION_AUTHOR", $dataset->author);
01889 $this->tpl->setVariable("QUESTION_POOL", $questionpools[$dataset->obj_fi]);
01890 $this->tpl->parseCurrentBlock();
01891 $counter++;
01892 }
01893 if (count($question_array) == 0)
01894 {
01895 $this->tpl->setCurrentBlock("Emptytable");
01896 $this->tpl->setVariable("TEXT_NO_QUESTIONS_AVAILABLE", $this->lng->txt("no_questions_available"));
01897 $this->tpl->parseCurrentBlock();
01898 }
01899 else
01900 {
01901 $this->tpl->setCurrentBlock("Selectionbuttons");
01902 $this->tpl->setVariable("BTN_YES", $this->lng->txt("random_accept_sample"));
01903 $this->tpl->setVariable("BTN_NO", $this->lng->txt("random_another_sample"));
01904 $this->tpl->parseCurrentBlock();
01905 }
01906 $chosen_questions = join($question_array, ",");
01907 $this->tpl->setCurrentBlock("adm_content");
01908 $this->tpl->setVariable("FORM_ACTION", $this->ctrl->getFormAction($this));
01909 $this->tpl->setVariable("QUESTION_TITLE", $this->lng->txt("tst_question_title"));
01910 $this->tpl->setVariable("QUESTION_COMMENT", $this->lng->txt("description"));
01911 $this->tpl->setVariable("QUESTION_TYPE", $this->lng->txt("tst_question_type"));
01912 $this->tpl->setVariable("QUESTION_AUTHOR", $this->lng->txt("author"));
01913 $this->tpl->setVariable("QUESTION_POOL", $this->lng->txt("qpl"));
01914 $this->tpl->setVariable("VALUE_CHOSEN_QUESTIONS", $chosen_questions);
01915 $this->tpl->setVariable("VALUE_QUESTIONPOOL_SELECTION", $_POST["sel_qpl"]);
01916 $this->tpl->setVariable("VALUE_NR_OF_QUESTIONS", $_POST["nr_of_questions"]);
01917 $this->tpl->setVariable("TEXT_QUESTION_OFFER", $this->lng->txt("tst_question_offer"));
01918 $this->tpl->setVariable("BTN_CANCEL", $this->lng->txt("cancel"));
01919 $this->tpl->parseCurrentBlock();
01920 }
01921
01929 function insertRandomSelectionObject()
01930 {
01931 $selected_array = split(",", $_POST["chosen_questions"]);
01932 if (!count($selected_array))
01933 {
01934 sendInfo($this->lng->txt("tst_insert_missing_question"));
01935 }
01936 else
01937 {
01938 $total = $this->object->evalTotalPersons();
01939 if ($total)
01940 {
01941
01942 sendInfo(sprintf($this->lng->txt("tst_insert_questions_and_results"), $total));
01943 }
01944 else
01945 {
01946 sendInfo($this->lng->txt("tst_insert_questions"));
01947 }
01948 foreach ($selected_array as $key => $value)
01949 {
01950 $this->object->insertQuestion($value);
01951 }
01952 $this->object->saveCompleteStatus();
01953 sendInfo($this->lng->txt("tst_questions_inserted"), true);
01954 $this->ctrl->redirect($this, "questions");
01955 return;
01956 }
01957 }
01958
01959 function saveRandomQuestionsObject()
01960 {
01961 $this->randomQuestionsObject();
01962 }
01963
01964 function addQuestionpoolObject()
01965 {
01966 $this->randomQuestionsObject();
01967 }
01968
01969 function randomQuestionsObject()
01970 {
01971 global $ilUser;
01972 $selection_mode = $ilUser->getPref("tst_question_selection_mode_equal");
01973 $total = $this->object->evalTotalPersons();
01974 $available_qpl =& $this->object->getAvailableQuestionpools(true, $selection_mode);
01975 include_once "./assessment/classes/class.ilObjQuestionPool.php";
01976 $qpl_question_count = array();
01977 foreach ($available_qpl as $key => $value)
01978 {
01979 $count = ilObjQuestionPool::_getQuestionCount($key);
01980 $qpl_question_count[$key] = $count;
01981 if ($count == 1)
01982 {
01983 $available_qpl[$key] = $value . " ($count " . $this->lng->txt("ass_question") . ")";
01984 }
01985 else
01986 {
01987 $available_qpl[$key] = $value . " ($count " . $this->lng->txt("ass_questions") . ")";
01988 }
01989 }
01990 $this->tpl->addBlockFile("ADM_CONTENT", "adm_content", "tpl.il_as_tst_random_questions.html", true);
01991 $found_qpls = array();
01992 if (count($_POST) == 0)
01993 {
01994 $found_qpls = $this->object->getRandomQuestionpools();
01995 }
01996 if (count($found_qpls) == 0)
01997 {
01998 if (!array_key_exists("countqpl_0", $_POST))
01999 {
02000
02001 foreach ($available_qpl as $key => $value)
02002 {
02003 $this->tpl->setCurrentBlock("qpl_value");
02004 $this->tpl->setVariable("QPL_ID", $key);
02005 $this->tpl->setVariable("QPL_TEXT", $value);
02006 $this->tpl->parseCurrentBlock();
02007 }
02008 $this->tpl->setCurrentBlock("questionpool_row");
02009 $this->tpl->setVariable("COUNTQPL", "0");
02010 $this->tpl->setVariable("VALUE_COUNTQPL", $_POST["countqpl_0"]);
02011 $this->tpl->setVariable("TEXT_SELECT_QUESTIONPOOL", $this->lng->txt("select_questionpool_option"));
02012 $this->tpl->setVariable("TEXT_QUESTIONS_FROM", $this->lng->txt("questions_from"));
02013 $this->tpl->parseCurrentBlock();
02014 }
02015 }
02016 $qpl_unselected = 0;
02017 foreach ($_POST as $key => $value)
02018 {
02019 if (preg_match("/countqpl_(\d+)/", $key, $matches))
02020 {
02021 if ($value > $qpl_question_count[$_POST["qpl_" . $matches[1]]])
02022 {
02023 $value = $qpl_question_count[$_POST["qpl_" . $matches[1]]];
02024 sendInfo($this->lng->txt("tst_random_selection_question_count_too_high"));
02025 }
02026 $found_qpls[$matches[1]] = array(
02027 "index" => $matches[1],
02028 "count" => sprintf("%d", $value),
02029 "qpl" => $_POST["qpl_" . $matches[1]]
02030 );
02031 if ($_POST["qpl_" . $matches[1]] == -1)
02032 {
02033 $qpl_unselected = 1;
02034 }
02035 }
02036 }
02037 $commands = $_POST["cmd"];
02038 if (is_array($commands))
02039 {
02040 foreach ($commands as $key => $value)
02041 {
02042 if (preg_match("/deleteqpl_(\d+)/", $key, $matches))
02043 {
02044 unset($found_qpls[$matches[1]]);
02045 }
02046 }
02047 }
02048 sort($found_qpls);
02049 $found_qpls = array_values($found_qpls);
02050 $counter = 0;
02051 foreach ($found_qpls as $key => $value)
02052 {
02053 $pools = $available_qpl;
02054 foreach ($found_qpls as $pkey => $pvalue)
02055 {
02056 if ($pvalue["qpl"] != $value["qpl"])
02057 {
02058 unset($pools[$pvalue["qpl"]]);
02059 }
02060 }
02061
02062 foreach ($pools as $pkey => $pvalue)
02063 {
02064 $this->tpl->setCurrentBlock("qpl_value");
02065 $this->tpl->setVariable("QPL_ID", $pkey);
02066 $this->tpl->setVariable("QPL_TEXT", $pvalue);
02067 if ($pkey == $value["qpl"])
02068 {
02069 $this->tpl->setVariable("SELECTED_QPL", " selected=\"selected\"");
02070 }
02071 $this->tpl->parseCurrentBlock();
02072 }
02073 $this->tpl->setCurrentBlock("questionpool_row");
02074 $this->tpl->setVariable("COUNTQPL", $counter);
02075 $this->tpl->setVariable("VALUE_COUNTQPL", $value["count"]);
02076 $this->tpl->setVariable("TEXT_SELECT_QUESTIONPOOL", $this->lng->txt("select_questionpool_option"));
02077 $this->tpl->setVariable("TEXT_QUESTIONS_FROM", $this->lng->txt("questions_from"));
02078 if (!$total)
02079 {
02080 if ($counter > 0)
02081 {
02082 $this->tpl->setVariable("BTNCOUNTQPL", $counter);
02083 $this->tpl->setVariable("BTN_DELETE", $this->lng->txt("delete"));
02084 }
02085 }
02086 $this->tpl->parseCurrentBlock();
02087 $counter++;
02088 }
02089 if ($_POST["cmd"]["addQuestionpool"])
02090 {
02091 if ($qpl_unselected)
02092 {
02093 sendInfo($this->lng->txt("tst_random_qpl_unselected"));
02094 }
02095 else
02096 {
02097 $pools = $available_qpl;
02098 foreach ($found_qpls as $pkey => $pvalue)
02099 {
02100 unset($pools[$pvalue["qpl"]]);
02101 }
02102 if (count($pools) == 0)
02103 {
02104 sendInfo($this->lng->txt("tst_no_more_available_questionpools"));
02105 }
02106 else
02107 {
02108 foreach ($pools as $key => $value)
02109 {
02110 $this->tpl->setCurrentBlock("qpl_value");
02111 $this->tpl->setVariable("QPL_ID", $key);
02112 $this->tpl->setVariable("QPL_TEXT", $value);
02113 $this->tpl->parseCurrentBlock();
02114 }
02115 $this->tpl->setCurrentBlock("questionpool_row");
02116 $this->tpl->setVariable("COUNTQPL", "$counter");
02117 $this->tpl->setVariable("TEXT_SELECT_QUESTIONPOOL", $this->lng->txt("select_questionpool_option"));
02118 $this->tpl->setVariable("TEXT_QUESTIONS_FROM", $this->lng->txt("questions_from"));
02119 $this->tpl->parseCurrentBlock();
02120 }
02121 }
02122 }
02123 if ($_POST["cmd"]["saveRandomQuestions"])
02124 {
02125 $this->object->saveRandomQuestionCount($_POST["total_questions"]);
02126 $this->object->saveRandomQuestionpools($found_qpls);
02127 $this->object->saveCompleteStatus();
02128 }
02129 $this->tpl->setCurrentBlock("adm_content");
02130 $this->tpl->setVariable("TEXT_SELECT_RANDOM_QUESTIONS", $this->lng->txt("tst_select_random_questions"));
02131 $this->tpl->setVariable("TEXT_TOTAL_QUESTIONS", $this->lng->txt("tst_total_questions"));
02132 $this->tpl->setVariable("TEXT_TOTAL_QUESTIONS_DESCRIPTION", $this->lng->txt("tst_total_questions_description"));
02133 $total_questions = $this->object->getRandomQuestionCount();
02134 if (array_key_exists("total_questions", $_POST))
02135 {
02136 $total_questions = $_POST["total_questions"];
02137 }
02138 if ($total_questions > 0)
02139 {
02140 $sum = 0;
02141 foreach ($found_qpls as $key => $value)
02142 {
02143 $sum += $qpl_question_count[$value["qpl"]];
02144 }
02145 if ($total_questions > $sum)
02146 {
02147 $total_questions = $sum;
02148 if ($_POST["cmd"]["saveRandomQuestions"])
02149 {
02150 $this->object->saveRandomQuestionCount($total_questions);
02151 }
02152 sendInfo($this->lng->txt("tst_random_selection_question_total_count_too_high"));
02153 }
02154 }
02155 $this->tpl->setVariable("VALUE_TOTAL_QUESTIONS", $total_questions);
02156 $this->tpl->setVariable("TEXT_QUESTIONPOOLS", $this->lng->txt("tst_random_questionpools"));
02157 if (!$total)
02158 {
02159 $this->tpl->setVariable("BTN_SAVE", $this->lng->txt("save"));
02160 $this->tpl->setVariable("BTN_ADD_QUESTIONPOOL", $this->lng->txt("add_questionpool"));
02161 }
02162 $this->tpl->setVariable("FORM_ACTION", $this->ctrl->getFormAction($this));
02163
02164 $this->tpl->setVariable("TEXT_QUESTION_SELECTION", $this->lng->txt("tst_question_selection"));
02165 $this->tpl->setVariable("VALUE_QUESTION_SELECTION", $this->lng->txt("tst_question_selection_equal"));
02166 $this->tpl->setVariable("CMD_QUESTION_SELECTION", "setEqualQplSelection");
02167 $this->tpl->setVariable("TEXT_QUESTION_SELECTION_DESCRIPTION", $this->lng->txt("tst_question_selection_description"));
02168 $this->tpl->setVariable("BUTTON_SAVE", $this->lng->txt("change"));
02169 if ($selection_mode == 1)
02170 {
02171 $this->tpl->setVariable("CHECKED_QUESTION_SELECTION_MODE", " checked=\"checked\"");
02172 }
02173 $this->tpl->parseCurrentBlock();
02174 }
02175
02176 function saveQuestionSelectionModeObject()
02177 {
02178 global $ilUser;
02179 if ($_POST["chbQuestionSelectionMode"])
02180 {
02181 $ilUser->setPref("tst_question_selection_mode_equal", 1);
02182 $ilUser->writePref("tst_question_selection_mode_equal", 1);
02183 }
02184 else
02185 {
02186 $ilUser->setPref("tst_question_selection_mode_equal", 0);
02187 $ilUser->writePref("tst_question_selection_mode_equal", 0);
02188 }
02189 $this->randomQuestionsObject();
02190 }
02191
02192 function browseForQuestionsObject()
02193 {
02194 $this->questionBrowser();
02195 }
02196
02204 function executeCreateQuestionObject()
02205 {
02206 $qpl_ref_id = $_POST["sel_qpl"];
02207 if ((strcmp($_POST["txt_qpl"], "") == 0) && (strcmp($qpl_ref_id, "") == 0))
02208 {
02209 sendInfo($this->lng->txt("questionpool_not_entered"));
02210 $this->createQuestionObject();
02211 return;
02212 }
02213 else
02214 {
02215 $_SESSION["test_id"] = $this->object->getRefId();
02216 if (strcmp($_POST["txt_qpl"], "") != 0)
02217 {
02218
02219 $qpl_ref_id = $this->createQuestionPool($_POST["txt_qpl"]);
02220 }
02221 include_once "./assessment/classes/class.ilObjQuestionPoolGUI.php";
02222 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"]);
02223 exit();
02224 }
02225 }
02226
02234 function cancelCreateQuestionObject()
02235 {
02236 $this->ctrl->redirect($this, "questions");
02237 }
02238
02246 function createQuestionObject()
02247 {
02248 global $ilUser;
02249 $this->tpl->addBlockFile("ADM_CONTENT", "adm_content", "tpl.il_as_tst_qpl_select.html", true);
02250 $questionpools =& $this->object->getAvailableQuestionpools();
02251 if (count($questionpools) == 0)
02252 {
02253 $this->tpl->setCurrentBlock("option");
02254 $this->tpl->setVariable("VALUE_QPL", "");
02255 $this->tpl->parseCurrentBlock();
02256 }
02257 else
02258 {
02259 foreach ($questionpools as $key => $value)
02260 {
02261 $this->tpl->setCurrentBlock("option");
02262 $this->tpl->setVariable("VALUE_OPTION", $key);
02263 $this->tpl->setVariable("TEXT_OPTION", $value);
02264 $this->tpl->parseCurrentBlock();
02265 }
02266 }
02267 $this->tpl->setCurrentBlock("hidden");
02268 $this->tpl->setVariable("HIDDEN_NAME", "sel_question_types");
02269 $this->tpl->setVariable("HIDDEN_VALUE", $_POST["sel_question_types"]);
02270 $this->tpl->parseCurrentBlock();
02271 $this->tpl->setCurrentBlock("adm_content");
02272 $this->tpl->setVariable("FORM_ACTION", $this->ctrl->getFormAction($this));
02273
02274 if (count($questionpools) == 0)
02275 {
02276 $this->tpl->setVariable("TXT_QPL_SELECT", $this->lng->txt("tst_enter_questionpool"));
02277 }
02278 else
02279 {
02280 $this->tpl->setVariable("TXT_QPL_SELECT", $this->lng->txt("tst_select_questionpool"));
02281 }
02282 $this->tpl->setVariable("BTN_SUBMIT", $this->lng->txt("submit"));
02283 $this->tpl->setVariable("BTN_CANCEL", $this->lng->txt("cancel"));
02284 $this->tpl->parseCurrentBlock();
02285 }
02286
02294 function confirmRemoveQuestionsObject()
02295 {
02296 sendInfo($this->lng->txt("tst_questions_removed"));
02297 $checked_questions = array();
02298 foreach ($_POST as $key => $value) {
02299 if (preg_match("/id_(\d+)/", $key, $matches)) {
02300 array_push($checked_questions, $matches[1]);
02301 }
02302 }
02303 foreach ($checked_questions as $key => $value) {
02304 $this->object->removeQuestion($value);
02305 }
02306 $this->object->saveCompleteStatus();
02307 $this->ctrl->redirect($this, "questions");
02308 }
02309
02317 function cancelRemoveQuestionsObject()
02318 {
02319 $this->ctrl->redirect($this, "questions");
02320 }
02321
02329 function removeQuestionsForm($checked_questions)
02330 {
02331 sendInfo();
02332 $this->tpl->addBlockFile("ADM_CONTENT", "adm_content", "tpl.il_as_tst_remove_questions.html", true);
02333 $query = sprintf("SELECT qpl_questions.*, qpl_question_type.type_tag FROM qpl_questions, qpl_question_type, tst_test_question WHERE qpl_questions.question_type_fi = qpl_question_type.question_type_id AND tst_test_question.test_fi = %s AND tst_test_question.question_fi = qpl_questions.question_id ORDER BY sequence",
02334 $this->ilias->db->quote($this->object->getTestId())
02335 );
02336 $query_result = $this->ilias->db->query($query);
02337 $colors = array("tblrow1", "tblrow2");
02338 $counter = 0;
02339 if ($query_result->numRows() > 0)
02340 {
02341 while ($data = $query_result->fetchRow(DB_FETCHMODE_OBJECT))
02342 {
02343 if (in_array($data->question_id, $checked_questions))
02344 {
02345 $this->tpl->setCurrentBlock("row");
02346 $this->tpl->setVariable("COLOR_CLASS", $colors[$counter % 2]);
02347 $this->tpl->setVariable("TXT_TITLE", $data->title);
02348 $this->tpl->setVariable("TXT_DESCRIPTION", $data->comment);
02349 $this->tpl->setVariable("TXT_TYPE", $this->lng->txt($data->type_tag));
02350 $this->tpl->parseCurrentBlock();
02351 $counter++;
02352 }
02353 }
02354 }
02355 foreach ($checked_questions as $id)
02356 {
02357 $this->tpl->setCurrentBlock("hidden");
02358 $this->tpl->setVariable("HIDDEN_NAME", "id_$id");
02359 $this->tpl->setVariable("HIDDEN_VALUE", "1");
02360 $this->tpl->parseCurrentBlock();
02361 }
02362
02363 $this->tpl->setCurrentBlock("adm_content");
02364 $this->tpl->setVariable("TXT_TITLE", $this->lng->txt("tst_question_title"));
02365 $this->tpl->setVariable("TXT_DESCRIPTION", $this->lng->txt("description"));
02366 $this->tpl->setVariable("TXT_TYPE", $this->lng->txt("tst_question_type"));
02367 $this->tpl->setVariable("BTN_CONFIRM", $this->lng->txt("confirm"));
02368 $this->tpl->setVariable("BTN_CANCEL", $this->lng->txt("cancel"));
02369 $this->tpl->setVariable("FORM_ACTION", $this->ctrl->getFormAction($this));
02370 $this->tpl->parseCurrentBlock();
02371 }
02372
02380 function removeQuestionsObject()
02381 {
02382 $checked_questions = array();
02383 foreach ($_POST as $key => $value) {
02384 if (preg_match("/cb_(\d+)/", $key, $matches)) {
02385 array_push($checked_questions, $matches[1]);
02386 }
02387 }
02388 if (count($checked_questions) > 0) {
02389 $total = $this->object->evalTotalPersons();
02390 if ($total) {
02391
02392 sendInfo(sprintf($this->lng->txt("tst_remove_questions_and_results"), $total));
02393 } else {
02394 sendInfo($this->lng->txt("tst_remove_questions"));
02395 }
02396 $this->removeQuestionsForm($checked_questions);
02397 return;
02398 } elseif (count($checked_questions) == 0) {
02399 sendInfo($this->lng->txt("tst_no_question_selected_for_removal"), true);
02400 $this->ctrl->redirect($this, "questions");
02401 }
02402 }
02403
02411 function moveQuestionsObject()
02412 {
02413 $this->questionsObject();
02414 }
02415
02423 function insertQuestionsBeforeObject()
02424 {
02425
02426 $move_questions = array();
02427 foreach ($_POST as $key => $value)
02428 {
02429 if (preg_match("/^move_(\d+)$/", $key, $matches))
02430 {
02431 array_push($move_questions, $value);
02432 }
02433 }
02434
02435 $insert_id = -1;
02436 foreach ($_POST as $key => $value)
02437 {
02438 if (preg_match("/^cb_(\d+)$/", $key, $matches))
02439 {
02440 if ($insert_id < 0)
02441 {
02442 $insert_id = $matches[1];
02443 }
02444 }
02445 }
02446 if ($insert_id <= 0)
02447 {
02448 sendInfo($this->lng->txt("no_target_selected_for_move"), true);
02449 }
02450 else
02451 {
02452 $insert_mode = 0;
02453 $this->object->moveQuestions($move_questions, $insert_id, $insert_mode);
02454 }
02455 $this->ctrl->redirect($this, "questions");
02456 }
02457
02465 function insertQuestionsAfterObject()
02466 {
02467
02468 $move_questions = array();
02469 foreach ($_POST as $key => $value)
02470 {
02471 if (preg_match("/^move_(\d+)$/", $key, $matches))
02472 {
02473 array_push($move_questions, $value);
02474 }
02475 }
02476
02477 $insert_id = -1;
02478 foreach ($_POST as $key => $value)
02479 {
02480 if (preg_match("/^cb_(\d+)$/", $key, $matches))
02481 {
02482 if ($insert_id < 0)
02483 {
02484 $insert_id = $matches[1];
02485 }
02486 }
02487 }
02488 if ($insert_id <= 0)
02489 {
02490 sendInfo($this->lng->txt("no_target_selected_for_move"), true);
02491 }
02492 else
02493 {
02494 $insert_mode = 1;
02495 $this->object->moveQuestions($move_questions, $insert_id, $insert_mode);
02496 }
02497 $this->ctrl->redirect($this, "questions");
02498 }
02499
02500 function questionsObject()
02501 {
02502 global $rbacsystem;
02503
02504 if ((!$rbacsystem->checkAccess("read", $this->ref_id)) && (!$rbacsystem->checkAccess("write", $this->ref_id)))
02505 {
02506
02507 sendInfo($this->lng->txt("cannot_edit_test"), true);
02508 $this->backToRepositoryObject();
02509 }
02510
02511 if ($this->object->isRandomTest())
02512 {
02513 $this->randomQuestionsObject();
02514 return;
02515 }
02516
02517 if ($_GET["eqid"] and $_GET["eqpl"])
02518 {
02519 ilUtil::redirect("ilias.php?baseClass=ilObjQuestionPoolGUI&ref_id=" . $_GET["eqpl"] . "&cmd=editQuestionForTest&calling_test=".$_GET["ref_id"]."&q_id=" . $_GET["eqid"]);
02520 }
02521
02522 if ($_GET["up"] > 0)
02523 {
02524 $this->object->questionMoveUp($_GET["up"]);
02525 }
02526 if ($_GET["down"] > 0)
02527 {
02528 $this->object->questionMoveDown($_GET["down"]);
02529 }
02530
02531 if ($_GET["add"])
02532 {
02533 $selected_array = array();
02534 array_push($selected_array, $_GET["add"]);
02535 $total = $this->object->evalTotalPersons();
02536 if ($total)
02537 {
02538
02539 sendInfo(sprintf($this->lng->txt("tst_insert_questions_and_results"), $total));
02540 }
02541 else
02542 {
02543 sendInfo($this->lng->txt("tst_insert_questions"));
02544 }
02545 $this->insertQuestions($selected_array);
02546 return;
02547 }
02548
02549 $this->tpl->addBlockFile("ADM_CONTENT", "adm_content", "tpl.il_as_tst_questions.html", true);
02550 $this->tpl->addBlockFile("A_BUTTONS", "question_buttons", "tpl.il_as_tst_question_buttons.html", true);
02551
02552 if (strcmp($this->ctrl->getCmd(), "moveQuestions") == 0)
02553 {
02554 $checked_move = 0;
02555 foreach ($_POST as $key => $value)
02556 {
02557 if (preg_match("/cb_(\d+)/", $key, $matches))
02558 {
02559 $checked_move++;
02560 $this->tpl->setCurrentBlock("move");
02561 $this->tpl->setVariable("MOVE_COUNTER", $matches[1]);
02562 $this->tpl->setVariable("MOVE_VALUE", $matches[1]);
02563 $this->tpl->parseCurrentBlock();
02564 }
02565 }
02566 if ($checked_move)
02567 {
02568 sendInfo($this->lng->txt("select_target_position_for_move_question"));
02569 $this->tpl->setCurrentBlock("move_buttons");
02570 $this->tpl->setVariable("INSERT_BEFORE", $this->lng->txt("insert_before"));
02571 $this->tpl->setVariable("INSERT_AFTER", $this->lng->txt("insert_after"));
02572 $this->tpl->parseCurrentBlock();
02573 }
02574 else
02575 {
02576 sendInfo($this->lng->txt("no_question_selected_for_move"));
02577 }
02578 }
02579
02580 $query = sprintf("SELECT qpl_questions.*, qpl_question_type.type_tag FROM qpl_questions, qpl_question_type, tst_test_question WHERE qpl_questions.question_type_fi = qpl_question_type.question_type_id AND tst_test_question.test_fi = %s AND tst_test_question.question_fi = qpl_questions.question_id ORDER BY sequence",
02581 $this->ilias->db->quote($this->object->getTestId())
02582 );
02583 $query_result = $this->ilias->db->query($query);
02584 $colors = array("tblrow1", "tblrow2");
02585 $counter = 0;
02586
02587 $questionpools = array();
02588 $total = $this->object->evalTotalPersons();
02589 if ($query_result->numRows() > 0)
02590 {
02591 while ($data = $query_result->fetchRow(DB_FETCHMODE_OBJECT))
02592 {
02593 if (!array_key_exists($data->obj_fi, $questionpools))
02594 {
02595 $pooltitle = $this->object->_lookupTitle($data->obj_fi);
02596 $questionpools[$data->obj_fi] = $pooltitle;
02597 }
02598 $this->tpl->setCurrentBlock("QTab");
02599 $this->tpl->setVariable("QUESTION_ID", $data->question_id);
02600 if (($rbacsystem->checkAccess("write", $this->ref_id) and ($total == 0))) {
02601 $q_id = $data->question_id;
02602 $qpl_ref_id = $this->object->_getRefIdFromObjId($data->obj_fi);
02603 $this->tpl->setVariable("QUESTION_TITLE", "<a href=\"" . $this->ctrl->getLinkTarget($this, "questions") . "&eqid=$q_id&eqpl=$qpl_ref_id" . "\">" . $data->title . "</a>");
02604 } else {
02605 $this->tpl->setVariable("QUESTION_TITLE", $data->title);
02606 }
02607 $this->tpl->setVariable("QUESTION_SEQUENCE", $this->lng->txt("tst_sequence"));
02608
02609 if (($rbacsystem->checkAccess("write", $this->ref_id) and ($total == 0))) {
02610 if ($data->question_id != $this->object->questions[1])
02611 {
02612 $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>");
02613 }
02614 if ($data->question_id != $this->object->questions[count($this->object->questions)])
02615 {
02616 $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>");
02617 }
02618 }
02619 $this->tpl->setVariable("QUESTION_COMMENT", $data->comment);
02620 $this->tpl->setVariable("QUESTION_TYPE", $this->lng->txt($data->type_tag));
02621 $this->tpl->setVariable("QUESTION_POOL", $questionpools[$data->obj_fi]);
02622 $this->tpl->setVariable("QUESTION_AUTHOR", $data->author);
02623 $this->tpl->setVariable("COLOR_CLASS", $colors[$counter % 2]);
02624 $this->tpl->parseCurrentBlock();
02625 $counter++;
02626 }
02627 }
02628 if ($counter == 0)
02629 {
02630 $this->tpl->setCurrentBlock("Emptytable");
02631 $this->tpl->setVariable("TEXT_EMPTYTABLE", $this->lng->txt("tst_no_questions_available"));
02632 $this->tpl->parseCurrentBlock();
02633 }
02634 else
02635 {
02636 if (($rbacsystem->checkAccess("write", $this->ref_id) and ($total == 0)))
02637 {
02638 $this->tpl->setCurrentBlock("selectall");
02639 $this->tpl->setVariable("SELECT_ALL", $this->lng->txt("select_all"));
02640 $counter++;
02641 $this->tpl->setVariable("COLOR_CLASS", $colors[$counter % 2]);
02642 $this->tpl->parseCurrentBlock();
02643 $this->tpl->setCurrentBlock("QFooter");
02644 $this->tpl->setVariable("ARROW", "<img src=\"" . ilUtil::getImagePath("arrow_downright.gif") . "\" alt=\"".$this->lng->txt("arrow_downright")."\"/>");
02645 $this->tpl->setVariable("REMOVE", $this->lng->txt("remove_question"));
02646 $this->tpl->setVariable("MOVE", $this->lng->txt("move"));
02647 $this->tpl->parseCurrentBlock();
02648 }
02649 }
02650
02651 if (($rbacsystem->checkAccess("write", $this->ref_id) and ($total == 0))) {
02652 $this->tpl->setCurrentBlock("QTypes");
02653 $query = "SELECT * FROM qpl_question_type";
02654 $query_result = $this->ilias->db->query($query);
02655 while ($data = $query_result->fetchRow(DB_FETCHMODE_OBJECT))
02656 {
02657 $this->tpl->setVariable("QUESTION_TYPE_ID", $data->type_tag);
02658 $this->tpl->setVariable("QUESTION_TYPE", $this->lng->txt($data->type_tag));
02659 $this->tpl->parseCurrentBlock();
02660 }
02661 $this->tpl->parseCurrentBlock();
02662 }
02663 $this->tpl->setCurrentBlock("adm_content");
02664 $this->tpl->setVariable("ACTION_QUESTION_FORM", $this->ctrl->getFormAction($this));
02665 $this->tpl->setVariable("QUESTION_TITLE", $this->lng->txt("tst_question_title"));
02666 $this->tpl->setVariable("QUESTION_COMMENT", $this->lng->txt("description"));
02667 $this->tpl->setVariable("QUESTION_TYPE", $this->lng->txt("tst_question_type"));
02668 $this->tpl->setVariable("QUESTION_AUTHOR", $this->lng->txt("author"));
02669 $this->tpl->setVariable("QUESTION_POOL", $this->lng->txt("qpl"));
02670
02671 if (($rbacsystem->checkAccess("write", $this->ref_id) and ($total == 0))) {
02672 $this->tpl->setVariable("BUTTON_INSERT_QUESTION", $this->lng->txt("tst_browse_for_questions"));
02673 $this->tpl->setVariable("TEXT_CREATE_NEW", " " . strtolower($this->lng->txt("or")) . " " . $this->lng->txt("create_new"));
02674 $this->tpl->setVariable("BUTTON_CREATE_QUESTION", $this->lng->txt("create"));
02675 $this->tpl->setVariable("TXT_OR", $this->lng->txt("or"));
02676 $this->tpl->setVariable("TEXT_RANDOM_SELECT", $this->lng->txt("random_selection"));
02677 }
02678
02679 $this->tpl->parseCurrentBlock();
02680 }
02681
02682 function takenObject() {
02683 }
02684
02692 function addMarkStepObject()
02693 {
02694 $this->saveMarkSchemaFormData();
02695 $this->object->mark_schema->add_mark_step();
02696 $this->marksObject();
02697 }
02698
02706 function saveMarkSchemaFormData()
02707 {
02708 $this->object->mark_schema->flush();
02709 foreach ($_POST as $key => $value) {
02710 if (preg_match("/mark_short_(\d+)/", $key, $matches)) {
02711 $this->object->mark_schema->add_mark_step($_POST["mark_short_$matches[1]"], $_POST["mark_official_$matches[1]"], $_POST["mark_percentage_$matches[1]"], $_POST["passed_$matches[1]"]);
02712 }
02713 }
02714 $this->object->ects_grades["A"] = $_POST["ects_grade_a"];
02715 $this->object->ects_grades["B"] = $_POST["ects_grade_b"];
02716 $this->object->ects_grades["C"] = $_POST["ects_grade_c"];
02717 $this->object->ects_grades["D"] = $_POST["ects_grade_d"];
02718 $this->object->ects_grades["E"] = $_POST["ects_grade_e"];
02719 if ($_POST["chbUseFX"])
02720 {
02721 $this->object->ects_fx = $_POST["percentFX"];
02722 }
02723 else
02724 {
02725 $this->object->ects_fx = "";
02726 }
02727 $this->object->ects_output = $_POST["chbECTS"];
02728 }
02729
02737 function addSimpleMarkSchemaObject()
02738 {
02739 $this->object->mark_schema->create_simple_schema($this->lng->txt("failed_short"), $this->lng->txt("failed_official"), 0, 0, $this->lng->txt("passed_short"), $this->lng->txt("passed_official"), 50, 1);
02740 $this->marksObject();
02741 }
02742
02750 function deleteMarkStepsObject()
02751 {
02752 $this->saveMarkSchemaFormData();
02753 $delete_mark_steps = array();
02754 foreach ($_POST as $key => $value) {
02755 if (preg_match("/cb_(\d+)/", $key, $matches)) {
02756 array_push($delete_mark_steps, $matches[1]);
02757 }
02758 }
02759 if (count($delete_mark_steps)) {
02760 $this->object->mark_schema->delete_mark_steps($delete_mark_steps);
02761 } else {
02762 sendInfo($this->lng->txt("tst_delete_missing_mark"));
02763 }
02764 $this->marksObject();
02765 }
02766
02774 function cancelMarksObject()
02775 {
02776 sendInfo($this->lng->txt("msg_cancel"), true);
02777 $this->ctrl->redirect($this, "properties");
02778 }
02779
02787 function saveMarksObject()
02788 {
02789 $this->saveMarkSchemaFormData();
02790
02791 $mark_check = $this->object->checkMarks();
02792 if ($mark_check !== true)
02793 {
02794 sendInfo($this->lng->txt($mark_check));
02795 }
02796 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)))
02797 {
02798 sendInfo($this->lng->txt("ects_fill_out_all_values"), true);
02799 }
02800 elseif (($_POST["ects_grade_a"] > 100) or ($_POST["ects_grade_a"] < 0))
02801 {
02802 sendInfo($this->lng->txt("ects_range_error_a"), true);
02803 }
02804 elseif (($_POST["ects_grade_b"] > 100) or ($_POST["ects_grade_b"] < 0))
02805 {
02806 sendInfo($this->lng->txt("ects_range_error_b"), true);
02807 }
02808 elseif (($_POST["ects_grade_c"] > 100) or ($_POST["ects_grade_c"] < 0))
02809 {
02810 sendInfo($this->lng->txt("ects_range_error_c"), true);
02811 }
02812 elseif (($_POST["ects_grade_d"] > 100) or ($_POST["ects_grade_d"] < 0))
02813 {
02814 sendInfo($this->lng->txt("ects_range_error_d"), true);
02815 }
02816 elseif (($_POST["ects_grade_e"] > 100) or ($_POST["ects_grade_e"] < 0))
02817 {
02818 sendInfo($this->lng->txt("ects_range_error_e"), true);
02819 }
02820 else
02821 {
02822 $this->object->mark_schema->saveToDb($this->object->getTestId());
02823 $this->object->saveCompleteStatus();
02824 if ($this->object->getReportingDate())
02825 {
02826 $fxpercent = "";
02827 if ($_POST["chbUseFX"])
02828 {
02829 $fxpercent = ilUtil::stripSlashes($_POST["percentFX"]);
02830 }
02831 $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"]);
02832 }
02833 sendInfo($this->lng->txt("msg_obj_modified"), true);
02834 }
02835 $this->marksObject();
02836 }
02837
02838 function marksObject()
02839 {
02840 global $rbacsystem;
02841
02842 if ((!$rbacsystem->checkAccess("read", $this->ref_id)) && (!$rbacsystem->checkAccess("write", $this->ref_id)))
02843 {
02844
02845 sendInfo($this->lng->txt("cannot_edit_test"), true);
02846 $this->backToRepositoryObject();
02847 }
02848
02849 if (!$this->object->canEditMarks())
02850 {
02851 sendInfo($this->lng->txt("cannot_edit_marks"));
02852 }
02853
02854 $this->object->mark_schema->sort();
02855
02856 $this->tpl->addBlockFile("ADM_CONTENT", "adm_content", "tpl.il_as_tst_marks.html", true);
02857 $marks = $this->object->mark_schema->mark_steps;
02858 $rows = array("tblrow1", "tblrow2");
02859 $counter = 0;
02860 foreach ($marks as $key => $value) {
02861 $this->tpl->setCurrentBlock("markrow");
02862 $this->tpl->setVariable("MARK_SHORT", $value->get_short_name());
02863 $this->tpl->setVariable("MARK_OFFICIAL", $value->get_official_name());
02864 $this->tpl->setVariable("MARK_PERCENTAGE", sprintf("%.2f", $value->get_minimum_level()));
02865 $this->tpl->setVariable("MARK_PASSED", strtolower($this->lng->txt("tst_mark_passed")));
02866 $this->tpl->setVariable("MARK_ID", "$key");
02867 $this->tpl->setVariable("ROW_CLASS", $rows[$counter % 2]);
02868 if ($value->get_passed()) {
02869 $this->tpl->setVariable("MARK_PASSED_CHECKED", " checked=\"checked\"");
02870 }
02871 $this->tpl->parseCurrentBlock();
02872 $counter++;
02873 }
02874 if (count($marks) == 0)
02875 {
02876 $this->tpl->setCurrentBlock("Emptyrow");
02877 $this->tpl->setVariable("EMPTY_ROW", $this->lng->txt("tst_no_marks_defined"));
02878 $this->tpl->setVariable("ROW_CLASS", $rows[$counter % 2]);
02879 $this->tpl->parseCurrentBlock();
02880 }
02881 else
02882 {
02883 if ($rbacsystem->checkAccess("write", $this->ref_id) && $this->object->canEditMarks())
02884 {
02885 $this->tpl->setCurrentBlock("selectall");
02886 $counter++;
02887 $this->tpl->setVariable("ROW_CLASS", $rows[$counter % 2]);
02888 $this->tpl->setVariable("SELECT_ALL", $this->lng->txt("select_all"));
02889 $this->tpl->parseCurrentBlock();
02890 $this->tpl->setCurrentBlock("Footer");
02891 $this->tpl->setVariable("ARROW", "<img src=\"" . ilUtil::getImagePath("arrow_downright.gif") . "\" alt=\"".$this->lng->txt("arrow_downright")."\"/>");
02892 $this->tpl->setVariable("BUTTON_EDIT", $this->lng->txt("edit"));
02893 $this->tpl->setVariable("BUTTON_DELETE", $this->lng->txt("delete"));
02894 $this->tpl->parseCurrentBlock();
02895 }
02896 }
02897
02898 if ($this->object->getReportingDate())
02899 {
02900 $this->tpl->setCurrentBlock("ects");
02901 if ($this->object->ects_output)
02902 {
02903 $this->tpl->setVariable("CHECKED_ECTS", " checked=\"checked\"");
02904 }
02905 $this->tpl->setVariable("TEXT_OUTPUT_ECTS_GRADES", $this->lng->txt("ects_output_of_ects_grades"));
02906 $this->tpl->setVariable("TEXT_ALLOW_ECTS_GRADES", $this->lng->txt("ects_allow_ects_grades"));
02907 $this->tpl->setVariable("TEXT_USE_FX", $this->lng->txt("ects_use_fx_grade"));
02908 if (preg_match("/\d+/", $this->object->ects_fx))
02909 {
02910 $this->tpl->setVariable("CHECKED_FX", " checked=\"checked\"");
02911 $this->tpl->setVariable("VALUE_PERCENT_FX", sprintf("value=\"%s\" ", $this->object->ects_fx));
02912 }
02913 $this->tpl->setVariable("TEXT_PERCENT", $this->lng->txt("ects_use_fx_grade_part2"));
02914 $this->tpl->setVariable("ECTS_GRADE", $this->lng->txt("ects_grade"));
02915 $this->tpl->setVariable("PERCENTILE", $this->lng->txt("percentile"));
02916 $this->tpl->setVariable("ECTS_GRADE_A", "A - " . $this->lng->txt("ects_grade_a_short"));
02917 $this->tpl->setVariable("VALUE_GRADE_A", $this->object->ects_grades["A"]);
02918 $this->tpl->setVariable("ECTS_GRADE_B", "B - " . $this->lng->txt("ects_grade_b_short"));
02919 $this->tpl->setVariable("VALUE_GRADE_B", $this->object->ects_grades["B"]);
02920 $this->tpl->setVariable("ECTS_GRADE_C", "C - " . $this->lng->txt("ects_grade_c_short"));
02921 $this->tpl->setVariable("VALUE_GRADE_C", $this->object->ects_grades["C"]);
02922 $this->tpl->setVariable("ECTS_GRADE_D", "D - " . $this->lng->txt("ects_grade_d_short"));
02923 $this->tpl->setVariable("VALUE_GRADE_D", $this->object->ects_grades["D"]);
02924 $this->tpl->setVariable("ECTS_GRADE_E", "E - " . $this->lng->txt("ects_grade_e_short"));
02925 $this->tpl->setVariable("VALUE_GRADE_E", $this->object->ects_grades["E"]);
02926
02927 $this->tpl->parseCurrentBlock();
02928 }
02929
02930 $this->tpl->setCurrentBlock("adm_content");
02931 $this->tpl->setVariable("ACTION_MARKS", $this->ctrl->getFormAction($this));
02932 $this->tpl->setVariable("HEADER_SHORT", $this->lng->txt("tst_mark_short_form"));
02933 $this->tpl->setVariable("HEADER_OFFICIAL", $this->lng->txt("tst_mark_official_form"));
02934 $this->tpl->setVariable("HEADER_PERCENTAGE", $this->lng->txt("tst_mark_minimum_level"));
02935 $this->tpl->setVariable("HEADER_PASSED", $this->lng->txt("tst_mark_passed"));
02936 if ($rbacsystem->checkAccess("write", $this->ref_id) && $this->object->canEditMarks())
02937 {
02938 $this->tpl->setVariable("BUTTON_NEW", $this->lng->txt("tst_mark_create_new_mark_step"));
02939 $this->tpl->setVariable("BUTTON_NEW_SIMPLE", $this->lng->txt("tst_mark_create_simple_mark_schema"));
02940 $this->tpl->setVariable("SAVE", $this->lng->txt("save"));
02941 $this->tpl->setVariable("CANCEL", $this->lng->txt("cancel"));
02942 }
02943 $this->tpl->parseCurrentBlock();
02944 }
02945
02953 function confirmDeleteAllUserDataObject()
02954 {
02955 $this->object->removeAllTestEditings();
02956 sendInfo($this->lng->txt("tst_all_user_data_deleted"), true);
02957 $this->ctrl->redirect($this, "maintenance");
02958 }
02959
02967 function cancelDeleteAllUserDataObject()
02968 {
02969 $this->ctrl->redirect($this, "maintenance");
02970 }
02971
02979 function confirmDeleteSelectedUserDataObject()
02980 {
02981 $this->object->removeSelectedTestResults($_POST["chbUser"]);
02982 sendInfo($this->lng->txt("tst_selected_user_data_deleted"), true);
02983 $this->ctrl->redirect($this, "maintenance");
02984 }
02985
02993 function cancelDeleteSelectedUserDataObject()
02994 {
02995 $this->ctrl->redirect($this, "maintenance");
02996 }
02997
03007 function createSolutionsObject()
03008 {
03009 $this->object->createRandomSolutionsForAllUsers();
03010 $this->ctrl->redirect($this, "maintenance");
03011 }
03012
03020 function deleteAllUserDataObject()
03021 {
03022 sendInfo($this->lng->txt("confirm_delete_all_user_data"));
03023 $this->tpl->addBlockFile("ADM_CONTENT", "adm_content", "tpl.il_as_tst_maintenance.html", true);
03024
03025 $this->tpl->setCurrentBlock("confirm_delete");
03026 $this->tpl->setVariable("BTN_CONFIRM_DELETE_ALL", $this->lng->txt("confirm"));
03027 $this->tpl->setVariable("BTN_CANCEL_DELETE_ALL", $this->lng->txt("cancel"));
03028 $this->tpl->parseCurrentBlock();
03029
03030 $this->tpl->setCurrentBlock("adm_content");
03031 $this->tpl->setVariable("FORM_ACTION", $this->ctrl->getFormAction($this));
03032 $this->tpl->parseCurrentBlock();
03033 }
03034
03042 function deleteSingleUserResultsObject()
03043 {
03044 if (count($_POST["chbUser"]) == 0)
03045 {
03046 $this->ctrl->redirect($this, "maintenance");
03047 }
03048 sendInfo($this->lng->txt("confirm_delete_single_user_data"));
03049 $this->tpl->addBlockFile("ADM_CONTENT", "adm_content", "tpl.il_as_tst_maintenance.html", true);
03050
03051 $this->tpl->setCurrentBlock("confirm_delete_selected");
03052 $this->tpl->setVariable("BTN_CONFIRM_DELETE_SELECTED", $this->lng->txt("confirm"));
03053 $this->tpl->setVariable("BTN_CANCEL_DELETE_SELECTED", $this->lng->txt("cancel"));
03054 $this->tpl->parseCurrentBlock();
03055
03056 foreach ($_POST["chbUser"] as $key => $value)
03057 {
03058 $this->tpl->setCurrentBlock("hidden");
03059 $this->tpl->setVariable("USER_ID", $value);
03060 $this->tpl->parseCurrentBlock();
03061 }
03062
03063 $this->tpl->setCurrentBlock("adm_content");
03064 $this->tpl->setVariable("FORM_ACTION", $this->ctrl->getFormAction($this));
03065 $this->tpl->parseCurrentBlock();
03066 }
03067
03075 function maintenanceObject()
03076 {
03077 global $rbacsystem;
03078
03079 if ((!$rbacsystem->checkAccess("read", $this->ref_id)) && (!$rbacsystem->checkAccess("write", $this->ref_id)))
03080 {
03081
03082 sendInfo($this->lng->txt("cannot_edit_test"), true);
03083 $this->backToRepositoryObject();
03084 }
03085
03086 if ($rbacsystem->checkAccess("write", $this->ref_id))
03087 {
03088 $this->tpl->addBlockFile("ADM_CONTENT", "adm_content", "tpl.il_as_tst_maintenance.html", true);
03089 $total = $this->object->evalTotalPersonsArray();
03090 if (count($total))
03091 {
03092 $color_class = array("tblrow1", "tblrow2");
03093 $counter = 0;
03094 foreach ($total as $user_id => $user_name)
03095 {
03096 $this->tpl->setCurrentBlock("userrow");
03097 $this->tpl->setVariable("ROW_CLASS", $color_class[$counter % 2]);
03098 $this->tpl->setVariable("USER_ID", $user_id);
03099 $this->tpl->setVariable("VALUE_USER_NAME", $user_name["fullname"]);
03100 $this->tpl->parseCurrentBlock();
03101 $counter++;
03102 }
03103 $this->tpl->setCurrentBlock("selectall");
03104 $this->tpl->setVariable("SELECT_ALL", $this->lng->txt("select_all"));
03105 $counter++;
03106 $this->tpl->setVariable("ROW_CLASS", $color_class[$counter % 2]);
03107 $this->tpl->parseCurrentBlock();
03108 $this->tpl->setCurrentBlock("participanttable");
03109 $this->tpl->setVariable("USER_NAME", $this->lng->txt("username"));
03110 $this->tpl->setVariable("IMG_ARROW", ilUtil::getImagePath("arrow_downright.gif"));
03111 $this->tpl->setVariable("DELETE", $this->lng->txt("delete_user_data"));
03112 $this->tpl->parseCurrentBlock();
03113
03114 $this->tpl->setCurrentBlock("adm_content");
03115 $this->tpl->setVariable("BTN_DELETE_ALL", $this->lng->txt("tst_delete_all_user_data"));
03116
03117 $this->tpl->setVariable("FORM_ACTION", $this->ctrl->getFormAction($this));
03118 $this->tpl->parseCurrentBlock();
03119 }
03120 else
03121 {
03122 $this->tpl->setCurrentBlock("maintenance_information");
03123 $this->tpl->setVariable("MAINTENANCE_INFORMATION", $this->lng->txt("tst_maintenance_information_no_results"));
03124 $this->tpl->parseCurrentBlock();
03125 }
03126 }
03127 else
03128 {
03129 sendInfo($this->lng->txt("cannot_maintain_test"));
03130 }
03131 }
03132
03140 function statusObject()
03141 {
03142 $this->tpl->addBlockFile("ADM_CONTENT", "adm_content", "tpl.il_as_tst_status.html", true);
03143 if (!$this->object->isComplete())
03144 {
03145 if (!$this->object->isRandomTest())
03146 {
03147 if (count($this->object->questions) == 0)
03148 {
03149 $this->tpl->setCurrentBlock("list_element");
03150 $this->tpl->setVariable("TEXT_ELEMENT", $this->lng->txt("tst_missing_questions"));
03151 $this->tpl->parseCurrentBlock();
03152 }
03153 }
03154 if (count($this->object->mark_schema->mark_steps) == 0)
03155 {
03156 $this->tpl->setCurrentBlock("list_element");
03157 $this->tpl->setVariable("TEXT_ELEMENT", $this->lng->txt("tst_missing_marks"));
03158 $this->tpl->parseCurrentBlock();
03159 }
03160 if (strcmp($this->object->author, "") == 0)
03161 {
03162 $this->tpl->setCurrentBlock("list_element");
03163 $this->tpl->setVariable("TEXT_ELEMENT", $this->lng->txt("tst_missing_author"));
03164 $this->tpl->parseCurrentBlock();
03165 }
03166 if (strcmp($this->object->title, "") == 0)
03167 {
03168 $this->tpl->setCurrentBlock("list_element");
03169 $this->tpl->setVariable("TEXT_ELEMENT", $this->lng->txt("tst_missing_author"));
03170 $this->tpl->parseCurrentBlock();
03171 }
03172
03173 if ($this->object->isRandomTest())
03174 {
03175 $arr = $this->object->getRandomQuestionpools();
03176 if (count($arr) == 0)
03177 {
03178 $this->tpl->setCurrentBlock("list_element");
03179 $this->tpl->setVariable("TEXT_ELEMENT", $this->lng->txt("tst_no_questionpools_for_random_test"));
03180 $this->tpl->parseCurrentBlock();
03181 }
03182 $count = 0;
03183 foreach ($arr as $array)
03184 {
03185 $count += $array["count"];
03186 }
03187 if (($count == 0) && ($this->object->getRandomQuestionCount() == 0))
03188 {
03189 $this->tpl->setCurrentBlock("list_element");
03190 $this->tpl->setVariable("TEXT_ELEMENT", $this->lng->txt("tst_no_questions_for_random_test"));
03191 $this->tpl->parseCurrentBlock();
03192 }
03193 }
03194
03195 $this->tpl->setCurrentBlock("status_list");
03196 $this->tpl->setVariable("TEXT_MISSING_ELEMENTS", $this->lng->txt("tst_status_missing_elements"));
03197 $this->tpl->parseCurrentBlock();
03198 }
03199 $total = $this->object->evalTotalPersons();
03200 if ($total > 0)
03201 {
03202 $this->tpl->setCurrentBlock("list_element");
03203 $this->tpl->setVariable("TEXT_ELEMENT", sprintf($this->lng->txt("tst_in_use_edit_questions_disabled"), $total));
03204 $this->tpl->parseCurrentBlock();
03205 }
03206 $this->tpl->setCurrentBlock("adm_content");
03207 if ($this->object->isComplete())
03208 {
03209 $this->tpl->setVariable("TEXT_STATUS_MESSAGE", $this->lng->txt("tst_status_ok"));
03210 $this->tpl->setVariable("STATUS_CLASS", "bold");
03211 }
03212 else
03213 {
03214 $this->tpl->setVariable("TEXT_STATUS_MESSAGE", $this->lng->txt("tst_status_missing"));
03215 $this->tpl->setVariable("STATUS_CLASS", "warning");
03216 }
03217 $this->tpl->parseCurrentBlock();
03218 }
03219
03223 function createObject()
03224 {
03225 global $rbacsystem;
03226 $new_type = $_POST["new_type"] ? $_POST["new_type"] : $_GET["new_type"];
03227 if (!$rbacsystem->checkAccess("create", $_GET["ref_id"], $new_type))
03228 {
03229 $this->ilias->raiseError($this->lng->txt("permission_denied"),$this->ilias->error_obj->MESSAGE);
03230 }
03231 else
03232 {
03233 $this->getTemplateFile("create", $new_type);
03234
03235 include_once("./assessment/classes/class.ilObjTest.php");
03236 $tst = new ilObjTest();
03237
03238 $tests =& ilObjTest::_getAvailableTests(true);
03239 if (count($tests) > 0)
03240 {
03241 foreach ($tests as $key => $value)
03242 {
03243 $this->tpl->setCurrentBlock("option_tst");
03244 $this->tpl->setVariable("OPTION_VALUE_TST", $key);
03245 $this->tpl->setVariable("TXT_OPTION_TST", $value);
03246 if ($_POST["tst"] == $key)
03247 {
03248 $this->tpl->setVariable("OPTION_SELECTED_TST", " selected=\"selected\"");
03249 }
03250 $this->tpl->parseCurrentBlock();
03251 }
03252 }
03253
03254 $questionpools =& $tst->getAvailableQuestionpools($use_object_id = true, $equal_points = false, $could_be_offline = true);
03255 if (count($questionpools) == 0)
03256 {
03257 }
03258 else
03259 {
03260 foreach ($questionpools as $key => $value)
03261 {
03262 $this->tpl->setCurrentBlock("option_qpl");
03263 $this->tpl->setVariable("OPTION_VALUE", $key);
03264 $this->tpl->setVariable("TXT_OPTION", $value);
03265 if ($_POST["qpl"] == $key)
03266 {
03267 $this->tpl->setVariable("OPTION_SELECTED", " selected=\"selected\"");
03268 }
03269 $this->tpl->parseCurrentBlock();
03270 }
03271 }
03272
03273 $data = array();
03274 $data["fields"] = array();
03275 $data["fields"]["title"] = ilUtil::prepareFormOutput($_SESSION["error_post_vars"]["Fobject"]["title"],true);
03276 $data["fields"]["desc"] = ilUtil::stripSlashes($_SESSION["error_post_vars"]["Fobject"]["desc"]);
03277
03278 foreach ($data["fields"] as $key => $val)
03279 {
03280 $this->tpl->setVariable("TXT_".strtoupper($key), $this->lng->txt($key));
03281 $this->tpl->setVariable(strtoupper($key), $val);
03282
03283 if ($this->prepare_output)
03284 {
03285 $this->tpl->parseCurrentBlock();
03286 }
03287 }
03288
03289 $this->ctrl->setParameter($this, "new_type", $this->type);
03290 $this->tpl->setVariable("FORMACTION", $this->ctrl->getFormAction($this));
03291
03292
03293 $this->tpl->setVariable("TXT_HEADER", $this->lng->txt($new_type."_new"));
03294 $this->tpl->setVariable("TXT_SELECT_QUESTIONPOOL", $this->lng->txt("select_questionpool"));
03295 $this->tpl->setVariable("OPTION_SELECT_QUESTIONPOOL", $this->lng->txt("select_questionpool_option"));
03296 $this->tpl->setVariable("TXT_CANCEL", $this->lng->txt("cancel"));
03297 $this->tpl->setVariable("TXT_SUBMIT", $this->lng->txt($new_type."_add"));
03298 $this->tpl->setVariable("CMD_SUBMIT", "save");
03299 $this->tpl->setVariable("TARGET", ' target="'.
03300 ilFrameTargetInfo::_getFrame("MainContent").'" ');
03301 $this->tpl->setVariable("TXT_REQUIRED_FLD", $this->lng->txt("required_field"));
03302
03303 $this->tpl->setVariable("TXT_IMPORT_TST", $this->lng->txt("import_tst"));
03304 $this->tpl->setVariable("TXT_TST_FILE", $this->lng->txt("tst_upload_file"));
03305 $this->tpl->setVariable("TXT_IMPORT", $this->lng->txt("import"));
03306
03307 $this->tpl->setVariable("TXT_DUPLICATE_TST", $this->lng->txt("duplicate_tst"));
03308 $this->tpl->setVariable("TXT_SELECT_TST", $this->lng->txt("obj_tst"));
03309 $this->tpl->setVariable("OPTION_SELECT_TST", $this->lng->txt("select_tst_option"));
03310 $this->tpl->setVariable("TXT_DUPLICATE", $this->lng->txt("duplicate"));
03311 $this->tpl->setVariable("NEW_TYPE", $this->type);
03312 $this->tpl->parseCurrentBlock();
03313 }
03314 }
03315
03323 function participantsObject()
03324 {
03325 global $rbacsystem;
03326
03327 if ((!$rbacsystem->checkAccess("read", $this->ref_id)) && (!$rbacsystem->checkAccess("write", $this->ref_id)))
03328 {
03329
03330 sendInfo($this->lng->txt("cannot_edit_test"), true);
03331 $this->backToRepositoryObject();
03332 }
03333
03334 if ($this->object->getTestType() != TYPE_ONLINE_TEST)
03335 {
03336
03337 sendInfo($this->lng->txt("tst_must_be_online_exam"), false);
03338 return;
03339 }
03340
03341 $this->tpl->addBlockFile("ADM_CONTENT", "adm_content", "tpl.il_as_tst_invite.html", true);
03342
03343 if ($_POST["cmd"]["cancel"])
03344 {
03345 $this->backToRepositoryObject();
03346 }
03347
03348 if (strcmp($this->ctrl->getCmd(), "searchParticipants") == 0)
03349 {
03350 if (is_array($_POST["search_for"]))
03351 {
03352 if (in_array("usr", $_POST["search_for"]) or in_array("grp", $_POST["search_for"]) or in_array("role", $_POST["search_for"]))
03353 {
03354
03355 include_once './classes/class.ilSearch.php';
03356 $search =& new ilSearch($ilUser->id);
03357 $search->setSearchString($_POST["search_term"]);
03358 $search->setCombination($_POST["concatenation"]);
03359 $search->setSearchFor($_POST["search_for"]);
03360 $search->setSearchType("new");
03361 if($search->validate($message))
03362 {
03363 $search->performSearch();
03364 }
03365 if ($message)
03366 {
03367 sendInfo($message);
03368 }
03369
03370 if(!$search->getNumberOfResults() && $search->getSearchFor())
03371 {
03372 sendInfo($this->lng->txt("search_no_match"));
03373 return;
03374 }
03375 $buttons = array("add");
03376
03377 $invited_users = $this->object->getInvitedUsers();
03378
03379 if ($searchresult = $search->getResultByType("usr"))
03380 {
03381 $users = array();
03382 foreach ($searchresult as $result_array)
03383 {
03384 if (!array_key_exists($result_array["id"], $invited_users))
03385 {
03386 array_push($users, $result_array["id"]);
03387 }
03388 }
03389
03390 $users = $this->object->getUserData($users);
03391
03392 if (count ($users))
03393 $this->outUserGroupTable("usr", $users, "user_result", "user_row", $this->lng->txt("search_user"),"TEXT_USER_TITLE", $buttons);
03394 }
03395
03396 $searchresult = array();
03397
03398 if ($searchresult = $search->getResultByType("grp"))
03399 {
03400 $groups = array();
03401
03402 foreach ($searchresult as $result_array)
03403 {
03404 array_push($groups, $result_array["id"]);
03405 }
03406 $groups = $this->object->getGroupData ($groups);
03407
03408 if (count ($groups))
03409 $this->outUserGroupTable("grp", $groups, "group_result", "group_row", $this->lng->txt("search_group"), "TEXT_GROUP_TITLE", $buttons);
03410 }
03411
03412 $searchresult = array();
03413
03414 if ($searchresult = $search->getResultByType("role"))
03415 {
03416 $roles = array();
03417
03418 foreach ($searchresult as $result_array)
03419 {
03420 array_push($roles, $result_array["id"]);
03421 }
03422
03423 $roles = $this->object->getRoleData ($roles);
03424
03425 if (count ($roles))
03426 $this->outUserGroupTable("role", $roles, "role_result", "role_row", $this->lng->txt("role"), "TEXT_ROLE_TITLE", $buttons);
03427 }
03428
03429 }
03430
03431 }
03432 else
03433 {
03434 sendInfo($this->lng->txt("no_user_or_group_selected"));
03435 }
03436 }
03437
03438 if ($_POST["cmd"]["save"])
03439 {
03440 $this->object->saveToDb();
03441 }
03442
03443 {
03444 if ($rbacsystem->checkAccess('write', $this->ref_id))
03445 {
03446 $this->tpl->setCurrentBlock("invitation");
03447 $this->tpl->setVariable("SEARCH_INVITATION", $this->lng->txt("search"));
03448 $this->tpl->setVariable("SEARCH_TERM", $this->lng->txt("search_term"));
03449 $this->tpl->setVariable("SEARCH_FOR", $this->lng->txt("search_for"));
03450 $this->tpl->setVariable("SEARCH_USERS", $this->lng->txt("search_users"));
03451 $this->tpl->setVariable("SEARCH_GROUPS", $this->lng->txt("search_groups"));
03452 $this->tpl->setVariable("SEARCH_ROLES", $this->lng->txt("search_roles"));
03453 $this->tpl->setVariable("TEXT_CONCATENATION", $this->lng->txt("concatenation"));
03454 $this->tpl->setVariable("TEXT_AND", $this->lng->txt("and"));
03455 $this->tpl->setVariable("TEXT_OR", $this->lng->txt("or"));
03456 $this->tpl->setVariable("VALUE_SEARCH_TERM", $_POST["search_term"]);
03457 if (is_array($_POST["search_for"]))
03458 {
03459 if (in_array("usr", $_POST["search_for"]))
03460 {
03461 $this->tpl->setVariable("CHECKED_USERS", " checked=\"checked\"");
03462 }
03463 if (in_array("grp", $_POST["search_for"]))
03464 {
03465 $this->tpl->setVariable("CHECKED_GROUPS", " checked=\"checked\"");
03466 }
03467 if (in_array("role", $_POST["search_for"]))
03468 {
03469 $this->tpl->setVariable("CHECKED_ROLES", " checked=\"checked\"");
03470 }
03471
03472 }
03473 if (strcmp($_POST["concatenation"], "and") == 0)
03474 {
03475 $this->tpl->setVariable("CHECKED_AND", " checked=\"checked\"");
03476 }
03477 else if (strcmp($_POST["concatenation"], "or") == 0)
03478 {
03479 $this->tpl->setVariable("CHECKED_OR", " checked=\"checked\"");
03480 }
03481 $this->tpl->setVariable("SEARCH", $this->lng->txt("search"));
03482 $this->tpl->parseCurrentBlock();
03483 }
03484 }
03485 $invited_users = $this->object->getInvitedUsers();
03486
03487 $buttons = array("save","remove","tst_show_answer_sheet","tst_show_results");
03488
03489 if (count($invited_users))
03490 {
03491 $this->outUserGroupTable("iv_usr", $invited_users, "invited_user_result", "invited_user_row", $this->lng->txt("tst_participating_users"), "TEXT_INVITED_USER_TITLE",$buttons);
03492 }
03493
03494 $this->tpl->setCurrentBlock("adm_content");
03495 $this->tpl->setVariable("FORM_ACTION", $this->ctrl->getFormAction($this));
03496 $this->tpl->setVariable("TEXT_INVITATION", $this->lng->txt("invitation"));
03497 $this->tpl->setVariable("VALUE_ON", $this->lng->txt("on"));
03498 $this->tpl->setVariable("VALUE_OFF", $this->lng->txt("off"));
03499 $this->tpl->setVariable("TXT_REQUIRED_FLD", $this->lng->txt("required_field"));
03500
03501 if ($rbacsystem->checkAccess("write", $this->ref_id)) {
03502 $this->tpl->setVariable("SAVE", $this->lng->txt("save"));
03503 $this->tpl->setVariable("CANCEL", $this->lng->txt("cancel"));
03504 }
03505 $this->tpl->parseCurrentBlock();
03506 }
03507
03508 function removeParticipantObject()
03509 {
03510 if (is_array($_POST["invited_users"]))
03511 {
03512 foreach ($_POST["invited_users"] as $user_id)
03513 {
03514 $this->object->disinviteUser($user_id);
03515 }
03516 }
03517 else
03518 {
03519 sendInfo($this->lng->txt("select_one_user"), true);
03520 }
03521 $this->ctrl->redirect($this, "participants");
03522 }
03523
03524 function saveClientIPObject()
03525 {
03526 if (is_array($_POST["invited_users"]))
03527 {
03528 foreach ($_POST["invited_users"] as $user_id)
03529 {
03530 $this->object->setClientIP($user_id, $_POST["clientip_".$user_id]);
03531 }
03532 }
03533 else
03534 {
03535 sendInfo($this->lng->txt("select_one_user"), true);
03536 }
03537 $this->ctrl->redirect($this, "participants");
03538 }
03539
03547 function printobject()
03548 {
03549 global $rbacsystem, $ilUser;
03550
03551 if ((!$rbacsystem->checkAccess("read", $this->ref_id)) && (!$rbacsystem->checkAccess("write", $this->ref_id)))
03552 {
03553
03554 sendInfo($this->lng->txt("cannot_edit_test"), true);
03555 $this->backToRepositoryObject();
03556 }
03557 $this->tpl->addBlockFile("ADM_CONTENT", "adm_content", "tpl.il_as_tst_print_test_confirm.html", true);
03558 $this->tpl->setCurrentBlock("generic_css");
03559 $this->tpl->setVariable("LOCATION_GENERIC_STYLESHEET", "./assessment/templates/default/test_print.css");
03560 $this->tpl->setVariable("MEDIA_GENERIC_STYLESHEET", "print");
03561 $this->tpl->parseCurrentBlock();
03562
03563 global $ilUser;
03564 $print_date = mktime(date("H"), date("i"), date("s"), date("m") , date("d"), date("Y"));
03565 $max_points= 0;
03566 $counter = 1;
03567
03568 foreach ($this->object->questions as $question)
03569 {
03570 $this->tpl->setCurrentBlock("question");
03571 $question_gui = $this->object->createQuestionGUI("", $question);
03572 $this->tpl->setVariable("COUNTER_QUESTION", $counter.".");
03573 switch ($question_gui->getQuestionType())
03574 {
03575 default:
03576 $question_gui->outWorkingForm($test_id="", $postponed = false, $show_solution = true, $show_pages = true, $show_solutions_only= true);
03577 break;
03578 case "qt_imagemap":
03579 $question_gui->outWorkingForm($test_id="", $postponed = false, $show_solution = true, $formaction, $show_pages= true, $show_solutions_only= true);
03580 break;
03581 case "qt_javaapplet":
03582 $question_gui->outWorkingForm($test_id="", $postponed = false, $show_solution = true, $show_pages = true, $show_solutions_only= true);
03583 break;
03584 }
03585 $this->tpl->parseCurrentBlock("question");
03586 $counter ++;
03587 $max_points += $question_gui->object->getMaximumPoints();
03588 }
03589
03590 $this->tpl->setCurrentBlock("navigation_buttons");
03591 $this->tpl->setVariable("BUTTON_PRINT", $this->lng->txt("print"));
03592 $this->tpl->parseCurrentBlock();
03593
03594 $this->tpl->setCurrentBlock("adm_content");
03595 $this->tpl->setVariable("TITLE", $this->object->getTitle());
03596 $this->tpl->setVariable("PRINT_TEST", $this->lng->txt("tst_print"));
03597 $this->tpl->setVariable("TXT_PRINT_DATE", $this->lng->txt("date"));
03598 $this->tpl->setVariable("VALUE_PRINT_DATE", strftime("%c",$print_date));
03599 $this->tpl->setVariable("TXT_MAXIMUM_POINTS", $this->lng->txt("tst_maximum_points"));
03600 $this->tpl->setVariable("VALUE_MAXIMUM_POINTS", $max_points);
03601 $this->tpl->parseCurrentBlock();
03602 }
03603
03611 function outPrinttest()
03612 {
03613 global $ilUser;
03614 $print_date = mktime(date("H"), date("i"), date("s"), date("m") , date("d"), date("Y"));
03615 include_once "./classes/class.ilTemplate.php";
03616 $this->tpl = new ilTemplate("./assessment/templates/default/tpl.il_as_tst_print_test.html", true, true);
03617
03618 $this->tpl->setVariable("PRINT_CSS", "./templates/default/print_test.css");
03619 $this->tpl->setVariable("SYNTAX_CSS","./templates/default/print_syntax.css");
03620
03621 $this->tpl->setVariable("TITLE", $this->object->getTitle());
03622 $this->tpl->setVariable("PRINT_TEST", $this->lng->txt("tst_print"));
03623 $this->tpl->setVariable("TXT_PRINT_DATE", $this->lng->txt("date"));
03624 $this->tpl->setVariable("VALUE_PRINT_DATE", strftime("%c",$print_date));
03625
03626 $tpl = &$this->tpl;
03627
03628 $tpl->setVariable("TITLE", $this->object->getTitle());
03629
03630 $max_points= 0;
03631 $counter = 1;
03632
03633 foreach ($this->object->questions as $question) {
03634 $tpl->setCurrentBlock("question");
03635 $question_gui = $this->object->createQuestionGUI("", $question);
03636
03637 $tpl->setVariable("EDIT_QUESTION", $this->ctrl->getLinkTarget($this, "questions")."&sequence=".$counter);
03638 $tpl->setVariable("COUNTER_QUESTION", $counter.".");
03639 $tpl->setVariable("QUESTION_TITLE", $question_gui->object->getTitle());
03640
03641 switch ($question_gui->getQuestionType()) {
03642
03643 case "qt_imagemap" :
03644 $question_gui->outWorkingForm($idx = "", $postponed = false, $show_solution = true, $formaction, $show_pages= true, $show_solutions_only= true);
03645 break;
03646 case "qt_javaapplet" :
03647 $question_gui->outWorkingForm($idx = "", $postponed = false, $show_solution = true, $show_pages = true, $show_solutions_only= true);
03648 break;
03649 default :
03650 $question_gui->outWorkingForm($idx = "", $postponed = false, $show_solution = true, $show_pages = true, $show_solutions_only= true);
03651 }
03652 $tpl->parseCurrentBlock("question");
03653 $counter ++;
03654 $max_points += $question_gui->object->getMaximumPoints();
03655 }
03656 $this->tpl->setVariable("TXT_MAXIMUM_POINTS", $this->lng->txt("tst_maximum_points"));
03657 $this->tpl->setVariable("VALUE_MAXIMUM_POINTS", $max_points);
03658 }
03659
03668 function outUserGroupTable($a_type, $data_array, $block_result, $block_row, $title_text, $title_label, $buttons)
03669 {
03670 global $rbacsystem;
03671 $rowclass = array("tblrow1", "tblrow2");
03672
03673 switch($a_type)
03674 {
03675 case "iv_usr":
03676 $finished = "<img border=\"0\" align=\"middle\" src=\"".ilUtil::getImagePath("right.png", true) . "\" alt=\"".$this->lng->txt("checkbox_checked")."\" />";
03677 $started = "<img border=\"0\" align=\"middle\" src=\"".ilUtil::getImagePath("right.png", true) . "\" alt=\"".$this->lng->txt("checkbox_checked")."\" />" ;
03678 $counter = 0;
03679 foreach ($data_array as $data)
03680 {
03681 $finished_line = str_replace ("&user_id=","&user_id=".$data->usr_id,$finished);
03682 $started_line = str_replace ("&user_id=","&user_id=".$data->usr_id,$started);
03683 $this->tpl->setCurrentBlock($block_row);
03684 $this->tpl->setVariable("COLOR_CLASS", $rowclass[$counter % 2]);
03685 $this->tpl->setVariable("COUNTER", $data->usr_id);
03686 $this->tpl->setVariable("VALUE_IV_USR_ID", $data->usr_id);
03687 $this->tpl->setVariable("VALUE_IV_LOGIN", $data->login);
03688 $this->tpl->setVariable("VALUE_IV_FIRSTNAME", $data->firstname);
03689 $this->tpl->setVariable("VALUE_IV_LASTNAME", $data->lastname);
03690 $this->tpl->setVariable("VALUE_IV_CLIENT_IP", $data->clientip);
03691 $this->tpl->setVariable("VALUE_IV_TEST_FINISHED", ($data->test_finished==1)?$finished_line:" ");
03692 $this->tpl->setVariable("VALUE_IV_TEST_STARTED", ($data->test_started==1)?$started_line:" ");
03693 $counter++;
03694 $this->tpl->parseCurrentBlock();
03695 }
03696 if (count($data_array))
03697 {
03698 $this->tpl->setCurrentBlock("selectall");
03699 $this->tpl->setVariable("SELECT_ALL", $this->lng->txt("select_all"));
03700 $counter++;
03701 $this->tpl->setVariable("COLOR_CLASS", $rowclass[$counter % 2]);
03702 $this->tpl->parseCurrentBlock();
03703 }
03704 $this->tpl->setCurrentBlock($block_result);
03705 $this->tpl->setVariable("$title_label", "<img src=\"" . ilUtil::getImagePath("icon_usr_b.gif") . "\" alt=\"".$this->lng->txt("objs_usr")."\" align=\"middle\" /> " . $title_text);
03706 $this->tpl->setVariable("TEXT_IV_LOGIN", $this->lng->txt("login"));
03707 $this->tpl->setVariable("TEXT_IV_FIRSTNAME", $this->lng->txt("firstname"));
03708 $this->tpl->setVariable("TEXT_IV_LASTNAME", $this->lng->txt("lastname"));
03709 $this->tpl->setVariable("TEXT_IV_CLIENT_IP", $this->lng->txt("clientip"));
03710 $this->tpl->setVariable("TEXT_IV_TEST_FINISHED", $this->lng->txt("tst_finished"));
03711 $this->tpl->setVariable("TEXT_IV_TEST_STARTED", $this->lng->txt("tst_started"));
03712
03713 if ($rbacsystem->checkAccess('write', $this->object->getRefId()))
03714 {
03715 foreach ($buttons as $cat)
03716 {
03717 $this->tpl->setVariable("VALUE_" . strtoupper($cat), $this->lng->txt($cat));
03718 }
03719 $this->tpl->setVariable("ARROW", "<img src=\"" . ilUtil::getImagePath("arrow_downright.gif") . "\" alt=\"".$this->lng->txt("arrow_downright")."\"/>");
03720 }
03721 $this->tpl->parseCurrentBlock();
03722 break;
03723 case "usr":
03724 $finished = "<a target=\"_BLANK\" href=\"".$this->ctrl->getLinkTarget($this, "participants")."\"><img border=\"0\" align=\"middle\" src=\"".ilUtil::getImagePath("right.png", true) . "\" alt=\"".$this->lng->txt("objs_usr")."\" /> ".$this->lng->txt("tst_qst_result_sheet")."</a>" ;
03725 $counter = 0;
03726 foreach ($data_array as $data)
03727 {
03728 $this->tpl->setCurrentBlock($block_row);
03729 $this->tpl->setVariable("COLOR_CLASS", $rowclass[$counter % 2]);
03730 $this->tpl->setVariable("COUNTER", $data->usr_id);
03731 $this->tpl->setVariable("VALUE_LOGIN", $data->login);
03732 $this->tpl->setVariable("VALUE_FIRSTNAME", $data->firstname);
03733 $this->tpl->setVariable("VALUE_LASTNAME", $data->lastname);
03734 $this->tpl->setVariable("VALUE_CLIENT_IP", $data->clientip);
03735 $counter++;
03736 $this->tpl->parseCurrentBlock();
03737 }
03738 if (count($data_array))
03739 {
03740 $this->tpl->setCurrentBlock("selectall_user_row");
03741 $this->tpl->setVariable("SELECT_ALL", $this->lng->txt("select_all"));
03742 $counter++;
03743 $this->tpl->setVariable("COLOR_CLASS", $rowclass[$counter % 2]);
03744 $this->tpl->parseCurrentBlock();
03745 }
03746 $this->tpl->setCurrentBlock($block_result);
03747 $this->tpl->setVariable("$title_label", "<img src=\"" . ilUtil::getImagePath("icon_usr_b.gif") . "\" alt=\"".$this->lng->txt("objs_usr")."\" align=\"middle\" /> " . $title_text);
03748 $this->tpl->setVariable("TEXT_LOGIN", $this->lng->txt("login"));
03749 $this->tpl->setVariable("TEXT_FIRSTNAME", $this->lng->txt("firstname"));
03750 $this->tpl->setVariable("TEXT_LASTNAME", $this->lng->txt("lastname"));
03751 $this->tpl->setVariable("TEXT_CLIENT_IP", $this->lng->txt("clientip"));
03752
03753 if ($rbacsystem->checkAccess('write', $this->object->getRefId()))
03754 {
03755 foreach ($buttons as $cat)
03756 {
03757 $this->tpl->setVariable("VALUE_" . strtoupper($cat), $this->lng->txt($cat));
03758 }
03759 $this->tpl->setVariable("ARROW", "<img src=\"" . ilUtil::getImagePath("arrow_downright.gif") . "\" alt=\"".$this->lng->txt("arrow_downright")."\"/>");
03760 }
03761 $this->tpl->parseCurrentBlock();
03762 break;
03763
03764 case "role":
03765 case "grp":
03766 $counter = 0;
03767 foreach ($data_array as $key => $data)
03768 {
03769 $this->tpl->setCurrentBlock($block_row);
03770 $this->tpl->setVariable("COLOR_CLASS", $rowclass[$counter % 2]);
03771 $this->tpl->setVariable("COUNTER", $key);
03772 $this->tpl->setVariable("VALUE_TITLE", $data->title);
03773 $this->tpl->setVariable("VALUE_DESCRIPTION", $data->description);
03774 $counter++;
03775 $this->tpl->parseCurrentBlock();
03776 }
03777 if (count($data_array))
03778 {
03779 $this->tpl->setCurrentBlock("selectall_" . $a_type . "_row");
03780 $this->tpl->setVariable("SELECT_ALL", $this->lng->txt("select_all"));
03781 $counter++;
03782 $this->tpl->setVariable("COLOR_CLASS", $rowclass[$counter % 2]);
03783 $this->tpl->parseCurrentBlock();
03784 }
03785 $this->tpl->setCurrentBlock($block_result);
03786 $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);
03787 $this->tpl->setVariable("TEXT_TITLE", $this->lng->txt("title"));
03788 $this->tpl->setVariable("TEXT_DESCRIPTION", $this->lng->txt("description"));
03789 if ($rbacsystem->checkAccess('write', $this->object->getRefId()))
03790 {
03791 foreach ($buttons as $cat)
03792 {
03793 $this->tpl->setVariable("VALUE_" . strtoupper($cat), $this->lng->txt($cat));
03794 }
03795 $this->tpl->setVariable("ARROW", "<img src=\"" . ilUtil::getImagePath("arrow_downright.gif") . "\" alt=\"".$this->lng->txt("arrow_downright")."\"/>");
03796 }
03797 $this->tpl->parseCurrentBlock();
03798 break;
03799 }
03800 }
03801
03802 function addParticipantsObject()
03803 {
03804
03805 if (is_array($_POST["user_select"]))
03806 {
03807 $i = 0;
03808 foreach ($_POST["user_select"] as $user_id)
03809 {
03810 $client_ip = $_POST["client_ip"][$i];
03811 $this->object->inviteUser($user_id, $client_ip);
03812 $i++;
03813 }
03814 }
03815
03816 if (is_array($_POST["group_select"]))
03817 {
03818 foreach ($_POST["group_select"] as $group_id)
03819 {
03820 $this->object->inviteGroup($group_id);
03821 }
03822 }
03823
03824 if (is_array($_POST["role_select"]))
03825 {
03826 foreach ($_POST["role_select"] as $role_id)
03827 {
03828 $this->object->inviteRole($role_id);
03829 }
03830 }
03831 $this->ctrl->redirect($this, "participants");
03832 }
03833
03834 function searchParticipantsObject()
03835 {
03836 $this->participantsObject();
03837 }
03838
03846 function showResultsObject()
03847 {
03848 $user_ids = array();
03849 foreach ($_POST["invited_users"] as $user_id)
03850 {
03851 if ($this->object->isActiveTestSubmitted($user_id))
03852 {
03853 array_push($user_ids, $user_id);
03854 }
03855 }
03856 if (count($user_ids) == 0)
03857 {
03858 sendInfo($this->lng->txt("select_one_submitted_test"), true);
03859 $this->ctrl->redirect($this, "participants");
03860 }
03861 $this->tpl->addBlockFile("ADM_CONTENT", "adm_content", "tpl.il_as_tst_print_result_details.html", true);
03862 $this->tpl->setCurrentBlock("generic_css");
03863 $this->tpl->setVariable("LOCATION_GENERIC_STYLESHEET", "./assessment/templates/default/test_print.css");
03864 $this->tpl->setVariable("MEDIA_GENERIC_STYLESHEET", "print");
03865 $this->tpl->parseCurrentBlock();
03866 $this->tpl->setCurrentBlock("navigation_buttons");
03867 $this->tpl->setVariable("BUTTON_PRINT", $this->lng->txt("print"));
03868 $this->tpl->setVariable("BUTTON_BACK", $this->lng->txt("back"));
03869 $this->tpl->setVariable("URL_BACK", $this->ctrl->getLinkTarget($this, "participants"));
03870 $this->tpl->parseCurrentBlock();
03871 $counter = 0;
03872 foreach ($user_ids as $user_id)
03873 {
03874 $counter++;
03875 if ($counter < count($user_ids)) $this->tpl->touchBlock("ruler");
03876 $this->outPrintUserResults($user_id);
03877 }
03878 }
03879
03887 function outPrintUserResults($user_id)
03888 {
03889 include_once "./classes/class.ilObjUser.php";
03890 $user = new ilObjUser($user_id);
03891 $active = $this->object->getActiveTestUser($user_id);
03892 $t = $active->submittimestamp;
03893
03894 $print_date = mktime(date("H"), date("i"), date("s"), date("m") , date("d"), date("Y"));
03895
03896 if (strlen($user->getMatriculation()))
03897 {
03898 $this->tpl->setCurrentBlock("user_matric");
03899 $this->tpl->setVariable("TXT_USR_MATRIC", $this->lng->txt("matriculation"));
03900 $this->tpl->parseCurrentBlock();
03901 $this->tpl->setCurrentBlock("user_matric_value");
03902 $this->tpl->setVariable("VALUE_USR_MATRIC", $user->getMatriculation());
03903 $this->tpl->parseCurrentBlock();
03904 $this->tpl->touchBlock("user_matric_separator");
03905 }
03906 $pagetitle = $this->object->getTitle() . " - " . $this->lng->txt("matriculation") . ": " . $user->getMatriculation();
03907
03908 $color_class = array("tblrow1", "tblrow2");
03909 $counter = 0;
03910
03911 $result_array =& $this->object->getTestResult($user_id);
03912
03913 if (!$result_array["test"]["total_max_points"])
03914 {
03915 $percentage = 0;
03916 }
03917 else
03918 {
03919 $percentage = ($result_array["test"]["total_reached_points"]/$result_array["test"]["total_max_points"])*100;
03920 }
03921
03922 $total_max = $result_array["test"]["total_max_points"];
03923 $total_reached = $result_array["test"]["total_reached_points"];
03924
03925 foreach ($result_array as $key => $value) {
03926 if (preg_match("/\d+/", $key)) {
03927 $title = $value["title"];
03928 $this->tpl->setCurrentBlock("question");
03929 $this->tpl->setVariable("COLOR_CLASS", $color_class[$counter % 2]);
03930 $this->tpl->setVariable("VALUE_QUESTION_COUNTER", $value["nr"]);
03931 $this->tpl->setVariable("VALUE_QUESTION_TITLE", $title);
03932 $this->tpl->setVariable("VALUE_MAX_POINTS", $value["max"]);
03933 $this->tpl->setVariable("VALUE_REACHED_POINTS", $value["reached"]);
03934 $this->tpl->setVariable("VALUE_PERCENT_SOLVED", $value["percent"]);
03935 $this->tpl->parseCurrentBlock("question");
03936 $counter++;
03937 }
03938 }
03939
03940 $this->tpl->setCurrentBlock("user_results");
03941 $this->tpl->setVariable("TXT_TEST_TITLE", $this->lng->txt("title"));
03942 $this->tpl->setVariable("VALUE_TEST_TITLE", $this->object->getTitle());
03943 $this->tpl->setVariable("TXT_USR_NAME", $this->lng->txt("name"));
03944 $this->tpl->setVariable("VALUE_USR_NAME", $user->getLastname().", ".$user->getFirstname());
03945 $this->tpl->setVariable("TXT_TEST_DATE", $this->lng->txt("tst_tst_date"));
03946 $this->tpl->setVariable("VALUE_TEST_DATE", strftime("%Y-%m-%d %H:%M:%S",ilUtil::date_mysql2time($t)));
03947 $this->tpl->setVariable("TXT_PRINT_DATE", $this->lng->txt("tst_print_date"));
03948 $this->tpl->setVariable("VALUE_PRINT_DATE", strftime("%Y-%m-%d %H:%M:%S",$print_date));
03949
03950 $this->tpl->setVariable("QUESTION_COUNTER", $this->lng->txt("tst_question_no"));
03951 $this->tpl->setVariable("QUESTION_TITLE", $this->lng->txt("tst_question_title"));
03952 $this->tpl->setVariable("SOLUTION_HINT_HEADER", $this->lng->txt("solution_hint"));
03953 $this->tpl->setVariable("MAX_POINTS", $this->lng->txt("tst_maximum_points"));
03954 $this->tpl->setVariable("REACHED_POINTS", $this->lng->txt("tst_reached_points"));
03955 $this->tpl->setVariable("PERCENT_SOLVED", $this->lng->txt("tst_percent_solved"));
03956
03957
03958 $this->tpl->setVariable("TOTAL", $this->lng->txt("total"));
03959 $this->tpl->setVariable("TOTAL_MAX_POINTS", $total_max);
03960 $this->tpl->setVariable("TOTAL_REACHED_POINTS", $total_reached);
03961 $this->tpl->setVariable("TOTAL_PERCENT_SOLVED", sprintf("%01.2f",$percentage)." %");
03962
03963 $mark_obj = $this->object->mark_schema->get_matching_mark($percentage);
03964 if ($mark_obj)
03965 {
03966 $mark .= "<br /><strong>" . $this->lng->txt("tst_mark") . ": "" . $mark_obj->get_official_name() . ""</strong>";
03967 }
03968 if ($this->object->ects_output)
03969 {
03970 $ects_mark = $this->object->getECTSGrade($total_reached, $total_max);
03971 $mark .= "<br />" . $this->lng->txt("tst_your_ects_mark_is") . ": "" . $ects_mark . "" (" . $this->lng->txt("ects_grade_". strtolower($ects_mark) . "_short") . ": " . $this->lng->txt("ects_grade_". strtolower($ects_mark)) . ")";
03972 }
03973
03974 $this->tpl->setVariable("GRADE", $mark);
03975 $this->tpl->setVariable("TITLE", $this->object->getTitle());
03976 $this->tpl->setVariable("TEXT_RESULTS", sprintf($this->lng->txt("tst_result_user_name"), $user->getFullName()));
03977 $this->tpl->parseCurrentBlock();
03978 $this->tpl->setVariable("PAGETITLE", $pagetitle);
03979 }
03980
03988 function showAnswersObject()
03989 {
03990 $user_ids = array();
03991 foreach ($_POST["invited_users"] as $user_id)
03992 {
03993 if ($this->object->isActiveTestSubmitted($user_id))
03994 {
03995 array_push($user_ids, $user_id);
03996 }
03997 }
03998 if (count($user_ids) == 0)
03999 {
04000 sendInfo($this->lng->txt("select_one_submitted_test"), true);
04001 $this->ctrl->redirect($this, "participants");
04002 }
04003 $this->tpl->addBlockFile("ADM_CONTENT", "adm_content", "tpl.il_as_tst_print_answers_sheet_details.html", true);
04004 $this->tpl->setCurrentBlock("generic_css");
04005 $this->tpl->setVariable("LOCATION_GENERIC_STYLESHEET", "./assessment/templates/default/test_print.css?boris=css");
04006 $this->tpl->setVariable("MEDIA_GENERIC_STYLESHEET", "print");
04007 $this->tpl->parseCurrentBlock();
04008 $this->tpl->setCurrentBlock("navigation_buttons");
04009 $this->tpl->setVariable("BUTTON_PRINT", $this->lng->txt("print"));
04010 $this->tpl->setVariable("BUTTON_BACK", $this->lng->txt("back"));
04011 $this->tpl->setVariable("URL_BACK", $this->ctrl->getLinkTarget($this, "participants"));
04012 $this->tpl->parseCurrentBlock();
04013 $counter = 0;
04014 foreach ($user_ids as $user_id)
04015 {
04016 $counter++;
04017 if ($counter < count($user_ids)) $this->tpl->touchBlock("ruler");
04018 $this->outShowAnswersDetails($user_id);
04019 }
04020 }
04021
04029 function outShowAnswersDetails($user_id)
04030 {
04031 $active = $this->object->getActiveTestUser($user_id);
04032 $t = $active->submittimestamp;
04033 include_once "./classes/class.ilObjUser.php";
04034 $ilUser = new ilObjUser($user_id);
04035
04036 if (strlen($ilUser->getMatriculation()))
04037 {
04038 $this->tpl->setCurrentBlock("user_matric");
04039 $this->tpl->setVariable("TXT_USR_MATRIC", $this->lng->txt("matriculation"));
04040 $this->tpl->parseCurrentBlock();
04041 $this->tpl->setCurrentBlock("user_matric_value");
04042 $this->tpl->setVariable("VALUE_USR_MATRIC", $ilUser->getMatriculation());
04043 $this->tpl->parseCurrentBlock();
04044 $this->tpl->touchBlock("user_matric_separator");
04045 }
04046
04047 $invited_users = array_pop($this->object->getInvitedUsers($ilUser->getId()));
04048 if (strlen($invited_users->clientip))
04049 {
04050 $this->tpl->setCurrentBlock("user_clientip");
04051 $this->tpl->setVariable("TXT_CLIENT_IP", $this->lng->txt("clientip"));
04052 $this->tpl->parseCurrentBlock();
04053 $this->tpl->setCurrentBlock("user_clientip_value");
04054 $this->tpl->setVariable("VALUE_CLIENT_IP", $invited_users->clientip);
04055 $this->tpl->parseCurrentBlock();
04056 $this->tpl->touchBlock("user_clientip_separator");
04057 }
04058 $pagetitle = $this->object->getTitle() . " - IP: " . $invited_users->clientip . " - " . $this->lng->txt("matriculation") . ": " . $ilUser->getMatriculation();
04059
04060 include_once "./classes/class.ilUtil.php";
04061
04062
04063 if ($active->submitted)
04064 {
04065
04066 $this->tpl->setCurrentBlock("freefield_bottom");
04067 $this->tpl->setVariable("TXT_DATE", $this->lng->txt("date"));
04068 $this->tpl->setVariable("VALUE_DATE", strftime("%Y-%m-%d %H:%M:%S", ilUtil::date_mysql2time($t)));
04069
04070 $freefieldtypes = array(
04071 "freefield_bottom" => array(
04072 array(
04073 "title" => $this->lng->txt("tst_signature"),
04074 "length" => 300
04075 )
04076 )
04077 );
04078
04079 foreach ($freefieldtypes as $type => $freefields)
04080 {
04081 $counter = 0;
04082 while ($counter < count($freefields))
04083 {
04084 $freefield = $freefields[$counter];
04085 $this->tpl->setVariable("TXT_FREE_FIELD", $freefield["title"]);
04086 $this->tpl->setVariable("IMG_SPACER", ilUtil::getImagePath("spacer.gif"));
04087 $counter ++;
04088 }
04089 }
04090 $this->tpl->parseCurrentBlock();
04091 }
04092
04093 $counter = 1;
04094
04095 foreach ($this->object->questions as $question)
04096 {
04097 $this->tpl->setCurrentBlock("question");
04098 $question_gui = $this->object->createQuestionGUI("", $question);
04099
04100 $this->tpl->setVariable("COUNTER_QUESTION", $counter.". ");
04101 $this->tpl->setVariable("QUESTION_TITLE", $question_gui->object->getTitle());
04102
04103 $idx = $this->object->getTestId();
04104
04105 switch ($question_gui->getQuestionType())
04106 {
04107 case "qt_imagemap" :
04108 $question_gui->outWorkingForm($idx, false, $show_solutions=false, $formaction, $show_question_page=false, $show_solution_only = false, $ilUser, $pass = NULL, $mixpass = true);
04109 break;
04110 case "qt_javaapplet" :
04111 $question_gui->outWorkingForm("", $is_postponed = false, $showsolution = 0, $show_question_page=false, $show_solution_only = false, $ilUser, $pass = NULL, $mixpass = true);
04112 break;
04113 default :
04114 $question_gui->outWorkingForm($idx, $is_postponed = false, $showsolution = 0, $show_question_page=false, $show_solution_only = false, $ilUser, $pass = NULL, $mixpass = true);
04115 }
04116 $this->tpl->parseCurrentBlock();
04117 $counter ++;
04118 }
04119
04120 $this->tpl->setCurrentBlock("answer_sheet");
04121 $this->tpl->setVariable("TXT_TEST_TITLE", $this->lng->txt("title"));
04122 $this->tpl->setVariable("VALUE_TEST_TITLE", $this->object->getTitle());
04123 $this->tpl->setVariable("TXT_TEST_PROLOG", $this->lng->txt("tst_your_answers"));
04124 $this->tpl->setVariable("TITLE", $this->object->getTitle());
04125 $this->tpl->setVariable("TXT_ANSWER_SHEET", $this->lng->txt("tst_answer_sheet"));
04126
04127 $this->tpl->setVariable("TXT_USR_NAME", $this->lng->txt("name"));
04128 $this->tpl->setVariable("VALUE_USR_NAME", $ilUser->getLastname().", ".$ilUser->getFirstname());
04129 $this->tpl->parseCurrentBlock();
04130 $this->tpl->setVariable("PAGETITLE", $pagetitle);
04131 }
04132
04138 function infoScreenObject()
04139 {
04140 $this->ctrl->setCmd("showSummary");
04141 $this->ctrl->setCmdClass("ilinfoscreengui");
04142 $this->infoScreen();
04143 }
04144
04148 function infoScreen()
04149 {
04150 global $ilAccess;
04151 global $ilUser;
04152
04153 if (!$ilAccess->checkAccess("visible", "", $this->ref_id))
04154 {
04155 $this->ilias->raiseError($this->lng->txt("msg_no_perm_read"),$this->ilias->error_obj->MESSAGE);
04156 }
04157
04158 unset($_SESSION["tst_resetsolved"]);
04159 unset($_SESSION["tst_setsolved"]);
04160 unset($_SESSION["tst_postpone"]);
04161 unset($_SESSION["tst_summary"]);
04162 unset($_SESSION["tst_resume"]);
04163 unset($_SESSION["tst_start"]);
04164 unset($_SESSION["tst_next"]);
04165 unset($_SESSION["tst_previous"]);
04166
04167 include_once("classes/class.ilInfoScreenGUI.php");
04168 $info = new ilInfoScreenGUI($this);
04169
04170 $active = $this->object->getActiveTestUser();
04171 $seq = 1;
04172 if (is_object($active))
04173 {
04174 $seq = $active->lastindex;
04175 }
04176 include_once "./assessment/classes/class.ilTestOutputGUI.php";
04177 $output_gui =& new ilTestOutputGUI($this->object);
04178 $this->ctrl->setParameter($output_gui, "sequence", $seq);
04179 $info->setFormAction($this->ctrl->getFormAction($output_gui));
04180 $online_access = false;
04181 if ($this->object->isOnlineTest())
04182 {
04183 include_once "./assessment/classes/class.ilObjTestAccess.php";
04184 $online_access_result = ilObjTestAccess::_lookupOnlineTestAccess($this->object->getId(), $ilUser->getId());
04185 if ($online_access_result === true)
04186 {
04187 $online_access = true;
04188 }
04189 }
04190 if ($this->object->isComplete())
04191 {
04192 if ((!$this->object->isOnlineTest() && $ilAccess->checkAccess("read", "", $this->ref_id)) || ($this->object->isOnlineTest() && $ilAccess->checkAccess("read", "", $this->ref_id) && $online_access))
04193 {
04194 $executable = $this->object->isExecutable($ilUser->getId());
04195 if ($executable["executable"])
04196 {
04197 if (is_object($active))
04198 {
04199
04200 $resume_text = $this->lng->txt("tst_resume_test");
04201 if ($seq < 2)
04202 {
04203 $resume_text = $this->lng->txt("tst_start_test");
04204 }
04205
04206 if(!$_GET['crs_show_result'] or $this->object->getFirstSequence())
04207 {
04208 $info->addFormButton("resume", $resume_text);
04209 }
04210 }
04211 else
04212 {
04213
04214 $info->addFormButton("start", $this->lng->txt("tst_start_test"));
04215 }
04216 }
04217 else
04218 {
04219 sendInfo($executable["errormessage"]);
04220 if ($this->object->isActiveTestSubmitted())
04221 {
04222
04223 $info->addFormButton("showAnswersOfUser", $this->lng->txt("tst_show_answer_print_sheet"));
04224 sendInfo($this->lng->txt("online_exam_show_answer_print_sheet"));
04225 }
04226 if ($this->object->isOnlineTest() and $executable["executable"] == false)
04227 {
04228 if (!$this->object->isActiveTestSubmitted($ilUser->getId()))
04229 {
04230 if ($this->object->startingTimeReached() && (!$this->object->endingTimeReached()))
04231 {
04232 $info->addFormButton("show_answers", $this->lng->txt("save_finish"));
04233 sendInfo($this->lng->txt("online_exam_show_finish_test"));
04234 }
04235 }
04236 }
04237 }
04238 if (is_object($active))
04239 {
04240
04241
04242 if ($this->object->canShowTestResults($ilUser->getId()))
04243 {
04244 $info->addFormButton("outResults", $this->lng->txt("tst_show_results"));
04245 }
04246 }
04247 }
04248 }
04249
04250 $info->enablePrivateNotes();
04251
04252 if (strlen($this->object->getIntroduction()))
04253 {
04254 $info->addSection($this->lng->txt("tst_introduction"));
04255 $info->addProperty("", str_replace("\n", "<br />", $this->object->getIntroduction()));
04256 }
04257
04258 $info->addSection($this->lng->txt("tst_general_properties"));
04259 $info->addProperty($this->lng->txt("tst_type"), $this->lng->txt($this->object->test_types[$this->object->getTestType()]));
04260 $info->addProperty($this->lng->txt("author"), $this->object->getAuthor());
04261 $info->addProperty($this->lng->txt("title"), $this->object->getTitle());
04262 if ($this->object->isComplete())
04263 {
04264 if ((!$this->object->isOnlineTest() && $ilAccess->checkAccess("read", "", $this->ref_id)) || ($this->object->isOnlineTest() && $ilAccess->checkAccess("read", "", $this->ref_id) && $online_access))
04265 {
04266
04267 $checked_javascript = false;
04268 if ($ilUser->prefs["tst_javascript"])
04269 {
04270 $checked_javascript = true;
04271 }
04272 $info->addPropertyCheckbox($this->lng->txt("tst_test_output"), "chb_javascript", 1, $this->lng->txt("tst_use_javascript"), $checked_javascript);
04273
04274
04275 if (!($this->object->getTestType() == TYPE_VARYING_RANDOMTEST))
04276 {
04277 if ($this->object->getNrOfTries() != 1)
04278 {
04279 if ($this->object->getHidePreviousResults() == 1)
04280 {
04281 $info->addProperty($this->lng->txt("tst_hide_previous_results"), $this->lng->txt("tst_hide_previous_results_introduction"));
04282 }
04283 else
04284 {
04285 $checked_hide_results = false;
04286 if ($ilUser->prefs["tst_hide_previous_results"])
04287 {
04288 $checked_hide_results = true;
04289 }
04290 $info->addPropertyCheckbox($this->lng->txt("tst_hide_previous_results"), "chb_hide_previous_results", 1, $this->lng->txt("tst_hide_previous_results_hide"), $checked_hide_results);
04291 }
04292 }
04293 }
04294 }
04295 }
04296
04297 $info->addSection($this->lng->txt("tst_sequence_properties"));
04298 $info->addProperty($this->lng->txt("tst_sequence"), $this->lng->txt(($this->object->getSequenceSettings() == TEST_FIXED_SEQUENCE)? "tst_sequence_fixed":"tst_sequence_postpone"));
04299
04300 $info->addSection($this->lng->txt("tst_heading_scoring"));
04301 $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"));
04302 $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"));
04303 if ($this->object->getTestType() == TYPE_VARYING_RANDOMTEST)
04304 {
04305 $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"));
04306 }
04307
04308 $info->addSection($this->lng->txt("tst_score_reporting"));
04309 $info->addProperty($this->lng->txt("tst_score_reporting"), $this->lng->txt(($this->object->getScoreReporting() == REPORT_AFTER_QUESTION)?"tst_report_after_question":"tst_report_after_test"));
04310 $reporting_date = $this->object->getReportingDate();
04311 if ($reporting_date)
04312 {
04313 preg_match("/(\d{4})(\d{2})(\d{2})(\d{2})(\d{2})(\d{2})/", $reporting_date, $matches);
04314 $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]));
04315 $info->addProperty($this->lng->txt("tst_score_reporting_date"), $txt_reporting_date);
04316 }
04317
04318 $info->addSection($this->lng->txt("tst_session_settings"));
04319 $info->addProperty($this->lng->txt("tst_nr_of_tries"), ($this->object->getNrOfTries() == 0)?$this->lng->txt("unlimited"):$this->object->getNrOfTries());
04320 if ($this->object->getNrOfTries() != 1)
04321 {
04322 $info->addProperty($this->lng->txt("tst_nr_of_tries_of_user"), ($active->tries == false)?$this->lng->txt("tst_no_tries"):$active->tries);
04323 }
04324
04325 if ($this->object->getEnableProcessingTime())
04326 {
04327 $info->addProperty($this->lng->txt("tst_processing_time"), $this->object->getProcessingTime());
04328 }
04329
04330 $starting_time = $this->object->getStartingTime();
04331 if ($starting_time)
04332 {
04333 preg_match("/(\d{4})(\d{2})(\d{2})(\d{2})(\d{2})(\d{2})/", $starting_time, $matches);
04334 $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]));
04335 $info->addProperty($this->lng->txt("tst_starting_time"), $txt_starting_time);
04336 }
04337 $ending_time = $this->object->getEndingTime();
04338 if ($ending_time)
04339 {
04340 preg_match("/(\d{4})(\d{2})(\d{2})(\d{2})(\d{2})(\d{2})/", $ending_time, $matches);
04341 $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]));
04342 $info->addProperty($this->lng->txt("tst_ending_time"), $txt_ending_time);
04343 }
04344 $info->addMetaDataSections($this->object->getId(),0, $this->object->getType());
04345
04346
04347 if($_GET['crs_show_result'] and !$this->object->getFirstSequence())
04348 {
04349 sendInfo($this->lng->txt('crs_all_questions_answered_successfully'));
04350 }
04351
04352 $this->ctrl->forwardCommand($info);
04353 }
04354
04355 function addLocatorItems()
04356 {
04357 global $ilLocator;
04358 switch ($this->ctrl->getCmd())
04359 {
04360 case "redirectQuestion":
04361 case "run":
04362 case "infoScreen":
04363 case "start":
04364 case "resume":
04365 case "previous":
04366 case "next":
04367 case "summary":
04368 case "finishTest":
04369 case "outEvaluationForm":
04370 case "passDetails":
04371 case "showAnswersOfUser":
04372 case "outResults":
04373 case "backFromSummary":
04374 case "show_answers":
04375 case "setsolved":
04376 case "resetsolved":
04377 case "outTestSummary":
04378 case "gotoQuestion":
04379 case "selectImagemapRegion":
04380 case "confirmSubmitAnswers":
04381 case "finalSubmission":
04382 case "postpone":
04383 case "outResultsOverview":
04384 $ilLocator->addItem($this->object->getTitle(), $this->ctrl->getLinkTarget($this, "infoScreen"));
04385 break;
04386 case "eval_stat":
04387 case "evalAllUsers":
04388 case "evalUserDetail":
04389 $ilLocator->addItem($this->object->getTitle(), $this->ctrl->getLinkTarget($this, "eval_stat"));
04390 break;
04391 case "create":
04392 case "save":
04393 case "cancel":
04394 case "importFile":
04395 case "cloneAll":
04396 case "importVerifiedFile":
04397 case "cancelImport":
04398 break;
04399 default:
04400 $ilLocator->addItem($this->object->getTitle(), $this->ctrl->getLinkTarget($this, ""));
04401 break;
04402 }
04403 }
04404
04410 function getTabs(&$tabs_gui)
04411 {
04412 global $rbacsystem;
04413
04414 switch ($this->ctrl->getCmd())
04415 {
04416 case "start":
04417 case "resume":
04418 case "previous":
04419 case "next":
04420 case "summary":
04421 case "directfeedback":
04422 case "finishTest":
04423 case "outEvaluationForm":
04424 case "passDetails":
04425 case "showAnswersOfUser":
04426 case "outResults":
04427 case "backFromSummary":
04428 case "show_answers":
04429 case "setsolved":
04430 case "resetsolved":
04431 case "confirmFinish":
04432 case "outTestSummary":
04433 case "gotoQuestion":
04434 case "selectImagemapRegion":
04435 case "confirmSubmitAnswers":
04436 case "finalSubmission":
04437 case "postpone":
04438 case "redirectQuestion":
04439 case "outResultsOverview":
04440 return;
04441 break;
04442 }
04443 if (strcmp(strtolower(get_class($this->object)), "ilobjtest") == 0)
04444 {
04445 global $ilAccess;
04446 if ($ilAccess->checkAccess("write", "", $this->ref_id))
04447 {
04448
04449 $force_active = ($this->ctrl->getCmdClass() == "" &&
04450 $this->ctrl->getCmd() == "")
04451 ? true
04452 : false;
04453 $tabs_gui->addTarget("properties",
04454 $this->ctrl->getLinkTarget($this,'properties'),
04455 array("properties", "saveProperties", "cancelProperties"),
04456 "",
04457 "", $force_active);
04458 }
04459
04460 if ($ilAccess->checkAccess("visible", "", $this->ref_id))
04461 {
04462 $tabs_gui->addTarget("info",
04463 $this->ctrl->getLinkTarget($this,'infoScreen'),
04464 array("infoScreen", "outIntroductionPage", "showSummary"));
04465 }
04466
04467 if ($ilAccess->checkAccess("write", "", $this->ref_id))
04468 {
04469
04470 $force_active = ($_GET["up"] != "" || $_GET["down"] != "")
04471 ? true
04472 : false;
04473 if (!$force_active)
04474 {
04475 if ($_GET["browse"] == 1) $force_active = true;
04476 if (preg_match("/deleteqpl_\d+/", $this->ctrl->getCmd()))
04477 {
04478 $force_active = true;
04479 }
04480 }
04481 $tabs_gui->addTarget("ass_questions",
04482 $this->ctrl->getLinkTarget($this,'questions'),
04483 array("questions", "browseForQuestions", "questionBrowser", "createQuestion",
04484 "randomselect", "filter", "resetFilter", "insertQuestions",
04485 "back", "createRandomSelection", "cancelRandomSelect",
04486 "insertRandomSelection", "removeQuestions", "moveQuestions",
04487 "insertQuestionsBefore", "insertQuestionsAfter", "confirmRemoveQuestions",
04488 "cancelRemoveQuestions", "executeCreateQuestion", "cancelCreateQuestion",
04489 "addQuestionpool", "saveRandomQuestions", "saveQuestionSelectionMode"),
04490 "", "", $force_active);
04491
04492
04493 $tabs_gui->addTarget("mark_schema",
04494 $this->ctrl->getLinkTarget($this,'marks'),
04495 array("marks", "addMarkStep", "deleteMarkSteps", "addSimpleMarkSchema",
04496 "saveMarks", "cancelMarks"),
04497 "");
04498
04499 if ($this->object->isOnlineTest())
04500 {
04501
04502 $tabs_gui->addTarget("participants",
04503 $this->ctrl->getLinkTarget($this,'participants'),
04504 array("participants", "searchParticipants", "addParticipants", "saveClientIP",
04505 "removeParticipant", "showAnswers", "showResults"),
04506 "");
04507 }
04508
04509
04510 if (!$this->object->isRandomTest())
04511 {
04512 $tabs_gui->addTarget("print",
04513 $this->ctrl->getLinkTarget($this,'print'),
04514 "print", "");
04515 }
04516
04517
04518 $tabs_gui->addTarget("export",
04519 $this->ctrl->getLinkTarget($this,'export'),
04520 array("export", "createExportFile", "confirmDeleteExportFile",
04521 "downloadExportFile", "deleteExportFile", "cancelDeleteExportFile"),
04522 "");
04523
04524
04525 $tabs_gui->addTarget("maintenance",
04526 $this->ctrl->getLinkTarget($this,'maintenance'),
04527 array("maintenance", "deleteAllUserData", "confirmDeleteAllUserData",
04528 "cancelDeleteAllUserData", "deleteSingleUserResults"),
04529 "");
04530
04531
04532 $tabs_gui->addTarget("status",
04533 $this->ctrl->getLinkTarget($this,'status'),
04534 "status", "");
04535
04536
04537 include_once("Services/Tracking/classes/class.ilObjUserTracking.php");
04538 if(ilObjUserTracking::_enabledLearningProgress() and $rbacsystem->checkAccess('edit_learning_progress',$this->ref_id))
04539 {
04540 $tabs_gui->addTarget('learning_progress',
04541 $this->ctrl->getLinkTargetByClass(array('illearningprogressgui'),''),
04542 '',
04543 array('illplistofobjectsgui','illplistofsettingsgui','illearningprogressgui',
04544 'illplistofprogressgui'));
04545 }
04546
04547
04548 $tabs_gui->addTarget("perm_settings",
04549 $this->ctrl->getLinkTargetByClass(array(get_class($this),'ilpermissiongui'), "perm"), array("perm","info","owner"), 'ilpermissiongui');
04550
04551
04552 $tabs_gui->addTarget("meta_data",
04553 $this->ctrl->getLinkTargetByClass('ilmdeditorgui','listSection'),
04554 "", "ilmdeditorgui");
04555 }
04556 }
04557 }
04558 }
04559 ?>