24 include_once 
"./Modules/SurveyQuestionPool/classes/class.SurveyQuestionGUI.php";
 
   25 include_once 
"./Modules/Survey/classes/inc.SurveyConstants.php";
 
   56                 include_once 
"./Modules/SurveyQuestionPool/classes/class.SurveyMatrixQuestion.php";
 
   58                 $this->show_layout_row = FALSE;
 
   61                         $this->
object->loadFromDb($id);
 
   70                 $cmd = $this->ctrl->getCmd();
 
   71                 $next_class = $this->ctrl->getNextClass($this);
 
   91                 $hasErrors = (!$always) ? $this->
editQuestion(
true) : 
false;
 
   94                         $this->
object->setTitle(
$_POST[
"title"]);
 
   95                         $this->
object->label = 
$_POST[
'label'];
 
   96                         $this->
object->setAuthor(
$_POST[
"author"]);
 
   97                         $this->
object->setDescription(
$_POST[
"description"]);
 
   98                         $questiontext = 
$_POST[
"question"];
 
   99                         $this->
object->setQuestiontext($questiontext);
 
  100                         $this->
object->setObligatory((
$_POST[
"obligatory"]) ? 1 : 0);
 
  101                         $this->
object->setSubtype(
$_POST[
"type"]);
 
  102                         $this->
object->setRowSeparators((
$_POST[
"row_separators"]) ? 1 : 0);
 
  103                         $this->
object->setColumnSeparators((
$_POST[
"column_separators"]) ? 1 : 0);
 
  104                         $this->
object->setNeutralColumnSeparator((
$_POST[
"neutral_column_separator"]) ? 1 : 0);
 
  106                         $this->
object->setBipolarAdjective(0, 
$_POST[
"bipolar1"]);
 
  107                         $this->
object->setBipolarAdjective(1, 
$_POST[
"bipolar2"]);
 
  109                         $this->
object->flushColumns();
 
  110                         foreach (
$_POST[
'columns'][
'answer'] as $key => $value)
 
  112                                 if (strlen($value)) $this->
object->getColumns()->addCategory($value, 
$_POST[
'columns'][
'other'][$key], 0, null, 
$_POST[
'columns'][
'scale'][$key]);
 
  114                         if (strlen(
$_POST[
"columns"][
"neutral"]))
 
  116                                 $this->
object->getColumns()->addCategory(
$_POST[
'columns'][
'neutral'], 0, 1, null, 
$_POST[
'columns_neutral_scale']);
 
  119                         $this->
object->flushRows();
 
  120                         foreach (
$_POST[
'rows'][
'answer'] as $key => $value)
 
  122                                 if (strlen($value)) $this->
object->getRows()->addCategory($value, 
$_POST[
'rows'][
'other'][$key], 0, 
$_POST[
'rows'][
'label'][$key]);
 
  139                 include_once(
"./Services/Form/classes/class.ilPropertyFormGUI.php");
 
  141                 $form->setFormAction($this->ctrl->getFormAction($this));
 
  142                 $form->setTitle($this->lng->txt($this->getQuestionType()));
 
  143                 $form->setMultipart(FALSE);
 
  144                 $form->setTableWidth(
"100%");
 
  145                 $form->setId(
"multiplechoice");
 
  149                 $title->setValue($this->object->getTitle());
 
  150                 $title->setRequired(TRUE);
 
  155                 $label->
setValue($this->object->label);
 
  156                 $label->setInfo($this->lng->txt(
"label_info"));
 
  157                 $label->setRequired(
false);
 
  158                 $form->addItem($label);
 
  161                 $author = 
new ilTextInputGUI($this->lng->txt(
"author"), 
"author");
 
  162                 $author->
setValue($this->object->getAuthor());
 
  163                 $author->setRequired(TRUE);
 
  164                 $form->addItem($author);
 
  167                 $description = 
new ilTextInputGUI($this->lng->txt(
"description"), 
"description");
 
  168                 $description->
setValue($this->object->getDescription());
 
  169                 $description->setRequired(FALSE);
 
  170                 $form->addItem($description);
 
  174                 $question->
setValue($this->object->prepareTextareaOutput($this->object->getQuestiontext()));
 
  175                 $question->setRequired(TRUE);
 
  176                 $question->setRows(10);
 
  177                 $question->setCols(80);
 
  178                 $question->setUseRte(TRUE);
 
  179                 include_once 
"./Services/AdvancedEditing/classes/class.ilObjAdvancedEditing.php";
 
  181                 $question->addPlugin(
"latex");
 
  182                 $question->addButton(
"latex");
 
  183                 $question->addButton(
"pastelatex");
 
  184                 $question->setRTESupport($this->object->getId(), 
"spl", 
"survey", null, 
false, 
"3.4.7");
 
  185                 $form->addItem($question);
 
  190                 $subtype->setValue($this->object->getSubtype());
 
  192                         "0" => 
"matrix_subtype_sr",
 
  193                         "1" => 
"matrix_subtype_mr",
 
  200                 foreach ($subtypes as $idx => $st)
 
  202                         $subtype->addOption(
new ilRadioOption($this->lng->txt($st), $idx));
 
  204                 $form->addItem($subtype);
 
  209                 $shuffle->setChecked($this->object->getObligatory());
 
  210                 $shuffle->setRequired(FALSE);
 
  211                 $form->addItem($shuffle);
 
  214                 $header->setTitle($this->lng->txt(
"matrix_appearance"));
 
  215                 $form->addItem($header);
 
  218                 $column_separators = 
new ilCheckboxInputGUI($this->lng->txt(
"matrix_column_separators"), 
"column_separators");
 
  220                 $column_separators->setInfo($this->lng->txt(
"matrix_column_separators_description"));
 
  221                 $column_separators->setChecked($this->object->getColumnSeparators());
 
  222                 $column_separators->setRequired(
false);
 
  223                 $form->addItem($column_separators);
 
  226                 $row_separators = 
new ilCheckboxInputGUI($this->lng->txt(
"matrix_row_separators"), 
"row_separators");
 
  228                 $row_separators->setInfo($this->lng->txt(
"matrix_row_separators_description"));
 
  229                 $row_separators->setChecked($this->object->getRowSeparators());
 
  230                 $row_separators->setRequired(
false);
 
  231                 $form->addItem($row_separators);
 
  234                 $neutral_column_separator = 
new ilCheckboxInputGUI($this->lng->txt(
"matrix_neutral_column_separator"), 
"neutral_column_separator");
 
  235                 $neutral_column_separator->
setValue(1);
 
  236                 $neutral_column_separator->setInfo($this->lng->txt(
"matrix_neutral_column_separator_description"));
 
  237                 $neutral_column_separator->setChecked($this->object->getNeutralColumnSeparator());
 
  238                 $neutral_column_separator->setRequired(
false);
 
  239                 $form->addItem($neutral_column_separator);
 
  242                 $header->setTitle($this->lng->txt(
"matrix_columns"));
 
  243                 $form->addItem($header);
 
  246                 include_once 
