32 require_once(
"./Services/FileSystem/classes/class.ilFileData.php");
54 define(
'COURSE_PATH',
'course');
57 $this->course_id = $a_course_id;
70 if(@file_exists($this->course_path.
'/'.$a_rel_name.
'.zip'))
72 return $this->course_path.
'/'.$a_rel_name.
'.zip';
74 if(@file_exists($this->course_path.
'/'.$a_rel_name.
'.pdf'))
76 return $this->course_path.
'/'.$a_rel_name.
'.pdf';
90 $dp = opendir($this->course_path);
92 while(
$file = readdir($dp))
99 if(preg_match(
"/^([0-9]{10})_[a-zA-Z]*_export_([a-z]+)_([0-9]+)\.[a-z]+$/",
$file,$matches) and $matches[3] == $this->course_id)
101 $timest = $matches[1];
102 $file_info[
'name'] = $matches[0];
103 $file_info[
'timest'] = $matches[1];
104 $file_info[
'type'] = $matches[2];
105 $file_info[
'id'] = $matches[3];
106 $file_info[
'size'] = filesize($this->course_path.
'/'.
$file);
108 $files[$timest] = $file_info;
112 return $files ? $files : array();
117 $file_name = $this->course_path.
'/'.$a_name;
118 if(@file_exists($file_name))
126 $file_name = $this->course_path.
'/'.$a_name;
127 if(@file_exists($file_name))
129 return file_get_contents($file_name);
136 $this->
deleteZipFile($this->course_path.
'/'.$a_rel_name.
'.zip');
139 $this->
deletePdf($this->course_path.
'/'.$a_rel_name.
'.pdf');
145 if(@file_exists($a_abs_name))
147 @unlink($a_abs_name);
155 if(file_exists($a_abs_name))
165 if(@file_exists($a_abs_name))
167 @unlink($a_abs_name);
176 if(@file_exists($a_from))
202 if(!$fp = @fopen($this->
getCoursePath().
'/'.$a_rel_name,
'w+'))
204 die(
"Cannot open file: ".$this->
getCoursePath().
'/'.$a_rel_name);
206 @fwrite($fp,$a_data);
251 $this->
getCoursePath().
'/import/crs_'.$this->course_id.
'/'.$a_name);
252 $this->import_file_info = pathinfo($this->
getCoursePath().
'/import/crs_'.$this->course_id.
'/'.$a_name);
263 if(!is_dir($this->
getCoursePath().
'/import/crs_'.$this->course_id).
'/'.
264 basename($this->import_file_info[
'basename'],
'.zip'))
268 if(!file_exists($this->
getCoursePath().
'/import/crs_'.$this->course_id
269 .
'/'.basename($this->import_file_info[
'basename'],
'.zip')
270 .
'/'.basename($this->import_file_info[
'basename'],
'.zip').
'.xml'))
278 return $this->
getCoursePath().
'/import/crs_'.$this->course_id
279 .
'/'.basename($this->import_file_info[
'basename'],
'.zip')
280 .
'/'.basename($this->import_file_info[
'basename'],
'.zip').
'.xml';
293 if(!@file_exists(CLIENT_WEB_DIR.
'/courses'))
313 $this->ilias->raiseError(
"Course import path is not readable/writable by webserver",$this->ilias->error_obj->FATAL);
325 if(is_writable($this->course_path) && is_readable($this->course_path))
331 $this->ilias->raiseError(
"Course directory is not readable/writable by webserver",$this->ilias->error_obj->FATAL);
342 if(is_writable($this->
getPath()))
345 $this->course_path = $this->
getPath().
'/'.COURSE_PATH;