ILIAS  release_5-0 Revision 5.0.0-1144-gc4397b1f870
All Data Structures Namespaces Files Functions Variables Modules Pages
ilMapArea Class Reference

Class ilMapArea. More...

+ Collaboration diagram for ilMapArea:

Public Member Functions

 ilMapArea ($a_item_id=0, $a_nr=0)
 map area More...
 
 create ()
 create persistent map area object in db More...
 
 _getMaxNr ($a_item_id)
 get maximum nr of media item (static) More...
 
 read ()
 read map area data into object (item id and nr must be set) More...
 
 update ()
 update map area More...
 
 _resolveIntLinks ($a_item_id)
 resolve internal links of an item id More...
 
 _getIntLinks ($a_item_id)
 get all internal links of a media items map areas More...
 
 getAllHighlightModes ()
 Get all highlight modes. More...
 
 setHighlightMode ($a_val)
 Set highlight mode. More...
 
 getHighlightMode ()
 Get highlight mode. More...
 
 getAllHighlightClasses ()
 Get all highlight classes. More...
 
 setHighlightClass ($a_val)
 Set highlight class. More...
 
 getHighlightClass ()
 Get highlight class. More...
 
 setItemId ($a_item_id)
 set media item id More...
 
 getItemId ()
 get item id More...
 
 setNr ($a_nr)
 set area number More...
 
 getNr ()
 get area number More...
 
 setShape ($a_shape)
 set shape (IL_AREA_RECT, IL_AREA_CIRCLE, IL_AREA_POLY, IL_AREA_WHOLE_PICTURE) More...
 
 getShape ()
 get shape More...
 
 setCoords ($a_coords)
 set coords of area More...
 
 getCoords ()
 get coords More...
 
 setTitle ($a_title)
 set (tooltip)title of area More...
 
 appendTitle ($a_title_str)
 append string to (tooltip) title of area More...
 
 getTitle ()
 get (tooltip) title More...
 
 setLinkType ($a_link_type)
 set link type More...
 
 getLinkType ()
 get link type More...
 
 setHref ($a_href)
 set hyper reference (external link only) More...
 
 getHref ()
 get hyper reference url (external link only) More...
 
 setExtTitle ($a_title)
 set link text (external link only) More...
 
 getExtTitle ()
 get link text (external link only) More...
 
 setTarget ($a_target)
 set link target (internal link only) More...
 
 getTarget ($a_insert_inst=false)
 get link target (internal link only) More...
 
 setType ($a_type)
 set link type (internal link only) More...
 
 getType ()
 get link type (internal link only) More...
 
 setTargetFrame ($a_target_frame)
 set link target frame (internal link only) More...
 
 getTargetFrame ()
 get link target frame (internal link only) More...
 
 draw (&$a_image, $a_col1, $a_col2, $a_close_poly=true, $a_x_ratio=1, $a_y_ratio=1)
 draw image to More...
 
 drawLine (&$im, $x1, $y1, $x2, $y2, $c1, $c2)
 draws an outlined two color line in an image More...
 
 drawRect (&$im, $coords, $c1, $c2, $a_x_ratio=1, $a_y_ratio=1)
 draws an outlined two color rectangle More...
 
 drawPoly (&$im, $coords, $c1, $c2, $closed, $a_x_ratio=1, $a_y_ratio=1)
 draws an outlined two color polygon More...
 
 drawCircle (&$im, $coords, $c1, $c2, $a_x_ratio=1, $a_y_ratio=1)
 draws an outlined two colored circle More...
 
 countCoords ($c)
 count the number of coordinates (x,y) in a coordinate string (format: "x1,y1,x2,y2,x3,y3,...") More...
 

Static Public Member Functions

static _getMobsForTarget ($a_type, $a_target)
 Get areas for a certain target. More...
 

Data Fields

const HL_NONE = ""
 
const HL_HOVER = "Hover"
 
const HL_ALWAYS = "Always"
 
const HLCL_ACCENTED = ""
 
const HLCL_LIGHT = "Light"
 
const HLCL_DARK = "Dark"
 
 $item_id
 
 $nr
 
 $shape
 
 $coords
 
 $title
 
 $linktype
 
 $xl_title
 
 $xl_href
 
 $il_target
 
 $il_type
 
 $il_target_frame
 

Detailed Description

Class ilMapArea.

Map Area of an Image Map, subobject of Media Item

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

Definition at line 36 of file class.ilMapArea.php.

Member Function Documentation

◆ _getIntLinks()

ilMapArea::_getIntLinks (   $a_item_id)

get all internal links of a media items map areas

