ILIAS  Release_4_0_x_branch Revision 61816
 All Data Structures Namespaces Files Functions Variables Groups Pages
class.ilClipboardTableGUI.php
Go to the documentation of this file.
1 <?php
2 /*
3  +-----------------------------------------------------------------------------+
4  | ILIAS open source |
5  +-----------------------------------------------------------------------------+
6  | Copyright (c) 1998-2008 ILIAS open source, University of Cologne |
7  | |
8  | This program is free software; you can redistribute it and/or |
9  | modify it under the terms of the GNU General Public License |
10  | as published by the Free Software Foundation; either version 2 |
11  | of the License, or (at your option) any later version. |
12  | |
13  | This program is distributed in the hope that it will be useful, |
14  | but WITHOUT ANY WARRANTY; without even the implied warranty of |
15  | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
16  | GNU General Public License for more details. |
17  | |
18  | You should have received a copy of the GNU General Public License |
19  | along with this program; if not, write to the Free Software |
20  | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
21  +-----------------------------------------------------------------------------+
22 */
23 
24 include_once("Services/Table/classes/class.ilTable2GUI.php");
25 
35 {
36 
40  function __construct($a_parent_obj, $a_parent_cmd)
41  {
42  global $ilCtrl, $lng, $ilAccess;
43 
44  parent::__construct($a_parent_obj, $a_parent_cmd);
45  $lng->loadLanguageModule("mep");
46 
47  $this->addColumn("", "", "1"); // checkbox
48  $this->addColumn($lng->txt("mep_thumbnail"), "", "1");
49  $this->addColumn($lng->txt("mep_title_and_description"), "", "100%");
50  $this->setEnableHeader(true);
51  $this->setFormAction($ilCtrl->getFormAction($a_parent_obj));
52  $this->setRowTemplate("tpl.clipboard_tbl_row.html",
53  "Services/Clipboard");
54  $this->getItems();
55 
56  // title
57  $this->setTitle($lng->txt("clipboard"), "icon_clip.gif", $lng->txt("clipboard"));
58 
59  $this->setDefaultOrderField("title");
60 
61  // action commands
62  if ($this->parent_obj->mode == "getObject")
63  {
64  $this->addMultiCommand("insert", $this->parent_obj->getInsertButtonTitle());
65  }
66  $this->addMultiCommand("remove", $lng->txt("remove"));
67 
68  $this->setSelectAllCheckbox("id");
69  }
70 
74  function getItems()
75  {
76  global $ilUser;
77 
78  $objs = $ilUser->getClipboardObjects("mob");
79  $objs2 = $ilUser->getClipboardObjects("incl");
80  $objs = array_merge($objs, $objs2);
81  $objs = ilUtil::sortArray($objs, $_GET["sort_by"], $_GET["sort_order"]);
82 
83  $this->setData($objs);
84  }
85 
90  protected function fillRow($a_set)
91  {
92  global $lng, $ilCtrl, $ilAccess;
93 
94  if ($a_set["type"] == "mob")
95  {
96  // output thumbnail
97  $mob = new ilObjMediaObject($a_set["id"]);
98  $med = $mob->getMediaItem("Standard");
99  $target = $med->getThumbnailTarget();
100  if ($target != "")
101  {
102  $this->tpl->setCurrentBlock("thumbnail");
103  $this->tpl->setVariable("IMG_THUMB", $target);
104  $this->tpl->parseCurrentBlock();
105  }
106  }
107  else if ($a_set["type"] == "incl")
108  {
109  $this->tpl->setCurrentBlock("thumbnail");
110  $this->tpl->setVariable("IMG_THUMB",
111  ilUtil::getImagePath("icon_pg.gif"));
112  $this->tpl->parseCurrentBlock();
113  }
114 
115  // allow editing of media objects
116  if ($this->parent_obj->mode != "getObject" && $a_set["type"] == "mob")
117  {
118  // output edit link
119  $this->tpl->setCurrentBlock("edit");
120  $ilCtrl->setParameter($this->parent_obj, "clip_item_id", $a_set["id"]);
121  $ilCtrl->setParameterByClass("ilObjMediaObjectGUI", "clip_item_id", $a_set["id"]);
122  $this->tpl->setVariable("EDIT_LINK",
123  $ilCtrl->getLinkTargetByClass("ilObjMediaObjectGUI", "edit",
124  array("ilEditClipboardGUI")));
125  $this->tpl->setVariable("TEXT_OBJECT", $a_set["title"].
126  " [".$a_set["id"]."]");
127  $this->tpl->parseCurrentBlock();
128  }
129  else // just list elements for selection
130  {
131  $this->tpl->setCurrentBlock("show");
132  $this->tpl->setVariable("TEXT_OBJECT2", $a_set["title"].
133  " [".$a_set["id"]."]");
134  $this->tpl->parseCurrentBlock();
135  }
136 
137  include_once("./Services/MediaObjects/classes/class.ilObjMediaObjectGUI.php");
138  if ($a_set["type"] == "mob")
139  {
140  $this->tpl->setVariable("MEDIA_INFO",
142  }
143  $this->tpl->setVariable("CHECKBOX_ID", $a_set["type"].":".$a_set["id"]);
144  }
145 
146 }
147 ?>