Public Member Functions | Data Fields

ASS_QuestionGUI Class Reference

Basic GUI class for assessment questions. More...

Inheritance diagram for ASS_QuestionGUI:

Public Member Functions

 ASS_QuestionGUI ()
 ASS_QuestionGUI constructor.
executeCommand ()
 execute command
 getCommand ($cmd)
 getQuestionType ()
 Returns the question type string.
 getType ()
 needed for page editor compliance
 outOtherQuestionData ()
 Sets the extra fields i.e.
 writePostData ()
 Evaluates a posted edit form and writes the form data in the question object.
 outWorkingForm ($test_id="", $is_postponed=false)
 Creates the question output form for the learner.
 assessment ()
 output assessment
 writeOtherPostData ($result=0)
 Sets the other data i.e.
_getQuestionGUI ($question_type, $question_id=-1)
 Creates a question gui representation.
 _getGUIClassNameForId ($a_q_id)
 _getClassNameForQType ($q_type)
createQuestionGUI ($question_type, $question_id=-1)
 Creates a question gui representation.
 getQuestionTemplate ($q_type)
 get question template
 outQuestionPage ($a_temp_var, $a_postponed=false, $test_id="")
 output question page
 cancel ()
 cancel action
 originalSyncForm ()
 sync ()
 cancelSync ()
 saveEdit ()
 save question
 save ()
 save question
 apply ()
 apply changes
 cancelExplorer ()
 addSuggestedSolution ()
 removeSuggestedSolution ()
 addPG ()
 addST ()
 addGIT ()
 linkChilds ()

Data Fields

 $object
 $tpl
 $lng
 $error

Detailed Description

Basic GUI class for assessment questions.

The ASS_QuestionGUI class encapsulates basic GUI functions for assessment questions.

Author:
Helmut Schottmüller <hschottm@tzi.de>
Version:
Id:
class.assQuestionGUI.php 6453 2005-01-06 16:40:53Z hschottm

class.assQuestionGUI.php Assessment

Definition at line 37 of file class.assQuestionGUI.php.


Member Function Documentation

ASS_QuestionGUI::_getClassNameForQType ( q_type  ) 

Definition at line 292 of file class.assQuestionGUI.php.

Referenced by _getGUIClassNameForId().

        {
                switch ($q_type)
                {
                        case "qt_multiple_choice_sr":
                                return "ASS_MultipleChoiceGUI";
                                break;

                        case "qt_multiple_choice_mr":
                                return "ASS_MultipleChoiceGUI";
                                break;

                        case "qt_cloze":
                                return "ASS_ClozeTestGUI";
                                break;

                        case "qt_matching":
                                return "ASS_MatchingQuestionGUI";
                                break;

                        case "qt_ordering":
                                return "ASS_OrderingQuestionGUI";
                                break;

                        case "qt_imagemap":
                                return "ASS_ImagemapQuestionGUI";
                                break;

                        case "qt_javaapplet":
                                return "ASS_JavaAppletGUI";
                                break;

                        case "qt_text":
                                return "ASS_TextQuestionGUI";
                                break;
                }

        }

Here is the caller graph for this function:

ASS_QuestionGUI::_getGUIClassNameForId ( a_q_id  ) 

Definition at line 285 of file class.assQuestionGUI.php.

References $class_name, _getClassNameForQType(), and ASS_Question::getQuestionTypeFromDb().

Referenced by ilObjQuestionPoolGUI::questionsObject().

Here is the call graph for this function:

Here is the caller graph for this function:

& ASS_QuestionGUI::_getQuestionGUI ( question_type,
question_id = -1 
)

Creates a question gui representation.

Creates a question gui representation and returns the alias to the question gui note: please do not use $this inside this method to allow static calls

Parameters:
string $question_type The question type as it is used in the language database
integer $question_id The database ID of an existing question to load it into ASS_QuestionGUI
Returns:
object The alias to the question object public

Definition at line 235 of file class.assQuestionGUI.php.

References ASS_Question::getQuestionTypeFromDb().

