ILIAS  Release_3_10_x_branch Revision 61812
 All Data Structures Namespaces Files Functions Variables Groups Pages
ilImageMapEditorGUI Class Reference

User interface class for map editor. More...

+ Inheritance diagram for ilImageMapEditorGUI:
+ Collaboration diagram for ilImageMapEditorGUI:

Public Member Functions

 __construct ($a_media_object)
 Constructor.
 executeCommand ()
 Execute current command.
 editMapAreas ()
 Show map areas.
 getImageMapTableHTML ()
 Get table HTML.
 handleMapParameters ()
 handle parameter during map area editing (storing to session)
 showImageMap ()
 show image map
 updateAreas ()
 Update map areas.
 addRectangle ()
 Add a new rectangle.
 addCircle ()
 Add a new circle.
 addPolygon ()
 Add a new polygon.
 clearSessionVars ()
 Clear Session Vars.
 addArea ($a_handle=true)
 Handle adding new area process.
 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.
 makeMapWorkCopy ($a_edit_property="", $a_area_nr=0, $a_output_new_area=false, $a_area_type="", $a_coords="")
 Make work file for editing.
 getImageMapOutput ($a_map_edit_mode="")
 Render the image map.
 getAliasXML ()
 getMapAreaLinkString ($a_target, $a_type, $a_frame)
 Get text name of internal link.
 editImagemapForward ()
 Get image map coordinates.
 _recoverParameters ()
 Recover parameters from session variables (static)
 saveArea ()
 Save new or updated map area.
 setInternalLink ()
 Set internal link.
 setLink ($a_handle=true)
 Set link.
 getLinkTypeOfArea ($a_nr)
 Get Link Type of Area.
 getTypeOfArea ($a_nr)
 Get Type of Area (only internal link)
 getTargetOfArea ($a_nr)
 Get Target of Area (only internal link)
 getTargetFrameOfArea ($a_nr)
 Get TargetFrame of Area (only internal link)
 getHrefOfArea ($a_nr)
 Get Href of Area (only external link)
 deleteAreas ()
 Delete map areas.
 editLink ()
 Edit existing link.
 editShapeRectangle ()
 Edit an existing shape (make it a rectangle)
 editShapeCircle ()
 Edit an existing shape (make it a circle)
 editShapePolygon ()
 Edit an existing shape (make it a polygon)
 setShape ($a_handle=true)
 edit shape of existing map area

Detailed Description

User interface class for map editor.

Author
Alex Killing alex..nosp@m.kill.nosp@m.ing@g.nosp@m.mx.d.nosp@m.e
Version
$Id$

ilImageMapEditorGUI: ilInternalLinkGUI

Definition at line 34 of file class.ilImageMapEditorGUI.php.

Constructor & Destructor Documentation

ilImageMapEditorGUI::__construct (   $a_media_object)

Constructor.

Definition at line 39 of file class.ilImageMapEditorGUI.php.

{
$this->media_object = $a_media_object;
}

Member Function Documentation

ilImageMapEditorGUI::_recoverParameters ( )

Recover parameters from session variables (static)

Definition at line 588 of file class.ilImageMapEditorGUI.php.

References $_GET, and $_SESSION.

Referenced by editImagemapForward(), and ilInternalLinkGUI\showLinkHelp().

{
$_GET["ref_id"] = $_SESSION["il_map_edit_ref_id"];
$_GET["obj_id"] = $_SESSION["il_map_edit_obj_id"];
$_GET["hier_id"] = $_SESSION["il_map_edit_hier_id"];
$_GET["pc_id"] = $_SESSION["il_map_edit_pc_id"];
}

+ Here is the caller graph for this function:

ilImageMapEditorGUI::addArea (   $a_handle = true)

Handle adding new area process.

Definition at line 221 of file class.ilImageMapEditorGUI.php.

References $_SESSION, ilMapArea\countCoords(), editMapArea(), and handleMapParameters().

Referenced by addCircle(), addPolygon(), addRectangle(), and setInternalLink().

