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) | |
| 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) | |
| draws an outlined two color rectangle | |
| drawPoly (&$im, $coords, $c1, $c2, $closed) | |
| draws an outlined two color polygon | |
| drawCircle (&$im, $coords, $c1, $c2) | |
| 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 | |
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 208 of file class.ilMapArea.php.
Referenced by ilMediaItem::_getMapAreasIntLinks().
{
$q = "SELECT * FROM map_area WHERE item_id='".$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.
References $q.
Referenced by ilMediaItem::_getMediaItemsOfMOb(), ilObjMediaObjectGUI::deleteAreasObject(), ilObjMediaObjectGUI::editMapAreasObject(), ilMediaItem::read(), ilObjMediaObjectGUI::saveAreaObject(), and ilObjMediaObjectGUI::updateAreasObject().
{
$q = "SELECT max(nr) AS max_nr FROM map_area WHERE item_id='".$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 176 of file class.ilMapArea.php.
References $item_id, $nr, $q, $query, $type, and ilInternalLink::_getIdForImportId().
Referenced by ilMediaItem::_resolveMapAreaLinks().
{
global $ilDB;
//echo "maparea::resolve<br>";
$q = "SELECT * FROM map_area WHERE item_id='".$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 326 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 593 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 $q, 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 | |||
| ) |
draw image to
| boolean | $a_close_poly close polygon |
Definition at line 476 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);
break;
case "Circle" :
$this->drawCircle($a_image, $this->getCoords(), $a_col1, $a_col2);
break;
case "Poly" :
$this->drawPoly($a_image, $this->getCoords(), $a_col1, $a_col2, $a_close_poly);
break;
}
}
Here is the call graph for this function:| ilMapArea::drawCircle | ( | &$ | im, | |
| $ | coords, | |||
| $ | c1, | |||
| $ | c2 | |||
| ) |
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 580 of file class.ilMapArea.php.
References $coords.
Referenced by draw().
{
$c = explode(",", $coords);
imagearc($im, $c[0], $c[1], ($c[2]+1)*2, ($c[2]+1)*2, 1, 360, $c1);
imagearc($im, $c[0], $c[1], ($c[2]-1)*2, ($c[2]-1)*2, 1, 360, $c1);
imagearc($im, $c[0], $c[1], $c[2]*2, $c[2]*2, 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 505 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 | |||
| ) |
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 543 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], $c[$i*2+1], $c[($i*2+2)%(2*$anz)],
$c[($i*2+3)%(2*$anz)], $c1, $c2);
}
}
Here is the call graph for this function:
Here is the caller graph for this function:| ilMapArea::drawRect | ( | &$ | im, | |
| $ | coords, | |||
| $ | c1, | |||
| $ | c2 | |||
| ) |
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 523 of file class.ilMapArea.php.
References $coords, and drawLine().
Referenced by draw().
{
$coord=explode(",", $coords);
$this->drawLine($im, $coord[0], $coord[1], $coord[0], $coord[3], $c1, $c2);
$this->drawLine($im, $coord[0], $coord[3], $coord[2], $coord[3], $c1, $c2);
$this->drawLine($im, $coord[2], $coord[3], $coord[2], $coord[1], $c1, $c2);
$this->drawLine($im, $coord[2], $coord[1], $coord[0], $coord[1], $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 306 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 396 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 376 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 246 of file class.ilMapArea.php.
Referenced by create(), and update().
{
return $this->item_id;
}
Here is the caller graph for this function:| ilMapArea::getLinkType | ( | ) |
get link type
Definition at line 356 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 266 of file class.ilMapArea.php.
Referenced by create(), and update().
{
return $this->nr;
}
Here is the caller graph for this function:| ilMapArea::getShape | ( | ) |
get shape
Definition at line 286 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 416 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 466 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 336 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 444 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 133 of file class.ilMapArea.php.
References $q, setCoords(), setHref(), setLinkType(), setNr(), setShape(), setTarget(), setTargetFrame(), setTitle(), and setType().
Referenced by ilMapArea().
{
$q = "SELECT * FROM map_area WHERE item_id='".$this->getItemId().
"' AND nr='".$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 296 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 386 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 366 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 236 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 346 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 256 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 276 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 406 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 455 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 316 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 434 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 155 of file class.ilMapArea.php.
References $q, 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