32 protected \ILIAS\DI\UIServices
$ui;
41 protected \ILIAS\MediaPool\StandardGUIRequest
$request;
56 string $a_folder_par =
"obj_id",
58 bool $a_all_objects =
false,
63 $this->
ctrl = $DIC->ctrl();
64 $this->
lng = $DIC->language();
65 $this->
access = $DIC->access();
66 $this->rbacreview = $DIC->rbac()->review();
67 $this->
user = $DIC->user();
69 $ilCtrl = $DIC->ctrl();
70 $ilAccess = $DIC->access();
71 $lng = $DIC->language();
72 $this->
ui = $DIC->ui();
74 $this->clipboard_manager = $DIC->mediaPool()
79 $this->request = $DIC->mediaPool()
84 if ($a_parent_tpl === null) {
85 $a_parent_tpl = $DIC->ui()->mainTemplate();
87 $this->parent_tpl = $a_parent_tpl;
89 $this->
setId(
"mepall");
90 if (method_exists($a_parent_obj,
"getObject") &&
91 is_object($a_parent_obj->getObject())) {
92 $this->
setId(
"mepall" . $a_parent_obj->getObject()->getId());
95 $this->
setId(
"mepfold");
96 if (method_exists($a_parent_obj,
"getObject") &&
97 is_object($a_parent_obj->getObject())) {
98 $this->
setId(
"mepfold" . $a_parent_obj->getObject()->getId());
104 $this->all_objects = $a_all_objects;
107 $this->media_pool = $a_media_pool;
109 $this->folder_par = $a_folder_par;
112 if ($this->all_objects) {
117 $current_folder = $this->clipboard_manager->getFolder();
120 $requested_folder_id = $this->request->getFolderId($this->folder_par);
121 if ($requested_folder_id > 0) {
122 $this->current_folder = $requested_folder_id;
123 } elseif ($current_folder > 0 && $this->tree->isInTree($current_folder)) {
126 $this->current_folder = $this->tree->getRootId();
128 $this->clipboard_manager->setFolder($this->current_folder);
136 $this->
setRowTemplate(
"tpl.mep_list_row.html",
"Modules/MediaPool");
143 $this->media_pool->getId(),
147 $this->adv_filter_record_gui->parse();
153 $this->media_pool->getId(),
157 $adv_th_record_gui->parse();
158 if ($a_mode === self::IL_MEP_SELECT) {
171 if ($a_mode !== self::IL_MEP_EDIT) {
173 $node = $this->tree->getNodeData($this->current_folder);
175 $lng->
txt(
"mep_choose_from_folder") .
": " . $node[
"title"],
181 $lng->
txt(
"mep_choose_from_mep") .
": " .
190 if ($ilAccess->checkAccess(
"write",
"", $this->media_pool->getRefId()) &&
191 $this->
getMode() === self::IL_MEP_EDIT) {
197 if ($this->
getMode() === self::IL_MEP_SELECT_SINGLE) {
202 if ($this->
getMode() === self::IL_MEP_EDIT &&
203 $ilAccess->checkAccess(
"write",
"", $this->media_pool->getRefId())) {
210 return ($this->all_objects);
220 $this->insert_command = $a_val;
228 public function setTitleFilter(
string $title):
void 232 $tprop->storeProperty(
234 $this->
user->getId(),
246 $input->setValue($title);
247 $input->writeToSession();
252 $html = parent::getHTML();
264 $ti->setMaxLength(64);
267 $ti->readFromSession();
268 $this->
filter[
"title"] = $ti->getValue();
271 $GLOBALS[
'lng']->loadLanguageModule(
'meta');
273 $ke->setMaxLength(64);
276 $ke->readFromSession();
277 $this->
filter[
'keyword'] = $ke->getValue();
281 $ca->setMaxLength(64);
284 $ca->readFromSession();
285 $this->
filter[
'caption'] = $ca->getValue();
291 if ($mset->get(
"mep_activate_pages")) {
292 $options[
"mob"] =
$lng->
txt(
"mep_mob");
293 $options[
"pg"] =
$lng->
txt(
"mep_mpg");
295 $formats = $this->media_pool->getUsedFormats();
296 $options = array_merge($options,
$formats);
298 $si->setOptions($options);
300 $si->readFromSession();
301 $this->
filter[
"format"] = $si->getValue();
306 $this->mode = $a_mode;
316 if (!$this->all_objects) {
317 $fobjs = $this->media_pool->getChilds($this->current_folder,
"fold");
319 foreach ($fobjs as $obj) {
320 $f2objs[$obj[
"title"] .
":" . $obj[
"child"]] = $obj;
325 if ($this->
getMode() === self::IL_MEP_SELECT) {
326 $mobjs = $this->media_pool->getChilds($this->current_folder,
"mob");
327 } elseif ($this->
getMode() === self::IL_MEP_SELECT_CONTENT) {
328 $mobjs = $this->media_pool->getChilds($this->current_folder,
"pg");
330 $mobjs = $this->media_pool->getChildsExceptFolders($this->current_folder);
333 foreach ($mobjs as $obj) {
334 $m2objs[$obj[
"title"] .
":" . $obj[
"child"]] = $obj;
339 $objs = array_merge($f2objs, $m2objs);
341 $objs = $this->pool_repo->getItems(
342 $this->media_pool->getId(),
345 $this->filter[
'keyword'],
346 $this->filter[
'caption']
352 $mobs = array_filter($objs,
function ($m) {
353 return ($m[
"type"] ===
"mob");
357 $this->media_pool->getRefId(),
365 $this->adv_filter_record_gui->getFilterElements()
368 $snippets = array_filter($objs,
function ($m) {
369 return ($m[
"type"] ===
"pg");
373 $this->media_pool->getRefId(),
376 [$this->media_pool->getId()],
381 $this->adv_filter_record_gui->getFilterElements()
384 $objs = array_merge($mobs, $snippets);
393 if ($this->
getMode() === self::IL_MEP_SELECT ||
394 $this->
getMode() === self::IL_MEP_SELECT_CONTENT) {
400 protected function fillRow(array $a_set): void
407 $this->tpl->setCurrentBlock(
"link");
414 $this->media_pool->getId(),
418 $adv_cell_record_gui->setRowData($a_set);
419 $this->tpl->setVariable(
"ADV_CELLS", $adv_cell_record_gui->parse());
423 switch ($a_set[
"type"]) {
425 $this->tpl->setVariable(
"TXT_TITLE", htmlentities($a_set[
"title"]));
426 $ilCtrl->setParameter($this->parent_obj, $this->folder_par, $a_set[
"obj_id"]);
427 $ilCtrl->setParameter($this->parent_obj,
"id", $a_set[
"obj_id"]);
428 $this->tpl->setVariable(
430 $ilCtrl->getLinkTarget($this->parent_obj, $this->parent_cmd)
432 $this->tpl->parseCurrentBlock();
434 if ($ilAccess->checkAccess(
"write",
"", $this->media_pool->getRefId()) &&
435 $this->
getMode() === self::IL_MEP_EDIT) {
436 $actions[
$lng->
txt(
"edit")] = $ilCtrl->getLinkTarget($this->parent_obj,
"editFolder");
437 $ilCtrl->setParameterByClass(
"ilobjmediapoolgui",
"mepitem_id", $this->request->getItemId());
438 $actions[
$lng->
txt(
"move")] = $ilCtrl->getLinkTarget($this->parent_obj,
"move");
439 $actions[
$lng->
txt(
"remove")] = $ilCtrl->getLinkTarget($this->parent_obj,
"confirmRemove");
440 $ilCtrl->setParameter($this->parent_obj, $this->folder_par, $a_set[
"obj_id"]);
441 $ilCtrl->setParameter(
444 $this->request->getFolderId($this->folder_par)
446 $this->tpl->parseCurrentBlock();
449 $this->tpl->setCurrentBlock(
"tbl_content");
451 $ilCtrl->setParameter($this->parent_obj, $this->folder_par, $this->current_folder);
455 if ($this->
getMode() === self::IL_MEP_SELECT ||
456 $this->
getMode() === self::IL_MEP_SELECT_SINGLE) {
457 $this->tpl->setVariable(
"TXT_NO_LINK_TITLE", htmlentities($a_set[
"title"]));
459 $this->tpl->setVariable(
"ONCLICK",
"il.MediaPool.preview('" . $a_set[
"child"] .
"'); return false;");
460 $this->tpl->setVariable(
"TXT_TITLE", htmlentities($a_set[
"title"]));
461 $ilCtrl->setParameterByClass(
"ilobjmediapoolgui",
"mepitem_id", $a_set[
"child"]);
464 if ($this->
getMode() === self::IL_MEP_EDIT &&
465 $ilAccess->checkAccess(
"write",
"", $this->media_pool->getRefId())) {
466 $ilCtrl->setParameterByClass(
"ilmediapoolpagegui",
"mepitem_id", $a_set[
"child"]);
467 $ilCtrl->setParameterByClass(
"ilobjmediapoolgui",
"id", $a_set[
"child"]);
469 $actions[
$lng->
txt(
"edit")] = $ilCtrl->getLinkTargetByClass(
"ilmediapoolpagegui",
"edit");
476 $mdtab = $mdgui->getTab(
"ilmediapoolpagegui");
478 $actions[
$lng->
txt(
"meta_data")] = $mdtab;
481 $actions[
$lng->
txt(
"cont_usage")] = $ilCtrl->getLinkTargetByClass(
"ilmediapoolpagegui",
"showMediaPoolPageUsages");
482 $actions[
$lng->
txt(
"settings")] = $ilCtrl->getLinkTargetByClass(
"ilmediapoolpagegui",
"editMediaPoolPage");
483 $ilCtrl->setParameterByClass(
"ilobjmediapoolgui",
"mepitem_id", $this->request->getItemId());
484 $actions[
$lng->
txt(
"move")] = $ilCtrl->getLinkTarget($this->parent_obj,
"move");
485 $actions[
$lng->
txt(
"remove")] = $ilCtrl->getLinkTarget($this->parent_obj,
"confirmRemove");
488 $this->tpl->setCurrentBlock(
"tbl_content");
490 $ilCtrl->setParameter($this->parent_obj, $this->folder_par, $this->current_folder);
494 $this->tpl->setVariable(
"ONCLICK",
"il.MediaPool.preview('" . $a_set[
"child"] .
"'); return false;");
495 $this->tpl->setVariable(
"TXT_TITLE", htmlentities($a_set[
"title"]));
496 $ilCtrl->setParameterByClass(
"ilobjmediaobjectgui",
"mepitem_id", $a_set[
"child"]);
497 $ilCtrl->setParameter($this->parent_obj,
"mob_id", $a_set[
"foreign_id"]);
498 $ilCtrl->setParameter($this->parent_obj,
"id", $a_set[
"child"]);
501 if ($ilAccess->checkAccess(
"write",
"", $this->media_pool->getRefId()) &&
502 $this->
getMode() === self::IL_MEP_EDIT) {
503 $actions[
$lng->
txt(
"edit")] = $ilCtrl->getLinkTargetByClass(
"ilobjmediaobjectgui",
"edit");
504 $ilCtrl->setParameterByClass(
"ilobjmediapoolgui",
"mepitem_id", $this->request->getItemId());
505 $actions[
$lng->
txt(
"cont_copy_to_clipboard")] = $ilCtrl->getLinkTargetByClass(
"ilobjmediapoolgui",
"copyToClipboard");
506 $actions[
$lng->
txt(
"move")] = $ilCtrl->getLinkTargetByClass(
"ilobjmediapoolgui",
"move");
507 $actions[
$lng->
txt(
"remove")] = $ilCtrl->getLinkTarget($this->parent_obj,
"confirmRemove");
510 $this->tpl->setCurrentBlock(
"link");
511 $this->tpl->setCurrentBlock(
"tbl_content");
516 $med = $mob->getMediaItem(
"Standard");
521 $target = $med->getThumbnailTarget();
525 if ($target ===
"") {
526 $target = $mob->getVideoPreviewPic();
529 if ($target !==
"") {
532 $this->tpl->setVariable(
538 $med->getLocationType() ===
"Reference") {
539 $size = getimagesize($med->getLocation());
540 if ($size[0] > 0 && $size[1] > 0) {
544 $w = (
int) ($size[0] / $r);
545 $h = (
int) ($size[1] / $r);
546 $this->tpl->setVariable(
554 $this->tpl->setVariable(
558 $ilCtrl->setParameter($this->parent_obj, $this->folder_par, $this->current_folder);
563 if ($ilAccess->checkAccess(
"write",
"", $this->media_pool->getRefId())) {
565 $this->
getMode() === self::IL_MEP_EDIT ||
566 ($this->
getMode() === self::IL_MEP_SELECT && $a_set[
"type"] ===
"mob") ||
567 ($this->
getMode() === self::IL_MEP_SELECT_CONTENT && $a_set[
"type"] ===
"pg")
569 $this->tpl->setCurrentBlock(
"chbox");
570 $this->tpl->setVariable(
"CHECKBOX_ID", $a_set[
"child"]);
571 $this->tpl->parseCurrentBlock();
572 $this->tpl->setCurrentBlock(
"tbl_content");
573 } elseif ($this->
getMode() === self::IL_MEP_SELECT_SINGLE && $a_set[
"type"] ===
"mob") {
574 $this->tpl->setCurrentBlock(
"radio");
575 $this->tpl->setVariable(
"RADIO_ID", $a_set[
"child"]);
576 $this->tpl->parseCurrentBlock();
577 $this->tpl->setCurrentBlock(
"tbl_content");
581 if (count($actions) > 0) {
583 foreach ($actions as
$txt => $act) {
584 $items[] = $this->
ui->factory()->link()->standard(
$txt, $act);
586 $dd = $this->
ui->factory()->dropdown()->standard($items);
587 $this->tpl->setVariable(
"DROPDOWN", $this->
ui->renderer()->render($dd));
595 $mtpl =
new ilTemplate(
"tpl.media_sel_table.html",
true,
true,
"Modules/MediaPool");
599 $path = $this->tree->getPathFull($this->current_folder);
602 foreach (
$path as $p) {
603 $ilCtrl->setParameter($this->parent_obj, $this->folder_par, $p[
"child"]);
604 $title = htmlentities($p[
"title"]);
605 if ($this->tree->getRootId() == $p[
"child"]) {
610 $ilCtrl->getLinkTarget($this->parent_obj, $this->parent_cmd)
613 $ilCtrl->setParameter(
616 $this->current_folder
619 $mtpl->setCurrentBlock(
"loc");
620 $mtpl->setVariable(
"LOC", $loc->getHTML());
621 $mtpl->parseCurrentBlock();
624 $mtpl->setVariable(
"TABLE", parent::render());
txt(string $a_topic, string $a_default_lang_fallback_mod="")
gets the text for a given topic if the topic is not in the list, the topic itself with "-" will be re...
setFormAction(string $a_form_action, bool $a_multipart=false)
addFilterItem(ilTableFilterItem $a_input_item, bool $a_optional=false)
addCommandButton(string $a_cmd, string $a_text, string $a_onclick='', string $a_id="", string $a_class="")
setResetCommand(string $a_val, string $a_caption="")
setSelectAllCheckbox(string $a_select_all_checkbox, bool $a_select_all_on_top=false)
static getImagePath(string $img, string $module_path="", string $mode="output", bool $offline=false)
get image path (for images located in a template directory)
loadLanguageModule(string $a_module)
Load language module.
static img(string $a_src, ?string $a_alt=null, $a_width="", $a_height="", $a_border=0, $a_id="", $a_class="")
Build img tag.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
getFilterItemByPostVar(string $a_post_var)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
resetOffset(bool $a_in_determination=false)
setExternalSorting(bool $a_val)
static _lookupTitle(int $obj_id)
setRowTemplate(string $a_template, string $a_template_dir="")
Set row template.
setFilterCommand(string $a_val, string $a_caption="")
if(!defined('PATH_SEPARATOR')) $GLOBALS['_PEAR_default_error_mode']
setTitle(string $a_title, string $a_icon="", string $a_icon_alt="")
static deducibleSize(string $a_mime)
checks if mime type is provided by getimagesize()
static queryForRecords(int $adv_rec_obj_ref_id, string $adv_rec_obj_type, string $adv_rec_obj_subtype, array $a_obj_id, string $a_subtype, array $a_records, string $a_obj_id_key, string $a_obj_subid_key, array $a_amet_filter=null)
__construct(Container $dic, ilPlugin $plugin)
setTableGUI(ilTable2GUI $a_val)
Set table for self::MODE_TABLE_FILTER.
static signFile(string $path_to_file)
addColumn(string $a_text, string $a_sort_field="", string $a_width="", bool $a_is_checkbox_action_column=false, string $a_class="", string $a_tooltip="", bool $a_tooltip_with_html=false)
static _lookupType(int $id, bool $reference=false)
addMultiCommand(string $a_cmd, string $a_text)
setEnableHeader(bool $a_enableheader)