ILIAS  release_5-1 Revision 5.0.0-5477-g43f3e3fab5f
class.ilPCIIMTriggerEditorGUI.php
Go to the documentation of this file.
1<?php
2
3/* Copyright (c) 1998-2009 ILIAS open source, Extended GPL, see docs/LICENSE */
4
5include_once("./Services/COPage/classes/class.ilPCImageMapEditorGUI.php");
6
18{
22 function __construct($a_content_obj, $a_page)
23 {
24 global $tpl;
25
26 $tpl->addJavascript("./Services/COPage/js/ilCOPagePres.js");
27
28 parent::__construct($a_content_obj, $a_page);
29 }
30
37 {
38 return "InteractiveImage";
39 }
40
46 function getEditorTitle()
47 {
48 global $lng;
49
50 return $lng->txt("cont_pc_iim");
51 }
52
57 {
58 global $tpl, $ilToolbar, $lng, $ilCtrl;
59
60 include_once("./Services/jQuery/classes/class.iljQueryUtil.php");
62
63 $tpl->addJavascript("./Services/COPage/js/ilCOPagePres.js");
64 $tpl->addJavascript("./Services/COPage/js/ilCOPagePCInteractiveImage.js");
65
66 include_once("./Services/Accordion/classes/class.ilAccordionGUI.php");
69
70 $ilToolbar->addText($lng->txt("cont_drag_element_click_save"));
71 $ilToolbar->setId("drag_toolbar");
72 $ilToolbar->setHidden(true);
73 $ilToolbar->addButton($lng->txt("save"),"#", "", "", "", "save_pos_button");
74
75 $ilToolbar->addButton($lng->txt("cancel"),
76 $ilCtrl->getLinkTarget($this, "editMapAreas"));
77
78 include_once("./Services/COPage/classes/class.ilPCIIMTriggerTableGUI.php");
79 $image_map_table = new ilPCIIMTriggerTableGUI($this, "editMapAreas", $this->content_obj,
80 $this->getParentNodeName());
81 return $image_map_table->getHTML();
82 }
83
89 function getToolbar()
90 {
91 global $ilCtrl, $lng;
92
93 // toolbar
94 $tb = new ilToolbarGUI();
95 $tb->setFormAction($ilCtrl->getFormAction($this));
96 include_once("./Services/Form/classes/class.ilSelectInputGUI.php");
97 $options = array(
98 "Rect" => $lng->txt("cont_Rect"),
99 "Circle" => $lng->txt("cont_Circle"),
100 "Poly" => $lng->txt("cont_Poly"),
101 "Marker" => $lng->txt("cont_marker")
102 );
103 $si = new ilSelectInputGUI($lng->txt("cont_trigger_area"), "shape");
104 $si->setOptions($options);
105 $tb->addInputItem($si, true);
106 $tb->addFormButton($lng->txt("add"), "addNewArea");
107
108 return $tb;
109 }
110
117 function addNewArea()
118 {
119 global $ilCtrl, $lng;
120
121 if ($_POST["shape"] == "Marker")
122 {
123 $this->content_obj->addTriggerMarker();
124 $this->updated = $this->page->update();
125 ilUtil::sendSuccess($lng->txt("cont_saved_map_data"), true);
126 $ilCtrl->redirect($this, "editMapAreas");
127 }
128 else
129 {
130 return parent::addNewArea();
131 }
132 }
133
139 public function initAreaEditingForm($a_edit_property)
140 {
141 global $lng, $ilCtrl;
142
143 include_once("Services/Form/classes/class.ilPropertyFormGUI.php");
144 $form = new ilPropertyFormGUI();
145 $form->setOpenTag(false);
146 $form->setCloseTag(false);
147
148 // name
149 if ($a_edit_property != "link" && $a_edit_property != "shape")
150 {
151 $ti = new ilTextInputGUI($lng->txt("cont_name"), "area_name");
152 $ti->setMaxLength(200);
153 $ti->setSize(20);
154 $ti->setRequired(true);
155 $form->addItem($ti);
156 }
157
158 // save and cancel commands
159 if ($a_edit_property == "")
160 {
161 $form->setTitle($lng->txt("cont_new_trigger_area"));
162 $form->addCommandButton("saveArea", $lng->txt("save"));
163 }
164 else
165 {
166 $form->setTitle($lng->txt("cont_new_area"));
167 $form->addCommandButton("saveArea", $lng->txt("save"));
168 }
169
170 return $form;
171 }
172
176 function saveArea()
177 {
178 global $lng, $ilCtrl;
179
180 switch ($_SESSION["il_map_edit_mode"])
181 {
182 // save edited shape
183 case "edit_shape":
184 $this->std_alias_item->setShape($_SESSION["il_map_area_nr"],
185 $_SESSION["il_map_edit_area_type"], $_SESSION["il_map_edit_coords"]);
186 $this->updated = $this->page->update();
187 break;
188
189 // save new area
190 default:
191 $area_type = $_SESSION["il_map_edit_area_type"];
192 $coords = $_SESSION["il_map_edit_coords"];
193 $this->content_obj->addTriggerArea($this->std_alias_item,
194 $area_type, $coords,
195 ilUtil::stripSlashes($_POST["area_name"]), $link);
196 $this->updated = $this->page->update();
197 break;
198 }
199
200 //$this->initMapParameters();
201 ilUtil::sendSuccess($lng->txt("cont_saved_map_area"), true);
202 $ilCtrl->redirect($this, "editMapAreas");
203 }
204
208 function updateTrigger()
209 {
210 global $lng, $ilCtrl;
211
212 $this->content_obj->setTriggerOverlays($_POST["ov"]);
213 $this->content_obj->setTriggerPopups($_POST["pop"]);
214 $this->content_obj->setTriggerOverlayPositions($_POST["ovpos"]);
215 $this->content_obj->setTriggerMarkerPositions($_POST["markpos"]);
216 $this->content_obj->setTriggerPopupPositions($_POST["poppos"]);
217 $this->content_obj->setTriggerPopupSize($_POST["popsize"]);
218 $this->content_obj->setTriggerTitles($_POST["title"]);
219 $this->updated = $this->page->update();
220 ilUtil::sendSuccess($lng->txt("msg_obj_modified"), true);
221 $ilCtrl->redirect($this, "editMapAreas");
222 }
223
228 {
229 global $ilCtrl, $tpl, $lng;
230
231 if (!is_array($_POST["tr"]) || count($_POST["tr"]) == 0)
232 {
233 ilUtil::sendFailure($lng->txt("no_checkbox"), true);
234 $ilCtrl->redirect($this, "editMapAreas");
235 }
236 else
237 {
238 include_once("./Services/Utilities/classes/class.ilConfirmationGUI.php");
239 $cgui = new ilConfirmationGUI();
240 $cgui->setFormAction($ilCtrl->getFormAction($this));
241 $cgui->setHeaderText($lng->txt("cont_really_delete_triggers"));
242 $cgui->setCancel($lng->txt("cancel"), "editMapAreas");
243 $cgui->setConfirm($lng->txt("delete"), "deleteTrigger");
244
245 foreach ($_POST["tr"] as $i)
246 {
247 $cgui->addItem("tr[]", $i, $_POST["title"][$i]);
248 }
249
250 $tpl->setContent($cgui->getHTML());
251 }
252 }
253
257 function deleteTrigger()
258 {
259 global $ilCtrl, $lng;
260
261 if (is_array($_POST["tr"]) && count($_POST["tr"]) > 0)
262 {
263 foreach ($_POST["tr"] as $tr_nr)
264 {
265 $this->content_obj->deleteTrigger($this->std_alias_item, $tr_nr);
266 }
267 $this->updated = $this->page->update();
268 ilUtil::sendSuccess($lng->txt("cont_areas_deleted"), true);
269 }
270
271 $ilCtrl->redirect($this, "editMapAreas");
272 }
273
280 {
281 return $this->page->getMultimediaXML();
282 }
283
290 function outputPostProcessing($a_output)
291 {
292
293 // for question html get the page gui object
294 include_once("./Services/COPage/classes/class.ilPageObjectGUI.php");
295 $pg_gui = new ilPageObjectGUI($this->page->getParentType(), $this->page->getId());
296 $pg_gui->setOutputMode(IL_PAGE_PREVIEW);
297 $pg_gui->getPageConfig()->setEnableSelfAssessment(true);
298// $pg_gui->initSelfAssessmentRendering(true); // todo: solve in other way
299 $qhtml = $pg_gui->getQuestionHTML();
300 if (is_array($qhtml))
301 {
302 foreach ($qhtml as $k => $h)
303 {
304 $a_output = str_replace($pg_gui->pl_start."Question;il__qst_$k".$pg_gui->pl_end, " ".$h, $a_output);
305 }
306 }
307// $a_output = $pg_gui->selfAssessmentRendering($a_output);
308
309 return $a_output;
310 }
311
312
313}
314?>
global $tpl
Definition: ilias.php:8
$_SESSION["AccountId"]
const IL_PAGE_PREVIEW
static addJavaScript()
Add javascript files that are necessary to run accordion.
static addCss()
Add required css.
Confirmation screen class.
User interface class for page content map editor.
__construct($a_content_obj, $a_page)
Constructor.
getParentNodeName()
Get parent node name.
confirmDeleteTrigger()
Confirm trigger deletion.
initAreaEditingForm($a_edit_property)
Init area editing form.
outputPostProcessing($a_output)
Output post processing.
getAdditionalPageXML()
Get additional page xml (to be overwritten)
saveArea()
Save new or updated map area.
TableGUI class for pc image map editor.
User interface class for page content map editor.
Class ilPageObjectGUI.
This class represents a property form user interface.
This class represents a selection list property in a property form.
This class represents a text property in a property form.
static sendSuccess($a_info="", $a_keep=false)
Send Success Message to Screen.
static sendFailure($a_info="", $a_keep=false)
Send Failure Message to Screen.
static stripSlashes($a_str, $a_strip_html=true, $a_allow="")
strip slashes if magic qoutes is enabled
static initjQueryUI()
Init jQuery UI (see included_components.txt for included components)
$_POST['username']
Definition: cron.php:12
$h
$coords
Definition: example_030.php:88
global $ilCtrl
Definition: ilias.php:18
global $lng
Definition: privfeed.php:40
if(!is_array($argv)) $options