24 include_once(
'Modules/Course/classes/class.ilFSStorageCourse.php');
55 $this->file_id = $a_file_id;
75 $new_file->setCourseId($a_target_id);
76 $new_file->setFileName($file_obj->getFileName());
77 $new_file->setFileSize($file_obj->getFileSize());
78 $new_file->setFileType($file_obj->getFileType());
79 $new_file->create(
false);
82 $target->initInfoDirectory();
83 $source->copyFile($file_obj->getAbsolutePath(),$new_file->getAbsolutePath());
89 $this->file_id = $a_id;
102 $this->course_id = $a_course_id;
107 $this->file_name = $a_name;
111 return $this->file_name;
115 $this->file_type = $a_type;
119 return $this->file_type;
123 $this->file_size = $a_size;
127 return $this->file_size;
131 $this->tmp_name = $a_name;
135 return $this->tmp_name;
139 $this->error_code = $a_code;
143 return $this->error_code;
148 if(is_object($this->fss_storage))
150 return $this->fss_storage->getInfoDirectory().
'/'.$this->
getFileId();
159 case UPLOAD_ERR_INI_SIZE:
160 $this->ilErr->appendMessage($this->lng->txt(
'file_upload_ini_size'));
162 case UPLOAD_ERR_FORM_SIZE:
163 $this->ilErr->appendMessage($this->lng->txt(
'file_upload_form_size'));
166 case UPLOAD_ERR_PARTIAL:
167 $this->ilErr->appendMessage($this->lng->txt(
'file_upload_only_partial'));
170 case UPLOAD_ERR_NO_TMP_DIR:
171 $this->ilErr->appendMessage($this->lng->txt(
'file_upload_no_tmp_dir'));
175 #case UPLOAD_ERR_CANT_WRITE:
176 # $this->ilErr->appendMessage($this->lng->txt('file_upload_no_write'));
180 case UPLOAD_ERR_NO_FILE:
195 $next_id = $ilDB->nextId(
'crs_file');
196 $query =
"INSERT INTO crs_file (file_id,course_id,file_name,file_size,file_type) ".
198 $ilDB->quote($next_id,
'integer').
", ".
208 $this->fss_storage->initInfoDirectory();
215 $this->fss_storage->getInfoDirectory().
'/'.$this->
getFileId());
226 $query =
"DELETE FROM crs_file ".
227 "WHERE file_id = ".$ilDB->quote($this->
getFileId(),
'integer').
"";
241 $query =
"DELETE FROM crs_file ".
242 "WHERE course_id = ".$ilDB->quote($a_course_id,
'integer').
"";
252 $query =
"SELECT * FROM crs_file ".
253 "WHERE course_id = ".$ilDB->quote($a_course_id,
'integer').
"";
256 while(
$row = $ilDB->fetchObject(
$res))
260 return is_array($files) ? $files : array();
273 $query =
"SELECT * FROM crs_file WHERE file_id = ".$ilDB->quote($this->file_id,
'integer');
275 while(
$row = $ilDB->fetchObject(
$res))