Public Member Functions | |
| ilMapArea ($a_item_id=0, $a_nr=0) | |
| map area | |
| create () | |
| create persistent map area object in db | |
| _getMaxNr ($a_item_id) | |
| get maximum nr of media item (static) | |
| read () | |
| read map area data into object (item id and nr must be set) | |
| update () | |
| update map area | |
| _resolveIntLinks ($a_item_id) | |
| resolve internal links of an item id | |
| _getIntLinks ($a_item_id) | |
| get all internal links of a media items map areas | |
| setItemId ($a_item_id) | |
| set media item id | |
| getItemId () | |
| get item id | |
| setNr ($a_nr) | |
| set area number | |
| getNr () | |
| get area number | |
| setShape ($a_shape) | |
| set shape (IL_AREA_RECT, IL_AREA_CIRCLE, IL_AREA_POLY) | |
| getShape () | |
| get shape | |
| setCoords ($a_coords) | |
| set coords of area | |
| getCoords () | |
| get coords | |
| setTitle ($a_title) | |
| set (tooltip)title of area | |
| appendTitle ($a_title_str) | |
| append string to (tooltip) title of area | |
| getTitle () | |
| get (tooltip) title | |
| setLinkType ($a_link_type) | |
| set link type | |
| getLinkType () | |
| get link type | |
| setHref ($a_href) | |
| set hyper reference (external link only) | |
| getHref () | |
| get hyper reference url (external link only) | |
| setExtTitle ($a_title) | |
| set link text (external link only) | |
| getExtTitle () | |
| get link text (external link only) | |
| setTarget ($a_target) | |
| set link target (internal link only) | |
| getTarget ($a_insert_inst=false) | |
| get link target (internal link only) | |
| setType ($a_type) | |
| set link type (internal link only) | |
| getType () | |
| get link type (internal link only) | |
| setTargetFrame ($a_target_frame) | |
| set link target frame (internal link only) | |
| getTargetFrame () | |
| get link target frame (internal link only) | |
| draw (&$a_image, $a_col1, $a_col2, $a_close_poly=true, $a_x_ratio=1, $a_y_ratio=1) | |
| draw image to | |
| drawLine (&$im, $x1, $y1, $x2, $y2, $c1, $c2) | |
| draws an outlined two color line in an image | |
| drawRect (&$im, $coords, $c1, $c2, $a_x_ratio=1, $a_y_ratio=1) | |
| draws an outlined two color rectangle | |
| drawPoly (&$im, $coords, $c1, $c2, $closed, $a_x_ratio=1, $a_y_ratio=1) | |
| draws an outlined two color polygon | |
| drawCircle (&$im, $coords, $c1, $c2, $a_x_ratio=1, $a_y_ratio=1) | |
| draws an outlined two colored circle | |
| countCoords ($c) | |
| count the number of coordinates (x,y) in a coordinate string (format: "x1,y1,x2,y2,x3,y3,...") | |
Data Fields | |
| $ilias | |
| $item_id | |
| $nr | |
| $shape | |
| $coords | |
| $title | |
| $linktype | |
| $xl_title | |
| $xl_href | |
| $il_target | |
| $il_type | |
| $il_target_frame | |
Class ilMapArea.
Map Area of an Image Map, subobject of Media Item
Definition at line 54 of file class.ilMapArea.php.
| ilMapArea::_getIntLinks | ( | $ | a_item_id | ) |
get all internal links of a media items map areas
| int | $a_item_id media item id |
Definition at line 214 of file class.ilMapArea.php.
Referenced by ilMediaItem::_getMapAreasIntLinks(), and ilObjMediaObject::getLinkedMediaObjects().
{
global $ilDB;
$q = "SELECT * FROM map_area WHERE item_id=".$ilDB->quote($a_item_id);
$area_set = $this->ilias->db->query($q);
$links = array();
while ($area_rec = $area_set->fetchRow(DB_FETCHMODE_ASSOC))
{
$target = $area_rec["target"];
$type = $area_rec["type"];
$targetframe = $area_rec["target_frame"];
if (($area_rec["link_type"] == IL_INT_LINK) && (is_int(strpos($target, "__"))))
{
$links[$target.":".$type.":".$targetframe] =
array("Target" => $target, "Type" => $type,
"TargetFrame" => $targetframe);
}
}
return $links;
}
Here is the caller graph for this function:| ilMapArea::_getMaxNr | ( | $ | a_item_id | ) |
get maximum nr of media item (static)
| int | $a_item_id item id |
Definition at line 121 of file class.ilMapArea.php.
Referenced by ilMediaItem::_getMediaItemsOfMOb(), ilObjMediaObjectGUI::deleteAreasObject(), ilObjMediaObjectGUI::editMapAreasObject(), ilMediaItem::read(), ilObjMediaObjectGUI::saveAreaObject(), and ilObjMediaObjectGUI::updateAreasObject().
{
global $ilDB;
$q = "SELECT max(nr) AS max_nr FROM map_area WHERE item_id=".
$ilDB->quote($a_item_id);
$max_set = $this->ilias->db->query($q);
$max_rec = $max_set->fetchRow(DB_FETCHMODE_ASSOC);
return $max_rec["max_nr"];
}
Here is the caller graph for this function:| ilMapArea::_resolveIntLinks | ( | $ | a_item_id | ) |
resolve internal links of an item id
Definition at line 182 of file class.ilMapArea.php.
References $item_id, $nr, and ilInternalLink::_getIdForImportId().
Referenced by ilMediaItem::_resolveMapAreaLinks().
{
global $ilDB;
//echo "maparea::resolve<br>";
$q = "SELECT * FROM map_area WHERE item_id=".$ilDB->quote($a_item_id);
$area_set = $this->ilias->db->query($q);
while ($area_rec = $area_set->fetchRow(DB_FETCHMODE_ASSOC))
{
$target = $area_rec["target"];
$type = $area_rec["type"];
$item_id = $area_rec["item_id"];
$nr = $area_rec["nr"];
if (($area_rec["link_type"] == IL_INT_LINK) && (!is_int(strpos($target, "__"))))
{
$new_target = ilInternalLink::_getIdForImportId($type, $target);
if ($new_target !== false)
{
$query = "UPDATE map_area SET target= ".$ilDB->quote($new_target)." ".
"WHERE item_id= ".$ilDB->quote($item_id)." AND nr=".$ilDB->quote($nr);
$this->ilias->db->query($query);
}
}
}
}
Here is the call graph for this function:
Here is the caller graph for this function:| ilMapArea::appendTitle | ( | $ | a_title_str | ) |
append string to (tooltip) title of area
| string | $a_title_str title string |
Definition at line 334 of file class.ilMapArea.php.
{
$this->title.= $a_title_str;
}
| ilMapArea::countCoords | ( | $ | c | ) |
count the number of coordinates (x,y) in a coordinate string (format: "x1,y1,x2,y2,x3,y3,...")
| string | $c coordinate string |
Definition at line 614 of file class.ilMapArea.php.
Referenced by ilObjMediaObjectGUI::addAreaObject(), drawPoly(), ilObjMediaObjectGUI::editMapArea(), and ilObjMediaObjectGUI::setShapeObject().
{
if ($c == "")
{
return 0;
}
else
{
$coord_array = explode(",", $c);
return (count($coord_array) / 2);
}
}
Here is the caller graph for this function:| ilMapArea::create | ( | ) |
create persistent map area object in db
Definition at line 94 of file class.ilMapArea.php.
References getCoords(), getHref(), getItemId(), getLinkType(), getNr(), getShape(), getTarget(), getTargetFrame(), getTitle(), and getType().
{
global $ilDB;
$q = "INSERT INTO map_area (item_id, nr, shape, ".
"coords, link_type, title, href, target, type, target_frame) ".
" VALUES (".
$ilDB->quote($this->getItemId()).",".
$ilDB->quote($this->getNr()).",".
$ilDB->quote($this->getShape()).",".
$ilDB->quote($this->getCoords()).",".
$ilDB->quote($this->getLinkType()).",".
$ilDB->quote($this->getTitle()).",".
$ilDB->quote($this->getHref()).",".
$ilDB->quote($this->getTarget()).",".
$ilDB->quote($this->getType()).",".
$ilDB->quote($this->getTargetFrame()).")";
$this->ilias->db->query($q);
}
Here is the call graph for this function:| ilMapArea::draw | ( | &$ | a_image, | |
| $ | a_col1, | |||
| $ | a_col2, | |||
| $ | a_close_poly = true, |
|||
| $ | a_x_ratio = 1, |
|||
| $ | a_y_ratio = 1 | |||
| ) |
draw image to
| boolean | $a_close_poly close polygon |
Definition at line 484 of file class.ilMapArea.php.
References drawCircle(), drawPoly(), drawRect(), getCoords(), and getShape().
{
switch ($this->getShape())
{
case "Rect" :
$this->drawRect($a_image, $this->getCoords(), $a_col1, $a_col2,
$a_x_ratio, $a_y_ratio);
break;
case "Circle" :
$this->drawCircle($a_image, $this->getCoords(), $a_col1, $a_col2,
$a_x_ratio, $a_y_ratio);
break;
case "Poly" :
$this->drawPoly($a_image, $this->getCoords(), $a_col1, $a_col2, $a_close_poly,
$a_x_ratio, $a_y_ratio);
break;
}
}
Here is the call graph for this function:| ilMapArea::drawCircle | ( | &$ | im, | |
| $ | coords, | |||
| $ | c1, | |||
| $ | c2, | |||
| $ | a_x_ratio = 1, |
|||
| $ | a_y_ratio = 1 | |||
| ) |
draws an outlined two colored circle
| int | $im image identifier as returned by ImageCreateFromGIF() | |
| string | $coords coordinate string, format : "x,y,r" with (x,y) as center point and r as radius | |
| int | $c1 color identifier 1 | |
| int | $c3 color identifier 2 |
Definition at line 598 of file class.ilMapArea.php.
References $coords.
Referenced by draw().
{
$c = explode(",", $coords);
imagearc($im, $c[0] / $a_x_ratio, $c[1] / $a_y_ratio,
($c[2]+1)*2 / $a_x_ratio, ($c[2]+1)*2 / $a_y_ratio, 1, 360, $c1);
imagearc($im, $c[0] / $a_x_ratio, $c[1] / $a_y_ratio,
($c[2]-1)*2 / $a_x_ratio, ($c[2]-1)*2 / $a_y_ratio, 1, 360, $c1);
imagearc($im, $c[0] / $a_x_ratio, $c[1] / $a_y_ratio,
$c[2]*2 / $a_x_ratio, $c[2]*2 / $a_y_ratio, 1, 360, $c2);
}
Here is the caller graph for this function:| ilMapArea::drawLine | ( | &$ | im, | |
| $ | x1, | |||
| $ | y1, | |||
| $ | x2, | |||
| $ | y2, | |||
| $ | c1, | |||
| $ | c2 | |||
| ) |
draws an outlined two color line in an image
| int | $im image identifier as returned by ImageCreateFromGIF() etc. | |
| int | $x1 x-coordinate of starting point | |
| int | $y1 y-coordinate of starting point | |
| int | $x2 x-coordinate of ending point | |
| int | $y2 y-coordinate of ending point | |
| int | $c1 color identifier 1 | |
| int | $c2 color identifier 2 |
Definition at line 517 of file class.ilMapArea.php.
Referenced by drawPoly(), and drawRect().
{
imageline($im, $x1+1, $y1, $x2+1, $y2, $c1);
imageline($im, $x1-1, $y1, $x2-1, $y2, $c1);
imageline($im, $x1, $y1+1, $x2, $y2+1, $c1);
imageline($im, $x1, $y1-1, $x2, $y2-1, $c1);
imageline($im, $x1, $y1, $x2, $y2, $c2);
}
Here is the caller graph for this function:| ilMapArea::drawPoly | ( | &$ | im, | |
| $ | coords, | |||
| $ | c1, | |||
| $ | c2, | |||
| $ | closed, | |||
| $ | a_x_ratio = 1, |
|||
| $ | a_y_ratio = 1 | |||
| ) |
draws an outlined two color polygon
| int | $im image identifier as returned by ImageCreateFromGIF() etc. | |
| string | $coords coordinate string, format : "x1,y1,x2,y2,..." with every (x,y) pair is an ending point of a line of the polygon | |
| int | $c1 color identifier 1 | |
| int | $c3 color identifier 2 | |
| boolean | $closed true: the first and the last point will be connected with a line |
Definition at line 560 of file class.ilMapArea.php.
References $coords, countCoords(), and drawLine().
Referenced by draw().
{
if ($closed)
{
$p = 0;
}
else
{
$p = 1;
}
$anz = ilMapArea::countCoords($coords);
if ($anz < (3 - $p))
{
return;
}
$c = explode(",", $coords);
for($i=0; $i<$anz-$p; $i++)
{
$this->drawLine($im, $c[$i*2] / $a_x_ratio, $c[$i*2+1] / $a_y_ratio,
$c[($i*2+2)%(2*$anz)] / $a_x_ratio,
$c[($i*2+3)%(2*$anz)] / $a_y_ratio, $c1, $c2);
}
}
Here is the call graph for this function:
Here is the caller graph for this function:| ilMapArea::drawRect | ( | &$ | im, | |
| $ | coords, | |||
| $ | c1, | |||
| $ | c2, | |||
| $ | a_x_ratio = 1, |
|||
| $ | a_y_ratio = 1 | |||
| ) |
draws an outlined two color rectangle
| int | $im image identifier as returned by ImageCreateFromGIF() etc. | |
| string | $coords coordinate string, format : "x1,y1,x2,y2" with (x1,y1) is top left and (x2,y2) is bottom right point of the rectangle | |
| int | $c1 color identifier 1 | |
| int | $c2 color identifier 2 |
Definition at line 535 of file class.ilMapArea.php.
References $coords, and drawLine().
Referenced by draw().
{
$coord=explode(",", $coords);
$this->drawLine($im, $coord[0] / $a_x_ratio, $coord[1] / $a_y_ratio,
$coord[0] / $a_x_ratio, $coord[3] / $a_y_ratio, $c1, $c2);
$this->drawLine($im, $coord[0] / $a_x_ratio, $coord[3] / $a_y_ratio,
$coord[2] / $a_x_ratio, $coord[3] / $a_y_ratio, $c1, $c2);
$this->drawLine($im, $coord[2] / $a_x_ratio, $coord[3] / $a_y_ratio,
$coord[2] / $a_x_ratio, $coord[1] / $a_y_ratio, $c1, $c2);
$this->drawLine($im, $coord[2] / $a_x_ratio, $coord[1] / $a_y_ratio,
$coord[0] / $a_x_ratio, $coord[1] / $a_y_ratio, $c1, $c2);
}
Here is the call graph for this function:
Here is the caller graph for this function:| ilMapArea::getCoords | ( | ) |
get coords
Definition at line 314 of file class.ilMapArea.php.
Referenced by create(), draw(), and update().
{
return $this->coords;
}
Here is the caller graph for this function:| ilMapArea::getExtTitle | ( | ) |
get link text (external link only)
Definition at line 404 of file class.ilMapArea.php.
{
return $this->xl_title;
}
| ilMapArea::getHref | ( | ) |
get hyper reference url (external link only)
| string | hyper ref url |
Definition at line 384 of file class.ilMapArea.php.
Referenced by create(), and update().
{
return $this->xl_href;
}
Here is the caller graph for this function:| ilMapArea::getItemId | ( | ) |
get item id
Definition at line 254 of file class.ilMapArea.php.
Referenced by create(), read(), and update().
{
return $this->item_id;
}
Here is the caller graph for this function:| ilMapArea::getLinkType | ( | ) |
get link type
Definition at line 364 of file class.ilMapArea.php.
Referenced by create(), and update().
{
return $this->linktype;
}
Here is the caller graph for this function:| ilMapArea::getNr | ( | ) |
get area number
Definition at line 274 of file class.ilMapArea.php.
Referenced by create(), read(), and update().
{
return $this->nr;
}
Here is the caller graph for this function:| ilMapArea::getShape | ( | ) |
get shape
Definition at line 294 of file class.ilMapArea.php.
Referenced by create(), draw(), and update().
{
return $this->shape;
}
Here is the caller graph for this function:| ilMapArea::getTarget | ( | $ | a_insert_inst = false |
) |
get link target (internal link only)
Definition at line 424 of file class.ilMapArea.php.
Referenced by create(), and update().
{
$target = $this->il_target;
if ((substr($target, 0, 4) == "il__") && $a_insert_inst)
{
$target = "il_".IL_INST_ID."_".substr($target, 4, strlen($target) - 4);
}
return $target;
}
Here is the caller graph for this function:| ilMapArea::getTargetFrame | ( | ) |
get link target frame (internal link only)
Definition at line 474 of file class.ilMapArea.php.
Referenced by create(), and update().
{
return $this->il_target_frame;
}
Here is the caller graph for this function:| ilMapArea::getTitle | ( | ) |
get (tooltip) title
Definition at line 344 of file class.ilMapArea.php.
Referenced by create(), and update().
{
return $this->title;
}
Here is the caller graph for this function:| ilMapArea::getType | ( | ) |
get link type (internal link only)
Definition at line 452 of file class.ilMapArea.php.
Referenced by create(), and update().
{
return $this->il_type;
}
Here is the caller graph for this function:| ilMapArea::ilMapArea | ( | $ | a_item_id = 0, |
|
| $ | a_nr = 0 | |||
| ) |
map area
| int | $a_item_id parent media item id | |
| int | $a_nr map area number within media item |
Definition at line 76 of file class.ilMapArea.php.
References $ilias, read(), setItemId(), and setNr().
{
global $ilias;
$this->ilias =& $ilias;
$this->title = "";
if ($a_item_id !=0 && $a_nr != 0)
{
$this->setItemId($a_item_id);
$this->setNr($a_nr);
$this->read();
}
}
Here is the call graph for this function:| ilMapArea::read | ( | ) |
read map area data into object (item id and nr must be set)
Definition at line 136 of file class.ilMapArea.php.
References getItemId(), getNr(), setCoords(), setHref(), setLinkType(), setNr(), setShape(), setTarget(), setTargetFrame(), setTitle(), and setType().
Referenced by ilMapArea().
{
global $ilDB;
$q = "SELECT * FROM map_area WHERE item_id=".
$ilDB->quote($this->getItemId()).
" AND nr=".$ilDB->quote($this->getNr());
$area_set = $this->ilias->db->query($q);
$area_rec = $area_set->fetchRow(DB_FETCHMODE_ASSOC);
$this->setShape($area_rec["shape"]);
//echo $area_rec["Shape"];
$this->setNr($area_rec["nr"]);
$this->setCoords($area_rec["coords"]);
$this->setLinkType($area_rec["link_type"]);
$this->setTitle($area_rec["title"]);
$this->setHref($area_rec["href"]);
$this->setTarget($area_rec["target"]);
$this->setType($area_rec["type"]);
$this->setTargetFrame($area_rec["target_frame"]);
}
Here is the call graph for this function:
Here is the caller graph for this function:| ilMapArea::setCoords | ( | $ | a_coords | ) |
set coords of area
| string | $a_coords coords (comma separated integers) |
Definition at line 304 of file class.ilMapArea.php.
Referenced by read().
{
$this->coords = $a_coords;
}
Here is the caller graph for this function:| ilMapArea::setExtTitle | ( | $ | a_title | ) |
set link text (external link only)
| string | $a_title link text |
Definition at line 394 of file class.ilMapArea.php.
{
$this->xl_title = $a_title;
}
| ilMapArea::setHref | ( | $ | a_href | ) |
set hyper reference (external link only)
| string | $a_href hyper ref url |
Definition at line 374 of file class.ilMapArea.php.
Referenced by read().
{
$this->xl_href = $a_href;
}
Here is the caller graph for this function:| ilMapArea::setItemId | ( | $ | a_item_id | ) |
set media item id
| int | $a_item_id media item id |
Definition at line 244 of file class.ilMapArea.php.
Referenced by ilMapArea().
{
$this->item_id = $a_item_id;
}
Here is the caller graph for this function:| ilMapArea::setLinkType | ( | $ | a_link_type | ) |
set link type
| string | $a_linktype link type (IL_INT_LINK, IL_EXT_LINK) |
Definition at line 354 of file class.ilMapArea.php.
Referenced by read().
{
$this->linktype = $a_link_type;
}
Here is the caller graph for this function:| ilMapArea::setNr | ( | $ | a_nr | ) |
set area number
| int | $a_nr number (of area within parent media object) |
Definition at line 264 of file class.ilMapArea.php.
Referenced by ilMapArea(), and read().
{
$this->nr = $a_nr;
}
Here is the caller graph for this function:| ilMapArea::setShape | ( | $ | a_shape | ) |
set shape (IL_AREA_RECT, IL_AREA_CIRCLE, IL_AREA_POLY)
| string | $a_shape shape of map area |
Definition at line 284 of file class.ilMapArea.php.
Referenced by read().
{
$this->shape = $a_shape;
}
Here is the caller graph for this function:| ilMapArea::setTarget | ( | $ | a_target | ) |
set link target (internal link only)
| string | $a_target link target (e.g. "il__pg_23") |
Definition at line 414 of file class.ilMapArea.php.
Referenced by read().
{
$this->il_target = $a_target;
}
Here is the caller graph for this function:| ilMapArea::setTargetFrame | ( | $ | a_target_frame | ) |
set link target frame (internal link only)
| string | $a_target_frame target frame (IL_TF_MEDIA | IL_TF_FAQ | IL_TF_GLOSSARY | IL_TF_NEW) |
Definition at line 463 of file class.ilMapArea.php.
Referenced by read().
{
$this->il_target_frame = $a_target_frame;
}
Here is the caller graph for this function:| ilMapArea::setTitle | ( | $ | a_title | ) |
set (tooltip)title of area
| string | $a_title title |
Definition at line 324 of file class.ilMapArea.php.
Referenced by read().
{
$this->title = $a_title;
}
Here is the caller graph for this function:| ilMapArea::setType | ( | $ | a_type | ) |
set link type (internal link only)
| string | $a_type link type (IL_LT_STRUCTURE | IL_LT_PAGE | IL_LT_MEDIA | IL_LT_GLITEM) |
Definition at line 442 of file class.ilMapArea.php.
Referenced by read().
{
$this->il_type = $a_type;
}
Here is the caller graph for this function:| ilMapArea::update | ( | ) |
update map area
Definition at line 161 of file class.ilMapArea.php.
References getCoords(), getHref(), getItemId(), getLinkType(), getNr(), getShape(), getTarget(), getTargetFrame(), getTitle(), and getType().
{
global $ilDB;
$q = "UPDATE map_area SET shape = ".$ilDB->quote($this->getShape()).
", coords = ".$ilDB->quote($this->getCoords()).
", link_type = ".$ilDB->quote($this->getLinkType()).
", title = ".$ilDB->quote($this->getTitle()).
", href = ".$ilDB->quote($this->getHref()).
", target = ".$ilDB->quote($this->getTarget()).
", type = ".$ilDB->quote($this->getType()).
", target_frame = ".$ilDB->quote($this->getTargetFrame()).
" WHERE item_id = ".$ilDB->quote($this->getItemId())." AND nr = ".
$ilDB->quote($this->getNr());
$this->ilias->db->query($q);
//echo "<br>$q<br>";
}
Here is the call graph for this function:| ilMapArea::$coords |
Definition at line 60 of file class.ilMapArea.php.
Referenced by drawCircle(), drawPoly(), and drawRect().
| ilMapArea::$il_target |
Definition at line 65 of file class.ilMapArea.php.
| ilMapArea::$il_target_frame |
Definition at line 67 of file class.ilMapArea.php.
| ilMapArea::$il_type |
Definition at line 66 of file class.ilMapArea.php.
| ilMapArea::$ilias |
Definition at line 56 of file class.ilMapArea.php.
Referenced by ilMapArea().
| ilMapArea::$item_id |
Definition at line 57 of file class.ilMapArea.php.
Referenced by _resolveIntLinks().
| ilMapArea::$linktype |
Definition at line 62 of file class.ilMapArea.php.
| ilMapArea::$nr |
Definition at line 58 of file class.ilMapArea.php.
Referenced by _resolveIntLinks().
| ilMapArea::$shape |
Definition at line 59 of file class.ilMapArea.php.
| ilMapArea::$title |
Definition at line 61 of file class.ilMapArea.php.
| ilMapArea::$xl_href |
Definition at line 64 of file class.ilMapArea.php.
| ilMapArea::$xl_title |
Definition at line 63 of file class.ilMapArea.php.
1.7.1