Referenced by ilObjQuestionPoolGUI::createQuestionForTestObject(), createQuestionGUI(), ilObjQuestionPoolGUI::createQuestionObject(), ilPCQuestionGUI::edit(), ilObjQuestionPoolGUI::editQuestionForTestObject(), and ilObjQuestionPoolGUI::executeCommand().

        {
                if ((!$question_type) and ($question_id > 0))
                {
                        $question_type = ASS_Question::getQuestionTypeFromDb($question_id);
// echo ":".$question_type;
                }
                switch ($question_type)
                {
                        case "qt_multiple_choice_sr":
                                $question =& new ASS_MultipleChoiceGUI();
                                $question->object->set_response(RESPONSE_SINGLE);
                                break;

                        case "qt_multiple_choice_mr":
                                $question =& new ASS_MultipleChoiceGUI();
                                $question->object->set_response(RESPONSE_MULTIPLE);
                                break;

                        case "qt_cloze":
                                $question =& new ASS_ClozeTestGUI();
                                break;

                        case "qt_matching":
                                $question =& new ASS_MatchingQuestionGUI();
                                break;

                        case "qt_ordering":
                                $question =& new ASS_OrderingQuestionGUI();
                                break;

                        case "qt_imagemap":
                                $question =& new ASS_ImagemapQuestionGUI();
                                break;

                        case "qt_javaapplet":
                                $question =& new ASS_JavaAppletGUI();
                                break;
                        case "qt_text":
                                $question =& new ASS_TextQuestionGUI();
                                break;
                }
                if ($question_id > 0)
                {
                        $question->object->loadFromDb($question_id);
                }

                return $question;
        }

Here is the call graph for this function:

Here is the caller graph for this function:

ASS_QuestionGUI::addGIT (  ) 

Definition at line 668 of file class.assQuestionGUI.php.

References $_GET, $_SESSION, and sendInfo().

        {
                $subquestion_index = 0;
                if ($_SESSION["subquestion_index"] >= 0)
                {
                        $subquestion_index = $_SESSION["subquestion_index"];
                }
                $this->object->setSuggestedSolution("il__git_" . $_GET["git"], $subquestion_index);
                unset($_SESSION["subquestion_index"]);
                unset($_SESSION["link_new_type"]);
                unset($_SESSION["search_link_type"]);
                sendInfo($this->lng->txt("suggested_solution_added_successfully"));
                $this->editQuestion();
        }

Here is the call graph for this function:

ASS_QuestionGUI::addPG (  ) 

Definition at line 638 of file class.assQuestionGUI.php.

References $_GET, $_SESSION, and sendInfo().

        {
                $subquestion_index = 0;
                if ($_SESSION["subquestion_index"] >= 0)
                {
                        $subquestion_index = $_SESSION["subquestion_index"];
                }
                $this->object->setSuggestedSolution("il__pg_" . $_GET["pg"], $subquestion_index);
                unset($_SESSION["subquestion_index"]);
                unset($_SESSION["link_new_type"]);
                unset($_SESSION["search_link_type"]);
                sendInfo($this->lng->txt("suggested_solution_added_successfully"));
                $this->editQuestion();
        }

Here is the call graph for this function:

ASS_QuestionGUI::addST (  ) 

Definition at line 653 of file class.assQuestionGUI.php.

References $_GET, $_SESSION, and sendInfo().

        {
                $subquestion_index = 0;
                if ($_SESSION["subquestion_index"] >= 0)
                {
                        $subquestion_index = $_SESSION["subquestion_index"];
                }
                $this->object->setSuggestedSolution("il__st_" . $_GET["st"], $subquestion_index);
                unset($_SESSION["subquestion_index"]);
                unset($_SESSION["link_new_type"]);
                unset($_SESSION["search_link_type"]);
                sendInfo($this->lng->txt("suggested_solution_added_successfully"));
                $this->editQuestion();
        }

Here is the call graph for this function:

ASS_QuestionGUI::addSuggestedSolution (  ) 

Reimplemented in ASS_ClozeTestGUI, ASS_ImagemapQuestionGUI, ASS_JavaAppletGUI, ASS_MatchingQuestionGUI, ASS_MultipleChoiceGUI, ASS_OrderingQuestionGUI, and ASS_TextQuestionGUI.

Definition at line 579 of file class.assQuestionGUI.php.

