Public Member Functions | Data Fields

SurveyQuestionGUI Class Reference

Basic class for all survey question types. More...

Inheritance diagram for SurveyQuestionGUI:

Public Member Functions

 SurveyQuestionGUI ()
 SurveyQuestion constructor.
executeCommand ()
 execute command
 getCommand ($cmd)
_getQuestionGUI ($questiontype, $question_id=-1)
 Creates a question gui representation.
 _getGUIClassNameForId ($a_q_id)
 _getClassNameForQType ($q_type)
 originalSyncForm ()
 sync ()
 cancelSync ()
 saveCategories ()
 Saves the categories.
 save ()
 save question
 cancel ()
 cancelDeleteCategory ()
 Cancels the form adding a phrase.
 addMaterial ()
 removeMaterial ()
 cancelExplorer ()
 addPG ()
 addST ()
 addGIT ()
 linkChilds ()
 setQuestionTabsForClass ($guiclass)
 addCategory ()
 Adds a category to the question.
 writeCategoryData ($save=false)
 Recreates the categories from the POST data.
 deleteCategory ()
 Removes one or more categories.
 moveCategory ()
 Selects one or more categories for moving.
 insertBeforeCategory ()
 Inserts categories which are selected for moving before the selected category.
 insertAfterCategory ()
 Inserts categories which are selected for moving before the selected category.

Data Fields

 $object
 $tpl
 $lng
 $errormessage

Detailed Description

Basic class for all survey question types.

The SurveyQuestionGUI class defines and encapsulates basic methods and attributes for survey question types to be used for all parent classes.

Author:
Helmut Schottmüller <helmut.schottmueller@mac.com>
Version:
Id:
class.SurveyQuestionGUI.php 10888 2006-05-18 06:00:38Z hschottm

class.SurveyQuestionGUI.php survey

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


Member Function Documentation

SurveyQuestionGUI::_getClassNameForQType ( q_type  ) 

Definition at line 149 of file class.SurveyQuestionGUI.php.