"./Modules/SurveyQuestionPool/classes/class.ilCategoryWizardInputGUI.php";
 
  251                 $columns->setShowNeutralCategory(
true);
 
  253                 $columns->setNeutralCategoryTitle($this->lng->txt(
'matrix_neutral_answer'));
 
  254                 $columns->setCategoryText($this->lng->txt(
'matrix_standard_answers'));
 
  256                 if (!$this->object->getColumnCount())
 
  258                         $this->
object->columns->addCategory(
"");
 
  260                 $columns->setValues($this->object->getColumns());
 
  264                 $header->setTitle($this->lng->txt(
"matrix_column_settings"));
 
  265                 $form->addItem($header);
 
  268                 $bipolar = 
new ilCustomInputGUI($this->lng->txt(
"matrix_bipolar_adjectives"));
 
  269                 $bipolar->
setInfo($this->lng->txt(
"matrix_bipolar_adjectives_description"));
 
  272                 $bipolar1 = 
new ilTextInputGUI($this->lng->txt(
"matrix_left_pole"), 
"bipolar1");
 
  273                 $bipolar1->
setValue($this->object->getBipolarAdjective(0));
 
  274                 $bipolar1->setRequired(
false);
 
  275                 $bipolar->addSubItem($bipolar1);
 
  278                 $bipolar2 = 
new ilTextInputGUI($this->lng->txt(
"matrix_right_pole"), 
"bipolar2");
 
  279                 $bipolar2->
setValue($this->object->getBipolarAdjective(1));
 
  280                 $bipolar2->setRequired(
false);
 
  281                 $bipolar->addSubItem($bipolar2);
 
  283                 $form->addItem($bipolar);
 
  286                 $header->setTitle($this->lng->txt(
"matrix_rows"));
 
  287                 $form->addItem($header);
 
  290                 include_once 
"./Modules/SurveyQuestionPool/classes/class.ilMatrixRowWizardInputGUI.php";
 
  292                 $rows->setRequired(
false);
 
  293                 $rows->setAllowMove(
true);
 
  294                 $rows->setLabelText($this->lng->txt(
'label'));
 
  295                 $rows->setUseOtherAnswer(
true);
 
  296                 if ($this->object->getRowCount() == 0)
 
  298                         $this->
object->getRows()->addCategory(
"");
 
  300                 $rows->setValues($this->object->getRows());
 
  301                 $form->addItem($rows);
 
  307                 if ($this->
isSaveCommand(array(
"wizardcolumns", 
"savePhrasecolumns")))
 
  309                         $form->setValuesByPost();
 
  310                         $errors = !$form->checkInput();
 
  311                         $form->setValuesByPost(); 
 
  312                         if (
$errors) $checkonly = 
false;
 
  315                 if (!$checkonly) $this->tpl->setVariable(
"ADM_CONTENT", $form->getHTML());
 
  325                 $position = key(
$_POST[
'cmd'][
'addrows']);
 
  326                 $this->
object->addRowAtPosition(
"", 
false, $position+1);
 
  336                 $position = key(
$_POST[
'cmd'][
'removerows']);
 
  337                 $this->
object->removeRow($position);
 
  347                 $position = key(
$_POST[
'cmd'][
'uprows']);
 
  348                 $this->
object->moveRowUp($position);
 
  358                 $position = key(
$_POST[
'cmd'][
'downrows']);
 
  359                 $this->
object->moveRowDown($position);
 
  369                 $position = key(
$_POST[
'cmd'][
'addcolumns']);
 
  370                 $this->
object->getColumns()->addCategoryAtPosition(
"", $position+1);
 
  380                 $position = key(
$_POST[
'cmd'][
'removecolumns']);
 
  381                 $this->
object->getColumns()->removeCategory($position);
 
  391                 $position = key(
$_POST[
'cmd'][
'upcolumns']);
 
  392                 $this->
object->getColumns()->moveCategoryUp($position);
 
  402                 $position = key(
$_POST[
'cmd'][
'downcolumns']);
 
  403                 $this->
object->getColumns()->moveCategoryDown($position);
 
  417                         if (!$haserror) $this->
object->saveToDb();
 
  419                         $this->tpl->addBlockFile(
"ADM_CONTENT", 
"adm_content", 
"tpl.il_svy_qpl_savephrase.html", 
"Modules/SurveyQuestionPool");
 
  420                         $this->tpl->setCurrentBlock(
"adm_content");
 
  421                         $this->tpl->setVariable(
"SAVE_PHRASE_INTRODUCTION", $this->lng->txt(
"save_phrase_introduction"));
 
  422                         $this->tpl->setVariable(
"TEXT_PHRASE_TITLE", $this->lng->txt(
"enter_phrase_title"));
 
  423                         $this->tpl->setVariable(
"VALUE_PHRASE_TITLE", 
$_POST[
"phrase_title"]);
 
  424                         $this->tpl->setVariable(
"BTN_CANCEL",$this->lng->txt(
"cancel"));
 
  425                         $this->tpl->setVariable(
"BTN_CONFIRM",$this->lng->txt(
"confirm"));
 
  426                         $this->tpl->setVariable(
"FORM_ACTION", $this->ctrl->getFormAction($this));
 
  428                         include_once 
"./Modules/SurveyQuestionPool/classes/tables/class.ilSurveySavePhraseTableGUI.php";
 
  434                                 foreach (
$_POST[
'columns'][
'answer'] as $key => $value)
 
  436                                         array_push(
$data, array(
'answer' => $value, 
'other' => ((
$_POST[
'columns'][
'other'][$key]) ? 
true : 
false), 
'scale' => 
$_POST[
'columns'][
'scale'][$key], 
'neutral' => 
false));
 
  438                                 if (strlen(
$_POST[
'columns'][
'neutral']))
 
  440                                         array_push(
$data, array(
'answer' => 
$_POST[
'columns'][
'neutral'], 
'other' => 
false, 
'scale' => 
$_POST[
'columns_neutral_scale'], 
'neutral' => 
true));
 
  447                         $table_gui->setData(
$data);
 
  449                         $this->tpl->setVariable(
'TABLE', $table_gui->getHTML());        
 
  450                         $this->tpl->parseCurrentBlock();
 
  462                 $this->ctrl->redirect($this, 
"editQuestion");
 
  472                 if (!
$_POST[
"phrase_title"])
 
  479                 if ($this->object->phraseExists(
$_POST[
"phrase_title"]))
 
  486                 $this->
object->savePhrase(
$_POST[
"phrase_title"]);
 
  488                 $this->ctrl->redirect($this, 
"editQuestion");
 
  501                         if ($save_post_data) $this->
object->saveToDb();
 
  502                         $this->tpl->addBlockFile(
"ADM_CONTENT", 
"adm_content", 
"tpl.il_svy_qpl_addphrase.html", 
"Modules/SurveyQuestionPool");
 
  505                         $this->tpl->setCurrentBlock(
"hidden");
 
  506                         $this->tpl->setVariable(
"HIDDEN_NAME", 
"id");
 
  507                         $this->tpl->setVariable(
"HIDDEN_VALUE", $this->object->getId());
 
  508                         $this->tpl->parseCurrentBlock();
 
  510                         include_once 