Parameters
int$a_item_idmedia item id

Definition at line 207 of file class.ilMapArea.php.

References $ilDB, and IL_INT_LINK.

Referenced by ilMediaItem\_getMapAreasIntLinks(), and ilObjMediaObject\getLinkedMediaObjects().

208  {
209  global $ilDB;
210 
211  $q = "SELECT * FROM map_area WHERE item_id = ".
212  $ilDB->quote($a_item_id, "integer");
213  $area_set = $ilDB->query($q);
214 
215  $links = array();
216 
217  while ($area_rec = $ilDB->fetchAssoc($area_set))
218  {
219  $target = $area_rec["target"];
220  $type = $area_rec["type"];
221  $targetframe = $area_rec["target_frame"];
222 
223  if (($area_rec["link_type"] == IL_INT_LINK) && (is_int(strpos($target, "__"))))
224  {
225  $links[$target.":".$type.":".$targetframe] =
226  array("Target" => $target, "Type" => $type,
227  "TargetFrame" => $targetframe);
228  }
229  }
230  return $links;
231  }
const IL_INT_LINK
global $ilDB
+ Here is the caller graph for this function:

◆ _getMaxNr()

ilMapArea::_getMaxNr (   $a_item_id)

get maximum nr of media item (static)

Parameters
int$a_item_iditem id
Returns
int maximum nr

Definition at line 107 of file class.ilMapArea.php.

References $ilDB.

Referenced by ilMediaItem\_getMediaItemsOfMOb(), ilImageMapEditorGUI\deleteAreas(), ilImageMapTableGUI\getItems(), ilMediaItem\read(), ilImageMapEditorGUI\saveArea(), and ilImageMapEditorGUI\updateAreas().

108  {
109  global $ilDB;
110 
111  $q = "SELECT max(nr) AS max_nr FROM map_area WHERE item_id = ".
112  $ilDB->quote($a_item_id, "integer");
113  $max_set = $ilDB->query($q);
114  $max_rec = $ilDB->fetchAssoc($max_set);
115 
116  return $max_rec["max_nr"];
117  }
global $ilDB
+ Here is the caller graph for this function:

◆ _getMobsForTarget()

static ilMapArea::_getMobsForTarget (   $a_type,
  $a_target 
)
static

Get areas for a certain target.

Definition at line 236 of file class.ilMapArea.php.

References $ilDB, $mobs, and ilMediaItem\_lookupMobId().

Referenced by ilLMObject\updateInternalLinks().

237  {
238  global $ilDB;
239 
240  $q = "SELECT * FROM map_area WHERE ".
241  " link_type = ".$ilDB->quote($a_type, "text").
242  " AND target = ".$ilDB->quote($a_target, "text");
243  $set = $ilDB->query($q);
244 
245  $mobs = array();
246  while($rec = $ilDB->fetchAssoc($set))
247  {
248  $mob_id = ilMediaItem::_lookupMobId($rec["item_id"]);
249  $mobs[$mob_id] = $mob_id;
250  }
251 
252  return $mobs;
253  }
$mobs
static _lookupMobId($a_med_id)
Lookup Mob ID.
global $ilDB
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ _resolveIntLinks()

ilMapArea::_resolveIntLinks (   $a_item_id)

resolve internal links of an item id

Definition at line 172 of file class.ilMapArea.php.

References $ilDB, $query, ilInternalLink\_getIdForImportId(), and IL_INT_LINK.

Referenced by ilMediaItem\_resolveMapAreaLinks().

173  {
174  global $ilDB;
175 
176 //echo "maparea::resolve<br>";
177  $q = "SELECT * FROM map_area WHERE item_id = ".
178  $ilDB->quote($a_item_id, "integer");
179  $area_set = $ilDB->query($q);
180  while ($area_rec = $ilDB->fetchAssoc($area_set))
181  {
182  $target = $area_rec["target"];
183  $type = $area_rec["type"];
184  $item_id = $area_rec["item_id"];
185  $nr = $area_rec["nr"];
186 
187  if (($area_rec["link_type"] == IL_INT_LINK) && (!is_int(strpos($target, "__"))))
188  {
189  $new_target = ilInternalLink::_getIdForImportId($type, $target);
190  if ($new_target !== false)
191  {
192  $query = "UPDATE map_area SET ".
193  "target = ".$ilDB->quote($new_target, "text")." ".
194  "WHERE item_id = ".$ilDB->quote($item_id, "integer").
195  " AND nr = ".$ilDB->quote($nr, "integer");
196  $ilDB->manipulate($query);
197  }
198  }
199  }
200  }
const IL_INT_LINK
global $ilDB
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ appendTitle()

