45 if ($with_cleared_cache) {
48 $this->irss = $DIC->resourceStorage();
49 $this->db = $DIC->database();
63 return array_map(
'strtolower', explode(
' ', (
string)
$settings->get(
'inline_file_extensions',
'')));
66 public function preloadData(array $ids,
bool $are_ref_ids =
false): void
69 $query =
"SELECT title, rid, file_id, page_count, on_click_mode 71 JOIN object_data ON object_data.obj_id = file_data.file_id 72 JOIN object_reference ON object_reference.obj_id = object_data.obj_id 73 WHERE rid IS NOT NULL AND " . $this->db->in(
80 $query =
"SELECT title, rid, file_id, page_count, on_click_mode FROM file_data JOIN object_data ON object_data.obj_id = file_data.file_id WHERE rid IS NOT NULL AND " . $this->db->in(
88 $res = $this->db->query(
96 while ($row = $this->db->fetchObject(
$res)) {
97 $rids[(
int) $row->file_id] = $row->rid;
98 $page_counts[(
int) $row->file_id] = $row->page_count;
99 $object_titles[(
int) $row->file_id] = $row->title;
102 $this->irss->preload($rids);
104 foreach ($rids as $file_id => $rid) {
105 if ((
$id = $this->irss->manage()->find($rid)) !== null) {
106 $max = $this->irss->manage()->getResource(
$id)->getCurrentRevision();
109 $object_titles[$file_id] ?? $max->getTitle(),
111 $max->getInformation()->getTitle(),
112 $max->getInformation()->getSuffix(),
113 in_array(strtolower($max->getInformation()->getSuffix()), $this->inline_suffixes,
true),
115 $max->getVersionNumber(),
116 $max->getInformation()->getCreationDate(),
117 in_array(strtolower($max->getInformation()->getMimeType()), [
118 MimeType::APPLICATION__ZIP,
119 MimeType::APPLICATION__X_ZIP_COMPRESSED
121 $max->getInformation()->getMimeType(),
122 new DataSize($max->getInformation()->getSize() ?? 0, DataSize::Byte),
123 $page_counts[$file_id] === null ? null : (
int) $page_counts[$file_id]
126 self::$cache[$file_id] = $info;
133 if (isset(self::$cache[$object_id])) {
134 return self::$cache[$object_id];
This class provides the data size with additional information to remove the work to calculate the siz...
getByObjectId(int $object_id)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
const CLICK_MODE_DOWNLOAD
static _lookupObjectId(int $ref_id)
preloadData(array $ids, bool $are_ref_ids=false)
__construct(bool $with_cleared_cache=false)
$id
plugin.php for ilComponentBuildPluginInfoObjectiveTest::testAddPlugins