public function questionsObject()
 {
     global $ilToolbar, $ilUser;
     // insert new questions?
     if ($_GET["new_id"] > 0) {
         // add a question to the survey previous created in a questionpool
         $existing = $this->object->getExistingQuestions();
         if (!in_array($_GET["new_id"], $existing)) {
             $inserted = $this->object->insertQuestion($_GET["new_id"]);
             if (!$inserted) {
                 ilUtil::sendFailure($this->lng->txt("survey_error_insert_incomplete_question"));
             }
         }
     }
     $this->questionsSubtabs("questions");
     $hasDatasets = $this->object->_hasDatasets($this->object->getSurveyId());
     $read_only = $hasDatasets;
     // toolbar
     if (!$read_only) {
         $qtypes = array();
         include_once "./Modules/SurveyQuestionPool/classes/class.ilObjSurveyQuestionPool.php";
         foreach (ilObjSurveyQuestionPool::_getQuestiontypes() as $translation => $data) {
             $qtypes[$data["type_tag"]] = $translation;
         }
         $ilToolbar->setFormAction($this->ctrl->getFormAction($this));
         include_once "Services/Form/classes/class.ilPropertyFormGUI.php";
         $types = new ilSelectInputGUI($this->lng->txt("create_new"), "sel_question_types");
         $types->setOptions($qtypes);
         $ilToolbar->addInputItem($types, "");
         $ilToolbar->addFormButton($this->lng->txt("svy_create_question"), "createQuestion");
         if ($this->object->isPoolActive()) {
             $ilToolbar->addSeparator();
             $cmd = $ilUser->getPref('svy_insert_type') == 1 || strlen($ilUser->getPref('svy_insert_type')) == 0 ? 'browseForQuestions' : 'browseForQuestionblocks';
             $ilToolbar->addButton($this->lng->txt("browse_for_questions"), $this->ctrl->getLinkTarget($this, $cmd));
         }
         $ilToolbar->addSeparator();
         $ilToolbar->addButton($this->lng->txt("add_heading"), $this->ctrl->getLinkTarget($this, "addHeading"));
     }
     if ($hasDatasets) {
         $link = $this->ctrl->getLinkTargetByClass("ilsurveyparticipantsgui", "maintenance");
         $link = "<a href=\"" . $link . "\">" . $this->lng->txt("survey_has_datasets_warning_page_view_link") . "</a>";
         ilUtil::sendInfo($this->lng->txt("survey_has_datasets_warning_page_view") . " " . $link);
     }
     // table gui
     include_once "Modules/Survey/classes/class.ilSurveyQuestionTableGUI.php";
     $table = new ilSurveyQuestionTableGUI($this, "questions", $this->object, $read_only);
     $this->tpl->setContent($table->getHTML());
 }
 /**
 * Creates the questions form for the survey object
 */
 public function questionsObject()
 {
     global $rbacsystem, $ilToolbar, $ilUser;
     $this->handleWriteAccess();
     $hasDatasets = $this->object->_hasDatasets($this->object->getSurveyId());
     include_once "./Services/Utilities/classes/class.ilUtil.php";
     if (!$rbacsystem->checkAccess("read", $this->ref_id) && !$rbacsystem->checkAccess("write", $this->ref_id)) {
         // allow only read and write access
         ilUtil::sendInfo($this->lng->txt("cannot_edit_survey"), true);
         $path = $this->tree->getPathFull($this->object->getRefID());
         ilUtil::redirect($this->getReturnLocation("cancel", "./ilias.php?baseClass=ilRepositoryGUI&cmd=frameset&ref_id=" . $path[count($path) - 2]["child"]));
         return;
     }
     if ($_GET["new_id"] > 0) {
         // add a question to the survey previous created in a questionpool
         $existing = $this->object->getExistingQuestions();
         if (!in_array($_GET["new_id"], $existing)) {
             $inserted = $this->object->insertQuestion($_GET["new_id"]);
             if (!$inserted) {
                 ilUtil::sendFailure($this->lng->txt("survey_error_insert_incomplete_question"));
             }
         }
     }
     if ($_GET["eqid"] and $_GET["eqpl"]) {
         ilUtil::redirect("ilias.php?baseClass=ilObjSurveyQuestionPoolGUI&ref_id=" . $_GET["eqpl"] . "&cmd=editQuestionForSurvey&calling_survey=" . $_GET["ref_id"] . "&q_id=" . $_GET["eqid"]);
     }
     $_SESSION["calling_survey"] = $this->object->getRefId();
     unset($_SESSION["survey_id"]);
     if ($_GET["editheading"]) {
         $this->addHeadingObject(false, $_GET["editheading"]);
         return;
     }
     /*
     if ($_GET["up"] > 0)
     {
     	$this->object->moveUpQuestion($_GET["up"]);
     	ilUtil::sendSuccess($this->lng->txt('msg_obj_modified'));
     }
     if ($_GET["down"] > 0)
     {
     	$this->object->moveDownQuestion($_GET["down"]);
     	ilUtil::sendSuccess($this->lng->txt('msg_obj_modified'));
     }
     if ($_GET["qbup"] > 0)
     {
     	$this->object->moveUpQuestionblock($_GET["qbup"]);
     	ilUtil::sendSuccess($this->lng->txt('msg_obj_modified'));
     }
     if ($_GET["qbdown"] > 0)
     {
     	$this->object->moveDownQuestionblock($_GET["qbdown"]);
     	ilUtil::sendSuccess($this->lng->txt('msg_obj_modified'));
     }
     */
     if ($_GET["removeheading"]) {
         $this->confirmRemoveHeadingForm();
         return;
     }
     if ($_GET["editblock"]) {
         $this->defineQuestionblock($_GET["editblock"]);
         return;
     }
     if ($_GET["add"]) {
         // called after a new question was created from a questionpool
         $selected_array = array();
         array_push($selected_array, $_GET["add"]);
         ilUtil::sendQuestion($this->lng->txt("ask_insert_questions"));
         $this->insertQuestionsForm($selected_array);
         return;
     }
     $this->questionsSubtabs("questions");
     $read_only = !$rbacsystem->checkAccess("write", $this->ref_id) || $hasDatasets;
     // toolbar
     if (!$read_only) {
         $qtypes = array();
         include_once "./Modules/SurveyQuestionPool/classes/class.ilObjSurveyQuestionPool.php";
         foreach (ilObjSurveyQuestionPool::_getQuestiontypes() as $translation => $data) {
             $qtypes[$data["type_tag"]] = $translation;
         }
         $ilToolbar->setFormAction($this->ctrl->getFormAction($this));
         include_once "Services/Form/classes/class.ilPropertyFormGUI.php";
         $types = new ilSelectInputGUI($this->lng->txt("create_new"), "sel_question_types");
         $types->setOptions($qtypes);
         $ilToolbar->addInputItem($types, "");
         $ilToolbar->addFormButton($this->lng->txt("svy_create_question"), "createQuestion");
         if ($this->object->isPoolActive()) {
             $ilToolbar->addSeparator();
             $cmd = $ilUser->getPref('svy_insert_type') == 1 || strlen($ilUser->getPref('svy_insert_type')) == 0 ? 'browseForQuestions' : 'browseForQuestionblocks';
             $ilToolbar->addButton($this->lng->txt("browse_for_questions"), $this->ctrl->getLinkTarget($this, $cmd));
         }
         $ilToolbar->addSeparator();
         $ilToolbar->addButton($this->lng->txt("add_heading"), $this->ctrl->getLinkTarget($this, "addHeading"));
     }
     if ($hasDatasets) {
         // ilUtil::sendInfo($this->lng->txt("survey_has_datasets_warning"));
         $link = $this->ctrl->getLinkTarget($this, "maintenance");
         $link = "<a href=\"" . $link . "\">" . $this->lng->txt("survey_has_datasets_warning_page_view_link") . "</a>";
         ilUtil::sendInfo($this->lng->txt("survey_has_datasets_warning_page_view") . " " . $link);
     }
     // table gui
     include_once "Modules/Survey/classes/class.ilSurveyQuestionTableGUI.php";
     $table = new ilSurveyQuestionTableGUI($this, "questions", $this->object, $read_only);
     $this->tpl->setContent($table->getHTML());
 }