4 require_once(
"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                         if (array_key_exists($directory, $cache))
 
  262                                 if (array_key_exists($directory, $cache)) {
 
  264                                         $directory .= 
"_".$id;
 
  268                         $cache[$directory] = $directory;
 
  270                         $sourcefiles = scandir($sourcedir);
 
  271                         foreach ($sourcefiles as $sourcefile) {
 
  272                                 if ($sourcefile == 
"." || $sourcefile == 
"..")
 
  274                                 $targetfile = trim(basename($sourcefile));
 
  275                                 $pos = strpos($targetfile, 
"_");
 
  280                                         $targetfile= substr($targetfile, $pos + 1);
 
  282                                 $targetfile = $directory.DIRECTORY_SEPARATOR.$targetfile;
 
  283                                 $sourcefile = $sourcedir.DIRECTORY_SEPARATOR.$sourcefile;
 
  285                                 if (!copy ($sourcefile, $targetfile))
 
  288                                         $this->ilias->raiseError(
'Could not copy '.basename($sourcefile).
" to '".$targetfile.
"'.",
 
  289                                                 $this->ilias->error_obj->MESSAGE);
 
  294                                         touch($targetfile, filectime($sourcefile));
 
  301                 $tmpzipfile = $tmpfile . 
".zip";
 
  307                 $exerciseTitle = $ilObjDataCache->lookupTitle($this->
getObjId());
 
  308                 ilUtil::deliverFile($tmpzipfile, (strlen($exerciseTitle) == 0? strtolower($lng->txt(
"excs")) : $exerciseTitle). 
".zip");
 
  323                 if(is_array($a_filenames))
 
  325                         foreach($a_filenames as 
$file)
 
  343                 if(file_exists($this->exercise_path.
'/'.$this->obj_id.
'_'.$a_filename))
 
  345                         return unlink($this->exercise_path.
'/'.$this->obj_id.
'_'.$a_filename);
 
  356                 return $this->exercise_path.
'/'.$this->obj_id.
'_'.$a_path;
 
  369                         foreach($a_files as 
$file)
 
  371                                 if(!file_exists($this->exercise_path.
'/'.$this->obj_id.
'_'.$file))
 
  400                 if(is_writable($this->exercise_path) && is_readable($this->exercise_path))
 
  406                         $this->ilias->raiseError(
"Exercise directory is not readable/writable by webserver",$this->ilias->error_obj->FATAL);
 
  417                 if(is_writable($this->
getPath()))
 
  432                 if(file_exists($a_path))
 
  435                         return rename($a_path,$a_path.
'.old');