5 require_once (
"./Services/COPage/classes/class.ilPageContentGUI.php");
6 require_once (
"./Services/COPage/classes/class.ilPCInteractiveImage.php");
7 include_once(
"./Services/COPage/classes/class.ilMediaAliasItem.php");
21 function __construct($a_pg_obj, $a_content_obj, $a_hier_id = 0, $a_pc_id =
"")
37 $next_class = $this->ctrl->getNextClass($this);
40 $cmd = $this->ctrl->getCmd();
42 if (is_object ($this->content_obj))
45 $this->
getTabs($this->tabs_gui);
65 case "ilpciimtriggereditorgui":
66 require_once(
"./Services/COPage/classes/class.ilPCIIMTriggerEditorGUI.php");
67 $ilTabs->setTabActive(
"triggers");
70 $ret = $this->ctrl->forwardCommand($image_map_edit);
71 $tpl->setContent(
$ret);
88 function getTabs(&$tab_gui, $a_create =
false, $a_change_obj_ref =
false)
95 $ilTabs->setBackTarget($lng->txt(
"pg"),
96 $ilCtrl->getParentReturn($this)
99 $ilTabs->addTab(
"triggers",
100 $lng->txt(
"cont_active_areas"),
101 $ilCtrl->getLinkTargetByClass(
"ilpciimtriggereditorgui",
"editMapAreas")
104 $ilTabs->addTab(
"list_overlays",
105 $lng->txt(
"cont_overlay_images"),
106 $ilCtrl->getLinkTarget($this,
"listOverlayImages")
109 $ilTabs->addTab(
"content_popups",
110 $lng->txt(
"cont_content_popups"),
111 $ilCtrl->getLinkTarget($this,
"listContentPopups")
114 $ilTabs->addTab(
"edit_base_image",
115 $lng->txt(
"cont_base_image").
" & ".$lng->txt(
"cont_caption"),
116 $ilCtrl->getLinkTarget($this,
"editBaseImage")
125 function insert($a_post_cmd =
"edpost", $a_submit_cmd =
"create_mob", $a_input_error =
false)
142 $form->setFormAction($ilCtrl->getFormAction($this));
146 $tpl->setContent($form->getHTML());
156 $ilCtrl->redirectByClass(array(
"ilpcinteractiveimagegui",
"ilpciimtriggereditorgui"),
"editMapAreas");
170 $ilTabs->activateTab(
"edit_base_image");
173 $tpl->setContent($form->getHTML());
186 include_once(
"Services/Form/classes/class.ilPropertyFormGUI.php");
191 $fi->setAllowDeletion(
false);
192 if ($a_mode ==
"edit")
194 $fi->
setImage($this->content_obj->getBaseThumbnailTarget());
198 if ($a_mode ==
"edit")
201 $ti =
new ilTextInputGUI($this->lng->txt(
"cont_caption"),
"caption");
208 if ($a_mode ==
"create")
210 $form->setTitle($lng->txt(
"cont_ed_insert_iim"));
211 $form->addCommandButton(
"create_iim", $lng->txt(
"save"));
212 $form->addCommandButton(
"cancelCreate", $lng->txt(
"cancel"));
218 $this->content_obj->getPcId(),
"InteractiveImage");
219 $ti->setValue($std_alias_item->getCaption());
221 $form->setTitle($lng->txt(
"cont_edit_base_image"));
222 $form->addCommandButton(
"update", $lng->txt(
"save"));
225 $form->setFormAction($ilCtrl->getFormAction($this));
238 $this->content_obj->createMediaObject();
239 $media_obj = $this->content_obj->getMediaObject();
240 $media_obj->setTitle($_FILES[
'image_file'][
'name']);
241 $media_obj->create();
244 $media_obj->createDirectory();
246 $media_obj->addMediaItem($media_item);
247 $media_item->setPurpose(
"Standard");
249 $file = $mob_dir.
"/".$_FILES[
'image_file'][
'name'];
251 $_FILES[
'image_file'][
'name'],
$file);
255 $location = $_FILES[
'image_file'][
'name'];
258 $media_item->setFormat($format);
260 $media_item->setLocationType(
"LocalFile");
263 $media_obj->update();
265 $this->content_obj->createAlias($this->pg_obj, $this->hier_id, $this->pc_id);
266 $this->updated = $this->pg_obj->update();
267 if ($this->updated ===
true)
269 $this->pg_obj->stripHierIDs();
270 $this->pg_obj->addHierIDs();
271 $ilCtrl->setParameter($this,
"hier_id", $this->content_obj->readHierId());
272 $ilCtrl->setParameter($this,
"pc_id", $this->content_obj->readPCId());
273 $this->content_obj->setHierId($this->content_obj->readHierId());
274 $this->
setHierId($this->content_obj->readHierId());
275 $this->content_obj->setPCId($this->content_obj->readPCId());
277 $this->ctrl->redirectByClass(
"ilpcinteractiveimagegui",
"edit");
294 $mob = $this->content_obj->getMediaObject();
296 $std_item = $mob->getMediaItem(
"Standard");
297 $location = $_FILES[
'image_file'][
'name'];
299 if (
$location !=
"" && is_file($_FILES[
'image_file'][
'tmp_name']))
301 $file = $mob_dir.
"/".$_FILES[
'image_file'][
'name'];
303 $_FILES[
'image_file'][
'name'],
$file);
307 $location = $_FILES[
'image_file'][
'name'];
308 $std_item->setFormat($format);
310 $std_item->setLocationType(
"LocalFile");
311 $mob->setDescription($format);
317 $this->content_obj->getPcId(),
"InteractiveImage");
319 $_SESSION[
"il_pg_error"] = $this->pg_obj->update();
322 $ilCtrl->redirectByClass(
"ilpcinteractiveimagegui",
"editBaseImage");
332 $this->content_obj->getPcId(),
"InteractiveImage");
334 $_SESSION[
"il_pg_error"] = $this->pg_obj->update();
335 $this->ctrl->returnToParent($this,
"jump".$this->hier_id);
344 $this->content_obj->getPcId(),
"InteractiveImage");
346 $_SESSION[
"il_pg_error"] = $this->pg_obj->update();
347 $this->ctrl->returnToParent($this,
"jump".$this->hier_id);
356 $this->content_obj->getPcId(),
"InteractiveImage");
358 $_SESSION[
"il_pg_error"] = $this->pg_obj->update();
359 $this->ctrl->returnToParent($this,
"jump".$this->hier_id);
368 $this->content_obj->getPcId(),
"InteractiveImage");
370 $_SESSION[
"il_pg_error"] = $this->pg_obj->update();
371 $this->ctrl->returnToParent($this,
"jump".$this->hier_id);
380 $this->content_obj->getPcId(),
"InteractiveImage");
382 $_SESSION[
"il_pg_error"] = $this->pg_obj->update();
383 $this->ctrl->returnToParent($this,
"jump".$this->hier_id);
402 $ilTabs->setTabActive(
"list_overlays");
404 $ilToolbar->addButton($lng->txt(
"cont_add_images"),
405 $ilCtrl->getLinkTarget($this,
"addOverlayImages"));
407 include_once(
"./Services/COPage/classes/class.ilPCIIMOverlaysTableGUI.php");
409 $this->content_obj->getMediaObject());
410 $tpl->setContent(
$tab->getHTML());
429 $tpl->setContent($form->getHTML());
442 $ilTabs->setTabActive(
"list_overlays");
444 include_once(
"Services/Form/classes/class.ilPropertyFormGUI.php");
446 $form->setTitle($lng->txt(
"cont_add_images"));
447 $form->setFormAction($ilCtrl->getFormAction($this));
450 include_once(
"./Services/Form/classes/class.ilFileWizardInputGUI.php");
452 $fi->
setSuffixes(array(
"gif",
"jpeg",
"jpg",
"png"));
453 $fi->setFilenames(array(0 =>
''));
454 $fi->setRequired(
true);
457 $form->addCommandButton(
"uploadOverlayImages", $lng->txt(
"upload"));
458 $form->addCommandButton(
"listOverlayImages", $lng->txt(
"cancel"));
475 if ($form->checkInput())
477 if (is_array($_FILES[
"ovfile"][
"name"]))
479 foreach ($_FILES[
"ovfile"][
"name"] as $k => $v)
481 $name = $_FILES[
"ovfile"][
"name"][$k];
482 $mime = $_FILES[
"ovfile"][
"type"][$k];
483 $tmp_name = $_FILES[
"ovfile"][
"tmp_name"][$k];
484 $size = $_FILES[
"ovfile"][
"size"][$k];
486 $this->content_obj->getMediaObject()->uploadAdditionalFile($name,
487 $tmp_name,
"overlays");
488 $piname = pathinfo($name);
489 $this->content_obj->getMediaObject()->makeThumbnail(
"overlays/".$name,
490 basename($name,
".".$piname[
'extension']).
".png");
494 $ilCtrl->redirect($this,
"listOverlayImages");
498 $form->setValuesByPost();
510 $ilTabs->setTabActive(
"list_overlays");
512 if (!is_array(
$_POST[
"file"]) || count(
$_POST[
"file"]) == 0)
515 $ilCtrl->redirect($this,
"listOverlayImages");
519 include_once(
"./Services/Utilities/classes/class.ilConfirmationGUI.php");
521 $cgui->setFormAction($ilCtrl->getFormAction($this));
522 $cgui->setHeaderText($lng->txt(
"cont_really_delete_overlays"));
523 $cgui->setCancel($lng->txt(
"cancel"),
"listOverlayImages");
524 $cgui->setConfirm($lng->txt(
"delete"),
"deleteOverlays");
526 foreach (
$_POST[
"file"] as $i =>
$d)
528 $cgui->addItem(
"file[]", $i, $i);
531 $tpl->setContent($cgui->getHTML());
542 if (is_array(
$_POST[
"file"]) && count(
$_POST[
"file"]) != 0)
544 foreach (
$_POST[
"file"] as $f)
547 $this->content_obj->getMediaObject()
548 ->removeAdditionalFile(
"overlays/".$f);
553 $ilCtrl->redirect($this,
"listOverlayImages");
570 $ilTabs->setTabActive(
"content_popups");
572 $ilToolbar->addButton($lng->txt(
"cont_add_popup"),
573 $ilCtrl->getLinkTarget($this,
"addPopup"));
575 include_once(
"./Services/COPage/classes/class.ilPCIIMPopupTableGUI.php");
578 $tpl->setContent(
$tab->getHTML());
591 $this->content_obj->addContentPopup();
592 $this->pg_obj->update();
594 $ilCtrl->redirect($this,
"listContentPopups");
604 if (is_array(
$_POST[
"title"]))
607 $this->content_obj->savePopUps($titles);
608 $this->pg_obj->update();
611 $ilCtrl->redirect($this,
"listContentPopups");
621 $ilTabs->setTabActive(
"content_popups");
623 if (!is_array(
$_POST[
"tid"]) || count(
$_POST[
"tid"]) == 0)
626 $ilCtrl->redirect($this,
"listContentPopups");
630 include_once(
"./Services/Utilities/classes/class.ilConfirmationGUI.php");
632 $cgui->setFormAction($ilCtrl->getFormAction($this));
633 $cgui->setHeaderText($lng->txt(
"cont_really_delete_popups"));
634 $cgui->setCancel($lng->txt(
"cancel"),
"listContentPopups");
635 $cgui->setConfirm($lng->txt(
"delete"),
"deletePopups");
639 $cgui->addItem(
"tid[]", $i,
$_POST[
"title"][$i]);
642 $tpl->setContent($cgui->getHTML());
656 if (is_array(
$_POST[
"tid"]) && count(
$_POST[
"tid"]) != 0)
658 foreach (
$_POST[
"tid"] as $id)
660 $id = explode(
":", $id);
661 $this->content_obj->deletePopup($id[0], $id[1]);
663 $this->pg_obj->update();
666 $ilCtrl->redirect($this,
"listContentPopups");