ilMapArea::appendTitle (   $a_title_str)

append string to (tooltip) title of area

Parameters
string$a_title_strtitle string

Definition at line 426 of file class.ilMapArea.php.

427  {
428  $this->title.= $a_title_str;
429  }

◆ countCoords()

ilMapArea::countCoords (   $c)

count the number of coordinates (x,y) in a coordinate string (format: "x1,y1,x2,y2,x3,y3,...")

Parameters
string$ccoordinate string

Definition at line 706 of file class.ilMapArea.php.

Referenced by ilImageMapEditorGUI\addArea(), drawPoly(), ilImageMapEditorGUI\editMapArea(), and ilImageMapEditorGUI\setShape().

707  {
708  if ($c == "")
709  {
710  return 0;
711  }
712  else
713  {
714  $coord_array = explode(",", $c);
715  return (count($coord_array) / 2);
716  }
717  }
+ Here is the caller graph for this function:

◆ create()

ilMapArea::create ( )

create persistent map area object in db

Definition at line 78 of file class.ilMapArea.php.

References $ilDB, getCoords(), getHighlightClass(), getHighlightMode(), getHref(), getItemId(), getLinkType(), getNr(), getShape(), getTarget(), getTargetFrame(), getTitle(), and getType().

79  {
80  global $ilDB;
81 
82  $q = "INSERT INTO map_area (item_id, nr, shape, ".
83  "coords, link_type, title, href, target, type, highlight_mode, highlight_class, target_frame) ".
84  " VALUES (".
85  $ilDB->quote($this->getItemId(), "integer").",".
86  $ilDB->quote($this->getNr(), "integer").",".
87  $ilDB->quote($this->getShape(), "text").",".
88  $ilDB->quote($this->getCoords(), "text").",".
89  $ilDB->quote($this->getLinkType(), "text").",".
90  $ilDB->quote($this->getTitle(), "text").",".
91  $ilDB->quote($this->getHref(), "text").",".
92  $ilDB->quote($this->getTarget(), "text").",".
93  $ilDB->quote($this->getType(), "text").",".
94  $ilDB->quote($this->getHighlightMode(), "text").",".
95  $ilDB->quote($this->getHighlightClass(), "text").",".
96  $ilDB->quote($this->getTargetFrame(), "text").")";
97  $ilDB->manipulate($q);
98  }
getTargetFrame()
get link target frame (internal link only)
getItemId()
get item id
getTitle()
get (tooltip) title
getHref()
get hyper reference url (external link only)
getCoords()
get coords
getNr()
get area number
getHighlightMode()
Get highlight mode.
getLinkType()
get link type
getShape()
get shape
global $ilDB
getHighlightClass()
Get highlight class.
getTarget($a_insert_inst=false)
get link target (internal link only)
getType()
get link type (internal link only)
+ Here is the call graph for this function:

◆ draw()

ilMapArea::draw ( $a_image,
  $a_col1,
  $a_col2,
  $a_close_poly = true,
  $a_x_ratio = 1,
  $a_y_ratio = 1 
)

draw image to

Parameters
boolean$a_close_polyclose polygon

Definition at line 576 of file class.ilMapArea.php.

References drawCircle(), drawPoly(), drawRect(), getCoords(), and getShape().

578  {
579  switch ($this->getShape())
580  {
581  case "Rect" :
582  $this->drawRect($a_image, $this->getCoords(), $a_col1, $a_col2,
583  $a_x_ratio, $a_y_ratio);
584  break;
585 
586  case "Circle" :
587  $this->drawCircle($a_image, $this->getCoords(), $a_col1, $a_col2,
588  $a_x_ratio, $a_y_ratio);
589  break;
590 
591  case "Poly" :
592  $this->drawPoly($a_image, $this->getCoords(), $a_col1, $a_col2, $a_close_poly,
593  $a_x_ratio, $a_y_ratio);
594  break;
595  }
596  }
drawCircle(&$im, $coords, $c1, $c2, $a_x_ratio=1, $a_y_ratio=1)
draws an outlined two colored circle
drawRect(&$im, $coords, $c1, $c2, $a_x_ratio=1, $a_y_ratio=1)
draws an outlined two color rectangle
getCoords()
get coords
getShape()
get shape
drawPoly(&$im, $coords, $c1, $c2, $closed, $a_x_ratio=1, $a_y_ratio=1)
draws an outlined two color polygon
+ Here is the call graph for this function:

◆ drawCircle()