"./Modules/SurveyQuestionPool/classes/class.ilSurveyPhrases.php";
 
  512                         $colors = array(
"tblrow1", 
"tblrow2");
 
  514                         foreach ($phrases as $phrase_id => $phrase_array)
 
  516                                 $this->tpl->setCurrentBlock(
"phraserow");
 
  517                                 $this->tpl->setVariable(
"COLOR_CLASS", $colors[$counter++ % 2]);
 
  518                                 $this->tpl->setVariable(
"PHRASE_VALUE", $phrase_id);
 
  519                                 $this->tpl->setVariable(
"PHRASE_NAME", $phrase_array[
"title"]);
 
  521                                 $this->tpl->setVariable(
"PHRASE_CONTENT", join($categories, 
","));
 
  522                                 $this->tpl->parseCurrentBlock();
 
  525                         $this->tpl->setCurrentBlock(
"adm_content");
 
  526                         $this->tpl->setVariable(
"TEXT_CANCEL", $this->lng->txt(
"cancel"));
 
  527                         $this->tpl->setVariable(
"TEXT_PHRASE", $this->lng->txt(
"phrase"));
 
  528                         $this->tpl->setVariable(
"TEXT_CONTENT", $this->lng->txt(
"categories"));
 
  529                         $this->tpl->setVariable(
"TEXT_ADD_PHRASE", $this->lng->txt(
"add_phrase"));
 
  530                         $this->tpl->setVariable(
"TEXT_INTRODUCTION",$this->lng->txt(
"add_phrase_introduction"));
 
  531                         $this->tpl->setVariable(
"FORM_ACTION", $this->ctrl->getFormAction($this));
 
  532                         $this->tpl->parseCurrentBlock();
 
  544                 $this->ctrl->redirect($this, 
'editQuestion');
 
  554                 if (strcmp(
$_POST[
"phrases"], 
"") == 0)
 
  561                         if (strcmp($this->object->getPhrase(
$_POST[
"phrases"]), 
"dp_standard_numbers") != 0)
 
  563                                 $this->
object->addPhrase(
$_POST[
"phrases"]);
 
  564                                 $this->
object->saveToDb();
 
  572                         $this->ctrl->redirect($this, 
'editQuestion');
 
  583                         $this->tpl->addBlockFile(
"ADM_CONTENT", 
"adm_content", 
"tpl.il_svy_qpl_addphrase_standard_numbers.html", 
"Modules/SurveyQuestionPool");
 
  586                         $this->tpl->setCurrentBlock(
"hidden");
 
  587                         $this->tpl->setVariable(
"HIDDEN_NAME", 
"id");
 
  588                         $this->tpl->setVariable(
"HIDDEN_VALUE", $this->object->getId());
 
  589                         $this->tpl->parseCurrentBlock();
 
  591                         $this->tpl->setCurrentBlock(
"adm_content");
 
  592                         $this->tpl->setVariable(
"ADD_STANDARD_NUMBERS", $this->lng->txt(
"add_standard_numbers"));
 
  593                         $this->tpl->setVariable(
"TEXT_ADD_LIMITS", $this->lng->txt(
"add_limits_for_standard_numbers"));
 
  594                         $this->tpl->setVariable(
"TEXT_LOWER_LIMIT",$this->lng->txt(
"lower_limit"));
 
  595                         $this->tpl->setVariable(
"TEXT_UPPER_LIMIT",$this->lng->txt(
"upper_limit"));
 
  596                         $this->tpl->setVariable(
"VALUE_LOWER_LIMIT", 
$_POST[
"lower_limit"]);
 
  597                         $this->tpl->setVariable(
"VALUE_UPPER_LIMIT", 
$_POST[
"upper_limit"]);
 
  598                         $this->tpl->setVariable(
"BTN_ADD",$this->lng->txt(
"add_phrase"));
 
  599                         $this->tpl->setVariable(
"BTN_CANCEL",$this->lng->txt(
"cancel"));
 
  600                         $this->tpl->setVariable(
"FORM_ACTION", $this->ctrl->getFormAction($this));
 
  601                         $this->tpl->parseCurrentBlock();
 
  612                 $this->ctrl->redirect($this, 
"editQuestion");
 
  622                 if ((strcmp(
$_POST[
"lower_limit"], 
"") == 0) or (strcmp(
$_POST[
"upper_limit"], 
"") == 0))
 
  627                 else if ((
int)
$_POST[
"upper_limit"] <= (
int)
$_POST[
"lower_limit"])
 
  634                         $this->
object->addStandardNumbers($_POST[
"lower_limit"], $_POST[
"upper_limit"]);
 
  635                         $this->
object->saveToDb();
 
  637                         $this->ctrl->redirect($this, 
"editQuestion");
 
  646         function getWorkingForm($working_data = 
"", $question_title = 1, $show_questiontext = 1, $error_message = 
"")
 
  648                 $layout = $this->
object->getLayout();
 
  649                 $neutralstyle = 
"3px solid #808080";
 
  650                 $bordercolor = 
"#808080";
 
  651                 $template = 
new ilTemplate(
"tpl.il_svy_out_matrix.html", TRUE, TRUE, 
"Modules/SurveyQuestionPool");
 
  652                 $template->setCurrentBlock(
"material_matrix");
 
  654                 $template->parseCurrentBlock();
 
  656                 if ($this->show_layout_row)
 
  659                         $template->setCurrentBlock(
"matrix_row");
 
  660                         $template->setVariable(
"ROW", $layout_row);
 
  661                         $template->parseCurrentBlock();
 
  664                 $tplheaders = 
new ilTemplate(
"tpl.il_svy_out_matrix_columnheaders.html", TRUE, TRUE, 
"Modules/SurveyQuestionPool");
 
  665                 if ((strlen($this->object->getBipolarAdjective(0))) && (strlen($this->object->getBipolarAdjective(1))))
 
  667                         $tplheaders->setCurrentBlock(
"bipolar_start");
 
  669                         array_push($style, sprintf(
"width: %.2f%s!important", $layout[
"percent_bipolar_adjective1"], 
"%"));
 
  670                         if (count($style) > 0)
 
  672                                 $tplheaders->setVariable(
"STYLE", 
" style=\"" . implode(
";", $style) . 
"\"");
 
  674                         $tplheaders->parseCurrentBlock();
 
  677                 for ($i = 0; $i < $this->
object->getColumnCount(); $i++)
 
  680                         $col = $this->
