ILIAS  eassessment Revision 61809
 All Data Structures Namespaces Files Functions Variables Groups Pages
class.ilStyleImageTableGUI.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 {
39  function __construct($a_parent_obj, $a_parent_cmd, $a_style_obj)
40  {
41  global $ilCtrl, $lng, $ilAccess, $lng;
42 
43  parent::__construct($a_parent_obj, $a_parent_cmd);
44 
45  $this->setTitle($lng->txt("sty_images"));
46  $this->style_obj = $a_style_obj;
47 
48  $this->addColumn("", "", "1"); // checkbox
49  $this->addColumn($this->lng->txt("thumbnail"), "", "1");
50  $this->addColumn($this->lng->txt("file"), "", "33%");
51  $this->addColumn($this->lng->txt("sty_width_height"), "", "33%");
52  $this->addColumn($this->lng->txt("size"), "", "33%");
53  $this->setEnableHeader(true);
54  $this->setFormAction($ilCtrl->getFormAction($a_parent_obj));
55  $this->setRowTemplate("tpl.style_image_row.html", "Services/Style");
56  $this->setSelectAllCheckbox("file");
57  $this->getItems();
58 
59  // action commands
60  $this->addMultiCommand("deleteImage", $lng->txt("delete"));
61 
62  //$this->addMultiCommand("editLink", $lng->txt("cont_set_link"));
63  $this->addCommandButton("addImage", $this->lng->txt("sty_add_image"));
64 
65  $this->setEnableTitle(true);
66  }
67 
71  function getItems()
72  {
73  $this->setData($this->style_obj->getImages());
74  }
75 
79  protected function fillRow($a_set)
80  {
81  global $lng, $ilCtrl, $ilAccess;
82 
83  $thumbfile = $this->style_obj->getThumbnailsDirectory()."/".$a_set["entry"];
84  if (is_file($thumbfile))
85  {
86  $this->tpl->setCurrentBlock("thumbnail");
87  $this->tpl->setVariable("IMG_ALT", $a_set["entry"]);
88  $this->tpl->setVariable("IMG_SRC", $thumbfile);
89  $this->tpl->parseCurrentBlock();
90  }
91  $image_file = $this->style_obj->getImagesDirectory()."/".$a_set["entry"];
92  $image_size = @getimagesize($image_file);
93  {
94  if ($image_size[0] > 0 && $image_size[1] > 0)
95  {
96  $this->tpl->setVariable("VAL_WIDTH_HEIGHT",
97  $image_size[0]."px x ".$image_size[1]."px");
98  }
99  }
100 
101  $this->tpl->setVariable("VAL_FILENAME", $a_set["entry"]);
102  $this->tpl->setVariable("VAL_SIZE", $a_set["size"]);
103  $this->tpl->setVariable("FILE", $a_set["entry"]);
104  }
105 }
106 ?>