ilMapArea::drawCircle ( $im,
  $coords,
  $c1,
  $c2,
  $a_x_ratio = 1,
  $a_y_ratio = 1 
)

draws an outlined two colored circle

Parameters
int$imimage identifier as returned by ImageCreateFromGIF()
string$coordscoordinate string, format : "x,y,r" with (x,y) as center point and r as radius
int$c1color identifier 1
int$c3color identifier 2

Definition at line 690 of file class.ilMapArea.php.

Referenced by draw().

691  {
692  $c = explode(",", $coords);
693  imagearc($im, $c[0] / $a_x_ratio, $c[1] / $a_y_ratio,
694  ($c[2]+1)*2 / $a_x_ratio, ($c[2]+1)*2 / $a_y_ratio, 1, 360, $c1);
695  imagearc($im, $c[0] / $a_x_ratio, $c[1] / $a_y_ratio,
696  ($c[2]-1)*2 / $a_x_ratio, ($c[2]-1)*2 / $a_y_ratio, 1, 360, $c1);
697  imagearc($im, $c[0] / $a_x_ratio, $c[1] / $a_y_ratio,
698  $c[2]*2 / $a_x_ratio, $c[2]*2 / $a_y_ratio, 1, 360, $c2);
699  }
+ Here is the caller graph for this function:

◆ drawLine()

ilMapArea::drawLine ( $im,
  $x1,
  $y1,
  $x2,
  $y2,
  $c1,
  $c2 
)

draws an outlined two color line in an image

Parameters
int$imimage identifier as returned by ImageCreateFromGIF() etc.
int$x1x-coordinate of starting point
int$y1y-coordinate of starting point
int$x2x-coordinate of ending point
int$y2y-coordinate of ending point
int$c1color identifier 1
int$c2color identifier 2

Definition at line 609 of file class.ilMapArea.php.

Referenced by drawPoly(), and drawRect().

610  {
611  imageline($im, $x1+1, $y1, $x2+1, $y2, $c1);
612  imageline($im, $x1-1, $y1, $x2-1, $y2, $c1);
613  imageline($im, $x1, $y1+1, $x2, $y2+1, $c1);
614  imageline($im, $x1, $y1-1, $x2, $y2-1, $c1);
615  imageline($im, $x1, $y1, $x2, $y2, $c2);
616  }
+ Here is the caller graph for this function:

◆ drawPoly()

ilMapArea::drawPoly ( $im,
  $coords,
  $c1,
  $c2,
  $closed,
  $a_x_ratio = 1,
  $a_y_ratio = 1 
)

draws an outlined two color polygon

Parameters
int$imimage identifier as returned by ImageCreateFromGIF() etc.
string$coordscoordinate string, format : "x1,y1,x2,y2,..." with every (x,y) pair is an ending point of a line of the polygon
int$c1color identifier 1
int$c3color identifier 2
boolean$closedtrue: the first and the last point will be connected with a line

Definition at line 652 of file class.ilMapArea.php.

References countCoords(), and drawLine().

Referenced by draw().

653  {
654  if ($closed)
655  {
656  $p = 0;
657  }
658  else
659  {
660  $p = 1;
661  }
662 
664 
665  if ($anz < (3 - $p))
666  {
667  return;
668  }
669 
670  $c = explode(",", $coords);
671 
672  for($i=0; $i<$anz-$p; $i++)
673  {
674  $this->drawLine($im, $c[$i*2] / $a_x_ratio, $c[$i*2+1] / $a_y_ratio,
675  $c[($i*2+2)%(2*$anz)] / $a_x_ratio,
676  $c[($i*2+3)%(2*$anz)] / $a_y_ratio, $c1, $c2);
677  }
678  }
countCoords($c)
count the number of coordinates (x,y) in a coordinate string (format: "x1,y1,x2,y2,x3,y3,...")
drawLine(&$im, $x1, $y1, $x2, $y2, $c1, $c2)
draws an outlined two color line in an image
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ drawRect()

ilMapArea::drawRect ( $im,
  $coords,
  $c1,
  $c2,
  $a_x_ratio = 1,
  $a_y_ratio = 1 
)

draws an outlined two color rectangle

Parameters
int$imimage identifier as returned by ImageCreateFromGIF() etc.
string$coordscoordinate string, format : "x1,y1,x2,y2" with (x1,y1) is top left and (x2,y2) is bottom right point of the rectangle
int$c1color identifier 1
int$c2color identifier 2

Definition at line 627 of file class.ilMapArea.php.

References drawLine().

Referenced by draw().