object->getColumn($i);
 
  683                                 $tplheaders->setCurrentBlock(
"neutral_column_header");
 
  685                                 $tplheaders->setVariable(
"CLASS", 
"rsep");
 
  687                                 array_push($style, sprintf(
"width: %.2f%s!important", $layout[
"percent_neutral"], 
"%"));
 
  688                                 if ($this->object->getNeutralColumnSeparator())
 
  690                                         array_push($style, 
"border-left: $neutralstyle!important;");
 
  692                                 if (count($style) > 0)
 
  694                                         $tplheaders->setVariable(
"STYLE", 
" style=\"" . implode(
";", $style) . 
"\"");
 
  696                                 $tplheaders->parseCurrentBlock();
 
  700                                 if ($this->object->getColumnSeparators() == 1)
 
  702                                         if (($i < $this->object->getColumnCount() - 1))
 
  704                                                 array_push($style, 
"border-right: 1px solid $bordercolor!important");
 
  707                                 array_push($style, sprintf(
"width: %.2f%s!important", $layout[
"percent_columns"] / $this->object->getColumnCount(), 
"%"));
 
  708                                 $tplheaders->setCurrentBlock(
"column_header");
 
  710                                 $tplheaders->setVariable(
"CLASS", 
"center");
 
  711                                 if (count($style) > 0)
 
  713                                         $tplheaders->setVariable(
"STYLE", 
" style=\"" . implode(
";", $style) . 
"\"");
 
  715                                 $tplheaders->parseCurrentBlock();
 
  718                 if ((strlen($this->object->getBipolarAdjective(0))) && (strlen($this->object->getBipolarAdjective(1))))
 
  720                         $tplheaders->setCurrentBlock(
"bipolar_end");
 
  722                         array_push($style, sprintf(
"width: %.2f%s!important", $layout[
"percent_bipolar_adjective2"], 
"%"));
 
  723                         if (count($style) > 0)
 
  725                                 $tplheaders->setVariable(
"STYLE", 
" style=\"" . implode(
";", $style) . 
"\"");
 
  727                         $tplheaders->parseCurrentBlock();
 
  731                 array_push($style, sprintf(
"width: %.2f%s!important", $layout[
"percent_row"], 
"%"));
 
  732                 if (count($style) > 0)
 
  734                         $tplheaders->setVariable(
"STYLE", 
" style=\"" . implode(
";", $style) . 
"\"");
 
  737                 $template->setCurrentBlock(
"matrix_row");
 
  738                 $template->setVariable(
"ROW", $tplheaders->get());
 
  739                 $template->parseCurrentBlock();
 
  741                 $rowclass = array(
"tblrow1", 
"tblrow2");
 
  742                 for ($i = 0; $i < $this->
object->getRowCount(); $i++)
 
  744                         $rowobj = $this->
object->getRow($i);
 
  745                         $tplrow = 
new ilTemplate(
"tpl.il_svy_out_matrix_row.html", TRUE, TRUE, 
"Modules/SurveyQuestionPool");
 
  746                         for ($j = 0; $j < $this->
object->getColumnCount(); $j++)
 
  748                                 $cat = $this->
object->getColumn($j);
 
  749                                 if (($i == 0) && ($j == 0))
 
  751                                         if ((strlen($this->object->getBipolarAdjective(0))) && (strlen($this->object->getBipolarAdjective(1))))
 
  753                                                 $tplrow->setCurrentBlock(
"bipolar_start");
 
  755                                                 $tplrow->setVariable(
"ROWSPAN", $this->object->getRowCount());
 
  756                                                 $tplrow->parseCurrentBlock();
 
  759                                 if (($i == 0) && ($j == $this->object->getColumnCount()-1))
 
  761                                         if ((strlen($this->object->getBipolarAdjective(0))) && (strlen($this->object->getBipolarAdjective(1))))
 
  763                                                 $tplrow->setCurrentBlock(
"bipolar_end");
 
  765                                                 $tplrow->setVariable(
"ROWSPAN", $this->object->getRowCount());
 
  766                                                 $tplrow->parseCurrentBlock();
 
  769                                 switch ($this->object->getSubtype())
 
  774                                                         $tplrow->setCurrentBlock(
"neutral_radiobutton");
 
  775                                                         $tplrow->setVariable(
"QUESTION_ID", $this->object->getId());
 
  776                                                         $tplrow->setVariable(
"ROW", $i);
 
  777                                                         $tplrow->setVariable(
"VALUE", ($cat->scale) ? ($cat->scale - 1) : $j);
 
  778                                                         if (is_array($working_data))
 
  780                                                                 foreach ($working_data as 
$data)
 
  782                                                                         if (($data[
"value"] == $cat->scale-1) && ($data[
"rowvalue"] == $i))
 
  784                                                                                 $tplrow->setVariable(
"CHECKED_RADIOBUTTON", 
" checked=\"checked\"");
 
  788                                                         $tplrow->parseCurrentBlock();
 
  792                                                         $tplrow->setCurrentBlock(
"radiobutton");
 
  793                                                         $tplrow->setVariable(
"QUESTION_ID", $this->object->getId());
 
  794                                                         $tplrow->setVariable(
"ROW", $i);
 
  795                                                         $tplrow->setVariable(
"VALUE", ($cat->scale) ? ($cat->scale - 1) : $j);
 
  796                                                         if (is_array($working_data))
 
  798                                                                 foreach ($working_data as 
$data)
 
  800                                                                         if (($data[
"value"] == $cat->scale-1) && ($data[
"rowvalue"] == $i))
 
  802                                                                                 $tplrow->setVariable(
"CHECKED_RADIOBUTTON", 
" checked=\"checked\"");
 
  806                                                         $tplrow->parseCurrentBlock();
 
  812                                                         $tplrow->setCurrentBlock(
"neutral_checkbox");
 
  813                                                         $tplrow->setVariable(
"QUESTION_ID", $this->object->getId());
 
  814                                                         $tplrow->setVariable(
"ROW", $i);
 
  815                                                         $tplrow->setVariable(
"VALUE", ($cat->scale) ? ($cat->scale - 1) : $j);
 
  816                                                         if (is_array($working_data))
 
  818                                                                 foreach ($working_data as 
$data)
 
  820                                                                         if (($data[
"value"] == $cat->scale-1) && ($data[
"rowvalue"] == $i))
 
  822                                                                                 $tplrow->setVariable(
"CHECKED_CHECKBOX", 
" checked=\"checked\"");
 
  826                                                         $tplrow->parseCurrentBlock();
 
  830                                                         $tplrow->setCurrentBlock(
"checkbox");
 
  831                                                         $tplrow->setVariable(
"QUESTION_ID", $this->object->getId());
 
  832                                                         $tplrow->setVariable(
"ROW", $i);
 
  833                                                         $tplrow->setVariable(
"VALUE", ($cat->scale) ? ($cat->scale - 1) : $j);
 
  834                                                         if (is_array($working_data))
 
  836                                                                 foreach ($working_data as 
$data)
 
  838                                                                         if (($data[
"value"] == $cat->scale-1) && ($data[
"rowvalue"] == $i))
 
  840                                                                                 $tplrow->setVariable(
"CHECKED_CHECKBOX", 
" checked=\"checked\"");
 
  844                                                         $tplrow->parseCurrentBlock();
 
  850                                         $tplrow->setCurrentBlock(
"neutral_answer");
 
  852                                         if ($this->object->getNeutralColumnSeparator())
 
  854                                                 array_push($style, 
"border-left: $neutralstyle!important");
 
  856                                         if ($this->object->getColumnSeparators() == 1)
 
  858                                                 if ($j < $this->object->getColumnCount() - 1)
 
  860                                                         array_push($style, 
"border-right: 1px solid $bordercolor!important");
 
  866                                         $tplrow->setCurrentBlock(
"answer");
 
  869                                         if ($this->object->getColumnSeparators() == 1)
 
  871                                                 if ($j < $this->object->getColumnCount() - 1)
 
  873                                                         array_push($style, 
"border-right: 1px solid $bordercolor!important");
 
  877                                 if ($this->object->getRowSeparators() == 1)
 
  879                                         if ($i < $this->object->getRowCount() - 1)
 
  881                                                 array_push($style, 
"border-bottom: 1px solid $bordercolor!important");
 
  886                                         $tplrow->setVariable(
"STYLE", 
" style=\"" . implode(
";", $style) . 
"\"");
 
  888                                 $tplrow->parseCurrentBlock();
 
  893                                 $tplrow->setCurrentBlock(
"row_other");
 
  894                                 $tplrow->setVariable(
"QUESTION_ID", $this->object->getId());
 
  895                                 $tplrow->setVariable(
"ROW", $i);
 
  896                                 if (is_array($working_data))
 
  898                                         foreach ($working_data as 
$data)
 
  900                                                 if ($data[
"rowvalue"] == $i)
 
  906                                 $tplrow->parseCurrentBlock();
 
  909                         $tplrow->setVariable(
"ROWCLASS", $rowclass[$i % 2]);
 
  910                         if ($this->object->getRowSeparators() == 1)
 
  912                                 if ($i < $this->object->getRowCount() - 1)
 
  914                                         $tplrow->setVariable(
"STYLE", 
" style=\"border-bottom: 1px solid $bordercolor!important\"");
 
  917                         $template->setCurrentBlock(
"matrix_row");
 
  918                         $template->setVariable(
"ROW", $tplrow->get());
 
  919                         $template->parseCurrentBlock();
 
  926                 $template->setCurrentBlock(
"question_data_matrix");
 
  927                 if (strcmp($error_message, 
"") != 0)
 
  929                         $template->setVariable(
"ERROR_MESSAGE", 
"<p class=\"warning\">$error_message</p>");
 
  931                 if ($show_questiontext)
 
  935                 $template->parseCurrentBlock();
 
  936                 return $template->get();
 
  946                 $layout = $this->