References $_GET, $_POST, $_SESSION, $exp, $tree, and sendInfo().

        {
                global $tree;

                require_once("./assessment/classes/class.ilSolutionExplorer.php");
                switch ($_POST["internalLinkType"])
                {
                        case "lm":
                                $_SESSION["link_new_type"] = "lm";
                                $_SESSION["search_link_type"] = "lm";
                                break;
                        case "glo":
                                $_SESSION["link_new_type"] = "glo";
                                $_SESSION["search_link_type"] = "glo";
                                break;
                        case "st":
                                $_SESSION["link_new_type"] = "lm";
                                $_SESSION["search_link_type"] = "st";
                                break;
                        case "pg":
                                $_SESSION["link_new_type"] = "lm";
                                $_SESSION["search_link_type"] = "pg";
                                break;
                        default:
                                if (!$_SESSION["link_new_type"])
                                {
                                        $_SESSION["link_new_type"] = "lm";
                                }
                                break;
                }

                sendInfo($this->lng->txt("select_object_to_link"));
                
                $exp = new ilSolutionExplorer($this->ctrl->getLinkTarget($this,'addSuggestedSolution'), get_class($this));

                $exp->setExpand($_GET["expand"] ? $_GET["expand"] : $tree->readRootId());
                $exp->setExpandTarget($this->ctrl->getLinkTarget($this,'addSuggestedSolution'));
                $exp->setTargetGet("ref_id");
                $exp->setRefId($this->cur_ref_id);
                $exp->addFilter($_SESSION["link_new_type"]);
                $exp->setSelectableType($_SESSION["link_new_type"]);

                // build html-output
                $exp->setOutput(0);

                $this->tpl->addBlockFile("EXPLORER", "explorer", "tpl.il_as_qpl_explorer.html", true);
                $this->tpl->setVariable("EXPLORER_TREE",$exp->getOutput());
                $this->tpl->setVariable("BUTTON_CANCEL",$this->lng->txt("cancel"));
                $this->tpl->setVariable("FORMACTION",$this->ctrl->getFormAction($this));
                $this->tpl->parseCurrentBlock();
        }

Here is the call graph for this function:

ASS_QuestionGUI::apply (  ) 

apply changes

Definition at line 564 of file class.assQuestionGUI.php.

References $_GET, and writePostData().

        {
                $this->writePostData();
                $this->object->saveToDb();
                $_GET["q_id"] = $this->object->getId();
                $this->editQuestion();
        }

Here is the call graph for this function:

ASS_QuestionGUI::ASS_QuestionGUI (  ) 

ASS_QuestionGUI constructor.

ASS_QuestionGUI constructor

public

Definition at line 59 of file class.assQuestionGUI.php.

References $ilCtrl, $lng, and $tpl.

Referenced by ASS_ClozeTestGUI::ASS_ClozeTestGUI(), ASS_ImagemapQuestionGUI::ASS_ImagemapQuestionGUI(), ASS_JavaAppletGUI::ASS_JavaAppletGUI(), ASS_MatchingQuestionGUI::ASS_MatchingQuestionGUI(), ASS_MultipleChoiceGUI::ASS_MultipleChoiceGUI(), ASS_OrderingQuestionGUI::ASS_OrderingQuestionGUI(), ASS_TextQuestionGUI::ASS_TextQuestionGUI(), and ilExerciseGUI::previewQuestion().

        {
                global $lng, $tpl, $ilCtrl;


                $this->lng =& $lng;
                $this->tpl =& $tpl;
                $this->ctrl =& $ilCtrl;
                $this->ctrl->saveParameter($this, "q_id");

                $this->object = new ASS_Question();
        }

Here is the caller graph for this function:

ASS_QuestionGUI::assessment (  ) 

output assessment

Definition at line 155 of file class.assQuestionGUI.php.

References $_GET, $counter, and sendInfo().

        {
                $this->tpl->addBlockFile("CONTENT", "content", "tpl.il_as_qpl_content.html", true);
                $this->tpl->addBlockFile("STATUSLINE", "statusline", "tpl.statusline.html");

                // catch feedback message
                sendInfo();

                //$this->setLocator();

                $title = $this->lng->txt("qpl_assessment_of_questions");
                if (!empty($title))
                {
                        $this->tpl->setVariable("HEADER", $title);
                }
                //$question =& $this->object->createQuestion("", $_GET["edit"]);
                $total_of_answers = $this->object->getTotalAnswers();
                $counter = 0;
                $color_class = array("tblrow1", "tblrow2");
                $this->tpl->addBlockFile("ADM_CONTENT", "adm_content", "tpl.il_as_qpl_assessment_of_questions.html", true);
                if (!$total_of_answers)
                {
                        $this->tpl->setCurrentBlock("emptyrow");
                        $this->tpl->setVariable("TXT_NO_ASSESSMENT", $this->lng->txt("qpl_assessment_no_assessment_of_questions"));
                        $this->tpl->setVariable("COLOR_CLASS", $color_class[$counter % 2]);
                        $this->tpl->parseCurrentBlock();
                }
                else
                {
                        $this->tpl->setCurrentBlock("row");
                        $this->tpl->setVariable("TXT_RESULT", $this->lng->txt("qpl_assessment_total_of_answers"));
                        $this->tpl->setVariable("TXT_VALUE", $total_of_answers);
                        $this->tpl->setVariable("COLOR_CLASS", $color_class[$counter % 2]);
                        $counter++;
                        $this->tpl->parseCurrentBlock();
                        $this->tpl->setCurrentBlock("row");
                        $this->tpl->setVariable("TXT_RESULT", $this->lng->txt("qpl_assessment_total_of_right_answers"));
                        $this->tpl->setVariable("TXT_VALUE", sprintf("%2.2f", $this->object->_getTotalRightAnswers($_GET["q_id"]) * 100.0) . " %");
                        $this->tpl->setVariable("COLOR_CLASS", $color_class[$counter % 2]);
                        $this->tpl->parseCurrentBlock();
                }
                $this->tpl->setCurrentBlock("adm_content");
                $this->tpl->setVariable("TXT_QUESTION_TITLE", $this->object->getTitle());
                $this->tpl->setVariable("TXT_RESULT", $this->lng->txt("result"));
                $this->tpl->setVariable("TXT_VALUE", $this->lng->txt("value"));
                $this->tpl->parseCurrentBlock();
        }

