32 require_once(
"./Services/FileSystem/classes/class.ilFileData.php");
54 define(
'COURSE_PATH',
'course');
55 parent::__construct();
56 $this->course_path = parent::getPath() .
"/" . COURSE_PATH;
57 $this->course_id = $a_course_id;
69 if (@file_exists($this->course_path .
'/' . $a_rel_name .
'.zip')) {
70 return $this->course_path .
'/' . $a_rel_name .
'.zip';
72 if (@file_exists($this->course_path .
'/' . $a_rel_name .
'.pdf')) {
73 return $this->course_path .
'/' . $a_rel_name .
'.pdf';
87 $dp = opendir($this->course_path);
89 while ($file = readdir($dp)) {
94 if (preg_match(
"/^([0-9]{10})_[a-zA-Z]*_export_([a-z]+)_([0-9]+)\.[a-z]+$/", $file, $matches)
and $matches[3] == $this->course_id) {
95 $timest = $matches[1];
96 $file_info[
'name'] = $matches[0];
97 $file_info[
'timest'] = $matches[1];
98 $file_info[
'type'] = $matches[2];
99 $file_info[
'id'] = $matches[3];
100 $file_info[
'size'] = filesize($this->course_path .
'/' . $file);
102 $files[$timest] = $file_info;
111 $file_name = $this->course_path .
'/' . $a_name;
112 if (@file_exists($file_name)) {
119 $file_name = $this->course_path .
'/' . $a_name;
120 if (@file_exists($file_name)) {
121 return file_get_contents($file_name);
128 $this->
deleteZipFile($this->course_path .
'/' . $a_rel_name .
'.zip');
131 $this->
deletePdf($this->course_path .
'/' . $a_rel_name .
'.pdf');
137 if (@file_exists($a_abs_name)) {
138 @unlink($a_abs_name);
146 if (file_exists($a_abs_name)) {
155 if (@file_exists($a_abs_name)) {
156 @unlink($a_abs_name);
163 public function copy($a_from, $a_to)
165 if (@file_exists($a_from)) {
173 public function rCopy($a_from, $a_to)
191 die(
"Cannot open file: " . $this->
getCoursePath() .
'/' . $a_rel_name);
193 @fwrite($fp, $a_data);
198 public function zipFile($a_rel_name, $a_zip_name)
236 ilUtil::moveUploadedFile(
239 $this->
getCoursePath() .
'/import/crs_' . $this->course_id .
'/' . $a_name
241 $this->import_file_info = pathinfo($this->
getCoursePath() .
'/import/crs_' . $this->course_id .
'/' . $a_name);
251 if (!is_dir($this->
getCoursePath() .
'/import/crs_' . $this->course_id) .
'/' .
252 basename($this->import_file_info[
'basename'],
'.zip')) {
255 if (!file_exists($this->
getCoursePath() .
'/import/crs_' . $this->course_id
256 .
'/' . basename($this->import_file_info[
'basename'],
'.zip')
257 .
'/' . basename($this->import_file_info[
'basename'],
'.zip') .
'.xml')) {
264 return $this->
getCoursePath() .
'/import/crs_' . $this->course_id
265 .
'/' . basename($this->import_file_info[
'basename'],
'.zip')
266 .
'/' . basename($this->import_file_info[
'basename'],
'.zip') .
'.xml';
278 if (!@file_exists(CLIENT_WEB_DIR .
'/courses')) {
295 $this->
ilias->raiseError(
"Course import path is not readable/writable by webserver", $this->
ilias->error_obj->FATAL);
307 if (is_writable($this->course_path) && is_readable($this->course_path)) {
310 $this->
ilias->raiseError(
"Course directory is not readable/writable by webserver", $this->
ilias->error_obj->FATAL);
321 if (is_writable($this->
getPath())) {
323 $this->course_path = $this->
getPath() .
'/' . COURSE_PATH;
getOnlineLink($a_rel_name)
getMemberExportFiles()
Get all member export files.
This class handles all operations of archive files for the course object.
static rCopy($a_sdir, $a_tdir, $preserveTimeAttributes=false)
Copies content of a directory $a_sdir recursively to a directory $a_tdir.
static unzip($a_file, $overwrite=false, $a_flat=false)
unzip file
getArchiveFile($a_rel_name)
createOnlineVersion($a_rel_name)
createImportFile($a_tmp_name, $a_name)
zipFile($a_rel_name, $a_zip_name)
getMemberExportFile($a_name)
This class handles all operations on files in directory /ilias_data/.
__construct($a_course_id)
Constructor call base constructors checks if directory is writable and sets the optional obj_id...
redirection script todo: (a better solution should control the processing via a xml file) ...
static zip($a_dir, $a_file, $compress_content=false)
zips given directory/file into given zip.file
static makeDir($a_dir)
creates a new directory and inherits all filesystem permissions of the parent directory You may pass ...
__initDirectory()
init directory overwritten method public
deleteZipFile($a_abs_name)
writeToFile($a_data, $a_rel_name)
__checkReadWrite()
check if directory is writable overwritten method from base class private
deleteMemberExportFile($a_name)
getCoursePath()
get exercise path public
deleteArchive($a_rel_name)
deleteDirectory($a_abs_name)
static delDir($a_dir, $a_clean_only=false)
removes a dir and all its content (subdirs and files) recursively
static getWebspaceDir($mode="filesystem")
get webspace directory
addDirectory($a_rel_name)