object->getLayout();
 
  947                 $neutralstyle = 
"3px solid #808080";
 
  948                 $bordercolor = 
"#808080";
 
  949                 $template = 
new ilTemplate(
"tpl.il_svy_qpl_matrix_printview.html", TRUE, TRUE, 
"Modules/SurveyQuestionPool");
 
  951                 if ($this->show_layout_row)
 
  954                         $template->setCurrentBlock(
"matrix_row");
 
  955                         $template->setVariable(
"ROW", $layout_row);
 
  956                         $template->parseCurrentBlock();
 
  959                 $tplheaders = 
new ilTemplate(
"tpl.il_svy_out_matrix_columnheaders.html", TRUE, TRUE, 
"Modules/SurveyQuestionPool");
 
  960                 if ((strlen($this->object->getBipolarAdjective(0))) && (strlen($this->object->getBipolarAdjective(1))))
 
  962                         $tplheaders->setCurrentBlock(
"bipolar_start");
 
  964                         array_push($style, sprintf(
"width: %.2f%s!important", $layout[
"percent_bipolar_adjective1"], 
"%"));
 
  965                         if (count($style) > 0)
 
  967                                 $tplheaders->setVariable(
"STYLE", 
" style=\"" . implode(
";", $style) . 
"\"");
 
  969                         $tplheaders->parseCurrentBlock();
 
  972                 for ($i = 0; $i < $this->
object->getColumnCount(); $i++)
 
  974                         $cat = $this->
object->getColumn($i);
 
  977                                 $tplheaders->setCurrentBlock(
"neutral_column_header");
 
  979                                 $tplheaders->setVariable(
"CLASS", 
"rsep");
 
  981                                 array_push($style, sprintf(
"width: %.2f%s!important", $layout[
"percent_neutral"], 
"%"));
 
  982                                 if ($this->object->getNeutralColumnSeparator())
 
  984                                         array_push($style, 
"border-left: $neutralstyle!important;");
 
  986                                 if (count($style) > 0)
 
  988                                         $tplheaders->setVariable(
"STYLE", 
" style=\"" . implode(
";", $style) . 
"\"");
 
  990                                 $tplheaders->parseCurrentBlock();
 
  995                                 if ($this->object->getColumnSeparators() == 1)
 
  997                                         if (($i < $this->object->getColumnCount() - 1))
 
  999                                                 array_push($style, 
"border-right: 1px solid $bordercolor!important");
 
 1002                                 array_push($style, sprintf(
"width: %.2f%s!important", $layout[
"percent_columns"] / $this->object->getColumnCount(), 
"%"));
 
 1003                                 $tplheaders->setCurrentBlock(
"column_header");
 
 1005                                 $tplheaders->setVariable(
"CLASS", 
"center");
 
 1006                                 if (count($style) > 0)
 
 1008                                         $tplheaders->setVariable(
"STYLE", 
" style=\"" . implode(
";", $style) . 
"\"");
 
 1010                                 $tplheaders->parseCurrentBlock();
 
 1014                 if ((strlen($this->object->getBipolarAdjective(0))) && (strlen($this->object->getBipolarAdjective(1))))
 
 1016                         $tplheaders->setCurrentBlock(
"bipolar_end");
 
 1018                         array_push($style, sprintf(
"width: %.2f%s!important", $layout[
"percent_bipolar_adjective2"], 
"%"));
 
 1019                         if (count($style) > 0)
 
 1021                                 $tplheaders->setVariable(
"STYLE", 
" style=\"" . implode(
";", $style) . 
"\"");
 
 1023                         $tplheaders->parseCurrentBlock();
 
 1027                 array_push($style, sprintf(
"width: %.2f%s!important", $layout[
"percent_row"], 
"%"));
 
 1028                 if (count($style) > 0)
 
 1030                         $tplheaders->setVariable(
"STYLE", 
" style=\"" . implode(
";", $style) . 
"\"");
 
 1033                 $template->setCurrentBlock(
"matrix_row");
 
 1034                 $template->setVariable(
"ROW", $tplheaders->get());
 
 1035                 $template->parseCurrentBlock();
 
 1037                 $rowclass = array(
"tblrow1", 
"tblrow2");
 
 1039                 for ($i = 0; $i < $this->
object->getRowCount(); $i++)
 
 1041                         $rowobj = $this->
object->getRow($i);
 
 1042                         $tplrow = 
