ILIAS  Release_4_1_x_branch Revision 61804
 All Data Structures Namespaces Files Functions Variables Groups Pages
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"), "icon_clip.gif", $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.gif"));
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 ?>