ILIAS  Release_4_2_x_branch Revision 61807
 All Data Structures Namespaces Files Functions Variables Groups Pages
class.ilStyleImageTableGUI.php
Go to the documentation of this file.
1 <?php
2 
3 /* Copyright (c) 1998-2011 ILIAS open source, Extended GPL, see docs/LICENSE */
4 
5 include_once("Services/Table/classes/class.ilTable2GUI.php");
6 
16 {
20  function __construct($a_parent_obj, $a_parent_cmd, $a_style_obj)
21  {
22  global $ilCtrl, $lng, $ilAccess, $lng, $rbacsystem;
23 
24  parent::__construct($a_parent_obj, $a_parent_cmd);
25 
26  $this->setTitle($lng->txt("sty_images"));
27  $this->style_obj = $a_style_obj;
28 
29  $this->addColumn("", "", "1"); // checkbox
30  $this->addColumn($this->lng->txt("thumbnail"), "", "1");
31  $this->addColumn($this->lng->txt("file"), "", "33%");
32  $this->addColumn($this->lng->txt("sty_width_height"), "", "33%");
33  $this->addColumn($this->lng->txt("size"), "", "33%");
34  $this->setEnableHeader(true);
35  $this->setFormAction($ilCtrl->getFormAction($a_parent_obj));
36  $this->setRowTemplate("tpl.style_image_row.html", "Services/Style");
37  $this->setSelectAllCheckbox("file");
38  $this->getItems();
39 
40  // action commands
41  if ($rbacsystem->checkAccess("write", (int) $_GET["ref_id"]))
42  {
43  $this->addMultiCommand("deleteImage", $lng->txt("delete"));
44  }
45 
46  //$this->addMultiCommand("editLink", $lng->txt("cont_set_link"));
47  //$this->addCommandButton("addImage", $this->lng->txt("sty_add_image"));
48 
49  $this->setEnableTitle(true);
50  }
51 
55  function getItems()
56  {
57  $this->setData($this->style_obj->getImages());
58  }
59 
63  protected function fillRow($a_set)
64  {
65  global $lng, $ilCtrl, $ilAccess;
66 
67  $thumbfile = $this->style_obj->getThumbnailsDirectory()."/".$a_set["entry"];
68  if (is_file($thumbfile))
69  {
70  $this->tpl->setCurrentBlock("thumbnail");
71  $this->tpl->setVariable("IMG_ALT", $a_set["entry"]);
72  $this->tpl->setVariable("IMG_SRC", $thumbfile);
73  $this->tpl->parseCurrentBlock();
74  }
75  $image_file = $this->style_obj->getImagesDirectory()."/".$a_set["entry"];
76  $image_size = @getimagesize($image_file);
77  {
78  if ($image_size[0] > 0 && $image_size[1] > 0)
79  {
80  $this->tpl->setVariable("VAL_WIDTH_HEIGHT",
81  $image_size[0]."px x ".$image_size[1]."px");
82  }
83  }
84 
85  $this->tpl->setVariable("VAL_FILENAME", $a_set["entry"]);
86  $this->tpl->setVariable("VAL_SIZE", $a_set["size"]);
87  $this->tpl->setVariable("FILE", $a_set["entry"]);
88  }
89 }
90 ?>