new ilTemplate(
"tpl.il_svy_qpl_matrix_printview_row.html", TRUE, TRUE, 
"Modules/SurveyQuestionPool");
 
 1043                         for ($j = 0; $j < $this->
object->getColumnCount(); $j++)
 
 1045                                 $cat = $this->
object->getColumn($j);
 
 1046                                 if (($i == 0) && ($j == 0))
 
 1048                                         if ((strlen($this->object->getBipolarAdjective(0))) && (strlen($this->object->getBipolarAdjective(1))))
 
 1050                                                 $tplrow->setCurrentBlock(
"bipolar_start");
 
 1052                                                 $tplrow->setVariable(
"ROWSPAN", $this->object->getRowCount());
 
 1053                                                 $tplrow->parseCurrentBlock();
 
 1056                                 if (($i == 0) && ($j == $this->object->getColumnCount()-1))
 
 1058                                         if ((strlen($this->object->getBipolarAdjective(0))) && (strlen($this->object->getBipolarAdjective(1))))
 
 1060                                                 $tplrow->setCurrentBlock(
"bipolar_end");
 
 1062                                                 $tplrow->setVariable(
"ROWSPAN", $this->object->getRowCount());
 
 1063                                                 $tplrow->parseCurrentBlock();
 
 1066                                 switch ($this->object->getSubtype())
 
 1071                                                         $tplrow->setCurrentBlock(
"neutral_radiobutton");
 
 1073                                                         $tplrow->setVariable(
"ALT_RADIO", $this->lng->txt(
"unchecked"));
 
 1074                                                         $tplrow->setVariable(
"TITLE_RADIO", $this->lng->txt(
"unchecked"));
 
 1075                                                         $tplrow->parseCurrentBlock();
 
 1079                                                         $tplrow->setCurrentBlock(
"radiobutton");
 
 1081                                                         $tplrow->setVariable(
"ALT_RADIO", $this->lng->txt(
"unchecked"));
 
 1082                                                         $tplrow->setVariable(
"TITLE_RADIO", $this->lng->txt(
"unchecked"));
 
 1083                                                         $tplrow->parseCurrentBlock();
 
 1089                                                         $tplrow->setCurrentBlock(
"neutral_checkbox");
 
 1091                                                         $tplrow->setVariable(
"ALT_CHECKBOX", $this->lng->txt(
"unchecked"));
 
 1092                                                         $tplrow->setVariable(
"TITLE_CHECKBOX", $this->lng->txt(
"unchecked"));
 
 1093                                                         $tplrow->parseCurrentBlock();
 
 1097                                                         $tplrow->setCurrentBlock(
"checkbox");
 
 1099                                                         $tplrow->setVariable(
"ALT_CHECKBOX", $this->lng->txt(
"unchecked"));
 
 1100                                                         $tplrow->setVariable(
"TITLE_CHECKBOX", $this->lng->txt(
"unchecked"));
 
 1101                                                         $tplrow->parseCurrentBlock();
 
 1107                                         $tplrow->setCurrentBlock(
"neutral_answer");
 
 1109                                         if ($this->object->getNeutralColumnSeparator())
 
 1111                                                 array_push($style, 
"border-left: $neutralstyle!important");
 
 1113                                         if ($this->object->getColumnSeparators() == 1)
 
 1115                                                 if ($j < $this->object->getColumnCount() - 1)
 
 1117                                                         array_push($style, 
"border-right: 1px solid $bordercolor!important");
 
 1121                                         if ($this->object->getRowSeparators() == 1)
 
 1123                                                 if ($i < $this->object->getRowCount() - 1)
 
 1125                                                         array_push($style, 
"border-bottom: 1px solid $bordercolor!important");
 
 1130                                                 $tplrow->setVariable(
"STYLE", 
" style=\"" . implode(
";", $style) . 
"\"");
 
 1132                                         $tplrow->parseCurrentBlock();
 
 1136                                         $tplrow->setCurrentBlock(
"answer");
 
 1139                                         if ($this->object->getColumnSeparators() == 1)
 
 1141                                                 if ($j < $this->object->getColumnCount() - 1)
 
 1143                                                         array_push($style, 
"border-right: 1px solid $bordercolor!important");
 
 1147                                         if ($this->object->getRowSeparators() == 1)
 
 1149                                                 if ($i < $this->object->getRowCount() - 1)
 
 1151                                                         array_push($style, 
"border-bottom: 1px solid $bordercolor!important");
 
 1156                                                 $tplrow->setVariable(
"STYLE", 
" style=\"" . implode(
";", $style) . 
"\"");
 
 1158                                         $tplrow->parseCurrentBlock();
 
 1164                                 $tplrow->setCurrentBlock(
"text_other");
 
 1165                                 $tplrow->setVariable(
"TEXT_OTHER", 
"             ");
 
 1166                                 $tplrow->parseCurrentBlock();
 
 1170                         $tplrow->setVariable(
"ROWCLASS", $rowclass[$i % 2]);
 
 1171                         if ($this->object->getRowSeparators() == 1)
 
 1173                                 if ($i < $this->object->getRowCount() - 1)
 
 1175                                         $tplrow->setVariable(
"STYLE", 
" style=\"border-bottom: 1px solid $bordercolor!important\"");
 
 1178                         $template->setCurrentBlock(
"matrix_row");
 
 1179                         $template->setVariable(
"ROW", $tplrow->get());
 
 1180                         $template->parseCurrentBlock();
 
 1183                 if ($question_title)
 
 1187                 $template->setCurrentBlock();
 
 1188                 if ($show_questiontext)
 
 1192                 $template->parseCurrentBlock();
 
 1193                 return $template->get();
 
 1203                 $this->tpl->addBlockFile(
"ADM_CONTENT", 
"adm_content", 
"tpl.il_svy_qpl_layout.html", 
"Modules/SurveyQuestionPool");
 
 1204                 $this->show_layout_row = TRUE;
 
 1206                 $this->tpl->setVariable(
"QUESTION_OUTPUT", $question_output);
 
 1207                 $this->tpl->setVariable(
"FORMACTION", $this->ctrl->getFormAction($this, 
"saveLayout"));
 
 1208                 $this->tpl->setVariable(
"SAVE", $this->lng->txt(
"save"));
 
 1218                 $percent_values = array(
 
 1219                         "percent_row" => (
int)
$_POST[
"percent_row"],
 
 1220                         "percent_columns" => (
int)$_POST[
"percent_columns"],
 
 1221                         "percent_bipolar_adjective1" => (
int)$_POST[
'percent_bipolar_adjective1'],
 
 1222                         "percent_bipolar_adjective2" => (
int)$_POST[
'percent_bipolar_adjective2'],
 
 1223                         "percent_neutral" => (
int)$_POST[
"percent_neutral"]
 
 1225                 $this->
object->setLayout($percent_values);
 
 1228                 if(array_sum($percent_values) == 100)
 
 1230                         $this->
object->saveLayout($percent_values[
"percent_row"], 
 
 1231                                 $percent_values[
'percent_columns'], 
 
 1232                                 $percent_values[
'percent_bipolar_adjective1'], 
 
 1233                                 $percent_values[
'percent_bipolar_adjective2'], 
 
 1234                                 $percent_values[
"percent_neutral"]);                                            
 
 1251                 $percent_values = $this->
object->getLayout();
 
 1252                 $template = 
new ilTemplate(
"tpl.il_svy_out_matrix_layout.html", TRUE, TRUE, 
"Modules/SurveyQuestionPool");
 
 1253                 if (strlen($this->object->getBipolarAdjective(0)) && strlen($this->object->getBipolarAdjective(1)))
 
 1255                         $template->setCurrentBlock(
"bipolar_start");
 
 1256                         $template->setVariable(
"VALUE_PERCENT_BIPOLAR_ADJECTIVE1", 
" value=\"" . $percent_values[
"percent_bipolar_adjective1"] . 
"\"");
 
 1257                         $template->setVariable(
"STYLE", 
" style=\"width:" . $percent_values[
"percent_bipolar_adjective1"] . 
"%\"");
 
 1258                         $template->parseCurrentBlock();
 
 1259                         $template->setCurrentBlock(
"bipolar_end");
 
 1260                         $template->setVariable(
"VALUE_PERCENT_BIPOLAR_ADJECTIVE2", 
" value=\"" . $percent_values[
"percent_bipolar_adjective2"] . 
"\"");
 
 1261                         $template->setVariable(
"STYLE", 
" style=\"width:" . $percent_values[
"percent_bipolar_adjective2"] . 
"%\"");
 
 1262                         $template->parseCurrentBlock();
 
 1264                 $counter = $this->
object->getColumnCount();
 
 1265                 if (strlen($this->object->hasNeutralColumn()))
 
 1267                         $template->setCurrentBlock(
"neutral_start");
 
 1268                         $template->setVariable(
"VALUE_PERCENT_NEUTRAL", 
" value=\"" . $percent_values[
"percent_neutral"] . 
"\"");
 
 1269                         $template->setVariable(
"STYLE_NEUTRAL", 
" style=\"width:" . $percent_values[
"percent_neutral"] . 
"%\"");
 
 1270                         $template->parseCurrentBlock();
 
 1273                 $template->setVariable(
"VALUE_PERCENT_ROW", 
" value=\"" . $percent_values[
"percent_row"] . 
"\"");
 
 1274                 $template->setVariable(
"STYLE_ROW", 
" style=\"width:" . $percent_values[
"percent_row"] . 
"%\"");                
 
 1275                 $template->setVariable(
"COLSPAN_COLUMNS", $counter);
 
 1276                 $template->setVariable(
"VALUE_PERCENT_COLUMNS", 
" value=\"" . $percent_values[
"percent_columns"] . 
"\"");
 
 1277                 $template->setVariable(
"STYLE_COLUMNS", 
" style=\"width:" . $percent_values[
"percent_columns"] . 
"%\"");
 
 1278                 return $template->get();
 
 1291                 if (count($this->cumulated) == 0)
 
 1293                         include_once 
"./Modules/Survey/classes/class.ilObjSurvey.php";
 
 1295                         $this->cumulated =& $this->
object->getCumulatedResults($survey_id, $nr_of_users);
 
 1298                 $cumulated_count = 0;
 
 1299                 foreach ($this->cumulated as $key => $value)
 
 1301                         if (is_numeric($key))   
 
 1309                 include_once 
"./Services/UICore/classes/class.ilTemplate.php";
 
 1310                 $template = 
new ilTemplate(
"tpl.il_svy_svy_cumulated_results_detail.html", TRUE, TRUE, 
"Modules/Survey");
 
 1312                 $template->setCurrentBlock(
"detail_row");
 
 1313                 $template->setVariable(
"TEXT_OPTION", $this->lng->txt(
"question"));
 
 1314                 $questiontext = $this->
object->getQuestiontext();
 
 1315                 $template->setVariable(
"TEXT_OPTION_VALUE", $this->object->prepareTextareaOutput($questiontext, TRUE));
 
 1316                 $template->parseCurrentBlock();
 
 1317                 $template->setCurrentBlock(
"detail_row");
 
 1318                 $template->setVariable(
"TEXT_OPTION", $this->lng->txt(
"question_type"));
 
 1319                 $template->setVariable(
"TEXT_OPTION_VALUE", $this->lng->txt($this->getQuestionType()).
 
 1320                         " (".$cumulated_count.
" ".$this->lng->txt(
"rows").
")");
 
 1321                 $template->parseCurrentBlock();
 
 1322                 $template->setCurrentBlock(
"detail_row");
 
 1323                 $template->setVariable(
"TEXT_OPTION", $this->lng->txt(
"users_answered"));
 
 1324                 $template->setVariable(
"TEXT_OPTION_VALUE", $this->cumulated[
"TOTAL"][
"USERS_ANSWERED"]);
 
 1325                 $template->parseCurrentBlock();
 
 1326                 $template->setCurrentBlock(
"detail_row");
 
 1327                 $template->setVariable(
"TEXT_OPTION", $this->lng->txt(
"users_skipped"));
 
 1328                 $template->setVariable(
"TEXT_OPTION_VALUE", $this->cumulated[
"TOTAL"][
"USERS_SKIPPED"]);
 
 1329                 $template->parseCurrentBlock();
 
 1340                 $template->setCurrentBlock(
"detail_row");
 
 1341                 $template->setVariable(
"TEXT_OPTION", $this->lng->txt(
"median"));
 
 1342                 $template->setVariable(
"TEXT_OPTION_VALUE", $this->cumulated[
"TOTAL"][
"MEDIAN"]);
 
 1343                 $template->parseCurrentBlock();
 
 1345                 $template->setCurrentBlock(
"detail_row");
 
 1346                 $template->setVariable(
"TEXT_OPTION", $this->lng->txt(
"categories"));
 
 1348                 foreach ($this->cumulated[
"TOTAL"][
"variables"] as $key => $value)
 
 1350                         $columns .= 
"<li>" . $value[
"title"] . 
": n=" . $value[
"selected"] . 
 
 1351                                 " (" . sprintf(
"%.2f", 100*$value[
"percentage"]) . 
"%)</li>";
 
 1354                 $template->setVariable(
"TEXT_OPTION_VALUE", 
$columns);
 
 1355                 $template->parseCurrentBlock();
 
 1358                 $template->setCurrentBlock(
"detail_row");                               
 
 1359                 $template->setVariable(
"TEXT_OPTION", $this->lng->txt(
"chart"));
 
 1360                 $template->setVariable(
"TEXT_OPTION_VALUE", $this->
renderChart(
"svy_ch_".$this->object->getId().
"_total", $this->cumulated[
"TOTAL"][
"variables"]));
 
 1361                 $template->parseCurrentBlock();
 
 1363                 $template->setVariable(
"QUESTION_TITLE", 
"$counter. ".$this->object->getTitle());               
 
 1365                 $output .= $template->get();
 
 1367                 foreach ($this->cumulated as $key => $value)
 
 1369                         if (is_numeric($key))   
 
 1371                                 $template = 
new ilTemplate(
"tpl.il_svy_svy_cumulated_results_detail.html", TRUE, TRUE, 
"Modules/Survey");       
 
 1373                                 $template->setCurrentBlock(
"detail_row");
 
 1374                                 $template->setVariable(
"TEXT_OPTION", $this->lng->txt(
"users_answered"));
 
 1375                                 $template->setVariable(
"TEXT_OPTION_VALUE", $value[
"USERS_ANSWERED"]);
 
 1376                                 $template->parseCurrentBlock();
 
 1377                                 $template->setCurrentBlock(
"detail_row");
 
 1378                                 $template->setVariable(
"TEXT_OPTION", $this->lng->txt(
"users_skipped"));
 
 1379                                 $template->setVariable(
"TEXT_OPTION_VALUE", $value[
"USERS_SKIPPED"]);
 
 1380                                 $template->parseCurrentBlock();                         
 
 1391                                 $template->setCurrentBlock(
"detail_row");                               
 
 1392                                 $template->setVariable(
"TEXT_OPTION", $this->lng->txt(
"median"));
 
 1393                                 $template->setVariable(
"TEXT_OPTION_VALUE", $value[
"MEDIAN"]);
 
 1394                                 $template->parseCurrentBlock();
 
 1396                                 $template->setCurrentBlock(
"detail_row");
 
 1397                                 $template->setVariable(
"TEXT_OPTION", $this->lng->txt(
"categories"));
 
 1399                                 foreach ($value[
"variables"] as $cvalue)
 
 1401                                         $columns .= 
"<li>" . $cvalue[
"title"] . 
": n=". $cvalue[
"selected"] . 
 
 1402                                                 " (".sprintf(
"%.2f", 100*$cvalue[
"percentage"]) . 
"%)</li>";
 
 1404                                 $columns = 
"<ol>".$columns.
"</ol>";
 
 1405                                 $template->setVariable(
"TEXT_OPTION_VALUE", 
$columns);
 
 1406                                 $template->parseCurrentBlock();
 
 1409                                 if (is_array($value[
"textanswers"]))
 
 1411                                         $template->setCurrentBlock(
"detail_row");
 
 1412                                         $template->setVariable(
"TEXT_OPTION", $this->lng->txt(
"freetext_answers"));     
 
 1414                                         foreach ($value[
"textanswers"] as $tkey => $answers)
 
 1416                                                 $html .= $value[
"variables"][$tkey][
"title"] .
"\n";
 
 1418                                                 foreach ($answers as $answer)
 
 1420                                                         $html .= 
"<li>" . preg_replace(
"/\n/", 
"<br>\n", $answer) . 
"</li>\n";
 
 1424                                         $template->setVariable(
"TEXT_OPTION_VALUE", $html);
 
 1425                                         $template->parseCurrentBlock();
 
 1429                                 $template->setCurrentBlock(
"detail_row");                               
 
 1430                                 $template->setVariable(
"TEXT_OPTION", $this->lng->txt(
"chart"));
 
 1431                                 $template->setVariable(
"TEXT_OPTION_VALUE", $this->
renderChart(
"svy_ch_".$this->object->getId().
"_".$key, $value[
"variables"]));
 
 1432                                 $template->parseCurrentBlock();
 
 1434                                 $template->setVariable(
"QUESTION_SUBTITLE", $counter.
".".($key+1).
" ".
 
 1435                                         $this->object->prepareTextareaOutput($value[
"ROW"], TRUE));
 
 1437                                 $output .= $template->get();
 
 1446                 global $rbacsystem,$ilTabs;
 
 1447                 $this->ctrl->setParameterByClass(
"$guiclass", 
"sel_question_types", $this->
getQuestionType());
 
 1448                 $this->ctrl->setParameterByClass(
"$guiclass", 
"q_id", 
$_GET[
"q_id"]);
 
 1450                 if ((
$_GET[
"calling_survey"] > 0) || (
$_GET[
"new_for_survey"] > 0))
 
 1455                         if (strlen(
$_GET[
"new_for_survey"]))
 
 1457                                 $addurl = 
"&new_id=" . 
$_GET[
"q_id"];
 
 1461                                 $addurl .= 
"&pgov=".$_REQUEST[
"pgov"];
 
 1462                                 $addurl .= 
"&pgov_pos=".$_REQUEST[
"pgov_pos"];
 
 1464                         $ilTabs->setBackTarget($this->lng->txt(
"menubacktosurvey"), 
"ilias.php?baseClass=ilObjSurveyGUI&ref_id=$ref_id&cmd=questions" . $addurl);
 
 1468                         $this->ctrl->setParameterByClass(
"ilObjSurveyQuestionPoolGUI", 
"q_id_table_nav", 
$_SESSION[
'q_id_table_nav']);
 
 1469                         $ilTabs->setBackTarget($this->lng->txt(
"spl"), $this->ctrl->getLinkTargetByClass(
"ilObjSurveyQuestionPoolGUI", 
"questions"));
 
 1473                         $ilTabs->addTarget(
"preview",
 
 1474                                 $this->ctrl->getLinkTarget($this, 
"preview"), 
 
 1479                         $ilTabs->addTarget(
"layout",
 
 1480                                 $this->ctrl->getLinkTarget($this, 
"layout"), 
 
 1481                                 array(
"layout", 
"saveLayout"),
 
 1485                 if ($rbacsystem->checkAccess(
'edit', 
$_GET[
"ref_id"])) 
 
 1487                         $ilTabs->addTarget(
"edit_properties",
 
 1488                                 $this->ctrl->getLinkTarget($this, 
"editQuestion"), 
 
 1489                                 array(
"editQuestion", 
"cancelExplorer", 
"linkChilds", 
"addGIT", 
"addST",
 
 1490                                         "addPG", 
"editQuestion", 
"addMaterial", 
"removeMaterial", 
 
 1491                                         "save", 
"cancel", 
"savePhrasecolumns", 
"confirmSavePhrase",
 
 1492                                         "downcolumns", 
"upcolumns", 
"addcolumns", 
"removecolumns",
 
 1493                                         "downrows", 
"uprows", 
"addrows", 
"removerows", 
"wizardcolumns",
 
 1494                                         "addSelectedPhrase", 
"insertStandardNumbers"),
 
 1499                 if ($this->object->getId() > 0) 
 
 1501                         $ilTabs->addTarget(
"material",
 
 1502                                                                          $this->ctrl->getLinkTarget($this, 
"material"), 
 
 1503                                                                         array(
"material", 
"cancelExplorer", 
"linkChilds", 
"addGIT", 
"addST",
 
 1504                                                                                          "addPG", 
"addMaterial", 
"removeMaterial"),
 
 1508                 if ($this->object->getId() > 0) 
 
 1510                         $title = $this->lng->txt(
"edit") . 
" "" . $this->
object->getTitle() . 
""";
 
 1517                 $this->tpl->setVariable(
"HEADER", 
$title);