ILIAS  release_5-1 Revision 5.0.0-5477-g43f3e3fab5f
class.ilImageMapTableGUI.php
Go to the documentation of this file.
1<?php
2
3/* Copyright (c) 1998-2010 ILIAS open source, Extended GPL, see docs/LICENSE */
4
5include_once("Services/Table/classes/class.ilTable2GUI.php");
6
16{
17
21 function __construct($a_parent_obj, $a_parent_cmd, $a_media_object)
22 {
23 global $ilCtrl, $lng, $ilAccess, $lng;
24
25 parent::__construct($a_parent_obj, $a_parent_cmd);
26 $this->media_object = $a_media_object;
27
28 include_once("./Services/MediaObjects/classes/class.ilMapArea.php");
29 $this->highl_modes = ilMapArea::getAllHighlightModes();
30 $this->highl_classes = ilMapArea::getAllHighlightClasses();
31
32 $this->initColumns();
33 $this->setEnableHeader(true);
34 $this->setFormAction($ilCtrl->getFormAction($a_parent_obj));
35 $this->setRowTemplate("tpl.image_map_table_row.html", "Services/MediaObjects");
36 $this->getItems();
37
38 // action commands
39 $this->initActions();
40
41 $this->setDefaultOrderField("title");
42 $this->setDefaultOrderDirection("asc");
43 $this->setEnableTitle(false);
44 }
45
49 function initColumns()
50 {
51 $this->addColumn("", "", "1"); // checkbox
52 $this->addColumn($this->lng->txt("cont_name"), "title", "");
53 $this->addColumn($this->lng->txt("cont_shape"), "", "");
54 $this->addColumn($this->lng->txt("cont_coords"), "", "");
55 $this->addColumn($this->lng->txt("cont_highlight_mode"));
56 $this->addColumn($this->lng->txt("cont_highlight_class"));
57 $this->addColumn($this->lng->txt("cont_link"), "", "");
58 }
59
63 function initActions()
64 {
65 global $lng;
66
67 // action commands
68 $this->addMultiCommand("deleteAreas", $lng->txt("delete"));
69 $this->addMultiCommand("editLink", $lng->txt("cont_set_link"));
70 $this->addMultiCommand("editShapeWholePicture", $lng->txt("cont_edit_shape_whole_picture"));
71 $this->addMultiCommand("editShapeRectangle", $lng->txt("cont_edit_shape_rectangle"));
72 $this->addMultiCommand("editShapeCircle", $lng->txt("cont_edit_shape_circle"));
73 $this->addMultiCommand("editShapePolygon", $lng->txt("cont_edit_shape_polygon"));
74
75 $data = $this->getData();
76 if (count($data) > 0)
77 {
78 $this->addCommandButton("updateAreas", $lng->txt("save"));
79 }
80 }
81
82
86 function getItems()
87 {
88 $st_item =& $this->media_object->getMediaItem("Standard");
89 $max = ilMapArea::_getMaxNr($st_item->getId());
90 $areas = array();
91
92 include_once("./Services/MediaObjects/classes/class.ilMapArea.php");
93 for ($i=1; $i<=$max; $i++)
94 {
95 $area = new ilMapArea($st_item->getId(), $i);
96 $areas[] = array("nr" => $i, "area" => $area, "title" => $area->getTitle());
97 }
98
99 $this->setData($areas);
100 }
101
106 protected function fillRow($a_set)
107 {
108 global $lng, $ilCtrl, $ilAccess;
109
110 $area = $a_set["area"];
111 $i = $a_set["nr"];
112 $this->tpl->setVariable("CHECKBOX",
113 ilUtil::formCheckBox("", "area[]", $i));
114 $this->tpl->setVariable("VAR_NAME", "name_".$i);
115 $this->tpl->setVariable("VAL_NAME", ilUtil::prepareFormOutput($area->getTitle()));
116 $this->tpl->setVariable("VAL_SHAPE", $area->getShape());
117
118 $this->tpl->setVariable("VAL_HIGHL_MODE",
119 ilUtil::formSelect($area->getHighlightMode(), "hl_mode_".$i,
120 $this->highl_modes, false, true));
121 $this->tpl->setVariable("VAL_HIGHL_CLASS",
122 ilUtil::formSelect($area->getHighlightClass(), "hl_class_".$i,
123 $this->highl_classes, false, true));
124
125 $this->tpl->setVariable("VAL_COORDS",
126 implode(explode(",", $area->getCoords()), ", "));
127 switch ($area->getLinkType())
128 {
129 case "ext":
130 $this->tpl->setVariable("VAL_LINK", $area->getHRef());
131 break;
132
133 case "int":
134 $link_str = $this->parent_obj->getMapAreaLinkString($area->getTarget(),
135 $area->getType(), $area->getTargetFrame());
136 $this->tpl->setVariable("VAL_LINK", $link_str);
137 break;
138 }
139 }
140
141}
142?>
TableGUI class for image map editor.
__construct($a_parent_obj, $a_parent_cmd, $a_media_object)
Constructor.
getItems()
Get items of current folder.
fillRow($a_set)
Standard Version of Fill Row.
Class ilMapArea.
getAllHighlightModes()
Get all highlight modes.
getAllHighlightClasses()
Get all highlight classes.
_getMaxNr($a_item_id)
get maximum nr of media item (static)
Class ilTable2GUI.
setEnableHeader($a_enableheader)
Set Enable Header.
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.
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.
setDefaultOrderField($a_defaultorderfield)
Set Default order field.
setFormAction($a_form_action, $a_multipart=false)
Set Form action parameter.
setDefaultOrderDirection($a_defaultorderdirection)
Set Default order direction.
addCommandButton($a_cmd, $a_text, $a_onclick='', $a_id="", $a_class=null)
Add Command button.
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.
static prepareFormOutput($a_str, $a_strip=false)
prepares string output for html forms @access public
global $ilCtrl
Definition: ilias.php:18
global $lng
Definition: privfeed.php:40