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 include_once "./Modules/TestQuestionPool/classes/class.assQuestionGUI.php";
00025
00036 class assClozeTestGUI extends assQuestionGUI
00037 {
00042 var $gapIndex;
00043
00048 var $answerIndex;
00049
00058 function assClozeTestGUI(
00059 $id = -1
00060 )
00061 {
00062 $this->assQuestionGUI();
00063 include_once "./Modules/TestQuestionPool/classes/class.assClozeTest.php";
00064 $this->object = new assClozeTest();
00065 if ($id >= 0)
00066 {
00067 $this->object->loadFromDb($id);
00068 }
00069 }
00070
00071 function getCommand($cmd)
00072 {
00073 if (preg_match("/^(addGapText|addSelectGapText|addSuggestedSolution|removeSuggestedSolution)_(\d+)$/", $cmd, $matches))
00074 {
00075 $cmd = $matches[1];
00076 $this->gapIndex = $matches[2];
00077 }
00078 else if (preg_match("/^(delete)_(\d+)_(\d+)$/", $cmd, $matches))
00079 {
00080 $cmd = $matches[1];
00081 $this->gapIndex = $matches[2];
00082 $this->answerIndex = $matches[3];
00083 }
00084 return $cmd;
00085 }
00086
00090 function createGaps()
00091 {
00092 $this->writePostData();
00093 $this->editQuestion();
00094 }
00095
00099 function changeGapType()
00100 {
00101 $this->writePostData();
00102 $this->editQuestion();
00103 }
00104
00108 function checkInput()
00109 {
00110 if ((!$_POST["title"]) or (!$_POST["author"]) or (!$_POST["clozetext"]))
00111 {
00112 return FALSE;
00113 }
00114 return TRUE;
00115 }
00116
00124 function setGapTypes()
00125 {
00126 foreach ($_POST as $key => $value)
00127 {
00128
00129 if (preg_match("/clozetype_(\d+)/", $key, $matches))
00130 {
00131 $this->object->setGapType($matches[1], $value);
00132 }
00133 }
00134 }
00135
00143 function setShuffleState()
00144 {
00145 foreach ($_POST as $key => $value)
00146 {
00147
00148 if (preg_match("/^shuffle_(\d+)$/", $key, $matches))
00149 {
00150 $this->object->setGapShuffle($matches[1], $value);
00151 }
00152 }
00153 }
00154
00162 function setGapAnswers()
00163 {
00164 $this->object->clearGapAnswers();
00165 foreach ($_POST as $key => $value)
00166 {
00167 if (preg_match("/^(textgap|selectgap|numericgap)_(\d+)_(\d+)$/", $key, $matches))
00168 {
00169
00170 $gap = $matches[2];
00171 $order = $matches[3];
00172 $this->object->addGapAnswer($gap, $order, ilUtil::stripSlashes($value, FALSE));
00173 }
00174 }
00175 }
00176
00184 function setGapPoints()
00185 {
00186 foreach ($_POST as $key => $value)
00187 {
00188 if (preg_match("/points_(\d+)_(\d+)/", $key, $matches))
00189 {
00190 $gap = $matches[1];
00191 $order = $matches[2];
00192 $this->object->setGapAnswerPoints($gap, $order, ilUtil::stripSlashes($value));
00193 }
00194 }
00195 }
00196
00204 function setGapBounds()
00205 {
00206 foreach ($_POST as $key => $value)
00207 {
00208 if (preg_match("/numericgap_(\d+)_(\d+)_lower/", $key, $matches))
00209 {
00210 $gap = $matches[1];
00211 $order = $matches[2];
00212 $this->object->setGapAnswerLowerBound($gap, $order, $value);
00213 }
00214 if (preg_match("/numericgap_(\d+)_(\d+)_upper/", $key, $matches))
00215 {
00216 $gap = $matches[1];
00217 $order = $matches[2];
00218 $this->object->setGapAnswerUpperBound($gap, $order, $value);
00219 }
00220 }
00221 }
00222
00230 function addGapText()
00231 {
00232 $this->writePostData();
00233 $this->object->addGapText($this->gapIndex);
00234 $this->editQuestion();
00235 }
00236
00244 function addSelectGapText()
00245 {
00246 $this->writePostData();
00247 $this->object->addGapText($this->gapIndex);
00248 $this->editQuestion();
00249 }
00250
00258 function delete()
00259 {
00260 $this->writePostData();
00261 $this->object->deleteAnswerText($this->gapIndex, $this->answerIndex);
00262 $this->editQuestion();
00263 }
00264
00273 function writePostData()
00274 {
00275 $result = 0;
00276 $saved = false;
00277
00278
00279 $this->object->flushGaps();
00280
00281 if (!$this->checkInput())
00282 {
00283 $result = 1;
00284 }
00285
00286
00287
00288
00289
00290
00291
00292
00293 $this->object->setTitle(ilUtil::stripSlashes($_POST["title"]));
00294 $this->object->setAuthor(ilUtil::stripSlashes($_POST["author"]));
00295 $this->object->setComment(ilUtil::stripSlashes($_POST["comment"]));
00296 $this->object->setTextgapRating($_POST["textgap_rating"]);
00297 $this->object->setIdenticalScoring($_POST["identical_scoring"]);
00298 $this->object->setFixedTextLength($_POST["fixedTextLength"]);
00299 include_once "./classes/class.ilObjAdvancedEditing.php";
00300 $cloze_text = ilUtil::stripSlashes($_POST["clozetext"], false, ilObjAdvancedEditing::_getUsedHTMLTagsAsString("assessment"));
00301 $this->object->setClozeText($cloze_text);
00302
00303 $saved = $saved | $this->writeOtherPostData($result);
00304 $this->object->suggested_solutions = array();
00305 foreach ($_POST as $key => $value)
00306 {
00307 if (preg_match("/^solution_hint_(\d+)/", $key, $matches))
00308 {
00309 if ($value)
00310 {
00311 $this->object->setSuggestedSolution($value, $matches[1]);
00312 }
00313 }
00314 }
00315
00316 if (strcmp($this->ctrl->getCmd(), "createGaps") == 0)
00317 {
00318
00319
00320
00321 $this->setGapTypes();
00322 $this->setShuffleState();
00323 $this->setGapPoints();
00324 $this->setGapBounds();
00325 }
00326 else
00327 {
00328 $this->setGapTypes();
00329 $this->setShuffleState();
00330 $this->setGapAnswers();
00331 $this->setGapPoints();
00332 $this->setGapBounds();
00333 $this->object->updateClozeTextFromGaps();
00334 }
00335 if ($saved)
00336 {
00337
00338
00339
00340
00341 $this->object->saveToDb();
00342 $this->ctrl->setParameter($this, "q_id", $this->object->getId());
00343 }
00344 return $result;
00345 }
00346
00354 function editQuestion()
00355 {
00356 include_once "./Modules/TestQuestionPool/classes/class.assQuestion.php";
00357 $internallinks = array(
00358 "lm" => $this->lng->txt("obj_lm"),
00359 "st" => $this->lng->txt("obj_st"),
00360 "pg" => $this->lng->txt("obj_pg"),
00361 "glo" => $this->lng->txt("glossary_term")
00362 );
00363
00364 $this->getQuestionTemplate();
00365 $this->tpl->addBlockFile("QUESTION_DATA", "question_data", "tpl.il_as_qpl_cloze_question.html", "Modules/TestQuestionPool");
00366 for ($i = 0; $i < $this->object->getGapCount(); $i++)
00367 {
00368 $gap = $this->object->getGap($i);
00369 if ($gap->getType() == CLOZE_TEXT)
00370 {
00371 $this->tpl->setCurrentBlock("textgap_value");
00372 foreach ($gap->getItemsRaw() as $item)
00373 {
00374 $this->tpl->setVariable("TEXT_VALUE", $this->lng->txt("value"));
00375 $this->tpl->setVariable("VALUE_TEXT_GAP", $item->getAnswertext());
00376 $this->tpl->setVariable("VALUE_GAP_COUNTER", "$i" . "_" . $item->getOrder());
00377 $this->tpl->setVariable("VALUE_GAP", $i);
00378 $this->tpl->setVariable("VALUE_INDEX", $item->getOrder());
00379 $this->tpl->setVariable("VALUE_STATUS_COUNTER", $item->getOrder());
00380 $this->tpl->setVariable("VALUE_GAP", $i);
00381 $this->tpl->setVariable("TEXT_POINTS", $this->lng->txt("points"));
00382 $this->tpl->setVariable("VALUE_TEXT_GAP_POINTS", $item->getPoints());
00383 $this->tpl->setVariable("DELETE", $this->lng->txt("delete"));
00384 $this->tpl->parseCurrentBlock();
00385 }
00386
00387 foreach ($internallinks as $key => $value)
00388 {
00389 $this->tpl->setCurrentBlock("textgap_internallink");
00390 $this->tpl->setVariable("TYPE_INTERNAL_LINK", $key);
00391 $this->tpl->setVariable("TEXT_INTERNAL_LINK", $value);
00392 $this->tpl->parseCurrentBlock();
00393 }
00394
00395 $this->tpl->setCurrentBlock("textgap_suggested_solution");
00396 $this->tpl->setVariable("TEXT_SOLUTION_HINT", $this->lng->txt("solution_hint"));
00397 if (array_key_exists($i, $this->object->suggested_solutions))
00398 {
00399 $solution_array = $this->object->getSuggestedSolution($i);
00400 $href = assQuestion::_getInternalLinkHref($solution_array["internal_link"]);
00401 $this->tpl->setVariable("TEXT_VALUE_SOLUTION_HINT", " <a href=\"$href\" target=\"content\">" . $this->lng->txt("solution_hint"). "</a> ");
00402 $this->tpl->setVariable("BUTTON_REMOVE_SOLUTION", $this->lng->txt("remove"));
00403 $this->tpl->setVariable("VALUE_GAP_COUNTER_REMOVE", $i);
00404 $this->tpl->setVariable("BUTTON_ADD_SOLUTION", $this->lng->txt("change"));
00405 $this->tpl->setVariable("VALUE_SOLUTION_HINT", $solution_array["internal_link"]);
00406 }
00407 else
00408 {
00409 $this->tpl->setVariable("BUTTON_ADD_SOLUTION", $this->lng->txt("add"));
00410 }
00411 $this->tpl->setVariable("VALUE_GAP_COUNTER", $i);
00412 $this->tpl->parseCurrentBlock();
00413 $this->tpl->setCurrentBlock("textgap");
00414 $this->tpl->setVariable("ADD_TEXT_GAP", $this->lng->txt("add_gap"));
00415 $this->tpl->setVariable("VALUE_GAP_COUNTER", "$i");
00416 $this->tpl->parseCurrentBlock();
00417 }
00418
00419 else if ($gap->getType() == CLOZE_NUMERIC)
00420 {
00421 $this->tpl->setCurrentBlock("numericgap_value");
00422 foreach ($gap->getItemsRaw() as $item)
00423 {
00424 $this->tpl->setVariable("TEXT_VALUE", $this->lng->txt("value"));
00425 $this->tpl->setVariable("TEXT_LOWER_LIMIT", $this->lng->txt("range_lower_limit"));
00426 $this->tpl->setVariable("TEXT_UPPER_LIMIT", $this->lng->txt("range_upper_limit"));
00427 $this->tpl->setVariable("VALUE_NUMERIC_GAP", $item->getAnswertext());
00428 $this->tpl->setVariable("VALUE_GAP_COUNTER", "$i" . "_" . $item->getOrder());
00429 $this->tpl->setVariable("VALUE_GAP", $i);
00430 $this->tpl->setVariable("VALUE_INDEX", $item->getOrder());
00431 $this->tpl->setVariable("VALUE_STATUS_COUNTER", $item->getOrder());
00432 $this->tpl->setVariable("VALUE_GAP", $i);
00433 $this->tpl->setVariable("TEXT_POINTS", $this->lng->txt("points"));
00434 $this->tpl->setVariable("VALUE_NUMERIC_GAP_POINTS", $item->getPoints());
00435 $this->tpl->setVariable("VALUE_LOWER_LIMIT", $item->getLowerBound());
00436 $this->tpl->setVariable("VALUE_UPPER_LIMIT", $item->getUpperBound());
00437 $this->tpl->setVariable("DELETE", $this->lng->txt("delete"));
00438 $this->tpl->parseCurrentBlock();
00439 }
00440
00441 foreach ($internallinks as $key => $value)
00442 {
00443 $this->tpl->setCurrentBlock("numericgap_internallink");
00444 $this->tpl->setVariable("TYPE_INTERNAL_LINK", $key);
00445 $this->tpl->setVariable("TEXT_INTERNAL_LINK", $value);
00446 $this->tpl->parseCurrentBlock();
00447 }
00448
00449 $this->tpl->setCurrentBlock("numericgap_suggested_solution");
00450 $this->tpl->setVariable("TEXT_SOLUTION_HINT", $this->lng->txt("solution_hint"));
00451 if (array_key_exists($i, $this->object->suggested_solutions))
00452 {
00453 $solution_array = $this->object->getSuggestedSolution($i);
00454 $href = assQuestion::_getInternalLinkHref($solution_array["internal_link"]);
00455 $this->tpl->setVariable("TEXT_VALUE_SOLUTION_HINT", " <a href=\"$href\" target=\"content\">" . $this->lng->txt("solution_hint"). "</a> ");
00456 $this->tpl->setVariable("BUTTON_REMOVE_SOLUTION", $this->lng->txt("remove"));
00457 $this->tpl->setVariable("VALUE_GAP_COUNTER_REMOVE", $i);
00458 $this->tpl->setVariable("BUTTON_ADD_SOLUTION", $this->lng->txt("change"));
00459 $this->tpl->setVariable("VALUE_SOLUTION_HINT", $solution_array["internal_link"]);
00460 }
00461 else
00462 {
00463 $this->tpl->setVariable("BUTTON_ADD_SOLUTION", $this->lng->txt("add"));
00464 }
00465 $this->tpl->setVariable("VALUE_GAP_COUNTER", $i);
00466 $this->tpl->parseCurrentBlock();
00467 $this->tpl->setCurrentBlock("numericgap");
00468 $this->tpl->parseCurrentBlock();
00469 }
00470
00471 else if ($gap->getType() == CLOZE_SELECT)
00472 {
00473 $this->tpl->setCurrentBlock("selectgap_value");
00474 foreach ($gap->getItemsRaw() as $item)
00475 {
00476 $this->tpl->setVariable("TEXT_VALUE", $this->lng->txt("value"));
00477 $this->tpl->setVariable("VALUE_SELECT_GAP", $item->getAnswertext());
00478 $this->tpl->setVariable("VALUE_GAP_COUNTER", "$i" . "_" . $item->getOrder());
00479 $this->tpl->setVariable("VALUE_GAP", $i);
00480 $this->tpl->setVariable("VALUE_INDEX", $item->getOrder());
00481 $this->tpl->setVariable("VALUE_STATUS_COUNTER", $item->getOrder());
00482 $this->tpl->setVariable("VALUE_GAP", $i);
00483 $this->tpl->setVariable("TEXT_POINTS", $this->lng->txt("points"));
00484 $this->tpl->setVariable("VALUE_SELECT_GAP_POINTS", $item->getPoints());
00485 $this->tpl->setVariable("DELETE", $this->lng->txt("delete"));
00486 $this->tpl->parseCurrentBlock();
00487 }
00488
00489 foreach ($internallinks as $key => $value)
00490 {
00491 $this->tpl->setCurrentBlock("selectgap_internallink");
00492 $this->tpl->setVariable("TYPE_INTERNAL_LINK", $key);
00493 $this->tpl->setVariable("TEXT_INTERNAL_LINK", $value);
00494 $this->tpl->parseCurrentBlock();
00495 }
00496
00497 $this->tpl->setCurrentBlock("selectgap_suggested_solution");
00498 $this->tpl->setVariable("TEXT_SOLUTION_HINT", $this->lng->txt("solution_hint"));
00499 if (array_key_exists($i, $this->object->suggested_solutions))
00500 {
00501 $solution_array = $this->object->getSuggestedSolution($i);
00502 $href = assQuestion::_getInternalLinkHref($solution_array["internal_link"]);
00503 $this->tpl->setVariable("TEXT_VALUE_SOLUTION_HINT", " <a href=\"$href\" target=\"content\">" . $this->lng->txt("solution_hint"). "</a> ");
00504 $this->tpl->setVariable("BUTTON_REMOVE_SOLUTION", $this->lng->txt("remove"));
00505 $this->tpl->setVariable("VALUE_GAP_COUNTER_REMOVE", $i);
00506 $this->tpl->setVariable("BUTTON_ADD_SOLUTION", $this->lng->txt("change"));
00507 $this->tpl->setVariable("VALUE_SOLUTION_HINT", $solution_array["internal_link"]);
00508 }
00509 else
00510 {
00511 $this->tpl->setVariable("BUTTON_ADD_SOLUTION", $this->lng->txt("add"));
00512 }
00513 $this->tpl->setVariable("VALUE_GAP_COUNTER", $i);
00514 $this->tpl->parseCurrentBlock();
00515 $this->tpl->setCurrentBlock("selectgap");
00516 $this->tpl->setVariable("ADD_SELECT_GAP", $this->lng->txt("add_gap"));
00517 $this->tpl->setVariable("TEXT_SHUFFLE_ANSWERS", $this->lng->txt("shuffle_answers"));
00518 $this->tpl->setVariable("VALUE_GAP_COUNTER", "$i");
00519 if ($gap->getShuffle())
00520 {
00521 $this->tpl->setVariable("SELECTED_YES", " selected=\"selected\"");
00522 }
00523 else
00524 {
00525 $this->tpl->setVariable("SELECTED_NO", " selected=\"selected\"");
00526 }
00527 $this->tpl->setVariable("TXT_YES", $this->lng->txt("yes"));
00528 $this->tpl->setVariable("TXT_NO", $this->lng->txt("no"));
00529 $this->tpl->parseCurrentBlock();
00530 }
00531
00532 $this->tpl->setCurrentBlock("answer_row");
00533 $name = $this->lng->txt("gap") . " " . ($i+1);
00534 $this->tpl->setVariable("TEXT_GAP_NAME", $name);
00535 $this->tpl->setVariable("TEXT_TYPE", $this->lng->txt("type"));
00536 $this->tpl->setVariable("TEXT_CHANGE", $this->lng->txt("change"));
00537 switch ($gap->getType())
00538 {
00539 case CLOZE_TEXT:
00540 $this->tpl->setVariable("SELECTED_TEXT_GAP", " selected=\"selected\"");
00541 break;
00542 case CLOZE_SELECT:
00543 $this->tpl->setVariable("SELECTED_SELECT_GAP", " selected=\"selected\"");
00544 break;
00545 case CLOZE_NUMERIC:
00546 $this->tpl->setVariable("SELECTED_NUMERIC_GAP", " selected=\"selected\"");
00547 break;
00548 }
00549 $this->tpl->setVariable("TEXT_TEXT_GAP", $this->lng->txt("text_gap"));
00550 $this->tpl->setVariable("TEXT_SELECT_GAP", $this->lng->txt("select_gap"));
00551 $this->tpl->setVariable("TEXT_NUMERIC_GAP", $this->lng->txt("numeric_gap"));
00552 $this->tpl->setVariable("VALUE_GAP_COUNTER", $i);
00553 $this->tpl->parseCurrentBlock();
00554 }
00555
00556
00557 $this->outOtherQuestionData();
00558
00559
00560 $this->tpl->setCurrentBlock("HeadContent");
00561 $this->tpl->addJavascript("./Services/JavaScript/js/Basic.js");
00562 $javascript = "<script type=\"text/javascript\">ilAddOnLoad(initialSelect);\n".
00563 "function initialSelect() {\n%s\n}</script>";
00564 if (preg_match("/addGapText_(\d+)/", $this->ctrl->getCmd(), $matches))
00565 {
00566 $this->tpl->setVariable("CONTENT_BLOCK", sprintf($javascript, "document.frm_cloze_test.textgap_" . $matches[1] . "_" .(is_object($this->object->getGap($matches[1])) ? $this->object->getGap($matches[1])->getItemCount() - 1 : 0) .".focus(); document.frm_cloze_test.textgap_" . $matches[1] . "_" . (is_object($this->object->getGap($matches[1])) ? $this->object->getGap($matches[1])->getItemCount() - 1 : 0) .".scrollIntoView(\"true\");"));
00567 }
00568 else if (preg_match("/addSelectGapText_(\d+)/", $this->ctrl->getCmd(), $matches))
00569 {
00570 $this->tpl->setVariable("CONTENT_BLOCK", sprintf($javascript, "document.frm_cloze_test.selectgap_" . $matches[1] . "_" .(is_object($this->object->getGap($matches[1])) ? $this->object->getGap($matches[1])->getItemCount() - 1 : 0) .".focus(); document.frm_cloze_test.selectgap_" . $matches[1] . "_" . (is_object($this->object->getGap($matches[1])) ? $this->object->getGap($matches[1])->getItemCount() - 1 : 0) .".scrollIntoView(\"true\");"));
00571 }
00572 else
00573 {
00574 $this->tpl->setVariable("CONTENT_BLOCK", sprintf($javascript, "document.frm_cloze_test.title.focus();"));
00575 }
00576 $this->tpl->parseCurrentBlock();
00577
00578
00579 $textgap_options = array(
00580 array("ci", $this->lng->txt("cloze_textgap_case_insensitive")),
00581 array("cs", $this->lng->txt("cloze_textgap_case_sensitive")),
00582 array("l1", sprintf($this->lng->txt("cloze_textgap_levenshtein_of"), "1")),
00583 array("l2", sprintf($this->lng->txt("cloze_textgap_levenshtein_of"), "2")),
00584 array("l3", sprintf($this->lng->txt("cloze_textgap_levenshtein_of"), "3")),
00585 array("l4", sprintf($this->lng->txt("cloze_textgap_levenshtein_of"), "4")),
00586 array("l5", sprintf($this->lng->txt("cloze_textgap_levenshtein_of"), "5"))
00587 );
00588 $textgap_rating = $this->object->getTextgapRating();
00589 foreach ($textgap_options as $textgap_option)
00590 {
00591 $this->tpl->setCurrentBlock("textgap_rating");
00592 $this->tpl->setVariable("TEXTGAP_VALUE", $textgap_option[0]);
00593 $this->tpl->setVariable("TEXTGAP_TEXT", $textgap_option[1]);
00594 if (strcmp($textgap_rating, $textgap_option[0]) == 0)
00595 {
00596 $this->tpl->setVariable("SELECTED_TEXTGAP_VALUE", " selected=\"selected\"");
00597 }
00598 $this->tpl->parseCurrentBlock();
00599 }
00600
00601 $this->tpl->setCurrentBlock("question_data");
00602 $this->tpl->setVariable("FIXED_TEXTLENGTH", $this->lng->txt("cloze_fixed_textlength"));
00603 $this->tpl->setVariable("FIXED_TEXTLENGTH_DESCRIPTION", $this->lng->txt("cloze_fixed_textlength_description"));
00604 if ($this->object->getFixedTextLength())
00605 {
00606 $this->tpl->setVariable("VALUE_FIXED_TEXTLENGTH", " value=\"" . ilUtil::prepareFormOutput($this->object->getFixedTextLength()) . "\"");
00607 }
00608 $this->tpl->setVariable("VALUE_CLOZE_TITLE", ilUtil::prepareFormOutput($this->object->getTitle()));
00609 $this->tpl->setVariable("VALUE_CLOZE_COMMENT", ilUtil::prepareFormOutput($this->object->getComment()));
00610 $this->tpl->setVariable("VALUE_CLOZE_AUTHOR", ilUtil::prepareFormOutput($this->object->getAuthor()));
00611 $cloze_text = $this->object->getClozeText();
00612 $this->tpl->setVariable("VALUE_CLOZE_TEXT", ilUtil::prepareFormOutput($this->object->prepareTextareaOutput($cloze_text)));
00613 $this->tpl->setVariable("TEXT_CREATE_GAPS", $this->lng->txt("create_gaps"));
00614 $identical_scoring = $this->object->getIdenticalScoring();
00615 if ($identical_scoring) $this->tpl->setVariable("CHECKED_IDENTICAL_SCORING", " checked=\"checked\"");
00616 $this->tpl->setVariable("TEXT_IDENTICAL_SCORING", $this->lng->txt("identical_scoring"));
00617 $this->tpl->setVariable("TEXT_IDENTICAL_SCORING_DESCRIPTION", $this->lng->txt("identical_scoring_desc"));
00618 $this->tpl->setVariable("TEXT_TITLE", $this->lng->txt("title"));
00619 $this->tpl->setVariable("TEXT_AUTHOR", $this->lng->txt("author"));
00620 $this->tpl->setVariable("TEXT_COMMENT", $this->lng->txt("description"));
00621 $this->tpl->setVariable("TEXT_CLOZE_TEXT", $this->lng->txt("cloze_text"));
00622 $this->tpl->setVariable("TEXT_CLOSE_HINT", ilUtil::prepareFormOutput($this->lng->txt("close_text_hint")));
00623 $this->tpl->setVariable("TEXTGAP_RATING", $this->lng->txt("cloze_textgap_rating"));
00624 $this->tpl->setVariable("TEXT_GAP_DEFINITION", $this->lng->txt("gap_definition"));
00625 $this->tpl->setVariable("SAVE",$this->lng->txt("save"));
00626 $this->tpl->setVariable("SAVE_EDIT", $this->lng->txt("save_edit"));
00627 $this->tpl->setVariable("CANCEL",$this->lng->txt("cancel"));
00628 $this->ctrl->setParameter($this, "sel_question_types", $this->object->getQuestionType());
00629 $this->tpl->setVariable("TEXT_QUESTION_TYPE", $this->lng->txt($this->object->getQuestionType()));
00630 $this->tpl->setVariable("FORMACTION", $this->ctrl->getFormAction($this));
00631 $this->tpl->setVariable("TXT_REQUIRED_FLD", $this->lng->txt("required_field"));
00632 $this->tpl->parseCurrentBlock();
00633
00634 include_once "./Services/RTE/classes/class.ilRTE.php";
00635 $rtestring = ilRTE::_getRTEClassname();
00636 include_once "./Services/RTE/classes/class.$rtestring.php";
00637 $rte = new $rtestring();
00638 $rte->addPlugin("latex");
00639 $rte->addButton("latex"); $rte->addButton("pastelatex");
00640 include_once "./classes/class.ilObject.php";
00641 $obj_id = $_GET["q_id"];
00642 $obj_type = ilObject::_lookupType($_GET["ref_id"], TRUE);
00643 $rte->addRTESupport($obj_id, $obj_type, "assessment");
00644
00645 $this->tpl->setCurrentBlock("adm_content");
00646
00647 $this->tpl->parseCurrentBlock();
00648 }
00649
00662 function outQuestionForTest($formaction, $active_id, $pass = NULL, $is_postponed = FALSE, $use_post_solutions = FALSE)
00663 {
00664 $test_output = $this->getTestOutput($active_id, $pass, $is_postponed, $use_post_solutions);
00665 $this->tpl->setVariable("QUESTION_OUTPUT", $test_output);
00666 $this->tpl->setVariable("FORMACTION", $formaction);
00667 }
00668
00677 function getPreview($show_question_only = FALSE)
00678 {
00679
00680 include_once "./classes/class.ilTemplate.php";
00681 $template = new ilTemplate("tpl.il_as_qpl_cloze_question_output.html", TRUE, TRUE, "Modules/TestQuestionPool");
00682 $output = $this->object->getClozeText();
00683 foreach ($this->object->getGaps() as $gap_index => $gap)
00684 {
00685 switch ($gap->getType())
00686 {
00687 case CLOZE_TEXT:
00688 $gaptemplate = new ilTemplate("tpl.il_as_qpl_cloze_question_gap_text.html", TRUE, TRUE, "Modules/TestQuestionPool");
00689 $gaptemplate->setVariable("TEXT_GAP_SIZE", $this->object->getFixedTextLength() ? $this->object->getFixedTextLength() : $gap->getMaxWidth());
00690 $gaptemplate->setVariable("GAP_COUNTER", $gap_index);
00691 $output = preg_replace("/\[gap\].*?\[\/gap\]/", $gaptemplate->get(), $output, 1);
00692 break;
00693 case CLOZE_SELECT:
00694 $gaptemplate = new ilTemplate("tpl.il_as_qpl_cloze_question_gap_select.html", TRUE, TRUE, "Modules/TestQuestionPool");
00695 foreach ($gap->getItems() as $item)
00696 {
00697 $gaptemplate->setCurrentBlock("select_gap_option");
00698 $gaptemplate->setVariable("SELECT_GAP_VALUE", $item->getOrder());
00699 $gaptemplate->setVariable("SELECT_GAP_TEXT", ilUtil::prepareFormOutput($item->getAnswerText()));
00700 $gaptemplate->parseCurrentBlock();
00701 }
00702 $gaptemplate->setVariable("PLEASE_SELECT", $this->lng->txt("please_select"));
00703 $gaptemplate->setVariable("GAP_COUNTER", $gap_index);
00704 $output = preg_replace("/\[gap\].*?\[\/gap\]/", $gaptemplate->get(), $output, 1);
00705 break;
00706 case CLOZE_NUMERIC:
00707 $gaptemplate = new ilTemplate("tpl.il_as_qpl_cloze_question_gap_numeric.html", TRUE, TRUE, "Modules/TestQuestionPool");
00708 $gaptemplate->setVariable("TEXT_GAP_SIZE", $this->object->getFixedTextLength() ? $this->object->getFixedTextLength() : $gap->getMaxWidth());
00709 $gaptemplate->setVariable("GAP_COUNTER", $gap_index);
00710 $output = preg_replace("/\[gap\].*?\[\/gap\]/", $gaptemplate->get(), $output, 1);
00711 break;
00712 }
00713 }
00714 $template->setVariable("QUESTIONTEXT", $this->object->prepareTextareaOutput($output, TRUE));
00715 $questionoutput = $template->get();
00716 if (!$show_question_only)
00717 {
00718
00719 $pageoutput = $this->getILIASPage();
00720 $questionoutput = preg_replace("/(<div( xmlns:xhtml\=\"http:\/\/www.w3.org\/1999\/xhtml\"){0,1} class\=\"ilc_Question\"><\/div>)/ims", $questionoutput, $pageoutput);
00721 }
00722 else
00723 {
00724 $questionoutput = preg_replace("/<div[^>]*?>(.*)<\/div>/is", "\\1", $questionoutput);
00725 }
00726
00727 return $questionoutput;
00728 }
00729
00742 function getSolutionOutput($active_id, $pass = NULL, $graphicalOutput = FALSE, $result_output = FALSE, $show_question_only = TRUE, $show_feedback = FALSE)
00743 {
00744
00745 $user_solution = array();
00746 if ($active_id)
00747 {
00748
00749 $user_solution =& $this->object->getSolutionValues($active_id, $pass);
00750 if (!is_array($user_solution))
00751 {
00752 $user_solution = array();
00753 }
00754 }
00755
00756 include_once "./classes/class.ilTemplate.php";
00757 $template = new ilTemplate("tpl.il_as_qpl_cloze_question_output_solution.html", TRUE, TRUE, "Modules/TestQuestionPool");
00758 $output = $this->object->getClozeText();
00759 $ssc = $this->object->_getSuggestedSolutionCount($this->object->getId());
00760 foreach ($this->object->getGaps() as $gap_index => $gap)
00761 {
00762 $gaptemplate = new ilTemplate("tpl.il_as_qpl_cloze_question_output_solution_gap.html", TRUE, TRUE, "Modules/TestQuestionPool");
00763 $found = array();
00764 foreach ($user_solution as $solutionarray)
00765 {
00766 if ($solutionarray["value1"] == $gap_index) $found = $solutionarray;
00767 }
00768
00769 if ($active_id)
00770 {
00771 if ($graphicalOutput)
00772 {
00773
00774 $details = $this->object->calculateReachedPoints($active_id, $pass, TRUE);
00775 $check = $details[$gap_index];
00776 if ($check["best"])
00777 {
00778 $gaptemplate->setCurrentBlock("icon_ok");
00779 $gaptemplate->setVariable("ICON_OK", ilUtil::getImagePath("icon_ok.gif"));
00780 $gaptemplate->setVariable("TEXT_OK", $this->lng->txt("answer_is_right"));
00781 $gaptemplate->parseCurrentBlock();
00782 }
00783 else
00784 {
00785 $gaptemplate->setCurrentBlock("icon_not_ok");
00786 if ($check["positive"])
00787 {
00788 $gaptemplate->setVariable("ICON_NOT_OK", ilUtil::getImagePath("icon_mostly_ok.gif"));
00789 $gaptemplate->setVariable("TEXT_NOT_OK", $this->lng->txt("answer_is_not_correct_but_positive"));
00790 }
00791 else
00792 {
00793 $gaptemplate->setVariable("ICON_NOT_OK", ilUtil::getImagePath("icon_not_ok.gif"));
00794 $gaptemplate->setVariable("TEXT_NOT_OK", $this->lng->txt("answer_is_wrong"));
00795 }
00796 $gaptemplate->parseCurrentBlock();
00797 }
00798 }
00799 if ($ssc > 0)
00800 {
00801 $ss = $this->object->_getSuggestedSolution($this->object->getId(), $gap_index);
00802 if (count($ss))
00803 {
00804 $gaptemplate->setCurrentBlock("solution_hint");
00805 $gaptemplate->setVariable("TEXT_SOLUTION_HINT", $this->lng->txt("solution_hint"));
00806 $gaptemplate->setVariable("URL_SOLUTION_HINT", $this->object->_getInternalLinkHref($ss["internal_link"]));
00807 $gaptemplate->parseCurrentBlock();
00808 }
00809 }
00810 }
00811 if ($result_output)
00812 {
00813 $points = $this->object->getMaximumGapPoints($gap_index);
00814 $resulttext = ($points == 1) ? "(%s " . $this->lng->txt("point") . ")" : "(%s " . $this->lng->txt("points") . ")";
00815 $gaptemplate->setCurrentBlock("result_output");
00816 $gaptemplate->setVariable("RESULT_OUTPUT", sprintf($resulttext, $points));
00817 $gaptemplate->parseCurrentBlock();
00818 }
00819 switch ($gap->getType())
00820 {
00821 case CLOZE_TEXT:
00822 $solutiontext = "";
00823 if ($active_id > 0)
00824 {
00825 if ((count($found) == 0) || (strlen(trim($found["value2"])) == 0))
00826 {
00827 for ($chars = 0; $chars < $gap->getMaxWidth(); $chars++)
00828 {
00829 $solutiontext .= " ";
00830 }
00831 }
00832 else
00833 {
00834 $solutiontext = ilUtil::prepareFormOutput($found["value2"]);
00835 }
00836 }
00837 else
00838 {
00839 $solutiontext = ilUtil::prepareFormOutput($gap->getBestSolutionOutput());
00840 }
00841 $gaptemplate->setVariable("SOLUTION", $solutiontext);
00842 $output = preg_replace("/\[gap\].*?\[\/gap\]/", $gaptemplate->get(), $output, 1);
00843 break;
00844 case CLOZE_SELECT:
00845 $solutiontext = "";
00846 if ($active_id > 0)
00847 {
00848 if ((count($found) == 0) || (strlen(trim($found["value2"])) == 0))
00849 {
00850 for ($chars = 0; $chars < $gap->getMaxWidth(); $chars++)
00851 {
00852 $solutiontext .= " ";
00853 }
00854 }
00855 else
00856 {
00857 $item = $gap->getItem($found["value2"]);
00858 if (is_object($item))
00859 {
00860 $solutiontext = ilUtil::prepareFormOutput($item->getAnswertext());
00861 }
00862 else
00863 {
00864 for ($chars = 0; $chars < $gap->getMaxWidth(); $chars++)
00865 {
00866 $solutiontext .= " ";
00867 }
00868 }
00869 }
00870 }
00871 else
00872 {
00873 $solutiontext = ilUtil::prepareFormOutput($gap->getBestSolutionOutput());
00874 }
00875 $gaptemplate->setVariable("SOLUTION", $solutiontext);
00876 $output = preg_replace("/\[gap\].*?\[\/gap\]/", $gaptemplate->get(), $output, 1);
00877 break;
00878 case CLOZE_NUMERIC:
00879 $solutiontext = "";
00880 if ($active_id > 0)
00881 {
00882 if ((count($found) == 0) || (strlen(trim($found["value2"])) == 0))
00883 {
00884 for ($chars = 0; $chars < $gap->getMaxWidth(); $chars++)
00885 {
00886 $solutiontext .= " ";
00887 }
00888 }
00889 else
00890 {
00891 $solutiontext = ilUtil::prepareFormOutput($found["value2"]);
00892 }
00893 }
00894 else
00895 {
00896 $solutiontext = ilUtil::prepareFormOutput($gap->getBestSolutionOutput());
00897 }
00898 $gaptemplate->setVariable("SOLUTION", $solutiontext);
00899 $output = preg_replace("/\[gap\].*?\[\/gap\]/", $gaptemplate->get(), $output, 1);
00900 break;
00901 }
00902 }
00903 $template->setVariable("QUESTIONTEXT", $this->object->prepareTextareaOutput($output, TRUE));
00904
00905
00906 $solutiontemplate = new ilTemplate("tpl.il_as_tst_solution_output.html",TRUE, TRUE, "Modules/TestQuestionPool");
00907 $questionoutput = $template->get();
00908 $feedback = ($show_feedback) ? $this->getAnswerFeedbackOutput($active_id, $pass) : "";
00909 if (strlen($feedback)) $solutiontemplate->setVariable("FEEDBACK", $feedback);
00910 $solutiontemplate->setVariable("SOLUTION_OUTPUT", $questionoutput);
00911
00912 $solutionoutput = $solutiontemplate->get();
00913 if (!$show_question_only)
00914 {
00915
00916 $pageoutput = $this->getILIASPage();
00917 $solutionoutput = "<div class=\"ilias_content\">" . preg_replace("/(<div( xmlns:xhtml\=\"http:\/\/www.w3.org\/1999\/xhtml\"){0,1} class\=\"ilc_Question\"><\/div>)/ims", "</div><div class=\"ilc_Question\">" . $solutionoutput . "</div><div class=\"ilias_content\">", $pageoutput) . "</div>";
00918 }
00919 return $solutionoutput;
00920 }
00921
00922 function getTestOutput($active_id, $pass = NULL, $is_postponed = FALSE, $use_post_solutions = FALSE)
00923 {
00924
00925 $pageoutput = $this->outQuestionPage("", $is_postponed, $active_id);
00926
00927
00928 $user_solution = array();
00929 if ($active_id)
00930 {
00931 include_once "./Modules/Test/classes/class.ilObjTest.php";
00932 if (!ilObjTest::_getUsePreviousAnswers($active_id, true))
00933 {
00934 if (is_null($pass)) $pass = ilObjTest::_getPass($active_id);
00935 }
00936 $user_solution =& $this->object->getSolutionValues($active_id, $pass);
00937 if (!is_array($user_solution))
00938 {
00939 $user_solution = array();
00940 }
00941 }
00942
00943
00944 include_once "./classes/class.ilTemplate.php";
00945 $template = new ilTemplate("tpl.il_as_qpl_cloze_question_output.html", TRUE, TRUE, "Modules/TestQuestionPool");
00946 $output = $this->object->getClozeText();
00947 foreach ($this->object->getGaps() as $gap_index => $gap)
00948 {
00949 switch ($gap->getType())
00950 {
00951 case CLOZE_TEXT:
00952 $gaptemplate = new ilTemplate("tpl.il_as_qpl_cloze_question_gap_text.html", TRUE, TRUE, "Modules/TestQuestionPool");
00953 $gaptemplate->setVariable("TEXT_GAP_SIZE", $this->object->getFixedTextLength() ? $this->object->getFixedTextLength() : $gap->getMaxWidth());
00954 $gaptemplate->setVariable("GAP_COUNTER", $gap_index);
00955 foreach ($user_solution as $solution)
00956 {
00957 if (strcmp($solution["value1"], $gap_index) == 0)
00958 {
00959 $gaptemplate->setVariable("VALUE_GAP", " value=\"" . ilUtil::prepareFormOutput($solution["value2"]) . "\"");
00960 }
00961 }
00962 $output = preg_replace("/\[gap\].*?\[\/gap\]/", $gaptemplate->get(), $output, 1);
00963 break;
00964 case CLOZE_SELECT:
00965 $gaptemplate = new ilTemplate("tpl.il_as_qpl_cloze_question_gap_select.html", TRUE, TRUE, "Modules/TestQuestionPool");
00966 foreach ($gap->getItems() as $item)
00967 {
00968 $gaptemplate->setCurrentBlock("select_gap_option");
00969 $gaptemplate->setVariable("SELECT_GAP_VALUE", $item->getOrder());
00970 $gaptemplate->setVariable("SELECT_GAP_TEXT", ilUtil::prepareFormOutput($item->getAnswerText()));
00971 foreach ($user_solution as $solution)
00972 {
00973 if (strcmp($solution["value1"], $gap_index) == 0)
00974 {
00975 if (strcmp($solution["value2"], $item->getOrder()) == 0)
00976 {
00977 $gaptemplate->setVariable("SELECT_GAP_SELECTED", " selected=\"selected\"");
00978 }
00979 }
00980 }
00981 $gaptemplate->parseCurrentBlock();
00982 }
00983 $gaptemplate->setVariable("PLEASE_SELECT", $this->lng->txt("please_select"));
00984 $gaptemplate->setVariable("GAP_COUNTER", $gap_index);
00985 $output = preg_replace("/\[gap\].*?\[\/gap\]/", $gaptemplate->get(), $output, 1);
00986 break;
00987 case CLOZE_NUMERIC:
00988 $gaptemplate = new ilTemplate("tpl.il_as_qpl_cloze_question_gap_numeric.html", TRUE, TRUE, "Modules/TestQuestionPool");
00989 $gaptemplate->setVariable("TEXT_GAP_SIZE", $this->object->getFixedTextLength() ? $this->object->getFixedTextLength() : $gap->getMaxWidth());
00990 $gaptemplate->setVariable("GAP_COUNTER", $gap_index);
00991 foreach ($user_solution as $solution)
00992 {
00993 if (strcmp($solution["value1"], $gap_index) == 0)
00994 {
00995 $gaptemplate->setVariable("VALUE_GAP", " value=\"" . ilUtil::prepareFormOutput($solution["value2"]) . "\"");
00996 }
00997 }
00998 $output = preg_replace("/\[gap\].*?\[\/gap\]/", $gaptemplate->get(), $output, 1);
00999 break;
01000 }
01001 }
01002 $template->setVariable("QUESTIONTEXT", $this->object->prepareTextareaOutput($output, TRUE));
01003 $questionoutput = $template->get();
01004 $questionoutput = preg_replace("/(<div( xmlns:xhtml\=\"http:\/\/www.w3.org\/1999\/xhtml\"){0,1} class\=\"ilc_Question\"><\/div>)/ims", $questionoutput, $pageoutput);
01005 return $questionoutput;
01006 }
01007
01008 function addSuggestedSolution()
01009 {
01010 $addForGap = -1;
01011 if (array_key_exists("cmd", $_POST))
01012 {
01013 foreach ($_POST["cmd"] as $key => $value)
01014 {
01015 if (preg_match("/addSuggestedSolution_(\d+)/", $key, $matches))
01016 {
01017 $addForGap = $matches[1];
01018 }
01019 }
01020 }
01021 if ($addForGap > -1)
01022 {
01023 if ($this->writePostData())
01024 {
01025 ilUtil::sendInfo($this->getErrorMessage());
01026 $this->editQuestion();
01027 return;
01028 }
01029 if (!$this->checkInput())
01030 {
01031 ilUtil::sendInfo($this->lng->txt("fill_out_all_required_fields_add_answer"));
01032 $this->editQuestion();
01033 return;
01034 }
01035 $_POST["internalLinkType"] = $_POST["internalLinkType_$addForGap"];
01036 $_SESSION["subquestion_index"] = $addForGap;
01037 }
01038 $this->object->saveToDb();
01039 $this->ctrl->setParameter($this, "q_id", $this->object->getId());
01040 $this->tpl->setVariable("HEADER", $this->object->getTitle());
01041 $this->getQuestionTemplate();
01042 parent::addSuggestedSolution();
01043 }
01044
01045 function removeSuggestedSolution()
01046 {
01047 $removeFromGap = -1;
01048 foreach ($_POST["cmd"] as $key => $value)
01049 {
01050 if (preg_match("/removeSuggestedSolution_(\d+)/", $key, $matches))
01051 {
01052 $removeFromGap = $matches[1];
01053 }
01054 }
01055 if ($removeFromGap > -1)
01056 {
01057 unset($this->object->suggested_solutions[$removeFromGap]);
01058 }
01059 $this->object->saveToDb();
01060 $this->editQuestion();
01061 }
01062
01070 function saveFeedback()
01071 {
01072 include_once "./classes/class.ilObjAdvancedEditing.php";
01073 $this->object->saveFeedbackGeneric(0, ilUtil::stripSlashes($_POST["feedback_incomplete"], false, ilObjAdvancedEditing::_getUsedHTMLTagsAsString("assessment")));
01074 $this->object->saveFeedbackGeneric(1, ilUtil::stripSlashes($_POST["feedback_complete"], false, ilObjAdvancedEditing::_getUsedHTMLTagsAsString("assessment")));
01075 $this->object->cleanupMediaObjectUsage();
01076 parent::saveFeedback();
01077 }
01078
01086 function feedback()
01087 {
01088 $this->tpl->addBlockFile("ADM_CONTENT", "feedback", "tpl.il_as_qpl_cloze_question_feedback.html", "Modules/TestQuestionPool");
01089 $this->tpl->setVariable("FEEDBACK_TEXT", $this->lng->txt("feedback"));
01090 $this->tpl->setVariable("FEEDBACK_COMPLETE", $this->lng->txt("feedback_complete_solution"));
01091 $this->tpl->setVariable("VALUE_FEEDBACK_COMPLETE", ilUtil::prepareFormOutput($this->object->prepareTextareaOutput($this->object->getFeedbackGeneric(1)), FALSE));
01092 $this->tpl->setVariable("FEEDBACK_INCOMPLETE", $this->lng->txt("feedback_incomplete_solution"));
01093 $this->tpl->setVariable("VALUE_FEEDBACK_INCOMPLETE", ilUtil::prepareFormOutput($this->object->prepareTextareaOutput($this->object->getFeedbackGeneric(0)), FALSE));
01094 $this->tpl->setVariable("SAVE", $this->lng->txt("save"));
01095 $this->tpl->setVariable("FORMACTION", $this->ctrl->getFormAction($this));
01096
01097 include_once "./Services/RTE/classes/class.ilRTE.php";
01098 $rtestring = ilRTE::_getRTEClassname();
01099 include_once "./Services/RTE/classes/class.$rtestring.php";
01100 $rte = new $rtestring();
01101 $rte->addPlugin("latex");
01102 $rte->addButton("latex"); $rte->addButton("pastelatex");
01103 include_once "./classes/class.ilObject.php";
01104 $obj_id = $_GET["q_id"];
01105 $obj_type = ilObject::_lookupType($_GET["ref_id"], TRUE);
01106 $rte->addRTESupport($obj_id, $obj_type, "assessment");
01107 }
01108
01116 function setQuestionTabs()
01117 {
01118 global $rbacsystem, $ilTabs;
01119
01120 $this->ctrl->setParameterByClass("ilpageobjectgui", "q_id", $_GET["q_id"]);
01121 include_once "./Modules/TestQuestionPool/classes/class.assQuestion.php";
01122 $q_type = $this->object->getQuestionType();
01123
01124 if (strlen($q_type))
01125 {
01126 $classname = $q_type . "GUI";
01127 $this->ctrl->setParameterByClass(strtolower($classname), "sel_question_types", $q_type);
01128 $this->ctrl->setParameterByClass(strtolower($classname), "q_id", $_GET["q_id"]);
01129 }
01130
01131 if ($_GET["q_id"])
01132 {
01133 if ($rbacsystem->checkAccess('write', $_GET["ref_id"]))
01134 {
01135
01136 $ilTabs->addTarget("edit_content",
01137 $this->ctrl->getLinkTargetByClass("ilPageObjectGUI", "view"),
01138 array("view", "insert", "exec_pg"),
01139 "", "", $force_active);
01140 }
01141
01142
01143 $ilTabs->addTarget("preview",
01144 $this->ctrl->getLinkTargetByClass("ilPageObjectGUI", "preview"),
01145 array("preview"),
01146 "ilPageObjectGUI", "", $force_active);
01147 }
01148
01149 $force_active = false;
01150 $commands = $_POST["cmd"];
01151 if (is_array($commands))
01152 {
01153 foreach ($commands as $key => $value)
01154 {
01155 if (preg_match("/^delete_.*/", $key, $matches) ||
01156 preg_match("/^addSelectGapText_.*/", $key, $matches) ||
01157 preg_match("/^addGapText_.*/", $key, $matches) ||
01158 preg_match("/^upload_.*/", $key, $matches) ||
01159 preg_match("/^addSuggestedSolution_.*/", $key, $matches) ||
01160 preg_match("/^removeSuggestedSolution_.*/", $key, $matches)
01161 )
01162 {
01163 $force_active = true;
01164 }
01165 }
01166 }
01167 if ($rbacsystem->checkAccess('write', $_GET["ref_id"]))
01168 {
01169 $url = "";
01170 if ($classname) $url = $this->ctrl->getLinkTargetByClass($classname, "editQuestion");
01171
01172 $ilTabs->addTarget("edit_properties",
01173 $url,
01174 array("editQuestion", "save", "cancel", "addSuggestedSolution",
01175 "cancelExplorer", "linkChilds", "removeSuggestedSolution",
01176 "createGaps", "saveEdit", "changeGapType"),
01177 $classname, "", $force_active);
01178 }
01179
01180 if ($_GET["q_id"])
01181 {
01182 $ilTabs->addTarget("feedback",
01183 $this->ctrl->getLinkTargetByClass($classname, "feedback"),
01184 array("feedback", "saveFeedback"),
01185 $classname, "");
01186 }
01187
01188
01189 if ($_GET["q_id"])
01190 {
01191 $ilTabs->addTarget("statistics",
01192 $this->ctrl->getLinkTargetByClass($classname, "assessment"),
01193 array("assessment"),
01194 $classname, "");
01195 }
01196
01197 if (($_GET["calling_test"] > 0) || ($_GET["test_ref_id"] > 0))
01198 {
01199 $ref_id = $_GET["calling_test"];
01200 if (strlen($ref_id) == 0) $ref_id = $_GET["test_ref_id"];
01201 $ilTabs->setBackTarget($this->lng->txt("backtocallingtest"), "ilias.php?baseClass=ilObjTestGUI&cmd=questions&ref_id=$ref_id");
01202 }
01203 else
01204 {
01205 $ilTabs->setBackTarget($this->lng->txt("qpl"), $this->ctrl->getLinkTargetByClass("ilobjquestionpoolgui", "questions"));
01206 }
01207 }
01208 }
01209 ?>