628  {
629  $coord=explode(",", $coords);
630 
631  $this->drawLine($im, $coord[0] / $a_x_ratio, $coord[1] / $a_y_ratio,
632  $coord[0] / $a_x_ratio, $coord[3] / $a_y_ratio, $c1, $c2);
633  $this->drawLine($im, $coord[0] / $a_x_ratio, $coord[3] / $a_y_ratio,
634  $coord[2] / $a_x_ratio, $coord[3] / $a_y_ratio, $c1, $c2);
635  $this->drawLine($im, $coord[2] / $a_x_ratio, $coord[3] / $a_y_ratio,
636  $coord[2] / $a_x_ratio, $coord[1] / $a_y_ratio, $c1, $c2);
637  $this->drawLine($im, $coord[2] / $a_x_ratio, $coord[1] / $a_y_ratio,
638  $coord[0] / $a_x_ratio, $coord[1] / $a_y_ratio, $c1, $c2);
639  }
drawLine(&$im, $x1, $y1, $x2, $y2, $c1, $c2)
draws an outlined two color line in an image
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getAllHighlightClasses()

ilMapArea::getAllHighlightClasses ( )

Get all highlight classes.

Parameters

Definition at line 300 of file class.ilMapArea.php.

References $lng.

Referenced by ilImageMapTableGUI\__construct().

301  {
302  global $lng;
303 
304  return array(
305  self::HLCL_ACCENTED => $lng->txt("cont_accented"),
306  self::HLCL_LIGHT => $lng->txt("cont_light"),
307  self::HLCL_DARK => $lng->txt("cont_dark"),
308  );
309  }
global $lng
Definition: privfeed.php:40
+ Here is the caller graph for this function:

◆ getAllHighlightModes()

ilMapArea::getAllHighlightModes ( )

Get all highlight modes.

Parameters

Definition at line 261 of file class.ilMapArea.php.

References $lng.

Referenced by ilImageMapTableGUI\__construct().

262  {
263  global $lng;
264 
265  return array(
266  self::HL_NONE => $lng->txt("cont_none"),
267  self::HL_HOVER => $lng->txt("cont_hover"),
268  self::HL_ALWAYS => $lng->txt("cont_always")
269  );
270 
271  }
global $lng
Definition: privfeed.php:40
+ Here is the caller graph for this function:

◆ getCoords()

ilMapArea::getCoords ( )

get coords

Returns
string coords (comma separated integers)

Definition at line 406 of file class.ilMapArea.php.

References $coords.

Referenced by create(), draw(), and update().

407  {
408  return $this->coords;
409  }
+ Here is the caller graph for this function:

◆ getExtTitle()

ilMapArea::getExtTitle ( )

get link text (external link only)

Returns
string link text

Definition at line 496 of file class.ilMapArea.php.

References $xl_title.

497  {
498  return $this->xl_title;
499  }

◆ getHighlightClass()

ilMapArea::getHighlightClass ( )

Get highlight class.

Returns
string highlight class

Definition at line 326 of file class.ilMapArea.php.

Referenced by create(), and update().

327  {
328  return $this->highlight_class;
329  }
+ Here is the caller graph for this function:

◆ getHighlightMode()

ilMapArea::getHighlightMode ( )

Get highlight mode.

Returns
string highlight mode

Definition at line 289 of file class.ilMapArea.php.

Referenced by create(), and update().

290  {
291  return $this->highlight_mode;
292  }
+ Here is the caller graph for this function:

◆ getHref()

ilMapArea::getHref ( )

get hyper reference url (external link only)

Parameters
stringhyper ref url

Definition at line 476 of file class.ilMapArea.php.

References $xl_href.

Referenced by create(), and update().

477  {
478  return $this->xl_href;
479  }
+ Here is the caller graph for this function:

◆ getItemId()

ilMapArea::getItemId ( )

get item id

Returns
int media item id

Definition at line 346 of file class.ilMapArea.php.

References $item_id.

Referenced by create(), read(), and update().

347  {
348  return $this->item_id;
349  }
+ Here is the caller graph for this function:

◆ getLinkType()

ilMapArea::getLinkType ( )

get link type

Returns
int link type (IL_INT_LINK, IL_EXT_LINK)

Definition at line 456 of file class.ilMapArea.php.

References $linktype.

Referenced by create(), and update().

457  {
458  return $this->linktype;
459  }
+ Here is the caller graph for this function:

◆ getNr()

ilMapArea::getNr ( )

get area number

Returns
int number (of area within parent media object)

Definition at line 366 of file class.ilMapArea.php.

References $nr.

Referenced by create(), read(), and update().

367  {
368  return $this->nr;
369  }
+ Here is the caller graph for this function:

◆ getShape()

