43 $this->ctrl = $DIC->ctrl();
44 $this->tpl = $DIC[
"tpl"];
45 $this->lng = $DIC->language();
46 $this->toolbar = $DIC->toolbar();
47 $this->media_object = $a_media_object;
58 $next_class =
$ilCtrl->getNextClass($this);
61 switch ($next_class) {
62 case "ilinternallinkgui":
63 require_once(
"./Services/Link/classes/class.ilInternalLinkGUI.php");
65 $link_gui->setSetLinkTargetScript(
71 $link_gui->filterLinkType(
"File");
76 require_once(
"./Services/MediaObjects/classes/class.ilObjMediaObjectGUI.php");
78 if (isset(
$_POST[
"editImagemapForward"]) ||
79 isset(
$_POST[
"editImagemapForward_x"]) ||
80 isset(
$_POST[
"editImagemapForward_y"])) {
81 $cmd =
"editImagemapForward";
108 $this->tpl =
new ilTemplate(
"tpl.map_edit.html",
true,
true,
"Services/MediaObjects");
109 $this->tpl->setVariable(
"FORMACTION",
$ilCtrl->getFormAction($this));
115 $this->tpl->setVariable(
"IMAGE_MAP",
$output);
117 $this->tpl->setVariable(
"TOOLBAR", $this->
getToolbar()->getHTML());
122 return $this->tpl->get();
138 $tb->setFormAction(
$ilCtrl->getFormAction($this));
139 include_once(
"./Services/Form/classes/class.ilSelectInputGUI.php");
141 "WholePicture" =>
$lng->txt(
"cont_WholePicture"),
142 "Rect" =>
$lng->txt(
"cont_Rect"),
143 "Circle" =>
$lng->txt(
"cont_Circle"),
144 "Poly" =>
$lng->txt(
"cont_Poly"),
148 $tb->addInputItem($si,
true);
149 $tb->addFormButton(
$lng->txt(
"cont_add_area"),
"addNewArea");
183 return $lng->txt(
"cont_imagemap");
192 include_once(
"./Services/MediaObjects/classes/class.ilImageMapTableGUI.php");
193 $image_map_table =
new ilImageMapTableGUI($this,
"editMapAreas", $this->media_object);
194 return $image_map_table->getHTML();
202 if (
$_GET[
"ref_id"] !=
"") {
206 if (
$_GET[
"obj_id"] !=
"") {
210 if (
$_GET[
"hier_id"] !=
"") {
214 if (
$_GET[
"pc_id"] !=
"") {
225 $item->outputMapWorkCopy();
236 $st_item = $this->media_object->getMediaItem(
"Standard");
238 for (
$i=1;
$i<=$max;
$i++) {
246 ilUtil::sendSuccess(
$lng->txt(
"cont_saved_map_data"),
true);
247 $ilCtrl->redirect($this,
"editMapAreas");
255 switch (
$_POST[
"shape"]) {
258 case "Circle":
return $this->
addCircle();
270 $_SESSION[
"il_map_edit_area_type"] =
"WholePicture";
281 $_SESSION[
"il_map_edit_area_type"] =
"Rect";
291 $_SESSION[
"il_map_edit_area_type"] =
"Circle";
301 $_SESSION[
"il_map_edit_area_type"] =
"Poly";
332 $area_type =
$_SESSION[
"il_map_edit_area_type"];
334 include_once(
"./Services/MediaObjects/classes/class.ilMapArea.php");
338 switch ($area_type) {
341 if ($cnt_coords < 2) {
344 } elseif ($cnt_coords == 2) {
351 if ($cnt_coords <= 1) {
354 if ($cnt_coords == 2) {
357 $coords .= round(sqrt(pow(abs(
$c[3]-
$c[1]), 2)+pow(abs(
$c[2]-
$c[0]), 2)));
367 if ($cnt_coords < 1) {
369 } elseif ($cnt_coords < 3) {
392 $a_get_next_coordinate =
false,
393 $a_output_new_area =
false,
394 $a_save_form =
false,
395 $a_edit_property =
"",
402 $area_type =
$_SESSION[
"il_map_edit_area_type"];
404 include_once(
"./Services/MediaObjects/classes/class.ilMapArea.php");
407 $this->tpl =
new ilTemplate(
"tpl.map_edit.html",
true,
true,
"Services/MediaObjects");
409 $this->tpl->setVariable(
"FORMACTION",
$ilCtrl->getFormAction($this));
411 if ($a_edit_property !=
"link") {
412 switch ($area_type) {
415 if ($cnt_coords == 0) {
418 if ($cnt_coords == 1) {
425 if ($cnt_coords == 0) {
428 if ($cnt_coords == 1) {
435 if ($cnt_coords == 0) {
437 } elseif ($cnt_coords < 3) {
449 if ($a_edit_property !=
"shape") {
451 $ilCtrl->setParameter($this,
"linkmode",
"map");
452 include_once(
"./Services/Link/classes/class.ilInternalLinkGUI.php");
453 $this->tpl->setCurrentBlock(
"int_link_prep");
463 $this->tpl->parseCurrentBlock();
466 $this->tpl->setVariable(
"FORM",
$form->getHTML());
477 $edit_mode = ($a_get_next_coordinate)
479 : (($a_output_new_area)
483 $this->tpl->setVariable(
"IMAGE_MAP",
$output);
485 return $this->tpl->get();
498 include_once(
"Services/Form/classes/class.ilPropertyFormGUI.php");
500 $form->setOpenTag(
false);
501 $form->setCloseTag(
false);
504 if ($a_edit_property !=
"shape") {
507 if (
$_SESSION[
"il_map_il_ltype"] !=
"int") {
511 $radg->setValue(
"ext");
514 $radg->setValue(
"int");
519 $radg->addOption($ext);
522 $ti->setMaxLength(800);
525 $ti->setValue(
$_SESSION[
"il_map_el_href"]);
527 $ti->setValue(
"http://");
529 $ext->addSubItem($ti);
533 $radg->addOption(
$int);
537 if (
$_SESSION[
"il_map_il_target"] !=
"") {
546 ' <a id="iosEditInternalLinkTrigger" href="#">' .
547 "[" .
$lng->txt(
"cont_get_link") .
"]" .
550 $int->addSubItem($ne);
554 $radg->addOption($no);
556 $form->addItem($radg);
561 if ($a_edit_property !=
"link" && $a_edit_property !=
"shape") {
569 if ($a_edit_property ==
"") {
570 $form->setTitle(
$lng->txt(
"cont_new_area"));
571 $form->addCommandButton(
"saveArea",
$lng->txt(
"save"));
573 $form->setTitle(
$lng->txt(
"cont_new_area"));
574 $form->addCommandButton(
"saveArea",
$lng->txt(
"save"));
586 $a_edit_property =
"",
588 $a_output_new_area =
false,
593 $st_item = $this->media_object->getMediaItem(
"Standard");
595 if ($a_edit_property ==
"shape") {
596 $st_item->makeMapWorkCopy($a_area_nr,
true);
598 $st_item->makeMapWorkCopy($a_area_nr,
false);
601 if ($a_output_new_area) {
602 $st_item->addAreaToMapWorkCopy($a_area_type, $a_coords);
613 $st_item = $this->media_object->getMediaItem(
"Standard");
621 $xsl = file_get_contents(
"./Services/COPage/xsl/page.xsl");
623 $args = array(
'/_xml' =>
$xml,
'/_xsl' => $xsl );
629 $random = new \ilRandom();
630 $params = array(
'map_edit_mode' => $a_map_edit_mode,
631 'map_item' => $st_item->getId(),
632 'map_mob_id' => $this->media_object->getId(),
634 'media_mode' =>
'enable',
635 'image_map_link' =>
$ilCtrl->getLinkTarget($this,
"showImageMap",
"",
false,
false),
636 'link_params' =>
"ref_id=" .
$_GET[
"ref_id"] .
"&rand=" . $random->int(1, 999999),
637 'ref_id' =>
$_GET[
"ref_id"],
640 'webspace_path' => $wb_path);
641 $output = xslt_process($xh,
"arg:/_xml",
"arg:/_xsl", null, $args,
$params);
689 $t_arr = explode(
"_", $a_target);
690 if ($a_frame !=
"") {
691 $frame_str =
" (" . $a_frame .
" Frame)";
694 case "StructureObject":
695 require_once(
"./Modules/LearningModule/classes/class.ilLMObject.php");
697 $link_str =
$lng->txt(
"chapter") .
698 ": " .
$title .
" [" . $t_arr[count($t_arr) - 1] .
"]" . $frame_str;
702 require_once(
"./Modules/LearningModule/classes/class.ilLMObject.php");
704 $link_str =
$lng->txt(
"page") .
705 ": " .
$title .
" [" . $t_arr[count($t_arr) - 1] .
"]" . $frame_str;
709 require_once(
"./Modules/Glossary/classes/class.ilGlossaryTerm.php");
711 $link_str =
$lng->txt(
"term") .
712 ": " . $term->getTerm() .
" [" . $t_arr[count($t_arr) - 1] .
"]" . $frame_str;
716 require_once(
"./Services/MediaObjects/classes/class.ilObjMediaObject.php");
718 $link_str =
$lng->txt(
"mob") .
719 ": " . $mob->getTitle() .
" [" . $t_arr[count($t_arr) - 1] .
"]" . $frame_str;
722 case "RepositoryItem":
726 $link_str =
$lng->txt(
"obj_" . $t_arr[count($t_arr) - 2]) .
727 ": " .
$title .
" [" . $t_arr[count($t_arr) - 1] .
"]" . $frame_str;
741 if (
$_SESSION[
"il_map_edit_coords"] !=
"") {
745 $_SESSION[
"il_map_edit_coords"] .=
$_POST[
"editImagemapForward_x"] .
"," .
746 $_POST[
"editImagemapForward_y"];
774 $st_item = $this->media_object->getMediaItem(
"Standard");
780 $area->setType(
$_SESSION[
"il_map_il_type"]);
781 $area->setTarget(
$_SESSION[
"il_map_il_target"]);
782 $area->setTargetFrame(
$_SESSION[
"il_map_il_targetframe"]);
796 $st_item = $this->media_object->getMediaItem(
"Standard");
801 $area->setCoords(
$_SESSION[
"il_map_edit_coords"]);
807 $area_type =
$_SESSION[
"il_map_edit_area_type"];
810 $st_item = $this->media_object->getMediaItem(
"Standard");
815 $area->setItemId($st_item->getId());
816 $area->setShape($area_type);
818 $area->setNr($max + 1);
820 switch (
$_POST[
"area_link_type"]) {
823 $area->setHref(
$_POST[
"area_link_ext"]);
828 $area->setType(
$_SESSION[
"il_map_il_type"]);
829 $area->setTarget(
$_SESSION[
"il_map_il_target"]);
830 $area->setTargetFrame(
$_SESSION[
"il_map_il_targetframe"]);
835 $st_item->addMapArea($area);
836 $this->media_object->update();
841 ilUtil::sendSuccess(
$lng->txt(
"cont_saved_map_area"),
true);
842 $ilCtrl->redirect($this,
"editMapAreas");
881 if (!isset(
$_POST[
"area"])) {
883 $ilCtrl->redirect($this,
"editMapAreas");
886 if (count(
$_POST[
"area"]) > 1) {
889 $ilCtrl->redirect($this,
"editMapAreas");
893 if (
$_SESSION[
"il_map_edit_mode"] !=
"edit_link") {
896 $_SESSION[
"il_map_edit_mode"] =
"edit_link";
897 $_SESSION[
"il_map_edit_target_script"] =
$ilCtrl->getLinkTarget($this,
"setLink");
915 $st_item = $this->media_object->getMediaItem(
"Standard");
916 $area = $st_item->getMapArea($a_nr);
917 return $area->getLinkType();
925 $st_item = $this->media_object->getMediaItem(
"Standard");
926 $area = $st_item->getMapArea($a_nr);
927 return $area->getType();
935 $st_item = $this->media_object->getMediaItem(
"Standard");
936 $area = $st_item->getMapArea($a_nr);
937 return $area->getTarget();
945 $st_item = $this->media_object->getMediaItem(
"Standard");
946 $area = $st_item->getMapArea($a_nr);
947 return $area->getTargetFrame();
955 $st_item = $this->media_object->getMediaItem(
"Standard");
956 $area = $st_item->getMapArea($a_nr);
957 return $area->getHref();
968 if (!isset(
$_POST[
"area"])) {
970 $ilCtrl->redirect($this,
"editMapAreas");
973 $st_item = $this->media_object->getMediaItem(
"Standard");
976 if (count(
$_POST[
"area"]) > 0) {
979 foreach (
$_POST[
"area"] as $area_nr) {
980 $st_item->deleteMapArea($area_nr -
$i);
984 $this->media_object->update();
985 ilUtil::sendSuccess(
$lng->txt(
"cont_areas_deleted"),
true);
988 $ilCtrl->redirect($this,
"editMapAreas");
1002 $_SESSION[
"il_map_il_targetframe"] =
"";
1013 $_SESSION[
"il_map_edit_area_type"] =
"WholePicture";
1023 $_SESSION[
"il_map_edit_area_type"] =
"Rect";
1033 $_SESSION[
"il_map_edit_area_type"] =
"Circle";
1043 $_SESSION[
"il_map_edit_area_type"] =
"Poly";
1058 if (
$_POST[
"areatype2"] !=
"") {
1061 if (
$_SESSION[
"il_map_area_nr"] !=
"") {
1064 if (!isset(
$_POST[
"area"])) {
1066 $ilCtrl->redirect($this,
"editMapAreas");
1069 if (count(
$_POST[
"area"]) > 1) {
1071 $ilCtrl->redirect($this,
"editMapAreas");
1074 if (
$_SESSION[
"il_map_edit_mode"] !=
"edit_shape") {
1076 $_SESSION[
"il_map_edit_mode"] =
"edit_shape";
1077 $_SESSION[
"il_map_edit_target_script"] =
$ilCtrl->getLinkTarget($this,
"setShape",
"",
false,
false);
1081 $area_type =
$_SESSION[
"il_map_edit_area_type"];
1086 switch ($area_type) {
1089 if ($cnt_coords < 2) {
1091 } elseif ($cnt_coords == 2) {
1098 if ($cnt_coords <= 1) {
1101 if ($cnt_coords == 2) {
1104 $coords .= round(sqrt(pow(abs(
$c[3]-
$c[1]), 2)+pow(abs(
$c[2]-
$c[0]), 2)));
1114 if ($cnt_coords < 1) {
1116 } elseif ($cnt_coords < 3) {
1124 case "WholePicture":
1140 $st_item = $this->media_object->getMediaItem(
"Standard");
1145 ilUtil::sendSuccess(
$lng->txt(
"msg_obj_modified"),
true);
1146 $ilCtrl->redirect($this,
"editMapAreas");
This class represents an option in a radio group.
static getInitHTML($a_url)
Get initialisation HTML to use interna link editing.
addPolygon()
Add a new polygon.
getImageMapOutput($a_map_edit_mode="")
Render the image map.
editShapeWholePicture()
Edit an existing shape (make it a whole picture link)
getEditorTitle()
Get editor title.
saveArea()
Save new or updated map area.
getLinkTypeOfArea($a_nr)
Get Link Type of Area.
clearSessionVars()
Clear Session Vars.
getTargetFrameOfArea($a_nr)
Get TargetFrame of Area (only internal link)
static _lookupTitle($a_id)
lookup object title
showImageMap()
show image map
static _lookupTitle($a_obj_id)
Lookup title.
editMapArea( $a_get_next_coordinate=false, $a_output_new_area=false, $a_save_form=false, $a_edit_property="", $a_area_nr=0)
Edit a single map area.
setInternalLink()
Set internal link.
initAreaEditingForm($a_edit_property)
Init area editing form.
getMapAreaLinkString($a_target, $a_type, $a_frame)
Get text name of internal link.
static sendInfo($a_info="", $a_keep=false)
Send Info Message to Screen.
editShapeCircle()
Edit an existing shape (make it a circle)
updateAreas()
Update map areas.
setHighlight()
Set highlight settings.
setLink($a_handle=true)
Set link.
if(isset($_POST['submit'])) $form
static getImagePath($img, $module_path="", $mode="output", $offline=false)
get image path (for images located in a template directory)
static _lookupObjId($a_id)
special template class to simplify handling of ITX/PEAR
This class represents a text property in a property form.
setTitle($a_title)
set (tooltip)title of area
editLink()
Edit existing link.
setMaxLength($a_maxlength)
Set Max Length.
outputPostProcessing($a_output)
Output post processing.
static stripSlashes($a_str, $a_strip_html=true, $a_allow="")
strip slashes if magic qoutes is enabled
deleteAreas()
Delete map areas.
setShape($a_handle=true)
edit shape of existing map area
handleMapParameters()
handle parameter during map area editing (storing to session)
static sendFailure($a_info="", $a_keep=false)
Send Failure Message to Screen.
editMapAreas()
Show map areas.
User interface class for map editor.
getHrefOfArea($a_nr)
Get Href of Area (only external link)
addArea($a_handle=true)
Handle adding new area process.
static _recoverParameters()
Recover parameters from session variables (static)
editShapePolygon()
Edit an existing shape (make it a polygon)
editImagemapForward()
Get image map coordinates.
setShape($a_shape)
set shape (IL_AREA_RECT, IL_AREA_CIRCLE, IL_AREA_POLY, IL_AREA_WHOLE_PICTURE)
__construct($a_media_object)
Constructor.
This class represents a non editable value in a property form.
linkWholePicture()
Link the whole picture.
static _getMaxNr($a_item_id)
get maximum nr of media item (static)
getAdditionalPageXML()
Get additional page xml (to be overwritten)
getTypeOfArea($a_nr)
Get Type of Area (only internal link)
TableGUI class for image map editor.
addCircle()
Add a new circle.
executeCommand()
Execute current command.
addRectangle()
Add a new rectangle.
getImageMapTableHTML()
Get table HTML.
setLinkType($a_link_type)
set link type
static redirect($a_script)
makeMapWorkCopy( $a_edit_property="", $a_area_nr=0, $a_output_new_area=false, $a_area_type="", $a_coords="")
Make work file for editing.
static getWebspaceDir($mode="filesystem")
get webspace directory
static countCoords($c)
count the number of coordinates (x,y) in a coordinate string (format: "x1,y1,x2,y2,x3,y3,...")
getTargetOfArea($a_nr)
Get Target of Area (only internal link)
editShapeRectangle()
Edit an existing shape (make it a rectangle)