/**
  * Creates an output to save the current answers as a phrase
  *
  * @access public
  */
 function savePhrase($a_reload = false)
 {
     global $ilTabs, $ilToolbar;
     $ilTabs->activateTab("edit_properties");
     if (!$a_reload) {
         $result = $this->saveForm();
         if ($result) {
             $this->object->saveToDb();
         }
     }
     include_once "./Services/Form/classes/class.ilTextInputGUI.php";
     $txt = new ilTextInputGUI($this->lng->txt("enter_phrase_title"), "phrase_title");
     $ilToolbar->addInputItem($txt, true);
     $ilToolbar->addFormButton($this->lng->txt("confirm"), "confirmSavePhrase");
     $ilToolbar->setFormAction($this->ctrl->getFormAction($this));
     include_once "./Modules/SurveyQuestionPool/classes/tables/class.ilSurveySavePhraseTableGUI.php";
     $table_gui = new ilSurveySavePhraseTableGUI($this, 'editQuestion');
     $table_gui->setDescription($this->lng->txt("save_phrase_introduction"));
     // matrix?
     if (method_exists($this->object, "getCategories")) {
         $categories = $this->object->getCategories();
     } else {
         $categories = $this->object->getColumns();
     }
     $data = array();
     for ($i = 0; $i < $categories->getCategoryCount(); $i++) {
         $cat = $categories->getCategory($i);
         $data[] = array("answer" => $cat->title, "other" => $cat->other, "scale" => $cat->scale, "neutral" => $cat->neutral);
     }
     $table_gui->setData($data);
     $_SESSION['save_phrase_data'] = $data;
     // :TODO: see savePhrase()
     $this->tpl->setContent($table_gui->getHTML());
 }
 /**
  * Creates an output to save the current answers as a phrase
  *
  * @access public
  */
 function savePhrasecolumns($haserror = false)
 {
     if (!$haserror) {
         $result = $this->writePostData();
     }
     if ($result == 0 || $haserror) {
         if (!$haserror) {
             $this->object->saveToDb();
         }
         $this->tpl->addBlockFile("ADM_CONTENT", "adm_content", "tpl.il_svy_qpl_savephrase.html", "Modules/SurveyQuestionPool");
         $this->tpl->setCurrentBlock("adm_content");
         $this->tpl->setVariable("SAVE_PHRASE_INTRODUCTION", $this->lng->txt("save_phrase_introduction"));
         $this->tpl->setVariable("TEXT_PHRASE_TITLE", $this->lng->txt("enter_phrase_title"));
         $this->tpl->setVariable("VALUE_PHRASE_TITLE", $_POST["phrase_title"]);
         $this->tpl->setVariable("BTN_CANCEL", $this->lng->txt("cancel"));
         $this->tpl->setVariable("BTN_CONFIRM", $this->lng->txt("confirm"));
         $this->tpl->setVariable("FORM_ACTION", $this->ctrl->getFormAction($this));
         include_once "./Modules/SurveyQuestionPool/classes/tables/class.ilSurveySavePhraseTableGUI.php";
         $table_gui = new ilSurveySavePhraseTableGUI($this, 'editQuestion');
         $data = array();
         if (!$haserror) {
             foreach ($_POST['columns']['answer'] as $key => $value) {
                 array_push($data, array('answer' => $value, 'other' => $_POST['columns']['other'][$key] ? true : false, 'scale' => $_POST['columns']['scale'][$key], 'neutral' => false));
             }
             if (strlen($_POST['columns']['neutral'])) {
                 array_push($data, array('answer' => $_POST['columns']['neutral'], 'other' => false, 'scale' => $_POST['columns_neutral_scale'], 'neutral' => true));
             }
         } else {
             $data = $_SESSION['save_phrase_data'];
         }
         $table_gui->setData($data);
         $_SESSION['save_phrase_data'] = $data;
         $this->tpl->setVariable('TABLE', $table_gui->getHTML());
         $this->tpl->parseCurrentBlock();
     }
 }