ILIAS  release_5-2 Revision v5.2.25-18-g3f80b828510
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 
5 include_once("Services/Table/classes/class.ilTable2GUI.php");
6 
16 {
17 
21  function __construct($a_parent_obj, $a_parent_cmd)
22  {
23  global $ilCtrl, $lng, $ilAccess;
24 
25  parent::__construct($a_parent_obj, $a_parent_cmd);
26  $lng->loadLanguageModule("mep");
27 
28  $this->addColumn("", "", "1"); // checkbox
29  $this->addColumn($lng->txt("mep_thumbnail"), "", "1");
30  $this->addColumn($lng->txt("mep_title_and_description"), "", "100%");
31  $this->setEnableHeader(true);
32  $this->setFormAction($ilCtrl->getFormAction($a_parent_obj));
33  $this->setRowTemplate("tpl.clipboard_tbl_row.html",
34  "Services/Clipboard");
35  $this->getItems();
36 
37  // title
38  $this->setTitle($lng->txt("clipboard"));
39 
40  $this->setDefaultOrderField("title");
41 
42  // action commands
43  if ($this->parent_obj->mode == "getObject")
44  {
45  $this->addMultiCommand("insert", $this->parent_obj->getInsertButtonTitle());
46  }
47  $this->addMultiCommand("remove", $lng->txt("remove"));
48 
49  $this->setSelectAllCheckbox("id");
50  }
51 
55  function getItems()
56  {
57  global $ilUser;
58 
59  $objs = $ilUser->getClipboardObjects("mob");
60  $objs2 = $ilUser->getClipboardObjects("incl");
61  $objs = array_merge($objs, $objs2);
62  $objs = ilUtil::sortArray($objs, $_GET["sort_by"], $_GET["sort_order"]);
63 
64  $this->setData($objs);
65  }
66 
71  protected function fillRow($a_set)
72  {
73  global $lng, $ilCtrl, $ilAccess;
74 
75  if ($a_set["type"] == "mob")
76  {
77  // output thumbnail
78  $mob = new ilObjMediaObject($a_set["id"]);
79  $med = $mob->getMediaItem("Standard");
80  $target = $med->getThumbnailTarget();
81  if ($target != "")
82  {
83  $this->tpl->setCurrentBlock("thumbnail");
84  $this->tpl->setVariable("IMG_THUMB", $target);
85  $this->tpl->parseCurrentBlock();
86  }
87  }
88  else if ($a_set["type"] == "incl")
89  {
90  $this->tpl->setCurrentBlock("thumbnail");
91  $this->tpl->setVariable("IMG_THUMB",
92  ilUtil::getImagePath("icon_pg.svg"));
93  $this->tpl->parseCurrentBlock();
94  }
95 
96  // allow editing of media objects
97  if ($this->parent_obj->mode != "getObject" && $a_set["type"] == "mob")
98  {
99  // output edit link
100  $this->tpl->setCurrentBlock("edit");
101  $ilCtrl->setParameter($this->parent_obj, "clip_item_id", $a_set["id"]);
102  $ilCtrl->setParameterByClass("ilObjMediaObjectGUI", "clip_item_id", $a_set["id"]);
103  $this->tpl->setVariable("EDIT_LINK",
104  $ilCtrl->getLinkTargetByClass("ilObjMediaObjectGUI", "edit",
105  array("ilEditClipboardGUI")));
106  $this->tpl->setVariable("TEXT_OBJECT", $a_set["title"].
107  " [".$a_set["id"]."]");
108  $this->tpl->parseCurrentBlock();
109  }
110  else // just list elements for selection
111  {
112  $this->tpl->setCurrentBlock("show");
113  $this->tpl->setVariable("TEXT_OBJECT2", $a_set["title"].
114  " [".$a_set["id"]."]");
115  $this->tpl->parseCurrentBlock();
116  }
117 
118  include_once("./Services/MediaObjects/classes/class.ilObjMediaObjectGUI.php");
119  if ($a_set["type"] == "mob")
120  {
121  $this->tpl->setVariable("MEDIA_INFO",
123  }
124  $this->tpl->setVariable("CHECKBOX_ID", $a_set["type"].":".$a_set["id"]);
125  }
126 
127 }
128 ?>
TableGUI clipboard items.
setDefaultOrderField($a_defaultorderfield)
Set Default order field.
$_GET["client_id"]
fillRow($a_set)
Standard Version of Fill Row.
static sortArray($array, $a_array_sortby, $a_array_sortorder=0, $a_numeric=false, $a_keep_keys=false)
sortArray
global $ilCtrl
Definition: ilias.php:18
setTitle($a_title, $a_icon=0, $a_icon_alt=0)
Set title and title icon.
getItems()
Get items from user clipboard.
Class ilTable2GUI.
static getImagePath($img, $module_path="", $mode="output", $offline=false)
get image path (for images located in a template directory)
addMultiCommand($a_cmd, $a_text)
Add Command button.
$ilUser
Definition: imgupload.php:18
Class ilObjMediaObject.
setRowTemplate($a_template, $a_template_dir="")
Set row template.
Create styles array
The data for the language used.
setFormAction($a_form_action, $a_multipart=false)
Set Form action parameter.
static _getMediaInfoHTML(&$a_mob)
get media info as html
global $lng
Definition: privfeed.php:17
setEnableHeader($a_enableheader)
Set Enable Header.
setSelectAllCheckbox($a_select_all_checkbox)
Set the name of the checkbox that should be toggled with a select all button.
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.
__construct($a_parent_obj, $a_parent_cmd)
Constructor.