Here is the call graph for this function:

ASS_QuestionGUI::cancel (  ) 

cancel action

Definition at line 397 of file class.assQuestionGUI.php.

References $_GET, and ilUtil::redirect().

        {
                if ($_GET["calling_test"])
                {
                        $_GET["ref_id"] = $_GET["calling_test"];
                        ilUtil::redirect("test.php?cmd=questions&ref_id=".$_GET["calling_test"]);
                }
                elseif ($_GET["test_ref_id"])
                {
                        $_GET["ref_id"] = $_GET["test_ref_id"];
                        ilUtil::redirect("test.php?cmd=questions&ref_id=".$_GET["test_ref_id"]);
                }
                else
                {
                        if ($_GET["q_id"] > 0)
                        {
                                $this->ctrl->setParameterByClass("ilpageobjectgui", "q_id", $_GET["q_id"]);
                                $this->ctrl->redirectByClass("ilpageobjectgui", "view");
                        }
                        else
                        {
                                $this->ctrl->redirectByClass("ilobjquestionpoolgui", "questions");
                        }
                }
        }

Here is the call graph for this function:

ASS_QuestionGUI::cancelExplorer (  ) 

Definition at line 572 of file class.assQuestionGUI.php.

References $_SESSION.

        {
                unset($_SESSION["subquestion_index"]);
                unset($_SESSION["link_new_type"]);
                $this->editQuestion();
        }

ASS_QuestionGUI::cancelSync (  ) 

Definition at line 445 of file class.assQuestionGUI.php.

References $_GET, and ilUtil::redirect().

        {
                $_GET["ref_id"] = $_GET["calling_test"];
                ilUtil::redirect("test.php?cmd=questions&ref_id=".$_GET["calling_test"]);
        }

Here is the call graph for this function:

& ASS_QuestionGUI::createQuestionGUI ( question_type,
question_id = -1 
)

Creates a question gui representation.

Creates a question gui representation and returns the alias to the question gui

Parameters:
string $question_type The question type as it is used in the language database
integer $question_id The database ID of an existing question to load it into ASS_QuestionGUI
Returns:
object The alias to the question object public

Definition at line 341 of file class.assQuestionGUI.php.

References _getQuestionGUI().

        {
                $this->question =& ASS_QuestionGUI::_getQuestionGUI($question_type, $question_id);
        }

Here is the call graph for this function:

& ASS_QuestionGUI::executeCommand (  ) 

execute command

Definition at line 75 of file class.assQuestionGUI.php.

References $cmd, and getCommand().

        {
                $cmd = $this->ctrl->getCmd("editQuestion");
                $next_class = $this->ctrl->getNextClass($this);

                $cmd = $this->getCommand($cmd);

                switch($next_class)
                {
                        default:
                                $ret =& $this->$cmd();
                                break;
                }
                return $ret;
        }

Here is the call graph for this function:

ASS_QuestionGUI::getCommand ( cmd  ) 

Reimplemented in ASS_ClozeTestGUI, ASS_ImagemapQuestionGUI, ASS_JavaAppletGUI, ASS_MatchingQuestionGUI, ASS_MultipleChoiceGUI, and ASS_OrderingQuestionGUI.

Definition at line 91 of file class.assQuestionGUI.php.

References $cmd.

Referenced by executeCommand().

        {
                return $cmd;
        }

Here is the caller graph for this function:

ASS_QuestionGUI::getQuestionTemplate ( q_type  ) 

get question template

Definition at line 349 of file class.assQuestionGUI.php.

