/** * Download feedback file */ function downloadFeedbackFileObject() { global $rbacsystem, $ilUser; $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"); } $ass = new ilExAssignment((int) $_GET["ass_id"]); if ($ass->getType() == ilExAssignment::TYPE_UPLOAD_TEAM) { $feedback_id = "t" . $ass->getTeamId($ilUser->getId()); } else { $feedback_id = $ilUser->getId(); } // check, whether file belongs to assignment include_once "./Modules/Exercise/classes/class.ilFSStorageExercise.php"; $storage = new ilFSStorageExercise($this->object->getId(), (int) $_GET["ass_id"]); $files = $storage->getFeedbackFiles($feedback_id); $file_exist = false; foreach ($files as $fb_file) { if ($fb_file == urldecode($file)) { $file_exist = true; break; } } if (!$file_exist) { echo "FILE DOES NOT EXIST"; exit; } // check whether assignment as already started $not_started_yet = false; if ($ass->getStartTime() > 0 && time() - $ass->getStartTime() <= 0) { $not_started_yet = true; } // deliver file if (!$not_started_yet) { $p = $storage->getFeedbackFilePath($feedback_id, urldecode($file)); ilUtil::deliverFile($p, urldecode($file)); } return true; }