ILIAS  Release_4_2_x_branch Revision 61807
 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.
 getToolbar ()
 Get toolbar.
 getEditorTitle ()
 Get editor title.
 getImageMapTableHTML ()
 Get table HTML.
 handleMapParameters ()
 handle parameter during map area editing (storing to session)
 showImageMap ()
 show image map
 updateAreas ()
 Update map areas.
 addNewArea ()
 Add area.
 linkWholePicture ()
 Link the whole picture.
 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.
 initAreaEditingForm ($a_edit_property)
 Init area editing form.
 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.
 getAdditionalPageXML ()
 Get additional page xml (to be overwritten)
 outputPostProcessing ($a_output)
 Output post processing.
 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.
 editShapeWholePicture ()
 Edit an existing shape (make it a whole picture 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 14 of file class.ilImageMapEditorGUI.php.

Constructor & Destructor Documentation

ilImageMapEditorGUI::__construct (   $a_media_object)

Constructor.

Definition at line 19 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 707 of file class.ilImageMapEditorGUI.php.

References $_GET, and $_SESSION.

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

{
$_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 271 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;
// Whole picture
case "WholePicture":
return $this->editMapArea(false, false, 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 235 of file class.ilImageMapEditorGUI.php.

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

Referenced by addNewArea().

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

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilImageMapEditorGUI::addNewArea ( )

Add area.

Reimplemented in ilPCIIMTriggerEditorGUI.

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

References $_POST, addCircle(), addPolygon(), addRectangle(), and linkWholePicture().

{
switch ($_POST["shape"])
{
case "WholePicture": return $this->linkWholePicture();
case "Rect": return $this->addRectangle();
case "Circle": return $this->addCircle();
case "Poly": return $this->addPolygon();
}
}

+ Here is the call graph for this function:

ilImageMapEditorGUI::addPolygon ( )

Add a new polygon.

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

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

Referenced by addNewArea().

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

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilImageMapEditorGUI::addRectangle ( )

Add a new rectangle.

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

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

Referenced by addNewArea().

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

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilImageMapEditorGUI::clearSessionVars ( )

Clear Session Vars.

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

References $_SESSION.

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

{
$_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 922 of file class.ilImageMapEditorGUI.php.

References $_POST, $ilCtrl, $lng, ilMapArea\_getMaxNr(), ilUtil\sendFailure(), and ilUtil\sendSuccess().

{
global $ilCtrl, $lng;
if (!isset($_POST["area"]))
{
ilUtil::sendFailure($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::sendSuccess($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 688 of file class.ilImageMapEditorGUI.php.

References $_POST, $_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 955 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 352 of file class.ilImageMapEditorGUI.php.

References $_SESSION, $ilCtrl, $lng, $tpl, ilMapArea\countCoords(), getImageMapOutput(), ilInternalLinkGUI\getInitHTML(), initAreaEditingForm(), makeMapWorkCopy(), and ilUtil\sendInfo().

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

{
global $ilCtrl, $lng, $tpl;
$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));
if ($a_edit_property != "link")
{
switch ($area_type)
{
// rectangle
case "Rect" :
if ($cnt_coords == 0)
{
ilUtil::sendInfo($lng->txt("cont_click_tl_corner"));
}
if ($cnt_coords == 1)
{
ilUtil::sendInfo($lng->txt("cont_click_br_corner"));
}
break;
// circle
case "Circle" :
if ($cnt_coords == 0)
{
ilUtil::sendInfo($lng->txt("cont_click_center"));
}
if ($cnt_coords == 1)
{
ilUtil::sendInfo($lng->txt("cont_click_circle"));
}
break;
// polygon
case "Poly" :
if ($cnt_coords == 0)
{
ilUtil::sendInfo($lng->txt("cont_click_starting_point"));
}
else if ($cnt_coords < 3)
{
ilUtil::sendInfo($lng->txt("cont_click_next_point"));
}
else
{
ilUtil::sendInfo($lng->txt("cont_click_next_or_save"));
}
break;
}
}
// map properties input fields (name and link)
if ($a_save_form)
{
if ($a_edit_property != "shape")
{
// prepare link gui
$ilCtrl->setParameter($this, "linkmode", "map");
include_once("./Modules/LearningModule/classes/class.ilInternalLinkGUI.php");
$this->tpl->setCurrentBlock("int_link_prep");
$this->tpl->setVariable("INT_LINK_PREP", ilInternalLinkGUI::getInitHTML(
$ilCtrl->getLinkTargetByClass("ilinternallinkgui",
"", false, true, false)));
$this->tpl->parseCurrentBlock();
}
$form = $this->initAreaEditingForm($a_edit_property);
$this->tpl->setVariable("FORM", $form->getHTML());
}
$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 65 of file class.ilImageMapEditorGUI.php.

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

{
global $ilCtrl, $lng, $ilToolbar;
$_SESSION["il_map_edit_target_script"] = $ilCtrl->getLinkTarget($this, "addArea",
"", false, false);
$this->tpl = new ilTemplate("tpl.map_edit.html", true, true, "Services/MediaObjects");
$this->tpl->setVariable("FORMACTION", $ilCtrl->getFormAction($this));
// create/update imagemap work copy
$this->makeMapWorkCopy();
$output = $this->getImageMapOutput();
$this->tpl->setVariable("IMAGE_MAP", $output);
$this->tpl->setVariable("TOOLBAR", $this->getToolbar()->getHTML());
// table
$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 991 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 1001 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 981 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::editShapeWholePicture ( )

Edit an existing shape (make it a whole picture link)

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

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

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

+ Here is the call graph for this function:

ilImageMapEditorGUI::executeCommand ( )

Execute current command.

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

References $_POST, $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("File");
$link_gui->setMode("asynch");
$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::getAdditionalPageXML ( )

Get additional page xml (to be overwritten)

Returns
string additional page xml

Reimplemented in ilPCIIMTriggerEditorGUI.

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

Referenced by getImageMapOutput().

{
return "";
}

+ Here is the caller graph for this function:

ilImageMapEditorGUI::getAliasXML ( )

Reimplemented in ilPCImageMapEditorGUI.

Definition at line 621 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::getEditorTitle ( )

Get editor title.

Returns
string editor title

Reimplemented in ilPCIIMTriggerEditorGUI.

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

References $lng.

{
global $lng;
return $lng->txt("cont_imagemap");
}
ilImageMapEditorGUI::getHrefOfArea (   $a_nr)

Get Href of Area (only external link)

Reimplemented in ilPCImageMapEditorGUI.

Definition at line 912 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 563 of file class.ilImageMapEditorGUI.php.

References $_GET, $ilCtrl, getAdditionalPageXML(), getAliasXML(), ilUtil\getWebspaceDir(), IL_MODE_OUTPUT, outputPostProcessing(), 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.= $this->getAdditionalPageXML();
$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";
//echo htmlentities($ilCtrl->getLinkTarget($this, "showImageMap"));
$params = array ('map_edit_mode' => $a_map_edit_mode,
'map_item' => $st_item->getId(),
'map_mob_id' => $this->media_object->getId(),
'mode' => $mode,
'media_mode' => 'enable',
'image_map_link' => $ilCtrl->getLinkTarget($this, "showImageMap", "", false, false),
'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);
$output = $this->outputPostProcessing($output);
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 ilPCIIMTriggerEditorGUI, and ilPCImageMapEditorGUI.

Definition at line 134 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 872 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 635 of file class.ilImageMapEditorGUI.php.

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

Referenced by initAreaEditingForm().

{
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 902 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 892 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::getToolbar ( )

Get toolbar.

Returns
object toolbar

Reimplemented in ilPCIIMTriggerEditorGUI.

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

References $ilCtrl, $lng, and ilSelectInputGUI\setOptions().

Referenced by editMapAreas().

{
global $ilCtrl, $lng;
// toolbar
$tb = new ilToolbarGUI();
$tb->setFormAction($ilCtrl->getFormAction($this));
include_once("./Services/Form/classes/class.ilSelectInputGUI.php");
$options = array(
"WholePicture" => $lng->txt("cont_WholePicture"),
"Rect" => $lng->txt("cont_Rect"),
"Circle" => $lng->txt("cont_Circle"),
"Poly" => $lng->txt("cont_Poly"),
);
$si = new ilSelectInputGUI($lng->txt("cont_shape"), "shape");
$si->setOptions($options);
$tb->addInputItem($si, true);
$tb->addFormButton($lng->txt("cont_add_area"), "addNewArea");
return $tb;
}

+ Here is the call graph for this function:

+ 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 882 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 144 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::initAreaEditingForm (   $a_edit_property)

Init area editing form.

Parameters
int$a_modeEdit Mode

Reimplemented in ilPCIIMTriggerEditorGUI.

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

References $_SESSION, $ilCtrl, $lng, getMapAreaLinkString(), ilTextInputGUI\setMaxLength(), and ilRadioGroupInputGUI\setValue().

Referenced by editMapArea().

{
global $lng, $ilCtrl;
include_once("Services/Form/classes/class.ilPropertyFormGUI.php");
$form = new ilPropertyFormGUI();
$form->setOpenTag(false);
$form->setCloseTag(false);
// link
if ($a_edit_property != "shape")
{
//
$radg = new ilRadioGroupInputGUI($lng->txt("cont_link"), "area_link_type");
if ($_SESSION["il_map_il_ltype"] != "int")
{
$radg->setValue("ext");
}
else
{
$radg->setValue("int");
}
// external link
$ext = new ilRadioOption($lng->txt("cont_link_ext"), "ext");
$radg->addOption($ext);
$ti = new ilTextInputGUI("", "area_link_ext");
$ti->setMaxLength(200);
$ti->setSize(50);
if ($_SESSION["il_map_el_href"] != "")
{
$ti->setValue($_SESSION["il_map_el_href"]);
}
else
{
$ti->setValue("http://");
}
$ext->addSubItem($ti);
// internal link
$int = new ilRadioOption($lng->txt("cont_link_int"), "int");
$radg->addOption($int);
$ne = new ilNonEditableValueGUI("", "", true);
$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"]);
}
$ne->setValue($link_str.
'&nbsp;<a id="iosEditInternalLinkTrigger" href="#">'.
"[".$lng->txt("cont_get_link")."]".
'</a>'
);
$int->addSubItem($ne);
$form->addItem($radg);
}
// name
if ($a_edit_property != "link" && $a_edit_property != "shape")
{
$ti = new ilTextInputGUI($lng->txt("cont_name"), "area_name");
$ti->setMaxLength(200);
$ti->setSize(20);
$form->addItem($ti);
}
// save and cancel commands
if ($a_edit_property == "")
{
$form->setTitle($lng->txt("cont_new_area"));
$form->addCommandButton("saveArea", $lng->txt("save"));
}
else
{
$form->setTitle($lng->txt("cont_new_area"));
$form->addCommandButton("saveArea", $lng->txt("save"));
}
// $form->setFormAction($ilCtrl->getFormAction($this));
return $form;
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilImageMapEditorGUI::linkWholePicture ( )

Link the whole picture.

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

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

Referenced by addNewArea().

{
$this->clearSessionVars();
$_SESSION["il_map_edit_area_type"] = "WholePicture";
return $this->editMapArea(false, false, true);
}

+ Here is the call graph for this function:

+ 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 539 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::outputPostProcessing (   $a_output)

Output post processing.

Parameters
@return

Reimplemented in ilPCIIMTriggerEditorGUI.

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

Referenced by getImageMapOutput().

{
return $a_output;
}

+ Here is the caller graph for this function:

ilImageMapEditorGUI::saveArea ( )

Save new or updated map area.

Reimplemented in ilPCIIMTriggerEditorGUI, and ilPCImageMapEditorGUI.

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

References $_POST, $_SESSION, $ilCtrl, $lng, ilMapArea\_getMaxNr(), IL_EXT_LINK, IL_INT_LINK, ilUtil\sendSuccess(), 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::sendSuccess($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 800 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 822 of file class.ilImageMapEditorGUI.php.

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

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::sendFailure($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::sendFailure($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 1011 of file class.ilImageMapEditorGUI.php.

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

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

{
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::sendFailure($lng->txt("no_checkbox"), true);
$ilCtrl->redirect($this, "editMapAreas");
}
if (count($_POST["area"]) > 1)
{
ilUtil::sendFailure($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", "", false, false);
}
$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;
// Whole Picture
case "WholePicture":
return $this->saveArea();
}
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilImageMapEditorGUI::showImageMap ( )

show image map

Definition at line 170 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 179 of file class.ilImageMapEditorGUI.php.

References $_POST, $ilCtrl, $lng, ilMapArea\_getMaxNr(), ilUtil\sendSuccess(), 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::sendSuccess($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: