24 include_once(
'Modules/Course/classes/class.ilFSStorageCourse.php');
62 $this->file_id = $a_file_id;
75 public static function _cloneFiles($a_source_id, $a_target_id)
81 $new_file->setCourseId($a_target_id);
82 $new_file->setFileName($file_obj->getFileName());
83 $new_file->setFileSize($file_obj->getFileSize());
84 $new_file->setFileType($file_obj->getFileType());
85 $new_file->create(
false);
89 $source->copyFile($file_obj->getAbsolutePath(), $new_file->getAbsolutePath());
95 $this->file_id = $a_id;
108 $this->course_id = $a_course_id;
113 $this->file_name = $a_name;
117 return $this->file_name;
125 return $this->file_type;
129 $this->file_size = $a_size;
133 return $this->file_size;
137 $this->tmp_name = $a_name;
141 return $this->tmp_name;
145 $this->error_code = $a_code;
149 return $this->error_code;
162 $file = $this->fss_storage->getInfoDirectory() .
'/' . $this->
getFileId();
163 if (!file_exists(
$file)) {
164 $file = $this->fss_storage->getInfoDirectory() .
'/' . $this->
getFileId() .
'.sec';
166 if (file_exists(
$file)) {
174 if (is_object($this->fss_storage)) {
175 return $this->fss_storage->getInfoDirectory();
182 case UPLOAD_ERR_INI_SIZE:
183 $this->ilErr->appendMessage($this->lng->txt(
'file_upload_ini_size'));
185 case UPLOAD_ERR_FORM_SIZE:
186 $this->ilErr->appendMessage($this->lng->txt(
'file_upload_form_size'));
189 case UPLOAD_ERR_PARTIAL:
190 $this->ilErr->appendMessage($this->lng->txt(
'file_upload_only_partial'));
193 case UPLOAD_ERR_NO_TMP_DIR:
194 $this->ilErr->appendMessage($this->lng->txt(
'file_upload_no_tmp_dir'));
198 #case UPLOAD_ERR_CANT_WRITE: 199 # $this->ilErr->appendMessage($this->lng->txt('file_upload_no_write')); 203 case UPLOAD_ERR_NO_FILE:
217 $next_id = $ilDB->nextId(
'crs_file');
218 $query =
"INSERT INTO crs_file (file_id,course_id,file_name,file_size,file_type) " .
220 $ilDB->quote($next_id,
'integer') .
", " .
221 $ilDB->quote($this->
getCourseId(),
'integer') .
", " .
222 $ilDB->quote($this->
getFileName(),
'text') .
", " .
223 $ilDB->quote($this->
getFileSize(),
'integer') .
", " .
230 $this->fss_storage->initInfoDirectory();
234 ilUtil::moveUploadedFile(
237 $this->fss_storage->getInfoDirectory() .
'/' . $this->
getFileId()
243 public function delete()
248 $query =
"DELETE FROM crs_file " .
249 "WHERE file_id = " . $ilDB->quote($this->
getFileId(),
'integer') .
"";
265 $query =
"DELETE FROM crs_file " .
266 "WHERE course_id = " . $ilDB->quote($a_course_id,
'integer') .
"";
281 $query =
"SELECT * FROM crs_file " .
282 "WHERE course_id = " . $ilDB->quote($a_course_id,
'integer') .
"";
285 while (
$row = $ilDB->fetchObject(
$res)) {
295 if (!$this->file_id) {
300 $query =
"SELECT * FROM crs_file WHERE file_id = " . $ilDB->quote($this->file_id,
'integer');
302 while (
$row = $ilDB->fetchObject(
$res)) {
setTemporaryName($a_name)
__construct($a_file_id=null)
Constructor.
foreach($_POST as $key=> $value) $res
static _readFilesByCourse($a_course_id)
Create styles array
The data for the language used.
setCourseId($a_course_id)
static _deleteByCourse($a_course_id)
if(!file_exists("$old.txt")) if($old===$new) if(file_exists("$new.txt")) $file
static _cloneFiles($a_source_id, $a_target_id)
Clone course files.