Referenced by ASS_TextQuestionGUI::addSuggestedSolution(), ASS_OrderingQuestionGUI::addSuggestedSolution(), ASS_MultipleChoiceGUI::addSuggestedSolution(), ASS_MatchingQuestionGUI::addSuggestedSolution(), ASS_JavaAppletGUI::addSuggestedSolution(), ASS_ImagemapQuestionGUI::addSuggestedSolution(), ASS_ClozeTestGUI::addSuggestedSolution(), ASS_TextQuestionGUI::editQuestion(), ASS_OrderingQuestionGUI::editQuestion(), ASS_MultipleChoiceGUI::editQuestion(), ASS_MatchingQuestionGUI::editQuestion(), ASS_JavaAppletGUI::editQuestion(), ASS_ImagemapQuestionGUI::editQuestion(), ASS_ClozeTestGUI::editQuestion(), and linkChilds().

        {
                $this->tpl->addBlockFile("CONTENT", "content", "tpl.il_as_qpl_content.html", true);
                $this->tpl->addBlockFile("STATUSLINE", "statusline", "tpl.statusline.html");
                // set screen title (Edit/Create Question)
                if ($this->object->id > 0)
                {
                        $title = $this->lng->txt("edit") . " " . $this->lng->txt($q_type);
                }
                else
                {
                        $title = $this->lng->txt("create_new") . " " . $this->lng->txt($q_type);
                        $this->tpl->setVariable("HEADER", $title);
                }
                $this->tpl->addBlockFile("ADM_CONTENT", "adm_content", "tpl.il_as_question.html", true);
        }

Here is the caller graph for this function:

ASS_QuestionGUI::getQuestionType (  ) 

Returns the question type string.

Returns the question type string

Returns:
string The question type string public

Reimplemented in ASS_ClozeTestGUI, ASS_ImagemapQuestionGUI, ASS_JavaAppletGUI, ASS_MatchingQuestionGUI, ASS_MultipleChoiceGUI, ASS_OrderingQuestionGUI, and ASS_TextQuestionGUI.

Definition at line 105 of file class.assQuestionGUI.php.

Referenced by getType().

        {
                return "";
        }

Here is the caller graph for this function:

ASS_QuestionGUI::getType (  ) 

needed for page editor compliance

Definition at line 113 of file class.assQuestionGUI.php.

References getQuestionType().

        {
                return $this->getQuestionType();
        }

Here is the call graph for this function:

ASS_QuestionGUI::linkChilds (  ) 

Definition at line 683 of file class.assQuestionGUI.php.

