/** * Creates an output for the addition of phrases * * @access public */ function wizardcolumns($save_post_data = true) { if ($save_post_data) { $result = $this->writePostData(); } if ($result == 0) { if ($save_post_data) { $this->object->saveToDb(); } $this->tpl->addBlockFile("ADM_CONTENT", "adm_content", "tpl.il_svy_qpl_addphrase.html", "Modules/SurveyQuestionPool"); // set the id to return to the selected question $this->tpl->setCurrentBlock("hidden"); $this->tpl->setVariable("HIDDEN_NAME", "id"); $this->tpl->setVariable("HIDDEN_VALUE", $this->object->getId()); $this->tpl->parseCurrentBlock(); include_once "./Modules/SurveyQuestionPool/classes/class.ilSurveyPhrases.php"; $phrases =& ilSurveyPhrases::_getAvailablePhrases(); $colors = array("tblrow1", "tblrow2"); $counter = 0; foreach ($phrases as $phrase_id => $phrase_array) { $this->tpl->setCurrentBlock("phraserow"); $this->tpl->setVariable("COLOR_CLASS", $colors[$counter++ % 2]); $this->tpl->setVariable("PHRASE_VALUE", $phrase_id); $this->tpl->setVariable("PHRASE_NAME", $phrase_array["title"]); $categories =& ilSurveyPhrases::_getCategoriesForPhrase($phrase_id); $this->tpl->setVariable("PHRASE_CONTENT", join($categories, ",")); $this->tpl->parseCurrentBlock(); } $this->tpl->setCurrentBlock("adm_content"); $this->tpl->setVariable("TEXT_CANCEL", $this->lng->txt("cancel")); $this->tpl->setVariable("TEXT_PHRASE", $this->lng->txt("phrase")); $this->tpl->setVariable("TEXT_CONTENT", $this->lng->txt("categories")); $this->tpl->setVariable("TEXT_ADD_PHRASE", $this->lng->txt("add_phrase")); $this->tpl->setVariable("TEXT_INTRODUCTION", $this->lng->txt("add_phrase_introduction")); $this->tpl->setVariable("FORM_ACTION", $this->ctrl->getFormAction($this)); $this->tpl->parseCurrentBlock(); } }
protected function initPhrasesForm() { include_once "./Services/Form/classes/class.ilPropertyFormGUI.php"; $form = new ilPropertyFormGUI(); $form->setFormAction($this->ctrl->getFormAction($this, "addSelectedPhrase")); $form->setTitle($this->lng->txt("add_phrase")); // $form->setDescription($this->lng->txt("add_phrase_introduction")); $group = new ilRadioGroupInputGUI($this->lng->txt("phrase"), "phrases"); $group->setRequired(true); $form->addItem($group); include_once "./Modules/SurveyQuestionPool/classes/class.ilSurveyPhrases.php"; foreach (ilSurveyPhrases::_getAvailablePhrases() as $phrase_id => $phrase_array) { $categories = ilSurveyPhrases::_getCategoriesForPhrase($phrase_id); $opt = new ilRadioOption($phrase_array["title"], $phrase_id); $opt->setInfo(join($categories, ",")); $group->addOption($opt); if ($phrase_array["org_title"] == "dp_standard_numbers") { $min = new ilNumberInputGUI($this->lng->txt("lower_limit"), "lower_limit"); $min->setRequired(true); $min->setSize(5); $opt->addSubItem($min); $max = new ilNumberInputGUI($this->lng->txt("upper_limit"), "upper_limit"); $max->setRequired(true); $max->setSize(5); $opt->addSubItem($max); } } $form->addCommandButton("addSelectedPhrase", $this->lng->txt("add_phrase")); $form->addCommandButton("editQuestion", $this->lng->txt("cancel")); return $form; }
/** * Creates a confirmation form to delete personal phases from the database * * @param array $checked_phrases An array with the id's of the phrases checked for deletion */ public function deletePhrasesForm($checked_phrases) { include_once "./Modules/SurveyQuestionPool/classes/tables/class.ilSurveyPhrasesTableGUI.php"; $table_gui = new ilSurveyPhrasesTableGUI($this, 'phrases', true); $phrases =& ilSurveyPhrases::_getAvailablePhrases(1); $data = array(); foreach ($checked_phrases as $phrase_id) { $phrase_array = $phrases[$phrase_id]; $categories =& ilSurveyPhrases::_getCategoriesForPhrase($phrase_id); array_push($data, array('phrase_id' => $phrase_id, 'phrase' => $phrase_array["title"], 'answers' => join($categories, ", "))); } $table_gui->setData($data); $this->tpl->setVariable('ADM_CONTENT', $table_gui->getHTML()); }