ILIAS  eassessment Revision 61809
 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.ilExcelUtils.php";
188  $adapter = ilExcelUtils::ExcelAdapter();
189  $column = 0;
190  switch ($_POST['export_label'])
191  {
192  case 'label_only':
193  $adapter->setCellValue(0, $column, $this->lng->txt("label"), CELL_FORMAT_BOLD);
194  break;
195  case 'title_only':
196  $adapter->setCellValue(0, $column, $this->lng->txt("title"), CELL_FORMAT_BOLD);
197  break;
198  default:
199  $adapter->setCellValue(0, $column, $this->lng->txt("title"), CELL_FORMAT_BOLD);
200  $column++;
201  $adapter->setCellValue(0, $column, $this->lng->txt("label"), CELL_FORMAT_BOLD);
202  break;
203  }
204  $column++;
205  $adapter->setCellValue(0, $column, $this->lng->txt("question"), CELL_FORMAT_BOLD);
206  $column++;
207  $adapter->setCellValue(0, $column, $this->lng->txt("question_type"), CELL_FORMAT_BOLD);
208  $column++;
209  $adapter->setCellValue(0, $column, $this->lng->txt("users_answered"), CELL_FORMAT_BOLD);
210  $column++;
211  $adapter->setCellValue(0, $column, $this->lng->txt("users_skipped"), CELL_FORMAT_BOLD);
212  $column++;
213  $adapter->setCellValue(0, $column, $this->lng->txt("mode"), CELL_FORMAT_BOLD);
214  $column++;
215  $adapter->setCellValue(0, $column, $this->lng->txt("mode_text"), CELL_FORMAT_BOLD);
216  $column++;
217  $adapter->setCellValue(0, $column, $this->lng->txt("mode_nr_of_selections"), CELL_FORMAT_BOLD);
218  $column++;
219  $adapter->setCellValue(0, $column, $this->lng->txt("median"), CELL_FORMAT_BOLD);
220  $column++;
221  $adapter->setCellValue(0, $column, $this->lng->txt("arithmetic_mean"), CELL_FORMAT_BOLD);
222  break;
223  case (TYPE_SPSS):
224  $csvfile = array();
225  $csvrow = array();
226  switch ($_POST['export_label'])
227  {
228  case 'label_only':
229  array_push($csvrow, $this->lng->txt("label"));
230  break;
231  case 'title_only':
232  array_push($csvrow, $this->lng->txt("title"));
233  break;
234  default:
235  array_push($csvrow, $this->lng->txt("title"));
236  array_push($csvrow, $this->lng->txt("label"));
237  break;
238  }
239  array_push($csvrow, $this->lng->txt("question"));
240  array_push($csvrow, $this->lng->txt("question_type"));
241  array_push($csvrow, $this->lng->txt("users_answered"));
242  array_push($csvrow, $this->lng->txt("users_skipped"));
243  array_push($csvrow, $this->lng->txt("mode"));
244 
245  //array_push($csvrow, $this->lng->txt("mode_text"));
246 
247 
248  array_push($csvrow, $this->lng->txt("mode_nr_of_selections"));
249  array_push($csvrow, $this->lng->txt("median"));
250  array_push($csvrow, $this->lng->txt("arithmetic_mean"));
251  array_push($csvfile, $csvrow);
252  break;
253  }
254  $questions =& $this->object->getSurveyQuestions();
255  $counter++;
256  foreach ($questions as $data)
257  {
258  include_once "./Modules/SurveyQuestionPool/classes/class.SurveyQuestion.php";
259  $question = SurveyQuestion::_instanciateQuestion($data["question_id"]);
260 
261  $eval = $this->object->getCumulatedResults($question);
262  switch ($_POST["export_format"])
263  {
264  case TYPE_XLS:
265  $counter = $question->setExportCumulatedXLS($adapter, $eval, $counter, $_POST['export_label']);
266  break;
267  case (TYPE_SPSS):
268  $csvrows =& $question->setExportCumulatedCVS($eval, $_POST['export_label']);
269  foreach ($csvrows as $csvrow)
270  {
271  array_push($csvfile, $csvrow);
272  }
273  break;
274  }
275  if ($details)
276  {
277  switch ($_POST["export_format"])
278  {
279  case TYPE_XLS:
280  $question->setExportDetailsXLS($adapter, $eval, $_POST['export_label']);
281  $adapter->setActiveWorksheet(0);
282  break;
283  }
284  }
285  }
286 
287  switch ($_POST["export_format"])
288  {
289  case TYPE_XLS:
290  // Let's send the file
291  $adapter->deliver($surveyname . "." . $adapter->getFileExtension());
292  exit();
293  break;
294  case TYPE_SPSS:
295  $csv = "";
296  $separator = ";";
297  foreach ($csvfile as $csvrow)
298  {
299  $csvrow =& $this->object->processCSVRow($csvrow, TRUE, $separator);
300  $csv .= join($csvrow, $separator) . "\n";
301  }
302  include_once "./Services/Utilities/classes/class.ilUtil.php";
303  ilUtil::deliverData($csv, "$surveyname.csv");
304  exit();
305  break;
306  }
307  }
308 
309  public function exportData()
310  {
311  if (strlen($_POST["export_format"]))
312  {
313  $this->exportCumulatedResults(0);
314  return;
315  }
316  else
317  {
318  $this->ctrl->redirect($this, 'evaluation');
319  }
320  }
321 
322  public function exportDetailData()
323  {
324  if (strlen($_POST["export_format"]))
325  {
326  $this->exportCumulatedResults(1);
327  return;
328  }
329  else
330  {
331  $this->ctrl->redirect($this, 'evaluation');
332  }
333  }
334 
335  public function printEvaluation()
336  {
337  ilUtil::sendInfo($this->lng->txt('use_browser_print_function'), true);
338  $this->ctrl->redirect($this, 'evaluation');
339  }
340 
341  function evaluation($details = 0)
342  {
343  global $ilUser;
344  global $rbacsystem;
345  global $ilias;
346 
347  if (!$rbacsystem->checkAccess("read",$_GET["ref_id"]))
348  {
349  ilUtil::sendFailure($this->lng->txt("permission_denied"));
350  return;
351  }
352  switch ($this->object->getEvaluationAccess())
353  {
355  if (!$rbacsystem->checkAccess("write", $_GET["ref_id"]))
356  {
357  ilUtil::sendFailure($this->lng->txt("permission_denied"));
358  return;
359  }
360  break;
362  include_once "./Modules/Survey/classes/class.ilObjSurveyAccess.php";
363  if (!($rbacsystem->checkAccess("write",$_GET["ref_id"]) || ilObjSurveyAccess::_hasEvaluationAccess($this->object->getId(), $ilUser->getId())))
364  {
365  ilUtil::sendFailure($this->lng->txt("permission_denied"));
366  return;
367  }
368  break;
370  if (($this->object->getAnonymize() == 1) && ($_SESSION["anon_evaluation_access"] != $_GET["ref_id"]))
371  {
373  return;
374  }
375  break;
376  }
377 
378  $this->tpl->addBlockFile("ADM_CONTENT", "adm_content", "tpl.il_svy_svy_evaluation.html", "Modules/Survey");
379  $questions =& $this->object->getSurveyQuestions();
380  $data = array();
381  $counter = 1;
382  foreach ($questions as $qdata)
383  {
384  include_once "./Modules/SurveyQuestionPool/classes/class.SurveyQuestion.php";
385  $question_gui = SurveyQuestion::_instanciateQuestionGUI($qdata["question_id"]);
386  $question = $question_gui->object;
387  $c = $question->getCumulatedResultData($this->object->getSurveyId(), $counter);
388  if (is_array($c[0]))
389  {
390  foreach ($c as $a)
391  {
392  array_push($data, $a);
393  }
394  }
395  else
396  {
397  array_push($data, $c);
398  }
399  $counter++;
400  if ($details)
401  {
402  $detail = $question_gui->getCumulatedResultsDetails($this->object->getSurveyId(), $counter-1);
403  $this->tpl->setCurrentBlock("detail");
404  $this->tpl->setVariable("DETAIL", $detail);
405  $this->tpl->parseCurrentBlock();
406  }
407  }
408 
409  $exporttypes = array(
410  "excel" => $this->lng->txt('exp_type_excel'),
411  "csv" => $this->lng->txt('exp_type_csv')
412  );
413  foreach ($exporttypes as $key => $value)
414  {
415  $this->tpl->setCurrentBlock('exportoption');
416  $this->tpl->setVariable('OPTION_VALUE', $key);
417  $this->tpl->setVariable('OPTION_TITLE', ilUtil::prepareFormOutput($value));
418  $this->tpl->parseCurrentBlock();
419  }
420  $labeldata = array(
421  array("title" => $this->lng->txt('export_label_only'), 'value' => 'label_only'),
422  array("title" => $this->lng->txt('export_title_only'), 'value' => 'title_only'),
423  array("title" => $this->lng->txt('export_title_label'), 'value' => 'title_label')
424  );
425  foreach ($labeldata as $label)
426  {
427  $this->tpl->setCurrentBlock("label_option");
428  $this->tpl->setVariable("LABEL_VALUE", $label['value']);
429  $this->tpl->setVariable("LABEL_TEXT", ilUtil::prepareFormOutput($label['title']));
430  $this->tpl->parseCurrentBlock();
431  }
432  if ($details)
433  {
434  $this->tpl->setVariable('SUBMIT_CMD', 'exportDetailData');
435  }
436  else
437  {
438  $this->tpl->setVariable('SUBMIT_CMD', 'exportData');
439  }
440  $this->tpl->setVariable('SUBMIT_VALUE', $this->lng->txt("export"));
441 
442  include_once "./Modules/Survey/classes/tables/class.ilSurveyResultsCumulatedTableGUI.php";
443  $table_gui = new ilSurveyResultsCumulatedTableGUI($this, 'evaluation', $detail);
444  $table_gui->setData($data);
445  $this->tpl->setVariable('CUMULATED', $table_gui->getHTML());
446  $this->tpl->addCss("./Modules/Survey/templates/default/survey_print.css", "print");
447  $this->tpl->setVariable('FORMACTION', $this->ctrl->getFormAction($this, 'evaluation'));
448  }
449 
457  function exportUserSpecificResults($export_format, $export_label = "")
458  {
459  global $ilLog;
460  $surveyname = ilUtil::getASCIIFilename(preg_replace("/\s/", "_", $this->object->getTitle()));
461  $csvfile = array();
462  $csvrow = array();
463  $questions = array();
464  $questions =& $this->object->getSurveyQuestions(true);
465  array_push($csvrow, $this->lng->txt("username"));
466  if ($this->object->canExportSurveyCode())
467  {
468  array_push($csvrow, $this->lng->txt("codes"));
469  }
470  if ($this->object->getAnonymize() == ANONYMIZE_OFF)
471  {
472  array_push($csvrow, $this->lng->txt("gender"));
473  }
474  $cellcounter = 1;
475  foreach ($questions as $question_id => $question_data)
476  {
477  include_once "./Modules/SurveyQuestionPool/classes/class.SurveyQuestion.php";
478  $question = SurveyQuestion::_instanciateQuestion($question_data["question_id"]);
479  $question->addUserSpecificResultsExportTitles($csvrow, $export_label);
480  $questions[$question_data["question_id"]] = $question;
481  }
482  array_push($csvfile, $csvrow);
483  $participants =& $this->object->getSurveyFinishedIds();
484  foreach ($participants as $user_id)
485  {
486  $resultset =& $this->object->getEvaluationByUser($questions, $user_id);
487  $csvrow = array();
488  array_push($csvrow, $resultset["name"]);
489  if ($this->object->canExportSurveyCode())
490  {
491  array_push($csvrow, $user_id);
492  }
493  if ($this->object->getAnonymize() == ANONYMIZE_OFF)
494  {
495  array_push($csvrow, $resultset["gender"]);
496  }
497  foreach ($questions as $question_id => $question)
498  {
499  $question->addUserSpecificResultsData($csvrow, $resultset);
500  }
501  $wt = $this->object->getWorkingtimeForParticipant($user_id);
502  array_push($csvrow, $wt);
503  array_push($csvfile, $csvrow);
504  }
505  switch ($export_format)
506  {
507  case TYPE_XLS:
508  include_once "./Services/Excel/classes/class.ilExcelUtils.php";
509  $adapter = ilExcelUtils::ExcelAdapter();
510  $pages = floor((count($csvfile[0])) / 250) + 1;
511  for ($i = 0; $i < $pages; $i++)
512  {
513  $adapter->addWorksheet($this->lng->txt('page') . ' ' . ($i+2));
514  }
515  $row = 0;
516  include_once "./Services/Excel/classes/class.ilExcelUtils.php";
517  $contentstartrow = 0;
518  foreach ($csvfile as $csvrow)
519  {
520  $col = 0;
521  if ($row == 0)
522  {
523  $worksheet = 0;
524  $adapter->setActiveWorksheet($worksheet);
525  foreach ($csvrow as $text)
526  {
527  if (is_array($text))
528  {
529  $textcount = 0;
530  foreach ($text as $string)
531  {
532  $adapter->setCellValue($row + $textcount, $col, $string, CELL_FORMAT_TITLE);
533  $textcount++;
534  $contentstartrow = max($contentstartrow, $textcount);
535  }
536  $col++;
537  }
538  else
539  {
540  $adapter->setCellValue($row, $col++, $text, CELL_FORMAT_TITLE);
541  }
542  if ($col % 251 == 0)
543  {
544  $worksheet++;
545  $col = 1;
546  $adapter->setActiveWorksheet($worksheet);
547  $adapter->setCellValue($row, 0, $csvrow[0], CELL_FORMAT_TITLE);
548  }
549  }
550  $adapter->setCellValue($row, $col++, $this->lng->txt('workingtime'), CELL_FORMAT_TITLE);
551  $row = $contentstartrow;
552  }
553  else
554  {
555  $worksheet = 0;
556  $adapter->setActiveWorksheet($worksheet);
557  foreach ($csvrow as $text)
558  {
559  if (is_numeric($text))
560  {
561  $adapter->setCellValue($row, $col++, $text);
562  }
563  else
564  {
565  $adapter->setCellValue($row, $col++, $text);
566  }
567  if ($col % 251 == 0)
568  {
569  $worksheet++;
570  $col = 1;
571  $adapter->setActiveWorksheet($worksheet);
572  $adapter->setCellValue($row, 0, $csvrow[0]);
573  }
574  }
575  }
576  $row++;
577  }
578  $adapter->deliver($surveyname . "." . $adapter->getFileExtension());
579  exit();
580  break;
581  case TYPE_SPSS:
582  $csv = "";
583  $separator = ";";
584  foreach ($csvfile as $csvrow)
585  {
586  $csvrow =& str_replace("\n", " ", $this->object->processCSVRow($csvrow, TRUE, $separator));
587  $csv .= join($csvrow, $separator) . "\n";
588  }
589  include_once "./Services/Utilities/classes/class.ilUtil.php";
590  ilUtil::deliverData($csv, "$surveyname.csv");
591  exit();
592  break;
593  }
594  }
595 
596  /* Change Sn */
604  function exportEvaluationParticipantsState($export_format)
605  {
606  $surveyname = ilUtil::getASCIIFilename(preg_replace("/\s/", "_", $this->object->getTitle()));
607  $csvfile = array();
608  $csvrow = array();
609  $participants =& $this->object->getSurveyParticipantsState();
610 
611  $cellcounter = 1;
612 
613  #get the keys for header row and then break after first row
614  while ($el = each($participants))
615  {
616  $csvrow = array();
617  while ($field = each($el['value']))
618  {
619  array_push($csvrow, $field['key']);
620  #reset($el['value']);
621  }
622  array_push($csvfile, $csvrow);
623  break;
624  }
625  #then get all data rows
626  reset($participants);
627  while ($el = each($participants)) {
628  $csvrow = array();
629  while ($field = each($el['value']))
630  {
631  array_push($csvrow, $field['value']);
632  }
633  array_push($csvfile, $csvrow);
634  }
635 
636  switch ($export_format)
637  {
638  case TYPE_XLS:
639  ilUtil::sendInfo("Not implemented",TRUE);
640  break;
641  case TYPE_SPSS:
642  $csv = "";
643  $separator = ";";
644  foreach ($csvfile as $csvrow)
645  {
646  $csvrow =& str_replace("\n", " ", $this->object->processCSVRow($csvrow, TRUE, $separator));
647  $csv .= join($csvrow, $separator) . "\n";
648  }
649  include_once "./Services/Utilities/classes/class.ilUtil.php";
650  ilUtil::deliverData($csv, "$surveyname.csv");
651  exit();
652  break;
653 
654  }
655 
656  }
657  /* Change Sn End */
658 
666  function evaluationuser()
667  {
668  global $ilAccess, $ilLog;
669 
670  if (!$ilAccess->checkAccess("write", "", $this->object->getRefId()))
671  {
672  ilUtil::sendFailure($this->lng->txt("no_permission"), TRUE);
673  $this->ctrl->redirectByClass("ilObjSurveyGUI", "infoScreen");
674  }
675  if (!is_array($_POST))
676  {
677  $_POST = array();
678  }
679  if (array_key_exists("export_format", $_POST))
680  {
681  return $this->exportUserSpecificResults($_POST["export_format"], $_POST['export_label']);
682  }
683 
684  $this->tpl->addCss("./Modules/Survey/templates/default/survey_print.css", "print");
685  $userResults =& $this->object->getUserSpecificResults();
687  $this->tpl->addBlockFile("ADM_CONTENT", "adm_content", "tpl.il_svy_svy_evaluation_user.html", "Modules/Survey");
688  $questions =& $this->object->getSurveyQuestions(true);
689  $participants =& $this->object->getSurveyParticipants();
690  $tabledata = array();
691  foreach ($participants as $data)
692  {
693  $questioncounter = 1;
694  $question = "";
695  $results = "";
696  $first = true;
697  foreach ($questions as $question_id => $question_data)
698  {
699  $found = $userResults[$question_id][$data["active_id"]];
700  $text = "";
701  if (is_array($found))
702  {
703  $text = implode("<br />", $found);
704  }
705  else
706  {
707  $text = $found;
708  }
709  if (strlen($text) == 0) $text = $this->lng->txt("skipped");
710  $wt = $this->object->getWorkingtimeForParticipant($data['active_id']);
711  if ($first)
712  {
713  array_push($tabledata, array(
714  'username' => $data["sortname"],
715  'gender' => $data["gender"],
716  'question' => $questioncounter++ . ". " . $question_data["title"],
717  'results' => $text,
718  'workingtime' => $wt
719  ));
720  $first = false;
721  }
722  else
723  {
724  array_push($tabledata, array(
725  'username' => " ",
726  'gender' => " ",
727  'question' => $questioncounter++ . ". " . $question_data["title"],
728  'results' => $text,
729  'workingtime' => null
730  ));
731  }
732  }
733  }
734  $this->tpl->setCurrentBlock("generic_css");
735  $this->tpl->setVariable("LOCATION_GENERIC_STYLESHEET", "./Modules/Survey/templates/default/evaluation_print.css");
736  $this->tpl->setVariable("MEDIA_GENERIC_STYLESHEET", "print");
737  $this->tpl->parseCurrentBlock();
738  $labeldata = array(
739  array("title" => $this->lng->txt('export_label_only'), 'value' => 'label_only'),
740  array("title" => $this->lng->txt('export_title_only'), 'value' => 'title_only'),
741  array("title" => $this->lng->txt('export_title_label'), 'value' => 'title_label')
742  );
743  foreach ($labeldata as $label)
744  {
745  $this->tpl->setCurrentBlock("label_option");
746  $this->tpl->setVariable("LABEL_VALUE", $label['value']);
747  $this->tpl->setVariable("LABEL_TEXT", ilUtil::prepareFormOutput($label['title']));
748  $this->tpl->parseCurrentBlock();
749  }
750  $this->tpl->setCurrentBlock("adm_content");
751  $this->tpl->setVariable("EXPORT_DATA", $this->lng->txt("export_data_as"));
752  $this->tpl->setVariable("TEXT_EXCEL", $this->lng->txt("exp_type_excel"));
753  $this->tpl->setVariable("TEXT_CSV", $this->lng->txt("exp_type_csv"));
754  $this->tpl->setVariable("BTN_EXPORT", $this->lng->txt("export"));
755  $this->tpl->setVariable("BTN_PRINT", $this->lng->txt("print"));
756  $this->tpl->setVariable("FORM_ACTION", $this->ctrl->getFormAction($this, "evaluationuser"));
757  $this->tpl->setVariable("PRINT_ACTION", $this->ctrl->getFormAction($this, "evaluationuser"));
758  $this->tpl->setVariable("CMD_EXPORT", "evaluationuser");
759  include_once "./Modules/Survey/classes/tables/class.ilSurveyResultsUserTableGUI.php";
760  $table_gui = new ilSurveyResultsUserTableGUI($this, 'evaluationuser', $this->object->getAnonymize());
761  $table_gui->setData($tabledata);
762  $this->tpl->setVariable('TABLE', $table_gui->getHTML());
763  $this->tpl->parseCurrentBlock();
764  }
765 
766  /* Change Sn */
775 
776  global $ilAccess;
777  if (!$ilAccess->checkAccess("write", "", $this->object->getRefId()))
778  {
779  ilUtil::sendInfo($this->lng->txt("no_permission"), TRUE);
780  $this->ctrl->redirectByClass("ilObjSurveyGUI", "infoScreen");
781  }
782  if (!is_array($_POST))
783  {
784  $_POST = array();
785  }
786  if (array_key_exists("export_format", $_POST))
787  {
788  return $this->exportEvaluationParticipantsState($_POST["export_format"]);
789  }
790 
791 
792  $this->tpl->addBlockFile("ADM_CONTENT", "adm_content", "tpl.il_svy_svy_evaluation_participants_state.html", "Modules/Survey");
793  $counter = 0;
794  $classes = array("tblrow1top", "tblrow2top");
795 
796  $this->tpl->setCurrentBlock("headercell");
797  $this->tpl->setVariable("TEXT_HEADER_CELL", $this->lng->txt("fullname"));
798  $this->tpl->parseCurrentBlock();
799 
800  $this->tpl->setCurrentBlock("headercell");
801  $this->tpl->setVariable("TEXT_HEADER_CELL", $this->lng->txt("login"));
802  $this->tpl->parseCurrentBlock();
803 
804  $this->tpl->setCurrentBlock("headercell");
805  $this->tpl->setVariable("TEXT_HEADER_CELL", $this->lng->txt("gender"));
806  $this->tpl->parseCurrentBlock();
807 
808  $this->tpl->setCurrentBlock("headercell");
809  $this->tpl->setVariable("TEXT_HEADER_CELL", $this->lng->txt("email"));
810  $this->tpl->parseCurrentBlock();
811 
812  $this->tpl->setCurrentBlock("headercell");
813  $this->tpl->setVariable("TEXT_HEADER_CELL", $this->lng->txt("status"));
814  $this->tpl->parseCurrentBlock();
815 
816  $cellcounter = 1;
817 
818  $participants =& $this->object->getSurveyParticipantsState();
819 
820  foreach ($participants as $data)
821  {
822  $this->tpl->setCurrentBlock("bodycell");
823  $this->tpl->setVariable("COLOR_CLASS", $classes[$counter % 2]);
824  $this->tpl->setVariable("TEXT_BODY_CELL", $data["sortname"]);
825  $this->tpl->parseCurrentBlock();
826 
827  $this->tpl->setCurrentBlock("bodycell");
828  $this->tpl->setVariable("COLOR_CLASS", $classes[$counter % 2]);
829  $this->tpl->setVariable("TEXT_BODY_CELL", $data["login"]);
830  $this->tpl->parseCurrentBlock();
831 
832  $this->tpl->setCurrentBlock("bodycell");
833  $this->tpl->setVariable("COLOR_CLASS", $classes[$counter % 2]);
834  $this->tpl->setVariable("TEXT_BODY_CELL", $data["gender"]);
835  $this->tpl->parseCurrentBlock();
836 
837  $this->tpl->setCurrentBlock("bodycell");
838  $this->tpl->setVariable("COLOR_CLASS", $classes[$counter % 2]);
839  $this->tpl->setVariable("TEXT_BODY_CELL", $data["email"]);
840  $this->tpl->parseCurrentBlock();
841 
842  $this->tpl->setCurrentBlock("bodycell");
843  $this->tpl->setVariable("COLOR_CLASS", $classes[$counter % 2]);
844  $status = ($data["status"]) ? $this->lng->txt("svy_finished") : $this->lng->txt("svy_not_finished");
845  $this->tpl->setVariable("TEXT_BODY_CELL", $status);
846  $this->tpl->parseCurrentBlock();
847  $this->tpl->setCurrentBlock("row");
848  $this->tpl->parse("row");
849  $counter++;
850  }
851  $this->tpl->setCurrentBlock("adm_content");
852  $this->tpl->setVariable("EXPORT_DATA", $this->lng->txt("export_data_as"));
853  $this->tpl->setVariable("TEXT_EXCEL", $this->lng->txt("exp_type_excel"));
854  $this->tpl->setVariable("TEXT_CSV", $this->lng->txt("exp_type_csv"));
855  $this->tpl->setVariable("BTN_EXPORT", $this->lng->txt("export"));
856  $this->tpl->setVariable("BTN_PRINT", $this->lng->txt("print"));
857  $this->tpl->setVariable("FORM_ACTION", $this->ctrl->getFormAction($this));
858  $this->tpl->setVariable("PRINT_ACTION", $this->ctrl->getFormAction($this));
859  $this->tpl->setVariable("CMD_EXPORT", "evaluationparticipantsstate");
860  $this->tpl->parseCurrentBlock();
861 
862  }
863  /* Change Sn End */
864 
865 
871  function outChart()
872  {
873  $survey_id = $_GET["survey"];
874  $question_id = $_GET["question"];
875  $type = (strlen($_GET["type"])) ? $_GET["type"] : "";
876  $question =& $this->object->_instanciateQuestion($question_id);
877  $question->outChart($survey_id, $type);
878  }
879 }
880 ?>