ILIAS  Release_4_2_x_branch Revision 61807
 All Data Structures Namespaces Files Functions Variables Groups Pages
class.ilSurveyEvaluationGUI.php
Go to the documentation of this file.
1 <?php
2  /*
3  +----------------------------------------------------------------------------+
4  | ILIAS open source |
5  +----------------------------------------------------------------------------+
6  | Copyright (c) 1998-2001 ILIAS open source, University of Cologne |
7  | |
8  | This program is free software; you can redistribute it and/or |
9  | modify it under the terms of the GNU General Public License |
10  | as published by the Free Software Foundation; either version 2 |
11  | of the License, or (at your option) any later version. |
12  | |
13  | This program is distributed in the hope that it will be useful, |
14  | but WITHOUT ANY WARRANTY; without even the implied warranty of |
15  | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
16  | GNU General Public License for more details. |
17  | |
18  | You should have received a copy of the GNU General Public License |
19  | along with this program; if not, write to the Free Software |
20  | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
21  +----------------------------------------------------------------------------+
22 */
23 
24 include_once "./Modules/Survey/classes/inc.SurveyConstants.php";
25 
38 {
39  var $object;
40  var $lng;
41  var $tpl;
42  var $ctrl;
43 
52  function ilSurveyEvaluationGUI($a_object)
53  {
54  global $lng, $tpl, $ilCtrl;
55 
56  $this->lng =& $lng;
57  $this->tpl =& $tpl;
58  $this->ctrl =& $ilCtrl;
59  $this->object =& $a_object;
60  }
61 
65  function &executeCommand()
66  {
67  $cmd = $this->ctrl->getCmd();
68  $next_class = $this->ctrl->getNextClass($this);
69 
70  $cmd = $this->getCommand($cmd);
71  switch($next_class)
72  {
73  default:
74  $ret =& $this->$cmd();
75  break;
76  }
77  return $ret;
78  }
79 
80  function getCommand($cmd)
81  {
82  return $cmd;
83  }
84 
93  {
94  global $rbacsystem;
95  global $ilUser;
96 
97  if ($rbacsystem->checkAccess("write", $_GET["ref_id"]))
98  {
99  // people with write access always have access to the evaluation
100  $_SESSION["anon_evaluation_access"] = $_GET["ref_id"];
101  return $this->evaluation();
102  }
103  if ($this->object->getEvaluationAccess() == EVALUATION_ACCESS_ALL)
104  {
105  // if the evaluation access is open for all users, grant it
106  $_SESSION["anon_evaluation_access"] = $_GET["ref_id"];
107  return $this->evaluation();
108  }
109  $surveycode = $this->object->getUserAccessCode($ilUser->getId());
110  if ($this->object->isAnonymizedParticipant($surveycode))
111  {
112  $_SESSION["anon_evaluation_access"] = $_GET["ref_id"];
113  return $this->evaluation();
114  }
115  $this->tpl->setVariable("TABS", "");
116  $this->tpl->addBlockFile("ADM_CONTENT", "adm_content", "tpl.il_svy_svy_evaluation_checkaccess.html", "Modules/Survey");
117  $this->tpl->setCurrentBlock("adm_content");
118  $this->tpl->setVariable("AUTHENTICATION_NEEDED", $this->lng->txt("svy_check_evaluation_authentication_needed"));
119  $this->tpl->setVariable("FORM_ACTION", $this->ctrl->getFormAction($this, "checkAnonymizedEvaluationAccess"));
120  $this->tpl->setVariable("EVALUATION_CHECKACCESS_INTRODUCTION", $this->lng->txt("svy_check_evaluation_access_introduction"));
121  $this->tpl->setVariable("VALUE_CHECK", $this->lng->txt("ok"));
122  $this->tpl->setVariable("VALUE_CANCEL", $this->lng->txt("cancel"));
123  $this->tpl->setVariable("TEXT_SURVEY_CODE", $this->lng->txt("survey_code"));
124  $this->tpl->parseCurrentBlock();
125  }
126 
135  {
136  $surveycode = $_POST["surveycode"];
137  if ($this->object->isAnonymizedParticipant($surveycode))
138  {
139  $_SESSION["anon_evaluation_access"] = $_GET["ref_id"];
140  $this->evaluation();
141  }
142  else
143  {
144  ilUtil::sendFailure($this->lng->txt("svy_check_evaluation_wrong_key", true));
145  $this->cancelEvaluationAccess();
146  }
147  }
148 
157  {
158  include_once "./Services/Utilities/classes/class.ilUtil.php";
159  global $tree;
160  $path = $tree->getPathFull($this->object->getRefID());
161  ilUtil::redirect("repository.php?cmd=frameset&ref_id=" . $path[count($path) - 2]["child"]);
162  }
163 
171  function evaluationdetails()
172  {
173  $this->evaluation(1);
174  }
175 
176  function exportCumulatedResults($details = 0)
177  {
178  $format_bold = "";
179  $format_percent = "";
180  $format_datetime = "";
181  $format_title = "";
182  $surveyname = ilUtil::getASCIIFilename(preg_replace("/\s/", "_", $this->object->getTitle()));
183 
184  switch ($_POST["export_format"])
185  {
186  case TYPE_XLS:
187  include_once "./Services/Excel/classes/class.ilExcelWriterAdapter.php";
188  $excelfile = ilUtil::ilTempnam();
189  $adapter = new ilExcelWriterAdapter($excelfile, FALSE);
190  $workbook = $adapter->getWorkbook();
191  $workbook->setVersion(8); // Use Excel97/2000 Format
192  // Creating a worksheet
193  $format_bold =& $workbook->addFormat();
194  $format_bold->setBold();
195  $format_percent =& $workbook->addFormat();
196  $format_percent->setNumFormat("0.00%");
197  $format_datetime =& $workbook->addFormat();
198  $format_datetime->setNumFormat("DD/MM/YYYY hh:mm:ss");
199  $format_title =& $workbook->addFormat();
200  $format_title->setBold();
201  $format_title->setColor('black');
202  $format_title->setPattern(1);
203  $format_title->setFgColor('silver');
204  $format_title->setAlign('center');
205  // Creating a worksheet
206  include_once ("./Services/Excel/classes/class.ilExcelUtils.php");
207  $mainworksheet =& $workbook->addWorksheet();
208  $column = 0;
209  switch ($_POST['export_label'])
210  {
211  case 'label_only':
212  $mainworksheet->writeString(0, $column, ilExcelUtils::_convert_text($this->lng->txt("label"), $_POST["export_format"]), $format_bold);
213  break;
214  case 'title_only':
215  $mainworksheet->writeString(0, $column, ilExcelUtils::_convert_text($this->lng->txt("title"), $_POST["export_format"]), $format_bold);
216  break;
217  default:
218  $mainworksheet->writeString(0, $column, ilExcelUtils::_convert_text($this->lng->txt("title"), $_POST["export_format"]), $format_bold);
219  $column++;
220  $mainworksheet->writeString(0, $column, ilExcelUtils::_convert_text($this->lng->txt("label"), $_POST["export_format"]), $format_bold);
221  break;
222  }
223  $column++;
224  $mainworksheet->writeString(0, $column, ilExcelUtils::_convert_text($this->lng->txt("question"), $_POST["export_format"]), $format_bold);
225  $column++;
226  $mainworksheet->writeString(0, $column, ilExcelUtils::_convert_text($this->lng->txt("question_type"), $_POST["export_format"]), $format_bold);
227  $column++;
228  $mainworksheet->writeString(0, $column, ilExcelUtils::_convert_text($this->lng->txt("users_answered"), $_POST["export_format"]), $format_bold);
229  $column++;
230  $mainworksheet->writeString(0, $column, ilExcelUtils::_convert_text($this->lng->txt("users_skipped"), $_POST["export_format"]), $format_bold);
231  $column++;
232  $mainworksheet->writeString(0, $column, ilExcelUtils::_convert_text($this->lng->txt("mode"), $_POST["export_format"]), $format_bold);
233  $column++;
234  $mainworksheet->writeString(0, $column, ilExcelUtils::_convert_text($this->lng->txt("mode_text"), $_POST["export_format"]), $format_bold);
235  $column++;
236  $mainworksheet->writeString(0, $column, ilExcelUtils::_convert_text($this->lng->txt("mode_nr_of_selections"), $_POST["export_format"]), $format_bold);
237  $column++;
238  $mainworksheet->writeString(0, $column, ilExcelUtils::_convert_text($this->lng->txt("median"), $_POST["export_format"]), $format_bold);
239  $column++;
240  $mainworksheet->writeString(0, $column, ilExcelUtils::_convert_text($this->lng->txt("arithmetic_mean"), $_POST["export_format"]), $format_bold);
241  break;
242  case (TYPE_SPSS):
243  $csvfile = array();
244  $csvrow = array();
245  switch ($_POST['export_label'])
246  {
247  case 'label_only':
248  array_push($csvrow, $this->lng->txt("label"));
249  break;
250  case 'title_only':
251  array_push($csvrow, $this->lng->txt("title"));
252  break;
253  default:
254  array_push($csvrow, $this->lng->txt("title"));
255  array_push($csvrow, $this->lng->txt("label"));
256  break;
257  }
258  array_push($csvrow, $this->lng->txt("question"));
259  array_push($csvrow, $this->lng->txt("question_type"));
260  array_push($csvrow, $this->lng->txt("users_answered"));
261  array_push($csvrow, $this->lng->txt("users_skipped"));
262  array_push($csvrow, $this->lng->txt("mode"));
263 
264  //array_push($csvrow, $this->lng->txt("mode_text"));
265 
266 
267  array_push($csvrow, $this->lng->txt("mode_nr_of_selections"));
268  array_push($csvrow, $this->lng->txt("median"));
269  array_push($csvrow, $this->lng->txt("arithmetic_mean"));
270  array_push($csvfile, $csvrow);
271  break;
272  }
273  $questions =& $this->object->getSurveyQuestions();
274  $counter++;
275  foreach ($questions as $data)
276  {
277  include_once "./Modules/SurveyQuestionPool/classes/class.SurveyQuestion.php";
278  $question = SurveyQuestion::_instanciateQuestion($data["question_id"]);
279 
280  $eval = $this->object->getCumulatedResults($question);
281  switch ($_POST["export_format"])
282  {
283  case TYPE_XLS:
284  $counter = $question->setExportCumulatedXLS($mainworksheet, $format_title, $format_bold, $eval, $counter, $_POST['export_label']);
285  break;
286  case (TYPE_SPSS):
287  $csvrows =& $question->setExportCumulatedCVS($eval, $_POST['export_label']);
288  foreach ($csvrows as $csvrow)
289  {
290  array_push($csvfile, $csvrow);
291  }
292  break;
293  }
294  if ($details)
295  {
296  switch ($_POST["export_format"])
297  {
298  case TYPE_XLS:
299  $question->setExportDetailsXLS($workbook, $format_title, $format_bold, $eval, $_POST['export_label']);
300  break;
301  }
302  }
303  }
304 
305  switch ($_POST["export_format"])
306  {
307  case TYPE_XLS:
308  // Let's send the file
309  $workbook->close();
310  ilUtil::deliverFile($excelfile, "$surveyname.xls", "application/vnd.ms-excel");
311  exit();
312  break;
313  case TYPE_SPSS:
314  $csv = "";
315  $separator = ";";
316  foreach ($csvfile as $csvrow)
317  {
318  $csvrow =& $this->object->processCSVRow($csvrow, TRUE, $separator);
319  $csv .= join($csvrow, $separator) . "\n";
320  }
321  include_once "./Services/Utilities/classes/class.ilUtil.php";
322  ilUtil::deliverData($csv, "$surveyname.csv");
323  exit();
324  break;
325  }
326  }
327 
328  public function exportData()
329  {
330  if (strlen($_POST["export_format"]))
331  {
332  $this->exportCumulatedResults(0);
333  return;
334  }
335  else
336  {
337  $this->ctrl->redirect($this, 'evaluation');
338  }
339  }
340 
341  public function exportDetailData()
342  {
343  if (strlen($_POST["export_format"]))
344  {
345  $this->exportCumulatedResults(1);
346  return;
347  }
348  else
349  {
350  $this->ctrl->redirect($this, 'evaluation');
351  }
352  }
353 
354  public function printEvaluation()
355  {
356  ilUtil::sendInfo($this->lng->txt('use_browser_print_function'), true);
357  $this->ctrl->redirect($this, 'evaluation');
358  }
359 
360  function evaluation($details = 0)
361  {
362  global $ilUser;
363  global $rbacsystem;
364  global $ilias;
365  global $ilToolbar;
366 
367  if (!$rbacsystem->checkAccess("read",$_GET["ref_id"]))
368  {
369  ilUtil::sendFailure($this->lng->txt("permission_denied"));
370  return;
371  }
372 
373  $ilToolbar->setFormAction($this->ctrl->getFormAction($this));
374 
375  include_once "Services/Form/classes/class.ilPropertyFormGUI.php";
376  $format = new ilSelectInputGUI("", "export_format");
377  $format->setOptions(array(
378  "excel" => $this->lng->txt('exp_type_excel'),
379  "csv" => $this->lng->txt('exp_type_csv')
380  ));
381  $ilToolbar->addInputItem($format);
382 
383  include_once "Services/Form/classes/class.ilPropertyFormGUI.php";
384  $label = new ilSelectInputGUI("", "export_label");
385  $label->setOptions(array(
386  'label_only' => $this->lng->txt('export_label_only'),
387  'title_only' => $this->lng->txt('export_title_only'),
388  'title_label'=> $this->lng->txt('export_title_label')
389  ));
390  $ilToolbar->addInputItem($label);
391 
392  if ($details)
393  {
394  $ilToolbar->addFormButton($this->lng->txt("export"), 'exportDetailData');
395  }
396  else
397  {
398  $ilToolbar->addFormButton($this->lng->txt("export"), 'exportData');
399  }
400 
401  switch ($this->object->getEvaluationAccess())
402  {
404  if (!$rbacsystem->checkAccess("write", $_GET["ref_id"]))
405  {
406  ilUtil::sendFailure($this->lng->txt("permission_denied"));
407  return;
408  }
409  break;
411  include_once "./Modules/Survey/classes/class.ilObjSurveyAccess.php";
412  if (!($rbacsystem->checkAccess("write",$_GET["ref_id"]) || ilObjSurveyAccess::_hasEvaluationAccess($this->object->getId(), $ilUser->getId())))
413  {
414  ilUtil::sendFailure($this->lng->txt("permission_denied"));
415  return;
416  }
417  break;
419  if (($this->object->getAnonymize() == 1) && ($_SESSION["anon_evaluation_access"] != $_GET["ref_id"]))
420  {
422  return;
423  }
424  break;
425  }
426 
427  $this->tpl->addBlockFile("ADM_CONTENT", "adm_content", "tpl.il_svy_svy_evaluation.html", "Modules/Survey");
428  $questions =& $this->object->getSurveyQuestions();
429  $data = array();
430  $counter = 1;
431  $last_questionblock_id = null;
432  foreach ($questions as $qdata)
433  {
434  include_once "./Modules/SurveyQuestionPool/classes/class.SurveyQuestion.php";
435  $question_gui = SurveyQuestion::_instanciateQuestionGUI($qdata["question_id"]);
436  $question = $question_gui->object;
437  $c = $question->getCumulatedResultData($this->object->getSurveyId(), $counter);
438  if (is_array($c[0]))
439  {
440  foreach ($c as $a)
441  {
442  array_push($data, $a);
443  }
444  }
445  else
446  {
447  array_push($data, $c);
448  }
449  $counter++;
450  if ($details)
451  {
452  // questionblock title handling
453  if($qdata["questionblock_id"] && $qdata["questionblock_id"] != $last_questionblock_id)
454  {
455  $qblock = $this->object->getQuestionblock($qdata["questionblock_id"]);
456  if($qblock["show_blocktitle"])
457  {
458  $this->tpl->setCurrentBlock("detail_qblock");
459  $this->tpl->setVariable("BLOCKTITLE", $qdata["questionblock_title"]);
460  $this->tpl->parseCurrentBlock();
461  }
462 
463  $last_questionblock_id = $qdata["questionblock_id"];
464  }
465 
466  $detail = $question_gui->getCumulatedResultsDetails($this->object->getSurveyId(), $counter-1);
467  $this->tpl->setCurrentBlock("detail");
468  $this->tpl->setVariable("DETAIL", $detail);
469  $this->tpl->parseCurrentBlock();
470  }
471  }
472 
473  include_once "./Modules/Survey/classes/tables/class.ilSurveyResultsCumulatedTableGUI.php";
474  $table_gui = new ilSurveyResultsCumulatedTableGUI($this, 'evaluation', $detail);
475  $table_gui->setData($data);
476  $this->tpl->setVariable('CUMULATED', $table_gui->getHTML());
477  $this->tpl->addCss("./Modules/Survey/templates/default/survey_print.css", "print");
478  $this->tpl->setVariable('FORMACTION', $this->ctrl->getFormAction($this, 'evaluation'));
479  }
480 
488  function exportUserSpecificResults($export_format, $export_label = "")
489  {
490  global $ilLog;
491  $surveyname = ilUtil::getASCIIFilename(preg_replace("/\s/", "_", $this->object->getTitle()));
492  $csvfile = array();
493  $csvrow = array();
494  $questions = array();
495  $questions =& $this->object->getSurveyQuestions(true);
496  array_push($csvrow, $this->lng->txt("username"));
497  array_push($csvrow, $this->lng->txt("login"));
498  if ($this->object->canExportSurveyCode())
499  {
500  array_push($csvrow, $this->lng->txt("codes"));
501  }
502  if ($this->object->getAnonymize() == ANONYMIZE_OFF)
503  {
504  array_push($csvrow, $this->lng->txt("gender"));
505  }
506  $cellcounter = 1;
507  foreach ($questions as $question_id => $question_data)
508  {
509  include_once "./Modules/SurveyQuestionPool/classes/class.SurveyQuestion.php";
510  $question = SurveyQuestion::_instanciateQuestion($question_data["question_id"]);
511  $question->addUserSpecificResultsExportTitles($csvrow, $export_label);
512  $questions[$question_data["question_id"]] = $question;
513  }
514  array_push($csvfile, $csvrow);
515  $participants =& $this->object->getSurveyFinishedIds();
516  foreach ($participants as $user_id)
517  {
518  $resultset =& $this->object->getEvaluationByUser($questions, $user_id);
519  $csvrow = array();
520  array_push($csvrow, $resultset["name"]);
521  array_push($csvrow, $resultset["login"]);
522  if ($this->object->canExportSurveyCode())
523  {
524  array_push($csvrow, $user_id);
525  }
526  if ($this->object->getAnonymize() == ANONYMIZE_OFF)
527  {
528  array_push($csvrow, $resultset["gender"]);
529  }
530  foreach ($questions as $question_id => $question)
531  {
532  $question->addUserSpecificResultsData($csvrow, $resultset);
533  }
534  $wt = $this->object->getWorkingtimeForParticipant($user_id);
535  array_push($csvrow, $wt);
536  array_push($csvfile, $csvrow);
537  }
538  switch ($export_format)
539  {
540  case TYPE_XLS:
541  include_once "./Services/Excel/classes/class.ilExcelWriterAdapter.php";
542  $excelfile = ilUtil::ilTempnam();
543  $adapter = new ilExcelWriterAdapter($excelfile, FALSE);
544  $workbook = $adapter->getWorkbook();
545  $workbook->setVersion(8); // Use Excel97/2000 Format
546  // Creating a worksheet
547  $format_bold =& $workbook->addFormat();
548  $format_bold->setBold();
549  $format_percent =& $workbook->addFormat();
550  $format_percent->setNumFormat("0.00%");
551  $format_datetime =& $workbook->addFormat();
552  $format_datetime->setNumFormat("DD/MM/YYYY hh:mm:ss");
553  $format_title =& $workbook->addFormat();
554  $format_title->setBold();
555  $format_title->setColor('black');
556  $format_title->setPattern(1);
557  $format_title->setFgColor('silver');
558  $format_title_plain =& $workbook->addFormat();
559  $format_title_plain->setColor('black');
560  $format_title_plain->setPattern(1);
561  $format_title_plain->setFgColor('silver');
562  // Creating a worksheet
563  $pages = floor((count($csvfile[0])) / 250) + 1;
564  $worksheets = array();
565  for ($i = 0; $i < $pages; $i++)
566  {
567  $worksheets[$i] =& $workbook->addWorksheet();
568  }
569  $row = 0;
570  include_once "./Services/Excel/classes/class.ilExcelUtils.php";
571  $contentstartrow = 0;
572  foreach ($csvfile as $csvrow)
573  {
574  $col = 0;
575  if ($row == 0)
576  {
577  $worksheet = 0;
578  $mainworksheet =& $worksheets[$worksheet];
579  foreach ($csvrow as $text)
580  {
581  if (is_array($text))
582  {
583  $textcount = 0;
584  foreach ($text as $string)
585  {
586  $mainworksheet->writeString($row + $textcount, $col, ilExcelUtils::_convert_text($string, $_POST["export_format"]), $format_title);
587  $textcount++;
588  $contentstartrow = max($contentstartrow, $textcount);
589  }
590  $col++;
591  }
592  else
593  {
594  $mainworksheet->writeString($row, $col++, ilExcelUtils::_convert_text($text, $_POST["export_format"]), $format_title);
595  }
596  if ($col % 251 == 0)
597  {
598  $worksheet++;
599  $col = 1;
600  $mainworksheet =& $worksheets[$worksheet];
601  $mainworksheet->writeString($row, 0, ilExcelUtils::_convert_text($csvrow[0], $_POST["export_format"]), $format_title);
602  }
603  }
604  $mainworksheet->writeString($row, $col++, ilExcelUtils::_convert_text($this->lng->txt('workingtime'), $_POST['export_format']), $format_title);
605  $row = $contentstartrow;
606  }
607  else
608  {
609  $worksheet = 0;
610  $mainworksheet =& $worksheets[$worksheet];
611  foreach ($csvrow as $text)
612  {
613  if (is_numeric($text))
614  {
615  $mainworksheet->writeNumber($row, $col++, $text);
616  }
617  else
618  {
619  $mainworksheet->writeString($row, $col++, ilExcelUtils::_convert_text($text, $_POST["export_format"]));
620  }
621  if ($col % 251 == 0)
622  {
623  $worksheet++;
624  $col = 1;
625  $mainworksheet =& $worksheets[$worksheet];
626  $mainworksheet->writeString($row, 0, ilExcelUtils::_convert_text($csvrow[0], $_POST["export_format"]));
627  }
628  }
629  }
630  $row++;
631  }
632  $workbook->close();
633  ilUtil::deliverFile($excelfile, "$surveyname.xls", "application/vnd.ms-excel");
634  exit();
635  break;
636  case TYPE_SPSS:
637  $csv = "";
638  $separator = ";";
639  foreach ($csvfile as $csvrow)
640  {
641  $csvrow =& str_replace("\n", " ", $this->object->processCSVRow($csvrow, TRUE, $separator));
642  $csv .= join($csvrow, $separator) . "\n";
643  }
644  include_once "./Services/Utilities/classes/class.ilUtil.php";
645  ilUtil::deliverData($csv, "$surveyname.csv");
646  exit();
647  break;
648  }
649  }
650 
658  function evaluationuser()
659  {
660  global $ilAccess, $ilLog, $ilToolbar;
661 
662  if (!$ilAccess->checkAccess("write", "", $this->object->getRefId()))
663  {
664  ilUtil::sendFailure($this->lng->txt("no_permission"), TRUE);
665  $this->ctrl->redirectByClass("ilObjSurveyGUI", "infoScreen");
666  }
667  if (!is_array($_POST))
668  {
669  $_POST = array();
670  }
671  if (array_key_exists("export_format", $_POST))
672  {
673  return $this->exportUserSpecificResults($_POST["export_format"], $_POST["export_label"]);
674  }
675 
676  $userResults =& $this->object->getUserSpecificResults();
677  $questions =& $this->object->getSurveyQuestions(true);
678  $participants =& $this->object->getSurveyParticipants();
679  $tabledata = array();
680  foreach ($participants as $data)
681  {
682  $questioncounter = 1;
683  $question = "";
684  $results = "";
685  $first = true;
686  foreach ($questions as $question_id => $question_data)
687  {
688  $found = $userResults[$question_id][$data["active_id"]];
689  $text = "";
690  if (is_array($found))
691  {
692  $text = implode("<br />", $found);
693  }
694  else
695  {
696  $text = $found;
697  }
698  if (strlen($text) == 0) $text = $this->lng->txt("skipped");
699  $wt = $this->object->getWorkingtimeForParticipant($data['active_id']);
700  if ($first)
701  {
702  array_push($tabledata, array(
703  'username' => $data["sortname"],
704  'gender' => $data["gender"],
705  'question' => $questioncounter++ . ". " . $question_data["title"],
706  'results' => $text,
707  'workingtime' => $wt
708  ));
709  $first = false;
710  }
711  else
712  {
713  array_push($tabledata, array(
714  'username' => " ",
715  'gender' => " ",
716  'question' => $questioncounter++ . ". " . $question_data["title"],
717  'results' => $text,
718  'workingtime' => null
719  ));
720  }
721  }
722  }
723 
724  $this->tpl->addCss("./Modules/Survey/templates/default/survey_print.css", "print");
725  $this->tpl->setCurrentBlock("generic_css");
726  $this->tpl->setVariable("LOCATION_GENERIC_STYLESHEET", "./Modules/Survey/templates/default/evaluation_print.css");
727  $this->tpl->setVariable("MEDIA_GENERIC_STYLESHEET", "print");
728  $this->tpl->parseCurrentBlock();
729 
730  $ilToolbar->setFormAction($this->ctrl->getFormAction($this, "evaluationuser"));
731 
732  include_once "Services/Form/classes/class.ilPropertyFormGUI.php";
733  $format = new ilSelectInputGUI("", "export_format");
734  $format->setOptions(array(
735  "excel" => $this->lng->txt('exp_type_excel'),
736  "csv" => $this->lng->txt('exp_type_csv')
737  ));
738  $ilToolbar->addInputItem($format);
739 
740  include_once "Services/Form/classes/class.ilPropertyFormGUI.php";
741  $label = new ilSelectInputGUI("", "export_label");
742  $label->setOptions(array(
743  'label_only' => $this->lng->txt('export_label_only'),
744  'title_only' => $this->lng->txt('export_title_only'),
745  'title_label'=> $this->lng->txt('export_title_label')
746  ));
747  $ilToolbar->addInputItem($label);
748 
749  $ilToolbar->addFormButton($this->lng->txt("export"), 'evaluationuser');
750 
751  $ilToolbar->addSeparator();
752 
753  $ilToolbar->addButton($this->lng->txt("print"), "#", "", "", "onclick=\"javascript:window.print()\"");
754 
755  include_once "./Modules/Survey/classes/tables/class.ilSurveyResultsUserTableGUI.php";
756  $table_gui = new ilSurveyResultsUserTableGUI($this, 'evaluationuser', $this->object->getAnonymize());
757  $table_gui->setData($tabledata);
758  $this->tpl->setContent($table_gui->getHTML());
759  }
760 }
761 
762 ?>