References $_GET, $_SESSION, $counter, getQuestionTemplate(), and sendInfo().

        {
                switch ($_SESSION["search_link_type"])
                {
                        case "pg":
                        case "st":
                                $_GET["q_id"] = $this->object->getId();
                                $this->tpl->setVariable("HEADER", $this->object->getTitle());
                                $this->getQuestionTemplate($_GET["sel_question_types"]);
                                $color_class = array("tblrow1", "tblrow2");
                                $counter = 0;
                                require_once("./content/classes/class.ilObjContentObject.php");
                                $cont_obj =& new ilObjContentObject($_GET["source_id"], true);
                                // get all chapters
                                $ctree =& $cont_obj->getLMTree();
                                $nodes = $ctree->getSubtree($ctree->getNodeData($ctree->getRootId()));
                                $this->tpl->addBlockFile("LINK_SELECTION", "link_selection", "tpl.il_as_qpl_internallink_selection.html", true);
                                foreach($nodes as $node)
                                {
                                        if($node["type"] == $_SESSION["search_link_type"])
                                        {
                                                $this->tpl->setCurrentBlock("linktable_row");
                                                $this->tpl->setVariable("TEXT_LINK", $node["title"]);
                                                $this->tpl->setVariable("TEXT_ADD", $this->lng->txt("add"));
                                                $this->tpl->setVariable("LINK_HREF", $this->ctrl->getLinkTargetByClass(get_class($this), "add" . strtoupper($node["type"])) . "&" . $node["type"] . "=" . $node["obj_id"]);
                                                $this->tpl->setVariable("COLOR_CLASS", $color_class[$counter % 2]);
                                                $this->tpl->parseCurrentBlock();
                                                $counter++;
                                        }
                                }
                                $this->tpl->setCurrentBlock("link_selection");
                                $this->tpl->setVariable("BUTTON_CANCEL",$this->lng->txt("cancel"));
                                $this->tpl->setVariable("TEXT_LINK_TYPE", $this->lng->txt("obj_" . $_SESSION["search_link_type"]));
                                $this->tpl->setVariable("FORMACTION",$this->ctrl->getFormAction($this));
                                $this->tpl->parseCurrentBlock();
                                break;
                        case "glo":
                                $_GET["q_id"] = $this->object->getId();
                                $this->tpl->setVariable("HEADER", $this->object->getTitle());
                                $this->getQuestionTemplate($_GET["sel_question_types"]);
                                $color_class = array("tblrow1", "tblrow2");
                                $counter = 0;
                                $this->tpl->addBlockFile("LINK_SELECTION", "link_selection", "tpl.il_as_qpl_internallink_selection.html", true);
                                require_once "./content/classes/class.ilObjGlossary.php";
                                $glossary =& new ilObjGlossary($_GET["source_id"], true);
                                // get all glossary items
                                $terms = $glossary->getTermList();
                                foreach($terms as $term)
                                {
                                        $this->tpl->setCurrentBlock("linktable_row");
                                        $this->tpl->setVariable("TEXT_LINK", $term["term"]);
                                        $this->tpl->setVariable("TEXT_ADD", $this->lng->txt("add"));
                                        $this->tpl->setVariable("LINK_HREF", $this->ctrl->getLinkTargetByClass(get_class($this), "addGIT") . "&git=" . $term["id"]);
                                        $this->tpl->setVariable("COLOR_CLASS", $color_class[$counter % 2]);
                                        $this->tpl->parseCurrentBlock();
                                        $counter++;
                                }
                                $this->tpl->setCurrentBlock("link_selection");
                                $this->tpl->setVariable("BUTTON_CANCEL",$this->lng->txt("cancel"));
                                $this->tpl->setVariable("TEXT_LINK_TYPE", $this->lng->txt("glossary_term"));
                                $this->tpl->setVariable("FORMACTION",$this->ctrl->getFormAction($this));
                                $this->tpl->parseCurrentBlock();
                                break;
                        case "lm":
                                $subquestion_index = 0;
                                if ($_SESSION["subquestion_index"] >= 0)
                                {
                                        $subquestion_index = $_SESSION["subquestion_index"];
                                }
                                $this->object->setSuggestedSolution("il__lm_" . $_GET["source_id"], $subquestion_index);
                                unset($_SESSION["subquestion_index"]);
                                unset($_SESSION["link_new_type"]);
                                unset($_SESSION["search_link_type"]);
                                sendInfo($this->lng->txt("suggested_solution_added_successfully"));
                                $this->editQuestion();
                                break;
                }
        }

Here is the call graph for this function:

ASS_QuestionGUI::originalSyncForm (  ) 

Definition at line 423 of file class.assQuestionGUI.php.

Referenced by save(), and saveEdit().

        {
                $this->tpl->addBlockFile("ADM_CONTENT", "adm_content", "tpl.il_tst_sync_original.html", true);
                $this->tpl->setCurrentBlock("adm_content");
                $this->tpl->setVariable("BUTTON_YES", $this->lng->txt("yes"));
                $this->tpl->setVariable("BUTTON_NO", $this->lng->txt("no"));
                $this->tpl->setVariable("FORM_ACTION", $this->ctrl->getFormAction($this));
                $this->tpl->setVariable("TEXT_SYNC", $this->lng->txt("confirm_sync_questions"));
                $this->tpl->parseCurrentBlock();
        }

Here is the caller graph for this function:

ASS_QuestionGUI::outOtherQuestionData (  ) 

Sets the extra fields i.e.

estimated working time of a question from a posted create/edit form

Sets the extra fields i.e. estimated working time of a question from a posted create/edit form

private

Reimplemented in ASS_ClozeTestGUI, ASS_ImagemapQuestionGUI, ASS_JavaAppletGUI, ASS_MatchingQuestionGUI, ASS_MultipleChoiceGUI, ASS_OrderingQuestionGUI, and ASS_TextQuestionGUI.

Definition at line 125 of file class.assQuestionGUI.php.

        {
        }

ASS_QuestionGUI::outQuestionPage ( a_temp_var,
a_postponed = false,
test_id = "" 
)

output question page

Definition at line 369 of file class.assQuestionGUI.php.

References $_GET.

