ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
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  protected $ctrl;
21 
25  protected $access;
26 
30  protected $rbacsystem;
31 
35  public function __construct($a_parent_obj, $a_parent_cmd, $a_style_obj)
36  {
37  global $DIC;
38 
39  $this->ctrl = $DIC->ctrl();
40  $this->lng = $DIC->language();
41  $this->access = $DIC->access();
42  $this->rbacsystem = $DIC->rbac()->system();
43  $ilCtrl = $DIC->ctrl();
44  $lng = $DIC->language();
45  $ilAccess = $DIC->access();
46  $lng = $DIC->language();
47  $rbacsystem = $DIC->rbac()->system();
48 
49  parent::__construct($a_parent_obj, $a_parent_cmd);
50 
51  $this->setTitle($lng->txt("sty_images"));
52  $this->style_obj = $a_style_obj;
53 
54  $this->addColumn("", "", "1"); // checkbox
55  $this->addColumn($this->lng->txt("thumbnail"), "", "1");
56  $this->addColumn($this->lng->txt("file"), "", "33%");
57  $this->addColumn($this->lng->txt("sty_width_height"), "", "33%");
58  $this->addColumn($this->lng->txt("size"), "", "33%");
59  $this->setEnableHeader(true);
60  $this->setFormAction($ilCtrl->getFormAction($a_parent_obj));
61  $this->setRowTemplate("tpl.style_image_row.html", "Services/Style/Content");
62  $this->setSelectAllCheckbox("file");
63  $this->getItems();
64 
65  // action commands
66  if ($this->parent_obj->checkWrite()) {
67  $this->addMultiCommand("deleteImage", $lng->txt("delete"));
68  }
69 
70  //$this->addMultiCommand("editLink", $lng->txt("cont_set_link"));
71  //$this->addCommandButton("addImage", $this->lng->txt("sty_add_image"));
72 
73  $this->setEnableTitle(true);
74  }
75 
79  public function getItems()
80  {
81  $this->setData($this->style_obj->getImages());
82  }
83 
87  protected function fillRow($a_set)
88  {
89  $lng = $this->lng;
91  $ilAccess = $this->access;
92 
93  $thumbfile = $this->style_obj->getThumbnailsDirectory() . "/" . $a_set["entry"];
94  if (is_file($thumbfile)) {
95  $this->tpl->setCurrentBlock("thumbnail");
96  $this->tpl->setVariable("IMG_ALT", $a_set["entry"]);
97  $this->tpl->setVariable("IMG_SRC", $thumbfile);
98  $this->tpl->parseCurrentBlock();
99  }
100  $image_file = $this->style_obj->getImagesDirectory() . "/" . $a_set["entry"];
101  $image_size = @getimagesize($image_file);
102  {
103  if ($image_size[0] > 0 && $image_size[1] > 0) {
104  $this->tpl->setVariable(
105  "VAL_WIDTH_HEIGHT",
106  $image_size[0] . "px x " . $image_size[1] . "px"
107  );
108  }
109  }
110 
111  $this->tpl->setVariable("VAL_FILENAME", $a_set["entry"]);
112  $this->tpl->setVariable("VAL_SIZE", $a_set["size"]);
113  $this->tpl->setVariable("FILE", $a_set["entry"]);
114  }
115 }
global $DIC
Definition: saml.php:7
getItems()
Get items of current folder.
global $ilCtrl
Definition: ilias.php:18
setTitle($a_title, $a_icon=0, $a_icon_alt=0)
Set title and title icon.
Class ilTable2GUI.
addMultiCommand($a_cmd, $a_text)
Add Command button.
fillRow($a_set)
Fill table row.
setRowTemplate($a_template, $a_template_dir="")
Set row template.
TableGUI class for style editor (image list)
setFormAction($a_form_action, $a_multipart=false)
Set Form action parameter.
addColumn( $a_text, $a_sort_field="", $a_width="", $a_is_checkbox_action_column=false, $a_class="", $a_tooltip="", $a_tooltip_with_html=false)
Add a column to the header.
__construct($a_parent_obj, $a_parent_cmd, $a_style_obj)
Constructor.
setEnableHeader($a_enableheader)
Set Enable Header.
setSelectAllCheckbox($a_select_all_checkbox)
Set the name of the checkbox that should be toggled with a select all button.
setEnableTitle($a_enabletitle)
Set Enable Title.