ilMapArea::getShape ( )

get shape

Returns
string (IL_AREA_RECT, IL_AREA_CIRCLE, IL_AREA_POLY, IL_AREA_WHOLE_PICTURE)

Definition at line 386 of file class.ilMapArea.php.

References $shape.

Referenced by create(), draw(), and update().

387  {
388  return $this->shape;
389  }
+ Here is the caller graph for this function:

◆ getTarget()

ilMapArea::getTarget (   $a_insert_inst = false)

get link target (internal link only)

Returns
string link target

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

References $il_target.

Referenced by create(), and update().

517  {
518  $target = $this->il_target;
519 
520  if ((substr($target, 0, 4) == "il__") && $a_insert_inst)
521  {
522  $target = "il_".IL_INST_ID."_".substr($target, 4, strlen($target) - 4);
523  }
524 
525  return $target;
526  }
+ Here is the caller graph for this function:

◆ getTargetFrame()

ilMapArea::getTargetFrame ( )

get link target frame (internal link only)

Returns
string link target frame target frame (IL_TF_MEDIA | IL_TF_FAQ | IL_TF_GLOSSARY | IL_TF_NEW)

Definition at line 566 of file class.ilMapArea.php.

References $il_target_frame.

Referenced by create(), and update().

567  {
568  return $this->il_target_frame;
569  }
+ Here is the caller graph for this function:

◆ getTitle()

ilMapArea::getTitle ( )

get (tooltip) title

Returns
string title

Definition at line 436 of file class.ilMapArea.php.

References $title.

Referenced by create(), and update().

437  {
438  return $this->title;
439  }
+ Here is the caller graph for this function:

◆ getType()

ilMapArea::getType ( )

get link type (internal link only)

Returns
string (IL_LT_STRUCTURE | IL_LT_PAGE | IL_LT_MEDIA | IL_LT_GLITEM)

Definition at line 544 of file class.ilMapArea.php.

References $il_type.

Referenced by create(), and update().

545  {
546  return $this->il_type;
547  }
+ Here is the caller graph for this function:

◆ ilMapArea()

ilMapArea::ilMapArea (   $a_item_id = 0,
  $a_nr = 0 
)

map area

Parameters
int$a_item_idparent media item id
int$a_nrmap area number within media item

Definition at line 64 of file class.ilMapArea.php.

References read(), setItemId(), and setNr().

65  {
66  $this->title = "";
67  if ($a_item_id !=0 && $a_nr != 0)
68  {
69  $this->setItemId($a_item_id);
70  $this->setNr($a_nr);
71  $this->read();
72  }
73  }
read()
read map area data into object (item id and nr must be set)
setNr($a_nr)
set area number
setItemId($a_item_id)
set media item id
+ Here is the call graph for this function:

◆ read()

ilMapArea::read ( )

read map area data into object (item id and nr must be set)

Definition at line 122 of file class.ilMapArea.php.

References $ilDB, getItemId(), getNr(), setCoords(), setHighlightClass(), setHighlightMode(), setHref(), setLinkType(), setNr(), setShape(), setTarget(), setTargetFrame(), setTitle(), and setType().

Referenced by ilMapArea().

123  {
124  global $ilDB;
125 
126  $q = "SELECT * FROM map_area WHERE item_id = ".
127  $ilDB->quote($this->getItemId(), "integer").
128  " AND nr = ".$ilDB->quote($this->getNr(), "integer");
129  $area_set = $ilDB->query($q);
130  $area_rec = $ilDB->fetchAssoc($area_set);
131 
132  $this->setShape($area_rec["shape"]);
133 //echo $area_rec["Shape"];
134  $this->setNr($area_rec["nr"]);
135  $this->setCoords($area_rec["coords"]);
136  $this->setLinkType($area_rec["link_type"]);
137  $this->setTitle($area_rec["title"]);
138  $this->setHref($area_rec["href"]);
139  $this->setTarget($area_rec["target"]);
140  $this->setType($area_rec["type"]);
141  $this->setTargetFrame($area_rec["target_frame"]);
142  $this->setHighlightMode($area_rec["highlight_mode"]);
143  $this->setHighlightClass($area_rec["highlight_class"]);
144 
145  }
setHighlightClass($a_val)
Set highlight class.
setTarget($a_target)
set link target (internal link only)
setTargetFrame($a_target_frame)
set link target frame (internal link only)
getItemId()
get item id
setHref($a_href)
set hyper reference (external link only)
setCoords($a_coords)
set coords of area
setHighlightMode($a_val)
Set highlight mode.
getNr()
get area number
setType($a_type)
set link type (internal link only)
setTitle($a_title)
set (tooltip)title of area
setShape($a_shape)
set shape (IL_AREA_RECT, IL_AREA_CIRCLE, IL_AREA_POLY, IL_AREA_WHOLE_PICTURE)
global $ilDB
setNr($a_nr)
set area number
setLinkType($a_link_type)
set link type
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ setCoords()

