25                $this->parent_gui = $a_parent_gui;
 
   26                $this->
object = $this->parent_gui->object;
 
   32                $this->ctrl->saveParameter($this, array(
"pgov", 
"pgov_pos"));
 
   39                $cmd = $this->ctrl->getCmd(
"questions");
 
   43                        if(
$cmd == 
"questions")
 
   45                                $this->ctrl->setCmdClass(
"ilsurveypagegui");
 
   46                                $this->ctrl->setCmd(
"renderpage");
 
   48                        else if(
$cmd == 
"confirmRemoveQuestions")
 
   51                                $this->ctrl->setCmdClass(
"ilsurveypagegui");
 
   52                                $this->ctrl->setCmd(
"confirmRemoveQuestions");
 
   56                $next_class = $this->ctrl->getNextClass($this); 
 
   59                        case 'ilsurveypagegui':
 
   61                                include_once 
'./Modules/Survey/classes/class.ilSurveyPageGUI.php';
 
   63                                $this->ctrl->forwardCommand($pg);
 
   68                                if(stristr($next_class, 
"questiongui"))
 
   70                                        $ilTabs->clearTargets();
 
   71                                        $this->ctrl->saveParameter($this, array(
"new_for_survey"));
 
   73                                        include_once 
"./Modules/SurveyQuestionPool/classes/class.SurveyQuestionGUI.php";
 
   75                                        if (is_object($q_gui->object))
 
   78                                                $ilHelp->setScreenIdComponent(
"spl_qt".$q_gui->object->getQuestionTypeId());
 
   81                                        $q_gui->setBackUrl($this->ctrl->getLinkTarget($this, 
"questions"));
 
   82                                        $q_gui->setQuestionTabs();                                                                      
 
   83                                        $this->ctrl->forwardCommand($q_gui);
 
   85                                        if(!(
int)$_REQUEST[
"new_for_survey"])
 
   88                                                $this->tpl->setTitle($this->lng->txt(
"question").
": ".$q_gui->object->getTitle());      
 
  104                if($a_cmd == 
"questions" && $_REQUEST[
"pgov"])
 
  109                $hidden_tabs = array();
 
  110                $template = $this->
object->getTemplate();
 
  113                        include_once 
"Services/Administration/classes/class.ilSettingsTemplate.php";
 
  115                        $hidden_tabs = $template->getHiddenTabs();
 
  118                $ilTabs->addSubTab(
"page", 
 
  119                        $this->lng->txt(
"survey_per_page_view"),
 
  120                        $this->ctrl->getLinkTargetByClass(
"ilsurveypagegui", 
"renderPage"));
 
  122                if(!in_array(
"survey_question_editor", $hidden_tabs))
 
  124                        $this->ctrl->setParameter($this, 
"pgov", 
"");
 
  125                        $ilTabs->addSubTab(
"questions",
 
  126                                $this->lng->txt(
"survey_question_editor"), 
 
  127                                $this->ctrl->getLinkTarget($this, 
"questions"));
 
  128                        $this->ctrl->setParameter($this, 
"pgov", $_REQUEST[
"pgov"]);
 
  131                $ilTabs->addSubTab(
"print",
 
  132                        $this->lng->txt(
"print_view"), 
 
  133                        $this->ctrl->getLinkTarget($this, 
"printView"));
 
  135                if($this->object->getSurveyPages())
 
  139                                $this->ctrl->setParameterByClass(
"ilsurveyexecutiongui", 
"pgov", max(1, $_REQUEST[
"pg"]));
 
  141                        $this->ctrl->setParameterByClass(
"ilsurveyexecutiongui", 
"prvw", 1);
 
  142                        $ilTabs->addSubTab(
"preview",
 
  143                                $this->lng->txt(
"preview"), 
 
  144                                $this->ctrl->getLinkTargetByClass(array(
"ilobjsurveygui", 
"ilsurveyexecutiongui"), 
"preview"));
 
  147                $ilTabs->activateSubTab($a_cmd);
 
  161                if (
$_GET[
"new_id"] > 0)
 
  164                        $existing = $this->
object->getExistingQuestions();
 
  165                        if (!in_array(
$_GET[
"new_id"], $existing))
 
  167                                $inserted = $this->
object->insertQuestion(
$_GET[
"new_id"]);
 
  179                $read_only = $hasDatasets;
 
  187                        include_once 
"./Modules/SurveyQuestionPool/classes/class.ilObjSurveyQuestionPool.php";
 
  190                                $qtypes[
$data[
"type_tag"]] = $translation;
 
  193                        $ilToolbar->setFormAction($this->ctrl->getFormAction($this));
 
  194                        include_once 
"Services/Form/classes/class.ilPropertyFormGUI.php";
 
  195                        $types = 
new ilSelectInputGUI($this->lng->txt(
"create_new"), 
"sel_question_types");
 
  196                        $types->setOptions($qtypes);
 
  197                        $ilToolbar->addStickyItem($types, 
"");
 
  200                        include_once 
"Services/UIComponent/Button/classes/class.ilLinkButton.php";
 
  201                        include_once 
