public function deliver() { $file = $this->object->getFilePath(); if ($file) { ilUtil::deliverFile($file, $this->object->getTitle() . ".pdf"); } }
$lng->loadLanguageModule("sop"); $this->lng =& $lng; $this->ctrl =& $ilCtrl; $this->ctrl->saveParameter($this, "ref_id"); $this->offlineMode = new ilSCORMOfflineMode(); $this->online_icon = 'icon_slm_b.png'; $this->offline_icon = 'icon_slm_b_offline.png'; $this->icon = $this->online_icon; } function executeCommand() { global $tpl, $ilCtrl; $this->lmId = ilObject::_lookupObjectId($_GET["ref_id"]); $this->clientIdSop = $this->offlineMode->getClientIdSop(); $cmd = $ilCtrl->getCmd(); $this->setOfflineModeTabs($cmd); switch ($cmd) { case 'offlineMode_il2sopContent': ilUtil::deliverFile(ilUtil::getDataDir() . "/lm_data/lm_" . $this->lmId . ".zip", "lm_" . $this->lmId . ".zip"); break; case 'offlineMode_il2sop': $this->offlineMode->il2sop(); break; case 'offlineMode_il2sopStop': $this->offlineMode->setOfflineMode("online"); $this->view($this->offlineMode->getOfflineMode(), "msg_export_failure"); break; case 'offlineMode_il2sopOk': $this->offlineMode->setOfflineMode("offline"); $this->view($this->offlineMode->getOfflineMode(), "msg_export_ok"); break; case 'offlineMode_sop2il': $this->offlineMode->sop2il(); break; case 'offlineMode_sop2ilStop': $this->offlineMode->setOfflineMode("offline"); $this->view($this->offlineMode->getOfflineMode(), "msg_push_tracking_failure"); break; case 'offlineMode_sop2ilOk': $this->offlineMode->setOfflineMode("online"); $this->view($this->offlineMode->getOfflineMode(), "msg_push_tracking_ok");
/** * Download assignment file */ function downloadFileObject() { global $rbacsystem; $file = $_POST["file"] ? $_POST["file"] : $_GET["file"]; // check read permission $this->checkPermission("read"); if (!isset($file)) { ilUtil::sendFailure($this->lng->txt("exc_select_one_file"), true); $this->ctrl->redirect($this, "view"); } // check, whether file belongs to assignment include_once "./Modules/Exercise/classes/class.ilExAssignment.php"; $files = ilExAssignment::getFiles($this->object->getId(), (int) $_GET["ass_id"]); $file_exist = false; foreach ($files as $lfile) { if ($lfile["name"] == urldecode($file)) { $file_exist = true; break; } } if (!$file_exist) { echo "FILE DOES NOT EXIST"; exit; } // check whether assignment as already started $ass = new ilExAssignment((int) $_GET["ass_id"]); $not_started_yet = false; if ($ass->getStartTime() > 0 && time() - $ass->getStartTime() <= 0) { $not_started_yet = true; } // deliver file if (!$not_started_yet) { include_once "./Modules/Exercise/classes/class.ilFSStorageExercise.php"; $storage = new ilFSStorageExercise($this->object->getId(), (int) $_GET["ass_id"]); $p = $storage->getAssignmentFilePath(urldecode($file)); ilUtil::deliverFile($p, urldecode($file)); } return true; }
/** * Download template file */ public function downloadTemplate() { if (is_file($this->type->getCertificateTemplatesPath(true))) { $filename = srCertificateTemplateTypeFactory::getById($this->type->getTemplateTypeId())->getTemplateFilename(); ilUtil::deliverFile($this->type->getCertificateTemplatesPath(true), $filename); } $this->editTemplate(); }
/** * 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; } }
/** * Build and deliver export file */ function export() { $zip = $this->buildExportFile(); ilUtil::deliverFile($zip, $this->object->getTitle() . ".zip", '', false, true); }
public function downloadFolder() { global $lng, $rbacsystem, $ilAccess; include_once "./Services/Utilities/classes/class.ilUtil.php"; include_once 'Modules/File/classes/class.ilObjFile.php'; include_once 'Modules/File/classes/class.ilFileException.php'; if (!$ilAccess->checkAccess("read", "", $this->getRefId())) { $this->ilErr->raiseError(get_class($this) . "::downloadFolder(): missing read permission!", $this->ilErr->WARNING); } if (ilObject::_isInTrash($this->getRefId())) { $this->ilErr->raiseError(get_class($this) . "::downloadFolder(): object is trashed!", $this->ilErr->WARNING); } $zip = PATH_TO_ZIP; $tmpdir = ilUtil::ilTempnam(); ilUtil::makeDir($tmpdir); $basename = ilUtil::getAsciiFilename($this->getTitle()); $deliverFilename = $basename . ".zip"; $zipbasedir = $tmpdir . DIRECTORY_SEPARATOR . $basename; $tmpzipfile = $tmpdir . DIRECTORY_SEPARATOR . $deliverFilename; try { ilObjFolder::recurseFolder($this->getRefId(), $this->getTitle(), $tmpdir); ilUtil::zip($zipbasedir, $tmpzipfile); rename($tmpzipfile, $zipfile = ilUtil::ilTempnam()); ilUtil::delDir($tmpdir); ilUtil::deliverFile($zipfile, $deliverFilename, '', false, true); } catch (ilFileException $e) { ilUtil::sendInfo($e->getMessage(), true); } }
/** * 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; } }
/** * delete object file */ function downloadFile() { if (!isset($_POST["file"])) { $this->ilias->raiseError($this->lng->txt("no_checkbox"), $this->ilias->error_obj->MESSAGE); } if (count($_POST["file"]) > 1) { $this->ilias->raiseError($this->lng->txt("cont_select_max_one_item"), $this->ilias->error_obj->MESSAGE); } $cur_subdir = str_replace(".", "", ilUtil::stripSlashes($_GET["cdir"])); $cur_dir = !empty($cur_subdir) ? $this->main_dir . "/" . $cur_subdir : $this->main_dir; $file = $cur_dir . "/" . $_POST["file"][0]; // validate against files of current directory $valid = false; foreach (ilUtil::getDir($cur_dir) as $entry) { if ($entry["type"] == "file" && $cur_dir . "/" . $entry["entry"] == $file) { $valid = true; break; } } if (@is_file($file) && !@is_dir($file) && $valid) { ilUtil::deliverFile($file, $_POST["file"][0]); exit; } else { $this->ctrl->saveParameter($this, "cdir"); $this->ctrl->redirect($this, "listFiles"); } }
public function deliverPostFile() { global $ilUser; $id = (int) $_GET["object_id"]; if (!$id) { return; } include_once 'Modules/BookingManager/classes/class.ilBookingReservation.php'; $book_id = ilBookingReservation::getObjectReservationForUser($id, $ilUser->getId()); $obj = new ilBookingReservation($book_id); if ($obj->getUserId() != $ilUser->getId()) { return; } include_once 'Modules/BookingManager/classes/class.ilBookingObject.php'; $obj = new ilBookingObject($id); $file = $obj->getPostFileFullPath(); if ($file) { ilUtil::deliverFile($file, $obj->getPostFile()); } }
/** * Deliver mob file * * @param * @return */ function deliverMobFile($a_purpose = "Standard", $a_increase_download_cnt = false) { $mob = $this->getMobId(); include_once "./Services/MediaObjects/classes/class.ilObjMediaObject.php"; $mob = new ilObjMediaObject($mob); $mob_dir = ilObjMediaObject::_getDirectory($mob->getId()); // check purpose if (!$mob->hasPurposeItem($a_purpose)) { return false; } $m_item = $mob->getMediaItem($a_purpose); if ($m_item->getLocationType() != "Reference") { $file = $mob_dir . "/" . $m_item->getLocation(); if (file_exists($file) && is_file($file)) { if ($a_increase_download_cnt) { $this->increaseDownloadCounter(); } ilUtil::deliverFile($file, $m_item->getLocation()); } else { ilUtil::sendFailure("File not found!", true); return false; } } else { if ($a_increase_download_cnt) { $this->increaseDownloadCounter(); } ilUtil::redirect($m_item->getLocation()); } }
/** * Delete news items. */ function downloadItemObject() { global $ilCtrl; $this->checkPermission("read"); $mc_item = new ilNewsItem($_GET["item_id"]); $mob = $mc_item->getMobId(); include_once "./Services/MediaObjects/classes/class.ilObjMediaObject.php"; $mob = new ilObjMediaObject($mob); $mob_dir = ilObjMediaObject::_getDirectory($mob->getId()); $purpose = $_GET["purpose"]; $m_item = $mob->getMediaItem($purpose); if ($m_item->getLocationType() != "Reference") { $file = $mob_dir . "/" . $m_item->getLocation(); if (file_exists($file) && is_file($file)) { ilUtil::deliverFile($file, $m_item->getLocation()); } else { ilUtil::sendFailure("File not found!", true); $ilCtrl->redirect($this, "listItems"); } } else { ilUtil::redirect($m_item->getLocation()); } exit; }
public function sendAndCreateSimpleExportFile() { $orgu_id = ilObjOrgUnit::getRootOrgId(); $orgu_ref_id = ilObjOrgUnit::getRootOrgRefId(); ilExport::_createExportDirectory($orgu_id, "xml", "orgu"); $export_dir = ilExport::_getExportDirectory($orgu_id, "xml", "orgu"); $ts = time(); // Workaround for test assessment $sub_dir = $ts . '__' . IL_INST_ID . '__' . "orgu" . '_' . $orgu_id . ""; $new_file = $sub_dir . '.zip'; $export_run_dir = $export_dir . "/" . $sub_dir; ilUtil::makeDirParents($export_run_dir); $writer = $this->simpleExport($orgu_ref_id); $writer->xmlDumpFile($export_run_dir . "/manifest.xml", false); // zip the file ilUtil::zip($export_run_dir, $export_dir . "/" . $new_file); ilUtil::delDir($export_run_dir); // Store info about export include_once './Services/Export/classes/class.ilExportFileInfo.php'; $exp = new ilExportFileInfo($orgu_id); $exp->setVersion(ILIAS_VERSION_NUMERIC); $exp->setCreationDate(new ilDateTime($ts, IL_CAL_UNIX)); $exp->setExportType('xml'); $exp->setFilename($new_file); $exp->create(); ilUtil::deliverFile($export_dir . "/" . $new_file, $new_file); return array("success" => true, "file" => $new_file, "directory" => $export_dir); }
function downloadExportFile() { if (!isset($_POST["file"])) { $this->ilias->raiseError($this->lng->txt("no_checkbox"), $this->ilias->error_obj->MESSAGE); } if (count($_POST["file"]) > 1) { $this->ilias->raiseError($this->lng->txt("cont_select_max_one_item"), $this->ilias->error_obj->MESSAGE); } $export = new ilSCORM2004Export($this->object); $export_dir = $export->getExportDirectoryForType($_POST['type'][$_POST['file'][0]]); ilUtil::deliverFile($export_dir . "/" . $_POST['file'][0], $_POST['file'][0]); }
/** * Download file */ function download() { global $ilCtrl, $lng; if (!isset($_POST["file"])) { ilUtil::sendFailure($lng->txt("no_checkbox"), true); $ilCtrl->redirect($this, "listExportFiles"); } if (count($_POST["file"]) > 1) { ilUtil::sendFailure($lng->txt("exp_select_max_one_item"), true); $ilCtrl->redirect($this, "listExportFiles"); } $file = explode(":", $_POST["file"][0]); include_once "./Services/Export/classes/class.ilExport.php"; $export_dir = ilExport::_getExportDirectory($this->obj->getId(), str_replace("..", "", $file[0]), $this->obj->getType()); ilUtil::deliverFile($export_dir . "/" . $file[1], $file[1]); }
/** * Create member status record for a new assignment for all participants */ function sendMultiFeedbackStructureFile() { global $ilDB; // send and delete the zip file $deliverFilename = trim(str_replace(" ", "_", $this->getTitle() . "_" . $this->getId())); $deliverFilename = ilUtil::getASCIIFilename($deliverFilename); $deliverFilename = "multi_feedback_" . $deliverFilename; $exc = new ilObjExercise($this->getExerciseId(), false); $cdir = getcwd(); // create temporary directoy $tmpdir = ilUtil::ilTempnam(); ilUtil::makeDir($tmpdir); $mfdir = $tmpdir . "/" . $deliverFilename; ilUtil::makeDir($mfdir); // create subfolders <lastname>_<firstname>_<id> for each participant include_once "./Modules/Exercise/classes/class.ilExerciseMembers.php"; $exmem = new ilExerciseMembers($exc); $mems = $exmem->getMembers(); foreach ($mems as $mem) { $name = ilObjUser::_lookupName($mem); $subdir = $name["lastname"] . "_" . $name["firstname"] . "_" . $name["login"] . "_" . $name["user_id"]; $subdir = ilUtil::getASCIIFilename($subdir); ilUtil::makeDir($mfdir . "/" . $subdir); } // create the zip file chdir($tmpdir); $tmpzipfile = $tmpdir . "/multi_feedback.zip"; ilUtil::zip($tmpdir, $tmpzipfile, true); chdir($cdir); ilUtil::deliverFile($tmpzipfile, $deliverFilename . ".zip", "", false, true); }
function downloadArchives() { global $ilAccess; // MINIMUM ACCESS LEVEL = 'write' if (!$ilAccess->checkAccess("read", '', $this->course_obj->getRefId())) { $ilErr->raiseError($this->lng->txt('msg_no_perm_write'), $ilErr->MESSAGE); } $_POST["archives"] = $_POST["archives"] ? $_POST["archives"] : array(); if (!count($_POST['archives'])) { ilUtil::sendFailure($this->lng->txt('crs_no_archive_selected')); $this->view(); return false; } if (count($_POST['archives']) > 1) { ilUtil::sendFailure($this->lng->txt('crs_select_one_archive')); $this->view(); return false; } $this->course_obj->initCourseArchiveObject(); $abs_path = $this->course_obj->archives_obj->getArchiveFile((int) $_POST['archives'][0]); $basename = basename($abs_path); ilUtil::deliverFile($abs_path, $basename); }
/** * export style */ function exportStyleObject() { $file = $this->object->export(); ilUtil::deliverFile($file, "sty_" . $this->object->getId() . ".zip"); }
/** * Download all submitted files of an assignment (all user) * * @param $members array of user names, key is user id */ function downloadAllDeliveredFiles($a_eph_id, $a_ass_id, $members) { global $lng, $ilObjDataCache, $ilias; include_once "./Services/Utilities/classes/class.ilUtil.php"; include_once "./Customizing/global/plugins/Services/Repository/RepositoryObject/Ephorus/classes/class.ilFSStorageEphorus.php"; $storage = new ilFSStorageEphorus($a_eph_id, $a_ass_id); $storage->create(); ksort($members); //$savepath = $this->getEphorusPath() . "/" . $this->obj_id . "/"; $savepath = $storage->getAbsoluteSubmissionPath(); $cdir = getcwd(); // important check: if the directory does not exist // ILIAS stays in the current directory (echoing only a warning) // and the zip command below archives the whole ILIAS directory // (including the data directory) and sends a mega file to the user :-o if (!is_dir($savepath)) { return; } // Safe mode fix // chdir($this->getEphorusPath()); chdir($storage->getTempPath()); $zip = PATH_TO_ZIP; // check first, if we have enough free disk space to copy all files to temporary directory $tmpdir = ilUtil::ilTempnam(); ilUtil::makeDir($tmpdir); chdir($tmpdir); $dirsize = 0; foreach ($members as $id => $object) { $directory = $savepath . DIRECTORY_SEPARATOR . $id; $dirsize += ilUtil::dirsize($directory); } if ($dirsize > disk_free_space($tmpdir)) { return -1; } // copy all member directories to the temporary folder // switch from id to member name and append the login if the member name is double // ensure that no illegal filenames will be created // remove timestamp from filename $cache = array(); foreach ($members as $id => $user) { $sourcedir = $savepath . DIRECTORY_SEPARATOR . $id; if (!is_dir($sourcedir)) { continue; } $userName = ilObjUser::_lookupName($id); $directory = ilUtil::getASCIIFilename(trim($userName["lastname"]) . "_" . trim($userName["firstname"])); if (array_key_exists($directory, $cache)) { // first try is to append the login; $directory = ilUtil::getASCIIFilename($directory . "_" . trim(ilObjUser::_lookupLogin($id))); if (array_key_exists($directory, $cache)) { // second and secure: append the user id as well. $directory .= "_" . $id; } } $cache[$directory] = $directory; ilUtil::makeDir($directory); $sourcefiles = scandir($sourcedir); foreach ($sourcefiles as $sourcefile) { if ($sourcefile == "." || $sourcefile == "..") { continue; } $targetfile = trim(basename($sourcefile)); $pos = strpos($targetfile, "_"); if ($pos === false) { } else { $targetfile = substr($targetfile, $pos + 1); } $targetfile = $directory . DIRECTORY_SEPARATOR . $targetfile; $sourcefile = $sourcedir . DIRECTORY_SEPARATOR . $sourcefile; if (!copy($sourcefile, $targetfile)) { //echo 'Could not copy '.$sourcefile.' to '.$targetfile; $ilias->raiseError('Could not copy ' . basename($sourcefile) . " to '" . $targetfile . "'.", $ilias->error_obj->MESSAGE); } else { // preserve time stamp touch($targetfile, filectime($sourcefile)); } } } $tmpfile = ilUtil::ilTempnam(); $tmpzipfile = $tmpfile . ".zip"; // Safe mode fix $zipcmd = $zip . " -r " . ilUtil::escapeShellArg($tmpzipfile) . " ."; exec($zipcmd); ilUtil::delDir($tmpdir); $assTitle = ilEphAssignment::lookupTitle($a_ass_id); chdir($cdir); ilUtil::deliverFile($tmpzipfile, (strlen($assTitle) == 0 ? strtolower($lng->txt("rep_robj_xeph_ephorus_assignment")) : $assTitle) . ".zip", "", false, true); }
/** * Download assignment file */ function downloadFile() { $file = $_POST["file"] ? $_POST["file"] : $_GET["file"]; if (!isset($file)) { ilUtil::sendFailure($this->lng->txt("rep_robj_xeph_select_one_file"), true); $this->ctrl->redirect($this, "view"); } // check, whether file belongs to assignment include_once "./Customizing/global/plugins/Services/Repository/RepositoryObject/Ephorus/classes/class.ilEphAssignment.php"; $files = ilEphAssignment::getFiles($this->object->getId(), (int) $_GET["ass_id"]); $file_exist = false; foreach ($files as $lfile) { if ($lfile["name"] == urldecode($file)) { $file_exist = true; break; } } if (!$file_exist) { echo "FILE DOES NOT EXIST"; exit; } // check whether assignment as already started $ass = new ilEphAssignment((int) $_GET["ass_id"]); $not_started_yet = false; if ($ass->getStartTime() > 0 && time() - $ass->getStartTime() <= 0) { $not_started_yet = true; } // deliver file if (!$not_started_yet) { include_once "./Customizing/global/plugins/Services/Repository/RepositoryObject/Ephorus/classes/class.ilFSStorageEphorus.php"; $storage = new ilFSStorageEphorus($this->object->getId(), (int) $_GET["ass_id"]); $p = $storage->getAssignmentFilePath(urldecode($file)); ilUtil::deliverFile($p, urldecode($file)); } return true; }
public function download() { /** * @var $lng ilLanguage * @var $ilCtrl ilCtrl */ global $lng, $ilCtrl; if (!isset($_POST['file'])) { ilUtil::sendInfo($lng->txt('no_checkbox'), true); $ilCtrl->redirect($this, 'listExportFiles'); } if (count($_POST['file']) > 1) { ilUtil::sendInfo($lng->txt('select_max_one_item'), true); $ilCtrl->redirect($this, 'listExportFiles'); } require_once 'class.ilTestArchiver.php'; $archiver = new ilTestArchiver($this->getParentGUI()->object->getId()); $archive_dir = $archiver->getZipExportDirectory(); $export_dir = $this->obj->getExportDirectory(); if (file_exists($export_dir . '/' . $_POST['file'][0])) { ilUtil::deliverFile($export_dir . '/' . $_POST['file'][0], $_POST['file'][0]); } if (file_exists($archive_dir . '/' . $_POST['file'][0])) { ilUtil::deliverFile($archive_dir . '/' . $_POST['file'][0], $_POST['file'][0]); } }
/** * send download file (xml/html) */ function downloadExportFile() { global $ilAccess, $ilias, $lng; if (!$ilAccess->checkAccess("read", "", $_GET["ref_id"])) { $ilias->raiseError($lng->txt("permission_denied"), $ilias->error_obj->MESSAGE); } $file = $this->glossary->getPublicExportFile($_GET["type"]); if ($this->glossary->getPublicExportFile($_GET["type"]) != "") { $dir = $this->glossary->getExportDirectory($_GET["type"]); if (is_file($dir . "/" . $file)) { ilUtil::deliverFile($dir . "/" . $file, $file); exit; } } $this->ilias->raiseError($this->lng->txt("file_not_found"), $this->ilias->error_obj->MESSAGE); }
/** * download export file */ function downloadPDFFile() { if (!isset($_POST["file"])) { $this->ilias->raiseError($this->lng->txt("no_checkbox"), $this->ilias->error_obj->MESSAGE); } if (count($_POST["file"]) > 1) { $this->ilias->raiseError($this->lng->txt("cont_select_max_one_item"), $this->ilias->error_obj->MESSAGE); } $export_dir = $this->object->getOfflineDirectory(); ilUtil::deliverFile($export_dir . "/" . $_POST["file"][0], $_POST["file"][0]); }
/** * Export page layout template object */ function exportLayoutObject() { include_once "./Services/Export/classes/class.ilExport.php"; $exp = new ilExport(); $tmpdir = ilUtil::ilTempnam(); ilUtil::makeDir($tmpdir); $succ = $exp->exportEntity("pgtp", (int) $_GET["layout_id"], "4.2.0", "Services/COPage", "Title", $tmpdir); if ($succ["success"]) { ilUtil::deliverFile($succ["directory"] . "/" . $succ["file"], $succ["file"], "", false, false, false); } if (is_file($succ["directory"] . "/" . $succ["file"])) { unlink($succ["directory"] . "/" . $succ["file"]); } if (is_dir($succ["directory"])) { unlink($succ["directory"]); } }
public function downloadFolderObject() { global $ilAccess, $ilErr, $lng; if (!$ilAccess->checkAccess("read", "", $this->ref_id)) { $this->ilias->raiseError($this->lng->txt("msg_no_perm_read"), $this->ilias->error_obj->MESSAGE); } $filename = $this->object->downloadFolder(); ilUtil::deliverFile($filename, ilUtil::getASCIIFilename($this->object->getTitle() . ".zip")); }
/** * export question */ function exportQuestionObject() { // export button was pressed if (count($_POST["q_id"]) > 0) { include_once "./Modules/TestQuestionPool/classes/class.ilQuestionpoolExport.php"; $qpl_exp = new ilQuestionpoolExport($this->object, "xml", $_POST["q_id"]); $export_file = $qpl_exp->buildExportFile(); $filename = $export_file; $filename = preg_replace("/.*\\//", "", $filename); include_once "./Services/Utilities/classes/class.ilUtil.php"; ilUtil::deliverFile($export_file, $filename); exit; } else { ilUtil::sendInfo($this->lng->txt("qpl_export_select_none"), true); } $this->ctrl->redirect($this, "questions"); }
/** * send File to User */ public function sendFile() { global $ilAccess; //need read access to receive file if ($ilAccess->checkAccess("read", "", $this->parent_obj->ref_id)) { $rec_id = $_GET['record_id']; $record = ilDataCollectionCache::getRecordCache($rec_id); $field_id = $_GET['field_id']; $file_obj = new ilObjFile($record->getRecordFieldValue($field_id), false); if (!$this->recordBelongsToCollection($record, $this->parent_obj->ref_id)) { return; } ilUtil::deliverFile($file_obj->getFile(), $file_obj->getTitle()); } }
/** * download export file */ public function downloadExportFileObject() { if (!isset($_POST["file"])) { ilUtil::sendFailure($this->lng->txt("no_checkbox"), true); $this->ctrl->redirect($this, "export"); } if (count($_POST["file"]) > 1) { ilUtil::sendFailure($this->lng->txt("select_max_one_item"), true); $this->ctrl->redirect($this, "export"); } $file = basename($_POST["file"][0]); $export_dir = $this->object->getExportDirectory(); include_once "./Services/Utilities/classes/class.ilUtil.php"; ilUtil::deliverFile($export_dir . "/" . $file, $file); }
public function downloadGlobalFeedbackFileObject() { global $ilCtrl, $ilUser; $needs_dl = $this->ass->getFeedbackDate() == ilExAssignment::FEEDBACK_DATE_DEADLINE; if (!$this->ass || !$this->ass->getFeedbackFile() || $needs_dl && !$this->ass->getDeadline() || $needs_dl && $this->ass->getDeadline() > time() || !$needs_dl && !ilExAssignment::getLastSubmission($this->ass->getId(), $ilUser->getId())) { $ilCtrl->redirect($this, "showOverview"); } ilUtil::deliverFile($this->ass->getFeedbackFilePath(), $this->ass->getFeedbackFile()); }
function downloadExportFile($file) { $this->__initFileObject(); if ($abs_name = $this->file_obj->getExportFile($file)) { ilUtil::deliverFile($abs_name, $file); // Not reached } return false; }