24 include_once
"./Modules/Survey/classes/inc.SurveyConstants.php";
59 $this->
object =& $a_object;
67 $cmd = $this->ctrl->getCmd();
68 $next_class = $this->ctrl->getNextClass($this);
97 if ($rbacsystem->checkAccess(
"write",
$_GET[
"ref_id"]))
109 $surveycode = $this->
object->getUserAccessCode($ilUser->getId());
110 if ($this->object->isAnonymizedParticipant($surveycode))
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();
136 $surveycode =
$_POST[
"surveycode"];
137 if ($this->object->isAnonymizedParticipant($surveycode))
158 include_once
"./Services/Utilities/classes/class.ilUtil.php";
160 $path = $tree->getPathFull($this->object->getRefID());
161 ilUtil::redirect(
"repository.php?cmd=frameset&ref_id=" . $path[count($path) - 2][
"child"]);
179 $format_percent =
"";
180 $format_datetime =
"";
184 switch (
$_POST[
"export_format"])
187 include_once
"./Services/Excel/classes/class.ilExcelWriterAdapter.php";
190 $workbook = $adapter->getWorkbook();
191 $workbook->setVersion(8);
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');
206 include_once (
"./Services/Excel/classes/class.ilExcelUtils.php");
207 $mainworksheet =& $workbook->addWorksheet();
222 array_push($csvrow, $this->lng->txt(
"title"));
223 array_push($csvrow, $this->lng->txt(
"question"));
224 array_push($csvrow, $this->lng->txt(
"question_type"));
225 array_push($csvrow, $this->lng->txt(
"users_answered"));
226 array_push($csvrow, $this->lng->txt(
"users_skipped"));
227 array_push($csvrow, $this->lng->txt(
"mode"));
232 array_push($csvrow, $this->lng->txt(
"mode_nr_of_selections"));
233 array_push($csvrow, $this->lng->txt(
"median"));
234 array_push($csvrow, $this->lng->txt(
"arithmetic_mean"));
235 array_push($csvfile, $csvrow);
238 $questions =& $this->
object->getSurveyQuestions();
240 foreach ($questions as
$data)
242 include_once
"./Modules/SurveyQuestionPool/classes/class.SurveyQuestion.php";
245 $eval = $this->
object->getCumulatedResults($question);
246 switch (
$_POST[
"export_format"])
249 $counter = $question->setExportCumulatedXLS($mainworksheet, $format_title, $format_bold, $eval, $counter);
252 $csvrows =& $question->setExportCumulatedCVS($eval);
253 foreach ($csvrows as $csvrow)
255 array_push($csvfile, $csvrow);
261 switch (
$_POST[
"export_format"])
264 $question->setExportDetailsXLS($workbook, $format_title, $format_bold, $eval);
270 switch (
$_POST[
"export_format"])
281 foreach ($csvfile as $csvrow)
283 $csvrow =& $this->
object->processCSVRow($csvrow, TRUE,
$separator);
286 include_once
"./Services/Utilities/classes/class.ilUtil.php";
295 if (strlen(
$_POST[
"export_format"]))
302 $this->ctrl->redirect($this,
'evaluation');
308 if (strlen(
$_POST[
"export_format"]))
315 $this->ctrl->redirect($this,
'evaluation');
322 $this->ctrl->redirect($this,
'evaluation');
331 if (!$rbacsystem->checkAccess(
"read",
$_GET[
"ref_id"]))
336 switch ($this->object->getEvaluationAccess())
339 if (!$rbacsystem->checkAccess(
"write",
$_GET[
"ref_id"]))
346 include_once
"./Modules/Survey/classes/class.ilObjSurveyAccess.php";
354 if (($this->object->getAnonymize() == 1) && (
$_SESSION[
"anon_evaluation_access"] !=
$_GET[
"ref_id"]))
362 $this->tpl->addBlockFile(
"ADM_CONTENT",
"adm_content",
"tpl.il_svy_svy_evaluation.html",
"Modules/Survey");
363 $questions =& $this->
object->getSurveyQuestions();
366 foreach ($questions as $qdata)
368 include_once
"./Modules/SurveyQuestionPool/classes/class.SurveyQuestion.php";
370 $question = $question_gui->object;
371 $c = $question->getCumulatedResultData($this->object->getSurveyId(), $counter);
376 array_push(
$data, $a);
381 array_push(
$data, $c);
386 $detail = $question_gui->getCumulatedResultsDetails($this->object->getSurveyId(), $counter-1);
387 $this->tpl->setCurrentBlock(
"detail");
388 $this->tpl->setVariable(
"DETAIL", $detail);
389 $this->tpl->parseCurrentBlock();
392 include_once
"./Modules/Survey/classes/tables/class.ilSurveyResultsCumulatedTableGUI.php";
394 $table_gui->setData(
$data);
395 $this->tpl->setVariable(
'CUMULATED', $table_gui->getHTML());
396 $this->tpl->addCss(
"./Modules/Survey/templates/default/survey_print.css",
"print");
412 $questions = array();
413 $questions =& $this->
object->getSurveyQuestions(
true);
414 array_push($csvrow, $this->lng->txt(
"username"));
415 if ($this->object->canExportSurveyCode())
417 array_push($csvrow, $this->lng->txt(
"codes"));
421 array_push($csvrow, $this->lng->txt(
"gender"));
424 foreach ($questions as $question_id => $question_data)
426 include_once
"./Modules/SurveyQuestionPool/classes/class.SurveyQuestion.php";
428 $question->addUserSpecificResultsExportTitles($csvrow);
429 $questions[$question_data[
"question_id"]] = $question;
431 array_push($csvfile, $csvrow);
432 $participants =& $this->
object->getSurveyFinishedIds();
434 foreach ($participants as $user_id)
436 $resultset =& $this->
object->getEvaluationByUser($questions, $user_id);
438 array_push($csvrow, $resultset[
"name"]);
439 if ($this->object->canExportSurveyCode())
441 array_push($csvrow, $user_id);
445 array_push($csvrow, $resultset[
"gender"]);
447 foreach ($questions as $question_id => $question)
449 $question->addUserSpecificResultsData($csvrow, $resultset);
451 array_push($csvfile, $csvrow);
453 switch ($export_format)
456 include_once
"./Services/Excel/classes/class.ilExcelWriterAdapter.php";
459 $workbook = $adapter->getWorkbook();
460 $workbook->setVersion(8);
462 $format_bold =& $workbook->addFormat();
463 $format_bold->setBold();
464 $format_percent =& $workbook->addFormat();
465 $format_percent->setNumFormat(
"0.00%");
466 $format_datetime =& $workbook->addFormat();
467 $format_datetime->setNumFormat(
"DD/MM/YYYY hh:mm:ss");
468 $format_title =& $workbook->addFormat();
469 $format_title->setBold();
470 $format_title->setColor(
'black');
471 $format_title->setPattern(1);
472 $format_title->setFgColor(
'silver');
473 $format_title_plain =& $workbook->addFormat();
474 $format_title_plain->setColor(
'black');
475 $format_title_plain->setPattern(1);
476 $format_title_plain->setFgColor(
'silver');
478 $pages = floor((count($csvfile[0])) / 250) + 1;
479 $worksheets = array();
480 for ($i = 0; $i < $pages; $i++)
482 $worksheets[$i] =& $workbook->addWorksheet();
485 include_once
"./Services/Excel/classes/class.ilExcelUtils.php";
486 foreach ($csvfile as $csvrow)
492 $mainworksheet =& $worksheets[$worksheet];
493 foreach ($csvrow as $text)
500 $mainworksheet =& $worksheets[$worksheet];
508 $mainworksheet =& $worksheets[$worksheet];
509 foreach ($csvrow as $text)
511 if (is_numeric($text))
513 $mainworksheet->writeNumber(
$row, $col++, $text);
523 $mainworksheet =& $worksheets[$worksheet];
537 foreach ($csvfile as $csvrow)
539 $csvrow =& str_replace(
"\n",
" ", $this->object->processCSVRow($csvrow, TRUE,
$separator));
542 include_once
"./Services/Utilities/classes/class.ilUtil.php";
560 if (!$ilAccess->checkAccess(
"write",
"", $this->object->getRefId()))
563 $this->ctrl->redirectByClass(
"ilObjSurveyGUI",
"infoScreen");
569 if (array_key_exists(
"export_format",
$_POST))
574 $this->tpl->addCss(
"./Modules/Survey/templates/default/survey_print.css",
"print");
575 $userResults =& $this->
object->getUserSpecificResults();
577 $this->tpl->addBlockFile(
"ADM_CONTENT",
"adm_content",
"tpl.il_svy_svy_evaluation_user.html",
"Modules/Survey");
579 $classes = array(
"tblrow1top",
"tblrow2top");
580 $questions =& $this->
object->getSurveyQuestions(
true);
581 $this->tpl->setCurrentBlock(
"headercell");
582 $this->tpl->setVariable(
"TEXT_HEADER_CELL", $this->lng->txt(
"username"));
583 $this->tpl->parseCurrentBlock();
586 $this->tpl->setCurrentBlock(
"headercell");
587 $this->tpl->setVariable(
"TEXT_HEADER_CELL", $this->lng->txt(
"gender"));
588 $this->tpl->parseCurrentBlock();
590 $this->tpl->setCurrentBlock(
"headercell");
591 $this->tpl->setVariable(
"TEXT_HEADER_CELL", $this->lng->txt(
"question"));
592 $this->tpl->parseCurrentBlock();
594 $this->tpl->setCurrentBlock(
"headercell");
595 $this->tpl->setVariable(
"TEXT_HEADER_CELL", $this->lng->txt(
"results"));
596 $this->tpl->parseCurrentBlock();
599 $participants =& $this->
object->getSurveyParticipants();
600 foreach ($participants as
$data)
602 $this->tpl->setCurrentBlock(
"bodycell");
603 $this->tpl->setVariable(
"COLOR_CLASS", $classes[$counter % 2]);
604 $this->tpl->setVariable(
"TEXT_BODY_CELL", $data[
"sortname"]);
605 $this->tpl->parseCurrentBlock();
608 $this->tpl->setCurrentBlock(
"bodycell");
609 $this->tpl->setVariable(
"COLOR_CLASS", $classes[$counter % 2]);
610 $this->tpl->setVariable(
"TEXT_BODY_CELL", $data[
"gender"]);
611 $this->tpl->parseCurrentBlock();
614 $questioncounter = 1;
615 foreach ($questions as $question_id => $question_data)
625 $this->tpl->setCurrentBlock(
"bodycell");
626 $this->tpl->setVariable(
"COLOR_CLASS", $classes[$counter % 2]);
627 $this->tpl->parseCurrentBlock();
629 $this->tpl->setCurrentBlock(
"bodycell");
630 $this->tpl->setVariable(
"COLOR_CLASS", $classes[$counter % 2]);
631 $this->tpl->parseCurrentBlock();
633 $this->tpl->setCurrentBlock(
"bodycell");
634 $this->tpl->setVariable(
"COLOR_CLASS", $classes[$counter % 2]);
635 $this->tpl->setVariable(
"TEXT_BODY_CELL", $questioncounter++ .
". " . $question_data[
"title"]);
636 $this->tpl->parseCurrentBlock();
638 $found = $userResults[$question_id][$data[
"active_id"]];
640 if (is_array($found))
642 $text = implode(
"<br />", $found);
648 if (strlen($text) == 0) $text = $this->lng->txt(
"skipped");
649 $this->tpl->setCurrentBlock(
"bodycell");
650 $this->tpl->setVariable(
"COLOR_CLASS", $classes[$counter % 2]);
651 $this->tpl->setVariable(
"TEXT_BODY_CELL", $text);
652 $this->tpl->parseCurrentBlock();
653 $this->tpl->setCurrentBlock(
"row");
654 $this->tpl->parse(
"row");
658 $this->tpl->setCurrentBlock(
"generic_css");
659 $this->tpl->setVariable(
"LOCATION_GENERIC_STYLESHEET",
"./Modules/Survey/templates/default/evaluation_print.css");
660 $this->tpl->setVariable(
"MEDIA_GENERIC_STYLESHEET",
"print");
661 $this->tpl->parseCurrentBlock();
662 $this->tpl->setCurrentBlock(
"adm_content");
663 $this->tpl->setVariable(
"EXPORT_DATA", $this->lng->txt(
"export_data_as"));
664 $this->tpl->setVariable(
"TEXT_EXCEL", $this->lng->txt(
"exp_type_excel"));
665 $this->tpl->setVariable(
"TEXT_CSV", $this->lng->txt(
"exp_type_csv"));
666 $this->tpl->setVariable(
"BTN_EXPORT", $this->lng->txt(
"export"));
667 $this->tpl->setVariable(
"BTN_PRINT", $this->lng->txt(
"print"));
668 $this->tpl->setVariable(
"FORM_ACTION", $this->ctrl->getFormAction($this,
"evaluationuser"));
669 $this->tpl->setVariable(
"PRINT_ACTION", $this->ctrl->getFormAction($this,
"evaluationuser"));
670 $this->tpl->setVariable(
"CMD_EXPORT",
"evaluationuser");
671 $this->tpl->parseCurrentBlock();
683 $survey_id =
$_GET[
"survey"];
684 $question_id =
$_GET[
"question"];
686 $question =& $this->
object->_instanciateQuestion($question_id);
687 $question->outChart($survey_id,
$type);