Referenced by ASS_TextQuestionGUI::outWorkingForm(), ASS_OrderingQuestionGUI::outWorkingForm(), ASS_MultipleChoiceGUI::outWorkingForm(), ASS_MatchingQuestionGUI::outWorkingForm(), ASS_JavaAppletGUI::outWorkingForm(), ASS_ImagemapQuestionGUI::outWorkingForm(), and ASS_ClozeTestGUI::outWorkingForm().

        {
                $postponed = "";
                if ($a_postponed)
                {
                        $postponed = " (" . $this->lng->txt("postponed") . ")";
                }

                include_once("content/classes/Pages/class.ilPageObjectGUI.php");
                $this->lng->loadLanguageModule("content");
                $page =& new ilPageObject("qpl", $this->object->getId());
                $page_gui =& new ilPageObjectGUI($page);
                $page_gui->setQuestionXML($this->object->to_xml(false, false, true, $test_id));
                $page_gui->setTemplateTargetVar($a_temp_var);
                $page_gui->setFileDownloadLink("test.php?cmd=downloadFile".
                        "&amp;ref_id=".$_GET["ref_id"]);
                $page_gui->setFullscreenLink("test.php?cmd=fullscreen".
                        "&amp;ref_id=".$_GET["ref_id"]);
                $page_gui->setSourcecodeDownloadScript("test.php?ref_id=".$_GET["ref_id"]);
                $page_gui->setOutputMode("presentation");
                //$page_gui->setHeader($this->object->getTitle());
                $page_gui->setPresentationTitle($this->object->getTitle().$postponed);
                return $page_gui->presentation();
        }

Here is the caller graph for this function:

ASS_QuestionGUI::outWorkingForm ( test_id = "",
is_postponed = false 
)

Creates the question output form for the learner.

Creates the question output form for the learner

public

Definition at line 148 of file class.assQuestionGUI.php.

        {
        }

ASS_QuestionGUI::removeSuggestedSolution (  ) 

Reimplemented in ASS_ClozeTestGUI.

Definition at line 631 of file class.assQuestionGUI.php.

        {
                $this->object->suggested_solutions = array();
                $this->object->saveToDb();
                $this->editQuestion();
        }

ASS_QuestionGUI::save (  ) 

save question

Definition at line 505 of file class.assQuestionGUI.php.

References $_GET, $_SESSION, $result, originalSyncForm(), ilUtil::redirect(), sendInfo(), and writePostData().

Referenced by ASS_ImagemapQuestionGUI::saveShape().

        {
                $old_id = $_GET["q_id"];
                $result = $this->writePostData();
                if ($result == 0)
                {
                        $this->object->saveToDb();
                        $originalexists = $this->object->_questionExists($this->object->original_id);
                        if ($_GET["calling_test"] && $originalexists)
                        {
                                $this->originalSyncForm();
                        }
                        elseif ($_GET["calling_test"] && !$originalexists)
                        {
                                $_GET["ref_id"] = $_GET["calling_test"];
                                ilUtil::redirect("test.php?cmd=questions&ref_id=".$_GET["calling_test"]);
                                return;
                        }
                        elseif ($_GET["test_ref_id"])
                        {
                                require_once ("assessment/classes/class.ilObjTest.php");
                                $_GET["ref_id"] = $_GET["test_ref_id"];
                                $test =& new ilObjTest($_GET["test_ref_id"], true);
                                $test->insertQuestion($this->object->getId());
                                ilUtil::redirect("test.php?cmd=questions&ref_id=".$_GET["test_ref_id"]);
                        }
                        else
                        {
                                $_GET["q_id"] = $this->object->getId();
                                if ($_GET["q_id"] !=  $old_id)
                                {
                                        // first save
                                        $this->ctrl->setParameterByClass($_GET["cmdClass"], "q_id", $this->object->getId());
                                        $this->ctrl->setParameterByClass($_GET["cmdClass"], "sel_question_types", $_GET["sel_question_types"]);
                                        $this->ctrl->redirectByClass($_GET["cmdClass"], "editQuestion");
                                }
                                $this->editQuestion();
                                if (strcmp($_SESSION["info"], "") != 0)
                                {
                                        sendInfo($_SESSION["info"] . "<br />" . $this->lng->txt("msg_obj_modified"), false);
                                }
                                else
                                {
                                        sendInfo($this->lng->txt("msg_obj_modified"), false);
                                }
        //                      $this->ctrl->setParameterByClass("ilpageobjectgui", "q_id", $this->object->getId());
        //                      $this->ctrl->redirectByClass("ilpageobjectgui", "view");
                        }
                }
                else
                {
      sendInfo($this->lng->txt("fill_out_all_required_fields"));
                        $this->editQuestion();
                }
        }

Here is the call graph for this function:

Here is the caller graph for this function:

ASS_QuestionGUI::saveEdit (  ) 

save question

Definition at line 454 of file class.assQuestionGUI.php.

