24 require_once(
"./Services/COPage/classes/class.ilPCMap.php");
25 require_once(
"./Services/COPage/classes/class.ilPageContentGUI.php");
44 function ilPCMapGUI(&$a_pg_obj, &$a_content_obj, $a_hier_id, $a_pc_id =
"")
55 $next_class = $this->ctrl->getNextClass($this);
58 $cmd = $this->ctrl->getCmd();
79 $tpl->setContent($this->form->getHTML());
85 function edit($a_insert =
false)
92 $tpl->setContent($this->form->getHTML());
104 $values[
"location"][
"latitude"] = $this->content_obj->getLatitude();
105 $values[
"location"][
"longitude"] = $this->content_obj->getLongitude();
106 $values[
"location"][
"zoom"] = $this->content_obj->getZoom();
107 $values[
"width"] = $this->content_obj->getWidth();
108 $values[
"height"] = $this->content_obj->getHeight();
109 $values[
"caption"] = $this->content_obj->handleCaptionFormOutput($this->content_obj->getCaption());
110 $values[
"horizontal_align"] = $this->content_obj->getHorizontalAlign();
112 $this->form->setValuesByArray($values);
123 include_once(
"./Services/Form/classes/class.ilPropertyFormGUI.php");
125 $this->form->setFormAction($ilCtrl->getFormAction($this));
126 if ($a_mode ==
"create")
128 $this->form->setTitle($this->lng->txt(
"cont_insert_map"));
132 $this->form->setTitle($this->lng->txt(
"cont_update_map"));
139 $this->form->addItem($loc_prop);
145 $width_prop->setMaxLength(4);
146 $width_prop->setRequired(
true);
147 $width_prop->setMinValue(250);
148 $this->form->addItem($width_prop);
154 $height_prop->setMaxLength(4);
155 $height_prop->setRequired(
true);
156 $height_prop->setMinValue(200);
157 $this->form->addItem($height_prop);
163 "Left" => $lng->txt(
"cont_left"),
164 "Center" => $lng->txt(
"cont_center"),
165 "Right" => $lng->txt(
"cont_right"),
166 "LeftFloat" => $lng->txt(
"cont_left_float"),
167 "RightFloat" => $lng->txt(
"cont_right_float"));
169 $this->form->addItem($align_prop);
174 $this->form->addItem($caption_prop);
177 if ($a_mode ==
"create")
179 $this->form->addCommandButton(
"create_map", $lng->txt(
"save"));
180 $this->form->addCommandButton(
"cancelCreate", $lng->txt(
"cancel"));
184 $this->form->addCommandButton(
"update_map", $lng->txt(
"save"));
185 $this->form->addCommandButton(
"cancelUpdate", $lng->txt(
"cancel"));
198 if ($this->form->checkInput())
200 $this->content_obj =
new ilPCMap($this->dom);
201 $location = $this->form->getInput(
"location");
202 $this->content_obj->create($this->pg_obj, $this->hier_id, $this->pc_id);
203 $this->content_obj->setLatitude(
$location[
"latitude"]);
204 $this->content_obj->setLongitude(
$location[
"longitude"]);
205 $this->content_obj->setZoom(
$location[
"zoom"]);
206 $this->content_obj->setLayout($this->form->getInput(
"width"),
207 $this->form->getInput(
"height"),
208 $this->form->getInput(
"horizontal_align"));
209 $this->content_obj->setCaption(
210 $this->content_obj->handleCaptionInput($this->form->getInput(
"caption")));
211 $this->updated = $this->pg_obj->update();
212 if ($this->updated ===
true)
214 $this->ctrl->returnToParent($this,
"jump".$this->hier_id);
219 $this->form->setValuesByPost();
220 $tpl->setContent($this->form->getHTML());
229 if ($this->form->checkInput())
231 $location = $this->form->getInput(
"location");
232 $this->content_obj->setLatitude(
$location[
"latitude"]);
233 $this->content_obj->setLongitude(
$location[
"longitude"]);
234 $this->content_obj->setZoom(
$location[
"zoom"]);
235 $this->content_obj->setLayout($this->form->getInput(
"width"),
236 $this->form->getInput(
"height"),
237 $this->form->getInput(
"horizontal_align"));
238 $this->content_obj->setCaption(
239 $this->content_obj->handleCaptionInput($this->form->getInput(
"caption")));
240 $this->updated = $this->pg_obj->update();
241 if ($this->updated ===
true)
243 $this->ctrl->returnToParent($this,
"jump".$this->hier_id);
248 $this->form->setValuesByPost();
249 $tpl->setContent($this->form->getHTML());