• Main Page
  • Related Pages
  • Modules
  • Namespaces
  • Data Structures
  • Files
  • File List
  • Globals

Modules/TestQuestionPool/classes/class.assTextQuestionGUI.php

Go to the documentation of this file.
00001 <?php
00002  /*
00003    +----------------------------------------------------------------------------+
00004    | ILIAS open source                                                          |
00005    +----------------------------------------------------------------------------+
00006    | Copyright (c) 1998-2001 ILIAS open source, University of Cologne           |
00007    |                                                                            |
00008    | This program is free software; you can redistribute it and/or              |
00009    | modify it under the terms of the GNU General Public License                |
00010    | as published by the Free Software Foundation; either version 2             |
00011    | of the License, or (at your option) any later version.                     |
00012    |                                                                            |
00013    | This program is distributed in the hope that it will be useful,            |
00014    | but WITHOUT ANY WARRANTY; without even the implied warranty of             |
00015    | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the              |
00016    | GNU General Public License for more details.                               |
00017    |                                                                            |
00018    | You should have received a copy of the GNU General Public License          |
00019    | along with this program; if not, write to the Free Software                |
00020    | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
00021    +----------------------------------------------------------------------------+
00022 */
00023 
00024 include_once "./Modules/TestQuestionPool/classes/class.assQuestionGUI.php";
00025 include_once "./Modules/Test/classes/inc.AssessmentConstants.php";
00026 
00037 class assTextQuestionGUI extends assQuestionGUI
00038 {
00047         function assTextQuestionGUI(
00048                         $id = -1
00049         )
00050         {
00051                 $this->assQuestionGUI();
00052                 include_once "./Modules/TestQuestionPool/classes/class.assTextQuestion.php";
00053                 $this->object = new assTextQuestion();
00054                 if ($id >= 0)
00055                 {
00056                         $this->object->loadFromDb($id);
00057                 }
00058         }
00059 
00067         function editQuestion()
00068         {
00069                 $this->tpl->addJavascript("./Services/JavaScript/js/Basic.js");
00070                 $javascript = "<script type=\"text/javascript\">ilAddOnLoad(initialSelect);\n".
00071                         "function initialSelect() {\n%s\n}</script>";
00072                 // single response
00073                 $this->getQuestionTemplate();
00074                 $this->tpl->addBlockFile("QUESTION_DATA", "question_data", "tpl.il_as_qpl_text_question.html", "Modules/TestQuestionPool");
00075                 // call to other question data i.e. estimated working time block
00076                 $this->outOtherQuestionData();
00077 
00078                 $internallinks = array(
00079                         "lm" => $this->lng->txt("obj_lm"),
00080                         "st" => $this->lng->txt("obj_st"),
00081                         "pg" => $this->lng->txt("obj_pg"),
00082                         "glo" => $this->lng->txt("glossary_term")
00083                 );
00084                 foreach ($internallinks as $key => $value)
00085                 {
00086                         $this->tpl->setCurrentBlock("internallink");
00087                         $this->tpl->setVariable("TYPE_INTERNAL_LINK", $key);
00088                         $this->tpl->setVariable("TEXT_INTERNAL_LINK", $value);
00089                         $this->tpl->parseCurrentBlock();
00090                 }
00091 
00092                 // Add text rating options
00093                 $text_options = array(
00094                         array("ci", $this->lng->txt("cloze_textgap_case_insensitive")),
00095                         array("cs", $this->lng->txt("cloze_textgap_case_sensitive")),
00096                         array("l1", sprintf($this->lng->txt("cloze_textgap_levenshtein_of"), "1")),
00097                         array("l2", sprintf($this->lng->txt("cloze_textgap_levenshtein_of"), "2")),
00098                         array("l3", sprintf($this->lng->txt("cloze_textgap_levenshtein_of"), "3")),
00099                         array("l4", sprintf($this->lng->txt("cloze_textgap_levenshtein_of"), "4")),
00100                         array("l5", sprintf($this->lng->txt("cloze_textgap_levenshtein_of"), "5"))
00101                 );
00102                 $text_rating = $this->object->getTextRating();
00103                 foreach ($text_options as $text_option)
00104                 {
00105                         $this->tpl->setCurrentBlock("text_rating");
00106                         $this->tpl->setVariable("RATING_VALUE", $text_option[0]);
00107                         $this->tpl->setVariable("RATING_TEXT", $text_option[1]);
00108                         if (strcmp($text_rating, $text_option[0]) == 0)
00109                         {
00110                                 $this->tpl->setVariable("SELECTED_RATING_VALUE", " selected=\"selected\"");
00111                         }
00112                         $this->tpl->parseCurrentBlock();
00113                 }
00114 
00115                 $this->tpl->setCurrentBlock("HeadContent");
00116                 $this->tpl->setVariable("CONTENT_BLOCK", sprintf($javascript, "document.frm_text_question.title.focus();"));
00117                 $this->tpl->parseCurrentBlock();
00118                 $this->tpl->setCurrentBlock("question_data");
00119                 $this->tpl->setVariable("TEXT_QUESTION_ID", $this->object->getId());
00120                 $this->tpl->setVariable("VALUE_TEXT_QUESTION_TITLE", ilUtil::prepareFormOutput($this->object->getTitle()));
00121                 $this->tpl->setVariable("VALUE_TEXT_QUESTION_COMMENT", ilUtil::prepareFormOutput($this->object->getComment()));
00122                 $this->tpl->setVariable("VALUE_TEXT_QUESTION_AUTHOR", ilUtil::prepareFormOutput($this->object->getAuthor()));
00123                 $questiontext = $this->object->getQuestion();
00124                 $this->tpl->setVariable("VALUE_QUESTION", ilUtil::prepareFormOutput($this->object->prepareTextareaOutput($questiontext)));
00125                 $keywords = $this->object->getKeywords();
00126                 $this->tpl->setVariable("VALUE_KEYWORDS", ilUtil::prepareFormOutput($keywords));
00127                 $this->tpl->setVariable("VALUE_POINTS", ilUtil::prepareFormOutput($this->object->getPoints()));
00128                 if ($this->object->getMaxNumOfChars())
00129                 {
00130                         $this->tpl->setVariable("VALUE_MAXCHARS", ilUtil::prepareFormOutput($this->object->getMaxNumOfChars()));
00131                 }
00132                 $this->tpl->setVariable("TEXT_TITLE", $this->lng->txt("title"));
00133                 $this->tpl->setVariable("TEXT_AUTHOR", $this->lng->txt("author"));
00134                 $this->tpl->setVariable("TEXT_COMMENT", $this->lng->txt("description"));
00135                 $this->tpl->setVariable("TEXT_RATING", $this->lng->txt("text_rating"));
00136                 $this->tpl->setVariable("TEXT_QUESTION", $this->lng->txt("question"));
00137                 $this->tpl->setVariable("TEXT_MAXCHARS", $this->lng->txt("maxchars"));
00138                 $this->tpl->setVariable("TEXT_POINTS", $this->lng->txt("points"));
00139                 $this->tpl->setVariable("OPTIONAL_KEYWORDS", $this->lng->txt("optional_keywords"));
00140                 $this->tpl->setVariable("TEXT_KEYWORDS", $this->lng->txt("keywords"));
00141                 $this->tpl->setVariable("DESCRIPTION_MAXCHARS", $this->lng->txt("description_maxchars"));
00142                 $this->tpl->setVariable("TEXT_SOLUTION_HINT", $this->lng->txt("solution_hint"));
00143                 $this->tpl->setVariable("TEXT_KEYWORDS_HINT", $this->lng->txt("keywords_hint"));
00144                 if (count($this->object->suggested_solutions))
00145                 {
00146                         $solution_array = $this->object->getSuggestedSolution(0);
00147                         include_once "./Modules/TestQuestionPool/classes/class.assQuestion.php";
00148                         $href = assQuestion::_getInternalLinkHref($solution_array["internal_link"]);
00149                         $this->tpl->setVariable("TEXT_VALUE_SOLUTION_HINT", " <a href=\"$href\" target=\"content\">" . $this->lng->txt("solution_hint"). "</a> ");
00150                         $this->tpl->setVariable("BUTTON_REMOVE_SOLUTION", $this->lng->txt("remove"));
00151                         $this->tpl->setVariable("BUTTON_ADD_SOLUTION", $this->lng->txt("change"));
00152                         $this->tpl->setVariable("VALUE_SOLUTION_HINT", $solution_array["internal_link"]);
00153                 }
00154                 else
00155                 {
00156                         $this->tpl->setVariable("BUTTON_ADD_SOLUTION", $this->lng->txt("add"));
00157                 }
00158                 $this->tpl->setVariable("SAVE",$this->lng->txt("save"));
00159                 $this->tpl->setVariable("SAVE_EDIT", $this->lng->txt("save_edit"));
00160                 $this->tpl->setVariable("CANCEL",$this->lng->txt("cancel"));
00161                 $this->tpl->setVariable("TXT_REQUIRED_FLD", $this->lng->txt("required_field"));
00162                 $this->ctrl->setParameter($this, "sel_question_types", "assTextQuestion");
00163                 $this->tpl->setVariable("TEXT_QUESTION_TYPE", $this->lng->txt("assTextQuestion"));
00164                 $this->tpl->setVariable("ACTION_TEXT_QUESTION", $this->ctrl->getFormAction($this));
00165 
00166                 $this->tpl->parseCurrentBlock();
00167                 include_once "./Services/RTE/classes/class.ilRTE.php";
00168                 $rtestring = ilRTE::_getRTEClassname();
00169                 include_once "./Services/RTE/classes/class.$rtestring.php";
00170                 $rte = new $rtestring();
00171                 $rte->addPlugin("latex");
00172                 $rte->addButton("latex"); $rte->addButton("pastelatex");
00173                 include_once "./classes/class.ilObject.php";
00174                 $obj_id = $_GET["q_id"];
00175                 $obj_type = ilObject::_lookupType($_GET["ref_id"], TRUE);
00176                 $rte->addRTESupport($obj_id, $obj_type, "assessment");
00177 
00178                 $this->tpl->setCurrentBlock("adm_content");
00179                 //$this->tpl->setVariable("BODY_ATTRIBUTES", " onload=\"initialSelect();\""); 
00180                 $this->tpl->parseCurrentBlock();
00181         }
00182 
00186         function checkInput()
00187         {
00188                 $cmd = $this->ctrl->getCmd();
00189 
00190                 if ((!$_POST["title"]) or (!$_POST["author"]) or (!$_POST["question"]) or (strlen($_POST["points"]) == 0))
00191                 {
00192                         return false;
00193                 }
00194                 return true;
00195         }
00196 
00205         function writePostData()
00206         {
00207                 $result = 0;
00208                 if ((!$_POST["title"]) or (!$_POST["author"]) or (!$_POST["question"]) or (strlen($_POST["points"]) == 0))
00209                 {
00210                         $result = 1;
00211                 }
00212 
00213                 $this->object->setTitle(ilUtil::stripSlashes($_POST["title"]));
00214                 $this->object->setAuthor(ilUtil::stripSlashes($_POST["author"]));
00215                 $this->object->setComment(ilUtil::stripSlashes($_POST["comment"]));
00216                 include_once "./classes/class.ilObjAdvancedEditing.php";
00217                 $questiontext = ilUtil::stripSlashes($_POST["question"], false, ilObjAdvancedEditing::_getUsedHTMLTagsAsString("assessment"));
00218                 $this->object->setQuestion($questiontext);
00219                 $this->object->setPoints($_POST["points"]);
00220                 if ($_POST["points"] < 0)
00221                 {
00222                         $result = 1;
00223                         $this->setErrorMessage($this->lng->txt("negative_points_not_allowed"));
00224                 }
00225                 $this->object->setSuggestedSolution($_POST["solution_hint"], 0);
00226                 $this->object->setMaxNumOfChars($_POST["maxchars"]);
00227                 $this->object->setKeywords(ilUtil::stripSlashes($_POST["keywords"], false, ilObjAdvancedEditing::_getUsedHTMLTagsAsString("assessment")));
00228                 $this->object->setTextRating($_POST["text_rating"]);
00229 
00230                 $saved = $this->writeOtherPostData($result);
00231 
00232                 // Set the question id from a hidden form parameter
00233                 if ($_POST["text_question_id"] > 0)
00234                 {
00235                         $this->object->setId($_POST["text_question_id"]);
00236                 }
00237                 
00238                 return $result;
00239         }
00240 
00241         function outAdditionalOutput()
00242         {
00243                 if ($this->object->getMaxNumOfChars() > 0)
00244                 {
00245                         $this->tpl->addBlockFile("CONTENT_BLOCK", "charcounter", "tpl.charcounter.html", "Modules/TestQuestionPool");
00246                         $this->tpl->setCurrentBlock("charcounter");
00247                         $this->tpl->setVariable("MAXCHARS", $this->object->getMaxNumOfChars());
00248                         $this->tpl->parseCurrentBlock();
00249                 }
00250         }
00251 
00252         function outQuestionForTest($formaction, $active_id, $pass = NULL, $is_postponed = FALSE, $use_post_solutions = FALSE)
00253         {
00254                 $test_output = $this->getTestOutput($active_id, $pass, $is_postponed, $use_post_solutions); 
00255                 $this->tpl->setVariable("QUESTION_OUTPUT", $test_output);
00256                 $this->tpl->setVariable("FORMACTION", $formaction);
00257                 $this->outAdditionalOutput();
00258         }
00259 
00260         function getSolutionOutput($active_id, $pass = NULL, $graphicalOutput = FALSE, $result_output = FALSE, $show_question_only = TRUE, $show_feedback = FALSE)
00261         {
00262                 // get the solution of the user for the active pass or from the last pass if allowed
00263                 $user_solution = "";
00264                 if ($active_id)
00265                 {
00266                         $solutions =& $this->object->getSolutionValues($active_id, $pass);
00267                         foreach ($solutions as $idx => $solution_value)
00268                         {
00269                                 $user_solution = $solution_value["value1"];
00270                         }
00271                 }
00272                 else
00273                 {
00274                         $keywords = $this->object->getKeywordList();
00275                         if (count($keywords))
00276                         {
00277                                 $user_solution = $this->lng->txt("solution_may_contain_keywords") . ": " . join(",", $keywords);
00278                         }
00279                 }
00280                 
00281                 // generate the question output
00282                 include_once "./classes/class.ilTemplate.php";
00283                 $template = new ilTemplate("tpl.il_as_qpl_text_question_output_solution.html", TRUE, TRUE, "Modules/TestQuestionPool");
00284                 $solutiontemplate = new ilTemplate("tpl.il_as_tst_solution_output.html",TRUE, TRUE, "Modules/TestQuestionPool");
00285                 $template->setVariable("ESSAY", $this->object->prepareTextareaOutput($user_solution));
00286                 $questiontext = $this->object->getQuestion();
00287                 if ($active_id)
00288                 {
00289                         if ($graphicalOutput)
00290                         {
00291                                 // output of ok/not ok icons for user entered solutions
00292                                 $reached_points = $this->object->getReachedPoints($active_id, $pass);
00293                                 if ($reached_points == $this->object->getMaximumPoints())
00294                                 {
00295                                         $template->setCurrentBlock("icon_ok");
00296                                         $template->setVariable("ICON_OK", ilUtil::getImagePath("icon_ok.gif"));
00297                                         $template->setVariable("TEXT_OK", $this->lng->txt("answer_is_right"));
00298                                         $template->parseCurrentBlock();
00299                                 }
00300                                 else
00301                                 {
00302                                         $template->setCurrentBlock("icon_ok");
00303                                         if ($reached_points > 0)
00304                                         {
00305                                                 $template->setVariable("ICON_NOT_OK", ilUtil::getImagePath("icon_mostly_ok.gif"));
00306                                                 $template->setVariable("TEXT_NOT_OK", $this->lng->txt("answer_is_not_correct_but_positive"));
00307                                         }
00308                                         else
00309                                         {
00310                                                 $template->setVariable("ICON_NOT_OK", ilUtil::getImagePath("icon_not_ok.gif"));
00311                                                 $template->setVariable("TEXT_NOT_OK", $this->lng->txt("answer_is_wrong"));
00312                                         }
00313                                         $template->parseCurrentBlock();
00314                                 }
00315                         }
00316                 }
00317                 $template->setVariable("QUESTIONTEXT", $this->object->prepareTextareaOutput($questiontext, TRUE));
00318                 $questionoutput = $template->get();
00319                 $feedback = ($show_feedback) ? $this->getAnswerFeedbackOutput($active_id, $pass) : "";
00320                 if (strlen($feedback)) $solutiontemplate->setVariable("FEEDBACK", $feedback);
00321                 $solutiontemplate->setVariable("SOLUTION_OUTPUT", $questionoutput);
00322 
00323                 $solutionoutput = $solutiontemplate->get(); 
00324                 if (!$show_question_only)
00325                 {
00326                         // get page object output
00327                         $pageoutput = $this->getILIASPage();
00328                         $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>";
00329                 }
00330                 return $solutionoutput;
00331         }
00332         
00333         function getPreview($show_question_only = FALSE)
00334         {
00335                 // generate the question output
00336                 include_once "./classes/class.ilTemplate.php";
00337                 $template = new ilTemplate("tpl.il_as_qpl_text_question_output.html", TRUE, TRUE, "Modules/TestQuestionPool");
00338                 if ($this->object->getMaxNumOfChars())
00339                 {
00340                         $template->setCurrentBlock("maximum_char_hint");
00341                         $template->setVariable("MAXIMUM_CHAR_HINT", sprintf($this->lng->txt("text_maximum_chars_allowed"), $this->object->getMaxNumOfChars()));
00342                         $template->parseCurrentBlock();
00343                         $template->setCurrentBlock("has_maxchars");
00344                         $template->setVariable("MAXCHARS", $this->object->getMaxNumOfChars());
00345                         $template->parseCurrentBlock();
00346                         $template->setCurrentBlock("maxchars_counter");
00347                         $template->setVariable("MAXCHARS", $this->object->getMaxNumOfChars());
00348                         $template->setVariable("TEXTBOXSIZE", strlen($this->object->getMaxNumOfChars()));
00349                         $template->setVariable("CHARACTERS", $this->lng->txt("characters"));
00350                         $template->parseCurrentBlock();
00351                 }
00352                 $questiontext = $this->object->getQuestion();
00353                 $template->setVariable("QUESTIONTEXT", $this->object->prepareTextareaOutput($questiontext, TRUE));
00354                 $questionoutput = $template->get();
00355                 if (!$show_question_only)
00356                 {
00357                         // get page object output
00358                         $pageoutput = $this->getILIASPage();
00359                         $questionoutput = preg_replace("/(<div( xmlns:xhtml\=\"http:\/\/www.w3.org\/1999\/xhtml\"){0,1} class\=\"ilc_Question\"><\/div>)/ims", $questionoutput, $pageoutput);
00360                 }
00361                 else
00362                 {
00363                         $questionoutput = preg_replace("/<div[^>]*?>(.*)<\/div>/is", "\\1", $questionoutput);
00364                 }
00365 
00366                 return $questionoutput;
00367         }
00368 
00369         function getTestOutput($active_id, $pass = NULL, $is_postponed = FALSE, $use_post_solutions = FALSE)
00370         {
00371                 // get page object output
00372                 $pageoutput = $this->outQuestionPage("", $is_postponed, $active_id);
00373 
00374                 // get the solution of the user for the active pass or from the last pass if allowed
00375                 $user_solution = "";
00376                 if ($active_id)
00377                 {
00378                         $solutions = NULL;
00379                         include_once "./Modules/Test/classes/class.ilObjTest.php";
00380                         if (!ilObjTest::_getUsePreviousAnswers($active_id, true))
00381                         {
00382                                 if (is_null($pass)) $pass = ilObjTest::_getPass($active_id);
00383                         }
00384                         $solutions =& $this->object->getSolutionValues($active_id, $pass);
00385                         foreach ($solutions as $idx => $solution_value)
00386                         {
00387                                 $user_solution = $solution_value["value1"];
00388                         }
00389                 }
00390                 
00391                 // generate the question output
00392                 include_once "./classes/class.ilTemplate.php";
00393                 $template = new ilTemplate("tpl.il_as_qpl_text_question_output.html", TRUE, TRUE, "Modules/TestQuestionPool");
00394                 if ($this->object->getMaxNumOfChars())
00395                 {
00396                         $template->setCurrentBlock("maximum_char_hint");
00397                         $template->setVariable("MAXIMUM_CHAR_HINT", sprintf($this->lng->txt("text_maximum_chars_allowed"), $this->object->getMaxNumOfChars()));
00398                         $template->parseCurrentBlock();
00399                         $template->setCurrentBlock("has_maxchars");
00400                         $template->setVariable("MAXCHARS", $this->object->getMaxNumOfChars());
00401                         $template->parseCurrentBlock();
00402                         $template->setCurrentBlock("maxchars_counter");
00403                         $template->setVariable("MAXCHARS", $this->object->getMaxNumOfChars());
00404                         $template->setVariable("TEXTBOXSIZE", strlen($this->object->getMaxNumOfChars()));
00405                         $template->setVariable("CHARACTERS", $this->lng->txt("characters"));
00406                         $template->parseCurrentBlock();
00407                 }
00408                 $template->setVariable("ESSAY", ilUtil::prepareFormOutput($user_solution));
00409                 $questiontext = $this->object->getQuestion();
00410                 $template->setVariable("QUESTIONTEXT", $this->object->prepareTextareaOutput($questiontext, TRUE));
00411                 $questionoutput = $template->get();
00412                 $questionoutput = preg_replace("/(<div( xmlns:xhtml\=\"http:\/\/www.w3.org\/1999\/xhtml\"){0,1} class\=\"ilc_Question\"><\/div>)/ims", $questionoutput, $pageoutput);
00413                 return $questionoutput;
00414         }
00415 
00416         function addSuggestedSolution()
00417         {
00418                 $_SESSION["subquestion_index"] = 0;
00419                 if ($_POST["cmd"]["addSuggestedSolution"])
00420                 {
00421                         if ($this->writePostData())
00422                         {
00423                                 ilUtil::sendInfo($this->getErrorMessage());
00424                                 $this->editQuestion();
00425                                 return;
00426                         }
00427                         if (!$this->checkInput())
00428                         {
00429                                 ilUtil::sendInfo($this->lng->txt("fill_out_all_required_fields_add_answer"));
00430                                 $this->editQuestion();
00431                                 return;
00432                         }
00433                 }
00434                 $this->object->saveToDb();
00435                 $this->ctrl->setParameter($this, "q_id", $this->object->getId());
00436                 $this->tpl->setVariable("HEADER", $this->object->getTitle());
00437                 $this->getQuestionTemplate();
00438                 parent::addSuggestedSolution();
00439         }
00440 
00448         function saveFeedback()
00449         {
00450                 include_once "./classes/class.ilObjAdvancedEditing.php";
00451                 $this->object->saveFeedbackGeneric(0, ilUtil::stripSlashes($_POST["feedback_incomplete"], false, ilObjAdvancedEditing::_getUsedHTMLTagsAsString("assessment")));
00452                 $this->object->saveFeedbackGeneric(1, ilUtil::stripSlashes($_POST["feedback_complete"], false, ilObjAdvancedEditing::_getUsedHTMLTagsAsString("assessment")));
00453                 $this->object->cleanupMediaObjectUsage();
00454                 parent::saveFeedback();
00455         }
00456 
00464         function feedback()
00465         {
00466                 $this->tpl->addBlockFile("ADM_CONTENT", "feedback", "tpl.il_as_qpl_text_question_feedback.html", "Modules/TestQuestionPool");
00467                 $this->tpl->setVariable("FEEDBACK_TEXT", $this->lng->txt("feedback"));
00468                 $this->tpl->setVariable("FEEDBACK_COMPLETE", $this->lng->txt("feedback_complete_solution"));
00469                 $this->tpl->setVariable("VALUE_FEEDBACK_COMPLETE", ilUtil::prepareFormOutput($this->object->prepareTextareaOutput($this->object->getFeedbackGeneric(1)), FALSE));
00470                 $this->tpl->setVariable("FEEDBACK_INCOMPLETE", $this->lng->txt("feedback_incomplete_solution"));
00471                 $this->tpl->setVariable("VALUE_FEEDBACK_INCOMPLETE", ilUtil::prepareFormOutput($this->object->prepareTextareaOutput($this->object->getFeedbackGeneric(0)), FALSE));
00472                 $this->tpl->setVariable("SAVE", $this->lng->txt("save"));
00473                 $this->tpl->setVariable("FORMACTION", $this->ctrl->getFormAction($this));
00474 
00475                 include_once "./Services/RTE/classes/class.ilRTE.php";
00476                 $rtestring = ilRTE::_getRTEClassname();
00477                 include_once "./Services/RTE/classes/class.$rtestring.php";
00478                 $rte = new $rtestring();
00479                 $rte->addPlugin("latex");
00480                 $rte->addButton("latex"); $rte->addButton("pastelatex");
00481                 include_once "./classes/class.ilObject.php";
00482                 $obj_id = $_GET["q_id"];
00483                 $obj_type = ilObject::_lookupType($_GET["ref_id"], TRUE);
00484                 $rte->addRTESupport($obj_id, $obj_type, "assessment");
00485         }
00486 
00494         function setQuestionTabs()
00495         {
00496                 global $rbacsystem, $ilTabs;
00497                 
00498                 $this->ctrl->setParameterByClass("ilpageobjectgui", "q_id", $_GET["q_id"]);
00499                 include_once "./Modules/TestQuestionPool/classes/class.assQuestion.php";
00500                 $q_type = $this->object->getQuestionType();
00501 
00502                 if (strlen($q_type))
00503                 {
00504                         $classname = $q_type . "GUI";
00505                         $this->ctrl->setParameterByClass(strtolower($classname), "sel_question_types", $q_type);
00506                         $this->ctrl->setParameterByClass(strtolower($classname), "q_id", $_GET["q_id"]);
00507                 }
00508 
00509                 if ($_GET["q_id"])
00510                 {
00511                         if ($rbacsystem->checkAccess('write', $_GET["ref_id"]))
00512                         {
00513                                 // edit page
00514                                 $ilTabs->addTarget("edit_content",
00515                                         $this->ctrl->getLinkTargetByClass("ilPageObjectGUI", "view"),
00516                                         array("view", "insert", "exec_pg"),
00517                                         "", "", $force_active);
00518                         }
00519         
00520                         // edit page
00521                         $ilTabs->addTarget("preview",
00522                                 $this->ctrl->getLinkTargetByClass("ilPageObjectGUI", "preview"),
00523                                 array("preview"),
00524                                 "ilPageObjectGUI", "", $force_active);
00525                 }
00526 
00527                 $force_active = false;
00528                 if ($rbacsystem->checkAccess('write', $_GET["ref_id"]))
00529                 {
00530                         $url = "";
00531                         if ($classname) $url = $this->ctrl->getLinkTargetByClass($classname, "editQuestion");
00532                         // edit question properties
00533                         $ilTabs->addTarget("edit_properties",
00534                                 $url,
00535                                 array("editQuestion", "save", "cancel", "addSuggestedSolution",
00536                                         "cancelExplorer", "linkChilds", "removeSuggestedSolution",
00537                                         "saveEdit"),
00538                                 $classname, "", $force_active);
00539                 }
00540 
00541                 if ($_GET["q_id"])
00542                 {
00543                         $ilTabs->addTarget("feedback",
00544                                 $this->ctrl->getLinkTargetByClass($classname, "feedback"),
00545                                 array("feedback", "saveFeedback"),
00546                                 $classname, "");
00547                 }
00548                 
00549                 // Assessment of questions sub menu entry
00550                 if ($_GET["q_id"])
00551                 {
00552                         $ilTabs->addTarget("statistics",
00553                                 $this->ctrl->getLinkTargetByClass($classname, "assessment"),
00554                                 array("assessment"),
00555                                 $classname, "");
00556                 }
00557                 
00558                 if (($_GET["calling_test"] > 0) || ($_GET["test_ref_id"] > 0))
00559                 {
00560                         $ref_id = $_GET["calling_test"];
00561                         if (strlen($ref_id) == 0) $ref_id = $_GET["test_ref_id"];
00562                         $ilTabs->setBackTarget($this->lng->txt("backtocallingtest"), "ilias.php?baseClass=ilObjTestGUI&cmd=questions&ref_id=$ref_id");
00563                 }
00564                 else
00565                 {
00566                         $ilTabs->setBackTarget($this->lng->txt("qpl"), $this->ctrl->getLinkTargetByClass("ilobjquestionpoolgui", "questions"));
00567                 }
00568         }
00569 }
00570 ?>

Generated on Fri Dec 13 2013 17:56:54 for ILIAS Release_3_9_x_branch .rev 46835 by  doxygen 1.7.1