"Services/UIComponent/Button/classes/class.ilSubmitButton.php";
 
  204                        $button->setCaption(
"svy_create_question");                                                             
 
  205                        $button->setCommand(
"createQuestion");
 
  206                        $ilToolbar->addStickyItem($button);             
 
  208                        if($this->object->isPoolActive())
 
  210                                $ilToolbar->addSeparator();
 
  212                                $cmd = (
$ilUser->getPref(
'svy_insert_type') == 1 || 
 
  213                                        strlen(
$ilUser->getPref(
'svy_insert_type')) == 0) 
 
  214                                        ? 
'browseForQuestions'  
  215                                        : 
'browseForQuestionblocks';
 
  218                                $button->setCaption(
"browse_for_questions");                                                            
 
  219                                $button->setUrl($this->ctrl->getLinkTarget($this, 
$cmd));                                                                               
 
  220                                $ilToolbar->addStickyItem($button);                                             
 
  223                        $ilToolbar->addSeparator();
 
  226                        $button->setCaption(
"add_heading");                                                             
 
  227                        $button->setUrl($this->ctrl->getLinkTarget($this, 
"addHeading"));                                                                               
 
  228                        $ilToolbar->addInputItem($button);              
 
  232                        $link = $this->ctrl->getLinkTargetByClass(
"ilsurveyparticipantsgui", 
"maintenance");
 
  233                        $link = 
"<a href=\"".$link.
"\">".$this->lng->txt(
"survey_has_datasets_warning_page_view_link").
"</a>";
 
  234                        ilUtil::sendInfo($this->lng->txt(
"survey_has_datasets_warning_page_view").
" ".$link);
 
  240                include_once 
"Modules/Survey/classes/class.ilSurveyQuestionTableGUI.php";
 
  243                $this->tpl->setContent($table->getHTML());
 
  255        protected function gatherSelectedTableItems($allow_blocks = 
true, $allow_questions = 
true, $allow_headings = 
false, $allow_questions_in_blocks = 
false)
 
  257                $block_map = array();
 
  258                foreach($this->object->getSurveyQuestions() as $item)
 
  260                        $block_map[$item[
"question_id"]] = $item[
"questionblock_id"];
 
  263                $questions = $blocks = $headings = array();
 
  266                        foreach (
$_POST[
"id"] as $key)
 
  269                                if ($allow_questions && preg_match(
"/cb_(\d+)/", $key, $matches))
 
  271                                        if(($allow_questions_in_blocks || !$block_map[$matches[1]]) &&
 
  272                                                !in_array($block_map[$matches[1]], $blocks))
 
  274                                                array_push($questions, $matches[1]);
 
  278                                if ($allow_blocks && preg_match(
"/cb_qb_(\d+)/", $key, $matches))
 
  280                                        array_push($blocks, $matches[1]);
 
  283                                if ($allow_headings && preg_match(
"/cb_tb_(\d+)/", $key, $matches))
 
  285                                        array_push($headings, $matches[1]);
 
  290                return array(
"questions" => $questions,
 
  292                        "headings" => $headings);
 
  297                if(isset(
$_POST[
"order"]))
 
  302                        foreach(array_keys(
$_POST[
"order"]) as $id)
 
  305                                if(substr($id, 0, 3) == 
"qb_")
 
  307                                        $block_id = substr($id, 3);
 
  308                                        $block = 
$_POST[
"block_order"][$block_id];
 
  310                                        foreach(array_keys($block) as $question_id)
 
  313                                                $order[$question_id] = $position;
 
  318                                        $question_id = substr($id, 2);
 
  320                                        $order[$question_id] = $position;
 
  323                        $this->
object->updateOrder($order);
 
  326                $obligatory = array();
 
  327                foreach (
$_POST as $key => $value)
 
  329                        if (preg_match(
"/obligatory_(\d+)/", $key, $matches))
 
  331                                $obligatory[$matches[1]] = 1;
 
  334                $this->
object->setObligatoryStates($obligatory);
 
  336                $this->ctrl->redirect($this, 
"questions");
 
  342                if (count($items[
"blocks"]))
 
  345                        $this->
object->unfoldQuestionblocks($items[
"blocks"]);
 
  351                $this->ctrl->redirect($this, 
"questions");
 
  358                $move_questions = $items[
"questions"];
 
  359                foreach ($items[
"blocks"] as $block_id)
 
  361                        foreach ($this->object->getQuestionblockQuestionIds($block_id) as $qid)
 
  363                                array_push($move_questions, $qid);
 
  366                if (count($move_questions) == 0)
 
  369                        $this->ctrl->redirect($this, 
"questions");
 
  373                        $_SESSION[
"move_questions"] = $move_questions;
 
  374                        ilUtil::sendInfo($this->lng->txt(
"select_target_position_for_move_question"));
 
  397                        while(!$insert_id && 
sizeof(
$_POST[
"id"]))
 
  400                                if (preg_match(
"/^cb_(\d+)$/", 
$target, $matches))
 
  403                                        if(in_array($matches[1], $items[
"questions"]))
 
  405                                                $insert_id = $matches[1];
 
  408                                if (!$insert_id && preg_match(
"/^cb_qb_(\d+)$/", 
$target, $matches))
 
  410                                        $ids = $this->
object->getQuestionblockQuestionIds($matches[1]);
 
  413                                                if ($insert_mode == 0)
 
  415                                                        $insert_id = $ids[0];
 
  417                                                else if ($insert_mode == 1)
 
  419                                                        $insert_id = $ids[count($ids)-1];
 
  433                        $this->