ilMapArea::setCoords (   $a_coords)

set coords of area

Parameters
string$a_coordscoords (comma separated integers)

Definition at line 396 of file class.ilMapArea.php.

Referenced by read().

397  {
398  $this->coords = $a_coords;
399  }
+ Here is the caller graph for this function:

◆ setExtTitle()

ilMapArea::setExtTitle (   $a_title)

set link text (external link only)

Parameters
string$a_titlelink text

Definition at line 486 of file class.ilMapArea.php.

487  {
488  $this->xl_title = $a_title;
489  }

◆ setHighlightClass()

ilMapArea::setHighlightClass (   $a_val)

Set highlight class.

Parameters
string$a_valhighlight class

Definition at line 316 of file class.ilMapArea.php.

Referenced by read().

317  {
318  $this->highlight_class = $a_val;
319  }
+ Here is the caller graph for this function:

◆ setHighlightMode()

ilMapArea::setHighlightMode (   $a_val)

Set highlight mode.

Parameters
string$a_valhighlight mode

Definition at line 279 of file class.ilMapArea.php.

Referenced by read().

280  {
281  $this->highlight_mode = $a_val;
282  }
+ Here is the caller graph for this function:

◆ setHref()

ilMapArea::setHref (   $a_href)

set hyper reference (external link only)

Parameters
string$a_hrefhyper ref url

Definition at line 466 of file class.ilMapArea.php.

Referenced by read().

467  {
468  $this->xl_href = $a_href;
469  }
+ Here is the caller graph for this function:

◆ setItemId()

ilMapArea::setItemId (   $a_item_id)

set media item id

Parameters
int$a_item_idmedia item id

Definition at line 336 of file class.ilMapArea.php.

Referenced by ilMapArea().

337  {
338  $this->item_id = $a_item_id;
339  }
+ Here is the caller graph for this function:

◆ setLinkType()

ilMapArea::setLinkType (   $a_link_type)

set link type

Parameters
string$a_linktypelink type (IL_INT_LINK, IL_EXT_LINK)

Definition at line 446 of file class.ilMapArea.php.

Referenced by read(), and ilImageMapEditorGUI\saveArea().

447  {
448  $this->linktype = $a_link_type;
449  }
+ Here is the caller graph for this function:

◆ setNr()

ilMapArea::setNr (   $a_nr)

set area number

Parameters
int$a_nrnumber (of area within parent media object)

Definition at line 356 of file class.ilMapArea.php.

Referenced by ilMapArea(), and read().

357  {
358  $this->nr = $a_nr;
359  }
+ Here is the caller graph for this function:

◆ setShape()

ilMapArea::setShape (   $a_shape)

set shape (IL_AREA_RECT, IL_AREA_CIRCLE, IL_AREA_POLY, IL_AREA_WHOLE_PICTURE)

Parameters
string$a_shapeshape of map area

Definition at line 376 of file class.ilMapArea.php.

Referenced by read(), and ilImageMapEditorGUI\saveArea().

377  {
378  $this->shape = $a_shape;
379  }
+ Here is the caller graph for this function:

◆ setTarget()

ilMapArea::setTarget (   $a_target)

set link target (internal link only)

Parameters
string$a_targetlink target (e.g. "il__pg_23")

Definition at line 506 of file class.ilMapArea.php.

Referenced by read().

507  {
508  $this->il_target = $a_target;
509  }
+ Here is the caller graph for this function:

◆ setTargetFrame()

ilMapArea::setTargetFrame (   $a_target_frame)

set link target frame (internal link only)

Parameters
string$a_target_frametarget frame (IL_TF_MEDIA | IL_TF_FAQ | IL_TF_GLOSSARY | IL_TF_NEW)

Definition at line 555 of file class.ilMapArea.php.

Referenced by read().

556  {
557  $this->il_target_frame = $a_target_frame;
558  }
+ Here is the caller graph for this function:

◆ setTitle()

ilMapArea::setTitle (   $a_title)

set (tooltip)title of area

Parameters
string$a_titletitle

Definition at line 416 of file class.ilMapArea.php.

Referenced by read(), and ilImageMapEditorGUI\updateAreas().

417  {
418  $this->title = $a_title;
419  }
+ Here is the caller graph for this function:

