50 $this->file = $file_version_gui->
getFile();
51 $this->upload = $DIC->upload();
52 $this->calling_gui = $file_version_gui;
53 $this->lng = $DIC->language();
54 $this->save_mode =
$mode;
55 parent::__construct();
58 $this->
setFormAction($DIC->ctrl()->getFormAction($file_version_gui));
65 $this->lng->loadLanguageModule(
'file');
66 switch ($this->save_mode) {
67 case self::MODE_REPLACE:
69 $this->
setTitle($this->lng->txt(
'replace_file'));
74 $this->
setTitle($this->lng->txt(
'file_new_version'));
82 $title->
setInfo($this->lng->txt(
"if_no_title_then_filename"));
98 $this->lng->txt(self::F_FILE),
101 $file->setRequired(
true);
103 $file->setMaxFiles(1);
107 $in_file =
new ilFileInputGUI($this->lng->txt(self::F_FILE), self::F_FILE);
119 public function saveObject()
124 if (!$this->upload->hasUploads()) {
133 $file_temp_name =
$file[
'tmp_name'];
135 $this->upload->process();
140 $result = $this->upload->getResults()[$file_temp_name];
141 if (
$result->getStatus() === ProcessingStatus::REJECTED) {
146 $file_name = $this->file->getFileName();
147 if (strlen(trim($input_title)) == 0) {
148 $input_title = $file_name;
150 $input_title = $this->file->checkFileExtension($file_name, $input_title);
154 switch ($this->save_mode) {
156 $this->file->addFileVersion($file_temp_name,
$result->getName());
158 case self::MODE_REPLACE:
159 $this->file->deleteVersions();
160 $this->file->clearDataDirectory();
161 $this->file->replaceFile($file_temp_name,
$result->getName());
165 $this->file->setFileType(
$result->getMimeType());
166 $this->file->setFileSize(
$result->getSize());
167 $this->file->setFilename(
$result->getName());
168 $this->file->setTitle($input_title);
169 $this->file->setDescription($this->
getInput((
string) self::F_DESCRIPTION));
170 $this->file->update();
179 $values[self::F_TITLE] = $this->file->getTitle();
180 $values[self::F_DESCRIPTION] = $this->file->getDescription();
const TITLE_LENGTH
max length of object title
static sendInfo($a_info="", $a_keep=false)
Send Info Message to Screen.
This class represents a text property in a property form.
static stripSlashes($a_str, $a_strip_html=true, $a_allow="")
strip slashes if magic qoutes is enabled
This class represents a text area property in a property form.
Class ilCountPDFPagesPreProcessors.
const CMD_CREATE_REPLACING_VERSION
const CMD_CREATE_NEW_VERSION