Referenced by _getGUIClassNameForId().

        {
                switch ($q_type)
                {
                        case "qt_nominal":
                                return "SurveyNominalQuestionGUI";
                                break;

                        case "qt_ordinal":
                                return "SurveyOrdinalQuestionGUI";
                                break;

                        case "qt_metric":
                                return "SurveyMetricQuestionGUI";
                                break;

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

Here is the caller graph for this function:

SurveyQuestionGUI::_getGUIClassNameForId ( a_q_id  ) 

Definition at line 140 of file class.SurveyQuestionGUI.php.

References $class_name, and _getClassNameForQType().

Referenced by ilObjSurveyQuestionPoolGUI::questionsObject().

        {
                include_once "./survey/classes/class.SurveyQuestion.php";
                include_once "./survey/classes/class.SurveyQuestionGUI.php";
                $q_type = SurveyQuestion::_getQuestiontype($a_q_id);
                $class_name = SurveyQuestionGUI::_getClassNameForQType($q_type);
                return $class_name;
        }

Here is the call graph for this function:

Here is the caller graph for this function:

& SurveyQuestionGUI::_getQuestionGUI ( questiontype,
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 106 of file class.SurveyQuestionGUI.php.

Referenced by ilObjSurveyQuestionPoolGUI::addLocatorItems(), ilObjSurveyQuestionPoolGUI::createQuestionForSurveyObject(), ilObjSurveyQuestionPoolGUI::createQuestionObject(), ilObjSurveyQuestionPoolGUI::editQuestionForSurveyObject(), ilObjSurveyQuestionPoolGUI::executeCommand(), and ilObjSurveyQuestionPoolGUI::previewObject().

        {
                if (!$questiontype)
                {
                        include_once "./survey/classes/class.SurveyQuestion.php";
                        $questiontype = SurveyQuestion::_getQuestiontype($question_id);
                }
                switch ($questiontype)
                {
                        case "qt_nominal":
                                include_once "./survey/classes/class.SurveyNominalQuestionGUI.php";
                                $question = new SurveyNominalQuestionGUI();
                                break;
                        case "qt_ordinal":
                                include_once "./survey/classes/class.SurveyOrdinalQuestionGUI.php";
                                $question = new SurveyOrdinalQuestionGUI();
                                break;
                        case "qt_metric":
                                include_once "./survey/classes/class.SurveyMetricQuestionGUI.php";
                                $question = new SurveyMetricQuestionGUI();
                                break;
                        case "qt_text":
                                include_once "./survey/classes/class.SurveyTextQuestionGUI.php";
                                $question = new SurveyTextQuestionGUI();
                                break;
                }
                if ($question_id > 0)
                {
                        $question->object->loadFromDb($question_id);
                }

                return $question;
        }

Here is the caller graph for this function:

SurveyQuestionGUI::addCategory (  ) 

Adds a category to the question.

Adds a category to the question

private

Definition at line 585 of file class.SurveyQuestionGUI.php.

References $_SESSION, $result, sendInfo(), and writeCategoryData().

        {
                $result = $this->writeCategoryData();
                if ($result == false)
                {
                        sendInfo($this->lng->txt("fill_out_all_category_fields"));
                }
                $_SESSION["spl_modified"] = true;
                $this->categories($result);
        }

Here is the call graph for this function:

SurveyQuestionGUI::addGIT (  ) 

Definition at line 401 of file class.SurveyQuestionGUI.php.

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

        {
                $this->object->setMaterial("il__git_" . $_GET["git"]);
                unset($_SESSION["link_new_type"]);
                unset($_SESSION["search_link_type"]);
                sendInfo($this->lng->txt("material_added_successfully"));
                $this->editQuestion();
        }

Here is the call graph for this function:

SurveyQuestionGUI::addMaterial (  ) 

Definition at line 318 of file class.SurveyQuestionGUI.php.

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

        {
                global $tree;

                include_once("./survey/classes/class.ilMaterialExplorer.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 ilMaterialExplorer($this->ctrl->getLinkTarget($this,'addMaterial'), get_class($this));

                $exp->setExpand($_GET["expand"] ? $_GET["expand"] : $tree->readRootId());
                $exp->setExpandTarget($this->ctrl->getLinkTarget($this,'addMaterial'));
                $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("ADM_CONTENT", "explorer", "tpl.il_svy_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:

SurveyQuestionGUI::addPG (  ) 

Definition at line 383 of file class.SurveyQuestionGUI.php.

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

        {
                $this->object->setMaterial("il__pg_" . $_GET["pg"]);
                unset($_SESSION["link_new_type"]);
                unset($_SESSION["search_link_type"]);
                sendInfo($this->lng->txt("material_added_successfully"));
                $this->editQuestion();
        }

Here is the call graph for this function:

SurveyQuestionGUI::addST (  ) 

Definition at line 392 of file class.SurveyQuestionGUI.php.

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

        {
                $this->object->setMaterial("il__st_" . $_GET["st"]);
                unset($_SESSION["link_new_type"]);
                unset($_SESSION["search_link_type"]);
                sendInfo($this->lng->txt("material_added_successfully"));
                $this->editQuestion();
        }

Here is the call graph for this function:

SurveyQuestionGUI::cancel (  ) 

Definition at line 286 of file class.SurveyQuestionGUI.php.

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

        {
                if ($_GET["calling_survey"])
                {
                        $_GET["ref_id"] = $_GET["calling_survey"];
                        include_once "./classes/class.ilUtil.php";
                        ilUtil::redirect("ilias.php?baseClass=ilObjSurveyGUI&cmd=questions&ref_id=".$_GET["calling_survey"]);
                }
                elseif ($_GET["new_for_survey"])
                {
                        $_GET["ref_id"] = $_GET["new_for_survey"];
                        include_once "./classes/class.ilUtil.php";
                        ilUtil::redirect("ilias.php?baseClass=ilObjSurveyGUI&cmd=questions&ref_id=".$_GET["new_for_survey"]);
                }
                else
                {
                        $this->ctrl->redirectByClass("ilobjsurveyquestionpoolgui", "questions");
                }
        }

Here is the call graph for this function:

SurveyQuestionGUI::cancelDeleteCategory (  ) 

Cancels the form adding a phrase.

Cancels the form adding a phrase

public

Definition at line 313 of file class.SurveyQuestionGUI.php.

        {
                $this->ctrl->redirect($this, "editQuestion");
        }

SurveyQuestionGUI::cancelExplorer (  ) 

Definition at line 377 of file class.SurveyQuestionGUI.php.

References $_SESSION.

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

SurveyQuestionGUI::cancelSync (  ) 

Definition at line 196 of file class.SurveyQuestionGUI.php.

        {
                $this->ctrl->redirect($this, "editQuestion");
                /*$_GET["ref_id"] = $_GET["calling_survey"];
                include_once "./classes/class.ilUtil.php";
                ilUtil::redirect("ilias.php?baseClass=ilObjSurveyGUI&ref_id=" . $_GET["calling_survey"] . "&cmd=questions");*/
        }

SurveyQuestionGUI::deleteCategory (  ) 

Removes one or more categories.

Removes one or more categories

private

Definition at line 637 of file class.SurveyQuestionGUI.php.

References $_POST, $_SESSION, sendInfo(), and writeCategoryData().

        {
                $this->writeCategoryData();
                $nothing_selected = true;
                if (array_key_exists("chb_category", $_POST))
                {
                        if (count($_POST["chb_category"]))
                        {
                                $nothing_selected = false;
                                $this->object->categories->removeCategories($_POST["chb_category"]);
                        }
                }
                if ($nothing_selected) sendInfo($this->lng->txt("category_delete_select_none"));
                $_SESSION["spl_modified"] = true;
                $this->categories();
        }

Here is the call graph for this function:

& SurveyQuestionGUI::executeCommand (  ) 

execute command

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

References $cmd, and getCommand().

        {
                $cmd = $this->ctrl->getCmd();
                $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:

SurveyQuestionGUI::getCommand ( cmd  ) 

Definition at line 90 of file class.SurveyQuestionGUI.php.

References $cmd.

Referenced by executeCommand().

        {
                return $cmd;
        }

Here is the caller graph for this function:

SurveyQuestionGUI::insertAfterCategory (  ) 

Inserts categories which are selected for moving before the selected category.

Inserts categories which are selected for moving before the selected category

private

Definition at line 716 of file class.SurveyQuestionGUI.php.

References $_POST, $_SESSION, $result, and writeCategoryData().

        {
                $result = $this->writeCategoryData();
                if (array_key_exists("chb_category", $_POST))
                {
                        if (count($_POST["chb_category"]) == 1)
                        {
                                // one entry is selected, moving is allowed
                                $this->object->categories->removeCategories($_SESSION["spl_move"]);
                                $newinsertindex = $this->object->categories->getCategoryIndex($_POST["category_".$_POST["chb_category"][0]]);
                                if ($newinsertindex === false) $newinsertindex = 0;
                                $move_categories = $_SESSION["spl_move"];
                                natsort($move_categories);
                                foreach (array_reverse($move_categories) as $index)
                                {
                                        $this->object->categories->addCategoryAtPosition($_POST["category_$index"], $newinsertindex+1);
                                }
                        }
                }
                $_SESSION["spl_modified"] = true;
                unset($_SESSION["spl_move"]);
                $this->categories();
        }

Here is the call graph for this function:

SurveyQuestionGUI::insertBeforeCategory (  ) 

Inserts categories which are selected for moving before the selected category.

Inserts categories which are selected for moving before the selected category

private

Definition at line 685 of file class.SurveyQuestionGUI.php.

References $_POST, $_SESSION, $result, and writeCategoryData().

        {
                $result = $this->writeCategoryData();
                if (array_key_exists("chb_category", $_POST))
                {
                        if (count($_POST["chb_category"]) == 1)
                        {
                                // one entry is selected, moving is allowed
                                $this->object->categories->removeCategories($_SESSION["spl_move"]);
                                $newinsertindex = $this->object->categories->getCategoryIndex($_POST["category_".$_POST["chb_category"][0]]);
                                if ($newinsertindex === false) $newinsertindex = 0;
                                $move_categories = $_SESSION["spl_move"];
                                natsort($move_categories);
                                foreach (array_reverse($move_categories) as $index)
                                {
                                        $this->object->categories->addCategoryAtPosition($_POST["category_$index"], $newinsertindex);
                                }
                        }
                }
                $_SESSION["spl_modified"] = true;
                unset($_SESSION["spl_move"]);
                $this->categories();
        }

Here is the call graph for this function:

SurveyQuestionGUI::linkChilds (  ) 

Definition at line 410 of file class.SurveyQuestionGUI.php.

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

        {
                switch ($_SESSION["search_link_type"])
                {
                        case "pg":
                        case "st":
                                $_GET["q_id"] = $this->object->getId();
                                $color_class = array("tblrow1", "tblrow2");
                                $counter = 0;
                                include_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("ADM_CONTENT", "link_selection", "tpl.il_svy_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();
                                $color_class = array("tblrow1", "tblrow2");
                                $counter = 0;
                                $this->tpl->addBlockFile("ADM_CONTENT", "link_selection", "tpl.il_svy_qpl_internallink_selection.html", true);
                                include_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":
                                $this->object->setMaterial("il__lm_" . $_GET["source_id"]);
                                unset($_SESSION["link_new_type"]);
                                unset($_SESSION["search_link_type"]);
                                sendInfo($this->lng->txt("material_added_successfully"));
                                $this->editQuestion();
                                break;
                }
        }

Here is the call graph for this function:

SurveyQuestionGUI::moveCategory (  ) 

Selects one or more categories for moving.

Selects one or more categories for moving

private

Definition at line 661 of file class.SurveyQuestionGUI.php.

References $_POST, $_SESSION, sendInfo(), and writeCategoryData().

        {
                $this->writeCategoryData();
                $nothing_selected = true;
                if (array_key_exists("chb_category", $_POST))
                {
                        if (count($_POST["chb_category"]))
                        {
                                $nothing_selected = false;
                                sendInfo($this->lng->txt("select_target_position_for_move"));
                                $_SESSION["spl_move"] = $_POST["chb_category"];
                        }
                }
                if ($nothing_selected) sendInfo($this->lng->txt("no_category_selected_for_move"));
                $this->categories();
        }

Here is the call graph for this function:

SurveyQuestionGUI::originalSyncForm (  ) 

Definition at line 171 of file class.SurveyQuestionGUI.php.

Referenced by save(), and saveCategories().

        {
                $this->tpl->addBlockFile("ADM_CONTENT", "adm_content", "tpl.il_svy_qpl_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:

SurveyQuestionGUI::removeMaterial (  ) 

Definition at line 370 of file class.SurveyQuestionGUI.php.

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

SurveyQuestionGUI::save (  ) 

save question

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

References $_GET, $ilUser, $result, SurveyQuestion::_isWriteable(), originalSyncForm(), ilUtil::redirect(), and sendInfo().

        {
                global $ilUser;
                
                $old_id = $_GET["q_id"];
                $this->errormessage = $this->lng->txt("fill_out_all_required_fields");
                $result = $this->writePostData();
                if ($result == 0)
                {
                        $ilUser->setPref("svy_lastquestiontype", $this->object->getQuestionType());
                        $ilUser->writePref("svy_lastquestiontype", $this->object->getQuestionType());
                        $this->object->saveToDb();
                        $originalexists = $this->object->_questionExists($this->object->original_id);
                        $_GET["q_id"] = $this->object->getId();
                        include_once "./survey/classes/class.SurveyQuestion.php";
                        if ($_GET["calling_survey"] && $originalexists && SurveyQuestion::_isWriteable($this->object->original_id, $ilUser->getId()))
                        {
                                $this->originalSyncForm();
                                return;
                        }
                        elseif ($_GET["calling_survey"])
                        {
                                $_GET["ref_id"] = $_GET["calling_survey"];
                                include_once "./classes/class.ilUtil.php";
                                ilUtil::redirect("ilias.php?baseClass=ilObjSurveyGUI&ref_id=" . $_GET["calling_survey"] . "&cmd=questions");
                                return;
                        }
                        elseif ($_GET["new_for_survey"] > 0)
                        {
                                $this->ctrl->setParameterByClass($_GET["cmdClass"], "q_id", $this->object->getId());
                                $this->ctrl->setParameterByClass($_GET["cmdClass"], "sel_question_types", $_GET["sel_question_types"]);
                                $this->ctrl->setParameterByClass($_GET["cmdClass"], "new_for_survey", $_GET["new_for_survey"]);
                                $this->ctrl->redirectByClass($_GET["cmdClass"], "editQuestion");
                                return;
                        }
                        else
                        {
                                sendInfo($this->lng->txt("msg_obj_modified"), true);
                                $this->ctrl->setParameterByClass($_GET["cmdClass"], "q_id", $this->object->getId());
                                $this->ctrl->setParameterByClass($_GET["cmdClass"], "sel_question_types", $_GET["sel_question_types"]);
                                $this->ctrl->setParameterByClass($_GET["cmdClass"], "new_for_survey", $_GET["new_for_survey"]);
                                $this->ctrl->redirectByClass($_GET["cmdClass"], "editQuestion");
                        }
                }
                else
                {
      sendInfo($this->errormessage);
                }
                $this->editQuestion();
        }

Here is the call graph for this function:

SurveyQuestionGUI::saveCategories (  ) 

Saves the categories.

Saves the categories

private

Definition at line 211 of file class.SurveyQuestionGUI.php.

References $_GET, $_SESSION, $ilUser, SurveyQuestion::_isWriteable(), originalSyncForm(), sendInfo(), and writeCategoryData().

        {
                global $ilUser;
                
                $this->writeCategoryData(true);
                $_SESSION["spl_modified"] = false;
                sendInfo($this->lng->txt("saved_successfully"), true);
                $originalexists = $this->object->_questionExists($this->object->original_id);
                $_GET["q_id"] = $this->object->getId();
                include_once "./survey/classes/class.SurveyQuestion.php";
                if ($_GET["calling_survey"] && $originalexists && SurveyQuestion::_isWriteable($this->object->original_id, $ilUser->getId()))
                {
                        $this->originalSyncForm();
                        return;
                }
                else
                {
                        $this->ctrl->redirect($this, "categories");
                }
        }

Here is the call graph for this function:

SurveyQuestionGUI::setQuestionTabsForClass ( guiclass  ) 

Definition at line 479 of file class.SurveyQuestionGUI.php.

References $_GET, $ilTabs, $rbacsystem, and $ref_id.

Referenced by SurveyTextQuestionGUI::setQuestionTabs(), SurveyOrdinalQuestionGUI::setQuestionTabs(), SurveyNominalQuestionGUI::setQuestionTabs(), and SurveyMetricQuestionGUI::setQuestionTabs().

        {
                global $rbacsystem,$ilTabs;

                $this->ctrl->setParameterByClass("$guiclass", "sel_question_types", $this->getQuestionType());
                $this->ctrl->setParameterByClass("$guiclass", "q_id", $_GET["q_id"]);

                if (($_GET["calling_survey"] > 0) || ($_GET["new_for_survey"] > 0))
                {
                        $ref_id = $_GET["calling_survey"];
                        if (!strlen($ref_id)) $ref_id = $_GET["new_for_survey"];
                        $ilTabs->setBackTarget($this->lng->txt("menubacktosurvey"), "ilias.php?baseClass=ilObjSurveyGUI&ref_id=$ref_id&cmd=questions&new_id=".$_GET["q_id"]);

                        if ($_GET["q_id"])
                        {
                                $ilTabs->addTarget("preview",
                                                                                 $this->ctrl->getLinkTargetByClass("$guiclass", "preview"), "preview",
                                                                                 "$guiclass");
                        }
                        
                        if ($rbacsystem->checkAccess('edit', $_GET["ref_id"])) {
                                $ilTabs->addTarget("edit_properties",
                                                                                 $this->ctrl->getLinkTargetByClass("$guiclass", "editQuestion"), 
                                                                                 array("editQuestion", "cancelExplorer", "linkChilds", "addGIT", "addST",
                                                                                                 "addPG",
                                                                                                 "editQuestion", "addMaterial", "removeMaterial", "save", "cancel"
                                                                                         ),
                                                                                 "$guiclass");
                        }
        
                        switch ($guiclass)
                        {
                                case "surveynominalquestiongui":
                                case "surveyordinalquestiongui":
                                        if ($this->object->getId() > 0) 
                                        {
                                                $ilTabs->addTarget("categories",
                                                                                                 $this->ctrl->getLinkTargetByClass("$guiclass", "categories"), 
                                                                                                 array("categories", "addCategory", "insertBeforeCategory",
                                                                                                                 "insertAfterCategory", "moveCategory", "deleteCategory",
                                                                                                                 "saveCategories", "savePhrase", "addPhrase",
                                                                                                                 "savePhrase", "addSelectedPhrase", "cancelViewPhrase", "confirmSavePhrase",
                                                                                                                 "cancelSavePhrase",
                                                                                                                 "confirmDeleteCategory", "cancelDeleteCategory"
                                                                                                         ),
                                                                                                 $guiclass
                                                );
                                        }
                                        break;
                        }
                }
                else
                {
                        if ($_GET["q_id"])
                        {
                                $ilTabs->addSubTabTarget("preview",
                                                                                 $this->ctrl->getLinkTargetByClass("$guiclass", "preview"), "preview",
                                                                                 "$guiclass");
                        }
                        
                        if ($rbacsystem->checkAccess('edit', $_GET["ref_id"])) {
                                $ilTabs->addSubTabTarget("edit_properties",
                                                                                 $this->ctrl->getLinkTargetByClass("$guiclass", "editQuestion"), 
                                                                                 array("editQuestion", "cancelExplorer", "linkChilds", "addGIT", "addST",
                                                                                                 "addPG",
                                                                                                 "editQuestion", "addMaterial", "removeMaterial", "save", "cancel"
                                                                                         ),
                                                                                 "$guiclass");
                        }
        
                        switch ($guiclass)
                        {
                                case "surveynominalquestiongui":
                                case "surveyordinalquestiongui":
                                        if ($this->object->getId() > 0) 
                                        {
                                                $ilTabs->addSubTabTarget("categories",
                                                                                                 $this->ctrl->getLinkTargetByClass("$guiclass", "categories"), 
                                                                                                 array("categories", "addCategory", "insertBeforeCategory",
                                                                                                                 "insertAfterCategory", "moveCategory", "deleteCategory",
                                                                                                                 "saveCategories", "savePhrase", "addPhrase",
                                                                                                                 "savePhrase", "addSelectedPhrase", "cancelViewPhrase", "confirmSavePhrase",
                                                                                                                 "cancelSavePhrase",
                                                                                                                 "confirmDeleteCategory", "cancelDeleteCategory"
                                                                                                         ),
                                                                                                 $guiclass
                                                );
                                        }
                                        break;
                        }
                }
                if ($this->object->getId() > 0) {
                        $title = $this->lng->txt("edit") . " &quot;" . $this->object->getTitle() . "&quot";
                } else {
                        $title = $this->lng->txt("create_new") . " " . $this->lng->txt($this->getQuestionType());
                }
                $this->tpl->setVariable("HEADER", $title);
        }

Here is the caller graph for this function:

SurveyQuestionGUI::SurveyQuestionGUI (  ) 

SurveyQuestion constructor.

The constructor takes possible arguments an creates an instance of the SurveyQuestion object.

Parameters:
string $title A title string to describe the question
string $description A description string to describe the question
string $author A string containing the name of the questions author
integer $owner A numerical ID to identify the owner/creator public

Definition at line 61 of file class.SurveyQuestionGUI.php.

References $ilCtrl, $lng, and $tpl.

Referenced by SurveyMetricQuestionGUI::SurveyMetricQuestionGUI(), SurveyNominalQuestionGUI::SurveyNominalQuestionGUI(), SurveyOrdinalQuestionGUI::SurveyOrdinalQuestionGUI(), and SurveyTextQuestionGUI::SurveyTextQuestionGUI().

  {
                global $lng, $tpl, $ilCtrl;

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

Here is the caller graph for this function:

SurveyQuestionGUI::sync (  ) 

Definition at line 182 of file class.SurveyQuestionGUI.php.

        {
                $original_id = $this->object->original_id;
                if ($original_id)
                {
                        $this->object->syncWithOriginal();
                }
                $this->ctrl->redirect($this, "editQuestion");
                
                /*$_GET["ref_id"] = $_GET["calling_survey"];
                include_once "./classes/class.ilUtil.php";
                ilUtil::redirect("ilias.php?baseClass=ilObjSurveyGUI&ref_id=" . $_GET["calling_survey"] . "&cmd=questions");*/
        }

SurveyQuestionGUI::writeCategoryData ( save = false  ) 

Recreates the categories from the POST data.

Recreates the categories from the POST data and saves it (optionally) to the database.

Parameters:
boolean $save If set to true the POST data will be saved to the database private

Definition at line 606 of file class.SurveyQuestionGUI.php.

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

Referenced by addCategory(), SurveyOrdinalQuestionGUI::addPhrase(), deleteCategory(), insertAfterCategory(), insertBeforeCategory(), moveCategory(), saveCategories(), and SurveyOrdinalQuestionGUI::savePhrase().

        {
    // Delete all existing categories and create new categories from the form data
    $this->object->categories->flushCategories();
                $complete = true;
                $array1 = array();
    // Add all categories from the form into the object
                include_once "./classes/class.ilUtil.php";
                foreach ($_POST as $key => $value) 
                {
                        if (preg_match("/^category_(\d+)/", $key, $matches)) 
                        {
                                $array1[$matches[1]] = ilUtil::stripSlashes($value);
                                if (strlen($array1[$matches[1]]) == 0) $complete = false;
                        }
                }
                $this->object->categories->addCategoryArray($array1);
                if ($save)
                {       
                        $this->object->saveCategoriesToDb();
                }
                return $complete;
        }

Here is the call graph for this function:

Here is the caller graph for this function:


Field Documentation

SurveyQuestionGUI::$errormessage

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

SurveyQuestionGUI::$lng

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

Referenced by SurveyQuestionGUI().

SurveyQuestionGUI::$object

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

SurveyQuestionGUI::$tpl

Definition at line 47 of file class.SurveyQuestionGUI.php.

Referenced by SurveyQuestionGUI().


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