ILIAS  release_8 Revision v8.24
class.ilClipboardTableGUI.php
Go to the documentation of this file.
1<?php
2
24{
26 protected ilObjUser $user;
27
28 public function __construct(
29 object $a_parent_obj,
30 string $a_parent_cmd
31 ) {
32 global $DIC;
33
34 $this->ctrl = $DIC->ctrl();
35 $this->lng = $DIC->language();
36 $this->access = $DIC->access();
37 $this->user = $DIC->user();
38 $ilCtrl = $DIC->ctrl();
39 $lng = $DIC->language();
40
41 parent::__construct($a_parent_obj, $a_parent_cmd);
43
44 $this->addColumn("", "", "1"); // checkbox
45 $this->addColumn($lng->txt("mep_thumbnail"), "", "1");
46 $this->addColumn($lng->txt("mep_title_and_description"), "", "100%");
47 $this->setEnableHeader(true);
48 $this->setFormAction($ilCtrl->getFormAction($a_parent_obj));
49 $this->setRowTemplate(
50 "tpl.clipboard_tbl_row.html",
51 "Modules/MediaPool/Clipboard"
52 );
53 $this->getItems();
54
55 // title
56 $this->setTitle($lng->txt("clipboard"));
57
58 $this->setDefaultOrderField("title");
59
60 // action commands
61 if ($this->parent_obj->mode === "getObject") {
62 $this->addMultiCommand("insert", $this->parent_obj->getInsertButtonTitle());
63 }
64 $this->addMultiCommand("remove", $lng->txt("remove"));
65
66 $this->setSelectAllCheckbox("id");
67 }
68
72 public function getItems(): void
73 {
75
76 $objs = $ilUser->getClipboardObjects("mob");
77 $objs2 = $ilUser->getClipboardObjects("incl");
78 $objs = array_merge($objs, $objs2);
79
80 $this->setData($objs);
81 }
82
83 protected function fillRow(array $a_set): void
84 {
85 $ilCtrl = $this->ctrl;
86
87 $mob = null;
88 if ($a_set["type"] === "mob") {
89 // output thumbnail
90 $mob = new ilObjMediaObject($a_set["id"]);
91 $med = $mob->getMediaItem("Standard");
92 $target = $med->getThumbnailTarget();
93 if ($target !== "") {
94 $this->tpl->setCurrentBlock("thumbnail");
95 $this->tpl->setVariable("IMG_THUMB", $target);
96 $this->tpl->parseCurrentBlock();
97 }
98 if (ilUtil::deducibleSize($med->getFormat()) &&
99 $med->getLocationType() === "Reference") {
100 $size = getimagesize($med->getLocation());
101 if ($size[0] > 0 && $size[1] > 0) {
102 $wr = $size[0] / 80;
103 $hr = $size[1] / 80;
104 $r = max($wr, $hr);
105 $w = (int) ($size[0] / $r);
106 $h = (int) ($size[1] / $r);
107 $this->tpl->setVariable(
108 "IMG",
109 ilUtil::img($med->getLocation(), "", $w, $h)
110 );
111 }
112 }
113 } elseif ($a_set["type"] === "incl") {
114 $this->tpl->setCurrentBlock("thumbnail");
115 $this->tpl->setVariable(
116 "IMG_THUMB",
117 ilUtil::getImagePath("icon_pg.svg")
118 );
119 $this->tpl->parseCurrentBlock();
120 }
121
122 // allow editing of media objects
123 if ($this->parent_obj->mode !== "getObject" && $a_set["type"] === "mob") {
124 // output edit link
125 $this->tpl->setCurrentBlock("edit");
126 $ilCtrl->setParameter($this->parent_obj, "clip_item_id", $a_set["id"]);
127 $ilCtrl->setParameterByClass("ilObjMediaObjectGUI", "clip_item_id", $a_set["id"]);
128 $this->tpl->setVariable(
129 "EDIT_LINK",
130 $ilCtrl->getLinkTargetByClass(
131 "ilObjMediaObjectGUI",
132 "edit"
133 )
134 );
135 $this->tpl->setVariable("TEXT_OBJECT", $a_set["title"] .
136 " [" . $a_set["id"] . "]");
137 } else { // just list elements for selection
138 $this->tpl->setCurrentBlock("show");
139 $this->tpl->setVariable("TEXT_OBJECT2", $a_set["title"] .
140 " [" . $a_set["id"] . "]");
141 }
142 $this->tpl->parseCurrentBlock();
143
144 if ($a_set["type"] === "mob") {
145 $this->tpl->setVariable(
146 "MEDIA_INFO",
148 );
149 }
150 $this->tpl->setVariable("CHECKBOX_ID", $a_set["type"] . ":" . $a_set["id"]);
151 }
152}
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
fillRow(array $a_set)
Standard Version of Fill Row.
__construct(object $a_parent_obj, string $a_parent_cmd)
getItems()
Get items from user clipboard.
loadLanguageModule(string $a_module)
Load language module.
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...
static _getMediaInfoHTML(ilObjMediaObject $a_mob)
get media info as html
User class.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
setTitle(string $a_title, string $a_icon="", string $a_icon_alt="")
addMultiCommand(string $a_cmd, string $a_text)
setFormAction(string $a_form_action, bool $a_multipart=false)
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)
setEnableHeader(bool $a_enableheader)
setDefaultOrderField(string $a_defaultorderfield)
setSelectAllCheckbox(string $a_select_all_checkbox, bool $a_select_all_on_top=false)
setRowTemplate(string $a_template, string $a_template_dir="")
Set row template.
setData(array $a_data)
Set table data.
ilLanguage $lng
static getImagePath(string $img, string $module_path="", string $mode="output", bool $offline=false)
get image path (for images located in a template directory)
static deducibleSize(string $a_mime)
checks if mime type is provided by getimagesize()
static img(string $a_src, ?string $a_alt=null, $a_width="", $a_height="", $a_border=0, $a_id="", $a_class="")
Build img tag.
global $DIC
Definition: feed.php:28
$ilUser
Definition: imgupload.php:34
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
__construct(Container $dic, ilPlugin $plugin)
@inheritDoc