/** * update file according to filename and version and create history entry * has to be called after (!) file save for new objects, since file storage will be initialised with obj id. * */ public function updateFileContents() { if ($this->setFileContents()) { require_once "./Services/History/classes/class.ilHistory.php"; ilHistory::_createEntry($this->file->getId(), "replace", $this->file->getFilename() . "," . $this->file->getVersion()); $this->file->addNewsNotification("file_updated"); } }
/** * Get material file name and goto url * * @param int $a_wsp_id * @return array caption, url */ function getMaterialInfo($a_wsp_id) { global $ilUser; if (!$this->ws_tree) { include_once "Services/PersonalWorkspace/classes/class.ilWorkspaceTree.php"; include_once "Services/PersonalWorkspace/classes/class.ilWorkspaceAccessHandler.php"; $this->ws_tree = new ilWorkspaceTree($ilUser->getId()); $this->ws_access = new ilWorkspaceAccessHandler($caption); } $obj_id = $this->ws_tree->lookupObjectId($a_wsp_id); $caption = ilObject::_lookupTitle($obj_id); if (!$this->offline_mode) { $url = $this->ws_access->getGotoLink($a_wsp_id, $obj_id); } else { $url = $this->offline_mode . "file_" . $obj_id . "/"; // all possible material types for now switch (ilObject::_lookupType($obj_id)) { case "tstv": include_once "Modules/Test/classes/class.ilObjTestVerification.php"; $obj = new ilObjTestVerification($obj_id, false); $url .= $obj->getOfflineFilename(); break; case "excv": include_once "Modules/Exercise/classes/class.ilObjExerciseVerification.php"; $obj = new ilObjExerciseVerification($obj_id, false); $url .= $obj->getOfflineFilename(); break; case "file": $file = new ilObjFile($obj_id, false); $url .= $file->getFilename(); break; } } return array($caption, $url); }