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                 $save = ((strcmp($this->ctrl->getCmd(), 
"save") == 0) || 
 
  140                         (strcmp($this->ctrl->getCmd(), 
"wizardcolumns") == 0) ||
 
  141                         (strcmp($this->ctrl->getCmd(), 
"savePhrasecolumns") == 0)
 
  144                 include_once(
"./Services/Form/classes/class.ilPropertyFormGUI.php");
 
  146                 $form->setFormAction($this->ctrl->getFormAction($this));
 
  147                 $form->setTitle($this->lng->txt($this->getQuestionType()));
 
  148                 $form->setMultipart(FALSE);
 
  149                 $form->setTableWidth(
"100%");
 
  150                 $form->setId(
"multiplechoice");
 
  154                 $title->setValue($this->object->getTitle());
 
  155                 $title->setRequired(TRUE);
 
  160                 $label->
setValue($this->object->label);
 
  161                 $label->setInfo($this->lng->txt(
"label_info"));
 
  162                 $label->setRequired(
false);
 
  163                 $form->addItem($label);
 
  166                 $author = 
new ilTextInputGUI($this->lng->txt(
"author"), 
"author");
 
  167                 $author->
setValue($this->object->getAuthor());
 
  168                 $author->setRequired(TRUE);
 
  169                 $form->addItem($author);
 
  172                 $description = 
new ilTextInputGUI($this->lng->txt(
"description"), 
"description");
 
  173                 $description->
setValue($this->object->getDescription());
 
  174                 $description->setRequired(FALSE);
 
  175                 $form->addItem($description);
 
  179                 $question->
setValue($this->object->prepareTextareaOutput($this->object->getQuestiontext()));
 
  180                 $question->setRequired(TRUE);
 
  181                 $question->setRows(10);
 
  182                 $question->setCols(80);
 
  183                 $question->setUseRte(TRUE);
 
  184                 include_once 
"./Services/AdvancedEditing/classes/class.ilObjAdvancedEditing.php";
 
  186                 $question->addPlugin(
"latex");
 
  187                 $question->addButton(
"latex");
 
  188                 $question->addButton(
"pastelatex");
 
  189                 $question->removePlugin(
"ibrowser");
 
  190                 $question->setRTESupport($this->object->getId(), 
"spl", 
"survey");
 
  191                 $form->addItem($question);
 
  196                 $subtype->setValue($this->object->getSubtype());
 
  198                         "0" => 
"matrix_subtype_sr",
 
  199                         "1" => 
"matrix_subtype_mr",
 
  206                 foreach ($subtypes as $idx => $st)
 
  208                         $subtype->addOption(
new ilRadioOption($this->lng->txt($st), $idx));
 
  210                 $form->addItem($subtype);
 
  215                 $shuffle->setChecked($this->object->getObligatory());
 
  216                 $shuffle->setRequired(FALSE);
 
  217                 $form->addItem($shuffle);
 
  220                 $header->setTitle($this->lng->txt(
"matrix_appearance"));
 
  221                 $form->addItem($header);
 
  224                 $column_separators = 
new ilCheckboxInputGUI($this->lng->txt(
"matrix_column_separators"), 
"column_separators");
 
  226                 $column_separators->setInfo($this->lng->txt(
"matrix_column_separators_description"));
 
  227                 $column_separators->setChecked($this->object->getColumnSeparators());
 
  228                 $column_separators->setRequired(
false);
 
  229                 $form->addItem($column_separators);
 
  232                 $row_separators = 
new ilCheckboxInputGUI($this->lng->txt(
"matrix_row_separators"), 
"row_separators");
 
  234                 $row_separators->setInfo($this->lng->txt(
"matrix_row_separators_description"));
 
  235                 $row_separators->setChecked($this->object->getRowSeparators());
 
  236                 $row_separators->setRequired(
false);
 
  237                 $form->addItem($row_separators);
 
  240                 $neutral_column_separator = 
new ilCheckboxInputGUI($this->lng->txt(
"matrix_neutral_column_separator"), 
"neutral_column_separator");
 
  241                 $neutral_column_separator->
setValue(1);
 
  242                 $neutral_column_separator->setInfo($this->lng->txt(
"matrix_neutral_column_separator_description"));
 
  243                 $neutral_column_separator->setChecked($this->object->getNeutralColumnSeparator());
 
  244                 $neutral_column_separator->setRequired(
false);
 
  245                 $form->addItem($neutral_column_separator);
 
  248                 $header->setTitle($this->lng->txt(
"matrix_columns"));
 
  249                 $form->addItem($header);
 
  252                 include_once 
"./Modules/SurveyQuestionPool/classes/class.ilCategoryWizardInputGUI.php";
 
  257                 $columns->setShowNeutralCategory(
true);
 
  259                 $columns->setNeutralCategoryTitle($this->lng->txt(
'matrix_neutral_answer'));
 
  260                 $columns->setCategoryText($this->lng->txt(
'matrix_standard_answers'));
 
  262                 if (!$this->object->getColumnCount())
 
  264                         $this->
object->columns->addCategory(
"");
 
  266                 $columns->setValues($this->object->getColumns());
 
  270                 $header->setTitle($this->lng->txt(
"matrix_column_settings"));
 
  271                 $form->addItem($header);
 
  274                 $bipolar = 
new ilCustomInputGUI($this->lng->txt(
"matrix_bipolar_adjectives"));
 
  275                 $bipolar->
setInfo($this->lng->txt(
"matrix_bipolar_adjectives_description"));
 
  278                 $bipolar1 = 
new ilTextInputGUI($this->lng->txt(
"matrix_left_pole"), 
"bipolar1");
 
  279                 $bipolar1->
setValue($this->object->getBipolarAdjective(0));
 
  280                 $bipolar1->setRequired(
false);
 
  281                 $bipolar->addSubItem($bipolar1);
 
  284                 $bipolar2 = 
new ilTextInputGUI($this->lng->txt(
"matrix_right_pole"), 
"bipolar2");
 
  285                 $bipolar2->
setValue($this->object->getBipolarAdjective(1));
 
  286                 $bipolar2->setRequired(
false);
 
  287                 $bipolar->addSubItem($bipolar2);
 
  289                 $form->addItem($bipolar);
 
  292                 $header->setTitle($this->lng->txt(
"matrix_rows"));
 
  293                 $form->addItem($header);
 
  296                 include_once 
"./Modules/SurveyQuestionPool/classes/class.ilMatrixRowWizardInputGUI.php";
 
  299                 $rows->setAllowMove(
true);
 
  300                 $rows->setLabelText($this->lng->txt(
'label'));
 
  301                 $rows->setUseOtherAnswer(
true);
 
  302                 if ($this->object->getRowCount() == 0)
 
  304                         $this->
object->getRows()->addCategory(
"");
 
  306                 $rows->setValues($this->object->getRows());
 
  307                 $form->addItem($rows);
 
  309                 $form->addCommandButton(
"save", $this->lng->txt(
"save"));
 
  315                         $form->setValuesByPost();
 
  316                         $errors = !$form->checkInput();
 
  317                         $form->setValuesByPost(); 
 
  318                         if (
$errors) $checkonly = 
false;
 
  321                 if (!$checkonly) $this->tpl->setVariable(
"ADM_CONTENT", $form->getHTML());
 
  331                 $position = key(
$_POST[
'cmd'][
'addrows']);
 
  332                 $this->
object->addRowAtPosition(
"", 
false, $position+1);
 
  342                 $position = key(
$_POST[
'cmd'][
'removerows']);
 
  343                 $this->
object->removeRow($position);
 
  353                 $position = key(
$_POST[
'cmd'][
'uprows']);
 
  354                 $this->
object->moveRowUp($position);
 
  364                 $position = key(
$_POST[
'cmd'][
'downrows']);
 
  365                 $this->
object->moveRowDown($position);
 
  375                 $position = key(
$_POST[
'cmd'][
'addcolumns']);
 
  376                 $this->
object->getColumns()->addCategoryAtPosition(
"", $position+1);
 
  386                 $position = key(
$_POST[
'cmd'][
'removecolumns']);
 
  387                 $this->
object->getColumns()->removeCategory($position);
 
  397                 $position = key(
$_POST[
'cmd'][
'upcolumns']);
 
  398                 $this->
object->getColumns()->moveCategoryUp($position);
 
  408                 $position = key(
$_POST[
'cmd'][
'downcolumns']);
 
  409                 $this->
object->getColumns()->moveCategoryDown($position);
 
  423                         if (!$haserror) $this->
object->saveToDb();
 
  425                         $this->tpl->addBlockFile(
"ADM_CONTENT", 
"adm_content", 
"tpl.il_svy_qpl_savephrase.html", 
"Modules/SurveyQuestionPool");
 
  426                         $this->tpl->setCurrentBlock(
"adm_content");
 
  427                         $this->tpl->setVariable(
"SAVE_PHRASE_INTRODUCTION", $this->lng->txt(
"save_phrase_introduction"));
 
  428                         $this->tpl->setVariable(
"TEXT_PHRASE_TITLE", $this->lng->txt(
"enter_phrase_title"));
 
  429                         $this->tpl->setVariable(
"VALUE_PHRASE_TITLE", 
$_POST[
"phrase_title"]);
 
  430                         $this->tpl->setVariable(
"BTN_CANCEL",$this->lng->txt(
"cancel"));
 
  431                         $this->tpl->setVariable(
"BTN_CONFIRM",$this->lng->txt(
"confirm"));
 
  432                         $this->tpl->setVariable(
"FORM_ACTION", $this->ctrl->getFormAction($this));
 
  434                         include_once 
"./Modules/SurveyQuestionPool/classes/tables/class.ilSurveySavePhraseTableGUI.php";
 
  440                                 foreach (
$_POST[
'columns'][
'answer'] as $key => $value)
 
  442                                         array_push(
$data, array(
'answer' => $value, 
'other' => ((
$_POST[
'columns'][
'other'][$key]) ? 
true : 
false), 
'scale' => 
$_POST[
'columns'][
'scale'][$key]));
 
  444                                 if (strlen(
$_POST[
'columns'][
'neutral']))
 
  446                                         array_push(
$data, array(
'answer' => 
$_POST[
'columns'][
'neutral'], 
'other' => 
false, 
'scale' => 
$_POST[
'columns_neutral_scale']));
 
  453                         $table_gui->setData(
$data);
 
  455                         $this->tpl->setVariable(
'TABLE', $table_gui->getHTML());        
 
  456                         $this->tpl->parseCurrentBlock();
 
  468                 $this->ctrl->redirect($this, 
"editQuestion");
 
  478                 if (!
$_POST[
"phrase_title"])
 
  485                 if ($this->object->phraseExists(
$_POST[
"phrase_title"]))
 
  492                 $this->
object->savePhrase(
$_POST[
"phrase_title"]);
 
  494                 $this->ctrl->redirect($this, 
"editQuestion");
 
  507                         if ($save_post_data) $this->
object->saveToDb();
 
  508                         $this->tpl->addBlockFile(
"ADM_CONTENT", 
"adm_content", 
"tpl.il_svy_qpl_addphrase.html", 
"Modules/SurveyQuestionPool");
 
  511                         $this->tpl->setCurrentBlock(
"hidden");
 
  512                         $this->tpl->setVariable(
"HIDDEN_NAME", 
"id");
 
  513                         $this->tpl->setVariable(
"HIDDEN_VALUE", $this->object->getId());
 
  514                         $this->tpl->parseCurrentBlock();
 
  516                         include_once 
"./Modules/SurveyQuestionPool/classes/class.ilSurveyPhrases.php";
 
  518                         $colors = array(
"tblrow1", 
"tblrow2");
 
  520                         foreach ($phrases as $phrase_id => $phrase_array)
 
  522                                 $this->tpl->setCurrentBlock(
"phraserow");
 
  523                                 $this->tpl->setVariable(
"COLOR_CLASS", $colors[$counter++ % 2]);
 
  524                                 $this->tpl->setVariable(
"PHRASE_VALUE", $phrase_id);
 
  525                                 $this->tpl->setVariable(
"PHRASE_NAME", $phrase_array[
"title"]);
 
  527                                 $this->tpl->setVariable(
"PHRASE_CONTENT", join($categories, 
","));
 
  528                                 $this->tpl->parseCurrentBlock();
 
  531                         $this->tpl->setCurrentBlock(
"adm_content");
 
  532                         $this->tpl->setVariable(
"TEXT_CANCEL", $this->lng->txt(
"cancel"));
 
  533                         $this->tpl->setVariable(
"TEXT_PHRASE", $this->lng->txt(
"phrase"));
 
  534                         $this->tpl->setVariable(
"TEXT_CONTENT", $this->lng->txt(
"categories"));
 
  535                         $this->tpl->setVariable(
"TEXT_ADD_PHRASE", $this->lng->txt(
"add_phrase"));
 
  536                         $this->tpl->setVariable(
"TEXT_INTRODUCTION",$this->lng->txt(
"add_phrase_introduction"));
 
  537                         $this->tpl->setVariable(
"FORM_ACTION", $this->ctrl->getFormAction($this));
 
  538                         $this->tpl->parseCurrentBlock();
 
  550                 $this->ctrl->redirect($this, 
'editQuestion');
 
  560                 if (strcmp(
$_POST[
"phrases"], 
"") == 0)
 
  567                         if (strcmp($this->object->getPhrase(
$_POST[
"phrases"]), 
"dp_standard_numbers") != 0)
 
  569                                 $this->
object->addPhrase(
$_POST[
"phrases"]);
 
  570                                 $this->
object->saveToDb();
 
  578                         $this->ctrl->redirect($this, 
'editQuestion');
 
  589                         $this->tpl->addBlockFile(
"ADM_CONTENT", 
"adm_content", 
"tpl.il_svy_qpl_addphrase_standard_numbers.html", 
"Modules/SurveyQuestionPool");
 
  592                         $this->tpl->setCurrentBlock(
"hidden");
 
  593                         $this->tpl->setVariable(
"HIDDEN_NAME", 
"id");
 
  594                         $this->tpl->setVariable(
"HIDDEN_VALUE", $this->object->getId());
 
  595                         $this->tpl->parseCurrentBlock();
 
  597                         $this->tpl->setCurrentBlock(
"adm_content");
 
  598                         $this->tpl->setVariable(
"ADD_STANDARD_NUMBERS", $this->lng->txt(
"add_standard_numbers"));
 
  599                         $this->tpl->setVariable(
"TEXT_ADD_LIMITS", $this->lng->txt(
"add_limits_for_standard_numbers"));
 
  600                         $this->tpl->setVariable(
"TEXT_LOWER_LIMIT",$this->lng->txt(
"lower_limit"));
 
  601                         $this->tpl->setVariable(
"TEXT_UPPER_LIMIT",$this->lng->txt(
"upper_limit"));
 
  602                         $this->tpl->setVariable(
"VALUE_LOWER_LIMIT", 
$_POST[
"lower_limit"]);
 
  603                         $this->tpl->setVariable(
"VALUE_UPPER_LIMIT", 
$_POST[
"upper_limit"]);
 
  604                         $this->tpl->setVariable(
"BTN_ADD",$this->lng->txt(
"add_phrase"));
 
  605                         $this->tpl->setVariable(
"BTN_CANCEL",$this->lng->txt(
"cancel"));
 
  606                         $this->tpl->setVariable(
"FORM_ACTION", $this->ctrl->getFormAction($this));
 
  607                         $this->tpl->parseCurrentBlock();
 
  618                 $this->ctrl->redirect($this, 
"editQuestion");
 
  628                 if ((strcmp(
$_POST[
"lower_limit"], 
"") == 0) or (strcmp(
$_POST[
"upper_limit"], 
"") == 0))
 
  633                 else if ((
int)
$_POST[
"upper_limit"] <= (
int)
$_POST[
"lower_limit"])
 
  640                         $this->
object->addStandardNumbers($_POST[
"lower_limit"], $_POST[
"upper_limit"]);
 
  641                         $this->
object->saveToDb();
 
  643                         $this->ctrl->redirect($this, 
"editQuestion");
 
  652         function getWorkingForm($working_data = 
"", $question_title = 1, $show_questiontext = 1, $error_message = 
"")
 
  654                 $layout = $this->
object->getLayout();
 
  655                 $neutralstyle = 
"3px solid #808080";
 
  656                 $bordercolor = 
"#808080";
 
  657                 $template = 
new ilTemplate(
"tpl.il_svy_out_matrix.html", TRUE, TRUE, 
"Modules/SurveyQuestionPool");
 
  658                 $template->setCurrentBlock(
"material_matrix");
 
  660                 $template->parseCurrentBlock();
 
  662                 if ($this->show_layout_row)
 
  665                         $template->setCurrentBlock(
"matrix_row");
 
  666                         $template->setVariable(
"ROW", $layout_row);
 
  667                         $template->parseCurrentBlock();
 
  670                 $tplheaders = 
new ilTemplate(
"tpl.il_svy_out_matrix_columnheaders.html", TRUE, TRUE, 
"Modules/SurveyQuestionPool");
 
  671                 if ((strlen($this->object->getBipolarAdjective(0))) && (strlen($this->object->getBipolarAdjective(1))))
 
  673                         $tplheaders->setCurrentBlock(
"bipolar_start");
 
  675                         array_push($style, sprintf(
"width: %.2f%s!important", $layout[
"percent_bipolar_adjective1"], 
"%"));
 
  676                         if (count($style) > 0)
 
  678                                 $tplheaders->setVariable(
"STYLE", 
" style=\"" . implode(
";", $style) . 
"\"");
 
  680                         $tplheaders->parseCurrentBlock();
 
  683                 for ($i = 0; $i < $this->
object->getColumnCount(); $i++)
 
  686                         $col = $this->
object->getColumn($i);
 
  689                                 $tplheaders->setCurrentBlock(
"neutral_column_header");
 
  691                                 $tplheaders->setVariable(
"CLASS", 
"rsep");
 
  693                                 array_push($style, sprintf(
"width: %.2f%s!important", $layout[
"percent_neutral"], 
"%"));
 
  694                                 if ($this->object->getNeutralColumnSeparator())
 
  696                                         array_push($style, 
"border-left: $neutralstyle!important;");
 
  698                                 if (count($style) > 0)
 
  700                                         $tplheaders->setVariable(
"STYLE", 
" style=\"" . implode(
";", $style) . 
"\"");
 
  702                                 $tplheaders->parseCurrentBlock();
 
  706                                 if ($this->object->getColumnSeparators() == 1)
 
  708                                         if (($i < $this->object->getColumnCount() - 1))
 
  710                                                 array_push($style, 
"border-right: 1px solid $bordercolor!important");
 
  713                                 array_push($style, sprintf(
"width: %.2f%s!important", $layout[
"percent_columns"] / $this->object->getColumnCount(), 
"%"));
 
  714                                 $tplheaders->setCurrentBlock(
"column_header");
 
  716                                 $tplheaders->setVariable(
"CLASS", 
"center");
 
  717                                 if (count($style) > 0)
 
  719                                         $tplheaders->setVariable(
"STYLE", 
" style=\"" . implode(
";", $style) . 
"\"");
 
  721                                 $tplheaders->parseCurrentBlock();
 
  724                 if ((strlen($this->object->getBipolarAdjective(0))) && (strlen($this->object->getBipolarAdjective(1))))
 
  726                         $tplheaders->setCurrentBlock(
"bipolar_end");
 
  728                         array_push($style, sprintf(
"width: %.2f%s!important", $layout[
"percent_bipolar_adjective2"], 
"%"));
 
  729                         if (count($style) > 0)
 
  731                                 $tplheaders->setVariable(
"STYLE", 
" style=\"" . implode(
";", $style) . 
"\"");
 
  733                         $tplheaders->parseCurrentBlock();
 
  737                 array_push($style, sprintf(
"width: %.2f%s!important", $layout[
"percent_row"], 
"%"));
 
  738                 if (count($style) > 0)
 
  740                         $tplheaders->setVariable(
"STYLE", 
" style=\"" . implode(
";", $style) . 
"\"");
 
  743                 $template->setCurrentBlock(
"matrix_row");
 
  744                 $template->setVariable(
"ROW", $tplheaders->get());
 
  745                 $template->parseCurrentBlock();
 
  747                 $rowclass = array(
"tblrow1", 
"tblrow2");
 
  748                 for ($i = 0; $i < $this->
object->getRowCount(); $i++)
 
  750                         $rowobj = $this->
object->getRow($i);
 
  751                         $tplrow = 
new ilTemplate(
"tpl.il_svy_out_matrix_row.html", TRUE, TRUE, 
"Modules/SurveyQuestionPool");
 
  752                         for ($j = 0; $j < $this->
object->getColumnCount(); $j++)
 
  754                                 $cat = $this->
object->getColumn($j);
 
  755                                 if (($i == 0) && ($j == 0))
 
  757                                         if ((strlen($this->object->getBipolarAdjective(0))) && (strlen($this->object->getBipolarAdjective(1))))
 
  759                                                 $tplrow->setCurrentBlock(
"bipolar_start");
 
  761                                                 $tplrow->setVariable(
"ROWSPAN", $this->object->getRowCount());
 
  762                                                 $tplrow->parseCurrentBlock();
 
  765                                 if (($i == 0) && ($j == $this->object->getColumnCount()-1))
 
  767                                         if ((strlen($this->object->getBipolarAdjective(0))) && (strlen($this->object->getBipolarAdjective(1))))
 
  769                                                 $tplrow->setCurrentBlock(
"bipolar_end");
 
  771                                                 $tplrow->setVariable(
"ROWSPAN", $this->object->getRowCount());
 
  772                                                 $tplrow->parseCurrentBlock();
 
  775                                 switch ($this->object->getSubtype())
 
  780                                                         $tplrow->setCurrentBlock(
"neutral_radiobutton");
 
  781                                                         $tplrow->setVariable(
"QUESTION_ID", $this->object->getId());
 
  782                                                         $tplrow->setVariable(
"ROW", $i);
 
  783                                                         $tplrow->setVariable(
"VALUE", ($cat->scale) ? ($cat->scale - 1) : $j);
 
  784                                                         if (is_array($working_data))
 
  786                                                                 foreach ($working_data as 
$data)
 
  788                                                                         if (($data[
"value"] == $cat->scale-1) && ($data[
"rowvalue"] == $i))
 
  790                                                                                 $tplrow->setVariable(
"CHECKED_RADIOBUTTON", 
" checked=\"checked\"");
 
  794                                                         $tplrow->parseCurrentBlock();
 
  798                                                         $tplrow->setCurrentBlock(
"radiobutton");
 
  799                                                         $tplrow->setVariable(
"QUESTION_ID", $this->object->getId());
 
  800                                                         $tplrow->setVariable(
"ROW", $i);
 
  801                                                         $tplrow->setVariable(
"VALUE", ($cat->scale) ? ($cat->scale - 1) : $j);
 
  802                                                         if (is_array($working_data))
 
  804                                                                 foreach ($working_data as 
$data)
 
  806                                                                         if (($data[
"value"] == $cat->scale-1) && ($data[
"rowvalue"] == $i))
 
  808                                                                                 $tplrow->setVariable(
"CHECKED_RADIOBUTTON", 
" checked=\"checked\"");
 
  812                                                         $tplrow->parseCurrentBlock();
 
  818                                                         $tplrow->setCurrentBlock(
"neutral_checkbox");
 
  819                                                         $tplrow->setVariable(
"QUESTION_ID", $this->object->getId());
 
  820                                                         $tplrow->setVariable(
"ROW", $i);
 
  821                                                         $tplrow->setVariable(
"VALUE", ($cat->scale) ? ($cat->scale - 1) : $j);
 
  822                                                         if (is_array($working_data))
 
  824                                                                 foreach ($working_data as 
$data)
 
  826                                                                         if (($data[
"value"] == $cat->scale-1) && ($data[
"rowvalue"] == $i))
 
  828                                                                                 $tplrow->setVariable(
"CHECKED_CHECKBOX", 
" checked=\"checked\"");
 
  832                                                         $tplrow->parseCurrentBlock();
 
  836                                                         $tplrow->setCurrentBlock(
"checkbox");
 
  837                                                         $tplrow->setVariable(
"QUESTION_ID", $this->object->getId());
 
  838                                                         $tplrow->setVariable(
"ROW", $i);
 
  839                                                         $tplrow->setVariable(
"VALUE", ($cat->scale) ? ($cat->scale - 1) : $j);
 
  840                                                         if (is_array($working_data))
 
  842                                                                 foreach ($working_data as 
$data)
 
  844                                                                         if (($data[
"value"] == $cat->scale-1) && ($data[
"rowvalue"] == $i))
 
  846                                                                                 $tplrow->setVariable(
"CHECKED_CHECKBOX", 
" checked=\"checked\"");
 
  850                                                         $tplrow->parseCurrentBlock();
 
  856                                         $tplrow->setCurrentBlock(
"neutral_answer");
 
  858                                         if ($this->object->getNeutralColumnSeparator())
 
  860                                                 array_push($style, 
"border-left: $neutralstyle!important");
 
  862                                         if ($this->object->getColumnSeparators() == 1)
 
  864                                                 if ($j < $this->object->getColumnCount() - 1)
 
  866                                                         array_push($style, 
"border-right: 1px solid $bordercolor!important");
 
  872                                         $tplrow->setCurrentBlock(
"answer");
 
  875                                         if ($this->object->getColumnSeparators() == 1)
 
  877                                                 if ($j < $this->object->getColumnCount() - 1)
 
  879                                                         array_push($style, 
"border-right: 1px solid $bordercolor!important");
 
  883                                 if ($this->object->getRowSeparators() == 1)
 
  885                                         if ($i < $this->object->getRowCount() - 1)
 
  887                                                 array_push($style, 
"border-bottom: 1px solid $bordercolor!important");
 
  892                                         $tplrow->setVariable(
"STYLE", 
" style=\"" . implode(
";", $style) . 
"\"");
 
  894                                 $tplrow->parseCurrentBlock();
 
  899                                 $tplrow->setCurrentBlock(
"row_other");
 
  900                                 $tplrow->setVariable(
"QUESTION_ID", $this->object->getId());
 
  901                                 $tplrow->setVariable(
"ROW", $i);
 
  902                                 if (is_array($working_data))
 
  904                                         foreach ($working_data as 
$data)
 
  906                                                 if ($data[
"rowvalue"] == $i)
 
  912                                 $tplrow->parseCurrentBlock();
 
  915                         $tplrow->setVariable(
"ROWCLASS", $rowclass[$i % 2]);
 
  916                         if ($this->object->getRowSeparators() == 1)
 
  918                                 if ($i < $this->object->getRowCount() - 1)
 
  920                                         $tplrow->setVariable(
"STYLE", 
" style=\"border-bottom: 1px solid $bordercolor!important\"");
 
  923                         $template->setCurrentBlock(
"matrix_row");
 
  924                         $template->setVariable(
"ROW", $tplrow->get());
 
  925                         $template->parseCurrentBlock();
 
  932                 $template->setCurrentBlock(
"question_data_matrix");
 
  933                 if (strcmp($error_message, 
"") != 0)
 
  935                         $template->setVariable(
"ERROR_MESSAGE", 
"<p class=\"warning\">$error_message</p>");
 
  937                 if ($show_questiontext)
 
  941                 $template->parseCurrentBlock();
 
  942                 return $template->get();
 
  952                 $layout = $this->
object->getLayout();
 
  953                 $neutralstyle = 
"3px solid #808080";
 
  954                 $bordercolor = 
"#808080";
 
  955                 $template = 
new ilTemplate(
"tpl.il_svy_qpl_matrix_printview.html", TRUE, TRUE, 
"Modules/SurveyQuestionPool");
 
  957                 if ($this->show_layout_row)
 
  960                         $template->setCurrentBlock(
"matrix_row");
 
  961                         $template->setVariable(
"ROW", $layout_row);
 
  962                         $template->parseCurrentBlock();
 
  965                 $tplheaders = 
new ilTemplate(
"tpl.il_svy_out_matrix_columnheaders.html", TRUE, TRUE, 
"Modules/SurveyQuestionPool");
 
  966                 if ((strlen($this->object->getBipolarAdjective(0))) && (strlen($this->object->getBipolarAdjective(1))))
 
  968                         $tplheaders->setCurrentBlock(
"bipolar_start");
 
  970                         array_push($style, sprintf(
"width: %.2f%s!important", $layout[
"percent_bipolar_adjective1"], 
"%"));
 
  971                         if (count($style) > 0)
 
  973                                 $tplheaders->setVariable(
"STYLE", 
" style=\"" . implode(
";", $style) . 
"\"");
 
  975                         $tplheaders->parseCurrentBlock();
 
  978                 for ($i = 0; $i < $this->
object->getColumnCount(); $i++)
 
  980                         $cat = $this->
object->getColumn($i);
 
  983                                 $tplheaders->setCurrentBlock(
"neutral_column_header");
 
  985                                 $tplheaders->setVariable(
"CLASS", 
"rsep");
 
  987                                 array_push($style, sprintf(
"width: %.2f%s!important", $layout[
"percent_neutral"], 
"%"));
 
  988                                 if ($this->object->getNeutralColumnSeparator())
 
  990                                         array_push($style, 
"border-left: $neutralstyle!important;");
 
  992                                 if (count($style) > 0)
 
  994                                         $tplheaders->setVariable(
"STYLE", 
" style=\"" . implode(
";", $style) . 
"\"");
 
  996                                 $tplheaders->parseCurrentBlock();
 
 1001                                 if ($this->object->getColumnSeparators() == 1)
 
 1003                                         if (($i < $this->object->getColumnCount() - 1))
 
 1005                                                 array_push($style, 
"border-right: 1px solid $bordercolor!important");
 
 1008                                 array_push($style, sprintf(
"width: %.2f%s!important", $layout[
"percent_columns"] / $this->object->getColumnCount(), 
"%"));
 
 1009                                 $tplheaders->setCurrentBlock(
"column_header");
 
 1011                                 $tplheaders->setVariable(
"CLASS", 
"center");
 
 1012                                 if (count($style) > 0)
 
 1014                                         $tplheaders->setVariable(
"STYLE", 
" style=\"" . implode(
";", $style) . 
"\"");
 
 1016                                 $tplheaders->parseCurrentBlock();
 
 1020                 if ((strlen($this->object->getBipolarAdjective(0))) && (strlen($this->object->getBipolarAdjective(1))))
 
 1022                         $tplheaders->setCurrentBlock(
"bipolar_end");
 
 1024                         array_push($style, sprintf(
"width: %.2f%s!important", $layout[
"percent_bipolar_adjective2"], 
"%"));
 
 1025                         if (count($style) > 0)
 
 1027                                 $tplheaders->setVariable(
"STYLE", 
" style=\"" . implode(
";", $style) . 
"\"");
 
 1029                         $tplheaders->parseCurrentBlock();
 
 1033                 array_push($style, sprintf(
"width: %.2f%s!important", $layout[
"percent_row"], 
"%"));
 
 1034                 if (count($style) > 0)
 
 1036                         $tplheaders->setVariable(
"STYLE", 
" style=\"" . implode(
";", $style) . 
"\"");
 
 1039                 $template->setCurrentBlock(
"matrix_row");
 
 1040                 $template->setVariable(
"ROW", $tplheaders->get());
 
 1041                 $template->parseCurrentBlock();
 
 1043                 $rowclass = array(
"tblrow1", 
"tblrow2");
 
 1045                 for ($i = 0; $i < $this->
object->getRowCount(); $i++)
 
 1047                         $rowobj = $this->
object->getRow($i);
 
 1048                         $tplrow = 
new ilTemplate(
"tpl.il_svy_qpl_matrix_printview_row.html", TRUE, TRUE, 
"Modules/SurveyQuestionPool");
 
 1049                         for ($j = 0; $j < $this->
object->getColumnCount(); $j++)
 
 1051                                 $cat = $this->
object->getColumn($j);
 
 1052                                 if (($i == 0) && ($j == 0))
 
 1054                                         if ((strlen($this->object->getBipolarAdjective(0))) && (strlen($this->object->getBipolarAdjective(1))))
 
 1056                                                 $tplrow->setCurrentBlock(
"bipolar_start");
 
 1058                                                 $tplrow->setVariable(
"ROWSPAN", $this->object->getRowCount());
 
 1059                                                 $tplrow->parseCurrentBlock();
 
 1062                                 if (($i == 0) && ($j == $this->object->getColumnCount()-1))
 
 1064                                         if ((strlen($this->object->getBipolarAdjective(0))) && (strlen($this->object->getBipolarAdjective(1))))
 
 1066                                                 $tplrow->setCurrentBlock(
"bipolar_end");
 
 1068                                                 $tplrow->setVariable(
"ROWSPAN", $this->object->getRowCount());
 
 1069                                                 $tplrow->parseCurrentBlock();
 
 1072                                 switch ($this->object->getSubtype())
 
 1077                                                         $tplrow->setCurrentBlock(
"neutral_radiobutton");
 
 1079                                                         $tplrow->setVariable(
"ALT_RADIO", $this->lng->txt(
"unchecked"));
 
 1080                                                         $tplrow->setVariable(
"TITLE_RADIO", $this->lng->txt(
"unchecked"));
 
 1081                                                         $tplrow->parseCurrentBlock();
 
 1085                                                         $tplrow->setCurrentBlock(
"radiobutton");
 
 1087                                                         $tplrow->setVariable(
"ALT_RADIO", $this->lng->txt(
"unchecked"));
 
 1088                                                         $tplrow->setVariable(
"TITLE_RADIO", $this->lng->txt(
"unchecked"));
 
 1089                                                         $tplrow->parseCurrentBlock();
 
 1095                                                         $tplrow->setCurrentBlock(
"neutral_checkbox");
 
 1097                                                         $tplrow->setVariable(
"ALT_CHECKBOX", $this->lng->txt(
"unchecked"));
 
 1098                                                         $tplrow->setVariable(
"TITLE_CHECKBOX", $this->lng->txt(
"unchecked"));
 
 1099                                                         $tplrow->parseCurrentBlock();
 
 1103                                                         $tplrow->setCurrentBlock(
"checkbox");
 
 1105                                                         $tplrow->setVariable(
"ALT_CHECKBOX", $this->lng->txt(
"unchecked"));
 
 1106                                                         $tplrow->setVariable(
"TITLE_CHECKBOX", $this->lng->txt(
"unchecked"));
 
 1107                                                         $tplrow->parseCurrentBlock();
 
 1113                                         $tplrow->setCurrentBlock(
"neutral_answer");
 
 1115                                         if ($this->object->getNeutralColumnSeparator())
 
 1117                                                 array_push($style, 
"border-left: $neutralstyle!important");
 
 1119                                         if ($this->object->getColumnSeparators() == 1)
 
 1121                                                 if ($j < $this->object->getColumnCount() - 1)
 
 1123                                                         array_push($style, 
"border-right: 1px solid $bordercolor!important");
 
 1127                                         if ($this->object->getRowSeparators() == 1)
 
 1129                                                 if ($i < $this->object->getRowCount() - 1)
 
 1131                                                         array_push($style, 
"border-bottom: 1px solid $bordercolor!important");
 
 1136                                                 $tplrow->setVariable(
"STYLE", 
" style=\"" . implode(
";", $style) . 
"\"");
 
 1138                                         $tplrow->parseCurrentBlock();
 
 1142                                         $tplrow->setCurrentBlock(
"answer");
 
 1145                                         if ($this->object->getColumnSeparators() == 1)
 
 1147                                                 if ($j < $this->object->getColumnCount() - 1)
 
 1149                                                         array_push($style, 
"border-right: 1px solid $bordercolor!important");
 
 1153                                         if ($this->object->getRowSeparators() == 1)
 
 1155                                                 if ($i < $this->object->getRowCount() - 1)
 
 1157                                                         array_push($style, 
"border-bottom: 1px solid $bordercolor!important");
 
 1162                                                 $tplrow->setVariable(
"STYLE", 
" style=\"" . implode(
";", $style) . 
"\"");
 
 1164                                         $tplrow->parseCurrentBlock();
 
 1170                                 $tplrow->setCurrentBlock(
"text_other");
 
 1171                                 $tplrow->setVariable(
"TEXT_OTHER", 
"             ");
 
 1172                                 $tplrow->parseCurrentBlock();
 
 1176                         $tplrow->setVariable(
"ROWCLASS", $rowclass[$i % 2]);
 
 1177                         if ($this->object->getRowSeparators() == 1)
 
 1179                                 if ($i < $this->object->getRowCount() - 1)
 
 1181                                         $tplrow->setVariable(
"STYLE", 
" style=\"border-bottom: 1px solid $bordercolor!important\"");
 
 1184                         $template->setCurrentBlock(
"matrix_row");
 
 1185                         $template->setVariable(
"ROW", $tplrow->get());
 
 1186                         $template->parseCurrentBlock();
 
 1189                 if ($question_title)
 
 1193                 $template->setCurrentBlock();
 
 1194                 if ($show_questiontext)
 
 1198                 $template->parseCurrentBlock();
 
 1199                 return $template->get();
 
 1209                 $this->tpl->addBlockFile(
"ADM_CONTENT", 
"adm_content", 
"tpl.il_svy_qpl_preview.html", 
"Modules/SurveyQuestionPool");
 
 1211                 $this->tpl->setVariable(
"QUESTION_OUTPUT", $question_output);
 
 1221                 $this->tpl->addBlockFile(
"ADM_CONTENT", 
"adm_content", 
"tpl.il_svy_qpl_layout.html", 
"Modules/SurveyQuestionPool");
 
 1222                 $this->show_layout_row = TRUE;
 
 1224                 $this->tpl->setVariable(
"QUESTION_OUTPUT", $question_output);
 
 1225                 $this->tpl->setVariable(
"FORMACTION", $this->ctrl->getFormAction($this, 
"saveLayout"));
 
 1226                 $this->tpl->setVariable(
"SAVE", $this->lng->txt(
"save"));
 
 1236                 $this->
object->saveLayout(
$_POST[
"percent_row"], 
$_POST[
'percent_columns'], 
$_POST[
'percent_bipolar_adjective1'], 
$_POST[
'percent_bipolar_adjective2'], 
$_POST[
"percent_neutral"]);
 
 1237                 $percent_values = array(
 
 1238                         "percent_row" => 
$_POST[
"percent_row"],
 
 1239                         "percent_columns" => 
$_POST[
"percent_columns"],
 
 1240                         "percent_bipolar_adjective1" => 
$_POST[
'percent_bipolar_adjective1'],
 
 1241                         "percent_bipolar_adjective2" => 
$_POST[
'percent_bipolar_adjective2'],
 
 1242                         "percent_neutral" => 
$_POST[
"percent_neutral"]
 
 1244                 $this->
object->setLayout($percent_values);
 
 1255                 $percent_values = $this->
object->getLayout();
 
 1256                 $template = 
new ilTemplate(
"tpl.il_svy_out_matrix_layout.html", TRUE, TRUE, 
"Modules/SurveyQuestionPool");
 
 1257                 if (strlen($this->object->getBipolarAdjective(0)) && strlen($this->object->getBipolarAdjective(1)))
 
 1259                         $template->setCurrentBlock(
"bipolar_start");
 
 1260                         $template->setVariable(
"VALUE_PERCENT_BIPOLAR_ADJECTIVE1", 
" value=\"" . $percent_values[
"percent_bipolar_adjective1"] . 
"\"");
 
 1261                         $template->setVariable(
"STYLE", 
" style=\"width:" . $percent_values[
"percent_bipolar_adjective1"] . 
"%\"");
 
 1262                         $template->parseCurrentBlock();
 
 1263                         $template->setCurrentBlock(
"bipolar_end");
 
 1264                         $template->setVariable(
"VALUE_PERCENT_BIPOLAR_ADJECTIVE2", 
" value=\"" . $percent_values[
"percent_bipolar_adjective2"] . 
"\"");
 
 1265                         $template->setVariable(
"STYLE", 
" style=\"width:" . $percent_values[
"percent_bipolar_adjective2"] . 
"%\"");
 
 1266                         $template->parseCurrentBlock();
 
 1268                 if (strlen($this->object->hasNeutralColumn()))
 
 1270                         $template->setCurrentBlock(
"bipolar_end");
 
 1271                         $template->setVariable(
"VALUE_PERCENT_NEUTRAL", 
" value=\"" . $percent_values[
"percent_neutral"] . 
"\"");
 
 1272                         $template->setVariable(
"STYLE_NEUTRAL", 
" style=\"width:" . $percent_values[
"percent_neutral"] . 
"%\"");
 
 1273                         $template->parseCurrentBlock();
 
 1275                 $template->setVariable(
"VALUE_PERCENT_ROW", 
" value=\"" . $percent_values[
"percent_row"] . 
"\"");
 
 1276                 $template->setVariable(
"STYLE_ROW", 
" style=\"width:" . $percent_values[
"percent_row"] . 
"%\"");
 
 1277                 $counter = $this->
object->getColumnCount();
 
 1278                 $template->setVariable(
"COLSPAN_COLUMNS", $counter);
 
 1279                 $template->setVariable(
"VALUE_PERCENT_COLUMNS", 
" value=\"" . $percent_values[
"percent_columns"] . 
"\"");
 
 1280                 $template->setVariable(
"STYLE_COLUMNS", 
" style=\"width:" . $percent_values[
"percent_columns"] . 
"%\"");
 
 1281                 return $template->get();
 
 1294                 if (count($this->cumulated) == 0)
 
 1296                         include_once 
"./Modules/Survey/classes/class.ilObjSurvey.php";
 
 1298                         $this->cumulated =& $this->
object->getCumulatedResults($survey_id, $nr_of_users);
 
 1302                 include_once 
"./classes/class.ilTemplate.php";
 
 1303                 $template = 
new ilTemplate(
"tpl.il_svy_svy_cumulated_results_detail.html", TRUE, TRUE, 
"Modules/Survey");
 
 1305                 $template->setCurrentBlock(
"detail_row");
 
 1306                 $template->setVariable(
"TEXT_OPTION", $this->lng->txt(
"question"));
 
 1307                 $questiontext = $this->
object->getQuestiontext();
 
 1308                 $template->setVariable(
"TEXT_OPTION_VALUE", $this->object->prepareTextareaOutput($questiontext, TRUE));
 
 1309                 $template->parseCurrentBlock();
 
 1310                 $template->setCurrentBlock(
"detail_row");
 
 1311                 $template->setVariable(
"TEXT_OPTION", $this->lng->txt(
"question_type"));
 
 1312                 $template->setVariable(
"TEXT_OPTION_VALUE", $this->lng->txt($this->getQuestionType()));
 
 1313                 $template->parseCurrentBlock();
 
 1314                 $template->setCurrentBlock(
"detail_row");
 
 1315                 $template->setVariable(
"TEXT_OPTION", $this->lng->txt(
"users_answered"));
 
 1316                 $template->setVariable(
"TEXT_OPTION_VALUE", $this->cumulated[
"TOTAL"][
"USERS_ANSWERED"]);
 
 1317                 $template->parseCurrentBlock();
 
 1318                 $template->setCurrentBlock(
"detail_row");
 
 1319                 $template->setVariable(
"TEXT_OPTION", $this->lng->txt(
"users_skipped"));
 
 1320                 $template->setVariable(
"TEXT_OPTION_VALUE", $this->cumulated[
"TOTAL"][
"USERS_SKIPPED"]);
 
 1321                 $template->parseCurrentBlock();
 
 1323                 $template->setCurrentBlock(
"detail_row");
 
 1324                 $template->setVariable(
"TEXT_OPTION", $this->lng->txt(
"mode"));
 
 1325                 $template->setVariable(
"TEXT_OPTION_VALUE", $this->cumulated[
"TOTAL"][
"MODE"]);
 
 1326                 $template->parseCurrentBlock();
 
 1327                 $template->setCurrentBlock(
"detail_row");
 
 1328                 $template->setVariable(
"TEXT_OPTION", $this->lng->txt(
"mode_nr_of_selections"));
 
 1329                 $template->setVariable(
"TEXT_OPTION_VALUE", $this->cumulated[
"TOTAL"][
"MODE_NR_OF_SELECTIONS"]);
 
 1330                 $template->parseCurrentBlock();
 
 1331                 $template->setCurrentBlock(
"detail_row");
 
 1332                 $template->setVariable(
"TEXT_OPTION", $this->lng->txt(
"median"));
 
 1333                 $template->setVariable(
"TEXT_OPTION_VALUE", $this->cumulated[
"TOTAL"][
"MEDIAN"]);
 
 1334                 $template->parseCurrentBlock();
 
 1336                 $template->setCurrentBlock(
"detail_row");
 
 1337                 $template->setVariable(
"TEXT_OPTION", $this->lng->txt(
"categories"));
 
 1339                 foreach ($this->cumulated[
"TOTAL"][
"variables"] as $key => $value)
 
 1341                         $columns .= 
"<li>" . $this->lng->txt(
"title") . 
":" . 
"<span class=\"bold\">" . $value[
"title"] . 
"</span><br />" .
 
 1342                                 $this->lng->txt(
"category_nr_selected") . 
": " . 
"<span class=\"bold\">" . $value[
"selected"] . 
"</span><br />" .
 
 1343                                 $this->lng->txt(
"percentage_of_selections") . 
": " . 
"<span class=\"bold\">" . sprintf(
"%.2f", 100*$value[
"percentage"]) . 
"</span></li>";
 
 1346                 $template->setVariable(
"TEXT_OPTION_VALUE", 
$columns);
 
 1347                 $template->parseCurrentBlock();
 
 1349                 foreach ($this->cumulated as $key => $value)
 
 1351                         if (is_numeric($key))
 
 1353                                 $template->setCurrentBlock(
"detail_row");
 
 1354                                 $template->setVariable(
"TEXT_OPTION", $this->lng->txt(
"row"));
 
 1355                                 $questiontext = $value[
"ROW"];
 
 1356                                 $template->setVariable(
"TEXT_OPTION_VALUE", $this->object->prepareTextareaOutput($questiontext, TRUE));
 
 1357                                 $template->parseCurrentBlock();
 
 1358                                 $template->setCurrentBlock(
"detail_row");
 
 1359                                 $template->setVariable(
"TEXT_OPTION", $this->lng->txt(
"users_answered"));
 
 1360                                 $template->setVariable(
"TEXT_OPTION_VALUE", $value[
"USERS_ANSWERED"]);
 
 1361                                 $template->parseCurrentBlock();
 
 1362                                 $template->setCurrentBlock(
"detail_row");
 
 1363                                 $template->setVariable(
"TEXT_OPTION", $this->lng->txt(
"users_skipped"));
 
 1364                                 $template->setVariable(
"TEXT_OPTION_VALUE", $value[
"USERS_SKIPPED"]);
 
 1365                                 $template->parseCurrentBlock();
 
 1367                                 $template->setCurrentBlock(
"detail_row");
 
 1368                                 $template->setVariable(
"TEXT_OPTION", $this->lng->txt(
"mode"));
 
 1369                                 $template->setVariable(
"TEXT_OPTION_VALUE", $value[
"MODE"]);
 
 1370                                 $template->parseCurrentBlock();
 
 1371                                 $template->setCurrentBlock(
"detail_row");
 
 1372                                 $template->setVariable(
"TEXT_OPTION", $this->lng->txt(
"mode_nr_of_selections"));
 
 1373                                 $template->setVariable(
"TEXT_OPTION_VALUE", $value[
"MODE_NR_OF_SELECTIONS"]);
 
 1374                                 $template->parseCurrentBlock();
 
 1375                                 $template->setCurrentBlock(
"detail_row");
 
 1376                                 $template->setVariable(
"TEXT_OPTION", $this->lng->txt(
"median"));
 
 1377                                 $template->setVariable(
"TEXT_OPTION_VALUE", $value[
"MEDIAN"]);
 
 1378                                 $template->parseCurrentBlock();
 
 1380                                 $template->setCurrentBlock(
"detail_row");
 
 1381                                 $template->setVariable(
"TEXT_OPTION", $this->lng->txt(
"categories"));
 
 1383                                 foreach ($value[
"variables"] as $key => $variable)
 
 1385                                         $columns .= 
"<li>" . $this->lng->txt(
"title") . 
":" . 
"<span class=\"bold\">" . $variable[
"title"] . 
"</span><br />" .
 
 1386                                                 $this->lng->txt(
"category_nr_selected") . 
": " . 
"<span class=\"bold\">" . $variable[
"selected"] . 
"</span><br />" .
 
 1387                                                 $this->lng->txt(
"percentage_of_selections") . 
": " . 
"<span class=\"bold\">" . sprintf(
"%.2f", 100*$variable[
"percentage"]) . 
"</span></li>";
 
 1390                                 $template->setVariable(
"TEXT_OPTION_VALUE", 
$columns);
 
 1391                                 $template->parseCurrentBlock();
 
 1394                                 if (is_array($value[
"textanswers"]))
 
 1396                                         $template->setCurrentBlock(
"detail_row");
 
 1397                                         $template->setVariable(
"TEXT_OPTION", $this->lng->txt(
"freetext_answers"));     
 
 1399                                         foreach ($value[
"textanswers"] as $key => $answers)
 
 1401                                                 $html .= $value[
"variables"][$key][
"title"] .
"\n";
 
 1403                                                 foreach ($answers as $answer)
 
 1405                                                         $html .= 
"<li>" . preg_replace(
"/\n/", 
"<br>\n", $answer) . 
"</li>\n";
 
 1409                                         $template->setVariable(
"TEXT_OPTION_VALUE", $html);
 
 1410                                         $template->parseCurrentBlock();
 
 1416                 foreach ($this->cumulated as $key => $value)
 
 1418                         if (is_numeric($key))
 
 1420                                 $template->setCurrentBlock(
"chartimage");
 
 1423                                 include_once 
"./Services/Administration/classes/class.ilSetting.php";
 
 1424                                 $surveySetting = 
new ilSetting(
"survey");
 
 1425                                 if ($surveySetting->get(
"googlechart") == 1)
 
 1427                                         $chartcolors = array(
"2A4BD7", 
"9DAFFF", 
"1D6914", 
"81C57A", 
"814A19", 
"E9DEBB", 
"8126C0", 
"AD2323", 
"29D0D0", 
"FFEE33", 
"FF9233", 
"FFCDF3", 
"A0A0A0", 
"575757", 
"000000");
 
 1428                                         $selections = array();
 
 1431                                         foreach ($value[
"variables"] as $val)
 
 1433                                                 if ($val[
"selected"] > $maxselection) $maxselection = $val[
"selected"];
 
 1434                                                 array_push($selections, $val[
"selected"]);
 
 1435                                                 array_push($values, str_replace(
" ", 
"+", $val[
"title"]));
 
 1438                                         $selectionlabels = 
"";
 
 1439                                         if ($maxselection % 2 == 0)
 
 1441                                                 $selectionlabels = 
"0|" . ($maxselection / 2) . 
"|$maxselection";
 
 1445                                                 $selectionlabels = 
"0|$maxselection";
 
 1447                                         $charturl = 
"http://chart.apis.google.com/chart?chco=" . implode(
"|", array_slice($chartcolors, 0, count($values))). 
"&cht=bvs&chs=" . $chartwidth . 
"x250&chd=t:" . implode(
",", $selections) . 
"&chds=0,$maxselection&chxt=y,y&chxl=0:|$selectionlabels|1:||".str_replace(
" ", 
"+", $this->lng->txt(
"mode_nr_of_selections")).
"|" . 
"&chxr=1,0,$maxselection&chtt=" . str_replace(
" ", 
"+", $value[
"ROW"]) . 
"&chbh=20," . (round($chartwidth/count($values))-25) . 
"&chdl=" . implode(
"|", $values) . 
"&chdlp=b";
 
 1451                                         $this->ctrl->setParameterByClass(
"ilsurveyevaluationgui", 
"type", $key);
 
 1452                                         $this->ctrl->setParameterByClass(
"ilsurveyevaluationgui", 
"survey", $survey_id);
 
 1453                                         $this->ctrl->setParameterByClass(
"ilsurveyevaluationgui", 
"question", $this->object->getId());
 
 1454                                         $charturl = $this->ctrl->getLinkTargetByClass(
"ilsurveyevaluationgui", 
"outChart");
 
 1456                                 $template->setVariable(
"CHART", $charturl);
 
 1457                                 $template->setVariable(
"ALT_CHART", $this->lng->txt(
"chart"));
 
 1458                                 $template->parseCurrentBlock();
 
 1461                 $template->setCurrentBlock(
"chart");
 
 1462                 $template->setVariable(
"TEXT_CHART", $this->lng->txt(
"chart"));
 
 1463                 $template->parseCurrentBlock();
 
 1465                 $template->setVariable(
"QUESTION_TITLE", 
"$counter. ".$this->object->getTitle());
 
 1466                 $output = $template->get();
 
 1472                 global $rbacsystem,$ilTabs;
 
 1473                 $this->ctrl->setParameterByClass(
"$guiclass", 
"sel_question_types", $this->
getQuestionType());
 
 1474                 $this->ctrl->setParameterByClass(
"$guiclass", 
"q_id", 
$_GET[
"q_id"]);
 
 1476                 if ((
$_GET[
"calling_survey"] > 0) || (
$_GET[
"new_for_survey"] > 0))
 
 1481                         if (strlen(
$_GET[
"new_for_survey"]))
 
 1483                                 $addurl = 
"&new_id=" . 
$_GET[
"q_id"];
 
 1485                         $ilTabs->setBackTarget($this->lng->txt(
"menubacktosurvey"), 
"ilias.php?baseClass=ilObjSurveyGUI&ref_id=$ref_id&cmd=questions" . $addurl);
 
 1489                         $this->ctrl->setParameterByClass(
"ilObjSurveyQuestionPoolGUI", 
"q_id_table_nav", 
$_SESSION[
'q_id_table_nav']);
 
 1490                         $ilTabs->setBackTarget($this->lng->txt(
"spl"), $this->ctrl->getLinkTargetByClass(
"ilObjSurveyQuestionPoolGUI", 
"questions"));
 
 1494                         $ilTabs->addTarget(
"preview",
 
 1495                                 $this->ctrl->getLinkTarget($this, 
"preview"), 
 
 1500                         $ilTabs->addTarget(
"layout",
 
 1501                                 $this->ctrl->getLinkTarget($this, 
"layout"), 
 
 1502                                 array(
"layout", 
"saveLayout"),
 
 1506                 if ($rbacsystem->checkAccess(
'edit', 
$_GET[
"ref_id"])) 
 
 1508                         $ilTabs->addTarget(
"edit_properties",
 
 1509                                 $this->ctrl->getLinkTarget($this, 
"editQuestion"), 
 
 1510                                 array(
"editQuestion", 
"cancelExplorer", 
"linkChilds", 
"addGIT", 
"addST",
 
 1511                                         "addPG", 
"editQuestion", 
"addMaterial", 
"removeMaterial", 
 
 1512                                         "save", 
"cancel", 
"savePhrasecolumns", 
"confirmSavePhrase",
 
 1513                                         "downcolumns", 
"upcolumns", 
"addcolumns", 
"removecolumns",
 
 1514                                         "downrows", 
"uprows", 
"addrows", 
"removerows", 
"wizardcolumns",
 
 1515                                         "addSelectedPhrase", 
"insertStandardNumbers"),
 
 1520                 if ($this->object->getId() > 0) 
 
 1522                         $ilTabs->addTarget(
"material",
 
 1523                                                                          $this->ctrl->getLinkTarget($this, 
"material"), 
 
 1524                                                                         array(
"material", 
"cancelExplorer", 
"linkChilds", 
"addGIT", 
"addST",
 
 1525                                                                                          "addPG", 
"addMaterial", 
"removeMaterial"),
 
 1529                 if ($this->object->getId() > 0) 
 
 1531                         $title = $this->lng->txt(
"edit") . 
" "" . $this->
object->getTitle() . 
""";
 
 1538                 $this->tpl->setVariable(
"HEADER", 
$title);