24 include_once(
'Modules/Course/classes/class.ilFSStorageCourse.php');
66 $this->file_id = $a_file_id;
79 public static function _cloneFiles($a_source_id, $a_target_id)
85 $new_file->setCourseId($a_target_id);
86 $new_file->setFileName($file_obj->getFileName());
87 $new_file->setFileSize($file_obj->getFileSize());
88 $new_file->setFileType($file_obj->getFileType());
89 $new_file->create(
false);
93 $source->copyFile($file_obj->getAbsolutePath(), $new_file->fss_storage->getInfoDirectory() .
'/' . $new_file->getFileId());
99 $this->file_id = $a_id;
112 $this->course_id = $a_course_id;
117 $this->file_name = $a_name;
121 return $this->file_name;
129 return $this->file_type;
133 $this->file_size = $a_size;
137 return $this->file_size;
141 $this->tmp_name = $a_name;
145 return $this->tmp_name;
149 $this->error_code = $a_code;
153 return $this->error_code;
166 $file = $this->fss_storage->getInfoDirectory() .
'/' . $this->
getFileId();
167 if (!file_exists($file)) {
168 $file = $this->fss_storage->getInfoDirectory() .
'/' . $this->
getFileId() .
'.sec';
170 if (file_exists($file)) {
178 if (is_object($this->fss_storage)) {
179 return $this->fss_storage->getInfoDirectory();
186 case UPLOAD_ERR_INI_SIZE:
187 $this->ilErr->appendMessage($this->lng->txt(
'file_upload_ini_size'));
189 case UPLOAD_ERR_FORM_SIZE:
190 $this->ilErr->appendMessage($this->lng->txt(
'file_upload_form_size'));
193 case UPLOAD_ERR_PARTIAL:
194 $this->ilErr->appendMessage($this->lng->txt(
'file_upload_only_partial'));
197 case UPLOAD_ERR_NO_TMP_DIR:
198 $this->ilErr->appendMessage($this->lng->txt(
'file_upload_no_tmp_dir'));
202 #case UPLOAD_ERR_CANT_WRITE: 203 # $this->ilErr->appendMessage($this->lng->txt('file_upload_no_write')); 207 case UPLOAD_ERR_NO_FILE:
217 $ilDB = $DIC[
'ilDB'];
223 $next_id =
$ilDB->nextId(
'crs_file');
224 $query =
"INSERT INTO crs_file (file_id,course_id,file_name,file_size,file_type) " .
226 $ilDB->quote($next_id,
'integer') .
", " .
236 $this->fss_storage->initInfoDirectory();
240 ilUtil::moveUploadedFile(
243 $this->fss_storage->getInfoDirectory() .
'/' . $this->
getFileId()
249 public function delete()
253 $ilDB = $DIC[
'ilDB'];
256 $query =
"DELETE FROM crs_file " .
257 "WHERE file_id = " .
$ilDB->quote($this->
getFileId(),
'integer') .
"";
272 $ilDB = $DIC[
'ilDB'];
275 $query =
"DELETE FROM crs_file " .
276 "WHERE course_id = " .
$ilDB->quote($a_course_id,
'integer') .
"";
291 $ilDB = $DIC[
'ilDB'];
293 $query =
"SELECT * FROM crs_file " .
294 "WHERE course_id = " .
$ilDB->quote($a_course_id,
'integer') .
"";
307 $ilDB = $DIC[
'ilDB'];
309 if (!$this->file_id) {
314 $query =
"SELECT * FROM crs_file WHERE file_id = " .
$ilDB->quote($this->file_id,
'integer');
setTemporaryName($a_name)
__construct($a_file_id=null)
Constructor.
foreach($_POST as $key=> $value) $res
static _readFilesByCourse($a_course_id)
setCourseId($a_course_id)
static _deleteByCourse($a_course_id)
static _cloneFiles($a_source_id, $a_target_id)
Clone course files.