References $_GET, $_SESSION, $result, originalSyncForm(), ilUtil::redirect(), sendInfo(), and writePostData().

        {
                $result = $this->writePostData();
                if ($result == 0)
                {
                        $this->object->saveToDb();
                        $originalexists = $this->object->_questionExists($this->object->original_id);
                        if ($_GET["calling_test"] && $originalexists)
                        {
                                $this->originalSyncForm();
                        }
                        elseif ($_GET["calling_test"] && !$originalexists)
                        {
                                $_GET["ref_id"] = $_GET["calling_test"];
                                ilUtil::redirect("test.php?cmd=questions&ref_id=".$_GET["calling_test"]);
                                return;
                        }
                        elseif ($_GET["test_ref_id"])
                        {
                                require_once ("assessment/classes/class.ilObjTest.php");
                                $_GET["ref_id"] = $_GET["test_ref_id"];
                                $test =& new ilObjTest($_GET["test_ref_id"], true);
                                $test->insertQuestion($this->object->getId());
                                ilUtil::redirect("test.php?cmd=questions&ref_id=".$_GET["test_ref_id"]);
                        }
                        else
                        {
                                $_GET["q_id"] = $this->object->getId();
                                $this->editQuestion();
                                if (strcmp($_SESSION["info"], "") != 0)
                                {
                                        sendInfo($_SESSION["info"] . "<br />" . $this->lng->txt("msg_obj_modified"), false);
                                }
                                else
                                {
                                        sendInfo($this->lng->txt("msg_obj_modified"), false);
                                }
                                $this->ctrl->setParameterByClass("ilpageobjectgui", "q_id", $this->object->getId());
                                $this->ctrl->redirectByClass("ilpageobjectgui", "view");
                        }
                }
                else
                {
      sendInfo($this->lng->txt("fill_out_all_required_fields"));
                        $this->editQuestion();
                }
        }

Here is the call graph for this function:

ASS_QuestionGUI::sync (  ) 

Definition at line 434 of file class.assQuestionGUI.php.

References $_GET, and ilUtil::redirect().

        {
                $original_id = $this->object->original_id;
                if ($original_id)
                {
                        $this->object->syncWithOriginal();
                }
                $_GET["ref_id"] = $_GET["calling_test"];
                ilUtil::redirect("test.php?cmd=questions&ref_id=".$_GET["calling_test"]);
        }

Here is the call graph for this function:

ASS_QuestionGUI::writeOtherPostData ( result = 0  ) 

Sets the other data i.e.

estimated working time of a question from a posted create/edit form

Sets the other data i.e. estimated working time of a question from a posted create/edit form

Returns:
boolean Returns true, if the question had to be autosaved private

Definition at line 212 of file class.assQuestionGUI.php.

References $_POST, and ilUtil::stripSlashes().

Referenced by ASS_TextQuestionGUI::writePostData(), ASS_OrderingQuestionGUI::writePostData(), ASS_MultipleChoiceGUI::writePostData(), ASS_MatchingQuestionGUI::writePostData(), ASS_JavaAppletGUI::writePostData(), ASS_ImagemapQuestionGUI::writePostData(), and ASS_ClozeTestGUI::writePostData().

        {
                $this->object->setEstimatedWorkingTime(
                        ilUtil::stripSlashes($_POST["Estimated"][h]),
                        ilUtil::stripSlashes($_POST["Estimated"][m]),
                        ilUtil::stripSlashes($_POST["Estimated"][s])
                );

                $saved = false;
                return $saved;
        }

Here is the call graph for this function:

Here is the caller graph for this function:

ASS_QuestionGUI::writePostData (  ) 

Evaluates a posted edit form and writes the form data in the question object.

Evaluates a posted edit form and writes the form data in the question object

Returns:
integer A positive value, if one of the required fields wasn't set, else 0 private

Reimplemented in ASS_ClozeTestGUI, ASS_ImagemapQuestionGUI, ASS_JavaAppletGUI, ASS_MatchingQuestionGUI, ASS_MultipleChoiceGUI, ASS_OrderingQuestionGUI, and ASS_TextQuestionGUI.

Definition at line 137 of file class.assQuestionGUI.php.

Referenced by apply(), save(), and saveEdit().

        {
        }

Here is the caller graph for this function:


Field Documentation

ASS_QuestionGUI::$error

Definition at line 50 of file class.assQuestionGUI.php.

ASS_QuestionGUI::$lng

Definition at line 49 of file class.assQuestionGUI.php.

Referenced by ASS_QuestionGUI().

ASS_QuestionGUI::$object

Definition at line 46 of file class.assQuestionGUI.php.

ASS_QuestionGUI::$tpl

Definition at line 48 of file class.assQuestionGUI.php.

Referenced by ASS_QuestionGUI().


The documentation for this class was generated from the following file: