ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
ilMapArea Class Reference

Class ilMapArea. More...

+ Collaboration diagram for ilMapArea:

Public Member Functions

 __construct ($a_item_id=0, $a_nr=0)
 map area More...
 
 create ()
 create persistent map area object in db More...
 
 read ()
 read map area data into object (item id and nr must be set) More...
 
 update ()
 update map area More...
 
 setHighlightMode ($a_val)
 Set highlight mode. More...
 
 getHighlightMode ()
 Get highlight mode. 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...
 

Static Public Member Functions

static _getMaxNr ($a_item_id)
 get maximum nr of media item (static) More...
 
static _resolveIntLinks ($a_item_id)
 resolve internal links of an item id More...
 
static _getIntLinks ($a_item_id)
 get all internal links of a media items map areas More...
 
static _getMobsForTarget ($a_type, $a_target)
 Get areas for a certain target. More...
 
static getAllHighlightModes ()
 Get all highlight modes. More...
 
static getAllHighlightClasses ()
 Get all highlight classes. More...
 
static countCoords ($c)
 count the number of coordinates (x,y) in a coordinate string (format: "x1,y1,x2,y2,x3,y3,...") 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
 

Protected Attributes

 $db
 

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.

Constructor & Destructor Documentation

◆ __construct()

ilMapArea::__construct (   $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 69 of file class.ilMapArea.php.

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

70  {
71  global $DIC;
72 
73  $this->db = $DIC->database();
74  $this->title = "";
75  if ($a_item_id !=0 && $a_nr != 0) {
76  $this->setItemId($a_item_id);
77  $this->setNr($a_nr);
78  $this->read();
79  }
80  }
global $DIC
Definition: saml.php:7
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:

Member Function Documentation

◆ _getIntLinks()

static ilMapArea::_getIntLinks (   $a_item_id)
static

get all internal links of a media items map areas

Parameters
int$a_item_idmedia item id

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

References $DIC, $ilDB, $links, $target, $type, array, and IL_INT_LINK.

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

215  {
216  global $DIC;
217 
218  $ilDB = $DIC->database();
219 
220  $q = "SELECT * FROM map_area WHERE item_id = " .
221  $ilDB->quote($a_item_id, "integer");
222  $area_set = $ilDB->query($q);
223 
224  $links = array();
225 
226  while ($area_rec = $ilDB->fetchAssoc($area_set)) {
227  $target = $area_rec["target"];
228  $type = $area_rec["type"];
229  $targetframe = $area_rec["target_frame"];
230 
231  if (($area_rec["link_type"] == IL_INT_LINK) && (is_int(strpos($target, "__")))) {
232  $links[$target . ":" . $type . ":" . $targetframe] =
233  array("Target" => $target, "Type" => $type,
234  "TargetFrame" => $targetframe);
235  }
236  }
237  return $links;
238  }
$type
global $DIC
Definition: saml.php:7
const IL_INT_LINK
Create styles array
The data for the language used.
global $ilDB
$links
+ Here is the caller graph for this function:

◆ _getMaxNr()

static ilMapArea::_getMaxNr (   $a_item_id)
static

get maximum nr of media item (static)

Parameters
int$a_item_iditem id
Returns
int maximum nr

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

References $DIC, and $ilDB.

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

115  {
116  global $DIC;
117 
118  $ilDB = $DIC->database();
119 
120  $q = "SELECT max(nr) AS max_nr FROM map_area WHERE item_id = " .
121  $ilDB->quote($a_item_id, "integer");
122  $max_set = $ilDB->query($q);
123  $max_rec = $ilDB->fetchAssoc($max_set);
124 
125  return $max_rec["max_nr"];
126  }
global $DIC
Definition: saml.php:7
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 243 of file class.ilMapArea.php.

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

Referenced by ilLMObject\updateInternalLinks().

244  {
245  global $DIC;
246 
247  $ilDB = $DIC->database();
248 
249  $q = "SELECT * FROM map_area WHERE " .
250  " link_type = " . $ilDB->quote($a_type, "text") .
251  " AND target = " . $ilDB->quote($a_target, "text");
252  $set = $ilDB->query($q);
253 
254  $mobs = array();
255  while ($rec = $ilDB->fetchAssoc($set)) {
256  $mob_id = ilMediaItem::_lookupMobId($rec["item_id"]);
257  $mobs[$mob_id] = $mob_id;
258  }
259 
260  return $mobs;
261  }
global $DIC
Definition: saml.php:7
$a_type
Definition: workflow.php:92
$mobs
static _lookupMobId($a_med_id)
Lookup Mob ID.
Create styles array
The data for the language used.
global $ilDB
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ _resolveIntLinks()

static ilMapArea::_resolveIntLinks (   $a_item_id)
static

resolve internal links of an item id

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

References $DIC, $ilDB, $item_id, $nr, $query, $target, $type, ilInternalLink\_getIdForImportId(), and IL_INT_LINK.

Referenced by ilMediaItem\_resolveMapAreaLinks().

181  {
182  global $DIC;
183 
184  $ilDB = $DIC->database();
185 
186  //echo "maparea::resolve<br>";
187  $q = "SELECT * FROM map_area WHERE item_id = " .
188  $ilDB->quote($a_item_id, "integer");
189  $area_set = $ilDB->query($q);
190  while ($area_rec = $ilDB->fetchAssoc($area_set)) {
191  $target = $area_rec["target"];
192  $type = $area_rec["type"];
193  $item_id = $area_rec["item_id"];
194  $nr = $area_rec["nr"];
195 
196  if (($area_rec["link_type"] == IL_INT_LINK) && (!is_int(strpos($target, "__")))) {
198  if ($new_target !== false) {
199  $query = "UPDATE map_area SET " .
200  "target = " . $ilDB->quote($new_target, "text") . " " .
201  "WHERE item_id = " . $ilDB->quote($item_id, "integer") .
202  " AND nr = " . $ilDB->quote($nr, "integer");
203  $ilDB->manipulate($query);
204  }
205  }
206  }
207  }
$type
global $DIC
Definition: saml.php:7
const IL_INT_LINK
$query
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 436 of file class.ilMapArea.php.

437  {
438  $this->title.= $a_title_str;
439  }

◆ countCoords()

static ilMapArea::countCoords (   $c)
static

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

Parameters
string$ccoordinate string
Returns
int number of coordinates

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

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

793  {
794  if ($c == "") {
795  return 0;
796  } else {
797  $coord_array = explode(",", $c);
798  return (count($coord_array) / 2);
799  }
800  }
+ Here is the caller graph for this function:

◆ create()

ilMapArea::create ( )

create persistent map area object in db

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

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

86  {
87  $ilDB = $this->db;
88 
89  $q = "INSERT INTO map_area (item_id, nr, shape, " .
90  "coords, link_type, title, href, target, type, highlight_mode, highlight_class, target_frame) " .
91  " VALUES (" .
92  $ilDB->quote($this->getItemId(), "integer") . "," .
93  $ilDB->quote($this->getNr(), "integer") . "," .
94  $ilDB->quote($this->getShape(), "text") . "," .
95  $ilDB->quote($this->getCoords(), "text") . "," .
96  $ilDB->quote($this->getLinkType(), "text") . "," .
97  $ilDB->quote($this->getTitle(), "text") . "," .
98  $ilDB->quote($this->getHref(), "text") . "," .
99  $ilDB->quote($this->getTarget(), "text") . "," .
100  $ilDB->quote($this->getType(), "text") . "," .
101  $ilDB->quote($this->getHighlightMode(), "text") . "," .
102  $ilDB->quote($this->getHighlightClass(), "text") . "," .
103  $ilDB->quote($this->getTargetFrame(), "text") . ")";
104  $ilDB->manipulate($q);
105  }
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 585 of file class.ilMapArea.php.

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

592  {
593  switch ($this->getShape()) {
594  case "Rect":
595  $this->drawRect(
596  $a_image,
597  $this->getCoords(),
598  $a_col1,
599  $a_col2,
600  $a_x_ratio,
601  $a_y_ratio
602  );
603  break;
604 
605  case "Circle":
606  $this->drawCircle(
607  $a_image,
608  $this->getCoords(),
609  $a_col1,
610  $a_col2,
611  $a_x_ratio,
612  $a_y_ratio
613  );
614  break;
615 
616  case "Poly":
617  $this->drawPoly(
618  $a_image,
619  $this->getCoords(),
620  $a_col1,
621  $a_col2,
622  $a_close_poly,
623  $a_x_ratio,
624  $a_y_ratio
625  );
626  break;
627  }
628  }
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 751 of file class.ilMapArea.php.

References $coords.

Referenced by draw().

752  {
753  $c = explode(",", $coords);
754  imagearc(
755  $im,
756  $c[0] / $a_x_ratio,
757  $c[1] / $a_y_ratio,
758  ($c[2]+1)*2 / $a_x_ratio,
759  ($c[2]+1)*2 / $a_y_ratio,
760  1,
761  360,
762  $c1
763  );
764  imagearc(
765  $im,
766  $c[0] / $a_x_ratio,
767  $c[1] / $a_y_ratio,
768  ($c[2]-1)*2 / $a_x_ratio,
769  ($c[2]-1)*2 / $a_y_ratio,
770  1,
771  360,
772  $c1
773  );
774  imagearc(
775  $im,
776  $c[0] / $a_x_ratio,
777  $c[1] / $a_y_ratio,
778  $c[2]*2 / $a_x_ratio,
779  $c[2]*2 / $a_y_ratio,
780  1,
781  360,
782  $c2
783  );
784  }
+ 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 641 of file class.ilMapArea.php.

Referenced by drawPoly(), and drawRect().

642  {
643  imageline($im, $x1+1, $y1, $x2+1, $y2, $c1);
644  imageline($im, $x1-1, $y1, $x2-1, $y2, $c1);
645  imageline($im, $x1, $y1+1, $x2, $y2+1, $c1);
646  imageline($im, $x1, $y1-1, $x2, $y2-1, $c1);
647  imageline($im, $x1, $y1, $x2, $y2, $c2);
648  }
+ 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 712 of file class.ilMapArea.php.

References $coords, $i, countCoords(), and drawLine().

Referenced by draw().

713  {
714  if ($closed) {
715  $p = 0;
716  } else {
717  $p = 1;
718  }
719 
721 
722  if ($anz < (3 - $p)) {
723  return;
724  }
725 
726  $c = explode(",", $coords);
727 
728  for ($i=0; $i<$anz-$p; $i++) {
729  $this->drawLine(
730  $im,
731  $c[$i*2] / $a_x_ratio,
732  $c[$i*2+1] / $a_y_ratio,
733  $c[($i*2+2)%(2*$anz)] / $a_x_ratio,
734  $c[($i*2+3)%(2*$anz)] / $a_y_ratio,
735  $c1,
736  $c2
737  );
738  }
739  }
$i
Definition: disco.tpl.php:19
static 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 659 of file class.ilMapArea.php.

References $coords, and drawLine().

Referenced by draw().

660  {
661  $coord=explode(",", $coords);
662 
663  $this->drawLine(
664  $im,
665  $coord[0] / $a_x_ratio,
666  $coord[1] / $a_y_ratio,
667  $coord[0] / $a_x_ratio,
668  $coord[3] / $a_y_ratio,
669  $c1,
670  $c2
671  );
672  $this->drawLine(
673  $im,
674  $coord[0] / $a_x_ratio,
675  $coord[3] / $a_y_ratio,
676  $coord[2] / $a_x_ratio,
677  $coord[3] / $a_y_ratio,
678  $c1,
679  $c2
680  );
681  $this->drawLine(
682  $im,
683  $coord[2] / $a_x_ratio,
684  $coord[3] / $a_y_ratio,
685  $coord[2] / $a_x_ratio,
686  $coord[1] / $a_y_ratio,
687  $c1,
688  $c2
689  );
690  $this->drawLine(
691  $im,
692  $coord[2] / $a_x_ratio,
693  $coord[1] / $a_y_ratio,
694  $coord[0] / $a_x_ratio,
695  $coord[1] / $a_y_ratio,
696  $c1,
697  $c2
698  );
699  }
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()

static ilMapArea::getAllHighlightClasses ( )
static

Get all highlight classes.

Returns
array

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

References $DIC, $lng, and array.

Referenced by ilImageMapTableGUI\__construct().

309  {
310  global $DIC;
311 
312  $lng = $DIC->language();
313 
314  return array(
315  self::HLCL_ACCENTED => $lng->txt("cont_accented"),
316  self::HLCL_LIGHT => $lng->txt("cont_light"),
317  self::HLCL_DARK => $lng->txt("cont_dark"),
318  );
319  }
global $DIC
Definition: saml.php:7
Create styles array
The data for the language used.
global $lng
Definition: privfeed.php:17
+ Here is the caller graph for this function:

◆ getAllHighlightModes()

static ilMapArea::getAllHighlightModes ( )
static

Get all highlight modes.

Parameters

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

References $DIC, $lng, and array.

Referenced by ilImageMapTableGUI\__construct().

270  {
271  global $DIC;
272 
273  $lng = $DIC->language();
274 
275  return array(
276  self::HL_NONE => $lng->txt("cont_none"),
277  self::HL_HOVER => $lng->txt("cont_hover"),
278  self::HL_ALWAYS => $lng->txt("cont_always")
279  );
280  }
global $DIC
Definition: saml.php:7
Create styles array
The data for the language used.
global $lng
Definition: privfeed.php:17
+ Here is the caller graph for this function:

◆ getCoords()

ilMapArea::getCoords ( )

get coords

Returns
string coords (comma separated integers)

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

References $coords.

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

417  {
418  return $this->coords;
419  }
+ Here is the caller graph for this function:

◆ getExtTitle()

ilMapArea::getExtTitle ( )

get link text (external link only)

Returns
string link text

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

References $xl_title.

507  {
508  return $this->xl_title;
509  }

◆ getHighlightClass()

ilMapArea::getHighlightClass ( )

Get highlight class.

Returns
string highlight class

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

Referenced by create(), and update().

337  {
338  return $this->highlight_class;
339  }
+ Here is the caller graph for this function:

◆ getHighlightMode()

ilMapArea::getHighlightMode ( )

Get highlight mode.

Returns
string highlight mode

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

Referenced by create(), and update().

299  {
300  return $this->highlight_mode;
301  }
+ 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 486 of file class.ilMapArea.php.

References $xl_href.

Referenced by create(), and update().

487  {
488  return $this->xl_href;
489  }
+ Here is the caller graph for this function:

◆ getItemId()

ilMapArea::getItemId ( )

get item id

Returns
int media item id

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

References $item_id.

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

357  {
358  return $this->item_id;
359  }
+ 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 466 of file class.ilMapArea.php.

References $linktype.

Referenced by create(), and update().

467  {
468  return $this->linktype;
469  }
+ 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 376 of file class.ilMapArea.php.

References $nr.

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

377  {
378  return $this->nr;
379  }
+ 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 396 of file class.ilMapArea.php.

References $shape.

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

397  {
398  return $this->shape;
399  }
+ 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 526 of file class.ilMapArea.php.

References $il_target, and $target.

Referenced by create(), and update().

527  {
529 
530  if ((substr($target, 0, 4) == "il__") && $a_insert_inst) {
531  $target = "il_" . IL_INST_ID . "_" . substr($target, 4, strlen($target) - 4);
532  }
533 
534  return $target;
535  }
+ 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 575 of file class.ilMapArea.php.

References $il_target_frame.

Referenced by create(), and update().

576  {
577  return $this->il_target_frame;
578  }
+ Here is the caller graph for this function:

◆ getTitle()

ilMapArea::getTitle ( )

get (tooltip) title

Returns
string title

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

References $title.

Referenced by create(), and update().

447  {
448  return $this->title;
449  }
+ 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 553 of file class.ilMapArea.php.

References $il_type.

Referenced by create(), and update().

554  {
555  return $this->il_type;
556  }
+ Here is the caller graph for this function:

◆ read()

ilMapArea::read ( )

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

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

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

Referenced by __construct().

132  {
133  $ilDB = $this->db;
134 
135  $q = "SELECT * FROM map_area WHERE item_id = " .
136  $ilDB->quote($this->getItemId(), "integer") .
137  " AND nr = " . $ilDB->quote($this->getNr(), "integer");
138  $area_set = $ilDB->query($q);
139  $area_rec = $ilDB->fetchAssoc($area_set);
140 
141  $this->setShape($area_rec["shape"]);
142  //echo $area_rec["Shape"];
143  $this->setNr($area_rec["nr"]);
144  $this->setCoords($area_rec["coords"]);
145  $this->setLinkType($area_rec["link_type"]);
146  $this->setTitle($area_rec["title"]);
147  $this->setHref($area_rec["href"]);
148  $this->setTarget($area_rec["target"]);
149  $this->setType($area_rec["type"]);
150  $this->setTargetFrame($area_rec["target_frame"]);
151  $this->setHighlightMode($area_rec["highlight_mode"]);
152  $this->setHighlightClass($area_rec["highlight_class"]);
153  }
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 406 of file class.ilMapArea.php.

Referenced by read().

407  {
408  $this->coords = $a_coords;
409  }
+ 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 496 of file class.ilMapArea.php.

497  {
498  $this->xl_title = $a_title;
499  }

◆ setHighlightClass()

ilMapArea::setHighlightClass (   $a_val)

Set highlight class.

Parameters
string$a_valhighlight class

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

Referenced by read().

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

◆ setHighlightMode()

ilMapArea::setHighlightMode (   $a_val)

Set highlight mode.

Parameters
string$a_valhighlight mode

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

Referenced by read().

289  {
290  $this->highlight_mode = $a_val;
291  }
+ 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 476 of file class.ilMapArea.php.

Referenced by read().

477  {
478  $this->xl_href = $a_href;
479  }
+ 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 346 of file class.ilMapArea.php.

Referenced by __construct().

347  {
348  $this->item_id = $a_item_id;
349  }
+ 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 456 of file class.ilMapArea.php.

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

457  {
458  $this->linktype = $a_link_type;
459  }
+ 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 366 of file class.ilMapArea.php.

Referenced by __construct(), and read().

367  {
368  $this->nr = $a_nr;
369  }
+ 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 386 of file class.ilMapArea.php.

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

387  {
388  $this->shape = $a_shape;
389  }
+ 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 516 of file class.ilMapArea.php.

Referenced by read().

517  {
518  $this->il_target = $a_target;
519  }
+ 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 564 of file class.ilMapArea.php.

Referenced by read().

565  {
566  $this->il_target_frame = $a_target_frame;
567  }
+ 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 426 of file class.ilMapArea.php.

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

427  {
428  $this->title = $a_title;
429  }
+ 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 543 of file class.ilMapArea.php.

References $a_type.

Referenced by read().

544  {
545  $this->il_type = $a_type;
546  }
$a_type
Definition: workflow.php:92
+ Here is the caller graph for this function:

◆ update()

ilMapArea::update ( )

update map area

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

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

159  {
160  $ilDB = $this->db;
161 
162  $q = "UPDATE map_area SET shape = " . $ilDB->quote($this->getShape(), "text") .
163  ", coords = " . $ilDB->quote($this->getCoords(), "text") .
164  ", link_type = " . $ilDB->quote($this->getLinkType(), "text") .
165  ", title = " . $ilDB->quote($this->getTitle(), "text") .
166  ", href = " . $ilDB->quote($this->getHref(), "text") .
167  ", target = " . $ilDB->quote($this->getTarget(), "text") .
168  ", type = " . $ilDB->quote($this->getType(), "text") .
169  ", highlight_mode = " . $ilDB->quote($this->getHighlightMode(), "text") .
170  ", highlight_class = " . $ilDB->quote($this->getHighlightClass(), "text") .
171  ", target_frame = " . $ilDB->quote($this->getTargetFrame(), "text") .
172  " WHERE item_id = " . $ilDB->quote($this->getItemId(), "integer") .
173  " AND nr = " . $ilDB->quote($this->getNr(), "integer");
174  $ilDB->manipulate($q);
175  }
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 53 of file class.ilMapArea.php.

Referenced by drawCircle(), drawPoly(), drawRect(), and getCoords().

◆ $db

ilMapArea::$db
protected

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

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

◆ $il_target

ilMapArea::$il_target

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

Referenced by getTarget().

◆ $il_target_frame

ilMapArea::$il_target_frame

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

Referenced by getTargetFrame().

◆ $il_type

ilMapArea::$il_type

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

Referenced by getType().

◆ $item_id

ilMapArea::$item_id

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

Referenced by _resolveIntLinks(), and getItemId().

◆ $linktype

ilMapArea::$linktype

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

Referenced by getLinkType().

◆ $nr

ilMapArea::$nr

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

Referenced by _resolveIntLinks(), and getNr().

◆ $shape

ilMapArea::$shape

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

Referenced by getShape().

◆ $title

ilMapArea::$title

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

Referenced by getTitle().

◆ $xl_href

ilMapArea::$xl_href

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

Referenced by getHref().

◆ $xl_title

ilMapArea::$xl_title

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

Referenced by getExtTitle().

◆ HL_ALWAYS

const ilMapArea::HL_ALWAYS = "Always"

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

◆ HL_HOVER

const ilMapArea::HL_HOVER = "Hover"

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

◆ HL_NONE

const ilMapArea::HL_NONE = ""

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

◆ HLCL_ACCENTED

const ilMapArea::HLCL_ACCENTED = ""

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

◆ HLCL_DARK

const ilMapArea::HLCL_DARK = "Dark"

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

◆ HLCL_LIGHT

const ilMapArea::HLCL_LIGHT = "Light"

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


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