ILIAS  trunk Revision v11.0_alpha-1723-g8e69f309bab
All Data Structures Namespaces Files Functions Variables Enumerations Enumerator Modules Pages
class.ilClipboardTableGUI.php
Go to the documentation of this file.
1 <?php
2 
24 {
25  protected \ILIAS\MediaObjects\Thumbs\ThumbsGUI $thumbs_gui;
27  protected ilObjUser $user;
28 
29  public function __construct(
30  object $a_parent_obj,
31  string $a_parent_cmd
32  ) {
33  global $DIC;
34 
35  $this->ctrl = $DIC->ctrl();
36  $this->lng = $DIC->language();
37  $this->access = $DIC->access();
38  $this->user = $DIC->user();
39  $ilCtrl = $DIC->ctrl();
40  $lng = $DIC->language();
41  $this->thumbs_gui = $DIC->mediaObjects()->internal()->gui()->thumbs();
42 
43  parent::__construct($a_parent_obj, $a_parent_cmd);
44  $lng->loadLanguageModule("mep");
45 
46  $this->addColumn("", "", "1"); // checkbox
47  $this->addColumn($lng->txt("mep_thumbnail"), "", "1");
48  $this->addColumn($lng->txt("mep_title_and_description"), "", "100%");
49  $this->setEnableHeader(true);
50  $this->setFormAction($ilCtrl->getFormAction($a_parent_obj));
51  $this->setRowTemplate(
52  "tpl.clipboard_tbl_row.html",
53  "components/ILIAS/MediaPool/Clipboard"
54  );
55  $this->getItems();
56 
57  // title
58  $this->setTitle($lng->txt("clipboard"));
59 
60  $this->setDefaultOrderField("title");
61 
62  // action commands
63  if ($this->parent_obj->mode === "getObject") {
64  $this->addMultiCommand("insert", $this->parent_obj->getInsertButtonTitle());
65  }
66  $this->addMultiCommand("remove", $lng->txt("remove"));
67 
68  $this->setSelectAllCheckbox("id");
69  }
70 
74  public function getItems(): void
75  {
76  $ilUser = $this->user;
77 
78  $objs = $ilUser->getClipboardObjects("mob");
79  $objs2 = $ilUser->getClipboardObjects("incl");
80  $objs = array_merge($objs, $objs2);
81 
82  $this->setData($objs);
83  }
84 
85  protected function fillRow(array $a_set): void
86  {
87  $ilCtrl = $this->ctrl;
88 
89  $mob = null;
90  if ($a_set["type"] === "mob") {
91  $this->tpl->setVariable(
92  "IMG",
93  $this->thumbs_gui->getThumbHtml((int) $a_set["id"])
94  );
95  } elseif ($a_set["type"] === "incl") {
96  $this->tpl->setCurrentBlock("thumbnail");
97  $this->tpl->setVariable(
98  "IMG_THUMB",
99  ilUtil::getImagePath("standard/icon_pg.svg")
100  );
101  $this->tpl->parseCurrentBlock();
102  }
103 
104  // allow editing of media objects
105  if ($this->parent_obj->mode !== "getObject" && $a_set["type"] === "mob") {
106  // output edit link
107  $this->tpl->setCurrentBlock("edit");
108  $ilCtrl->setParameter($this->parent_obj, "clip_item_id", $a_set["id"]);
109  $ilCtrl->setParameterByClass("ilObjMediaObjectGUI", "clip_item_id", $a_set["id"]);
110  $this->tpl->setVariable(
111  "EDIT_LINK",
112  $ilCtrl->getLinkTargetByClass(
113  "ilObjMediaObjectGUI",
114  "edit"
115  )
116  );
117  $this->tpl->setVariable("TEXT_OBJECT", $a_set["title"] .
118  " [" . $a_set["id"] . "]");
119  } else { // just list elements for selection
120  $this->tpl->setCurrentBlock("show");
121  $this->tpl->setVariable("TEXT_OBJECT2", $a_set["title"] .
122  " [" . $a_set["id"] . "]");
123  }
124  $this->tpl->parseCurrentBlock();
125 
126  if ($a_set["type"] === "mob") {
127  $this->tpl->setVariable(
128  "MEDIA_INFO",
130  );
131  }
132  $this->tpl->setVariable("CHECKBOX_ID", $a_set["type"] . ":" . $a_set["id"]);
133  }
134 }
setData(array $a_data)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
ILIAS MediaObjects Thumbs ThumbsGUI $thumbs_gui
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)
setSelectAllCheckbox(string $a_select_all_checkbox, bool $a_select_all_on_top=false)
loadLanguageModule(string $a_module)
Load language module.
ilLanguage $lng
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
getItems()
Get items from user clipboard.
__construct(object $a_parent_obj, string $a_parent_cmd)
getClipboardObjects(string $a_type='', bool $a_top_nodes_only=false)
get all clipboard objects of user and specified type
setDefaultOrderField(string $a_defaultorderfield)
setRowTemplate(string $a_template, string $a_template_dir="")
Set row template.
global $DIC
Definition: shib_login.php:22
static getImagePath(string $image_name, string $module_path="", string $mode="output", bool $offline=false)
get image path (for images located in a template directory)
setTitle(string $a_title, string $a_icon="", string $a_icon_alt="")
__construct(Container $dic, ilPlugin $plugin)
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 _getMediaInfoHTML(ilObjMediaObject $a_mob)
get media info as html
addMultiCommand(string $a_cmd, string $a_text)
setEnableHeader(bool $a_enableheader)