54 include_once
"./Modules/SurveyQuestionPool/classes/class.ilSurveyPhrases.php";
59 $this->gui_object =& $a_object;
62 $this->ref_id = $a_object->ref_id;
63 $this->ctrl->saveParameter($this,
"p_id");
71 $cmd = $this->ctrl->getCmd();
72 $next_class = $this->ctrl->getNextClass($this);
99 $checked_phrases =
$_POST[
'phrase'];
100 if (count($checked_phrases))
123 if ($rbacsystem->checkAccess(
"write", $this->ref_id))
125 include_once
"./Modules/SurveyQuestionPool/classes/tables/class.ilSurveyPhrasesTableGUI.php";
129 foreach ($phrases as $phrase_id => $phrase_array)
132 array_push(
$data, array(
'phrase_id' => $phrase_id,
'phrase' => $phrase_array[
"title"],
'answers' => join($categories,
", ")));
134 $table_gui->setData(
$data);
135 $this->tpl->setVariable(
'ADM_CONTENT', $table_gui->getHTML());
148 $this->ctrl->redirect($this,
"phrases");
156 $phrases =
$_POST[
'phrase'];
157 $this->
object->deletePhrases($phrases);
159 $this->ctrl->redirect($this,
"phrases");
166 include_once
"./Modules/SurveyQuestionPool/classes/class.SurveyCategories.php";
168 $result = $ilDB->queryF(
"SELECT svy_category.title, svy_category.neutral, svy_phrase_cat.sequence FROM svy_phrase_cat, svy_category WHERE svy_phrase_cat.phrase_fi = %s AND svy_phrase_cat.category_fi = svy_category.category_id ORDER BY svy_phrase_cat.sequence ASC",
172 if ($result->numRows() > 0)
174 while (
$data = $ilDB->fetchAssoc($result))
176 $categories->addCategory(
$data[
"title"], 0,
$data[
"neutral"], null,
$data[
'sequence']);
186 $result = $ilDB->queryF(
"SELECT svy_phrase.title FROM svy_phrase WHERE svy_phrase.phrase_id = %s",
190 if ($result->numRows() > 0)
192 $row = $ilDB->fetchAssoc($result);
193 return $row[
'title'];
205 include_once
"./Modules/SurveyQuestionPool/classes/tables/class.ilSurveyPhrasesTableGUI.php";
209 foreach ($checked_phrases as $phrase_id)
211 $phrase_array = $phrases[$phrase_id];
213 array_push(
$data, array(
'phrase_id' => $phrase_id,
'phrase' => $phrase_array[
"title"],
'answers' => join($categories,
", ")));
215 $table_gui->setData(
$data);
216 $this->tpl->setVariable(
'ADM_CONTENT', $table_gui->getHTML());
221 $this->ctrl->redirect($this,
'phrases');
231 $this->
object->updatePhrase(
$_GET[
'p_id']);
236 $this->
object->savePhrase();
239 $this->ctrl->redirect($this,
'phrases');
252 $hasErrors = (!$always) ? $this->
phraseEditor(
true) :
false;
255 $this->
object->title =
$_POST[
"title"];
256 include_once
"./Modules/SurveyQuestionPool/classes/class.SurveyCategories.php";
258 foreach (
$_POST[
'answers'][
'answer'] as $key => $value)
260 if (strlen($value)) $categories->addCategory($value,
$_POST[
'answers'][
'other'][$key], 0, null,
$_POST[
'answers'][
'scale'][$key]);
262 if (strlen(
$_POST[
'answers'][
'neutral']))
264 $categories->addCategory(
$_POST[
'answers'][
'neutral'], 0, 1, null,
$_POST[
'answers_neutral_scale']);
266 $this->
object->categories = $categories;
277 $this->ctrl->redirect($this,
'phraseEditor');
282 if (!array_key_exists(
'phrase',
$_POST))
285 $this->ctrl->redirect($this,
'phrases');
287 if ((array_key_exists(
'phrase',
$_POST)) && count(
$_POST[
'phrase']) > 1)
290 $this->ctrl->redirect($this,
'phrases');
292 $phrase_id = (array_key_exists(
'phrase',
$_POST)) ?
$_POST[
'phrase'][key(
$_POST[
'phrase'])] : null;
295 $this->ctrl->setParameter($this,
'p_id', $phrase_id);
297 $this->ctrl->redirect($this,
'phraseEditor');
302 $save = (strcmp($this->ctrl->getCmd(),
"saveEditPhrase") == 0) ? TRUE : FALSE;
304 include_once(
"./Services/Form/classes/class.ilPropertyFormGUI.php");
306 $form->setFormAction($this->ctrl->getFormAction($this,
'phraseEditor'));
307 $form->setTitle($this->lng->txt(
'edit_phrase'));
308 $form->setMultipart(FALSE);
309 $form->setTableWidth(
"100%");
310 $form->setId(
"phraseeditor");
312 $phrase_id =
$_GET[
'p_id'];
317 $title->setRequired(TRUE);
321 include_once
"./Modules/SurveyQuestionPool/classes/class.ilCategoryWizardInputGUI.php";
324 $answers->setAllowMove(
true);
325 $answers->setShowWizard(
false );
326 $answers->setShowSavePhrase(
false);
327 $answers->setUseOtherAnswer(
false);
328 $answers->setShowNeutralCategory(
true);
329 $answers->setNeutralCategoryTitle($this->lng->txt(
'matrix_neutral_answer'));
330 include_once
"./Modules/SurveyQuestionPool/classes/class.SurveyCategories.php";
332 if (!$categories->getCategoryCount())
334 $categories->addCategory(
"");
336 $answers->setValues($categories);
337 $answers->setDisabledScale(
true);
338 $form->addItem($answers);
340 $form->addCommandButton(
"saveEditPhrase", $this->lng->txt(
"save"));
341 $form->addCommandButton(
"cancelEditPhrase", $this->lng->txt(
"cancel"));
347 $form->setValuesByPost();
348 $errors = !$form->checkInput();
349 $form->setValuesByPost();
350 if (
$errors) $checkonly =
false;
353 if (!$checkonly) $this->tpl->setVariable(
"ADM_CONTENT", $form->getHTML());