ILIAS  release_6 Revision v6.24-5-g0c8bfefb3b8
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
5include_once("Services/Table/classes/class.ilTable2GUI.php");
6
16{
20 protected $ctrl;
21
25 protected $access;
26
30 protected $rbacsystem;
31
35 protected $style_obj;
36
40 public function __construct($a_parent_obj, $a_parent_cmd, $a_style_obj)
41 {
42 global $DIC;
43
44 $this->ctrl = $DIC->ctrl();
45 $this->lng = $DIC->language();
46 $this->access = $DIC->access();
47 $this->rbacsystem = $DIC->rbac()->system();
48 $ilCtrl = $DIC->ctrl();
49 $lng = $DIC->language();
50 $ilAccess = $DIC->access();
51 $lng = $DIC->language();
52 $rbacsystem = $DIC->rbac()->system();
53
54 parent::__construct($a_parent_obj, $a_parent_cmd);
55
56 $this->setTitle($lng->txt("sty_images"));
57 $this->style_obj = $a_style_obj;
58
59 $this->addColumn("", "", "1"); // checkbox
60 $this->addColumn($this->lng->txt("thumbnail"), "", "1");
61 $this->addColumn($this->lng->txt("file"), "", "33%");
62 $this->addColumn($this->lng->txt("sty_width_height"), "", "33%");
63 $this->addColumn($this->lng->txt("size"), "", "33%");
64 $this->setEnableHeader(true);
65 $this->setFormAction($ilCtrl->getFormAction($a_parent_obj));
66 $this->setRowTemplate("tpl.style_image_row.html", "Services/Style/Content");
67 $this->setSelectAllCheckbox("file");
68 $this->getItems();
69
70 // action commands
71 if ($this->parent_obj->checkWrite()) {
72 $this->addMultiCommand("deleteImage", $lng->txt("delete"));
73 }
74
75 //$this->addMultiCommand("editLink", $lng->txt("cont_set_link"));
76 //$this->addCommandButton("addImage", $this->lng->txt("sty_add_image"));
77
78 $this->setEnableTitle(true);
79 }
80
84 public function getItems()
85 {
86 $this->setData($this->style_obj->getImages());
87 }
88
92 protected function fillRow($a_set)
93 {
96 $ilAccess = $this->access;
97
98 $thumbfile = $this->style_obj->getThumbnailsDirectory() . "/" . $a_set["entry"];
99 $image_file = $this->style_obj->getImagesDirectory() . "/" . $a_set["entry"];
100 if (!is_file($thumbfile) || strtolower(pathinfo($a_set["entry"], PATHINFO_EXTENSION)) == "svg") {
101 $thumbfile = $image_file;
102 }
103 if (is_file($thumbfile)) {
104 $this->tpl->setCurrentBlock("thumbnail");
105 $this->tpl->setVariable("IMG_ALT", $a_set["entry"]);
106 $this->tpl->setVariable("IMG_SRC", $thumbfile);
107 $this->tpl->parseCurrentBlock();
108 }
109
110 $image_size = @getimagesize($image_file);
111 {
112 if ($image_size[0] > 0 && $image_size[1] > 0) {
113 $this->tpl->setVariable(
114 "VAL_WIDTH_HEIGHT",
115 $image_size[0] . "px x " . $image_size[1] . "px"
116 );
117 }
118 }
119
120 $this->tpl->setVariable("VAL_FILENAME", $a_set["entry"]);
121 $this->tpl->setVariable("VAL_SIZE", $a_set["size"]);
122 $this->tpl->setVariable("FILE", $a_set["entry"]);
123 }
124}
An exception for terminatinating execution or to throw for unit testing.
TableGUI class for style editor (image list)
__construct($a_parent_obj, $a_parent_cmd, $a_style_obj)
Constructor.
fillRow($a_set)
Fill table row.
getItems()
Get items of current folder.
Class ilTable2GUI.
setEnableHeader($a_enableheader)
Set Enable Header.
setTitle($a_title, $a_icon=0, $a_icon_alt=0)
Set title and title icon.
setSelectAllCheckbox($a_select_all_checkbox, $a_select_all_on_top=false)
Set the name of the checkbox that should be toggled with a select all button.
setData($a_data)
set table data @access public
setEnableTitle($a_enabletitle)
Set Enable Title.
setRowTemplate($a_template, $a_template_dir="")
Set row template.
addMultiCommand($a_cmd, $a_text)
Add Command button.
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.
setFormAction($a_form_action, $a_multipart=false)
Set Form action parameter.
global $ilCtrl
Definition: ilias.php:18
__construct(Container $dic, ilPlugin $plugin)
@inheritDoc
$DIC
Definition: xapitoken.php:46