/** * Creates an Excel worksheet for the detailed cumulated results of this question * @param object $worksheet Reference to the parent excel worksheet * @param object $startrow Startrow of the output in the excel worksheet * @param object $active_id Active id of the participant * @param object $pass Test pass * @param object $format_title Excel title format * @param object $format_bold Excel bold format * @param array $eval_data Cumulated evaluation data * @access public */ public function setExportDetailsXLS(&$worksheet, $startrow, $active_id, $pass, &$format_title, &$format_bold) { require_once 'Services/Excel/classes/class.ilExcelUtils.php'; $solution = $this->getSolutionValues($active_id, $pass); $worksheet->writeString($startrow, 0, ilExcelUtils::_convert_text($this->lng->txt($this->getQuestionType())), $format_title); $worksheet->writeString($startrow, 1, ilExcelUtils::_convert_text($this->getTitle()), $format_title); $i = 1; foreach ($solution as $solutionvalue) { $worksheet->writeString($startrow + $i, 0, ilExcelUtils::_convert_text($solutionvalue["value1"]), $format_bold); if (strpos($solutionvalue["value1"], "_unit")) { $unit = $this->getUnit($solutionvalue["value2"]); if (is_object($unit)) { $worksheet->write($startrow + $i, 1, $unit->getUnit()); } } else { $worksheet->write($startrow + $i, 1, $solutionvalue["value2"]); } if (preg_match("/(\\\$v\\d+)/", $solutionvalue["value1"], $matches)) { $var = $this->getVariable($solutionvalue["value1"]); if (is_object($var) && is_object($var->getUnit())) { $worksheet->write($startrow + $i, 2, $var->getUnit()->getUnit()); } } $i++; } return $startrow + $i + 1; }
/** * Creates an Excel worksheet for the detailed cumulated results of this question * * @param object $worksheet Reference to the parent excel worksheet * @param object $startrow Startrow of the output in the excel worksheet * @param object $active_id Active id of the participant * @param object $pass Test pass * @param object $format_title Excel title format * @param object $format_bold Excel bold format * @param array $eval_data Cumulated evaluation data * @access public */ public function setExportDetailsXLS(&$worksheet, $startrow, $active_id, $pass, &$format_title, &$format_bold) { include_once "./Services/Excel/classes/class.ilExcelUtils.php"; $solution = $this->getSolutionValues($active_id, $pass); $worksheet->writeString($startrow, 0, ilExcelUtils::_convert_text($this->lng->txt($this->getQuestionType())), $format_title); $worksheet->writeString($startrow, 1, ilExcelUtils::_convert_text($this->getTitle()), $format_title); $i = 1; foreach ($this->getGaps() as $gap_index => $gap) { $worksheet->writeString($startrow + $i, 0, ilExcelUtils::_convert_text($this->lng->txt("gap") . " {$i}"), $format_bold); $checked = FALSE; foreach ($solution as $solutionvalue) { if ($gap_index == $solutionvalue["value1"]) { switch ($gap->getType()) { case CLOZE_SELECT: $worksheet->writeString($startrow + $i, 1, $gap->getItem($solutionvalue["value2"])->getAnswertext()); break; case CLOZE_NUMERIC: case CLOZE_TEXT: $worksheet->writeString($startrow + $i, 1, $solutionvalue["value2"]); break; } } } $i++; } return $startrow + $i + 1; }
/** * Creates an Excel worksheet for the detailed cumulated results of this question * * @param object $workbook Reference to the parent excel workbook * @param object $format_title Excel title format * @param object $format_bold Excel bold format * @param array $eval_data Cumulated evaluation data * @access public */ function setExportDetailsXLS(&$workbook, &$format_title, &$format_bold, &$eval_data, $export_label) { include_once "./Services/Excel/classes/class.ilExcelUtils.php"; $worksheet =& $workbook->addWorksheet(); $rowcounter = 0; switch ($export_label) { case 'label_only': $worksheet->writeString(0, 0, ilExcelUtils::_convert_text($this->lng->txt("label")), $format_bold); $worksheet->writeString(0, 1, ilExcelUtils::_convert_text($this->label)); break; case 'title_only': $worksheet->writeString(0, 0, ilExcelUtils::_convert_text($this->lng->txt("title")), $format_bold); $worksheet->writeString(0, 1, ilExcelUtils::_convert_text($this->getTitle())); break; default: $worksheet->writeString(0, 0, ilExcelUtils::_convert_text($this->lng->txt("title")), $format_bold); $worksheet->writeString(0, 1, ilExcelUtils::_convert_text($this->getTitle())); $rowcounter++; $worksheet->writeString($rowcounter, 0, ilExcelUtils::_convert_text($this->lng->txt("label")), $format_bold); $worksheet->writeString($rowcounter, 1, ilExcelUtils::_convert_text($this->label)); break; } $rowcounter++; $worksheet->writeString($rowcounter, 0, ilExcelUtils::_convert_text($this->lng->txt("question")), $format_bold); $worksheet->writeString($rowcounter, 1, ilExcelUtils::_convert_text($this->getQuestiontext())); $rowcounter++; $worksheet->writeString($rowcounter, 0, ilExcelUtils::_convert_text($this->lng->txt("question_type")), $format_bold); $worksheet->writeString($rowcounter, 1, ilExcelUtils::_convert_text($this->lng->txt($this->getQuestionType()))); $rowcounter++; $worksheet->writeString($rowcounter, 0, ilExcelUtils::_convert_text($this->lng->txt("users_answered")), $format_bold); $worksheet->write($rowcounter, 1, $eval_data["USERS_ANSWERED"]); $rowcounter++; $worksheet->writeString($rowcounter, 0, ilExcelUtils::_convert_text($this->lng->txt("users_skipped")), $format_bold); $worksheet->write($rowcounter, 1, $eval_data["USERS_SKIPPED"]); $rowcounter++; $worksheet->write($rowcounter, 0, $this->lng->txt("subtype"), $format_bold); switch ($this->getSubtype()) { case self::SUBTYPE_NON_RATIO: $worksheet->write($rowcounter++, 1, ilExcelUtils::_convert_text($this->lng->txt("non_ratio")), $format_bold); break; case self::SUBTYPE_RATIO_NON_ABSOLUTE: $worksheet->write($rowcounter++, 1, ilExcelUtils::_convert_text($this->lng->txt("ratio_non_absolute")), $format_bold); break; case self::SUBTYPE_RATIO_ABSOLUTE: $worksheet->write($rowcounter++, 1, ilExcelUtils::_convert_text($this->lng->txt("ratio_absolute")), $format_bold); break; } $worksheet->write($rowcounter, 0, ilExcelUtils::_convert_text($this->lng->txt("mode")), $format_bold); $worksheet->write($rowcounter++, 1, ilExcelUtils::_convert_text($eval_data["MODE"])); $worksheet->write($rowcounter, 0, ilExcelUtils::_convert_text($this->lng->txt("mode_text")), $format_bold); $worksheet->write($rowcounter++, 1, ilExcelUtils::_convert_text($eval_data["MODE"])); $worksheet->write($rowcounter, 0, ilExcelUtils::_convert_text($this->lng->txt("mode_nr_of_selections")), $format_bold); $worksheet->write($rowcounter++, 1, ilExcelUtils::_convert_text($eval_data["MODE_NR_OF_SELECTIONS"])); $worksheet->write($rowcounter, 0, ilExcelUtils::_convert_text($this->lng->txt("median")), $format_bold); $worksheet->write($rowcounter++, 1, ilExcelUtils::_convert_text($eval_data["MEDIAN"])); $worksheet->write($rowcounter, 0, ilExcelUtils::_convert_text($this->lng->txt("arithmetic_mean")), $format_bold); $worksheet->write($rowcounter++, 1, ilExcelUtils::_convert_text($eval_data["ARITHMETIC_MEAN"])); $worksheet->write($rowcounter, 0, ilExcelUtils::_convert_text($this->lng->txt("values")), $format_bold); $worksheet->write($rowcounter, 1, ilExcelUtils::_convert_text($this->lng->txt("value")), $format_title); $worksheet->write($rowcounter, 2, ilExcelUtils::_convert_text($this->lng->txt("category_nr_selected")), $format_title); $worksheet->write($rowcounter++, 3, ilExcelUtils::_convert_text($this->lng->txt("percentage_of_selections")), $format_title); $values = ""; if (is_array($eval_data["values"])) { foreach ($eval_data["values"] as $key => $value) { $worksheet->write($rowcounter, 1, ilExcelUtils::_convert_text($value["value"])); $worksheet->write($rowcounter, 2, ilExcelUtils::_convert_text($value["selected"])); $worksheet->write($rowcounter++, 3, ilExcelUtils::_convert_text($value["percentage"]), $format_percent); } } }
/** * {@inheritdoc} */ public function setExportDetailsXLS(&$worksheet, $startrow, $active_id, $pass, &$format_title, &$format_bold) { require_once 'Services/Excel/classes/class.ilExcelUtils.php'; $solution = $this->getSolutionValues($active_id, $pass); $worksheet->writeString($startrow, 0, ilExcelUtils::_convert_text($this->lng->txt($this->getQuestionType())), $format_title); $worksheet->writeString($startrow, 1, ilExcelUtils::_convert_text($this->getTitle()), $format_title); $i = 1; foreach ($this->getAnswers() as $id => $answer) { $worksheet->writeString($startrow + $i, 0, ilExcelUtils::_convert_text($answer->getAnswertext()), $format_bold); $correctness = FALSE; foreach ($solution as $solutionvalue) { if ($id == $solutionvalue['value1']) { $correctness = $solutionvalue['value2']; break; } } $worksheet->write($startrow + $i, 1, $correctness); $i++; } return $startrow + $i + 1; }
/** * Creates an Excel worksheet for the detailed cumulated results of this question * * @param object $worksheet Reference to the parent excel worksheet * @param object $startrow Startrow of the output in the excel worksheet * @param object $active_id Active id of the participant * @param object $pass Test pass * @param object $format_title Excel title format * @param object $format_bold Excel bold format * @param array $eval_data Cumulated evaluation data */ public function setExportDetailsXLS(&$worksheet, $startrow, $active_id, $pass, &$format_title, &$format_bold) { include_once "./Services/Excel/classes/class.ilExcelUtils.php"; $worksheet->writeString($startrow, 0, ilExcelUtils::_convert_text($this->lng->txt($this->getQuestionType())), $format_title); $worksheet->writeString($startrow, 1, ilExcelUtils::_convert_text($this->getTitle()), $format_title); $i = 0; $selections = array(); $solutions =& $this->getSolutionValues($active_id, $pass); if (is_array($solutions)) { foreach ($solutions as $solution) { array_push($selections, $solution['value1']); } $errortext_value = join(",", $selections); } $errortext = $this->createErrorTextExport($selections); $i++; $worksheet->writeString($startrow + $i, 0, ilExcelUtils::_convert_text($errortext)); $i++; return $startrow + $i + 1; }
/** * Creates an Excel worksheet for the detailed cumulated results of this question * * @param object $worksheet Reference to the parent excel worksheet * @param object $startrow Startrow of the output in the excel worksheet * @param object $active_id Active id of the participant * @param object $pass Test pass * @param object $format_title Excel title format * @param object $format_bold Excel bold format * @param array $eval_data Cumulated evaluation data */ public function setExportDetailsXLS(&$worksheet, $startrow, $active_id, $pass, &$format_title, &$format_bold) { include_once "./Services/Excel/classes/class.ilExcelUtils.php"; $worksheet->writeString($startrow, 0, ilExcelUtils::_convert_text($this->lng->txt($this->getQuestionType())), $format_title); $worksheet->writeString($startrow, 1, ilExcelUtils::_convert_text($this->getTitle()), $format_title); $solutionvalue = ""; $solutions =& $this->getSolutionValues($active_id, $pass); $solutionvalue = str_replace("{::}", " ", $solutions[0]["value1"]); $i = 1; $worksheet->writeString($startrow + $i, 0, ilExcelUtils::_convert_text($solutionvalue)); $i++; return $startrow + $i + 1; }
/** * Creates an Excel worksheet for the detailed cumulated results of this question * * @param object $worksheet Reference to the parent excel worksheet * @param object $startrow Startrow of the output in the excel worksheet * @param object $active_id Active id of the participant * @param object $pass Test pass * @param object $format_title Excel title format * @param object $format_bold Excel bold format * @param array $eval_data Cumulated evaluation data * @access public */ public function setExportDetailsXLS(&$worksheet, $startrow, $active_id, $pass, &$format_title, &$format_bold) { include_once "./Services/Excel/classes/class.ilExcelUtils.php"; $solutions = $this->getSolutionValues($active_id, $pass); $sol = array(); foreach ($solutions as $solution) { $sol[$solution["value1"]] = $solution["value2"]; } asort($sol); $sol = array_keys($sol); $worksheet->writeString($startrow, 0, ilExcelUtils::_convert_text($this->lng->txt($this->getQuestionType())), $format_title); $worksheet->writeString($startrow, 1, ilExcelUtils::_convert_text($this->getTitle()), $format_title); $i = 1; $answers = $this->getAnswers(); foreach ($sol as $idx) { foreach ($solutions as $solution) { if ($solution["value1"] == $idx) { $worksheet->writeString($startrow + $i, 0, ilExcelUtils::_convert_text($solution["value2"])); } } $worksheet->writeString($startrow + $i, 1, ilExcelUtils::_convert_text($answers[$idx]->getAnswertext())); $i++; } return $startrow + $i + 1; }
/** * Creates an Excel worksheet for the detailed cumulated results of this question * * @param object $worksheet Reference to the parent excel worksheet * @param object $startrow Startrow of the output in the excel worksheet * @param object $active_id Active id of the participant * @param object $pass Test pass * @param object $format_title Excel title format * @param object $format_bold Excel bold format * @param array $eval_data Cumulated evaluation data * @access public */ public function setExportDetailsXLS(&$worksheet, $startrow, $active_id, $pass, &$format_title, &$format_bold) { include_once "./Services/Excel/classes/class.ilExcelUtils.php"; $solutions = $this->getSolutionValues($active_id, $pass); $worksheet->writeString($startrow, 0, ilExcelUtils::_convert_text($this->lng->txt($this->getQuestionType())), $format_title); $worksheet->writeString($startrow, 1, ilExcelUtils::_convert_text($this->getTitle()), $format_title); $i = 1; foreach ($solutions as $solution) { $worksheet->write($startrow + $i, 1, ilExcelUtils::_convert_text($this->lng->txt("result") . " {$i}")); if (strlen($solution["value1"])) { $worksheet->write($startrow + $i, 1, ilExcelUtils::_convert_text($solution["value1"])); } if (strlen($solution["value2"])) { $worksheet->write($startrow + $i, 2, ilExcelUtils::_convert_text($solution["value2"])); } $i++; } return $startrow + $i + 1; }
/** * Creates an Excel worksheet for the detailed cumulated results of this question * * @param object $workbook Reference to the parent excel workbook * @param object $format_title Excel title format * @param object $format_bold Excel bold format * @param array $eval_data Cumulated evaluation data * @access public */ function setExportDetailsXLS(&$workbook, &$format_title, &$format_bold, &$eval_data, $export_label) { include_once "./Services/Excel/classes/class.ilExcelUtils.php"; $worksheet =& $workbook->addWorksheet(); $rowcounter = 0; switch ($export_label) { case 'label_only': $worksheet->writeString(0, 0, ilExcelUtils::_convert_text($this->lng->txt("label")), $format_bold); $worksheet->writeString(0, 1, ilExcelUtils::_convert_text($this->label)); break; case 'title_only': $worksheet->writeString(0, 0, ilExcelUtils::_convert_text($this->lng->txt("title")), $format_bold); $worksheet->writeString(0, 1, ilExcelUtils::_convert_text($this->getTitle())); break; default: $worksheet->writeString(0, 0, ilExcelUtils::_convert_text($this->lng->txt("title")), $format_bold); $worksheet->writeString(0, 1, ilExcelUtils::_convert_text($this->getTitle())); $rowcounter++; $worksheet->writeString($rowcounter, 0, ilExcelUtils::_convert_text($this->lng->txt("label")), $format_bold); $worksheet->writeString($rowcounter, 1, ilExcelUtils::_convert_text($this->label)); break; } $rowcounter++; $worksheet->writeString($rowcounter, 0, ilExcelUtils::_convert_text($this->lng->txt("question")), $format_bold); $worksheet->writeString($rowcounter, 1, ilExcelUtils::_convert_text($this->getQuestiontext())); $rowcounter++; $worksheet->writeString($rowcounter, 0, ilExcelUtils::_convert_text($this->lng->txt("question_type")), $format_bold); $worksheet->writeString($rowcounter, 1, ilExcelUtils::_convert_text($this->lng->txt($this->getQuestionType()))); $rowcounter++; $worksheet->writeString($rowcounter, 0, ilExcelUtils::_convert_text($this->lng->txt("users_answered")), $format_bold); $worksheet->write($rowcounter, 1, $eval_data["USERS_ANSWERED"]); $rowcounter++; $worksheet->writeString($rowcounter, 0, ilExcelUtils::_convert_text($this->lng->txt("users_skipped")), $format_bold); $worksheet->write($rowcounter, 1, $eval_data["USERS_SKIPPED"]); $rowcounter++; $worksheet->write($rowcounter, 0, ilExcelUtils::_convert_text($this->lng->txt("given_answers")), $format_bold); $textvalues = ""; if (is_array($eval_data["textvalues"])) { foreach ($eval_data["textvalues"] as $textvalue) { $worksheet->write($rowcounter++, 1, ilExcelUtils::_convert_text($textvalue)); } } }
/** * Creates an Excel worksheet for the detailed cumulated results of this question * * @param object $worksheet Reference to the parent excel worksheet * @param object $startrow Startrow of the output in the excel worksheet * @param object $active_id Active id of the participant * @param object $pass Test pass * @param object $format_title Excel title format * @param object $format_bold Excel bold format * @param array $eval_data Cumulated evaluation data * @access public */ public function setExportDetailsXLS(&$worksheet, $startrow, $active_id, $pass, &$format_title, &$format_bold) { include_once "./Services/Excel/classes/class.ilExcelUtils.php"; $worksheet->writeString($startrow, 0, ilExcelUtils::_convert_text($this->lng->txt($this->getQuestionType())), $format_title); $worksheet->writeString($startrow, 1, ilExcelUtils::_convert_text($this->getTitle()), $format_title); return $startrow + 1; }
/** * Creates the Excel output for the cumulated results of this question * * @param object $worksheet Reference to the excel worksheet * @param object $format_title Excel title format * @param object $format_bold Excel bold format * @param array $eval_data Cumulated evaluation data * @param integer $row Actual row in the worksheet * @return integer The next row which should be used for the export * @access public */ function setExportCumulatedXLS(&$worksheet, &$format_title, &$format_bold, &$eval_data, $row, $export_label) { include_once "./Services/Excel/classes/class.ilExcelUtils.php"; $column = 0; switch ($export_label) { case 'label_only': $worksheet->writeString($row, $column, ilExcelUtils::_convert_text($this->label)); break; case 'title_only': $worksheet->writeString($row, $column, ilExcelUtils::_convert_text($this->getTitle())); break; default: $worksheet->writeString($row, $column, ilExcelUtils::_convert_text($this->getTitle())); $column++; $worksheet->writeString($row, $column, ilExcelUtils::_convert_text($this->label)); break; } $column++; $worksheet->writeString($row, $column, ilExcelUtils::_convert_text(strip_tags($this->getQuestiontext()))); // #12942 $column++; $worksheet->writeString($row, $column, ilExcelUtils::_convert_text($this->lng->txt($eval_data["QUESTION_TYPE"]))); $column++; $worksheet->write($row, $column, $eval_data["USERS_ANSWERED"]); $column++; $worksheet->write($row, $column, $eval_data["USERS_SKIPPED"]); $column++; $worksheet->write($row, $column, ilExcelUtils::_convert_text($eval_data["MODE_VALUE"])); $column++; $worksheet->write($row, $column, ilExcelUtils::_convert_text($eval_data["MODE"])); $column++; $worksheet->write($row, $column, $eval_data["MODE_NR_OF_SELECTIONS"]); $column++; $worksheet->write($row, $column, ilExcelUtils::_convert_text(str_replace("<br />", " ", $eval_data["MEDIAN"]))); $column++; $worksheet->write($row, $column, $eval_data["ARITHMETIC_MEAN"]); return $row + 1; }
/** * Creates an Excel worksheet for the detailed cumulated results of this question * * @param object $worksheet Reference to the parent excel worksheet * @param object $startrow Startrow of the output in the excel worksheet * @param object $active_id Active id of the participant * @param object $pass Test pass * @param object $format_title Excel title format * @param object $format_bold Excel bold format * @param array $eval_data Cumulated evaluation data * @access public */ public function setExportDetailsXLS(&$worksheet, $startrow, $active_id, $pass, &$format_title, &$format_bold) { global $lng; include_once "./Services/Excel/classes/class.ilExcelUtils.php"; $solutions = $this->getSolutionStored($active_id, $pass, true); $worksheet->writeString($startrow, 0, ilExcelUtils::_convert_text($this->getPlugin()->txt($this->getQuestionType())), $format_title); $worksheet->writeString($startrow, 1, ilExcelUtils::_convert_text($this->getTitle()), $format_title); $row = $startrow + 1; $part = 1; foreach ($this->getParts() as $part_obj) { $part_id = $part_obj->getPartId(); $worksheet->writeString($row++, 0, ilExcelUtils::_convert_text($this->getPlugin()->txt('accounting_table') . ' ' . $part), $format_bold); // the excel fields can be filled from the stored input $part_obj->analyzeWorkingXMl($solutions[$part_id]); $part_obj->calculateReachedPoints(); $data = $part_obj->getWorkingData(); $point = $this->plugin->txt('point'); $points = $this->plugin->txt('points'); $worksheet->writeString($row, 1, ilExcelUtils::_convert_text($data['headerLeft'])); $worksheet->writeString($row, 2, ilExcelUtils::_convert_text($data['headerRight'])); $row++; foreach ($data['record']['rows'] as $r) { $left = $r['leftAccountText'] . ' ' . $r['leftValueRaw'] . ' (' . $r['leftPoints'] . ' ' . ($r['leftPoints'] == 1 ? $point : $points) . ')'; $right = $r['rightAccountText'] . ' ' . $r['rightValueRaw'] . ' (' . $r['rightPoints'] . ' ' . ($r['rightPoints'] == 1 ? $point : $points) . ')'; $worksheet->writeString($row, 1, ilExcelUtils::_convert_text($left)); $worksheet->writeString($row, 2, ilExcelUtils::_convert_text($right)); $row++; } foreach (array('bonusOrderLeft', 'bonusOrderRight', 'malusCountLeft', 'malusCountRight', 'malusSumsDiffer') as $key) { if ($data['record'][$key] != 0) { $worksheet->writeString($row, 1, ilExcelUtils::_convert_text($this->plugin->txt($key))); $worksheet->writeString($row, 2, ilExcelUtils::_convert_text($data['record'][$key] . ' ' . (abs($data['record'][$key]) == 1 ? $point : $points))); $row++; } } $part++; } return $row + 1; }
/** * Creates an Excel worksheet for the detailed cumulated results of this question * * @param object $worksheet Reference to the parent excel worksheet * @param object $startrow Startrow of the output in the excel worksheet * @param object $active_id Active id of the participant * @param object $pass Test pass * @param object $format_title Excel title format * @param object $format_bold Excel bold format * @param array $eval_data Cumulated evaluation data * @access public */ public function setExportDetailsXLS(&$worksheet, $startrow, $active_id, $pass, &$format_title, &$format_bold) { include_once "./Services/Excel/classes/class.ilExcelUtils.php"; $solutions = $this->getSolutionValues($active_id, $pass); $worksheet->writeString($startrow, 0, ilExcelUtils::_convert_text($this->lng->txt($this->getQuestionType())), $format_title); $worksheet->writeString($startrow, 1, ilExcelUtils::_convert_text($this->getTitle()), $format_title); $imagepath = $this->getImagePath(); $i = 1; foreach ($solutions as $solution) { $matches_written = FALSE; foreach ($this->getMatchingPairs() as $idx => $pair) { if (!$matches_written) { $worksheet->writeString($startrow + $i, 1, ilExcelUtils::_convert_text($this->lng->txt("matches"))); } $matches_written = TRUE; if ($pair->definition->identifier == $solution["value2"]) { if (strlen($pair->definition->text)) { $worksheet->writeString($startrow + $i, 0, ilExcelUtils::_convert_text($pair->definition->text)); } else { $worksheet->writeString($startrow + $i, 0, ilExcelUtils::_convert_text($pair->definition->picture)); } } if ($pair->term->identifier == $solution["value1"]) { if (strlen($pair->term->text)) { $worksheet->writeString($startrow + $i, 2, ilExcelUtils::_convert_text($pair->term->text)); } else { $worksheet->writeString($startrow + $i, 2, ilExcelUtils::_convert_text($pair->term->picture)); } } } $i++; } return $startrow + $i + 1; }
/** * Export the user specific results for the survey * * Export the user specific results for the survey * * @access private */ function exportUserSpecificResults($export_format, $export_label, $finished_ids) { global $ilLog; // #13620 ilDatePresentation::setUseRelativeDates(false); $csvfile = array(); $csvrow = array(); $csvrow2 = array(); $questions = array(); $questions =& $this->object->getSurveyQuestions(true); array_push($csvrow, $this->lng->txt("lastname")); // #12756 array_push($csvrow, $this->lng->txt("firstname")); array_push($csvrow, $this->lng->txt("login")); array_push($csvrow, $this->lng->txt('workingtime')); // #13622 array_push($csvrow, $this->lng->txt('survey_results_finished')); array_push($csvrow2, ""); array_push($csvrow2, ""); array_push($csvrow2, ""); array_push($csvrow2, ""); array_push($csvrow2, ""); if ($this->object->canExportSurveyCode()) { array_push($csvrow, $this->lng->txt("codes")); array_push($csvrow2, ""); } /* #8211 if ($this->object->getAnonymize() == ilObjSurvey::ANONYMIZE_OFF) { array_push($csvrow, $this->lng->txt("gender")); } */ $cellcounter = 1; foreach ($questions as $question_id => $question_data) { include_once "./Modules/SurveyQuestionPool/classes/class.SurveyQuestion.php"; $question = SurveyQuestion::_instanciateQuestion($question_data["question_id"]); switch ($export_label) { case "label_only": $question->addUserSpecificResultsExportTitles($csvrow, true); break; case "title_only": $question->addUserSpecificResultsExportTitles($csvrow, false); break; default: $question->addUserSpecificResultsExportTitles($csvrow, false); $question->addUserSpecificResultsExportTitles($csvrow2, true, false); break; } $questions[$question_data["question_id"]] = $question; } array_push($csvfile, $csvrow); if (sizeof($csvrow2) && implode("", $csvrow2)) { array_push($csvfile, $csvrow2); } if (!$finished_ids) { $participants =& $this->object->getSurveyFinishedIds(); } else { $participants = $finished_ids; } $finished_data = array(); foreach ($this->object->getSurveyParticipants($participants) as $item) { $finished_data[$item["active_id"]] = $item; } foreach ($participants as $user_id) { if ($user_id < 1) { continue; } $resultset =& $this->object->getEvaluationByUser($questions, $user_id); $csvrow = array(); // #12756 array_push($csvrow, trim($resultset["lastname"]) ? $resultset["lastname"] : $resultset["name"]); // anonymous array_push($csvrow, $resultset["firstname"]); array_push($csvrow, $resultset["login"]); // #10579 if ($this->object->canExportSurveyCode()) { array_push($csvrow, $user_id); } /* #8211 if ($this->object->getAnonymize() == ilObjSurvey::ANONYMIZE_OFF) { array_push($csvrow, $resultset["gender"]); } */ $wt = $this->object->getWorkingtimeForParticipant($user_id); array_push($csvrow, $wt); $finished = $finished_data[$user_id]; if ((bool) $finished["finished"]) { array_push($csvrow, ilDatePresentation::formatDate(new ilDateTime($finished["finished_tstamp"], IL_CAL_UNIX))); } else { array_push($csvrow, "-"); } foreach ($questions as $question_id => $question) { $question->addUserSpecificResultsData($csvrow, $resultset); } array_push($csvfile, $csvrow); } // #11179 $surveyname = $this->object->getTitle() . " " . $this->lng->txt("svy_eval_user") . " " . date("Y-m-d"); $surveyname = preg_replace("/\\s/", "_", trim($surveyname)); $surveyname = ilUtil::getASCIIFilename($surveyname); switch ($export_format) { case self::TYPE_XLS: include_once "./Services/Excel/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 $pages = floor(count($csvfile[0]) / 250) + 1; $worksheets = array(); for ($i = 0; $i < $pages; $i++) { $worksheets[$i] =& $workbook->addWorksheet(); } $row = 0; include_once "./Services/Excel/classes/class.ilExcelUtils.php"; $contentstartrow = 0; foreach ($csvfile as $csvrow) { $col = 0; if ($row == 0) { $worksheet = 0; $mainworksheet =& $worksheets[$worksheet]; foreach ($csvrow as $text) { if (is_array($text)) { $textcount = 0; foreach ($text as $string) { $mainworksheet->writeString($row + $textcount, $col, ilExcelUtils::_convert_text($string, $_POST["export_format"]), $format_title); $textcount++; $contentstartrow = max($contentstartrow, $textcount); } $col++; } else { $mainworksheet->writeString($row, $col++, ilExcelUtils::_convert_text($text, $_POST["export_format"]), $format_title); } if ($col % 251 == 0) { $worksheet++; $col = 1; $mainworksheet =& $worksheets[$worksheet]; $mainworksheet->writeString($row, 0, ilExcelUtils::_convert_text($csvrow[0], $_POST["export_format"]), $format_title); } } $row = $contentstartrow; } else { $worksheet = 0; $mainworksheet =& $worksheets[$worksheet]; 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"])); } if ($col % 251 == 0) { $worksheet++; $col = 1; $mainworksheet =& $worksheets[$worksheet]; $mainworksheet->writeString($row, 0, ilExcelUtils::_convert_text($csvrow[0], $_POST["export_format"])); } } } $row++; } $workbook->close(); ilUtil::deliverFile($excelfile, "{$surveyname}.xls", "application/vnd.ms-excel"); exit; break; case self::TYPE_SPSS: $csv = ""; $separator = ";"; foreach ($csvfile as $idx => $csvrow) { $csvrow =& str_replace("\n", " ", $this->object->processCSVRow($csvrow, TRUE, $separator)); $csv .= join($csvrow, $separator) . "\n"; } include_once "./Services/Utilities/classes/class.ilUtil.php"; ilUtil::deliverData($csv, "{$surveyname}.csv"); exit; break; } }
/** * Exports grades as excel */ function exportGradesExcel() { include_once "./Modules/Exercise/classes/class.ilExAssignment.php"; $ass_data = ilExAssignment::getAssignmentDataOfExercise($this->getId()); include_once "./Services/Excel/classes/class.ilExcelWriterAdapter.php"; $excelfile = ilUtil::ilTempnam(); $adapter = new ilExcelWriterAdapter($excelfile, FALSE); $workbook = $adapter->getWorkbook(); $workbook->setVersion(8); // Use Excel97/2000 Format include_once "./Services/Excel/classes/class.ilExcelUtils.php"; // // status // $mainworksheet = $workbook->addWorksheet(); // header row $mainworksheet->writeString(0, 0, ilExcelUtils::_convert_text($this->lng->txt("name"))); $cnt = 1; foreach ($ass_data as $ass) { $mainworksheet->writeString(0, $cnt, $cnt); $cnt++; } $mainworksheet->writeString(0, $cnt, ilExcelUtils::_convert_text($this->lng->txt("exc_total_exc"))); // data rows $this->mem_obj = new ilExerciseMembers($this); $getmems = $this->mem_obj->getMembers(); $mems = array(); foreach ($getmems as $user_id) { $mems[$user_id] = ilObjUser::_lookupName($user_id); } $mems = ilUtil::sortArray($mems, "lastname", "asc", false, true); $data = array(); $row_cnt = 1; foreach ($mems as $user_id => $d) { $col_cnt = 1; // name $mainworksheet->writeString($row_cnt, 0, ilExcelUtils::_convert_text($d["lastname"] . ", " . $d["firstname"] . " [" . $d["login"] . "]")); reset($ass_data); foreach ($ass_data as $ass) { $status = ilExAssignment::lookupStatusOfUser($ass["id"], $user_id); $mainworksheet->writeString($row_cnt, $col_cnt, ilExcelUtils::_convert_text($this->lng->txt("exc_" . $status))); $col_cnt++; } // total status $status = ilExerciseMembers::_lookupStatus($this->getId(), $user_id); $mainworksheet->writeString($row_cnt, $col_cnt, ilExcelUtils::_convert_text($this->lng->txt("exc_" . $status))); $row_cnt++; } // // mark // $worksheet2 = $workbook->addWorksheet(); // header row $worksheet2->writeString(0, 0, ilExcelUtils::_convert_text($this->lng->txt("name"))); $cnt = 1; foreach ($ass_data as $ass) { $worksheet2->writeString(0, $cnt, $cnt); $cnt++; } $worksheet2->writeString(0, $cnt, ilExcelUtils::_convert_text($this->lng->txt("exc_total_exc"))); // data rows $data = array(); $row_cnt = 1; reset($mems); foreach ($mems as $user_id => $d) { $col_cnt = 1; $d = ilObjUser::_lookupName($user_id); // name $worksheet2->writeString($row_cnt, 0, ilExcelUtils::_convert_text($d["lastname"] . ", " . $d["firstname"] . " [" . $d["login"] . "]")); reset($ass_data); foreach ($ass_data as $ass) { $worksheet2->writeString($row_cnt, $col_cnt, ilExcelUtils::_convert_text(ilExAssignment::lookupMarkOfUser($ass["id"], $user_id))); $col_cnt++; } // total mark include_once 'Services/Tracking/classes/class.ilLPMarks.php'; $worksheet2->writeString($row_cnt, $col_cnt, ilExcelUtils::_convert_text(ilLPMarks::_lookupMark($user_id, $this->getId()))); $row_cnt++; } $workbook->close(); $exc_name = ilUtil::getASCIIFilename(preg_replace("/\\s/", "_", $this->getTitle())); ilUtil::deliverFile($excelfile, $exc_name . ".xls", "application/vnd.ms-excel"); }
/** * Creates an Excel worksheet for the detailed cumulated results of this question * * @param object $workbook Reference to the parent excel workbook * @param object $format_title Excel title format * @param object $format_bold Excel bold format * @param array $eval_data Cumulated evaluation data * @access public */ function setExportDetailsXLS(&$workbook, &$format_title, &$format_bold, &$eval_data, $export_label) { include_once "./Services/Excel/classes/class.ilExcelUtils.php"; $worksheet =& $workbook->addWorksheet(); $rowcounter = 0; switch ($export_label) { case 'label_only': $worksheet->writeString(0, 0, ilExcelUtils::_convert_text($this->lng->txt("label")), $format_bold); $worksheet->writeString(0, 1, ilExcelUtils::_convert_text($this->label)); break; case 'title_only': $worksheet->writeString(0, 0, ilExcelUtils::_convert_text($this->lng->txt("title")), $format_bold); $worksheet->writeString(0, 1, ilExcelUtils::_convert_text($this->getTitle())); break; default: $worksheet->writeString(0, 0, ilExcelUtils::_convert_text($this->lng->txt("title")), $format_bold); $worksheet->writeString(0, 1, ilExcelUtils::_convert_text($this->getTitle())); $rowcounter++; $worksheet->writeString($rowcounter, 0, ilExcelUtils::_convert_text($this->lng->txt("label")), $format_bold); $worksheet->writeString($rowcounter, 1, ilExcelUtils::_convert_text($this->label)); break; } $rowcounter++; $worksheet->writeString($rowcounter, 0, ilExcelUtils::_convert_text($this->lng->txt("question")), $format_bold); $worksheet->writeString($rowcounter, 1, ilExcelUtils::_convert_text($this->getQuestiontext())); $rowcounter++; $worksheet->writeString($rowcounter, 0, ilExcelUtils::_convert_text($this->lng->txt("question_type")), $format_bold); $worksheet->writeString($rowcounter, 1, ilExcelUtils::_convert_text($this->lng->txt($this->getQuestionType()))); $rowcounter++; $worksheet->writeString($rowcounter, 0, ilExcelUtils::_convert_text($this->lng->txt("users_answered")), $format_bold); $worksheet->write($rowcounter, 1, $eval_data["USERS_ANSWERED"]); $rowcounter++; $worksheet->writeString($rowcounter, 0, ilExcelUtils::_convert_text($this->lng->txt("users_skipped")), $format_bold); $worksheet->write($rowcounter, 1, $eval_data["USERS_SKIPPED"]); $rowcounter++; $worksheet->write($rowcounter, 0, ilExcelUtils::_convert_text($this->lng->txt("mode")), $format_bold); $worksheet->write($rowcounter++, 1, ilExcelUtils::_convert_text($eval_data["MODE_VALUE"])); $worksheet->write($rowcounter, 0, ilExcelUtils::_convert_text($this->lng->txt("mode_text")), $format_bold); $worksheet->write($rowcounter++, 1, ilExcelUtils::_convert_text($eval_data["MODE"])); $worksheet->write($rowcounter, 0, ilExcelUtils::_convert_text($this->lng->txt("mode_nr_of_selections")), $format_bold); $worksheet->write($rowcounter++, 1, ilExcelUtils::_convert_text($eval_data["MODE_NR_OF_SELECTIONS"])); $worksheet->write($rowcounter, 0, ilExcelUtils::_convert_text($this->lng->txt("categories")), $format_bold); $worksheet->write($rowcounter, 1, ilExcelUtils::_convert_text($this->lng->txt("title")), $format_title); $worksheet->write($rowcounter, 2, ilExcelUtils::_convert_text($this->lng->txt("value")), $format_title); $worksheet->write($rowcounter, 3, ilExcelUtils::_convert_text($this->lng->txt("category_nr_selected")), $format_title); $worksheet->write($rowcounter++, 4, ilExcelUtils::_convert_text($this->lng->txt("percentage_of_selections")), $format_title); foreach ($eval_data["variables"] as $key => $value) { $worksheet->write($rowcounter, 1, ilExcelUtils::_convert_text($value["title"])); $category = $this->categories->getCategory($key); $worksheet->write($rowcounter, 2, $category->scale); $worksheet->write($rowcounter, 3, ilExcelUtils::_convert_text($value["selected"])); $worksheet->write($rowcounter++, 4, ilExcelUtils::_convert_text($value["percentage"]), $format_percent); } // add text answers to detailed results if (is_array($eval_data["textanswers"])) { $worksheet->write($rowcounter, 0, ilExcelUtils::_convert_text($this->lng->txt("freetext_answers")), $format_bold); $worksheet->write($rowcounter, 1, ilExcelUtils::_convert_text($this->lng->txt("title")), $format_title); $worksheet->write($rowcounter++, 2, ilExcelUtils::_convert_text($this->lng->txt("answer")), $format_title); foreach ($eval_data["textanswers"] as $key => $answers) { $title = $eval_data["variables"][$key]["title"]; foreach ($answers as $answer) { $worksheet->write($rowcounter, 1, ilExcelUtils::_convert_text($title)); $worksheet->write($rowcounter++, 2, ilExcelUtils::_convert_text($answer)); } } } }
/** * build xml export file */ function buildExportFileXLS() { global $ilBench; $ilBench->start("QuestionpoolExport", "buildExportFile"); include_once "./Services/Excel/classes/class.ilExcelWriterAdapter.php"; $adapter = new ilExcelWriterAdapter($this->export_dir . "/" . $this->filename, 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'); $worksheet =& $workbook->addWorksheet(); $row = 0; $col = 0; // title row include_once "./Services/Excel/classes/class.ilExcelUtils.php"; include_once "./Modules/TestQuestionPool/classes/class.assQuestion.php"; $worksheet->write($row, $col, ilExcelUtils::_convert_text($this->lng->txt("title"), "latin1"), $format_title); $col++; $worksheet->write($row, $col, ilExcelUtils::_convert_text($this->lng->txt("description"), "latin1"), $format_title); $col++; $worksheet->write($row, $col, ilExcelUtils::_convert_text($this->lng->txt("question_type"), "latin1"), $format_title); $col++; $worksheet->write($row, $col, ilExcelUtils::_convert_text($this->lng->txt("author"), "latin1"), $format_title); $col++; $worksheet->write($row, $col, ilExcelUtils::_convert_text($this->lng->txt("create_date"), "latin1"), $format_title); $col++; $worksheet->write($row, $col, ilExcelUtils::_convert_text($this->lng->txt("last_update"), "latin1"), $format_title); $col = 0; $row++; $questions = $this->qpl_obj->getQuestionList(); foreach ($questions as $question) { $worksheet->write($row, $col, ilExcelUtils::_convert_text($question["title"], "latin1")); $col++; $worksheet->write($row, $col, ilExcelUtils::_convert_text($question["description"], "latin1")); $col++; $worksheet->write($row, $col, ilExcelUtils::_convert_text($this->lng->txt($question["type_tag"]), "latin1")); $col++; $worksheet->write($row, $col, ilExcelUtils::_convert_text($question["author"], "latin1")); $col++; // ilDatePresentation::formatDate(new ilDateTime($question["created"],IL_CAL_UNIX)) $worksheet->write($row, $col, ilExcelUtils::_convert_text(ilFormat::formatDate(ilFormat::ftimestamp2dateDB($question["created"]), "date"), "latin1")); $col++; $worksheet->write($row, $col, ilExcelUtils::_convert_text(ilFormat::formatDate(ilFormat::ftimestamp2dateDB($question["tstamp"]), "date"), "latin1")); $col = 0; $row++; } $workbook->close(); ilUtil::zip($this->export_dir . "/" . $this->filename, $this->export_dir . "/" . $this->zipfilename); if (@file_exists($this->export_dir . "/" . $this->filename)) { @unlink($this->export_dir . "/" . $this->filename); } }
/** * Exports the evaluation data to the Microsoft Excel file format * * @param bool $deliver * @param string $filterby * @param string $filtertext Filter text for the user data * @param boolean $passedonly TRUE if only passed user datasets should be exported, FALSE otherwise * * @return string */ public function exportToExcel($deliver = TRUE, $filterby = "", $filtertext = "", $passedonly = FALSE) { if (strcmp($this->mode, "aggregated") == 0) { return $this->aggregatedResultsToExcel($deliver); } require_once './Services/Excel/classes/class.ilExcelWriterAdapter.php'; $excelfile = ilUtil::ilTempnam(); $adapter = new ilExcelWriterAdapter($excelfile, FALSE); $testname = $this->test_obj->getTitle(); switch ($this->mode) { case 'results': $testname .= '_results'; break; } $testname = ilUtil::getASCIIFilename(preg_replace("/\\s/", "_", $testname)) . ".xls"; $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'); require_once './Services/Excel/classes/class.ilExcelUtils.php'; $worksheet =& $workbook->addWorksheet(ilExcelUtils::_convert_text($this->lng->txt("tst_results"))); $additionalFields = $this->test_obj->getEvaluationAdditionalFields(); $row = 0; $col = 0; if ($this->test_obj->getAnonymity()) { $worksheet->write($row, $col++, ilExcelUtils::_convert_text($this->lng->txt("counter")), $format_title); } else { $worksheet->write($row, $col++, ilExcelUtils::_convert_text($this->lng->txt("name")), $format_title); $worksheet->write($row, $col++, ilExcelUtils::_convert_text($this->lng->txt("login")), $format_title); } if (count($additionalFields)) { foreach ($additionalFields as $fieldname) { $worksheet->write($row, $col++, ilExcelUtils::_convert_text($this->lng->txt($fieldname)), $format_title); } } $worksheet->write($row, $col++, ilExcelUtils::_convert_text($this->lng->txt("tst_stat_result_resultspoints")), $format_title); $worksheet->write($row, $col++, ilExcelUtils::_convert_text($this->lng->txt("maximum_points")), $format_title); $worksheet->write($row, $col++, ilExcelUtils::_convert_text($this->lng->txt("tst_stat_result_resultsmarks")), $format_title); if ($this->test_obj->getECTSOutput()) { $worksheet->write($row, $col++, ilExcelUtils::_convert_text($this->lng->txt("ects_grade")), $format_title); } $worksheet->write($row, $col++, ilExcelUtils::_convert_text($this->lng->txt("tst_stat_result_qworkedthrough")), $format_title); $worksheet->write($row, $col++, ilExcelUtils::_convert_text($this->lng->txt("tst_stat_result_qmax")), $format_title); $worksheet->write($row, $col++, ilExcelUtils::_convert_text($this->lng->txt("tst_stat_result_pworkedthrough")), $format_title); $worksheet->write($row, $col++, ilExcelUtils::_convert_text($this->lng->txt("tst_stat_result_timeofwork")), $format_title); $worksheet->write($row, $col++, ilExcelUtils::_convert_text($this->lng->txt("tst_stat_result_atimeofwork")), $format_title); $worksheet->write($row, $col++, ilExcelUtils::_convert_text($this->lng->txt("tst_stat_result_firstvisit")), $format_title); $worksheet->write($row, $col++, ilExcelUtils::_convert_text($this->lng->txt("tst_stat_result_lastvisit")), $format_title); $worksheet->write($row, $col++, ilExcelUtils::_convert_text($this->lng->txt("tst_stat_result_mark_median")), $format_title); $worksheet->write($row, $col++, ilExcelUtils::_convert_text($this->lng->txt("tst_stat_result_rank_participant")), $format_title); $worksheet->write($row, $col++, ilExcelUtils::_convert_text($this->lng->txt("tst_stat_result_rank_median")), $format_title); $worksheet->write($row, $col++, ilExcelUtils::_convert_text($this->lng->txt("tst_stat_result_total_participants")), $format_title); $worksheet->write($row, $col++, ilExcelUtils::_convert_text($this->lng->txt("tst_stat_result_median")), $format_title); $worksheet->write($row, $col++, ilExcelUtils::_convert_text($this->lng->txt("scored_pass")), $format_title); $worksheet->write($row, $col++, ilExcelUtils::_convert_text($this->lng->txt("pass")), $format_title); $counter = 1; $data =& $this->test_obj->getCompleteEvaluationData(TRUE, $filterby, $filtertext); $firstrowwritten = false; foreach ($data->getParticipants() as $active_id => $userdata) { $remove = FALSE; if ($passedonly) { if ($data->getParticipant($active_id)->getPassed() == FALSE) { $remove = TRUE; } } if (!$remove) { $row++; if ($this->test_obj->isRandomTest() || $this->test_obj->getShuffleQuestions()) { $row++; } $col = 0; if ($this->test_obj->getAnonymity()) { $worksheet->write($row, $col++, ilExcelUtils::_convert_text($counter)); } else { $worksheet->write($row, $col++, ilExcelUtils::_convert_text($data->getParticipant($active_id)->getName())); $worksheet->write($row, $col++, ilExcelUtils::_convert_text($data->getParticipant($active_id)->getLogin())); } if (count($additionalFields)) { $userfields = ilObjUser::_lookupFields($userdata->getUserID()); foreach ($additionalFields as $fieldname) { if (strcmp($fieldname, "gender") == 0) { $worksheet->write($row, $col++, ilExcelUtils::_convert_text($this->lng->txt("gender_" . $userfields[$fieldname]))); } else { $worksheet->write($row, $col++, ilExcelUtils::_convert_text($userfields[$fieldname])); } } } $worksheet->write($row, $col++, ilExcelUtils::_convert_text($data->getParticipant($active_id)->getReached())); $worksheet->write($row, $col++, ilExcelUtils::_convert_text($data->getParticipant($active_id)->getMaxpoints())); $worksheet->write($row, $col++, ilExcelUtils::_convert_text($data->getParticipant($active_id)->getMark())); if ($this->test_obj->getECTSOutput()) { $worksheet->write($row, $col++, ilExcelUtils::_convert_text($data->getParticipant($active_id)->getECTSMark())); } $worksheet->write($row, $col++, ilExcelUtils::_convert_text($data->getParticipant($active_id)->getQuestionsWorkedThrough())); $worksheet->write($row, $col++, ilExcelUtils::_convert_text($data->getParticipant($active_id)->getNumberOfQuestions())); $worksheet->write($row, $col++, $data->getParticipant($active_id)->getQuestionsWorkedThroughInPercent() / 100.0, $format_percent); $time = $data->getParticipant($active_id)->getTimeOfWork(); $time_seconds = $time; $time_hours = floor($time_seconds / 3600); $time_seconds -= $time_hours * 3600; $time_minutes = floor($time_seconds / 60); $time_seconds -= $time_minutes * 60; $worksheet->write($row, $col++, ilExcelUtils::_convert_text(sprintf("%02d:%02d:%02d", $time_hours, $time_minutes, $time_seconds))); $time = $data->getParticipant($active_id)->getQuestionsWorkedThrough() ? $data->getParticipant($active_id)->getTimeOfWork() / $data->getParticipant($active_id)->getQuestionsWorkedThrough() : 0; $time_seconds = $time; $time_hours = floor($time_seconds / 3600); $time_seconds -= $time_hours * 3600; $time_minutes = floor($time_seconds / 60); $time_seconds -= $time_minutes * 60; $worksheet->write($row, $col++, ilExcelUtils::_convert_text(sprintf("%02d:%02d:%02d", $time_hours, $time_minutes, $time_seconds))); $fv = getdate($data->getParticipant($active_id)->getFirstVisit()); $firstvisit = ilUtil::excelTime($fv["year"], $fv["mon"], $fv["mday"], $fv["hours"], $fv["minutes"], $fv["seconds"]); $worksheet->write($row, $col++, $firstvisit, $format_datetime); $lv = getdate($data->getParticipant($active_id)->getLastVisit()); $lastvisit = ilUtil::excelTime($lv["year"], $lv["mon"], $lv["mday"], $lv["hours"], $lv["minutes"], $lv["seconds"]); $worksheet->write($row, $col++, $lastvisit, $format_datetime); $median = $data->getStatistics()->getStatistics()->median(); $pct = $data->getParticipant($active_id)->getMaxpoints() ? $median / $data->getParticipant($active_id)->getMaxpoints() * 100.0 : 0; $mark = $this->test_obj->mark_schema->getMatchingMark($pct); $mark_short_name = ""; if (is_object($mark)) { $mark_short_name = $mark->getShortName(); } $worksheet->write($row, $col++, ilExcelUtils::_convert_text($mark_short_name)); $worksheet->write($row, $col++, ilExcelUtils::_convert_text($data->getStatistics()->getStatistics()->rank($data->getParticipant($active_id)->getReached()))); $worksheet->write($row, $col++, ilExcelUtils::_convert_text($data->getStatistics()->getStatistics()->rank_median())); $worksheet->write($row, $col++, ilExcelUtils::_convert_text($data->getStatistics()->getStatistics()->count())); $worksheet->write($row, $col++, ilExcelUtils::_convert_text($median)); if ($this->test_obj->getPassScoring() == SCORE_BEST_PASS) { $worksheet->write($row, $col++, $data->getParticipant($active_id)->getBestPass() + 1); } else { $worksheet->write($row, $col++, $data->getParticipant($active_id)->getLastPass() + 1); } $startcol = $col; for ($pass = 0; $pass <= $data->getParticipant($active_id)->getLastPass(); $pass++) { $col = $startcol; $finishdate = $this->test_obj->getPassFinishDate($active_id, $pass); if ($finishdate > 0) { if ($pass > 0) { $row++; if ($this->test_obj->isRandomTest() || $this->test_obj->getShuffleQuestions()) { $row++; } } $worksheet->write($row, $col++, ilExcelUtils::_convert_text($pass + 1)); if (is_object($data->getParticipant($active_id)) && is_array($data->getParticipant($active_id)->getQuestions($pass))) { foreach ($data->getParticipant($active_id)->getQuestions($pass) as $question) { $question_data = $data->getParticipant($active_id)->getPass($pass)->getAnsweredQuestionByQuestionId($question["id"]); $worksheet->write($row, $col, ilExcelUtils::_convert_text($question_data["reached"])); if ($this->test_obj->isRandomTest() || $this->test_obj->getShuffleQuestions()) { $worksheet->write($row - 1, $col, ilExcelUtils::_convert_text(preg_replace("/<.*?>/", "", $data->getQuestionTitle($question["id"]))), $format_title); } else { if ($pass == 0 && !$firstrowwritten) { $worksheet->write(0, $col, ilExcelUtils::_convert_text(preg_replace("/<.*?>/", "", $data->getQuestionTitle($question["id"]))), $format_title); } } $col++; } $firstrowwritten = true; } } } $counter++; } } if ($this->test_obj->getExportSettingsSingleChoiceShort() && !$this->test_obj->isRandomTest() && $this->test_obj->hasSingleChoiceQuestions()) { // special tab for single choice tests $titles =& $this->test_obj->getQuestionTitlesAndIndexes(); $positions = array(); $pos = 0; $row = 0; foreach ($titles as $id => $title) { $positions[$id] = $pos; $pos++; } $usernames = array(); $participantcount = count($data->getParticipants()); $allusersheet = false; $pages = 0; $resultsheet =& $workbook->addWorksheet($this->lng->txt("eval_all_users")); $col = 0; $resultsheet->write($row, $col++, ilExcelUtils::_convert_text($this->lng->txt('name')), $format_title); $resultsheet->write($row, $col++, ilExcelUtils::_convert_text($this->lng->txt('login')), $format_title); if (count($additionalFields)) { foreach ($additionalFields as $fieldname) { if (strcmp($fieldname, "matriculation") == 0) { $resultsheet->write($row, $col++, ilExcelUtils::_convert_text($this->lng->txt('matriculation')), $format_title); } } } $resultsheet->write($row, $col++, ilExcelUtils::_convert_text($this->lng->txt('test')), $format_title); foreach ($titles as $title) { $resultsheet->write($row, $col++, ilExcelUtils::_convert_text($title), $format_title); } $row++; foreach ($data->getParticipants() as $active_id => $userdata) { $username = !is_null($userdata) && ilExcelUtils::_convert_text($userdata->getName()) ? ilExcelUtils::_convert_text($userdata->getName()) : "ID {$active_id}"; if (array_key_exists($username, $usernames)) { $usernames[$username]++; $username .= " ({$i})"; } else { $usernames[$username] = 1; } $col = 0; $resultsheet->write($row, $col++, $username); $resultsheet->write($row, $col++, $userdata->getLogin()); if (count($additionalFields)) { $userfields = ilObjUser::_lookupFields($userdata->getUserID()); foreach ($additionalFields as $fieldname) { if (strcmp($fieldname, "matriculation") == 0) { if (strlen($userfields[$fieldname])) { $resultsheet->write($row, $col++, ilExcelUtils::_convert_text($userfields[$fieldname])); } else { $col++; } } } } $resultsheet->write($row, $col++, ilExcelUtils::_convert_text($this->test_obj->getTitle())); $pass = $userdata->getScoredPass(); if (is_object($userdata) && is_array($userdata->getQuestions($pass))) { foreach ($userdata->getQuestions($pass) as $question) { $objQuestion =& $this->test_obj->_instanciateQuestion($question["aid"]); if (is_object($objQuestion) && strcmp($objQuestion->getQuestionType(), 'assSingleChoice') == 0) { $solution = $objQuestion->getSolutionValues($active_id, $pass); $pos = $positions[$question["aid"]]; $selectedanswer = "x"; foreach ($objQuestion->getAnswers() as $id => $answer) { if (strlen($solution[0]["value1"]) && $id == $solution[0]["value1"]) { $selectedanswer = $answer->getAnswertext(); } } $resultsheet->write($row, $col + $pos, ilExcelUtils::_convert_text($selectedanswer)); } } } $row++; } if ($this->test_obj->isSingleChoiceTestWithoutShuffle()) { // special tab for single choice tests without shuffle option $pos = 0; $row = 0; $usernames = array(); $allusersheet = false; $pages = 0; $resultsheet =& $workbook->addWorksheet($this->lng->txt("eval_all_users") . " (2)"); $col = 0; $resultsheet->write($row, $col++, ilExcelUtils::_convert_text($this->lng->txt('name')), $format_title); $resultsheet->write($row, $col++, ilExcelUtils::_convert_text($this->lng->txt('login')), $format_title); if (count($additionalFields)) { foreach ($additionalFields as $fieldname) { if (strcmp($fieldname, "matriculation") == 0) { $resultsheet->write($row, $col++, ilExcelUtils::_convert_text($this->lng->txt('matriculation')), $format_title); } } } $resultsheet->write($row, $col++, ilExcelUtils::_convert_text($this->lng->txt('test')), $format_title); foreach ($titles as $title) { $resultsheet->write($row, $col++, ilExcelUtils::_convert_text($title), $format_title); } $row++; foreach ($data->getParticipants() as $active_id => $userdata) { $username = !is_null($userdata) && ilExcelUtils::_convert_text($userdata->getName()) ? ilExcelUtils::_convert_text($userdata->getName()) : "ID {$active_id}"; if (array_key_exists($username, $usernames)) { $usernames[$username]++; $username .= " ({$i})"; } else { $usernames[$username] = 1; } $col = 0; $resultsheet->write($row, $col++, $username); $resultsheet->write($row, $col++, $userdata->getLogin()); if (count($additionalFields)) { $userfields = ilObjUser::_lookupFields($userdata->getUserID()); foreach ($additionalFields as $fieldname) { if (strcmp($fieldname, "matriculation") == 0) { if (strlen($userfields[$fieldname])) { $resultsheet->write($row, $col++, ilExcelUtils::_convert_text($userfields[$fieldname])); } else { $col++; } } } } $resultsheet->write($row, $col++, ilExcelUtils::_convert_text($this->test_obj->getTitle())); $pass = $userdata->getScoredPass(); if (is_object($userdata) && is_array($userdata->getQuestions($pass))) { foreach ($userdata->getQuestions($pass) as $question) { $objQuestion =& $this->test_obj->_instanciateQuestion($question["aid"]); if (is_object($objQuestion) && strcmp($objQuestion->getQuestionType(), 'assSingleChoice') == 0) { $solution = $objQuestion->getSolutionValues($active_id, $pass); $pos = $positions[$question["aid"]]; $selectedanswer = chr(65 + $solution[0]["value1"]); $resultsheet->write($row, $col + $pos, ilExcelUtils::_convert_text($selectedanswer)); } } } $row++; } } } else { // test participant result export $usernames = array(); $participantcount = count($data->getParticipants()); $allusersheet = false; $pages = 0; $i = 0; foreach ($data->getParticipants() as $active_id => $userdata) { $i++; $username = !is_null($userdata) && ilExcelUtils::_convert_text($userdata->getName()) ? ilExcelUtils::_convert_text($userdata->getName()) : "ID {$active_id}"; if (array_key_exists($username, $usernames)) { $usernames[$username]++; $username .= " ({$i})"; } else { $usernames[$username] = 1; } if ($participantcount > 250) { if (!$allusersheet || $pages - 1 < floor($row / 64000)) { $resultsheet =& $workbook->addWorksheet($this->lng->txt("eval_all_users") . ($pages > 0 ? " (" . ($pages + 1) . ")" : "")); $allusersheet = true; $row = 0; $pages++; } } else { $resultsheet =& $workbook->addWorksheet($username); } if (method_exists($resultsheet, "writeString")) { $pass = $userdata->getScoredPass(); $row = $allusersheet ? $row : 0; $resultsheet->writeString($row, 0, ilExcelUtils::_convert_text(sprintf($this->lng->txt("tst_result_user_name_pass"), $pass + 1, $userdata->getName())), $format_bold); $row += 2; if (is_object($userdata) && is_array($userdata->getQuestions($pass))) { foreach ($userdata->getQuestions($pass) as $question) { require_once "./Modules/TestQuestionPool/classes/class.assQuestion.php"; $question = assQuestion::_instanciateQuestion($question["id"]); if (is_object($question)) { $row = $question->setExportDetailsXLS($resultsheet, $row, $active_id, $pass, $format_title, $format_bold); } } } } } } $workbook->close(); if ($deliver) { ilUtil::deliverFile($excelfile, $testname, "application/vnd.ms-excel", false, true); exit; } else { return $excelfile; } }
function createExcelExport(&$settings, &$data, $filename, $a_mode) { include_once "./Services/Excel/classes/class.ilExcelUtils.php"; include_once "./Services/Excel/classes/class.ilExcelWriterAdapter.php"; $adapter = new ilExcelWriterAdapter($filename, FALSE); $workbook = $adapter->getWorkbook(); // 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'); $worksheet =& $workbook->addWorksheet(); $row = 0; $col = 0; $udf_ex_fields = $this->getUserDefinedExportFields(); // title row foreach ($settings as $value) { if ($value == 'ext_account') { $value = 'user_ext_account'; } $worksheet->write($row, $col, ilExcelUtils::_convert_text($this->lng->txt($value), $a_mode), $format_title); $col++; } foreach ($udf_ex_fields as $f) { $worksheet->write($row, $col, ilExcelUtils::_convert_text($f["name"], $a_mode), $format_title); $col++; } $this->lng->loadLanguageModule("meta"); foreach ($data as $index => $rowdata) { $row++; $col = 0; // standard fields foreach ($settings as $fieldname) { $value = $rowdata[$fieldname]; switch ($fieldname) { case "language": $worksheet->write($row, $col, ilExcelUtils::_convert_text($this->lng->txt("meta_l_" . $value), $a_mode)); break; case "time_limit_from": case "time_limit_until": $date = strftime("%Y-%m-%d %H:%M:%S", $value); if (preg_match("/(\\d{4})-(\\d{2})-(\\d{2}) (\\d{2}):(\\d{2}):(\\d{2})/", $date, $matches)) { $worksheet->write($row, $col, ilUtil::excelTime($matches[1], $matches[2], $matches[3], $matches[4], $matches[5], $matches[6]), $format_datetime); } break; case "last_login": case "last_update": case "create_date": case "approve_date": case "agree_date": if (preg_match("/(\\d{4})-(\\d{2})-(\\d{2}) (\\d{2}):(\\d{2}):(\\d{2})/", $value, $matches)) { $worksheet->write($row, $col, ilUtil::excelTime($matches[1], $matches[2], $matches[3], $matches[4], $matches[5], $matches[6]), $format_datetime); } break; case "interests_general": case "interests_help_offered": case "interests_help_looking": if (is_array($value) && sizeof($value)) { $value = implode(", ", $value); } else { $value = null; } // fallthrough // fallthrough default: $worksheet->write($row, $col, ilExcelUtils::_convert_text($value, $a_mode)); break; } $col++; } // custom fields reset($udf_ex_fields); if (count($udf_ex_fields) > 0) { include_once "./Services/User/classes/class.ilUserDefinedData.php"; $udf = new ilUserDefinedData($rowdata["usr_id"]); foreach ($udf_ex_fields as $f) { $worksheet->write($row, $col, ilExcelUtils::_convert_text($udf->get("f_" . $f["id"]), $a_mode)); $col++; } } } $workbook->close(); }
/** * Creates an Excel worksheet for the detailed cumulated results of this question * * @param object $worksheet Reference to the parent excel worksheet * @param object $startrow Startrow of the output in the excel worksheet * @param object $active_id Active id of the participant * @param object $pass Test pass * @param object $format_title Excel title format * @param object $format_bold Excel bold format * @param array $eval_data Cumulated evaluation data * @access public */ public function setExportDetailsXLS(&$worksheet, $startrow, $active_id, $pass, &$format_title, &$format_bold) { include_once "./Services/Excel/classes/class.ilExcelUtils.php"; $solution = $this->getSolutionValues($active_id, $pass); $worksheet->writeString($startrow, 0, ilExcelUtils::_convert_text($this->lng->txt($this->getQuestionType())), $format_title); $worksheet->writeString($startrow, 1, ilExcelUtils::_convert_text($this->getTitle()), $format_title); $i = 1; foreach ($this->getAnswers() as $id => $answer) { $worksheet->writeString($startrow + $i, 0, ilExcelUtils::_convert_text($answer->getArea() . ": " . $answer->getCoords()), $format_bold); if ($id == $solution[0]["value1"]) { $worksheet->write($startrow + $i, 1, 1); } else { $worksheet->write($startrow + $i, 1, 0); } $i++; } return $startrow + $i + 1; }
/** * Creates an Excel worksheet for the detailed cumulated results of this question * * @param object $workbook Reference to the parent excel workbook * @param object $format_title Excel title format * @param object $format_bold Excel bold format * @param array $eval_data Cumulated evaluation data * @access public */ function setExportDetailsXLS(&$workbook, &$format_title, &$format_bold, &$eval_data, $export_label) { include_once "./Services/Excel/classes/class.ilExcelUtils.php"; $worksheet =& $workbook->addWorksheet(); $rowcounter = 0; switch ($export_label) { case 'label_only': $worksheet->writeString(0, 0, ilExcelUtils::_convert_text($this->lng->txt("label")), $format_bold); $worksheet->writeString(0, 1, ilExcelUtils::_convert_text($this->label)); break; case 'title_only': $worksheet->writeString(0, 0, ilExcelUtils::_convert_text($this->lng->txt("title")), $format_bold); $worksheet->writeString(0, 1, ilExcelUtils::_convert_text($this->getTitle())); break; default: $worksheet->writeString(0, 0, ilExcelUtils::_convert_text($this->lng->txt("title")), $format_bold); $worksheet->writeString(0, 1, ilExcelUtils::_convert_text($this->getTitle())); $rowcounter++; $worksheet->writeString($rowcounter, 0, ilExcelUtils::_convert_text($this->lng->txt("label")), $format_bold); $worksheet->writeString($rowcounter, 1, ilExcelUtils::_convert_text($this->label)); break; } $rowcounter++; $worksheet->writeString($rowcounter, 0, ilExcelUtils::_convert_text($this->lng->txt("question")), $format_bold); $worksheet->writeString($rowcounter, 1, ilExcelUtils::_convert_text($this->getQuestiontext())); $rowcounter++; $worksheet->writeString($rowcounter, 0, ilExcelUtils::_convert_text($this->lng->txt("question_type")), $format_bold); $worksheet->writeString($rowcounter, 1, ilExcelUtils::_convert_text($this->lng->txt($this->getQuestionType()))); $rowcounter++; $worksheet->writeString($rowcounter, 0, ilExcelUtils::_convert_text($this->lng->txt("users_answered")), $format_bold); $worksheet->write($rowcounter, 1, $eval_data["TOTAL"]["USERS_ANSWERED"]); $rowcounter++; $worksheet->writeString($rowcounter, 0, ilExcelUtils::_convert_text($this->lng->txt("users_skipped")), $format_bold); $worksheet->write($rowcounter, 1, $eval_data["TOTAL"]["USERS_SKIPPED"]); $rowcounter++; preg_match("/(.*?)\\s+-\\s+(.*)/", $eval_data["TOTAL"]["MODE"], $matches); $worksheet->write($rowcounter, 0, ilExcelUtils::_convert_text($this->lng->txt("mode")), $format_bold); $worksheet->write($rowcounter++, 1, ilExcelUtils::_convert_text($matches[1])); $worksheet->write($rowcounter, 0, ilExcelUtils::_convert_text($this->lng->txt("mode_text")), $format_bold); $worksheet->write($rowcounter++, 1, ilExcelUtils::_convert_text($matches[2])); $worksheet->write($rowcounter, 0, ilExcelUtils::_convert_text($this->lng->txt("mode_nr_of_selections")), $format_bold); $worksheet->write($rowcounter++, 1, ilExcelUtils::_convert_text($eval_data["TOTAL"]["MODE_NR_OF_SELECTIONS"])); $worksheet->write($rowcounter, 0, ilExcelUtils::_convert_text($this->lng->txt("median")), $format_bold); $worksheet->write($rowcounter++, 1, ilExcelUtils::_convert_text(str_replace("<br />", " ", $eval_data["TOTAL"]["MEDIAN"]))); $worksheet->write($rowcounter, 0, ilExcelUtils::_convert_text($this->lng->txt("categories")), $format_bold); $worksheet->write($rowcounter, 1, ilExcelUtils::_convert_text($this->lng->txt("title")), $format_title); $worksheet->write($rowcounter, 2, ilExcelUtils::_convert_text($this->lng->txt("value")), $format_title); $worksheet->write($rowcounter, 3, ilExcelUtils::_convert_text($this->lng->txt("category_nr_selected")), $format_title); $worksheet->write($rowcounter++, 4, ilExcelUtils::_convert_text($this->lng->txt("percentage_of_selections")), $format_title); foreach ($eval_data["TOTAL"]["variables"] as $key => $value) { $worksheet->write($rowcounter, 1, ilExcelUtils::_convert_text($value["title"])); $worksheet->write($rowcounter, 2, $key + 1); $worksheet->write($rowcounter, 3, ilExcelUtils::_convert_text($value["selected"])); $worksheet->write($rowcounter++, 4, ilExcelUtils::_convert_text($value["percentage"]), $format_percent); } foreach ($eval_data as $evalkey => $evalvalue) { if (is_numeric($evalkey)) { $worksheet->writeString($rowcounter, 0, ilExcelUtils::_convert_text($this->lng->txt("row")), $format_bold); $worksheet->writeString($rowcounter, 1, ilExcelUtils::_convert_text($evalvalue["ROW"])); $worksheet->writeString($rowcounter + 1, 0, ilExcelUtils::_convert_text($this->lng->txt("users_answered")), $format_bold); $worksheet->write($rowcounter + 1, 1, $evalvalue["USERS_ANSWERED"]); $worksheet->writeString($rowcounter + 2, 0, ilExcelUtils::_convert_text($this->lng->txt("users_skipped")), $format_bold); $worksheet->write($rowcounter + 2, 1, $evalvalue["USERS_SKIPPED"]); $rowcounter = $rowcounter + 3; preg_match("/(.*?)\\s+-\\s+(.*)/", $evalvalue["MODE"], $matches); $worksheet->write($rowcounter, 0, ilExcelUtils::_convert_text($this->lng->txt("mode")), $format_bold); $worksheet->write($rowcounter++, 1, ilExcelUtils::_convert_text($matches[1])); $worksheet->write($rowcounter, 0, ilExcelUtils::_convert_text($this->lng->txt("mode_text")), $format_bold); $worksheet->write($rowcounter++, 1, ilExcelUtils::_convert_text($matches[2])); $worksheet->write($rowcounter, 0, ilExcelUtils::_convert_text($this->lng->txt("mode_nr_of_selections")), $format_bold); $worksheet->write($rowcounter++, 1, ilExcelUtils::_convert_text($evalvalue["MODE_NR_OF_SELECTIONS"])); $worksheet->write($rowcounter, 0, ilExcelUtils::_convert_text($this->lng->txt("median")), $format_bold); $worksheet->write($rowcounter++, 1, ilExcelUtils::_convert_text(str_replace("<br />", " ", $evalvalue["MEDIAN"]))); $worksheet->write($rowcounter, 0, ilExcelUtils::_convert_text($this->lng->txt("categories")), $format_bold); $worksheet->write($rowcounter, 1, ilExcelUtils::_convert_text($this->lng->txt("title")), $format_title); $worksheet->write($rowcounter, 2, ilExcelUtils::_convert_text($this->lng->txt("value")), $format_title); $worksheet->write($rowcounter, 3, ilExcelUtils::_convert_text($this->lng->txt("category_nr_selected")), $format_title); $worksheet->write($rowcounter++, 4, ilExcelUtils::_convert_text($this->lng->txt("percentage_of_selections")), $format_title); foreach ($evalvalue["variables"] as $key => $value) { $worksheet->write($rowcounter, 1, ilExcelUtils::_convert_text($value["title"])); $worksheet->write($rowcounter, 2, $key + 1); $worksheet->write($rowcounter, 3, ilExcelUtils::_convert_text($value["selected"])); $worksheet->write($rowcounter++, 4, ilExcelUtils::_convert_text($value["percentage"]), $format_percent); } // add text answers to detailed results if (is_array($evalvalue["textanswers"])) { $worksheet->write($rowcounter, 0, ilExcelUtils::_convert_text($this->lng->txt("freetext_answers")), $format_bold); $worksheet->write($rowcounter, 1, ilExcelUtils::_convert_text($this->lng->txt("title")), $format_title); $worksheet->write($rowcounter++, 2, ilExcelUtils::_convert_text($this->lng->txt("answer")), $format_title); foreach ($evalvalue["textanswers"] as $key => $answers) { $title = $evalvalue["variables"][$key]["title"]; foreach ($answers as $answer) { $worksheet->write($rowcounter, 1, ilExcelUtils::_convert_text($title)); $worksheet->write($rowcounter++, 2, ilExcelUtils::_convert_text($answer)); } } } } } // out compressed 2D-Matrix $format_center =& $workbook->addFormat(); $format_center->setColor('black'); $format_center->setAlign('center'); $worksheet->write($rowcounter, 0, ilExcelUtils::_convert_text($this->lng->txt("overview")), $format_bold); // title row with variables $rowcounter++; $counter = 0; $worksheet->write($rowcounter, $counter, "", $format_title); foreach ($eval_data["TOTAL"]["variables"] as $variable) { $worksheet->write($rowcounter, 1 + $counter, ilExcelUtils::_convert_text($variable["title"]), $format_title); $counter++; } $rowcounter++; // rows with variable values foreach ($eval_data as $index => $data) { if (is_numeric($index)) { $worksheet->write($rowcounter, 0, ilExcelUtils::_convert_text($data["ROW"]), $format_title); $counter = 1; foreach ($data["variables"] as $vardata) { $worksheet->write($rowcounter, $counter, $vardata["selected"], $format_center); $counter++; } $rowcounter++; } } }