29 protected ?
bool $no_meta_data_creation = null;
34 $check_existing = $DIC->database()->queryF(
35 'SELECT file_id FROM file_data WHERE file_id = %s',
39 if ($check_existing->numRows() === 0) {
40 $DIC->database()->insert(
'file_data', $this->getArrayForDatabase());
42 $DIC->database()->update(
44 $this->getArrayForDatabase(),
45 [
'file_id' => [
'integer', $this->
getId()]]
62 if (isset($this->ref_id)) {
64 if ($default_visibility ===
"public") {
71 if ($this->getMode() !== self::MODE_FILELIST) {
72 $this->createMetaData();
78 $this->no_meta_data_creation = $a_status;
83 return !(bool) $this->no_meta_data_creation;
88 return !(bool) $this->no_meta_data_creation;
99 $manipulator = $DIC->learningObjectMetadata()
100 ->manipulate($this->
getId(), 0, $this->getType())
101 ->prepareCreateOrUpdate($this->
getPathToSize(), (
string) $this->getFileSize())
102 ->prepareCreateOrUpdate($this->
getPathToVersion(), (
string) $this->getVersion());
103 if ($this->getFileType() !==
'') {
104 $manipulator = $manipulator->prepareCreateOrUpdate($this->
getPathToFirstFormat(), $this->getFileType());
106 $manipulator->execute();
115 if ($a_element !==
'General') {
119 $paths = $DIC->learningObjectMetadata()->paths();
121 $title = $DIC->learningObjectMetadata()->read(
126 )->firstData($paths->title())->value();
128 $title = $this->appendSuffixToTitle($title, $this->getFileName());
130 $DIC->learningObjectMetadata()->manipulate($this->
getId(), 0, $this->getType())
131 ->prepareCreateOrUpdate($paths->title(), $title)
142 if ($a_element !==
'Technical') {
146 $first_format = $DIC->learningObjectMetadata()->read(
153 $this->setFileType($first_format);
163 $manipulator = $DIC->learningObjectMetadata()
164 ->manipulate($this->
getId(), 0, $this->getType())
165 ->prepareCreateOrUpdate($this->
getPathToSize(), (
string) $this->getFileSize())
166 ->prepareCreateOrUpdate($this->
getPathToVersion(), (
string) $this->getVersion());
167 if ($this->getFileType() !==
'') {
168 $manipulator = $manipulator->prepareCreateOrUpdate($this->
getPathToFirstFormat(), $this->getFileType());
170 $manipulator->execute();
180 $lom_services = $DIC->learningObjectMetadata();
182 $copyright_id = $this->getCopyrightID();
183 if (!$lom_services->copyrightHelper()->isCopyrightSelectionActive() || $copyright_id === null) {
187 $lom_services->copyrightHelper()->prepareCreateOrUpdateOfCopyrightFromPreset(
188 $lom_services->manipulate($this->getId(), 0, $this->getType()),
197 return $DIC->learningObjectMetadata()
200 ->withNextStep(
'technical')
201 ->withNextStep(
'size')
209 return $DIC->learningObjectMetadata()
212 ->withNextStep(
'technical')
213 ->withNextStep(
'format')
214 ->withAdditionalFilterAtCurrentStep(FilterType::INDEX,
'0')
222 return $DIC->learningObjectMetadata()
225 ->withNextStep(
'lifeCycle')
226 ->withNextStep(
'version')
227 ->withNextStep(
'string')
static _getDefaultVisibilityForRefId(int $a_ref_id)
Get default visibility for reference id.
static _write(string $a_type, string $a_setting, string $a_value, int $a_user=0, int $a_block_id=0)
Write setting to database.