ILIAS  release_7 Revision v7.30-3-g800a261c036
class.ilPCIIMTriggerTableGUI.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");
6include_once("Services/MediaObjects/classes/class.ilImageMapTableGUI.php");
7
17{
21 protected $ctrl;
22
26 protected $access;
27
28
32 public function __construct(
33 $a_parent_obj,
34 $a_parent_cmd,
35 $a_pc_media_object,
36 $a_parent_node_name
37 ) {
38 global $DIC;
39
40 $this->ctrl = $DIC->ctrl();
41 $this->lng = $DIC->language();
42 $this->access = $DIC->access();
43 $lng = $DIC->language();
44
45 $this->setId("cont_iim_tr");
46
47 $this->parent_node_name = $a_parent_node_name;
48 $this->pc_media_object = $a_pc_media_object;
49 $this->mob = $this->pc_media_object->getMediaObject();
50
51 $this->areas = array();
52 foreach ($this->pc_media_object->getStandardAliasItem()->getMapAreas() as $a) {
53 $this->area[$a["Id"]] = $a;
54 }
55
56 $this->ov_files = $this->mob->getFilesOfDirectory("overlays");
57 $this->ov_options = array("" => $lng->txt("please_select"));
58 foreach ($this->ov_files as $of) {
59 $this->ov_options[$of] = $of;
60 }
61 $this->popups = $this->pc_media_object->getPopups();
62 $this->pop_options = array("" => $lng->txt("please_select"));
63 foreach ($this->popups as $k => $p) {
64 $this->pop_options[$p["nr"]] = $p["title"];
65 }
66 parent::__construct($a_parent_obj, $a_parent_cmd, $a_pc_media_object->getMediaObject());
67 $this->setRowTemplate("tpl.iim_trigger_row.html", "Services/COPage");
68 }
69
73 public function initColumns()
74 {
75 $this->addColumn("", "", "1"); // checkbox
76 $this->addColumn($this->lng->txt("title"), "Title", "");
77 $this->addColumn($this->lng->txt("type"), "", "");
78 $this->addColumn($this->lng->txt("cont_coords"), "", "");
79 $this->addColumn($this->lng->txt("cont_overlay_image"), "", "");
80 $this->addColumn($this->lng->txt("cont_content_popup"), "", "");
81 $this->addColumn($this->lng->txt("actions"), "", "");
82 }
83
87 public function initActions()
88 {
90
91 // action commands
92 $this->addMultiCommand("confirmDeleteTrigger", $lng->txt("delete"));
93
94 $data = $this->getData();
95 if (count($data) > 0) {
96 $this->addCommandButton("updateTrigger", $lng->txt("save"), "", "update_tr_button");
97 }
98 }
99
100
104 public function getItems()
105 {
106 $triggers = $this->pc_media_object->getTriggers();
107
108 $triggers = ilUtil::sortArray($triggers, "Title", "asc", false, true);
109 $this->setData($triggers);
110 }
111
116 protected function fillRow($a_set)
117 {
119 $ilCtrl = $this->ctrl;
120 $ilAccess = $this->access;
121 //var_dump($a_set);
122
123 $i = $a_set["Nr"];
124
125 // command: edit marker position
126 if ($a_set["Overlay"] != "") {
127 $this->tpl->setCurrentBlock("cmd");
128 $this->tpl->setVariable("CMD_ID", "ov_" . $i);
129 $this->tpl->setVariable("HREF_CMD", "#");
130 $this->tpl->setVariable("CMD_CLASS", "ov_cmd");
131 $this->tpl->setVariable("TXT_CMD", $lng->txt("cont_edit_overlay_position"));
132 $this->tpl->parseCurrentBlock();
133 }
134
135 // command: edit marker position
136 if ($a_set["PopupNr"] != "") {
137 $this->tpl->setCurrentBlock("cmd");
138 $this->tpl->setVariable("CMD_ID", "pop_" . $i);
139 $this->tpl->setVariable("HREF_CMD", "#");
140 $this->tpl->setVariable("CMD_CLASS", "pop_cmd");
141 $this->tpl->setVariable("TXT_CMD", $lng->txt("cont_edit_popup_position"));
142 $this->tpl->parseCurrentBlock();
143 }
144
145 if ($a_set["Type"] == ilPCInteractiveImage::AREA) {
146 $this->tpl->setCurrentBlock("coords");
147 $this->tpl->setVariable(
148 "VAL_COORDS",
149 implode(", ", explode(",", $this->area[$a_set["Nr"]]["Coords"]))
150 );
151 $this->tpl->parseCurrentBlock();
152
153 $this->tpl->setVariable(
154 "TYPE",
155 $lng->txt("cont_" . $this->area[$a_set["Nr"]]["Shape"])
156 );
157 } else {
158 // command: edit marker position
159 $this->tpl->setCurrentBlock("cmd");
160 $this->tpl->setVariable("CMD_ID", "mark_" . $i);
161 $this->tpl->setVariable("HREF_CMD", "#");
162 $this->tpl->setVariable("CMD_CLASS", "mark_cmd");
163 $this->tpl->setVariable("TXT_CMD", $lng->txt("cont_edit_marker_position"));
164 $this->tpl->parseCurrentBlock();
165
166 // marker position
167 $this->tpl->setCurrentBlock("marker_pos");
168 $this->tpl->setVariable("VAR_MARK_POS", "markpos[" . $i . "]");
169 $this->tpl->setVariable("ID_MARK_POS", "markpos_" . $i);
170 $this->tpl->setVariable("VAL_MARK_POS", $a_set["MarkerX"] . "," . $a_set["MarkerY"]);
171 $this->tpl->setVariable("TXT_MLEFT", $lng->txt("cont_left"));
172 $this->tpl->setVariable("TXT_MTOP", $lng->txt("cont_top"));
173 $this->tpl->parseCurrentBlock();
174
175 $this->tpl->setVariable("TYPE", $lng->txt("cont_marker"));
176 }
177
178 $this->tpl->setVariable(
179 "CHECKBOX",
180 ilUtil::formCheckBox("", "tr[]", $i)
181 );
182 $this->tpl->setVariable("VAR_NAME", "title[" . $i . "]");
183 $this->tpl->setVariable("VAL_NAME", $a_set["Title"]);
184
185
186 $this->tpl->setVariable("VAR_POS", "ovpos[" . $i . "]");
187 $this->tpl->setVariable("ID_OV_POS", "ovpos_" . $i);
188 $this->tpl->setVariable("ID_POP_POS", "poppos_" . $i);
189 $this->tpl->setVariable("VAR_POP_POS", "poppos[" . $i . "]");
190 $this->tpl->setVariable("VAR_POP_SIZE", "popsize[" . $i . "]");
191 $this->tpl->setVariable("VAL_POS", $a_set["OverlayX"] . "," . $a_set["OverlayY"]);
192 $this->tpl->setVariable("VAL_POP_POS", $a_set["PopupX"] . "," . $a_set["PopupY"]);
193 $this->tpl->setVariable("VAL_POP_SIZE", $a_set["PopupWidth"] . "," . $a_set["PopupHeight"]);
194 $this->tpl->setVariable("TXT_IMG", $lng->txt("image"));
195 $this->tpl->setVariable("TXT_TITLE", $lng->txt("title"));
196 $this->tpl->setVariable("TXT_LEFT", $lng->txt("cont_left"));
197 $this->tpl->setVariable("TXT_TOP", $lng->txt("cont_top"));
198 $this->tpl->setVariable("TXT_WIDTH", $lng->txt("cont_width"));
199 $this->tpl->setVariable("TXT_HEIGHT", $lng->txt("cont_height"));
200 $this->tpl->setVariable(
201 "OVERLAY_IMAGE",
202 ilUtil::formSelect($a_set["Overlay"], "ov[" . $i . "]", $this->ov_options, false, true)
203 );
204 $this->tpl->setVariable(
205 "CONTENT_POPUP",
206 ilUtil::formSelect($a_set["PopupNr"], "pop[" . $i . "]", $this->pop_options, false, true)
207 );
208 }
209}
An exception for terminatinating execution or to throw for unit testing.
TableGUI class for image map editor.
TableGUI class for pc image map editor.
fillRow($a_set)
Standard Version of Fill Row.
getItems()
Get items of current folder.
__construct( $a_parent_obj, $a_parent_cmd, $a_pc_media_object, $a_parent_node_name)
Constructor.
setData($a_data)
set table data @access public
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.
setId($a_val)
Set id.
addCommandButton($a_cmd, $a_text, $a_onclick='', $a_id="", $a_class=null)
Add Command button.
static sortArray( $array, $a_array_sortby, $a_array_sortorder=0, $a_numeric=false, $a_keep_keys=false)
sortArray
static formSelect( $selected, $varname, $options, $multiple=false, $direct_text=false, $size="0", $style_class="", $attribs="", $disabled=false)
Builds a select form field with options and shows the selected option first.
global $DIC
Definition: goto.php:24
$i
Definition: metadata.php:24
__construct(Container $dic, ilPlugin $plugin)
@inheritDoc
$a
thx to https://mlocati.github.io/php-cs-fixer-configurator for the examples