ILIAS  Release_4_1_x_branch Revision 61804
 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 
366  if (!$rbacsystem->checkAccess("read",$_GET["ref_id"]))
367  {
368  ilUtil::sendFailure($this->lng->txt("permission_denied"));
369  return;
370  }
371  switch ($this->object->getEvaluationAccess())
372  {
374  if (!$rbacsystem->checkAccess("write", $_GET["ref_id"]))
375  {
376  ilUtil::sendFailure($this->lng->txt("permission_denied"));
377  return;
378  }
379  break;
381  include_once "./Modules/Survey/classes/class.ilObjSurveyAccess.php";
382  if (!($rbacsystem->checkAccess("write",$_GET["ref_id"]) || ilObjSurveyAccess::_hasEvaluationAccess($this->object->getId(), $ilUser->getId())))
383  {
384  ilUtil::sendFailure($this->lng->txt("permission_denied"));
385  return;
386  }
387  break;
389  if (($this->object->getAnonymize() == 1) && ($_SESSION["anon_evaluation_access"] != $_GET["ref_id"]))
390  {
392  return;
393  }
394  break;
395  }
396 
397  $this->tpl->addBlockFile("ADM_CONTENT", "adm_content", "tpl.il_svy_svy_evaluation.html", "Modules/Survey");
398  $questions =& $this->object->getSurveyQuestions();
399  $data = array();
400  $counter = 1;
401  foreach ($questions as $qdata)
402  {
403  include_once "./Modules/SurveyQuestionPool/classes/class.SurveyQuestion.php";
404  $question_gui = SurveyQuestion::_instanciateQuestionGUI($qdata["question_id"]);
405  $question = $question_gui->object;
406  $c = $question->getCumulatedResultData($this->object->getSurveyId(), $counter);
407  if (is_array($c[0]))
408  {
409  foreach ($c as $a)
410  {
411  array_push($data, $a);
412  }
413  }
414  else
415  {
416  array_push($data, $c);
417  }
418  $counter++;
419  if ($details)
420  {
421  $detail = $question_gui->getCumulatedResultsDetails($this->object->getSurveyId(), $counter-1);
422  $this->tpl->setCurrentBlock("detail");
423  $this->tpl->setVariable("DETAIL", $detail);
424  $this->tpl->parseCurrentBlock();
425  }
426  }
427 
428  $exporttypes = array(
429  "excel" => $this->lng->txt('exp_type_excel'),
430  "csv" => $this->lng->txt('exp_type_csv')
431  );
432  foreach ($exporttypes as $key => $value)
433  {
434  $this->tpl->setCurrentBlock('exportoption');
435  $this->tpl->setVariable('OPTION_VALUE', $key);
436  $this->tpl->setVariable('OPTION_TITLE', ilUtil::prepareFormOutput($value));
437  $this->tpl->parseCurrentBlock();
438  }
439  $labeldata = array(
440  array("title" => $this->lng->txt('export_label_only'), 'value' => 'label_only'),
441  array("title" => $this->lng->txt('export_title_only'), 'value' => 'title_only'),
442  array("title" => $this->lng->txt('export_title_label'), 'value' => 'title_label')
443  );
444  foreach ($labeldata as $label)
445  {
446  $this->tpl->setCurrentBlock("label_option");
447  $this->tpl->setVariable("LABEL_VALUE", $label['value']);
448  $this->tpl->setVariable("LABEL_TEXT", ilUtil::prepareFormOutput($label['title']));
449  $this->tpl->parseCurrentBlock();
450  }
451  if ($details)
452  {
453  $this->tpl->setVariable('SUBMIT_CMD', 'exportDetailData');
454  }
455  else
456  {
457  $this->tpl->setVariable('SUBMIT_CMD', 'exportData');
458  }
459  $this->tpl->setVariable('SUBMIT_VALUE', $this->lng->txt("export"));
460 
461  include_once "./Modules/Survey/classes/tables/class.ilSurveyResultsCumulatedTableGUI.php";
462  $table_gui = new ilSurveyResultsCumulatedTableGUI($this, 'evaluation', $detail);
463  $table_gui->setData($data);
464  $this->tpl->setVariable('CUMULATED', $table_gui->getHTML());
465  $this->tpl->addCss("./Modules/Survey/templates/default/survey_print.css", "print");
466  $this->tpl->setVariable('FORMACTION', $this->ctrl->getFormAction($this, 'evaluation'));
467  }
468 
476  function exportUserSpecificResults($export_format, $export_label = "")
477  {
478  global $ilLog;
479  $surveyname = ilUtil::getASCIIFilename(preg_replace("/\s/", "_", $this->object->getTitle()));
480  $csvfile = array();
481  $csvrow = array();
482  $questions = array();
483  $questions =& $this->object->getSurveyQuestions(true);
484  array_push($csvrow, $this->lng->txt("username"));
485  if ($this->object->canExportSurveyCode())
486  {
487  array_push($csvrow, $this->lng->txt("codes"));
488  }
489  if ($this->object->getAnonymize() == ANONYMIZE_OFF)
490  {
491  array_push($csvrow, $this->lng->txt("gender"));
492  }
493  $cellcounter = 1;
494  foreach ($questions as $question_id => $question_data)
495  {
496  include_once "./Modules/SurveyQuestionPool/classes/class.SurveyQuestion.php";
497  $question = SurveyQuestion::_instanciateQuestion($question_data["question_id"]);
498  $question->addUserSpecificResultsExportTitles($csvrow, $export_label);
499  $questions[$question_data["question_id"]] = $question;
500  }
501  array_push($csvfile, $csvrow);
502  $participants =& $this->object->getSurveyFinishedIds();
503  foreach ($participants as $user_id)
504  {
505  $resultset =& $this->object->getEvaluationByUser($questions, $user_id);
506  $csvrow = array();
507  array_push($csvrow, $resultset["name"]);
508  if ($this->object->canExportSurveyCode())
509  {
510  array_push($csvrow, $user_id);
511  }
512  if ($this->object->getAnonymize() == ANONYMIZE_OFF)
513  {
514  array_push($csvrow, $resultset["gender"]);
515  }
516  foreach ($questions as $question_id => $question)
517  {
518  $question->addUserSpecificResultsData($csvrow, $resultset);
519  }
520  $wt = $this->object->getWorkingtimeForParticipant($user_id);
521  array_push($csvrow, $wt);
522  array_push($csvfile, $csvrow);
523  }
524  switch ($export_format)
525  {
526  case TYPE_XLS:
527  include_once "./Services/Excel/classes/class.ilExcelWriterAdapter.php";
528  $excelfile = ilUtil::ilTempnam();
529  $adapter = new ilExcelWriterAdapter($excelfile, FALSE);
530  $workbook = $adapter->getWorkbook();
531  $workbook->setVersion(8); // Use Excel97/2000 Format
532  // Creating a worksheet
533  $format_bold =& $workbook->addFormat();
534  $format_bold->setBold();
535  $format_percent =& $workbook->addFormat();
536  $format_percent->setNumFormat("0.00%");
537  $format_datetime =& $workbook->addFormat();
538  $format_datetime->setNumFormat("DD/MM/YYYY hh:mm:ss");
539  $format_title =& $workbook->addFormat();
540  $format_title->setBold();
541  $format_title->setColor('black');
542  $format_title->setPattern(1);
543  $format_title->setFgColor('silver');
544  $format_title_plain =& $workbook->addFormat();
545  $format_title_plain->setColor('black');
546  $format_title_plain->setPattern(1);
547  $format_title_plain->setFgColor('silver');
548  // Creating a worksheet
549  $pages = floor((count($csvfile[0])) / 250) + 1;
550  $worksheets = array();
551  for ($i = 0; $i < $pages; $i++)
552  {
553  $worksheets[$i] =& $workbook->addWorksheet();
554  }
555  $row = 0;
556  include_once "./Services/Excel/classes/class.ilExcelUtils.php";
557  $contentstartrow = 0;
558  foreach ($csvfile as $csvrow)
559  {
560  $col = 0;
561  if ($row == 0)
562  {
563  $worksheet = 0;
564  $mainworksheet =& $worksheets[$worksheet];
565  foreach ($csvrow as $text)
566  {
567  if (is_array($text))
568  {
569  $textcount = 0;
570  foreach ($text as $string)
571  {
572  $mainworksheet->writeString($row + $textcount, $col, ilExcelUtils::_convert_text($string, $_POST["export_format"]), $format_title);
573  $textcount++;
574  $contentstartrow = max($contentstartrow, $textcount);
575  }
576  $col++;
577  }
578  else
579  {
580  $mainworksheet->writeString($row, $col++, ilExcelUtils::_convert_text($text, $_POST["export_format"]), $format_title);
581  }
582  if ($col % 251 == 0)
583  {
584  $worksheet++;
585  $col = 1;
586  $mainworksheet =& $worksheets[$worksheet];
587  $mainworksheet->writeString($row, 0, ilExcelUtils::_convert_text($csvrow[0], $_POST["export_format"]), $format_title);
588  }
589  }
590  $mainworksheet->writeString($row, $col++, ilExcelUtils::_convert_text($this->lng->txt('workingtime'), $_POST['export_format']), $format_title);
591  $row = $contentstartrow;
592  }
593  else
594  {
595  $worksheet = 0;
596  $mainworksheet =& $worksheets[$worksheet];
597  foreach ($csvrow as $text)
598  {
599  if (is_numeric($text))
600  {
601  $mainworksheet->writeNumber($row, $col++, $text);
602  }
603  else
604  {
605  $mainworksheet->writeString($row, $col++, ilExcelUtils::_convert_text($text, $_POST["export_format"]));
606  }
607  if ($col % 251 == 0)
608  {
609  $worksheet++;
610  $col = 1;
611  $mainworksheet =& $worksheets[$worksheet];
612  $mainworksheet->writeString($row, 0, ilExcelUtils::_convert_text($csvrow[0], $_POST["export_format"]));
613  }
614  }
615  }
616  $row++;
617  }
618  $workbook->close();
619  ilUtil::deliverFile($excelfile, "$surveyname.xls", "application/vnd.ms-excel");
620  exit();
621  break;
622  case TYPE_SPSS:
623  $csv = "";
624  $separator = ";";
625  foreach ($csvfile as $csvrow)
626  {
627  $csvrow =& str_replace("\n", " ", $this->object->processCSVRow($csvrow, TRUE, $separator));
628  $csv .= join($csvrow, $separator) . "\n";
629  }
630  include_once "./Services/Utilities/classes/class.ilUtil.php";
631  ilUtil::deliverData($csv, "$surveyname.csv");
632  exit();
633  break;
634  }
635  }
636 
644  function evaluationuser()
645  {
646  global $ilAccess, $ilLog;
647 
648  if (!$ilAccess->checkAccess("write", "", $this->object->getRefId()))
649  {
650  ilUtil::sendFailure($this->lng->txt("no_permission"), TRUE);
651  $this->ctrl->redirectByClass("ilObjSurveyGUI", "infoScreen");
652  }
653  if (!is_array($_POST))
654  {
655  $_POST = array();
656  }
657  if (array_key_exists("export_format", $_POST))
658  {
659  return $this->exportUserSpecificResults($_POST["export_format"], $_POST['export_label']);
660  }
661 
662  $this->tpl->addCss("./Modules/Survey/templates/default/survey_print.css", "print");
663  $userResults =& $this->object->getUserSpecificResults();
665  $this->tpl->addBlockFile("ADM_CONTENT", "adm_content", "tpl.il_svy_svy_evaluation_user.html", "Modules/Survey");
666  $questions =& $this->object->getSurveyQuestions(true);
667  $participants =& $this->object->getSurveyParticipants();
668  $tabledata = array();
669  foreach ($participants as $data)
670  {
671  $questioncounter = 1;
672  $question = "";
673  $results = "";
674  $first = true;
675  foreach ($questions as $question_id => $question_data)
676  {
677  $found = $userResults[$question_id][$data["active_id"]];
678  $text = "";
679  if (is_array($found))
680  {
681  $text = implode("<br />", $found);
682  }
683  else
684  {
685  $text = $found;
686  }
687  if (strlen($text) == 0) $text = $this->lng->txt("skipped");
688  $wt = $this->object->getWorkingtimeForParticipant($data['active_id']);
689  if ($first)
690  {
691  array_push($tabledata, array(
692  'username' => $data["sortname"],
693  'gender' => $data["gender"],
694  'question' => $questioncounter++ . ". " . $question_data["title"],
695  'results' => $text,
696  'workingtime' => $wt
697  ));
698  $first = false;
699  }
700  else
701  {
702  array_push($tabledata, array(
703  'username' => " ",
704  'gender' => " ",
705  'question' => $questioncounter++ . ". " . $question_data["title"],
706  'results' => $text,
707  'workingtime' => null
708  ));
709  }
710  }
711  }
712  $this->tpl->setCurrentBlock("generic_css");
713  $this->tpl->setVariable("LOCATION_GENERIC_STYLESHEET", "./Modules/Survey/templates/default/evaluation_print.css");
714  $this->tpl->setVariable("MEDIA_GENERIC_STYLESHEET", "print");
715  $this->tpl->parseCurrentBlock();
716  $labeldata = array(
717  array("title" => $this->lng->txt('export_label_only'), 'value' => 'label_only'),
718  array("title" => $this->lng->txt('export_title_only'), 'value' => 'title_only'),
719  array("title" => $this->lng->txt('export_title_label'), 'value' => 'title_label')
720  );
721  foreach ($labeldata as $label)
722  {
723  $this->tpl->setCurrentBlock("label_option");
724  $this->tpl->setVariable("LABEL_VALUE", $label['value']);
725  $this->tpl->setVariable("LABEL_TEXT", ilUtil::prepareFormOutput($label['title']));
726  $this->tpl->parseCurrentBlock();
727  }
728  $this->tpl->setCurrentBlock("adm_content");
729  $this->tpl->setVariable("EXPORT_DATA", $this->lng->txt("export_data_as"));
730  $this->tpl->setVariable("TEXT_EXCEL", $this->lng->txt("exp_type_excel"));
731  $this->tpl->setVariable("TEXT_CSV", $this->lng->txt("exp_type_csv"));
732  $this->tpl->setVariable("BTN_EXPORT", $this->lng->txt("export"));
733  $this->tpl->setVariable("BTN_PRINT", $this->lng->txt("print"));
734  $this->tpl->setVariable("FORM_ACTION", $this->ctrl->getFormAction($this, "evaluationuser"));
735  $this->tpl->setVariable("PRINT_ACTION", $this->ctrl->getFormAction($this, "evaluationuser"));
736  $this->tpl->setVariable("CMD_EXPORT", "evaluationuser");
737  include_once "./Modules/Survey/classes/tables/class.ilSurveyResultsUserTableGUI.php";
738  $table_gui = new ilSurveyResultsUserTableGUI($this, 'evaluationuser', $this->object->getAnonymize());
739  $table_gui->setData($tabledata);
740  $this->tpl->setVariable('TABLE', $table_gui->getHTML());
741  $this->tpl->parseCurrentBlock();
742  }
743 
749  function outChart()
750  {
751  $survey_id = $_GET["survey"];
752  $question_id = $_GET["question"];
753  $type = (strlen($_GET["type"])) ? $_GET["type"] : "";
754  $question =& $this->object->_instanciateQuestion($question_id);
755  $question->outChart($survey_id, $type);
756  }
757 }
758 ?>