◆ setType()

ilMapArea::setType (   $a_type)

set link type (internal link only)

Parameters
string$a_typelink type (IL_LT_STRUCTURE | IL_LT_PAGE | IL_LT_MEDIA | IL_LT_GLITEM)

Definition at line 534 of file class.ilMapArea.php.

Referenced by read().

535  {
536  $this->il_type = $a_type;
537  }
+ Here is the caller graph for this function:

◆ update()

ilMapArea::update ( )

update map area

Definition at line 150 of file class.ilMapArea.php.

References $ilDB, getCoords(), getHighlightClass(), getHighlightMode(), getHref(), getItemId(), getLinkType(), getNr(), getShape(), getTarget(), getTargetFrame(), getTitle(), and getType().

151  {
152  global $ilDB;
153 
154  $q = "UPDATE map_area SET shape = ".$ilDB->quote($this->getShape(), "text").
155  ", coords = ".$ilDB->quote($this->getCoords(), "text").
156  ", link_type = ".$ilDB->quote($this->getLinkType(), "text").
157  ", title = ".$ilDB->quote($this->getTitle(), "text").
158  ", href = ".$ilDB->quote($this->getHref(), "text").
159  ", target = ".$ilDB->quote($this->getTarget(), "text").
160  ", type = ".$ilDB->quote($this->getType(), "text").
161  ", highlight_mode = ".$ilDB->quote($this->getHighlightMode(), "text").
162  ", highlight_class = ".$ilDB->quote($this->getHighlightClass(), "text").
163  ", target_frame = ".$ilDB->quote($this->getTargetFrame(), "text").
164  " WHERE item_id = ".$ilDB->quote($this->getItemId(), "integer").
165  " AND nr = ".$ilDB->quote($this->getNr(), "integer");
166  $ilDB->manipulate($q);
167  }
getTargetFrame()
get link target frame (internal link only)
getItemId()
get item id
getTitle()
get (tooltip) title
getHref()
get hyper reference url (external link only)
getCoords()
get coords
getNr()
get area number
getHighlightMode()
Get highlight mode.
getLinkType()
get link type
getShape()
get shape
global $ilDB
getHighlightClass()
Get highlight class.
getTarget($a_insert_inst=false)
get link target (internal link only)
getType()
get link type (internal link only)
+ Here is the call graph for this function:

Field Documentation

◆ $coords

ilMapArea::$coords

Definition at line 48 of file class.ilMapArea.php.

Referenced by getCoords().

◆ $il_target

ilMapArea::$il_target

Definition at line 53 of file class.ilMapArea.php.

Referenced by getTarget().

◆ $il_target_frame

ilMapArea::$il_target_frame

Definition at line 55 of file class.ilMapArea.php.

Referenced by getTargetFrame().

◆ $il_type

ilMapArea::$il_type

Definition at line 54 of file class.ilMapArea.php.

Referenced by getType().

◆ $item_id

ilMapArea::$item_id

Definition at line 45 of file class.ilMapArea.php.

Referenced by getItemId().

◆ $linktype

ilMapArea::$linktype

Definition at line 50 of file class.ilMapArea.php.

Referenced by getLinkType().

◆ $nr

ilMapArea::$nr

Definition at line 46 of file class.ilMapArea.php.

Referenced by getNr().

◆ $shape

ilMapArea::$shape

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

Referenced by getShape().

◆ $title

ilMapArea::$title

Definition at line 49 of file class.ilMapArea.php.

Referenced by getTitle().

◆ $xl_href

ilMapArea::$xl_href

Definition at line 52 of file class.ilMapArea.php.

Referenced by getHref().

◆ $xl_title

ilMapArea::$xl_title

Definition at line 51 of file class.ilMapArea.php.

Referenced by getExtTitle().

◆ HL_ALWAYS

const ilMapArea::HL_ALWAYS = "Always"

Definition at line 40 of file class.ilMapArea.php.

◆ HL_HOVER

const ilMapArea::HL_HOVER = "Hover"

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

◆ HL_NONE

const ilMapArea::HL_NONE = ""

Definition at line 38 of file class.ilMapArea.php.

◆ HLCL_ACCENTED

const ilMapArea::HLCL_ACCENTED = ""

Definition at line 41 of file class.ilMapArea.php.

◆ HLCL_DARK

const ilMapArea::HLCL_DARK = "Dark"

Definition at line 43 of file class.ilMapArea.php.

◆ HLCL_LIGHT

const ilMapArea::HLCL_LIGHT = "Light"

Definition at line 42 of file class.ilMapArea.php.


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