4 require_once(
"./Services/FileSystem/classes/class.ilFileData.php");
39 die (
"ilFileDataExercise is deprecated.");
40 define(
'EXERCISE_PATH',
'exercise');
49 $this->obj_id = $a_obj_id;
70 $dp = opendir($this->exercise_path);
72 while(
$file = readdir($dp))
81 if(!is_dir($this->exercise_path.
'/'.
$file))
85 'size' => filesize($this->exercise_path.
'/'.
$file),
87 'fullpath' => $this->exercise_path.
'/'.
$file);
100 $this->getExercisePath().
"/".$a_new_obj_id.
'_'.$file[
"name"]);
111 $delivered_file_path = $this->
getExercisePath() .
"/" . $this->obj_id .
"/";
112 if (is_dir($delivered_file_path))
114 include_once
"./Services/Utilities/classes/class.ilUtil.php";
134 if ($secure_filename)
141 if(isset($a_http_post_file) && $a_http_post_file[
'size'])
156 rename($a_http_post_file[
'tmp_name'],
177 if ($secure_filename)
184 if(count($content) > 0 )
193 if (!$vir[0] ||$vir[1] !=
"")
211 require_once
"./Services/Utilities/classes/class.ilUtil.php";
212 global
$lng, $ilObjDataCache;
223 if (!is_dir($savepath))
238 foreach ($members as $id => $object) {
239 $directory = $savepath.DIRECTORY_SEPARATOR.$id;
242 if ($dirsize > disk_free_space($tmpdir)) {
251 foreach ($members as $id => $user)
253 $sourcedir = $savepath.DIRECTORY_SEPARATOR.$id;
254 if (!is_dir($sourcedir))
258 trim($userName[
"firstname"]).
"_".trim($userName[
"login"]).
"_".$userName[
"user_id"]);
269 $cache[$directory] = $directory;
271 $sourcefiles = scandir($sourcedir);
272 foreach ($sourcefiles as $sourcefile) {
273 if ($sourcefile ==
"." || $sourcefile ==
"..")
275 $targetfile = trim(basename($sourcefile));
276 $pos = strpos($targetfile,
"_");
281 $targetfile= substr($targetfile, $pos + 1);
283 $targetfile = $directory.DIRECTORY_SEPARATOR.$targetfile;
284 $sourcefile = $sourcedir.DIRECTORY_SEPARATOR.$sourcefile;
286 if (!copy ($sourcefile, $targetfile))
289 $this->ilias->raiseError(
'Could not copy '.basename($sourcefile).
" to '".$targetfile.
"'.",
290 $this->ilias->error_obj->MESSAGE);
295 touch($targetfile, filectime($sourcefile));
302 $tmpzipfile = $tmpfile .
".zip";
308 $exerciseTitle = $ilObjDataCache->lookupTitle($this->
getObjId());
309 ilUtil::deliverFile($tmpzipfile, (strlen($exerciseTitle) == 0? strtolower($lng->txt(
"excs")) : $exerciseTitle).
".zip");
324 if(is_array($a_filenames))
326 foreach($a_filenames as
$file)
344 if(file_exists($this->exercise_path.
'/'.$this->obj_id.
'_'.$a_filename))
346 return unlink($this->exercise_path.
'/'.$this->obj_id.
'_'.$a_filename);
357 return $this->exercise_path.
'/'.$this->obj_id.
'_'.$a_path;
370 foreach($a_files as
$file)
372 if(!file_exists($this->exercise_path.
'/'.$this->obj_id.
'_'.$file))
401 if(is_writable($this->exercise_path) && is_readable($this->exercise_path))
407 $this->ilias->raiseError(
"Exercise directory is not readable/writable by webserver",$this->ilias->error_obj->FATAL);
418 if(is_writable($this->
getPath()))
433 if(file_exists($a_path))
436 return rename($a_path,$a_path.
'.old');