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))
 
  121                 global $rbacsystem, $ilToolbar;
 
  123                 $this->ctrl->setParameter($this, 
"p_id", 
"");
 
  125                 if ($rbacsystem->checkAccess(
"write", $this->ref_id))
 
  127                         $ilToolbar->addButton($this->lng->txt(
'phrase_new'), 
 
  128                                 $this->ctrl->getLinkTarget($this, 
'newPhrase'));
 
  130                         include_once 
"./Modules/SurveyQuestionPool/classes/tables/class.ilSurveyPhrasesTableGUI.php";
 
  134                         foreach ($phrases as $phrase_id => $phrase_array)
 
  137                                 array_push($data, array(
'phrase_id' => $phrase_id, 
'phrase' => $phrase_array[
"title"], 
'answers' => join($categories, 
", ")));
 
  139                         $table_gui->setData($data);
 
  140                         $this->tpl->setContent($table_gui->getHTML());  
 
  153                 $this->ctrl->redirect($this, 
"phrases");
 
  161                 $phrases = 
$_POST[
'phrase'];
 
  162                 $this->
object->deletePhrases($phrases);
 
  164                 $this->ctrl->redirect($this, 
"phrases");
 
  171                 include_once 
"./Modules/SurveyQuestionPool/classes/class.SurveyCategories.php";
 
  173                 $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",
 
  179                         while ($data = $ilDB->fetchAssoc(
$result)) 
 
  181                                 $categories->addCategory($data[
"title"], 0, $data[
"neutral"], null, $data[
'sequence']);
 
  191                 $result = $ilDB->queryF(
"SELECT svy_phrase.title FROM svy_phrase WHERE svy_phrase.phrase_id = %s",
 
  198                         return $row[
'title'];
 
  210                 include_once 
"./Modules/SurveyQuestionPool/classes/tables/class.ilSurveyPhrasesTableGUI.php";
 
  214                 foreach ($checked_phrases as $phrase_id)
 
  216                         $phrase_array = $phrases[$phrase_id];
 
  218                         array_push($data, array(
'phrase_id' => $phrase_id, 
'phrase' => $phrase_array[
"title"], 
'answers' => join($categories, 
", ")));
 
  220                 $table_gui->setData($data);
 
  221                 $this->tpl->setVariable(
'ADM_CONTENT', $table_gui->getHTML());  
 
  226                 $this->ctrl->redirect($this, 
'phrases');
 
  236                                 $this->
object->updatePhrase(
$_GET[
'p_id']);
 
  241                                 $this->
object->savePhrase();
 
  244                         $this->ctrl->redirect($this, 
'phrases');
 
  257                 $hasErrors = (!$always) ? $this->
phraseEditor(
true) : 
false;
 
  260                         $this->
object->title = 
$_POST[
"title"];
 
  261                         include_once 
"./Modules/SurveyQuestionPool/classes/class.SurveyCategories.php";
 
  263                         foreach (
$_POST[
'answers'][
'answer'] as $key => $value) 
 
  265                                 if (strlen($value)) $categories->addCategory($value, 
$_POST[
'answers'][
'other'][$key], 0, null, 
$_POST[
'answers'][
'scale'][$key]);
 
  267                         if (strlen(
$_POST[
'answers'][
'neutral']))
 
  269                                 $categories->addCategory(
$_POST[
'answers'][
'neutral'], 0, 1, null, 
$_POST[
'answers_neutral_scale']);
 
  271                         $this->
object->categories = $categories;
 
  282                 $this->ctrl->redirect($this, 
'phraseEditor');
 
  287                 if (!array_key_exists(
'phrase', 
$_POST))
 
  290                         $this->ctrl->redirect($this, 
'phrases');
 
  292                 if ((array_key_exists(
'phrase', 
$_POST)) && count(
$_POST[
'phrase']) > 1)
 
  295                         $this->ctrl->redirect($this, 
'phrases');
 
  297                 $phrase_id = (array_key_exists(
'phrase', 
$_POST)) ? 
$_POST[
'phrase'][key(
$_POST[
'phrase'])] : null;
 
  300                         $this->ctrl->setParameter($this, 
'p_id', $phrase_id);
 
  302                 $this->ctrl->redirect($this, 
'phraseEditor');
 
  307                 $save = (strcmp($this->ctrl->getCmd(), 
"saveEditPhrase") == 0) ? TRUE : FALSE;
 
  309                 include_once(
"./Services/Form/classes/class.ilPropertyFormGUI.php");
 
  311                 $form->setFormAction($this->ctrl->getFormAction($this, 
'phraseEditor'));
 
  312                 $form->setTitle($this->lng->txt(
'edit_phrase'));
 
  313                 $form->setMultipart(FALSE);
 
  314                 $form->setTableWidth(
"100%");
 
  315                 $form->setId(
"phraseeditor");
 
  317                 $phrase_id = 
$_GET[
'p_id'];
 
  322                 $title->setRequired(TRUE);
 
  323                 $form->addItem($title);
 
  326                 include_once 
"./Modules/SurveyQuestionPool/classes/class.ilCategoryWizardInputGUI.php";
 
  329                 $answers->setAllowMove(
true);
 
  330                 $answers->setShowWizard(
false );
 
  331                 $answers->setShowSavePhrase(
false);
 
  332                 $answers->setUseOtherAnswer(
false);
 
  333                 $answers->setShowNeutralCategory(
true);
 
  334                 $answers->setNeutralCategoryTitle($this->lng->txt(
'matrix_neutral_answer'));
 
  335                 include_once 
"./Modules/SurveyQuestionPool/classes/class.SurveyCategories.php";
 
  337                 if (!$categories->getCategoryCount())
 
  339                         $categories->addCategory(
"");
 
  341                 $answers->setValues($categories);
 
  342                 $answers->setDisabledScale(
true);
 
  343                 $form->addItem($answers);
 
  345                 $form->addCommandButton(
"saveEditPhrase", $this->lng->txt(
"save"));
 
  346                 $form->addCommandButton(
"cancelEditPhrase", $this->lng->txt(
"cancel"));
 
  352                         $form->setValuesByPost();
 
  353                         $errors = !$form->checkInput();
 
  354                         $form->setValuesByPost(); 
 
  355                         if (
$errors) $checkonly = 
false;
 
  358                 if (!$checkonly) $this->tpl->setVariable(
"ADM_CONTENT", $form->getHTML());