{
// handle map parameters
if($a_handle)
{
}
$area_type = $_SESSION["il_map_edit_area_type"];
$coords = $_SESSION["il_map_edit_coords"];
include_once("./Services/MediaObjects/classes/class.ilMapArea.php");
$cnt_coords = ilMapArea::countCoords($coords);
// decide what to do next
switch ($area_type)
{
// Rectangle
case "Rect" :
if ($cnt_coords < 2)
{
$html = $this->editMapArea(true, false, false);
return $html;
}
else if ($cnt_coords == 2)
{
return $this->editMapArea(false, true, true);
}
break;
// Circle
case "Circle":
if ($cnt_coords <= 1)
{
return $this->editMapArea(true, false, false);
}
else
{
if ($cnt_coords == 2)
{
$c = explode(",",$coords);
$coords = $c[0].",".$c[1].","; // determine radius
$coords .= round(sqrt(pow(abs($c[3]-$c[1]),2)+pow(abs($c[2]-$c[0]),2)));
}
$_SESSION["il_map_edit_coords"] = $coords;
return $this->editMapArea(false, true, true);
}
break;
// Polygon
case "Poly":
if ($cnt_coords < 1)
{
return $this->editMapArea(true, false, false);
}
else if ($cnt_coords < 3)
{
return $this->editMapArea(true, true, false);
}
else
{
return $this->editMapArea(true, true, true);
}
break;
}
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilImageMapEditorGUI::addCircle ( )

Add a new circle.

Definition at line 185 of file class.ilImageMapEditorGUI.php.

References $_SESSION, addArea(), and clearSessionVars().

{
$this->clearSessionVars();
$_SESSION["il_map_edit_area_type"] = "Circle";
return $this->addArea(false);
}

+ Here is the call graph for this function:

ilImageMapEditorGUI::addPolygon ( )

Add a new polygon.

Definition at line 195 of file class.ilImageMapEditorGUI.php.

References $_SESSION, addArea(), and clearSessionVars().

{
$this->clearSessionVars();
$_SESSION["il_map_edit_area_type"] = "Poly";
return $this->addArea(false);
}

+ Here is the call graph for this function:

ilImageMapEditorGUI::addRectangle ( )

Add a new rectangle.

Definition at line 175 of file class.ilImageMapEditorGUI.php.

References $_SESSION, addArea(), and clearSessionVars().

{
$this->clearSessionVars();
$_SESSION["il_map_edit_area_type"] = "Rect";
return $this->addArea(false);
}

+ Here is the call graph for this function:

ilImageMapEditorGUI::clearSessionVars ( )

Clear Session Vars.

Definition at line 205 of file class.ilImageMapEditorGUI.php.

References $_SESSION.

Referenced by addCircle(), addPolygon(), addRectangle(), editShapeCircle(), editShapePolygon(), and editShapeRectangle().

{
$_SESSION["il_map_area_nr"] = "";
$_SESSION["il_map_edit_coords"] = "";
$_SESSION["il_map_edit_mode"] = "";
$_SESSION["il_map_el_href"] = "";
$_SESSION["il_map_il_type"] = "";
$_SESSION["il_map_il_ltype"] = "";
$_SESSION["il_map_il_target"] = "";
$_SESSION["il_map_il_targetframe"] = "";
$_SESSION["il_map_edit_area_type"] = "";
}

+ Here is the caller graph for this function:

ilImageMapEditorGUI::deleteAreas ( )

Delete map areas.

Reimplemented in ilPCImageMapEditorGUI.

Definition at line 803 of file class.ilImageMapEditorGUI.php.

References $ilCtrl, $lng, ilMapArea\_getMaxNr(), and ilUtil\sendInfo().

{
global $ilCtrl, $lng;
if (!isset($_POST["area"]))
{
ilUtil::sendInfo($lng->txt("no_checkbox"), true);
$ilCtrl->redirect($this, "editMapAreas");
}
$st_item = $this->media_object->getMediaItem("Standard");
$max = ilMapArea::_getMaxNr($st_item->getId());
if (count($_POST["area"]) > 0)
{
$i = 0;
foreach ($_POST["area"] as $area_nr)
{
$st_item->deleteMapArea($area_nr - $i);
$i++;
}
$this->media_object->update();
ilUtil::sendInfo($lng->txt("cont_areas_deleted"), true);
}
$ilCtrl->redirect($this, "editMapAreas");
}

+ Here is the call graph for this function:

ilImageMapEditorGUI::editImagemapForward ( )

Get image map coordinates.

Definition at line 569 of file class.ilImageMapEditorGUI.php.

References $_SESSION, _recoverParameters(), and ilUtil\redirect().

{
if ($_SESSION["il_map_edit_coords"] != "")
{
$_SESSION["il_map_edit_coords"] .= ",";
}
$_SESSION["il_map_edit_coords"] .= $_POST["editImagemapForward_x"].",".
$_POST["editImagemapForward_y"];
// call editing script
ilUtil::redirect($_SESSION["il_map_edit_target_script"]);
}

+ Here is the call graph for this function:

ilImageMapEditorGUI::editLink ( )

Edit existing link.

Definition at line 836 of file class.ilImageMapEditorGUI.php.

References $_SESSION, and setLink().

{
$_SESSION["il_map_edit_coords"] = "";
$_SESSION["il_map_edit_mode"] = "";
$_SESSION["il_map_el_href"] = "";
$_SESSION["il_map_il_type"] = "";
$_SESSION["il_map_il_ltype"] = "";
$_SESSION["il_map_il_target"] = "";
$_SESSION["il_map_il_targetframe"] = "";
$_SESSION["il_map_area_nr"] = "";
return $this->setLink(false);
}

+ Here is the call graph for this function:

ilImageMapEditorGUI::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.

Parameters
boolean$a_get_next_coordinateenable next coordinate input
boolean$a_output_new_areaoutput the new area
boolean$a_save_fromoutput save form
string$a_edit_property"" | "link" | "shape"

Definition at line 297 of file class.ilImageMapEditorGUI.php.

References $_SESSION, $ilCtrl, $lng, ilMapArea\countCoords(), getImageMapOutput(), getMapAreaLinkString(), and makeMapWorkCopy().

Referenced by addArea(), setLink(), and setShape().

{
global $ilCtrl, $lng;
$area_type = $_SESSION["il_map_edit_area_type"];
$coords = $_SESSION["il_map_edit_coords"];
include_once("./Services/MediaObjects/classes/class.ilMapArea.php");
$cnt_coords = ilMapArea::countCoords($coords);
$this->tpl = new ilTemplate("tpl.map_edit.html", true, true, "Services/MediaObjects");
$this->tpl->setVariable("FORMACTION", $ilCtrl->getFormAction($this));
$this->tpl->setVariable("TXT_IMAGEMAP", $lng->txt("cont_imagemap"));
$this->tpl->setCurrentBlock("instruction");
if ($a_edit_property != "link")
{
switch ($area_type)
{
// rectangle
case "Rect" :
if ($cnt_coords == 0)
{
$this->tpl->setVariable("INSTRUCTION", $lng->txt("cont_click_tl_corner"));
}
if ($cnt_coords == 1)
{
$this->tpl->setVariable("INSTRUCTION", $lng->txt("cont_click_br_corner"));
}
break;
// circle
case "Circle" :
if ($cnt_coords == 0)
{
$this->tpl->setVariable("INSTRUCTION", $lng->txt("cont_click_center"));
}
if ($cnt_coords == 1)
{
$this->tpl->setVariable("INSTRUCTION", $lng->txt("cont_click_circle"));
}
break;
// polygon
case "Poly" :
if ($cnt_coords == 0)
{
$this->tpl->setVariable("INSTRUCTION", $lng->txt("cont_click_starting_point"));
}
else if ($cnt_coords < 3)
{
$this->tpl->setVariable("INSTRUCTION", $lng->txt("cont_click_next_point"));
}
else
{
$this->tpl->setVariable("INSTRUCTION", $lng->txt("cont_click_next_or_save"));
}
break;
}
}
$this->tpl->parseCurrentBlock();
$this->tpl->setCurrentBlock("adm_content");
// map properties input fields (name and link)
if ($a_save_form)
{
if ($a_edit_property != "link" && $a_edit_property != "shape")
{
$this->tpl->setCurrentBlock("edit_name");
$this->tpl->setVariable("VAR_NAME2", "area_name");
$this->tpl->setVariable("TXT_NAME2", $lng->txt("cont_name"));
$this->tpl->parseCurrentBlock();
}
if ($a_edit_property != "shape")
{
$this->tpl->setCurrentBlock("edit_link");
$this->tpl->setVariable("TXT_LINK_EXT", $lng->txt("cont_link_ext"));
$this->tpl->setVariable("TXT_LINK_INT", $lng->txt("cont_link_int"));
if ($_SESSION["il_map_el_href"] != "")
{
$this->tpl->setVariable("VAL_LINK_EXT", $_SESSION["il_map_el_href"]);
}
else
{
$this->tpl->setVariable("VAL_LINK_EXT", "http://");
}
$this->tpl->setVariable("VAR_LINK_EXT", "area_link_ext");
$this->tpl->setVariable("VAR_LINK_TYPE", "area_link_type");
if ($_SESSION["il_map_il_ltype"] != "int")
{
$this->tpl->setVariable("EXT_CHECKED", "checked=\"1\"");
}
else
{
$this->tpl->setVariable("INT_CHECKED", "checked=\"1\"");
}
// internal link
$link_str = "";
if($_SESSION["il_map_il_target"] != "")
{
$link_str = $this->getMapAreaLinkString($_SESSION["il_map_il_target"],
$_SESSION["il_map_il_type"], $_SESSION["il_map_il_targetframe"]);
$this->tpl->setVariable("VAL_LINK_INT", $link_str);
}
// internal link list
$ilCtrl->setParameter($this, "linkmode", "map");
$this->tpl->setVariable("LINK_ILINK",
$ilCtrl->getLinkTargetByClass("ilInternalLinkGUI", "showLinkHelp",
array("ilObjMediaObjectGUI"), true));
$this->tpl->setVariable("TXT_ILINK", "[".$lng->txt("cont_get_link")."]");
$this->tpl->parseCurrentBlock();
}
$this->tpl->setCurrentBlock("new_area");
$this->tpl->setVariable("TXT_SAVE", $lng->txt("save"));
$this->tpl->setVariable("BTN_SAVE", "saveArea");
if ($a_edit_property == "")
{
$this->tpl->setVariable("TXT_NEW_AREA", $lng->txt("cont_new_area"));
}
else
{
$this->tpl->setVariable("TXT_NEW_AREA", $lng->txt("cont_edit_area"));
}
$this->tpl->parseCurrentBlock();
}
$this->makeMapWorkCopy($a_edit_property, $a_area_nr,
$a_output_new_area, $area_type, $coords);
$edit_mode = ($a_get_next_coordinate)
? "get_coords"
: "";
$output = $this->getImageMapOutput($edit_mode);
$this->tpl->setVariable("IMAGE_MAP", $output);
return $this->tpl->get();
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilImageMapEditorGUI::editMapAreas ( )

Show map areas.

Definition at line 84 of file class.ilImageMapEditorGUI.php.

References $_SESSION, $ilCtrl, $lng, getImageMapOutput(), getImageMapTableHTML(), handleMapParameters(), and makeMapWorkCopy().

{
global $ilCtrl, $lng;
$_SESSION["il_map_edit_target_script"] = $ilCtrl->getLinkTarget($this, "addArea");
$this->tpl = new ilTemplate("tpl.map_edit.html", true, true, "Services/MediaObjects");
$this->tpl->setVariable("FORMACTION", $ilCtrl->getFormAction($this));
$this->tpl->setVariable("TXT_IMAGEMAP", $lng->txt("cont_imagemap"));
// create/update imagemap work copy
$this->makeMapWorkCopy();
$output = $this->getImageMapOutput();
$this->tpl->setVariable("IMAGE_MAP", $output);
$this->tpl->setVariable("MAP_AREA_TABLE", $this->getImageMapTableHTML());
return $this->tpl->get();
}

+ Here is the call graph for this function:

ilImageMapEditorGUI::editShapeCircle ( )

Edit an existing shape (make it a circle)

Definition at line 862 of file class.ilImageMapEditorGUI.php.

References $_SESSION, clearSessionVars(), and setShape().

{
$this->clearSessionVars();
$_SESSION["il_map_edit_area_type"] = "Circle";
return $this->setShape(false);
}

+ Here is the call graph for this function:

ilImageMapEditorGUI::editShapePolygon ( )

Edit an existing shape (make it a polygon)

Definition at line 872 of file class.ilImageMapEditorGUI.php.

References $_SESSION, clearSessionVars(), and setShape().

{
$this->clearSessionVars();
$_SESSION["il_map_edit_area_type"] = "Poly";
return $this->setShape(false);
}

+ Here is the call graph for this function:

ilImageMapEditorGUI::editShapeRectangle ( )

Edit an existing shape (make it a rectangle)

Definition at line 852 of file class.ilImageMapEditorGUI.php.

References $_SESSION, clearSessionVars(), and setShape().

{
$this->clearSessionVars();
$_SESSION["il_map_edit_area_type"] = "Rect";
return $this->setShape(false);
}

+ Here is the call graph for this function:

ilImageMapEditorGUI::executeCommand ( )

Execute current command.

Definition at line 47 of file class.ilImageMapEditorGUI.php.

References $cmd, $ilCtrl, and $ret.

{
global $ilCtrl;
$next_class = $ilCtrl->getNextClass($this);
$cmd = $ilCtrl->getCmd();
switch($next_class)
{
case "ilinternallinkgui":
require_once("./Modules/LearningModule/classes/class.ilInternalLinkGUI.php");
$link_gui = new ilInternalLinkGUI("Media_Media", 0);
$link_gui->setMode("link");
$link_gui->setSetLinkTargetScript(
$ilCtrl->getLinkTarget($this,
"setInternalLink"));
$link_gui->filterLinkType("Media");
$ret = $ilCtrl->forwardCommand($link_gui);
break;
default:
if (isset($_POST["editImagemapForward"]) ||
isset($_POST["editImagemapForward_x"]) ||
isset($_POST["editImagemapForward_y"]))
{
$cmd = "editImagemapForward";
}
$ret = $this->$cmd();
break;
}
return $ret;
}
ilImageMapEditorGUI::getAliasXML ( )

Reimplemented in ilPCImageMapEditorGUI.

Definition at line 502 of file class.ilImageMapEditorGUI.php.

References IL_MODE_ALIAS.

Referenced by getImageMapOutput().

{
return $this->media_object->getXML(IL_MODE_ALIAS);
}

+ Here is the caller graph for this function:

ilImageMapEditorGUI::getHrefOfArea (   $a_nr)

Get Href of Area (only external link)

Reimplemented in ilPCImageMapEditorGUI.

Definition at line 793 of file class.ilImageMapEditorGUI.php.

Referenced by setLink().

{
$st_item = $this->media_object->getMediaItem("Standard");
$area = $st_item->getMapArea($a_nr);
return $area->getHref();
}

+ Here is the caller graph for this function:

ilImageMapEditorGUI::getImageMapOutput (   $a_map_edit_mode = "")

Render the image map.

Definition at line 471 of file class.ilImageMapEditorGUI.php.

References $_GET, $ilCtrl, getAliasXML(), ilUtil\getWebspaceDir(), IL_MODE_OUTPUT, xslt_create(), xslt_error(), xslt_free(), and xslt_process().

Referenced by editMapArea(), and editMapAreas().

{
global $ilCtrl;
$st_item = $this->media_object->getMediaItem("Standard");
// output image map
$xml = "<dummy>";
$xml.= $this->getAliasXML();
$xml.= $this->media_object->getXML(IL_MODE_OUTPUT);
$xml.="</dummy>";
$xsl = file_get_contents("./Services/COPage/xsl/page.xsl");
$args = array( '/_xml' => $xml, '/_xsl' => $xsl );
$xh = xslt_create();
$wb_path = ilUtil::getWebspaceDir("output");
$mode = "media";
$params = array ('map_edit_mode' => $a_map_edit_mode,
'map_item' => $st_item->getId(),
'mode' => $mode,
'image_map_link' => $ilCtrl->getLinkTarget($this, "showImageMap"),
'link_params' => "ref_id=".$_GET["ref_id"]."&rand=".rand(1,999999),
'ref_id' => $_GET["ref_id"],
'pg_frame' => "",
'webspace_path' => $wb_path);
$output = xslt_process($xh,"arg:/_xml","arg:/_xsl",NULL,$args, $params);
echo xslt_error($xh);
xslt_free($xh);
return $output;
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilImageMapEditorGUI::getImageMapTableHTML ( )

Get table HTML.

Reimplemented in ilPCImageMapEditorGUI.

Definition at line 110 of file class.ilImageMapEditorGUI.php.

Referenced by editMapAreas().

{
include_once("./Services/MediaObjects/classes/class.ilImageMapTableGUI.php");
$image_map_table = new ilImageMapTableGUI($this, "editMapAreas", $this->media_object);
return $image_map_table->getHTML();
}

+ Here is the caller graph for this function:

ilImageMapEditorGUI::getLinkTypeOfArea (   $a_nr)

Get Link Type of Area.

Reimplemented in ilPCImageMapEditorGUI.

Definition at line 753 of file class.ilImageMapEditorGUI.php.

Referenced by setLink().

{
$st_item = $this->media_object->getMediaItem("Standard");
$area = $st_item->getMapArea($a_nr);
return $area->getLinkType();
}

+ Here is the caller graph for this function:

ilImageMapEditorGUI::getMapAreaLinkString (   $a_target,
  $a_type,
  $a_frame 
)

Get text name of internal link.

Parameters
string$a_targettarget object link id
string$a_typetype
string$a_frametarget frame

private

Definition at line 516 of file class.ilImageMapEditorGUI.php.

References $lng, $title, ilObject\_lookupObjId(), ilLMObject\_lookupTitle(), and ilObject\_lookupTitle().

Referenced by editMapArea().

{
global $lng;
$t_arr = explode("_", $a_target);
if ($a_frame != "")
{
$frame_str = " (".$a_frame." Frame)";
}
switch($a_type)
{
case "StructureObject":
require_once("./Modules/LearningModule/classes/class.ilLMObject.php");
$title = ilLMObject::_lookupTitle($t_arr[count($t_arr) - 1]);
$link_str = $lng->txt("chapter").
": ".$title." [".$t_arr[count($t_arr) - 1]."]".$frame_str;
break;
case "PageObject":
require_once("./Modules/LearningModule/classes/class.ilLMObject.php");
$title = ilLMObject::_lookupTitle($t_arr[count($t_arr) - 1]);
$link_str = $lng->txt("page").
": ".$title." [".$t_arr[count($t_arr) - 1]."]".$frame_str;
break;
case "GlossaryItem":
require_once("./Modules/Glossary/classes/class.ilGlossaryTerm.php");
$term =& new ilGlossaryTerm($t_arr[count($t_arr) - 1]);
$link_str = $lng->txt("term").
": ".$term->getTerm()." [".$t_arr[count($t_arr) - 1]."]".$frame_str;
break;
case "MediaObject":
require_once("./Services/MediaObjects/classes/class.ilObjMediaObject.php");
$mob =& new ilObjMediaObject($t_arr[count($t_arr) - 1]);
$link_str = $lng->txt("mob").
": ".$mob->getTitle()." [".$t_arr[count($t_arr) - 1]."]".$frame_str;
break;
case "RepositoryItem":
ilObject::_lookupObjId($t_arr[count($t_arr) - 1]));
$link_str = $lng->txt("obj_".$t_arr[count($t_arr) - 2]).
": ".$title." [".$t_arr[count($t_arr) - 1]."]".$frame_str;
break;
}
return $link_str;
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilImageMapEditorGUI::getTargetFrameOfArea (   $a_nr)

Get TargetFrame of Area (only internal link)

Reimplemented in ilPCImageMapEditorGUI.

Definition at line 783 of file class.ilImageMapEditorGUI.php.

Referenced by setLink().

{
$st_item = $this->media_object->getMediaItem("Standard");
$area = $st_item->getMapArea($a_nr);
return $area->getTargetFrame();
}

+ Here is the caller graph for this function:

ilImageMapEditorGUI::getTargetOfArea (   $a_nr)

Get Target of Area (only internal link)

Reimplemented in ilPCImageMapEditorGUI.

Definition at line 773 of file class.ilImageMapEditorGUI.php.

Referenced by setLink().

{
$st_item = $this->media_object->getMediaItem("Standard");
$area = $st_item->getMapArea($a_nr);
return $area->getTarget();
}

+ Here is the caller graph for this function:

ilImageMapEditorGUI::getTypeOfArea (   $a_nr)

Get Type of Area (only internal link)

Reimplemented in ilPCImageMapEditorGUI.

Definition at line 763 of file class.ilImageMapEditorGUI.php.

Referenced by setLink().

{
$st_item = $this->media_object->getMediaItem("Standard");
$area = $st_item->getMapArea($a_nr);
return $area->getType();
}

+ Here is the caller graph for this function:

ilImageMapEditorGUI::handleMapParameters ( )

handle parameter during map area editing (storing to session)

Definition at line 120 of file class.ilImageMapEditorGUI.php.

References $_GET, and $_SESSION.

Referenced by addArea(), editMapAreas(), setLink(), and setShape().

{
if($_GET["ref_id"] != "")
{
$_SESSION["il_map_edit_ref_id"] = $_GET["ref_id"];
}
if($_GET["obj_id"] != "")
{
$_SESSION["il_map_edit_obj_id"] = $_GET["obj_id"];
}
if($_GET["hier_id"] != "")
{
$_SESSION["il_map_edit_hier_id"] = $_GET["hier_id"];
}
if($_GET["pc_id"] != "")
{
$_SESSION["il_map_edit_pc_id"] = $_GET["pc_id"];
}
}

+ Here is the caller graph for this function:

ilImageMapEditorGUI::makeMapWorkCopy (   $a_edit_property = "",
  $a_area_nr = 0,
  $a_output_new_area = false,
  $a_area_type = "",
  $a_coords = "" 
)

Make work file for editing.

Reimplemented in ilPCImageMapEditorGUI.

Definition at line 447 of file class.ilImageMapEditorGUI.php.

Referenced by editMapArea(), and editMapAreas().

{
// create/update imagemap work copy
$st_item = $this->media_object->getMediaItem("Standard");
if ($a_edit_property == "shape")
{
$st_item->makeMapWorkCopy($a_area_nr, true); // exclude area currently being edited
}
else
{
$st_item->makeMapWorkCopy($a_area_nr, false);
}
if ($a_output_new_area)
{
$st_item->addAreaToMapWorkCopy($a_area_type, $a_coords);
}
}

+ Here is the caller graph for this function:

ilImageMapEditorGUI::saveArea ( )

Save new or updated map area.

Reimplemented in ilPCImageMapEditorGUI.

Definition at line 599 of file class.ilImageMapEditorGUI.php.

References $_SESSION, $ilCtrl, $lng, ilMapArea\_getMaxNr(), IL_EXT_LINK, IL_INT_LINK, ilUtil\sendInfo(), ilMapArea\setLinkType(), ilMapArea\setShape(), and ilUtil\stripSlashes().

Referenced by setShape().

{
global $lng, $ilCtrl;
switch ($_SESSION["il_map_edit_mode"])
{
// save edited link
case "edit_link":
$st_item = $this->media_object->getMediaItem("Standard");
$max = ilMapArea::_getMaxNr($st_item->getId());
$area = new ilMapArea($st_item->getId(), $_SESSION["il_map_area_nr"]);
if ($_POST["area_link_type"] == IL_INT_LINK)
{
$area->setType($_SESSION["il_map_il_type"]);
$area->setTarget($_SESSION["il_map_il_target"]);
$area->setTargetFrame($_SESSION["il_map_il_targetframe"]);
}
else
{
$area->setLinkType(IL_EXT_LINK);
$area->setHref(ilUtil::stripSlashes($_POST["area_link_ext"]));
}
$area->update();
break;
// save edited shape
case "edit_shape":
$st_item = $this->media_object->getMediaItem("Standard");
$max = ilMapArea::_getMaxNr($st_item->getId());
$area =& new ilMapArea($st_item->getId(), $_SESSION["il_map_area_nr"]);
$area->setShape($_SESSION["il_map_edit_area_type"]);
$area->setCoords($_SESSION["il_map_edit_coords"]);
$area->update();
break;
// save new area
default:
$area_type = $_SESSION["il_map_edit_area_type"];
$coords = $_SESSION["il_map_edit_coords"];
$st_item = $this->media_object->getMediaItem("Standard");
$max = ilMapArea::_getMaxNr($st_item->getId());
// make new area object
$area = new ilMapArea();
$area->setItemId($st_item->getId());
$area->setShape($area_type);
$area->setCoords($coords);
$area->setNr($max + 1);
$area->setTitle(ilUtil::stripSlashes($_POST["area_name"]));
switch($_POST["area_link_type"])
{
case "ext":
$area->setLinkType(IL_EXT_LINK);
$area->setHref($_POST["area_link_ext"]);
break;
case "int":
$area->setLinkType(IL_INT_LINK);
$area->setType($_SESSION["il_map_il_type"]);
$area->setTarget($_SESSION["il_map_il_target"]);
$area->setTargetFrame($_SESSION["il_map_il_targetframe"]);
break;
}
// put area into item and update media object
$st_item->addMapArea($area);
$this->media_object->update();
break;
}
//$this->initMapParameters();
ilUtil::sendInfo($lng->txt("cont_saved_map_area"), true);
$ilCtrl->redirect($this, "editMapAreas");
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilImageMapEditorGUI::setInternalLink ( )

Set internal link.

Definition at line 681 of file class.ilImageMapEditorGUI.php.

References $_GET, $_SESSION, addArea(), and setLink().

{
$_SESSION["il_map_il_type"] = $_GET["linktype"];
$_SESSION["il_map_il_ltype"] = "int";
$_SESSION["il_map_il_target"] = $_GET["linktarget"];
$_SESSION["il_map_il_targetframe"] = $_GET["linktargetframe"];
switch ($_SESSION["il_map_edit_mode"])
{
case "edit_link":
return $this->setLink();
break;
default:
return $this->addArea();
break;
}
}

+ Here is the call graph for this function:

ilImageMapEditorGUI::setLink (   $a_handle = true)

Set link.

Definition at line 703 of file class.ilImageMapEditorGUI.php.

References $_SESSION, $ilCtrl, $lng, editMapArea(), getHrefOfArea(), getLinkTypeOfArea(), getTargetFrameOfArea(), getTargetOfArea(), getTypeOfArea(), handleMapParameters(), IL_INT_LINK, and ilUtil\sendInfo().

Referenced by editLink(), and setInternalLink().

{
global $lng, $ilCtrl;
if($a_handle)
{
}
if ($_SESSION["il_map_area_nr"] != "")
{
$_POST["area"][0] = $_SESSION["il_map_area_nr"];
}
if (!isset($_POST["area"]))
{
ilUtil::sendInfo($lng->txt("no_checkbox"), true);
$ilCtrl->redirect($this, "editMapAreas");
}
if (count($_POST["area"]) > 1)
{
//$this->ilias->raiseError($this->lng->txt("cont_select_max_one_item"),$this->ilias->error_obj->MESSAGE);
ilUtil::sendInfo($lng->txt("cont_select_max_one_item"), true);
$ilCtrl->redirect($this, "editMapAreas");
}
if ($_SESSION["il_map_edit_mode"] != "edit_link")
{
$_SESSION["il_map_area_nr"] = $_POST["area"][0];
$_SESSION["il_map_il_ltype"] = $this->getLinkTypeOfArea($_POST["area"][0]);
$_SESSION["il_map_edit_mode"] = "edit_link";
$_SESSION["il_map_edit_target_script"] = $ilCtrl->getLinkTarget($this, "setLink");
if ($_SESSION["il_map_il_ltype"] == IL_INT_LINK)
{
$_SESSION["il_map_il_type"] = $this->getTypeOfArea($_POST["area"][0]);
$_SESSION["il_map_il_target"] = $this->getTargetOfArea($_POST["area"][0]);
$_SESSION["il_map_il_targetframe"] = $this->getTargetFrameOfArea($_POST["area"][0]);
}
else
{
$_SESSION["il_map_el_href"] = $this->getHrefOfArea($_POST["area"][0]);
}
}
return $this->editMapArea(false, false, true, "link", $_POST["area"][0]);
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilImageMapEditorGUI::setShape (   $a_handle = true)

edit shape of existing map area

Definition at line 882 of file class.ilImageMapEditorGUI.php.

References $_SESSION, $ilCtrl, $lng, ilMapArea\countCoords(), editMapArea(), handleMapParameters(), saveArea(), and ilUtil\sendInfo().

Referenced by editShapeCircle(), editShapePolygon(), and editShapeRectangle().

{
global $lng, $ilCtrl;
if($a_handle)
{
}
if($_POST["areatype2"] != "")
{
$_SESSION["il_map_edit_area_type"] = $_POST["areatype2"];
}
if ($_SESSION["il_map_area_nr"] != "")
{
$_POST["area"][0] = $_SESSION["il_map_area_nr"];
}
if (!isset($_POST["area"]))
{
ilUtil::sendInfo($lng->txt("no_checkbox"), true);
$ilCtrl->redirect($this, "editMapAreas");
}
if (count($_POST["area"]) > 1)
{
ilUtil::sendInfo($lng->txt("cont_select_max_one_item"), true);
$ilCtrl->redirect($this, "editMapAreas");
}
if ($_SESSION["il_map_edit_mode"] != "edit_shape")
{
$_SESSION["il_map_area_nr"] = $_POST["area"][0];
$_SESSION["il_map_edit_mode"] = "edit_shape";
$_SESSION["il_map_edit_target_script"] = $ilCtrl->getLinkTarget($this, "setShape");
}
$area_type = $_SESSION["il_map_edit_area_type"];
$coords = $_SESSION["il_map_edit_coords"];
$cnt_coords = ilMapArea::countCoords($coords);
// decide what to do next
switch ($area_type)
{
// Rectangle
case "Rect" :
if ($cnt_coords < 2)
{
return $this->editMapArea(true, false, false, "shape", $_POST["area"][0]);
}
else if ($cnt_coords == 2)
{
return $this->saveArea();
}
break;
// Circle
case "Circle":
if ($cnt_coords <= 1)
{
return $this->editMapArea(true, false, false, "shape", $_POST["area"][0]);
}
else
{
if ($cnt_coords == 2)
{
$c = explode(",",$coords);
$coords = $c[0].",".$c[1].","; // determine radius
$coords .= round(sqrt(pow(abs($c[3]-$c[1]),2)+pow(abs($c[2]-$c[0]),2)));
}
$_SESSION["il_map_edit_coords"] = $coords;
return $this->saveArea();
}
break;
// Polygon
case "Poly":
if ($cnt_coords < 1)
{
return $this->editMapArea(true, false, false, "shape", $_POST["area"][0]);
}
else if ($cnt_coords < 3)
{
return $this->editMapArea(true, true, false, "shape", $_POST["area"][0]);
}
else
{
return $this->editMapArea(true, true, true, "shape", $_POST["area"][0]);
}
break;
}
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilImageMapEditorGUI::showImageMap ( )

show image map

Definition at line 146 of file class.ilImageMapEditorGUI.php.

References $_GET.

{
$item =& new ilMediaItem($_GET["item_id"]);
$item->outputMapWorkCopy();
}
ilImageMapEditorGUI::updateAreas ( )

Update map areas.

Reimplemented in ilPCImageMapEditorGUI.

Definition at line 155 of file class.ilImageMapEditorGUI.php.

References $ilCtrl, $lng, ilMapArea\_getMaxNr(), ilUtil\sendInfo(), ilMapArea\setTitle(), and ilUtil\stripSlashes().

{
global $lng, $ilCtrl;
$st_item =& $this->media_object->getMediaItem("Standard");
$max = ilMapArea::_getMaxNr($st_item->getId());
for ($i=1; $i<=$max; $i++)
{
$area =& new ilMapArea($st_item->getId(), $i);
$area->setTitle(ilUtil::stripSlashes($_POST["name_".$i]));
$area->update();
}
ilUtil::sendInfo($lng->txt("cont_saved_map_data"), true);
$ilCtrl->redirect($this, "editMapAreas");
}

+ Here is the call graph for this function:


The documentation for this class was generated from the following file: