ILIAS  Release_3_10_x_branch Revision 61812
 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  $objs = ilUtil::sortArray($objs, $_GET["sort_by"], $_GET["sort_order"]);
80 
81  $this->setData($objs);
82  }
83 
88  protected function fillRow($a_set)
89  {
90  global $lng, $ilCtrl, $ilAccess;
91 
92  // output thumbnail
93  $mob = new ilObjMediaObject($a_set["id"]);
94  $med = $mob->getMediaItem("Standard");
95  $target = $med->getThumbnailTarget();
96  if ($target != "")
97  {
98  $this->tpl->setCurrentBlock("thumbnail");
99  $this->tpl->setVariable("IMG_THUMB", $target);
100  $this->tpl->parseCurrentBlock();
101  }
102 
103  // allow editing of media objects
104  if ($this->parent_obj->mode != "getObject")
105  {
106  // output edit link
107  $this->tpl->setCurrentBlock("edit");
108  $ilCtrl->setParameter($this->parent_obj, "clip_mob_id", $a_set["id"]);
109  $this->tpl->setVariable("EDIT_LINK",
110  $ilCtrl->getLinkTargetByClass("ilObjMediaObjectGUI", "edit",
111  array("ilEditClipboardGUI")));
112  $this->tpl->setVariable("TEXT_OBJECT", $a_set["title"].
113  " [".$a_set["id"]."]");
114  $this->tpl->parseCurrentBlock();
115  }
116  else // just list elements for selection
117  {
118  $this->tpl->setCurrentBlock("show");
119  $this->tpl->setVariable("TEXT_OBJECT2", $a_set["title"].
120  " [".$a_set["id"]."]");
121  $this->tpl->parseCurrentBlock();
122  }
123 
124  include_once("./Services/MediaObjects/classes/class.ilObjMediaObjectGUI.php");
125  $this->tpl->setVariable("MEDIA_INFO",
127  $this->tpl->setVariable("CHECKBOX_ID", $a_set["id"]);
128  }
129 
130 }
131 ?>