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;
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 $query =
"INSERT INTO crs_file ".
196 "SET course_id = ".$ilDB->quote($this->
getCourseId()).
", ".
197 "file_name = ".$ilDB->quote($this->
getFileName()).
", ".
198 "file_size = ".$ilDB->quote($this->
getFileSize()).
", ".
199 "file_type = ".$ilDB->quote($this->
getFileType()).
" ";
201 $res = $this->db->query($query);
202 $this->
setFileId($this->db->getLastInsertId());
205 $this->fss_storage->initInfoDirectory();
212 $this->fss_storage->getInfoDirectory().
'/'.$this->
getFileId());
223 $query =
"DELETE FROM crs_file ".
224 "WHERE file_id = ".$ilDB->quote($this->
getFileId()).
"";
225 $this->db->query($query);
238 $query =
"DELETE FROM crs_file ".
239 "WHERE course_id = ".$ilDB->quote($a_course_id).
"";
240 $res = $ilDB->query($query);
249 $query =
"SELECT * FROM crs_file ".
250 "WHERE course_id = ".$ilDB->quote($a_course_id).
"";
252 $res = $ilDB->query($query);
268 $query =
"SELECT * FROM crs_file WHERE file_id = '".$this->file_id.
"'";
269 $res = $this->db->query($query);