ILIAS  release_6 Revision v6.24-5-g0c8bfefb3b8
class.ilClipboardTableGUI.php
Go to the documentation of this file.
1<?php
2
3/* Copyright (c) 1998-2010 ILIAS open source, Extended GPL, see docs/LICENSE */
4
5include_once("Services/Table/classes/class.ilTable2GUI.php");
6
16{
20 protected $ctrl;
21
25 protected $access;
26
30 protected $user;
31
32
36 public function __construct($a_parent_obj, $a_parent_cmd)
37 {
38 global $DIC;
39
40 $this->ctrl = $DIC->ctrl();
41 $this->lng = $DIC->language();
42 $this->access = $DIC->access();
43 $this->user = $DIC->user();
44 $ilCtrl = $DIC->ctrl();
45 $lng = $DIC->language();
46 $ilAccess = $DIC->access();
47
48 parent::__construct($a_parent_obj, $a_parent_cmd);
49 $lng->loadLanguageModule("mep");
50
51 $this->addColumn("", "", "1"); // checkbox
52 $this->addColumn($lng->txt("mep_thumbnail"), "", "1");
53 $this->addColumn($lng->txt("mep_title_and_description"), "", "100%");
54 $this->setEnableHeader(true);
55 $this->setFormAction($ilCtrl->getFormAction($a_parent_obj));
56 $this->setRowTemplate(
57 "tpl.clipboard_tbl_row.html",
58 "Services/Clipboard"
59 );
60 $this->getItems();
61
62 // title
63 $this->setTitle($lng->txt("clipboard"));
64
65 $this->setDefaultOrderField("title");
66
67 // action commands
68 if ($this->parent_obj->mode == "getObject") {
69 $this->addMultiCommand("insert", $this->parent_obj->getInsertButtonTitle());
70 }
71 $this->addMultiCommand("remove", $lng->txt("remove"));
72
73 $this->setSelectAllCheckbox("id");
74 }
75
79 public function getItems()
80 {
82
83 $objs = $ilUser->getClipboardObjects("mob");
84 $objs2 = $ilUser->getClipboardObjects("incl");
85 $objs = array_merge($objs, $objs2);
86 $objs = ilUtil::sortArray($objs, $_GET["sort_by"], $_GET["sort_order"]);
87
88 $this->setData($objs);
89 }
90
95 protected function fillRow($a_set)
96 {
99 $ilAccess = $this->access;
100
101 if ($a_set["type"] == "mob") {
102 // output thumbnail
103 $mob = new ilObjMediaObject($a_set["id"]);
104 $med = $mob->getMediaItem("Standard");
105 $target = $med->getThumbnailTarget();
106 if ($target != "") {
107 $this->tpl->setCurrentBlock("thumbnail");
108 $this->tpl->setVariable("IMG_THUMB", $target);
109 $this->tpl->parseCurrentBlock();
110 }
111 if ($med && ilUtil::deducibleSize($med->getFormat()) &&
112 $med->getLocationType() == "Reference") {
113 $size = @getimagesize($med->getLocation());
114 if ($size[0] > 0 && $size[1] > 0) {
115 $wr = $size[0] / 80;
116 $hr = $size[1] / 80;
117 $r = max($wr, $hr);
118 $w = (int) ($size[0] / $r);
119 $h = (int) ($size[1] / $r);
120 $this->tpl->setVariable(
121 "IMG",
122 ilUtil::img($med->getLocation(), "", $w, $h)
123 );
124 }
125 }
126 } elseif ($a_set["type"] == "incl") {
127 $this->tpl->setCurrentBlock("thumbnail");
128 $this->tpl->setVariable(
129 "IMG_THUMB",
130 ilUtil::getImagePath("icon_pg.svg")
131 );
132 $this->tpl->parseCurrentBlock();
133 }
134
135 // allow editing of media objects
136 if ($this->parent_obj->mode != "getObject" && $a_set["type"] == "mob") {
137 // output edit link
138 $this->tpl->setCurrentBlock("edit");
139 $ilCtrl->setParameter($this->parent_obj, "clip_item_id", $a_set["id"]);
140 $ilCtrl->setParameterByClass("ilObjMediaObjectGUI", "clip_item_id", $a_set["id"]);
141 $this->tpl->setVariable(
142 "EDIT_LINK",
143 $ilCtrl->getLinkTargetByClass(
144 "ilObjMediaObjectGUI",
145 "edit",
146 array("ilEditClipboardGUI")
147 )
148 );
149 $this->tpl->setVariable("TEXT_OBJECT", $a_set["title"] .
150 " [" . $a_set["id"] . "]");
151 $this->tpl->parseCurrentBlock();
152 } else { // just list elements for selection
153 $this->tpl->setCurrentBlock("show");
154 $this->tpl->setVariable("TEXT_OBJECT2", $a_set["title"] .
155 " [" . $a_set["id"] . "]");
156 $this->tpl->parseCurrentBlock();
157 }
158
159 include_once("./Services/MediaObjects/classes/class.ilObjMediaObjectGUI.php");
160 if ($a_set["type"] == "mob") {
161 $this->tpl->setVariable(
162 "MEDIA_INFO",
164 );
165 }
166 $this->tpl->setVariable("CHECKBOX_ID", $a_set["type"] . ":" . $a_set["id"]);
167 }
168}
user()
Definition: user.php:4
$size
Definition: RandomTest.php:84
$_GET["client_id"]
An exception for terminatinating execution or to throw for unit testing.
TableGUI clipboard items.
fillRow($a_set)
Standard Version of Fill Row.
getItems()
Get items from user clipboard.
__construct($a_parent_obj, $a_parent_cmd)
Constructor.
static _getMediaInfoHTML(&$a_mob)
get media info as html
Class ilObjMediaObject.
Class ilTable2GUI.
setEnableHeader($a_enableheader)
Set Enable Header.
setTitle($a_title, $a_icon=0, $a_icon_alt=0)
Set title and title icon.
setSelectAllCheckbox($a_select_all_checkbox, $a_select_all_on_top=false)
Set the name of the checkbox that should be toggled with a select all button.
setData($a_data)
set table data @access public
setRowTemplate($a_template, $a_template_dir="")
Set row template.
addMultiCommand($a_cmd, $a_text)
Add Command button.
setDefaultOrderField($a_defaultorderfield)
Set Default order field.
addColumn( $a_text, $a_sort_field="", $a_width="", $a_is_checkbox_action_column=false, $a_class="", $a_tooltip="", $a_tooltip_with_html=false)
Add a column to the header.
setFormAction($a_form_action, $a_multipart=false)
Set Form action parameter.
static sortArray( $array, $a_array_sortby, $a_array_sortorder=0, $a_numeric=false, $a_keep_keys=false)
sortArray
static img($a_src, $a_alt=null, $a_width="", $a_height="", $a_border=0, $a_id="", $a_class="")
Build img tag.
static getImagePath($img, $module_path="", $mode="output", $offline=false)
get image path (for images located in a template directory)
static deducibleSize($a_mime)
checks if mime type is provided by getimagesize()
global $ilCtrl
Definition: ilias.php:18
__construct(Container $dic, ilPlugin $plugin)
@inheritDoc
$ilUser
Definition: imgupload.php:18
$DIC
Definition: xapitoken.php:46