22 private \ILIAS\FileUpload\FileUpload
$upload;
28 $this->
upload = $DIC->upload();
29 $this->main_tpl = $DIC->ui()->mainTemplate();
47 $has_record_id = $this->
http->wrapper()->query()->has(
'record_id');
48 $is_confirmed = $this->
http->wrapper()->post()->has(
'save_confirmed');
49 $has_save_confirmation = ($this->
getRecord()->getTable()->getSaveConfirmation() && !$has_record_id);
52 && isset($media[
'tmp_name'])
53 && $media[
'tmp_name'] !==
"" 54 && (!$has_save_confirmation || $is_confirmed)
57 $mob->setTitle($media[
'name']);
60 if (!is_dir($mob_dir)) {
61 $mob->createDirectory();
64 $mob->addMediaItem($media_item);
65 $media_item->setPurpose(
"Standard");
67 $file_name = str_replace(
" ",
"_", $file_name);
68 $target_file_path = $mob_dir .
"/" . $file_name;
72 if ($has_save_confirmation) {
73 $ilfilehash = $this->
http->wrapper()->post()->retrieve(
75 $this->
refinery->kindlyTo()->string()
85 if (
false === $this->
upload->hasBeenProcessed()) {
89 if (
false === $this->
upload->hasUploads()) {
90 throw new ilException($this->
lng->txt(
'upload_error_file_not_found'));
92 $move_file = $media[
'tmp_name'];
102 list($width, $height,
$type, $attr) = getimagesize($target_file_path);
106 if ($new_width || $new_height) {
108 if ($new_height < $height && $new_width < $width) {
110 if (!$new_height || !$new_width) {
136 $this->
getRecord()->getTable()->getCollectionObject()->getId()
138 $media_item->setFormat(
$format);
140 $media_item->setLocationType(
"LocalFile");
143 $med = $mob->getMediaItem(
"Standard");
149 $this->main_tpl->setOnScreenMessage(
'failure', $e->getMessage(),
true);
154 $return = $mob->getId();
157 if (is_array($media) && isset($media[
'tmp_name']) && $media[
'tmp_name'] !=
'') {
175 if (is_numeric($file)) {
177 $mob_name = $mob->getTitle();
202 return $mob->getTitle();
208 if ($form->
getItemByPostVar(
"field_" . $this->getField()->getId())->getDeletionFlag()) {
220 if (!$record_field || !$record_field->getValue()) {
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
setValue($value, bool $omit_parsing=false)
Set value for record field.
$location
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
addHiddenItem(string $a_post_var, string $a_value)
static extractImage(string $a_file, string $a_target_filename, string $a_target_dir="", int $a_sec=1)
Extract image from video file.
parseExportValue($value)
Function to parse incoming data from form input value $value.
static getASCIIFilename(string $a_filename)
static renameExecutables(string $a_dir)
static supportsImageExtraction(string $a_mime)
Check if mime type supports image extraction.
static http()
Fetches the global http state from ILIAS.
doUpdate()
Update object in database.
parseSortingValue($value, bool $link=true)
Returns sortable value for the specific field-types.
ILIAS FileUpload FileUpload $upload
ilDclBaseFieldModel $field
ilGlobalTemplateInterface $main_tpl
getProperty(string $key)
Returns a certain property of a field.
__construct(Container $dic, ilPlugin $plugin)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
static getCloneOf(int $id, string $type)
addHiddenItemsToConfirmation(ilConfirmationGUI $confirmation)
static rename(string $a_source, string $a_target)
static getRecordFieldCache(object $record, object $field)
__construct(ilDclBaseRecordModel $record, ilDclBaseFieldModel $field)
static enabled()
Checks, whether FFmpeg support is enabled (path is set in the setup)
ilDclBaseRecordModel $record
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
setValueFromForm(ilPropertyFormGUI $form)