Survey evaluation graphical output. More...
Public Member Functions | |
ilSurveyEvaluationGUI ($a_object) | |
ilSurveyEvaluationGUI constructor | |
& | executeCommand () |
execute command | |
getCommand ($cmd) | |
checkAnonymizedEvaluationAccess () | |
Show the detailed evaluation. | |
checkEvaluationAccess () | |
Checks the evaluation access after entering the survey access code. | |
cancelEvaluationAccess () | |
Cancels the input of the survey access code for evaluation access. | |
evaluationdetails () | |
Show the detailed evaluation. | |
exportCumulatedResults ($details=0) | |
evaluation ($details=0) | |
evaluationuser () | |
Print the survey evaluation for a selected user. | |
setEvalTabs () | |
Set the tabs for the evaluation output. | |
Data Fields | |
$object | |
$lng | |
$tpl | |
$ctrl |
Survey evaluation graphical output.
The ilSurveyEvaluationGUI class creates the evaluation output for the ilObjSurveyGUI class. This saves some heap space because the ilObjSurveyGUI class will be smaller.
class.ilSurveyEvaluationGUI.php Survey
Definition at line 38 of file class.ilSurveyEvaluationGUI.php.
ilSurveyEvaluationGUI::cancelEvaluationAccess | ( | ) |
Cancels the input of the survey access code for evaluation access.
Cancels the input of the survey access code for evaluation access
private
Definition at line 157 of file class.ilSurveyEvaluationGUI.php.
References $tree, and ilUtil::redirect().
Referenced by checkEvaluationAccess().
{ include_once "./classes/class.ilUtil.php"; global $tree; $path = $tree->getPathFull($this->object->getRefID()); ilUtil::redirect("repository.php?cmd=frameset&ref_id=" . $path[count($path) - 2]["child"]); }
ilSurveyEvaluationGUI::checkAnonymizedEvaluationAccess | ( | ) |
Show the detailed evaluation.
Show the detailed evaluation
private
Definition at line 93 of file class.ilSurveyEvaluationGUI.php.
References $_GET, $_SESSION, $rbacsystem, and evaluation().
Referenced by evaluation().
{ global $rbacsystem; global $ilUser; if ($rbacsystem->checkAccess("write", $_GET["ref_id"])) { // people with write access always have access to the evaluation $_SESSION["anon_evaluation_access"] = $_GET["ref_id"]; return $this->evaluation(); } if ($this->object->getEvaluationAccess() == EVALUATION_ACCESS_ALL) { // if the evaluation access is open for all users, grant it $_SESSION["anon_evaluation_access"] = $_GET["ref_id"]; return $this->evaluation(); } $surveycode = $this->object->getUserAccessCode($ilUser->getId()); if ($this->object->isAnonymizedParticipant($surveycode)) { $_SESSION["anon_evaluation_access"] = $_GET["ref_id"]; return $this->evaluation(); } $this->tpl->setVariable("TABS", ""); $this->tpl->addBlockFile("ADM_CONTENT", "adm_content", "tpl.il_svy_svy_evaluation_checkaccess.html", true); $this->tpl->setCurrentBlock("adm_content"); $this->tpl->setVariable("AUTHENTICATION_NEEDED", $this->lng->txt("svy_check_evaluation_authentication_needed")); $this->tpl->setVariable("FORM_ACTION", $this->ctrl->getFormAction($this)); $this->tpl->setVariable("EVALUATION_CHECKACCESS_INTRODUCTION", $this->lng->txt("svy_check_evaluation_access_introduction")); $this->tpl->setVariable("VALUE_CHECK", $this->lng->txt("ok")); $this->tpl->setVariable("VALUE_CANCEL", $this->lng->txt("cancel")); $this->tpl->setVariable("TEXT_SURVEY_CODE", $this->lng->txt("survey_code")); $this->tpl->parseCurrentBlock(); }
ilSurveyEvaluationGUI::checkEvaluationAccess | ( | ) |
Checks the evaluation access after entering the survey access code.
Checks the evaluation access after entering the survey access code
private
Definition at line 135 of file class.ilSurveyEvaluationGUI.php.
References $_GET, $_POST, $_SESSION, cancelEvaluationAccess(), evaluation(), and sendInfo().
{ $surveycode = $_POST["surveycode"]; if ($this->object->isAnonymizedParticipant($surveycode)) { $_SESSION["anon_evaluation_access"] = $_GET["ref_id"]; $this->evaluation(); } else { sendInfo($this->lng->txt("svy_check_evaluation_wrong_key", true)); $this->cancelEvaluationAccess(); } }
ilSurveyEvaluationGUI::evaluation | ( | $ | details = 0 |
) |
Definition at line 464 of file class.ilSurveyEvaluationGUI.php.
References $_GET, $_POST, $_SESSION, $counter, $data, $ilias, $rbacsystem, $row, SurveyQuestion::_getQuestionType(), ilObjSurveyAccess::_hasEvaluationAccess(), checkAnonymizedEvaluationAccess(), exportCumulatedResults(), sendInfo(), and setEvalTabs().
Referenced by checkAnonymizedEvaluationAccess(), checkEvaluationAccess(), and evaluationdetails().
{ global $ilUser; global $rbacsystem; global $ilias; switch ($this->object->getEvaluationAccess()) { case EVALUATION_ACCESS_OFF: if (!$rbacsystem->checkAccess("write", $_GET["ref_id"])) { sendInfo($this->lng->txt("permission_denied")); return; } break; case EVALUATION_ACCESS_ALL: include_once "./survey/classes/class.ilObjSurveyAccess.php"; if (!($rbacsystem->checkAccess("write",$_GET["ref_id"]) || ilObjSurveyAccess::_hasEvaluationAccess($this->object->getId(), $ilUser->getId()))) { sendInfo($this->lng->txt("permission_denied")); return; } break; case EVALUATION_ACCESS_PARTICIPANTS: if (($this->object->getAnonymize() == 1) && ($_SESSION["anon_evaluation_access"] != $_GET["ref_id"])) { $this->checkAnonymizedEvaluationAccess(); return; } break; } if (strlen($_POST["export_format"])) { $this->exportCumulatedResults($details); return; } $this->setEvalTabs(); sendInfo(); $this->tpl->addBlockFile("ADM_CONTENT", "adm_content", "tpl.il_svy_svy_evaluation.html", true); $counter = 0; $classes = array("tblrow1", "tblrow2"); $questions =& $this->object->getSurveyQuestions(); foreach ($questions as $data) { include_once "./survey/classes/class.SurveyQuestion.php"; $question_type = SurveyQuestion::_getQuestionType($data["question_id"]); $question_type_gui = $question_type . "GUI"; include_once "./survey/classes/class.$question_type". "GUI.php"; $question_gui = new $question_type_gui($data["question_id"]); $question = $question_gui->object; //$question->loadFromDb($data["question_id"]); $eval = $this->object->getCumulatedResults($question); $row =& $question->outEvaluationCumulatedResults($eval); $this->tpl->setCurrentBlock("row"); $this->tpl->setVariable("QUESTION_TITLE", ($counter+1) . ". ".$row["QUESTION_TITLE"]); $maxlen = 37; $questiontext = preg_replace("/<[^>]+?>/ims", "", $row["QUESTION_TEXT"]); if (strlen($questiontext) > $maxlen + 3) { $questiontext = substr($questiontext, 0, $maxlen) . "..."; } $this->tpl->setVariable("QUESTION_TEXT", $questiontext); $this->tpl->setVariable("USERS_ANSWERED", $row["USERS_ANSWERED"]); $this->tpl->setVariable("USERS_SKIPPED", $row["USERS_SKIPPED"]); $this->tpl->setVariable("QUESTION_TYPE", $row["QUESTION_TYPE"]); $this->tpl->setVariable("MODE", $row["MODE"]); $this->tpl->setVariable("MODE_NR_OF_SELECTIONS", $row["MODE_NR_OF_SELECTIONS"]); $this->tpl->setVariable("MEDIAN", $row["MEDIAN"]); $this->tpl->setVariable("ARITHMETIC_MEAN", $row["ARITHMETIC_MEAN"]); $this->tpl->setVariable("COLOR_CLASS", $classes[$counter % 2]); $this->tpl->parseCurrentBlock(); if ($details) { $question_gui->outCumulatedResultsDetails($eval, $counter+1); } $counter++; } $this->tpl->setCurrentBlock("generic_css"); $this->tpl->setVariable("LOCATION_GENERIC_STYLESHEET", "./survey/templates/default/evaluation_print.css"); $this->tpl->setVariable("MEDIA_GENERIC_STYLESHEET", "print"); $this->tpl->parseCurrentBlock(); $this->tpl->setCurrentBlock("adm_content"); $this->tpl->setVariable("QUESTION_TITLE", $this->lng->txt("title")); $this->tpl->setVariable("QUESTION_TEXT", $this->lng->txt("question")); $this->tpl->setVariable("QUESTION_TYPE", $this->lng->txt("question_type")); $this->tpl->setVariable("USERS_ANSWERED", $this->lng->txt("users_answered")); $this->tpl->setVariable("USERS_SKIPPED", $this->lng->txt("users_skipped")); $this->tpl->setVariable("MODE", $this->lng->txt("mode")); $this->tpl->setVariable("MODE_NR_OF_SELECTIONS", $this->lng->txt("mode_nr_of_selections")); $this->tpl->setVariable("MEDIAN", $this->lng->txt("median")); $this->tpl->setVariable("ARITHMETIC_MEAN", $this->lng->txt("arithmetic_mean")); $this->tpl->setVariable("EXPORT_DATA", $this->lng->txt("export_data_as")); $this->tpl->setVariable("TEXT_EXCEL", $this->lng->txt("exp_type_excel")); $this->tpl->setVariable("TEXT_CSV", $this->lng->txt("exp_type_csv")); $this->tpl->setVariable("VALUE_DETAIL", $details); $this->tpl->setVariable("BTN_EXPORT", $this->lng->txt("export")); $this->tpl->setVariable("BTN_PRINT", $this->lng->txt("print")); $this->tpl->setVariable("FORM_ACTION", $this->ctrl->getFormAction($this)); $this->tpl->setVariable("PRINT_ACTION", $this->ctrl->getFormAction($this)); if ($details) { $this->tpl->setVariable("CMD_EXPORT", "evaluationdetails"); } else { $this->tpl->setVariable("CMD_EXPORT", "evaluation"); } $this->tpl->parseCurrentBlock(); }
ilSurveyEvaluationGUI::evaluationdetails | ( | ) |
Show the detailed evaluation.
Show the detailed evaluation
private
Definition at line 172 of file class.ilSurveyEvaluationGUI.php.
References evaluation().
{ $this->evaluation(1); }
ilSurveyEvaluationGUI::evaluationuser | ( | ) |
Print the survey evaluation for a selected user.
Print the survey evaluation for a selected user
private
Definition at line 586 of file class.ilSurveyEvaluationGUI.php.
References $_POST, $counter, $key, $row, $separator, $user_id, ilExcelUtils::_convert_text(), ilUtil::deliverData(), ilUtil::deliverFile(), exit, ilUtil::getASCIIFilename(), ilUtil::ilTempnam(), ilUtil::prepareFormOutput(), sendInfo(), and setEvalTabs().
{ if (!is_array($_POST)) { $_POST = array(); } $format_bold = ""; $format_percent = ""; $format_datetime = ""; $format_title = ""; $format_title_plain = ""; $surveyname = ilUtil::getASCIIFilename(preg_replace("/\s/", "_", $this->object->getTitle())); $eval =& $this->object->getEvaluationForAllUsers(); $this->setEvalTabs(); sendInfo(); $this->tpl->addBlockFile("ADM_CONTENT", "adm_content", "tpl.il_svy_svy_evaluation_user.html", true); $counter = 0; $classes = array("tblrow1top", "tblrow2top"); $csvrow = array(); $questions =& $this->object->getSurveyQuestions(true); $this->tpl->setCurrentBlock("headercell"); $this->tpl->setVariable("TEXT_HEADER_CELL", $this->lng->txt("username")); $this->tpl->parseCurrentBlock(); if ($this->object->getAnonymize() == ANONYMIZE_OFF) { $this->tpl->setCurrentBlock("headercell"); $this->tpl->setVariable("TEXT_HEADER_CELL", $this->lng->txt("gender")); $this->tpl->parseCurrentBlock(); } if (array_key_exists("export_format", $_POST)) { array_push($csvrow, $this->lng->txt("username")); if ($this->object->getAnonymize() == ANONYMIZE_OFF) { array_push($csvrow, $this->lng->txt("gender")); } } $char = "A"; $cellcounter = 1; foreach ($questions as $question_id => $question_data) { $this->tpl->setCurrentBlock("headercell"); $this->tpl->setVariable("TEXT_HEADER_CELL", $char); $this->tpl->parseCurrentBlock(); $this->tpl->setCurrentBlock("legendrow"); $this->tpl->setVariable("TEXT_KEY", $char++); $this->tpl->setVariable("TEXT_VALUE", $question_data["title"]); if (array_key_exists("export_format", $_POST)) { array_push($csvrow, $question_data["title"]); switch ($question_data["questiontype_fi"]) { case 1: include_once "./survey/classes/class.SurveyNominalQuestion.php"; if ($question_data["subtype"] == SUBTYPE_MCMR) { foreach ($question_data["answers"] as $cat => $cattext) { array_push($csvrow, ($cat+1) . " - $cattext"); } } break; case 2: case 3: case 4: break; } } $this->tpl->parseCurrentBlock(); } $csvfile = array(); array_push($csvfile, $csvrow); foreach ($eval as $user_id => $resultset) { $csvrow = array(); $this->tpl->setCurrentBlock("bodycell"); $this->tpl->setVariable("COLOR_CLASS", $classes[$counter % 2]); $this->tpl->setVariable("TEXT_BODY_CELL", $resultset["name"]); array_push($csvrow, $resultset["name"]); $this->tpl->parseCurrentBlock(); if ($this->object->getAnonymize() == ANONYMIZE_OFF) { $this->tpl->setCurrentBlock("bodycell"); $this->tpl->setVariable("COLOR_CLASS", $classes[$counter % 2]); $this->tpl->setVariable("TEXT_BODY_CELL", $resultset["gender"]); array_push($csvrow, $resultset["gender"]); $this->tpl->parseCurrentBlock(); } foreach ($questions as $question_id => $question_data) { // csv output if (array_key_exists("export_format", $_POST)) { switch ($question_data["questiontype_fi"]) { case 1: // nominal question include_once "./survey/classes/class.SurveyNominalQuestion.php"; if (count($resultset["answers"][$question_id])) { if ($question_data["subtype"] == SUBTYPE_MCMR) { array_push($csvrow, ""); foreach ($question_data["answers"] as $cat => $cattext) { $found = 0; foreach ($resultset["answers"][$question_id] as $answerdata) { if (strcmp($cat, $answerdata["value"]) == 0) { $found = 1; } } if ($found) { array_push($csvrow, "1"); } else { array_push($csvrow, "0"); } } } else { array_push($csvrow, $resultset["answers"][$question_id][0]["value"]+1); } } else { array_push($csvrow, $this->lng->txt("skipped")); if ($question_data["subtype"] == SUBTYPE_MCMR) { foreach ($question_data["answers"] as $cat => $cattext) { array_push($csvrow, ""); } } } break; case 2: // ordinal question if (count($resultset["answers"][$question_id])) { foreach ($resultset["answers"][$question_id] as $key => $answer) { array_push($csvrow, $answer["value"]+1); } } else { array_push($csvrow, $this->lng->txt("skipped")); } break; case 3: // metric question if (count($resultset["answers"][$question_id])) { foreach ($resultset["answers"][$question_id] as $key => $answer) { array_push($csvrow, $answer["value"]); } } else { array_push($csvrow, $this->lng->txt("skipped")); } break; case 4: // text question if (count($resultset["answers"][$question_id])) { foreach ($resultset["answers"][$question_id] as $key => $answer) { array_push($csvrow, $answer["textanswer"]); } } else { array_push($csvrow, $this->lng->txt("skipped")); } break; } } // html output if (count($resultset["answers"][$question_id])) { $answervalues = array(); include_once "./classes/class.ilUtil.php"; foreach ($resultset["answers"][$question_id] as $key => $answer) { switch ($question_data["questiontype_fi"]) { case 1: // nominal question if (strcmp($answer["value"], "") != 0) { array_push($answervalues, ($answer["value"]+1) . " - " . ilUtil::prepareFormOutput($questions[$question_id]["answers"][$answer["value"]])); } break; case 2: // ordinal question array_push($answervalues, ($answer["value"]+1) . " - " . ilUtil::prepareFormOutput($questions[$question_id]["answers"][$answer["value"]])); break; case 3: // metric question array_push($answervalues, $answer["value"]); break; case 4: // text question array_push($answervalues, $answer["textanswer"]); break; } } $this->tpl->setCurrentBlock("bodycell"); $this->tpl->setVariable("COLOR_CLASS", $classes[$counter % 2]); $this->tpl->setVariable("TEXT_BODY_CELL", join($answervalues, "<br />")); $this->tpl->parseCurrentBlock(); } else { $this->tpl->setCurrentBlock("bodycell"); $this->tpl->setVariable("COLOR_CLASS", $classes[$counter % 2]); $this->tpl->setVariable("TEXT_BODY_CELL", $this->lng->txt("skipped")); $this->tpl->parseCurrentBlock(); } } $this->tpl->setCurrentBlock("row"); $this->tpl->parse("row"); $counter++; array_push($csvfile, $csvrow); } $this->tpl->setCurrentBlock("generic_css"); $this->tpl->setVariable("LOCATION_GENERIC_STYLESHEET", "./survey/templates/default/evaluation_print.css"); $this->tpl->setVariable("MEDIA_GENERIC_STYLESHEET", "print"); $this->tpl->parseCurrentBlock(); $this->tpl->setCurrentBlock("adm_content"); $this->tpl->setVariable("EXPORT_DATA", $this->lng->txt("export_data_as")); $this->tpl->setVariable("TEXT_EXCEL", $this->lng->txt("exp_type_excel")); $this->tpl->setVariable("TEXT_CSV", $this->lng->txt("exp_type_csv")); $this->tpl->setVariable("BTN_EXPORT", $this->lng->txt("export")); $this->tpl->setVariable("BTN_PRINT", $this->lng->txt("print")); $this->tpl->setVariable("FORM_ACTION", $this->ctrl->getFormAction($this)); $this->tpl->setVariable("PRINT_ACTION", $this->ctrl->getFormAction($this)); $this->tpl->setVariable("TEXT_LEGEND", $this->lng->txt("legend")); $this->tpl->setVariable("TEXT_LEGEND_LINK", $this->lng->txt("eval_legend_link")); $this->tpl->setVariable("CMD_EXPORT", "evaluationuser"); $this->tpl->parseCurrentBlock(); switch ($_POST["export_format"]) { case TYPE_XLS: include_once "./classes/class.ilExcelWriterAdapter.php"; $excelfile = ilUtil::ilTempnam(); $adapter = new ilExcelWriterAdapter($excelfile, FALSE); $workbook = $adapter->getWorkbook(); $workbook->setVersion(8); // Use Excel97/2000 Format // Creating a worksheet $format_bold =& $workbook->addFormat(); $format_bold->setBold(); $format_percent =& $workbook->addFormat(); $format_percent->setNumFormat("0.00%"); $format_datetime =& $workbook->addFormat(); $format_datetime->setNumFormat("DD/MM/YYYY hh:mm:ss"); $format_title =& $workbook->addFormat(); $format_title->setBold(); $format_title->setColor('black'); $format_title->setPattern(1); $format_title->setFgColor('silver'); $format_title_plain =& $workbook->addFormat(); $format_title_plain->setColor('black'); $format_title_plain->setPattern(1); $format_title_plain->setFgColor('silver'); // Creating a worksheet $mainworksheet =& $workbook->addWorksheet(); $row = 0; include_once "./classes/class.ilExcelUtils.php"; foreach ($csvfile as $csvrow) { $col = 0; if ($row == 0) { foreach ($csvrow as $text) { $mainworksheet->writeString($row, $col++, ilExcelUtils::_convert_text($text, $_POST["export_format"]), $format_title); } } else { foreach ($csvrow as $text) { if (is_numeric($text)) { $mainworksheet->writeNumber($row, $col++, $text); } else { $mainworksheet->writeString($row, $col++, ilExcelUtils::_convert_text($text, $_POST["export_format"])); } } } $row++; } $workbook->close(); ilUtil::deliverFile($excelfile, "$surveyname.xls", "application/vnd.ms-excel"); exit(); break; case TYPE_SPSS: $csv = ""; $separator = ";"; foreach ($csvfile as $csvrow) { $csvrow =& $this->object->processCSVRow($csvrow, TRUE, $separator); $csv .= join($csvrow, $separator) . "\n"; } include_once "./classes/class.ilUtil.php"; ilUtil::deliverData($csv, "$surveyname.csv"); exit(); break; } }
& ilSurveyEvaluationGUI::executeCommand | ( | ) |
execute command
Definition at line 66 of file class.ilSurveyEvaluationGUI.php.
References $cmd, and getCommand().
{ $cmd = $this->ctrl->getCmd(); $next_class = $this->ctrl->getNextClass($this); $cmd = $this->getCommand($cmd); switch($next_class) { default: $ret =& $this->$cmd(); break; } return $ret; }
ilSurveyEvaluationGUI::exportCumulatedResults | ( | $ | details = 0 |
) |
Definition at line 177 of file class.ilSurveyEvaluationGUI.php.
References $_POST, $counter, $data, $key, $row, $separator, ilExcelUtils::_convert_text(), SurveyQuestion::_getQuestionType(), ilUtil::deliverData(), ilUtil::deliverFile(), exit, ilUtil::getASCIIFilename(), and ilUtil::ilTempnam().
Referenced by evaluation().
{ $format_bold = ""; $format_percent = ""; $format_datetime = ""; $format_title = ""; $surveyname = ilUtil::getASCIIFilename(preg_replace("/\s/", "_", $this->object->getTitle())); switch ($_POST["export_format"]) { case TYPE_XLS: // Creating a workbook include_once "./classes/class.ilExcelWriterAdapter.php"; $excelfile = ilUtil::ilTempnam(); $adapter = new ilExcelWriterAdapter($excelfile, FALSE); $workbook = $adapter->getWorkbook(); $workbook->setVersion(8); // Use Excel97/2000 Format $format_bold =& $workbook->addFormat(); $format_bold->setBold(); $format_percent =& $workbook->addFormat(); $format_percent->setNumFormat("0.00%"); $format_datetime =& $workbook->addFormat(); $format_datetime->setNumFormat("DD/MM/YYYY hh:mm:ss"); $format_title =& $workbook->addFormat(); $format_title->setBold(); $format_title->setColor('black'); $format_title->setPattern(1); $format_title->setFgColor('silver'); // Creating a worksheet include_once ("./classes/class.ilExcelUtils.php"); $mainworksheet =& $workbook->addWorksheet(); include_once ("./classes/class.ilExcelUtils.php"); $mainworksheet->writeString(0, 0, ilExcelUtils::_convert_text($this->lng->txt("title"), $_POST["export_format"]), $format_bold); $mainworksheet->writeString(0, 1, ilExcelUtils::_convert_text($this->lng->txt("question"), $_POST["export_format"]), $format_bold); $mainworksheet->writeString(0, 2, ilExcelUtils::_convert_text($this->lng->txt("question_type"), $_POST["export_format"]), $format_bold); $mainworksheet->writeString(0, 3, ilExcelUtils::_convert_text($this->lng->txt("users_answered"), $_POST["export_format"]), $format_bold); $mainworksheet->writeString(0, 4, ilExcelUtils::_convert_text($this->lng->txt("users_skipped"), $_POST["export_format"]), $format_bold); $mainworksheet->writeString(0, 5, ilExcelUtils::_convert_text($this->lng->txt("mode"), $_POST["export_format"]), $format_bold); $mainworksheet->writeString(0, 6, ilExcelUtils::_convert_text($this->lng->txt("mode_text"), $_POST["export_format"]), $format_bold); $mainworksheet->writeString(0, 7, ilExcelUtils::_convert_text($this->lng->txt("mode_nr_of_selections"), $_POST["export_format"]), $format_bold); $mainworksheet->writeString(0, 8, ilExcelUtils::_convert_text($this->lng->txt("median"), $_POST["export_format"]), $format_bold); $mainworksheet->writeString(0, 9, ilExcelUtils::_convert_text($this->lng->txt("arithmetic_mean"), $_POST["export_format"]), $format_bold); break; case (TYPE_SPSS): $csvfile = array(); $csvrow = array(); array_push($csvrow, $this->lng->txt("title")); array_push($csvrow, $this->lng->txt("question")); array_push($csvrow, $this->lng->txt("question_type")); array_push($csvrow, $this->lng->txt("users_answered")); array_push($csvrow, $this->lng->txt("users_skipped")); array_push($csvrow, $this->lng->txt("mode")); //array_push($csvrow, $this->lng->txt("mode_text")); array_push($csvrow, $this->lng->txt("mode_nr_of_selections")); array_push($csvrow, $this->lng->txt("median")); array_push($csvrow, $this->lng->txt("arithmetic_mean")); array_push($csvfile, $csvrow); break; } $questions =& $this->object->getSurveyQuestions(); foreach ($questions as $data) { include_once "./survey/classes/class.SurveyQuestion.php"; $question_type = SurveyQuestion::_getQuestionType($data["question_id"]); include_once "./survey/classes/class.$question_type.php"; $question = new $question_type(); $question->loadFromDb($data["question_id"]); $eval = $this->object->getCumulatedResults($question); $row =& $question->outEvaluationCumulatedResults($eval); switch ($_POST["export_format"]) { case TYPE_XLS: include_once ("./classes/class.ilExcelUtils.php"); $mainworksheet->writeString($counter+1, 0, ilExcelUtils::_convert_text($row["QUESTION_TITLE"], $_POST["export_format"])); $mainworksheet->writeString($counter+1, 1, ilExcelUtils::_convert_text($row["QUESTION_TEXT"], $_POST["export_format"])); $mainworksheet->writeString($counter+1, 2, ilExcelUtils::_convert_text($row["QUESTION_TYPE"], $_POST["export_format"])); $mainworksheet->write($counter+1, 3, $row["USERS_ANSWERED"]); $mainworksheet->write($counter+1, 4, $row["USERS_SKIPPED"]); $mainworksheet->write($counter+1, 5, ilExcelUtils::_convert_text($row["MODE_VALUE"], $_POST["export_format"])); $mainworksheet->write($counter+1, 6, ilExcelUtils::_convert_text($row["MODE"], $_POST["export_format"])); $mainworksheet->write($counter+1, 7, $row["MODE_NR_OF_SELECTIONS"]); $mainworksheet->write($counter+1, 8, ilExcelUtils::_convert_text(str_replace("<br />", " ", $row["MEDIAN"]), $_POST["export_format"])); $mainworksheet->write($counter+1, 9, $row["ARITHMETIC_MEAN"]); break; case (TYPE_SPSS): $csvrow = array(); array_push($csvrow, $row["QUESTION_TITLE"]); array_push($csvrow, $row["QUESTION_TEXT"]); array_push($csvrow, $row["QUESTION_TYPE"]); array_push($csvrow, $row["USERS_ANSWERED"]); array_push($csvrow, $row["USERS_SKIPPED"]); array_push($csvrow, $row["MODE"]); array_push($csvrow, $row["MODE_NR_OF_SELECTIONS"]); array_push($csvrow, $row["MEDIAN"]); array_push($csvrow, $row["ARITHMETIC_MEAN"]); array_push($csvfile, $csvrow); break; } if ($details) { switch ($_POST["export_format"]) { case TYPE_XLS: include_once ("./classes/class.ilExcelUtils.php"); $worksheet =& $workbook->addWorksheet(); $worksheet->writeString(0, 0, ilExcelUtils::_convert_text($this->lng->txt("title"), $_POST["export_format"]), $format_bold); $worksheet->writeString(0, 1, ilExcelUtils::_convert_text($row["QUESTION_TITLE"], $_POST["export_format"])); $worksheet->writeString(1, 0, ilExcelUtils::_convert_text($this->lng->txt("question"), $_POST["export_format"]), $format_bold); $worksheet->writeString(1, 1, ilExcelUtils::_convert_text($row["QUESTION_TEXT"], $_POST["export_format"])); $worksheet->writeString(2, 0, ilExcelUtils::_convert_text($this->lng->txt("question_type"), $_POST["export_format"]), $format_bold); $worksheet->writeString(2, 1, ilExcelUtils::_convert_text($row["QUESTION_TYPE"], $_POST["export_format"])); $worksheet->writeString(3, 0, ilExcelUtils::_convert_text($this->lng->txt("users_answered"), $_POST["export_format"]), $format_bold); $worksheet->write(3, 1, $row["USERS_ANSWERED"]); $worksheet->writeString(4, 0, ilExcelUtils::_convert_text($this->lng->txt("users_skipped"), $_POST["export_format"]), $format_bold); $worksheet->write(4, 1, $row["USERS_SKIPPED"]); $rowcounter = 5; break; } switch ($eval["QUESTION_TYPE"]) { case "SurveyOrdinalQuestion": switch ($_POST["export_format"]) { case TYPE_XLS: preg_match("/(.*?)\s+-\s+(.*)/", $eval["MODE"], $matches); $worksheet->write($rowcounter, 0, ilExcelUtils::_convert_text($this->lng->txt("mode"), $_POST["export_format"]), $format_bold); $worksheet->write($rowcounter++, 1, ilExcelUtils::_convert_text($matches[1], $_POST["export_format"])); $worksheet->write($rowcounter, 0, ilExcelUtils::_convert_text($this->lng->txt("mode_text"), $_POST["export_format"]), $format_bold); $worksheet->write($rowcounter++, 1, ilExcelUtils::_convert_text($matches[2], $_POST["export_format"])); $worksheet->write($rowcounter, 0, ilExcelUtils::_convert_text($this->lng->txt("mode_nr_of_selections"), $_POST["export_format"]), $format_bold); $worksheet->write($rowcounter++, 1, ilExcelUtils::_convert_text($eval["MODE_NR_OF_SELECTIONS"], $_POST["export_format"])); $worksheet->write($rowcounter, 0, ilExcelUtils::_convert_text($this->lng->txt("median"), $_POST["export_format"]), $format_bold); $worksheet->write($rowcounter++, 1, ilExcelUtils::_convert_text(str_replace("<br />", " ", $eval["MEDIAN"]), $_POST["export_format"])); $worksheet->write($rowcounter, 0, ilExcelUtils::_convert_text($this->lng->txt("categories"), $_POST["export_format"]), $format_bold); $worksheet->write($rowcounter, 1, ilExcelUtils::_convert_text($this->lng->txt("title"), $_POST["export_format"]), $format_title); $worksheet->write($rowcounter, 2, ilExcelUtils::_convert_text($this->lng->txt("value"), $_POST["export_format"]), $format_title); $worksheet->write($rowcounter, 3, ilExcelUtils::_convert_text($this->lng->txt("category_nr_selected"), $_POST["export_format"]), $format_title); $worksheet->write($rowcounter++, 4, ilExcelUtils::_convert_text($this->lng->txt("percentage_of_selections"), $_POST["export_format"]), $format_title); break; } foreach ($eval["variables"] as $key => $value) { switch ($_POST["export_format"]) { case TYPE_XLS: $worksheet->write($rowcounter, 1, ilExcelUtils::_convert_text($value["title"], $_POST["export_format"])); $worksheet->write($rowcounter, 2, $key+1); $worksheet->write($rowcounter, 3, ilExcelUtils::_convert_text($value["selected"], $_POST["export_format"])); $worksheet->write($rowcounter++, 4, ilExcelUtils::_convert_text($value["percentage"], $_POST["export_format"]), $format_percent); break; } } break; case "SurveyNominalQuestion": include_once "./survey/classes/class.SurveyNominalQuestion.php"; switch ($_POST["export_format"]) { case TYPE_XLS: $worksheet->write($rowcounter, 0, ilExcelUtils::_convert_text($this->lng->txt("mode"), $_POST["export_format"]), $format_bold); $worksheet->write($rowcounter++, 1, ilExcelUtils::_convert_text($eval["MODE_VALUE"], $_POST["export_format"])); $worksheet->write($rowcounter, 0, ilExcelUtils::_convert_text($this->lng->txt("mode_text"), $_POST["export_format"]), $format_bold); $worksheet->write($rowcounter++, 1, ilExcelUtils::_convert_text($eval["MODE"], $_POST["export_format"])); $worksheet->write($rowcounter, 0, ilExcelUtils::_convert_text($this->lng->txt("mode_nr_of_selections"), $_POST["export_format"]), $format_bold); $worksheet->write($rowcounter++, 1, ilExcelUtils::_convert_text($eval["MODE_NR_OF_SELECTIONS"], $_POST["export_format"])); $worksheet->write($rowcounter, 0, ilExcelUtils::_convert_text($this->lng->txt("categories"), $_POST["export_format"]), $format_bold); $worksheet->write($rowcounter, 1, ilExcelUtils::_convert_text($this->lng->txt("title"), $_POST["export_format"]), $format_title); $worksheet->write($rowcounter, 2, ilExcelUtils::_convert_text($this->lng->txt("value"), $_POST["export_format"]), $format_title); $worksheet->write($rowcounter, 3, ilExcelUtils::_convert_text($this->lng->txt("category_nr_selected"), $_POST["export_format"]), $format_title); $worksheet->write($rowcounter++, 4, ilExcelUtils::_convert_text($this->lng->txt("percentage_of_selections"), $_POST["export_format"]), $format_title); break; } foreach ($eval["variables"] as $key => $value) { switch ($_POST["export_format"]) { case TYPE_XLS: $worksheet->write($rowcounter, 1, ilExcelUtils::_convert_text($value["title"], $_POST["export_format"])); $worksheet->write($rowcounter, 2, $key+1); $worksheet->write($rowcounter, 3, ilExcelUtils::_convert_text($value["selected"], $_POST["export_format"])); $worksheet->write($rowcounter++, 4, ilExcelUtils::_convert_text($value["percentage"], $_POST["export_format"]), $format_percent); break; } } break; case "SurveyMetricQuestion": include_once "./survey/classes/class.SurveyMetricQuestion.php"; switch ($_POST["export_format"]) { case TYPE_XLS: $worksheet->write($rowcounter, 0, $this->lng->txt("subtype"), $format_bold); switch ($data["subtype"]) { case SUBTYPE_NON_RATIO: $worksheet->write($rowcounter++, 1, ilExcelUtils::_convert_text($this->lng->txt("non_ratio"), $_POST["export_format"]), $format_bold); break; case SUBTYPE_RATIO_NON_ABSOLUTE: $worksheet->write($rowcounter++, 1, ilExcelUtils::_convert_text($this->lng->txt("ratio_non_absolute"), $_POST["export_format"]), $format_bold); break; case SUBTYPE_RATIO_ABSOLUTE: $worksheet->write($rowcounter++, 1, ilExcelUtils::_convert_text($this->lng->txt("ratio_absolute"), $_POST["export_format"]), $format_bold); break; } $worksheet->write($rowcounter, 0, ilExcelUtils::_convert_text($this->lng->txt("mode"), $_POST["export_format"]), $format_bold); $worksheet->write($rowcounter++, 1, ilExcelUtils::_convert_text($eval["MODE"], $_POST["export_format"])); $worksheet->write($rowcounter, 0, ilExcelUtils::_convert_text($this->lng->txt("mode_text"), $_POST["export_format"]), $format_bold); $worksheet->write($rowcounter++, 1, ilExcelUtils::_convert_text($eval["MODE"], $_POST["export_format"])); $worksheet->write($rowcounter, 0, ilExcelUtils::_convert_text($this->lng->txt("mode_nr_of_selections"), $_POST["export_format"]), $format_bold); $worksheet->write($rowcounter++, 1, ilExcelUtils::_convert_text($eval["MODE_NR_OF_SELECTIONS"], $_POST["export_format"])); $worksheet->write($rowcounter, 0, ilExcelUtils::_convert_text($this->lng->txt("median"), $_POST["export_format"]), $format_bold); $worksheet->write($rowcounter++, 1, ilExcelUtils::_convert_text($eval["MEDIAN"], $_POST["export_format"])); $worksheet->write($rowcounter, 0, ilExcelUtils::_convert_text($this->lng->txt("arithmetic_mean"), $_POST["export_format"]), $format_bold); $worksheet->write($rowcounter++, 1, ilExcelUtils::_convert_text($eval["ARITHMETIC_MEAN"], $_POST["export_format"])); $worksheet->write($rowcounter, 0, ilExcelUtils::_convert_text($this->lng->txt("values"), $_POST["export_format"]), $format_bold); $worksheet->write($rowcounter, 1, ilExcelUtils::_convert_text($this->lng->txt("value"), $_POST["export_format"]), $format_title); $worksheet->write($rowcounter, 2, ilExcelUtils::_convert_text($this->lng->txt("category_nr_selected"), $_POST["export_format"]), $format_title); $worksheet->write($rowcounter++, 3, ilExcelUtils::_convert_text($this->lng->txt("percentage_of_selections"), $_POST["export_format"]), $format_title); break; } $values = ""; if (is_array($eval["values"])) { foreach ($eval["values"] as $key => $value) { switch ($_POST["export_format"]) { case TYPE_XLS: $worksheet->write($rowcounter, 1, ilExcelUtils::_convert_text($value["value"], $_POST["export_format"])); $worksheet->write($rowcounter, 2, ilExcelUtils::_convert_text($value["selected"], $_POST["export_format"])); $worksheet->write($rowcounter++, 3, ilExcelUtils::_convert_text($value["percentage"], $_POST["export_format"]), $format_percent); break; } } } break; case "SurveyTextQuestion": switch ($_POST["export_format"]) { case TYPE_XLS: $worksheet->write($rowcounter, 0, ilExcelUtils::_convert_text($this->lng->txt("given_answers"), $_POST["export_format"]), $format_bold); break; } $textvalues = ""; if (is_array($eval["textvalues"])) { foreach ($eval["textvalues"] as $textvalue) { switch ($_POST["export_format"]) { case TYPE_XLS: $worksheet->write($rowcounter++, 1, $textvalue); break; } } } break; } } $counter++; } switch ($_POST["export_format"]) { case TYPE_XLS: // Let's send the file $workbook->close(); ilUtil::deliverFile($excelfile, "$surveyname.xls", "application/vnd.ms-excel"); exit(); break; case TYPE_SPSS: $csv = ""; $separator = ";"; foreach ($csvfile as $csvrow) { $csvrow =& $this->object->processCSVRow($csvrow, TRUE, $separator); $csv .= join($csvrow, $separator) . "\n"; } include_once "./classes/class.ilUtil.php"; ilUtil::deliverData($csv, "$surveyname.csv"); exit(); break; } }
ilSurveyEvaluationGUI::getCommand | ( | $ | cmd | ) |
Definition at line 81 of file class.ilSurveyEvaluationGUI.php.
References $cmd.
Referenced by executeCommand().
{ return $cmd; }
ilSurveyEvaluationGUI::ilSurveyEvaluationGUI | ( | $ | a_object | ) |
ilSurveyEvaluationGUI constructor
The constructor takes possible arguments an creates an instance of the ilSurveyEvaluationGUI object.
object | $a_object Associated ilObjSurvey class public |
Definition at line 53 of file class.ilSurveyEvaluationGUI.php.
ilSurveyEvaluationGUI::setEvalTabs | ( | ) |
Set the tabs for the evaluation output.
Set the tabs for the evaluation output
private
Definition at line 916 of file class.ilSurveyEvaluationGUI.php.
References $rbacsystem.
Referenced by evaluation(), and evaluationuser().
{ global $rbacsystem,$ilTabs; include_once "./classes/class.ilTabsGUI.php"; $tabs_gui =& new ilTabsGUI(); $tabs_gui->addTarget( "svy_eval_cumulated", $this->ctrl->getLinkTargetByClass(get_class($this), "evaluation"), array("evaluation", "checkEvaluationAccess"), "" ); $tabs_gui->addTarget( "svy_eval_detail", $this->ctrl->getLinkTargetByClass(get_class($this), "evaluationdetails"), array("evaluationdetails"), "" ); $tabs_gui->addTarget( "svy_eval_user", $this->ctrl->getLinkTargetByClass(get_class($this), "evaluationuser"), array("evaluationuser"), "" ); $ilTabs = $tabs_gui; #$this->tpl->setVariable("TABS", $tabs_gui->getHTML()); }
ilSurveyEvaluationGUI::$ctrl |
Definition at line 43 of file class.ilSurveyEvaluationGUI.php.
ilSurveyEvaluationGUI::$lng |
Definition at line 41 of file class.ilSurveyEvaluationGUI.php.
Referenced by ilSurveyEvaluationGUI().
ilSurveyEvaluationGUI::$object |
Definition at line 40 of file class.ilSurveyEvaluationGUI.php.
ilSurveyEvaluationGUI::$tpl |
Definition at line 42 of file class.ilSurveyEvaluationGUI.php.
Referenced by ilSurveyEvaluationGUI().