object->moveQuestions(
$_SESSION[
"move_questions"], $insert_id, $insert_mode);
 
  437                $this->ctrl->redirect($this, 
"questions");
 
  443                if (count($items[
"blocks"]) + count($items[
"questions"]) + count($items[
"headings"]) > 0)
 
  451                        ilUtil::sendInfo($this->lng->txt(
"no_question_selected_for_removal"), 
true);
 
  452                        $this->ctrl->redirect($this, 
"questions");
 
  458                include_once(
"./Services/Utilities/classes/class.ilConfirmationGUI.php");
 
  460                $cgui->setHeaderText($this->lng->txt(
"survey_sure_delete_questions"));
 
  462                $cgui->setFormAction($this->ctrl->getFormAction($this, 
"confirmRemoveQuestions"));
 
  463                $cgui->setCancel($this->lng->txt(
"cancel"), 
"questions");
 
  464                $cgui->setConfirm($this->lng->txt(
"confirm"), 
"confirmRemoveQuestions");
 
  467                $surveyquestions =& $this->
object->getSurveyQuestions();
 
  468                include_once 
"./Modules/SurveyQuestionPool/classes/class.SurveyQuestion.php";
 
  469                foreach ($surveyquestions as $question_id => 
$data)
 
  471                        if (in_array(
$data[
"question_id"], $checked_questions))
 
  475                                $cgui->addItem(
"id_".
$data[
"question_id"], 
$data[
"question_id"], 
 
  476                                        $type.
": ".
$data[
"title"]);
 
  478                        else if((in_array(
$data[
"questionblock_id"], $checked_questionblocks)))
 
  482                                $cgui->addItem(
"id_qb_".
$data[
"questionblock_id"], 
$data[
"questionblock_id"], 
 
  483                                        $data[
"questionblock_title"].
" - ".$type.
": ".
$data[
"title"]);                          
 
  485                        else if (in_array(
$data[
"question_id"], $checked_headings))
 
  487                                $cgui->addItem(
"id_tb_".
$data[
"question_id"], 
$data[
"question_id"], 
 
  492                $this->tpl->setContent($cgui->getHTML());
 
  497                $checked_questions = array();
 
  498                $checked_questionblocks = array();
 
  499                $checked_headings = array();
 
  500                foreach (
$_POST as $key => $value) 
 
  502                        if (preg_match(
"/id_(\d+)/", $key, $matches)) 
 
  504                                array_push($checked_questions, $matches[1]);
 
  506                        if (preg_match(
"/id_qb_(\d+)/", $key, $matches)) 
 
  508                                array_push($checked_questionblocks, $matches[1]);
 
  510                        if (preg_match(
"/id_tb_(\d+)/", $key, $matches))
 
  512                                array_push($checked_headings, $matches[1]);
 
  516                if(
sizeof($checked_questions) || 
sizeof($checked_questionblocks))
 
  518                        $this->
object->removeQuestions($checked_questions, $checked_questionblocks);
 
  520                if($checked_headings)
 
  522                        foreach($checked_headings as $q_id)
 
  524                                $this->
object->saveHeading(
"", $q_id);
 
  527                $this->
object->saveCompletionStatus();
 
  529                $this->ctrl->redirect($this, 
"questions");
 
  537                $copy_questions = $items[
"questions"];
 
  538                foreach ($items[
"blocks"] as $block_id)
 
  540                        foreach ($this->object->getQuestionblockQuestionIds($block_id) as $qid)
 
  542                                array_push($copy_questions, $qid);
 
  545                $copy_questions = array_unique($copy_questions);
 
  548                if (count($copy_questions))
 
  550                        foreach($copy_questions as $idx => $question_id)
 
  553                                if($question->getOriginalId())
 
  555                                        unset($copy_questions[$idx]);
 
  560                if (count($copy_questions) == 0)
 
  562                        ilUtil::sendInfo($this->lng->txt(
"no_question_selected_for_copy_to_pool"), 
true);
 
  563                        $this->ctrl->redirect($this, 
"questions");
 
  569                        include_once 
"Services/Form/classes/class.ilPropertyFormGUI.php";
 
  572                        $form->setFormAction($this->ctrl->getFormAction($this, 
"executeCreateQuestion"));
 
  575                        $ids->setValue(implode(
";", $copy_questions));
 
  576                        $form->addItem($ids);
 
  578                        $questionpools =& $this->
object->getAvailableQuestionpools(
false, 
false, 
true, 
"write");
 
  579                        $pools = 
new ilSelectInputGUI($this->lng->txt(
"survey_copy_select_questionpool"), 
"sel_spl");
 
  580                        $pools->setOptions($questionpools);
 
  581                        $form->addItem($pools);
 
  583                        $form->addCommandButton(
"executeCopyQuestionsToPool", $this->lng->txt(
"submit"));
 
  584                        $form->addCommandButton(
"questions", $this->lng->txt(
"cancel"));
 
  586                        return $this->tpl->setContent($form->getHTML());
 
  592                $question_ids = explode(
";", 
$_POST[
"question_ids"]);
 
  595                foreach($question_ids as $qid)
 
  599                        $new_question->setId();
 
  600                        $new_question->setObjId($pool_id);
 
  601                        $new_question->saveToDb();
 
  608                $this->ctrl->redirect($this, 
"questions");
 
  618                if(!$this->object->isPoolActive())
 
  621                        $_GET[
"sel_question_types"] = 
$_POST[
"sel_question_types"];
 
  629                        include_once 
"Services/Form/classes/class.ilPropertyFormGUI.php";
 
  632                        $sel_question_types = (strlen(
$_POST[
"sel_question_types"])) ? 
$_POST[
"sel_question_types"] : 
$_GET[
"sel_question_types"];
 
  633                        $this->ctrl->setParameter($this, 
"sel_question_types", $sel_question_types);
 
  634                        $form->setFormAction($this->ctrl->getFormAction($this, 
"executeCreateQuestion"));
 
  642                $usage->setRequired(
true);
 
  643                $no_pool = 
new ilRadioOption($this->lng->txt(
"survey_no_pool"), 1);
 
  644                $usage->addOption($no_pool);
 
  645                $existing_pool = 
new ilRadioOption($this->lng->txt(
"survey_existing_pool"), 3);
 
  646                $usage->addOption($existing_pool);
 
  647                $new_pool = 
new ilRadioOption($this->lng->txt(
"survey_new_pool"), 2);
 
  648                $usage->addOption($new_pool);
 
  649                $form->addItem($usage);
 
  653                        $usage->setValue(
$_SESSION[
"svy_qpool_choice"]);
 
  661                $questionpools =& $this->
object->getAvailableQuestionpools(FALSE, TRUE, TRUE, 
"write");
 
  662                $pools = 
new ilSelectInputGUI($this->lng->txt(
"select_questionpool"), 
"sel_spl");
 
  663                $pools->setOptions($questionpools);
 
  664                $existing_pool->addSubItem($pools);
 
  666                $name = 
new ilTextInputGUI($this->lng->txt(
"spl_new"), 
"name_spl"); 
 
  668                $name->setMaxLength(50);
 
  669                $new_pool->addSubItem($name);
 
  676                $form->addCommandButton(
"executeCreateQuestion", $this->lng->txt(
"submit"));
 
  677                $form->addCommandButton(
"questions", $this->lng->txt(
"cancel"));
 
  679                return $this->tpl->setContent($form->getHTML());
 
  686                $q_type = 
$_GET[
"sel_question_types"];
 
  691                        $obj_id = $this->
object->getId();       
 
  694                else if (
$_POST[
"usage"] == 3 && strlen(
$_POST[
"sel_spl"]))
 
  699                elseif (
$_POST[
"usage"] == 2 && strlen(
$_POST[
"name_spl"]))
 
  713                        $this->ctrl->setParameter($this, 
"sel_question_types", $q_type);
 
  714                        $this->ctrl->redirect($this, 
"createQuestion");
 
  720                include_once 
"./Modules/SurveyQuestionPool/classes/class.SurveyQuestionGUI.php";
 
  722                $q_gui->object->setObjId($obj_id); 
 
  723                $q_gui->object->createNewQuestion();            
 
  724                $q_gui_class = get_class($q_gui);       
 
  726                if($_REQUEST[
"pgov"])
 
  728                        $this->ctrl->setParameterByClass($q_gui_class, 
"pgov", $_REQUEST[
"pgov"]);
 
  729                        $this->ctrl->setParameterByClass($q_gui_class, 
"pgov_pos",$_REQUEST[
"pgov_pos"]);                       
 
  732                $this->ctrl->setParameterByClass($q_gui_class, 
"ref_id", $this->object->getRefId());
 
  733                $this->ctrl->setParameterByClass($q_gui_class, 
"new_for_survey", $this->object->getRefId());
 
  734                $this->ctrl->setParameterByClass($q_gui_class, 
"q_id", $q_gui->object->getId());
 
  735                $this->ctrl->setParameterByClass($q_gui_class, 
"sel_question_types", $q_gui->getQuestionType());                
 
  736                $this->ctrl->redirectByClass($q_gui_class, 
"editQuestion");                                     
 
  743                $parent_ref = $tree->getParentId($this->object->getRefId());
 
  745                include_once 
"./Modules/SurveyQuestionPool/classes/class.ilObjSurveyQuestionPool.php";
 
  747                $qpl->setType(
"spl");
 
  748                $qpl->setTitle($name);
 
  749                $qpl->setDescription(
"");
 
  751                $qpl->createReference();
 
  752                $qpl->putInTree($parent_ref);
 
  753                $qpl->setPermissions($parent_ref);
 
  757                return $qpl->getId();
 
  767                global $ilTabs, $ilToolbar, 
$ilUser;
 
  769                if(!isset($_REQUEST[
"pgov"]))
 
  771                        $link = $this->ctrl->getLinkTarget($this, 
"questions");
 
  775                        $link = $this->ctrl->getLinkTargetByClass(
"ilsurveypagegui", 
"renderpage");
 
  777                $ilTabs->setBackTarget($this->lng->txt(
"menubacktosurvey"), $link);
 
  780                include_once 
"Services/Form/classes/class.ilSelectInputGUI.php";
 
  781                $types = 
new ilSelectInputGUI($this->lng->txt(
"display_all_available"), 
"datatype");
 
  782                $types->setOptions(array(
 
  783                        1 =>  $this->lng->txt(
"questions"),
 
  784                        2 =>  $this->lng->txt(
"questionblocks")
 
  786                $types->setValue(
$ilUser->getPref(
'svy_insert_type'));
 
  787                $ilToolbar->addInputItem($types, 
true);
 
  788                $ilToolbar->addFormButton($this->lng->txt(
"change"), 
"changeDatatype");
 
  789                $ilToolbar->setFormAction( $this->ctrl->getFormAction($this, 
"changeDatatype"));                
 
  798                switch (
$_POST[
"datatype"])
 
  801                                $this->ctrl->redirect($this, 
'browseForQuestionblocks');
 
  806                                $this->ctrl->redirect($this, 
'browseForQuestions');
 
  815                include_once 
"./Modules/Survey/classes/tables/class.ilSurveyQuestionbrowserTableGUI.php";
 
  817                $table_gui->setEditable(
true);          
 
  818                $this->tpl->setContent($table_gui->getHTML());                                                  
 
  823                include_once 
"./Modules/Survey/classes/tables/class.ilSurveyQuestionbrowserTableGUI.php";
 
  825                $table_gui->writeFilterToSession();
 
  826                $this->ctrl->redirect($this, 
'browseForQuestions');
 
  831                include_once 
"./Modules/Survey/classes/tables/class.ilSurveyQuestionbrowserTableGUI.php";
 
  833                $table_gui->resetFilter();
 
  834                $this->ctrl->redirect($this, 
'browseForQuestions');
 
  839                $inserted_objects = 0;
 
  840                if (is_array(
$_POST[
'q_id']))
 
  842                        if($_REQUEST[
"pgov"])
 
  844                                include_once 
"Modules/Survey/classes/class.ilSurveyPageGUI.php";
 
  846                                $page_gui->determineCurrentPage();      
 
  851                        foreach (
$_POST[
'q_id'] as $question_id)
 
  853                                if(!$_REQUEST[
"pgov"])
 
  855                                        $this->
object->insertQuestion($question_id);
 
  860                                        $page_gui->insertNewQuestion($question_id);
 
  865                if ($inserted_objects)
 
  867                        $this->
object->saveCompletionStatus();
 
  869                        if(!$_REQUEST[
"pgov"])
 
  871                                $this->ctrl->redirect($this, 
"questions");
 
  875                                $target_page = $_REQUEST[
"pgov"];
 
  876                                if(substr($_REQUEST[
"pgov_pos"], -1) == 
"c")
 
  879                                        if((
int)$_REQUEST[
"pgov_pos"])
 
  888                                $this->ctrl->setParameterByClass(
"ilsurveypagegui", 
"pgov", $target_page);
 
  889                                $this->ctrl->redirectByClass(
"ilsurveypagegui", 
"renderpage");                  
 
  895                        $this->ctrl->redirect($this, 
'browseForQuestions');
 
  903                include_once 
"./Modules/Survey/classes/tables/class.ilSurveyQuestionblockbrowserTableGUI.php";
 
  905                $table_gui->setEditable(
true);                          
 
  906                $this->tpl->setContent($table_gui->getHTML());  
 
  911                include_once 
"./Modules/Survey/classes/tables/class.ilSurveyQuestionblockbrowserTableGUI.php";
 
  913                $table_gui->writeFilterToSession();
 
  914                $this->ctrl->redirect($this, 
'browseForQuestionblocks');
 
  919                include_once 
"./Modules/Survey/classes/tables/class.ilSurveyQuestionblockbrowserTableGUI.php";
 
  921                $table_gui->resetFilter();
 
  922                $this->ctrl->redirect($this, 
'browseForQuestionblocks');
 
  927                $inserted_objects = 0;
 
  928                if (is_array(
$_POST[
'cb']))
 
  930                        if($_REQUEST[
"pgov"])
 
  932                                include_once 
"Modules/Survey/classes/class.ilSurveyPageGUI.php";
 
  934                                $page_gui->determineCurrentPage();      
 
  939                        foreach (
$_POST[
'cb'] as $questionblock_id)
 
  941                                if(!$_REQUEST[
"pgov"])
 
  943                                        $this->
object->insertQuestionblock($questionblock_id);
 
  947                                        $page_gui->insertQuestionblock($questionblock_id);
 
  952                if ($inserted_objects)
 
  954                        $this->
object->saveCompletionStatus();
 
  955                        ilUtil::sendSuccess(($inserted_objects == 1) ? $this->lng->txt(
"questionblock_inserted") : $this->lng->txt(
"questionblocks_inserted"), 
true);                   
 
  956                        if(!$_REQUEST[
"pgov"])
 
  958                                $this->ctrl->redirect($this, 
"questions");
 
  962                                $target_page = $_REQUEST[
"pgov"];
 
  963                                if(substr($_REQUEST[
"pgov_pos"], -1) == 
"c")
 
  967                                $this->ctrl->setParameterByClass(
"ilsurveypagegui", 
"pgov", $target_page);
 
  968                                $this->ctrl->redirectByClass(
"ilsurveypagegui", 
"renderpage");                  
 
  974                        $this->ctrl->redirect($this, 
'browseForQuestionblocks');
 
  985                $block_id = (int)$_REQUEST[
"bl_id"];            
 
  986                $this->ctrl->setParameter($this, 
"bl_id", $block_id);
 
  994                $this->tpl->setContent($a_form->getHTML());
 
 1003                        if(
sizeof(
$_POST[
"qids"]))
 
 1005                                $items[
"questions"] = 
$_POST[
"qids"];
 
 1007                        if (count($items[
"questions"]) < 2)
 
 1009                                ilUtil::sendInfo($this->lng->txt(
"qpl_define_questionblock_select_missing"), 
true);
 
 1010                                $this->ctrl->redirect($this, 
"questions");
 
 1017                $this->tpl->setContent($a_form->getHTML());
 
 1022                include_once(
"./Services/Form/classes/class.ilPropertyFormGUI.php");
 
 1024                $form->setFormAction($this->ctrl->getFormAction($this, 
"saveDefineQuestionblock"));
 
 1025                $form->setTitle($this->lng->txt(
"define_questionblock"));
 
 1028                $title->setRequired(
true);              
 
 1031                $toggle_blocktitle = 
new ilCheckboxInputGUI($this->lng->txt(
"survey_show_blocktitle"), 
"show_blocktitle");
 
 1032                $toggle_blocktitle->setInfo($this->lng->txt(
"survey_show_blocktitle_description"));             
 
 1033                $form->addItem($toggle_blocktitle);
 
 1035                $toggle_questiontitle = 
new ilCheckboxInputGUI($this->lng->txt(
"show_questiontext"), 
"show_questiontext");
 
 1036                $toggle_questiontitle->setInfo($this->lng->txt(
"show_questiontext_description"));               
 
 1037                $form->addItem($toggle_questiontitle);
 
 1042                        $title->setValue($questionblock[
"title"]);
 
 1043                        $toggle_blocktitle->setChecked($questionblock[
"show_blocktitle"]);
 
 1044                        $toggle_questiontitle->setChecked($questionblock[
"show_questiontext"]);
 
 1048                        $toggle_blocktitle->setChecked(
true);
 
 1049                        $toggle_questiontitle->setChecked(
true);
 
 1052                $form->addCommandButton(
"saveDefineQuestionblock", $this->lng->txt(
"save"));
 
 1053                $form->addCommandButton(
"questions", $this->lng->txt(
"cancel"));
 
 1056                if(!$a_question_ids && 
$_POST[
"qids"])
 
 1058                        $a_question_ids = 
$_POST[
"qids"];
 
 1061                if ($a_question_ids)
 
 1063                        foreach ($a_question_ids as $q_id)
 
 1066                                $hidden->setValue($q_id);
 
 1067                                $form->addItem($hidden);
 
 1076                $block_id = (int)$_REQUEST[
"bl_id"];
 
 1079                $this->ctrl->setParameter($this, 
"bl_id", $block_id);
 
 1081                if(!$block_id && !is_array($q_ids))
 
 1083                        $this->ctrl->redirect($this, 
"questions");
 
 1087                if($form->checkInput())
 
 1089                        $title = $form->getInput(
"title");
 
 1090                        $show_questiontext = $form->getInput(
"show_questiontext");
 
 1091                        $show_blocktitle = $form->getInput(
"show_blocktitle") ;
 
 1095                                $this->
object->modifyQuestionblock($block_id, 
$title, 
 
 1096                                        $show_questiontext, $show_blocktitle);
 
 1100                                $this->
object->createQuestionblock(
$title, $show_questiontext, 
 
 1101                                        $show_blocktitle, $q_ids);
 
 1105                        $this->ctrl->redirect($this, 
"questions");
 
 1108                $form->setValuesByPost();
 
 1119                $survey_questions = $this->
object->getSurveyQuestions();
 
 1121                include_once(
"./Services/Form/classes/class.ilPropertyFormGUI.php");
 
 1123                $form->setFormAction($this->ctrl->getFormAction($this, 
""));
 
 1127                $heading->setRows(10);
 
 1128                $heading->setCols(80);
 
 1129                $heading->setUseRte(TRUE);
 
 1130                include_once 
"./Services/AdvancedEditing/classes/class.ilObjAdvancedEditing.php";
 
 1133                $heading->setRTESupport($this->object->getId(), 
"svy", 
"survey");
 
 1134                $heading->setRequired(
true);
 
 1135                $form->addItem($heading);
 
 1137                $insertbefore = 
new ilSelectInputGUI($this->lng->txt(
"insert"), 
"insertbefore");
 
 1139                foreach ($survey_questions as $key => $value)
 
 1141                        $options[$key] = $this->lng->txt(
"before") . 
": \"" . $value[
"title"] . 
"\"";
 
 1143                $insertbefore->setOptions(
$options);            
 
 1144                $insertbefore->setRequired(
true);               
 
 1145                $form->addItem($insertbefore);
 
 1147                $form->addCommandButton(
"saveHeading", $this->lng->txt(
"save"));
 
 1148                $form->addCommandButton(
"questions", $this->lng->txt(
"cancel"));
 
 1152                        $form->setTitle($this->lng->txt(
"edit_heading"));
 
 1154                        $heading->setValue($this->object->prepareTextareaOutput($survey_questions[$a_question_id][
"heading"]));
 
 1155                        $insertbefore->setValue($a_question_id);
 
 1156                        $insertbefore->setDisabled(
true);
 
 1160                        $form->setTitle($this->lng->txt(
"add_heading"));
 
 1168                $q_id = $_REQUEST[
"q_id"];
 
 1169                $this->ctrl->setParameter($this, 
"q_id", $q_id);
 
 1178                $this->tpl->setContent($a_form->getHTML());
 
 1183                $q_id = $_REQUEST[
"q_id"];
 
 1184                $this->ctrl->setParameter($this, 
"q_id", $q_id);
 
 1193                $this->tpl->setContent($a_form->getHTML());
 
 1199                $q_id = (int)$_REQUEST[
"q_id"];         
 
 1200                $this->ctrl->setParameter($this, 
"q_id", $q_id);
 
 1203                if ($form->checkInput())
 
 1205                        include_once 
"./Services/AdvancedEditing/classes/class.ilObjAdvancedEditing.php";
 
 1208                                $form->getInput(
"insertbefore"));
 
 1209                        $this->ctrl->redirect($this, 
"questions");
 
 1212                $form->setValuesByPost();
 
 1218                $q_id = (int)$_REQUEST[
"q_id"];
 
 1219                $this->ctrl->setParameter($this, 
"q_id", $q_id);
 
 1223                        $this->ctrl->redirect($this, 
"questions");
 
 1228                include_once(
"./Services/Utilities/classes/class.ilConfirmationGUI.php");
 
 1230                $cgui->setHeaderText($this->lng->txt(
"confirm_remove_heading"));
 
 1232                $cgui->setFormAction($this->ctrl->getFormAction($this, 
"confirmedRemoveHeading"));
 
 1233                $cgui->setCancel($this->lng->txt(
"cancel"), 
"questions");
 
 1234                $cgui->setConfirm($this->lng->txt(
"confirm"), 
"confirmedRemoveHeading");
 
 1236                $this->tpl->setContent($cgui->getHTML());
 
 1242                $q_id = (int)$_REQUEST[
"q_id"];         
 
 1245                        $this->ctrl->redirect($this, 
"questions");
 
 1248                $this->
object->saveHeading(
"", $q_id);
 
 1249                $this->ctrl->redirect($this, 
"questions");
 
 1271                if(!$current_title = (
int) $_REQUEST[
'export_label']) {
 
 1272                        $current_title = $this->
object->getShowQuestionTitles();
 
 1282                include_once 
"Services/Form/classes/class.ilSelectInputGUI.php";
 
 1283                $label = 
new ilSelectInputGUI($this->lng->txt(
"title").
"/".$this->lng->txt(
"label"), 
"export_label");
 
 1284                $label->setOptions(array(
 
 1287                        1 => $this->lng->txt(
'svy_print_title_only'), 
 
 1288                        2 => $this->lng->txt(
'svy_print_label_only'),                   
 
 1289                        3 => $this->lng->txt(
'svy_print_title_label')
 
 1291                $label->setValue($current_title);
 
 1292                $ilToolbar->addStickyItem($label, 
true);
 
 1294                $ilToolbar->setFormAction($this->ctrl->getFormAction($this, 
"printView"));
 
 1296                include_once 
"Services/UIComponent/Button/classes/class.ilSubmitButton.php";
 
 1298                $button->setCaption(
"show");
 
 1299                $button->setCommand(
"printView");                       
 
 1300                $ilToolbar->addStickyItem($button);
 
 1302                $ilToolbar->addSeparator();
 
 1304                include_once 
"Services/UIComponent/Button/classes/class.ilLinkButton.php";
 
 1306                $button->setCaption(
"print");                                                           
 
 1307                $button->setOnClick(
"window.print(); return false;");                           
 
 1308                $button->setOmitPreventDoubleSubmission(
true);
 
 1309                $ilToolbar->addButtonInstance($button);                         
 
 1311                include_once 
'./Services/WebServices/RPC/classes/class.ilRPCServerSettings.php';
 
 1314                        $this->ctrl->setParameter($this, 
"export_label", $current_title);
 
 1315                        $this->ctrl->setParameter($this, 
"pdf", 
"1");
 
 1316                        $pdf_url = $this->ctrl->getLinkTarget($this, 
"printView");
 
 1317                        $this->ctrl->setParameter($this, 
"pdf", 
"");
 
 1318                        $this->ctrl->setParameter($this, 
"export_label", 
"");
 
 1321                        $button->setCaption(
"pdf_export");                                                              
 
 1322                        $button->setUrl($pdf_url);                              
 
 1323                        $button->setOmitPreventDoubleSubmission(
true);
 
 1324                        $ilToolbar->addButtonInstance($button); 
 
 1328                if (array_key_exists(
"pdf", 
$_GET) && (
$_GET[
"pdf"] == 1))
 
 1330                        require_once(
'Services/MathJax/classes/class.ilMathJax.php');
 
 1334                $template = 
new ilTemplate(
"tpl.il_svy_svy_printview.html", TRUE, TRUE, 
"Modules/Survey");
 
 1336                $pages =& $this->
object->getSurveyPages();
 
 1338                foreach ($pages as $page)
 
 1340                        if (count($page) > 0)
 
 1342                                foreach ($page as $question)
 
 1344                                        $questionGUI = $this->
object->getQuestionGUI($question[
"type_tag"], $question[
"question_id"]);
 
 1345                                        if (is_object($questionGUI))
 
 1347                                                if (strlen($question[
"heading"]))
 
 1349                                                        $template->setCurrentBlock(
"textblock");
 
 1350                                                        $template->setVariable(
"TEXTBLOCK", $question[
"heading"]);
 
 1351                                                        $template->parseCurrentBlock();
 
 1353                                                $template->setCurrentBlock(
"question");
 
 1354                                                $template->setVariable(
"QUESTION_DATA", $questionGUI->getPrintView($current_title, $question[
"questionblock_show_questiontext"], $this->object->getSurveyId()));
 
 1355                                                $template->parseCurrentBlock();
 
 1357                                                if($question[
"obligatory"])
 
 1363                                if (count($page) > 1 && $page[0][
"questionblock_show_blocktitle"])
 
 1365                                        $template->setCurrentBlock(
"page");
 
 1366                                        $template->setVariable(
"BLOCKTITLE", $page[0][
"questionblock_title"]);
 
 1367                                        $template->parseCurrentBlock();
 
 1371                                        $template->setCurrentBlock(
"page");
 
 1372                                        $template->parseCurrentBlock();
 
 1380                        $template->setVariable(
"TEXT_REQUIRED", $this->lng->txt(
"required_field"));
 
 1384                if (array_key_exists(
"pdf", 
$_GET) && (
$_GET[
"pdf"] == 1))
 
 1386                        $printbody = 
new ilTemplate(
"tpl.il_as_tst_print_body.html", TRUE, TRUE, 
"Modules/Test");
 
 1387                        $printbody->setVariable(
"TITLE", 
sprintf($this->lng->txt(
"tst_result_user_name"), $uname));
 
 1388                        $printbody->setVariable(
"ADM_CONTENT", $template->get());
 
 1389                        $printoutput = $printbody->get();
 
 1390                        $printoutput = preg_replace(
"/href=\".*?\"/", 
"", $printoutput);                
 
 1391                        $fo = $this->
object->processPrintoutput2FO($printoutput);
 
 1394                        require_once(
'Services/MathJax/classes/class.ilMathJax.php');
 
 1398                                ->insertLatexImages($fo);
 
 1401                        if(!$fo || !$this->object->deliverPDFfromFO($fo))
 
 1404                                $this->ctrl->redirect($this, 
"printView");
 
 1409                        $this->tpl->setVariable(
"ADM_CONTENT", $template->get());
 
sprintf('%.4f', $callTime)
An exception for terminatinating execution or to throw for unit testing.
static _getQuestionGUI($questiontype, $question_id=-1)
Creates a question gui representation.
static _getQuestionTypeName($type_tag)
Return the translation for a given question type tag.
static _changeOriginalId($a_question_id, $a_original_id, $a_object_id)
Change original id of existing question in db.
Confirmation screen class.
static getInstance()
Singleton: get instance.
const PURPOSE_DEFERRED_PDF
const RENDER_PNG_AS_FO_FILE
static _getUsedHTMLTagsAsString($a_module="")
Returns a string of all allowed HTML tags for text editing.
static _getUsedHTMLTags($a_module="")
Returns an array of all allowed HTML tags for text editing.
static _getQuestiontypes()
Creates a list of all available question types.
static _instanciateQuestion($question_id)
Creates an instance of a question with a given question id.
static _hasDatasets($survey_id)
static _getQuestionblock($questionblock_id)
Returns the database row for a given question block.
static _lookupObjId($a_id)
static getInstance()
Get singelton instance.
const ILIAS_IMG_MANAGER_PLUGIN
This class represents an option in a radio group.
Settings template application class.
filterQuestionblockBrowserObject()
editHeadingObject(ilPropertyFormGUI $a_form=null)
browseForQuestionblocksObject()
initHeadingForm($a_question_id=null)
resetfilterQuestionBrowserObject()
saveDefineQuestionblockObject()
removeQuestionsForm($checked_questionblocks, $checked_questions, $checked_headings)
insertQuestionsBeforeObject()
confirmRemoveQuestionsObject()
copyQuestionsToPoolObject()
insertQuestionblocksObject()
filterQuestionBrowserObject()
addHeadingObject(ilPropertyFormGUI $a_form=null)
executeCreateQuestionObject()
createQuestionblockObject(ilPropertyFormGUI $a_form=null)
executeCopyQuestionsToPoolObject()
__construct(ilObjSurveyGUI $a_parent_gui)
setBrowseForQuestionsSubtabs()
gatherSelectedTableItems($allow_blocks=true, $allow_questions=true, $allow_headings=false, $allow_questions_in_blocks=false)
Gather (and filter) selected items from table gui.
unfoldQuestionblockObject()
browseForQuestionsObject()
resetfilterQuestionblockBrowserObject()
createQuestionPool($name="dummy")
insertQuestions($insert_mode)
insertQuestionsAfterObject()
initQuestionblockForm($a_block_id=null, $a_question_ids=null)
editQuestionblockObject(ilPropertyFormGUI $a_form=null)
confirmedRemoveHeadingObject()
createQuestionObject(ilPropertyFormGUI $a_form=null)
printViewObject()
Creates a print view of the survey questions.
Survey question table GUI class.
special template class to simplify handling of ITX/PEAR
This class represents a text area property in a property form.
This class represents a text property in a property form.
static sendQuestion($a_info="", $a_keep=false)
Send Question to Screen.
static sendSuccess($a_info="", $a_keep=false)
Send Success Message to Screen.
static sendFailure($a_info="", $a_keep=false)
Send Failure Message to Screen.
static stripSlashes($a_str, $a_strip_html=true, $a_allow="")
strip slashes if magic qoutes is enabled
static sendInfo($a_info="", $a_keep=false)
Send Info Message to Screen.
if(!is_array($argv)) $options