ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
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 {
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  {
97  $lng = $this->lng;
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  } elseif ($a_set["type"] == "incl") {
112  $this->tpl->setCurrentBlock("thumbnail");
113  $this->tpl->setVariable(
114  "IMG_THUMB",
115  ilUtil::getImagePath("icon_pg.svg")
116  );
117  $this->tpl->parseCurrentBlock();
118  }
119 
120  // allow editing of media objects
121  if ($this->parent_obj->mode != "getObject" && $a_set["type"] == "mob") {
122  // output edit link
123  $this->tpl->setCurrentBlock("edit");
124  $ilCtrl->setParameter($this->parent_obj, "clip_item_id", $a_set["id"]);
125  $ilCtrl->setParameterByClass("ilObjMediaObjectGUI", "clip_item_id", $a_set["id"]);
126  $this->tpl->setVariable(
127  "EDIT_LINK",
128  $ilCtrl->getLinkTargetByClass(
129  "ilObjMediaObjectGUI",
130  "edit",
131  array("ilEditClipboardGUI")
132  )
133  );
134  $this->tpl->setVariable("TEXT_OBJECT", $a_set["title"] .
135  " [" . $a_set["id"] . "]");
136  $this->tpl->parseCurrentBlock();
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  $this->tpl->parseCurrentBlock();
142  }
143 
144  include_once("./Services/MediaObjects/classes/class.ilObjMediaObjectGUI.php");
145  if ($a_set["type"] == "mob") {
146  $this->tpl->setVariable(
147  "MEDIA_INFO",
149  );
150  }
151  $this->tpl->setVariable("CHECKBOX_ID", $a_set["type"] . ":" . $a_set["id"]);
152  }
153 }
static sortArray( $array, $a_array_sortby, $a_array_sortorder=0, $a_numeric=false, $a_keep_keys=false)
sortArray
TableGUI clipboard items.
setDefaultOrderField($a_defaultorderfield)
Set Default order field.
global $DIC
Definition: saml.php:7
$_GET["client_id"]
fillRow($a_set)
Standard Version of Fill Row.
user()
Definition: user.php:4
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.
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.
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.
setFormAction($a_form_action, $a_multipart=false)
Set Form action parameter.
static _getMediaInfoHTML(&$a_mob)
get media info as html
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.
setEnableHeader($a_enableheader)
Set Enable Header.
$target
Definition: test.php:19
__construct($a_parent_obj, $a_parent_cmd)
Constructor.