Public Member Functions | |
ilMediaItem ($a_id=0) | |
setId ($a_id) | |
set media item id | |
getId () | |
get media item id | |
setMobId ($a_mob_id) | |
set id of parent media object | |
getMobId () | |
get id of parent media object | |
setNr ($a_nr) | |
set number of media item within media object | |
getNr () | |
create () | |
create persistent media item | |
update () | |
update media item data (without map areas!) | |
read () | |
read media item data (item id or (mob_id and nr) must be set) | |
writeThumbTried ($a_tried) | |
write thumbnail creation try data ("y"/"n") | |
_getMediaItemsOfMOb (&$a_mob) | |
read media items into media objects (static) | |
deleteAllItemsOfMob ($a_mob_id) | |
static | |
setPurpose ($a_purpose) | |
getPurpose () | |
setLocation ($a_location) | |
getLocation () | |
setLocationType ($a_type) | |
getLocationType () | |
setFormat ($a_format) | |
getFormat () | |
setThumbTried ($a_tried) | |
getThumbTried () | |
addMapArea (&$a_map_area) | |
deleteMapArea ($nr) | |
delete map area | |
& | getMapArea ($nr) |
get map area | |
getWidth () | |
get width | |
setWidth ($a_width) | |
set width | |
getHeight () | |
get height | |
setHeight ($a_height) | |
set height | |
getOriginalSize () | |
get original size | |
setCaption ($a_caption) | |
set caption | |
getCaption () | |
get caption | |
setHAlign ($a_halign) | |
set horizontal align | |
getHAlign () | |
get horizontal align | |
setParameter ($a_name, $a_value) | |
set parameter | |
resetParameters () | |
reset parameters | |
setParameters ($a_par) | |
set alle parameters via parameter string (format: par1="value1", par2="value2", ...) | |
getParameters () | |
get all parameters (in array) | |
getParameterString () | |
get all parameters (as string) | |
getParameter ($a_name) | |
get a single parameter | |
getWorkDirectory () | |
get work directory for image map editing | |
createWorkDirectory () | |
create work directory for image map editing | |
getSuffix () | |
get location suffix | |
getMapWorkCopyType () | |
get image type of image map work copy | |
getMapWorkCopyName () | |
getDirectory () | |
get media file directory | |
getThumbnailDirectory ($a_mode="filesystem") | |
get media file directory | |
getThumbnailTarget ($a_size="") | |
get thumbnail target | |
makeMapWorkCopy ($a_area_nr=0, $a_exclude=false) | |
make map work copy of image | |
addAreaToMapWorkCopy ($a_shape, $a_coords) | |
draw a new area in work image | |
outputMapWorkCopy () | |
output raw map work copy file | |
buildMapWorkImage () | |
build image map work image | |
saveMapWorkImage () | |
save image map work image | |
& | getMapWorkImage () |
get image map work image | |
getMapAreasXML ($a_insert_inst=false, $a_inst=0) | |
get xml code of media items' areas | |
_resolveMapAreaLinks ($a_mob_id) | |
resolve internal links of all media items of a media object | |
_getMapAreasIntLinks ($a_mob_id) | |
get all internal links of map areas of a mob | |
Data Fields | |
$ilias | |
$id | |
$purpose | |
$location | |
$location_type | |
$format | |
$width | |
$height | |
$caption | |
$halign | |
$parameters | |
$mob_id | |
$nr | |
$mapareas | |
$map_cnt | |
$map_image | |
$color1 | |
$color2 |
Definition at line 36 of file class.ilMediaItem.php.
ilMediaItem::_getMapAreasIntLinks | ( | $ | a_mob_id | ) |
get all internal links of map areas of a mob
int | $a_mob_id media object id |
Definition at line 924 of file class.ilMediaItem.php.
References $key, $query, and ilMapArea::_getIntLinks().
Referenced by ilPageObject::getInternalLinks(), ilLMPresentationGUI::ilMedia(), ilGlossaryPresentationGUI::media(), and ilObjMediaPoolGUI::showMedia().
{ // read media_items records $query = "SELECT * FROM media_item WHERE mob_id = '".$a_mob_id."' ". "ORDER BY nr"; $item_set = $this->ilias->db->query($query); $links = array(); while ($item_rec = $item_set->fetchRow(DB_FETCHMODE_ASSOC)) { $map_links = ilMapArea::_getIntLinks($item_rec["id"]); foreach($map_links as $key => $map_link) { $links[$key] = $map_link; } } return $links; }
ilMediaItem::_getMediaItemsOfMOb | ( | &$ | a_mob | ) |
read media items into media objects (static)
object | $a_mob media object |
Definition at line 283 of file class.ilMediaItem.php.
References $query, ilMapArea::_getMaxNr(), and ilMediaItem().
Referenced by ilObjMediaObject::read().
{ // read media_object record $query = "SELECT * FROM media_item WHERE mob_id = '".$a_mob->getId()."' ". "ORDER BY nr"; $item_set = $this->ilias->db->query($query); while ($item_rec = $item_set->fetchRow(DB_FETCHMODE_ASSOC)) { $media_item =& new ilMediaItem(); $media_item->setNr($item_rec["nr"]); $media_item->setId($item_rec["id"]); $media_item->setLocation($item_rec["location"]); $media_item->setLocationType($item_rec["location_type"]); $media_item->setFormat($item_rec["format"]); $media_item->setWidth($item_rec["width"]); $media_item->setHeight($item_rec["height"]); $media_item->setHAlign($item_rec["halign"]); $media_item->setCaption($item_rec["caption"]); $media_item->setPurpose($item_rec["purpose"]); $media_item->setMobId($item_rec["mob_id"]); $media_item->setThumbTried($item_rec["tried_thumb"]); // get item parameter $query = "SELECT * FROM mob_parameter WHERE med_item_id = '". $item_rec["id"]."'"; $par_set = $this->ilias->db->query($query); while ($par_rec = $par_set->fetchRow(DB_FETCHMODE_ASSOC)) { $media_item->setParameter($par_rec["name"], $par_rec["value"]); } // get item map areas $max = ilMapArea::_getMaxNr($media_item->getId()); for ($i = 1; $i <= $max; $i++) { $area =& new ilMapArea($media_item->getId(), $i); $media_item->addMapArea($area); } // add media item to media object $a_mob->addMediaItem($media_item); } }
ilMediaItem::_resolveMapAreaLinks | ( | $ | a_mob_id | ) |
resolve internal links of all media items of a media object
int | $a_mob_id media object id |
Definition at line 906 of file class.ilMediaItem.php.
References $query, and ilMapArea::_resolveIntLinks().
Referenced by ilContObjParser::processPagesToParse(), and ilPageObject::resolveIntLinks().
{ //echo "mediaItems::resolve<br>"; // read media_object record $query = "SELECT * FROM media_item WHERE mob_id = '".$a_mob_id."' ". "ORDER BY nr"; $item_set = $this->ilias->db->query($query); while ($item_rec = $item_set->fetchRow(DB_FETCHMODE_ASSOC)) { ilMapArea::_resolveIntLinks($item_rec["id"]); } }
ilMediaItem::addAreaToMapWorkCopy | ( | $ | a_shape, | |
$ | a_coords | |||
) |
draw a new area in work image
string | $a_shape shape | |
string | $a_coords coordinates string |
Definition at line 758 of file class.ilMediaItem.php.
References buildMapWorkImage(), getMapWorkImage(), and saveMapWorkImage().
{ $this->buildMapWorkImage(); // add new area to work image $area = new ilMapArea(); $area->setShape($a_shape); //echo "addAreaToMap:".$a_shape.":<br>"; $area->setCoords($a_coords); $area->draw($this->getMapWorkImage(), $this->color1, $this->color2, false); $this->saveMapWorkImage(); }
ilMediaItem::addMapArea | ( | &$ | a_map_area | ) |
Definition at line 401 of file class.ilMediaItem.php.
Referenced by read().
{ $this->mapareas[$this->map_cnt] =& $a_map_area; $this->map_cnt++; }
ilMediaItem::buildMapWorkImage | ( | ) |
build image map work image
Definition at line 790 of file class.ilMediaItem.php.
References getMapWorkCopyName(), and getMapWorkCopyType().
Referenced by addAreaToMapWorkCopy(), and makeMapWorkCopy().
{ $im_type = strtolower($this->getMapWorkCopyType()); switch ($im_type) { case "gif": $this->map_image = ImageCreateFromGIF($this->getMapWorkCopyName()); break; case "jpg": $this->map_image = ImageCreateFromJPEG($this->getMapWorkCopyName()); break; case "png": $this->map_image = ImageCreateFromPNG($this->getMapWorkCopyName()); break; } // try to allocate black and white as color. if this is not possible, get the closest colors if (imagecolorstotal($this->map_image) > 250) { $this->color1 = imagecolorclosest($this->map_image, 0, 0, 0); $this->color2 = imagecolorclosest($this->map_image, 255, 255, 255); } else { $this->color1 = imagecolorallocate($this->map_image, 0, 0, 0); $this->color2 = imagecolorallocate($this->map_image, 255, 255, 255); } }
ilMediaItem::create | ( | ) |
create persistent media item
Definition at line 129 of file class.ilMediaItem.php.
References $query, getCaption(), getFormat(), getHAlign(), getHeight(), getId(), getLocation(), getLocationType(), getMobId(), getNr(), getParameters(), getPurpose(), getWidth(), and setId().
{ global $ilDB; $query = "INSERT INTO media_item (mob_id, purpose, location, ". "location_type, format, width, ". "height, halign, caption, nr) VALUES ". "(".$ilDB->quote($this->getMobId()).",". $ilDB->quote($this->getPurpose()).",". $ilDB->quote($this->getLocation()).",". $ilDB->quote($this->getLocationType()).",". $ilDB->quote($this->getFormat()).",". $ilDB->quote($this->getWidth()).",". $ilDB->quote($this->getHeight()).",". $ilDB->quote($this->getHAlign()).",". $ilDB->quote($this->getCaption()).",". $ilDB->quote($this->getNr()).")"; $this->ilias->db->query($query); //echo "create_mob:$query:<br>"; $item_id = $this->ilias->db->getLastInsertId(); $this->setId($item_id); // create mob parameters $params = $this->getParameters(); foreach($params as $name => $value) { $query = "INSERT INTO mob_parameter (med_item_id, name, value) VALUES ". "(".$ilDB->quote($item_id).",". $ilDB->quote($name).",". $ilDB->quote($value).")"; $this->ilias->db->query($query); } // create map areas for ($i=0; $i < count($this->mapareas); $i++) { $this->mapareas[$i]->setItemId($this->getId()); $this->mapareas[$i]->setNr($i + 1); $this->mapareas[$i]->create(); } }
ilMediaItem::createWorkDirectory | ( | ) |
create work directory for image map editing
Definition at line 602 of file class.ilMediaItem.php.
References ilUtil::createDirectory(), ilUtil::getDataDir(), and getWorkDirectory().
Referenced by makeMapWorkCopy().
{ if(!@is_dir(ilUtil::getDataDir()."/map_workfiles")) { ilUtil::createDirectory(ilUtil::getDataDir()."/map_workfiles"); } $work_dir = $this->getWorkDirectory(); if(!@is_dir($work_dir)) { ilUtil::createDirectory($work_dir); } }
ilMediaItem::deleteAllItemsOfMob | ( | $ | a_mob_id | ) |
static
Definition at line 330 of file class.ilMediaItem.php.
References $query.
Referenced by ilObjMediaObject::delete(), and ilObjMediaObject::update().
{ // iterate all media items ob mob $query = "SELECT * FROM media_item WHERE mob_id = '".$a_mob_id."'"; $item_set = $this->ilias->db->query($query); while ($item_rec = $item_set->fetchRow(DB_FETCHMODE_ASSOC)) { // delete all parameters of media item $query = "DELETE FROM mob_parameter WHERE med_item_id = '".$item_rec["id"]."'"; $this->ilias->db->query($query); // delete all map areas of media item $query = "DELETE FROM map_area WHERE item_id = '".$item_rec["id"]."'"; $this->ilias->db->query($query); } // delete media items $query = "DELETE FROM media_item WHERE mob_id = '".$a_mob_id."'"; $this->ilias->db->query($query); }
ilMediaItem::deleteMapArea | ( | $ | nr | ) |
delete map area
Definition at line 410 of file class.ilMediaItem.php.
References $nr.
{ for ($i=1; $i<=$this->map_cnt; $i++) { if($i > $nr) { $this->mapareas[$i-2] =& $this->mapareas[$i-1]; $this->mapareas[$i-2]->setNr($i-1); } } if($nr <= $this->map_cnt) { unset($this->mapareas[$this->map_cnt - 1]); $this->map_cnt--; } }
ilMediaItem::getCaption | ( | ) |
get caption
Definition at line 505 of file class.ilMediaItem.php.
Referenced by create(), and update().
{
return $this->caption;
}
ilMediaItem::getDirectory | ( | ) |
get media file directory
Definition at line 650 of file class.ilMediaItem.php.
References ilObjMediaObject::_getDirectory(), and getMobId().
Referenced by getThumbnailTarget(), and makeMapWorkCopy().
{ return ilObjMediaObject::_getDirectory($this->getMobId()); }
ilMediaItem::getFormat | ( | ) |
Definition at line 386 of file class.ilMediaItem.php.
Referenced by create(), getOriginalSize(), getThumbnailTarget(), and update().
{
return $this->format;
}
ilMediaItem::getHAlign | ( | ) |
get horizontal align
Definition at line 521 of file class.ilMediaItem.php.
Referenced by create(), and update().
{
return $this->halign;
}
ilMediaItem::getHeight | ( | ) |
get height
Definition at line 454 of file class.ilMediaItem.php.
Referenced by create(), and update().
{
return $this->height;
}
ilMediaItem::getId | ( | ) |
get media item id
Definition at line 88 of file class.ilMediaItem.php.
Referenced by create(), getWorkDirectory(), read(), update(), and writeThumbTried().
{
return $this->id;
}
ilMediaItem::getLocation | ( | ) |
Definition at line 366 of file class.ilMediaItem.php.
Referenced by create(), getMapWorkCopyName(), getOriginalSize(), getSuffix(), getThumbnailTarget(), makeMapWorkCopy(), and update().
{
return $this->location;
}
ilMediaItem::getLocationType | ( | ) |
Definition at line 376 of file class.ilMediaItem.php.
Referenced by create(), getOriginalSize(), getThumbnailTarget(), and update().
{
return $this->location_type;
}
& ilMediaItem::getMapArea | ( | $ | nr | ) |
get map area
Definition at line 430 of file class.ilMediaItem.php.
References $nr.
{ return $this->mapareas[$nr-1]; }
ilMediaItem::getMapAreasXML | ( | $ | a_insert_inst = false , |
|
$ | a_inst = 0 | |||
) |
get xml code of media items' areas
Definition at line 860 of file class.ilMediaItem.php.
{ $xml = ""; // build xml of map areas for ($i=0; $i < count($this->mapareas); $i++) { $area =& $this->mapareas[$i]; $xml .= "<MapArea Shape=\"".$area->getShape()."\" Coords=\"".$area->getCoords()."\">"; if ($area->getLinkType() == IL_INT_LINK) { $target_frame = $area->getTargetFrame(); if ($area->getType() == "GlossaryItem" && $target_frame == "") { $target_frame = "Glossary"; } $tf_str = ($target_frame == "") ? "" : "TargetFrame=\"".$target_frame."\""; $xml .= "<IntLink Target=\"".$area->getTarget($a_insert_inst, $a_inst)."\" Type=\"". $area->getType()."\" $tf_str>"; $xml .= $area->getTitle(); $xml .="</IntLink>"; } else { $xml .= "<ExtLink Href=\"".str_replace("&", "&",$area->getHref())."\" Title=\"". $area->getExtTitle()."\">"; $xml .= $area->getTitle(); $xml .="</ExtLink>"; } $xml .= "</MapArea>"; } return $xml; }
ilMediaItem::getMapWorkCopyName | ( | ) |
Definition at line 636 of file class.ilMediaItem.php.
References $file, getLocation(), getMapWorkCopyType(), and getWorkDirectory().
Referenced by buildMapWorkImage(), makeMapWorkCopy(), outputMapWorkCopy(), and saveMapWorkImage().
{ $file_arr = explode("/", $this->getLocation()); $file = $file_arr[count($file_arr) - 1]; $file_arr = explode(".", $file); unset($file_arr[count($file_arr) - 1]); $file = implode($file_arr, "."); return $this->getWorkDirectory()."/".$file.".".$this->getMapWorkCopyType(); }
ilMediaItem::getMapWorkCopyType | ( | ) |
get image type of image map work copy
Definition at line 628 of file class.ilMediaItem.php.
References ilUtil::getGDSupportedImageType(), and getSuffix().
Referenced by buildMapWorkImage(), getMapWorkCopyName(), makeMapWorkCopy(), outputMapWorkCopy(), and saveMapWorkImage().
{ return ilUtil::getGDSupportedImageType($this->getSuffix()); }
& ilMediaItem::getMapWorkImage | ( | ) |
get image map work image
Definition at line 851 of file class.ilMediaItem.php.
Referenced by addAreaToMapWorkCopy(), and makeMapWorkCopy().
{
return $this->map_image;
}
ilMediaItem::getMobId | ( | ) |
get id of parent media object
Definition at line 108 of file class.ilMediaItem.php.
Referenced by create(), getDirectory(), getOriginalSize(), getThumbnailDirectory(), getThumbnailTarget(), read(), and update().
{
return $this->mob_id;
}
ilMediaItem::getNr | ( | ) |
Definition at line 121 of file class.ilMediaItem.php.
Referenced by create(), read(), and update().
{
return $this->nr;
}
ilMediaItem::getOriginalSize | ( | ) |
get original size
Definition at line 470 of file class.ilMediaItem.php.
References $file, ilObjMediaObject::_getDirectory(), ilUtil::deducibleSize(), getFormat(), getLocation(), getLocationType(), and getMobId().
{ $mob_dir = ilObjMediaObject::_getDirectory($this->getMobId()); if ($this->getLocationType() == "LocalFile" && ilUtil::deducibleSize($this->getFormat())) { $file = $mob_dir."/".$this->getLocation(); if (is_file($file)) { $size = getimagesize($file); } else { $size[0] = $size[1] = 0; } $size = array("width" => $size[0], "height" => $size[1]); return $size; } return false; }
ilMediaItem::getParameter | ( | $ | a_name | ) |
get a single parameter
Definition at line 586 of file class.ilMediaItem.php.
{
return $this->parameters[$a_name];
}
ilMediaItem::getParameters | ( | ) |
get all parameters (in array)
Definition at line 568 of file class.ilMediaItem.php.
Referenced by create(), and update().
{
return $this->parameters;
}
ilMediaItem::getParameterString | ( | ) |
get all parameters (as string)
Definition at line 577 of file class.ilMediaItem.php.
References ilUtil::assembleParameterString().
{ return ilUtil::assembleParameterString($this->parameters); }
ilMediaItem::getPurpose | ( | ) |
Definition at line 356 of file class.ilMediaItem.php.
Referenced by create(), getThumbnailTarget(), and update().
{
return $this->purpose;
}
ilMediaItem::getSuffix | ( | ) |
get location suffix
Definition at line 618 of file class.ilMediaItem.php.
References getLocation().
Referenced by getMapWorkCopyType().
{ $loc_arr = explode(".", $this->getLocation()); return $loc_arr[count($loc_arr) - 1]; }
ilMediaItem::getThumbnailDirectory | ( | $ | a_mode = "filesystem" |
) |
get media file directory
Definition at line 658 of file class.ilMediaItem.php.
References ilObjMediaObject::_getThumbnailDirectory(), and getMobId().
Referenced by getThumbnailTarget().
{ return ilObjMediaObject::_getThumbnailDirectory($this->getMobId(), $a_mode); }
ilMediaItem::getThumbnailTarget | ( | $ | a_size = "" |
) |
get thumbnail target
Definition at line 666 of file class.ilMediaItem.php.
References ilObjMediaObject::_createThumbnailDirectory(), ilUtil::convertImage(), getDirectory(), getFormat(), getLocation(), getLocationType(), getMobId(), getPurpose(), getThumbnailDirectory(), getThumbTried(), and writeThumbTried().
{ if (is_int(strpos($this->getFormat(), "image"))) { $thumb_file = $this->getThumbnailDirectory()."/". $this->getPurpose().".jpeg"; $thumb_file_small = $this->getThumbnailDirectory()."/". $this->getPurpose()."_small.jpeg"; // generate thumbnail (if not tried before) if ($this->getThumbTried() == "n" && $this->getLocationType() == "LocalFile") { if (is_file($thumb_file)) { unlink($thumb_file); } if (is_file($thumb_file_small)) { unlink($thumb_file_small); } $this->writeThumbTried("y"); ilObjMediaObject::_createThumbnailDirectory($this->getMobId()); $med_file = $this->getDirectory()."/".$this->getLocation(); if (is_file($med_file)) { ilUtil::convertImage($med_file, $thumb_file, "jpeg", "80"); ilUtil::convertImage($med_file, $thumb_file_small, "jpeg", "40"); } } if ($a_size == "small") { if (is_file($thumb_file_small)) { return $this->getThumbnailDirectory("output")."/". $this->getPurpose()."_small.jpeg?dummy=".rand(1, 999999); } } else { if (is_file($thumb_file)) { return $this->getThumbnailDirectory("output")."/". $this->getPurpose().".jpeg?dummy=".rand(1, 999999); } } } return ""; }
ilMediaItem::getThumbTried | ( | ) |
Definition at line 396 of file class.ilMediaItem.php.
Referenced by getThumbnailTarget().
{
return $this->tried_thumb;
}
ilMediaItem::getWidth | ( | ) |
get width
Definition at line 438 of file class.ilMediaItem.php.
Referenced by create(), and update().
{
return $this->width;
}
ilMediaItem::getWorkDirectory | ( | ) |
get work directory for image map editing
Definition at line 594 of file class.ilMediaItem.php.
References ilUtil::getDataDir(), and getId().
Referenced by createWorkDirectory(), and getMapWorkCopyName().
{ return ilUtil::getDataDir()."/map_workfiles/item_".$this->getId(); }
ilMediaItem::ilMediaItem | ( | $ | a_id = 0 |
) |
Definition at line 57 of file class.ilMediaItem.php.
References $ilias, read(), and setId().
Referenced by _getMediaItemsOfMOb().
{ global $ilias; $this->ilias =& $ilias; $this->parameters = array(); $this->mapareas = array(); $this->map_cnt = 0; if ($a_id != 0) { $this->setId($a_id); $this->read(); } }
ilMediaItem::makeMapWorkCopy | ( | $ | a_area_nr = 0 , |
|
$ | a_exclude = false | |||
) |
make map work copy of image
int | $a_area_nr draw area $a_area_nr only | |
boolean | $a_exclude true: draw all areas but area $a_area_nr |
Definition at line 726 of file class.ilMediaItem.php.
References buildMapWorkImage(), ilUtil::convertImage(), createWorkDirectory(), getDirectory(), getLocation(), getMapWorkCopyName(), getMapWorkCopyType(), getMapWorkImage(), and saveMapWorkImage().
{ $this->createWorkDirectory(); ilUtil::convertImage($this->getDirectory()."/".$this->getLocation(), $this->getMapWorkCopyName(), $this->getMapWorkCopyType()); $this->buildMapWorkImage(); // draw map areas for ($i=0; $i < count($this->mapareas); $i++) { if ( ((($i+1) == $a_area_nr) && !$a_exclude) || ((($i+1) != $a_area_nr) && $a_exclude) || ($a_area_nr == 0) ) { $area =& $this->mapareas[$i]; $area->draw($this->getMapWorkImage(), $this->color1, $this->color2); } } $this->saveMapWorkImage(); }
ilMediaItem::outputMapWorkCopy | ( | ) |
output raw map work copy file
Definition at line 775 of file class.ilMediaItem.php.
References exit, getMapWorkCopyName(), and getMapWorkCopyType().
{ if ($this->getMapWorkCopyType() != "") { header("Pragma: no-cache"); header("Expires: 0"); header("Content-type: image/".strtolower($this->getMapWorkCopyType())); readfile($this->getMapWorkCopyName()); } exit; }
ilMediaItem::read | ( | ) |
read media item data (item id or (mob_id and nr) must be set)
Definition at line 211 of file class.ilMediaItem.php.
References $mob_id, $nr, $query, ilMapArea::_getMaxNr(), addMapArea(), getId(), getMobId(), getNr(), setCaption(), setFormat(), setHAlign(), setHeight(), setId(), setLocation(), setLocationType(), setMobId(), setNr(), setParameter(), setPurpose(), setThumbTried(), and setWidth().
Referenced by ilMediaItem().
{ $item_id = $this->getId(); $mob_id = $this->getMobId(); $nr = $this->getNr(); $query = ""; if($item_id > 0) { $query = "SELECT * FROM media_item WHERE id = '".$this->getId()."'"; } else if ($mob_id > 0 && $nr > 0) { $query = "SELECT * FROM media_item WHERE mob_id = '".$this->getMobId()."' ". "AND nr='".$this->getNr()."'"; } if ($query != "") { $item_set = $this->ilias->db->query($query); $item_rec = $item_set->fetchRow(DB_FETCHMODE_ASSOC); $this->setLocation($item_rec["location"]); $this->setLocationType($item_rec["location_type"]); $this->setFormat($item_rec["format"]); $this->setWidth($item_rec["width"]); $this->setHeight($item_rec["height"]); $this->setHAlign($item_rec["halign"]); $this->setCaption($item_rec["caption"]); $this->setPurpose($item_rec["purpose"]); $this->setNr($item_rec["nr"]); $this->setMobId($item_rec["mob_id"]); $this->setId($item_rec["id"]); $this->setThumbTried($item_rec["tried_thumb"]); // get item parameter $query = "SELECT * FROM mob_parameter WHERE med_item_id = '". $this->getId()."'"; $par_set = $this->ilias->db->query($query); while ($par_rec = $par_set->fetchRow(DB_FETCHMODE_ASSOC)) { $this->setParameter($par_rec["name"], $par_rec["value"]); } // get item map areas $max = ilMapArea::_getMaxNr($this->getId()); for ($i = 1; $i <= $max; $i++) { $area =& new ilMapArea($this->getId(), $i); $this->addMapArea($area); } } }
ilMediaItem::resetParameters | ( | ) |
reset parameters
Definition at line 541 of file class.ilMediaItem.php.
Referenced by setParameters().
{ $this->parameters = array(); }
ilMediaItem::saveMapWorkImage | ( | ) |
save image map work image
Definition at line 825 of file class.ilMediaItem.php.
References getMapWorkCopyName(), and getMapWorkCopyType().
Referenced by addAreaToMapWorkCopy(), and makeMapWorkCopy().
{ $im_type = strtolower($this->getMapWorkCopyType()); // save image work-copy and free memory switch ($im_type) { case "gif": ImageGIF($this->map_image, $this->getMapWorkCopyName()); break; case "jpg": ImageJPEG($this->map_image, $this->getMapWorkCopyName()); break; case "png": ImagePNG($this->map_image, $this->getMapWorkCopyName()); break; } ImageDestroy($this->map_image); }
ilMediaItem::setCaption | ( | $ | a_caption | ) |
set caption
Definition at line 497 of file class.ilMediaItem.php.
Referenced by read().
{ $this->caption = $a_caption; }
ilMediaItem::setFormat | ( | $ | a_format | ) |
Definition at line 381 of file class.ilMediaItem.php.
Referenced by read().
{ $this->format = $a_format; }
ilMediaItem::setHAlign | ( | $ | a_halign | ) |
set horizontal align
Definition at line 513 of file class.ilMediaItem.php.
Referenced by read().
{ $this->halign = $a_halign; }
ilMediaItem::setHeight | ( | $ | a_height | ) |
set height
Definition at line 462 of file class.ilMediaItem.php.
Referenced by read().
{ $this->height = $a_height; }
ilMediaItem::setId | ( | $ | a_id | ) |
set media item id
int | $a_id media item id |
Definition at line 78 of file class.ilMediaItem.php.
Referenced by create(), ilMediaItem(), and read().
{
$this->id = $a_id;
}
ilMediaItem::setLocation | ( | $ | a_location | ) |
Definition at line 361 of file class.ilMediaItem.php.
Referenced by read().
{ $this->location = $a_location; }
ilMediaItem::setLocationType | ( | $ | a_type | ) |
Definition at line 371 of file class.ilMediaItem.php.
Referenced by read().
{ $this->location_type = $a_type; }
ilMediaItem::setMobId | ( | $ | a_mob_id | ) |
set id of parent media object
int | $a_mob_id media object id |
Definition at line 98 of file class.ilMediaItem.php.
Referenced by read().
{ $this->mob_id = $a_mob_id; }
ilMediaItem::setNr | ( | $ | a_nr | ) |
set number of media item within media object
Definition at line 116 of file class.ilMediaItem.php.
Referenced by read().
{ $this->nr = $a_nr; }
ilMediaItem::setParameter | ( | $ | a_name, | |
$ | a_value | |||
) |
set parameter
string | $a_name parameter name | |
string | $a_value parameter value |
Definition at line 533 of file class.ilMediaItem.php.
Referenced by read(), and setParameters().
{ $this->parameters[$a_name] = $a_value; }
ilMediaItem::setParameters | ( | $ | a_par | ) |
set alle parameters via parameter string (format: par1="value1", par2="value2", ...)
string | $a_par parameter string |
Definition at line 551 of file class.ilMediaItem.php.
References ilUtil::extractParameterString(), resetParameters(), and setParameter().
{ $this->resetParameters(); $par_arr = ilUtil::extractParameterString($a_par); if(is_array($par_arr)) { foreach($par_arr as $par => $val) { $this->setParameter($par, $val); } } }
ilMediaItem::setPurpose | ( | $ | a_purpose | ) |
Definition at line 351 of file class.ilMediaItem.php.
Referenced by read().
{ $this->purpose = $a_purpose; }
ilMediaItem::setThumbTried | ( | $ | a_tried | ) |
Definition at line 391 of file class.ilMediaItem.php.
Referenced by read().
{ $this->tried_thumb = $a_tried; }
ilMediaItem::setWidth | ( | $ | a_width | ) |
set width
Definition at line 446 of file class.ilMediaItem.php.
Referenced by read().
{ $this->width = $a_width; }
ilMediaItem::update | ( | ) |
update media item data (without map areas!)
Definition at line 174 of file class.ilMediaItem.php.
References $query, getCaption(), getFormat(), getHAlign(), getHeight(), getId(), getLocation(), getLocationType(), getMobId(), getNr(), getParameters(), getPurpose(), and getWidth().
{ global $ilDB; $query = "UPDATE media_item SET ". " mob_id = ".$ilDB->quote($this->getMobId()).",". " purpose = ".$ilDB->quote($this->getPurpose()).",". " location = ".$ilDB->quote($this->getLocation()).",". " location_type = ".$ilDB->quote($this->getLocationType()).",". " format = ".$ilDB->quote($this->getFormat()).",". " width = ".$ilDB->quote($this->getWidth()).",". " height = ".$ilDB->quote($this->getHeight()).",". " halign = ".$ilDB->quote($this->getHAlign()).",". " caption = ".$ilDB->quote($this->getCaption()).",". " nr = ".$ilDB->quote($this->getNr()). " WHERE id = ".$ilDB->quote($this->getId()); $this->ilias->db->query($query); // delete mob parameters $query = "DELETE FROM mob_parameter WHERE med_item_id = ". $ilDB->quote($this->getId()); // create mob parameters $params = $this->getParameters(); foreach($params as $name => $value) { $query = "INSERT INTO mob_parameter (med_item_id, name, value) VALUES ". "(".$ilDB->quote($this->getId()).",". $ilDB->quote($name).",". $ilDB->quote($value).")"; $this->ilias->db->query($query); } }
ilMediaItem::writeThumbTried | ( | $ | a_tried | ) |
write thumbnail creation try data ("y"/"n")
Definition at line 267 of file class.ilMediaItem.php.
Referenced by getThumbnailTarget().
{ global $ilDB; $q = "UPDATE media_item SET tried_thumb=". $ilDB->quote($a_tried). " WHERE id = ".$ilDB->quote($this->getId()); $ilDB->query($q); }
ilMediaItem::$caption |
Definition at line 46 of file class.ilMediaItem.php.
ilMediaItem::$color1 |
Definition at line 54 of file class.ilMediaItem.php.
ilMediaItem::$color2 |
Definition at line 55 of file class.ilMediaItem.php.
ilMediaItem::$format |
Definition at line 43 of file class.ilMediaItem.php.
ilMediaItem::$halign |
Definition at line 47 of file class.ilMediaItem.php.
ilMediaItem::$height |
Definition at line 45 of file class.ilMediaItem.php.
ilMediaItem::$id |
Definition at line 39 of file class.ilMediaItem.php.
ilMediaItem::$ilias |
Definition at line 38 of file class.ilMediaItem.php.
Referenced by ilMediaItem().
ilMediaItem::$location |
Definition at line 41 of file class.ilMediaItem.php.
ilMediaItem::$location_type |
Definition at line 42 of file class.ilMediaItem.php.
ilMediaItem::$map_cnt |
Definition at line 52 of file class.ilMediaItem.php.
ilMediaItem::$map_image |
Definition at line 53 of file class.ilMediaItem.php.
ilMediaItem::$mapareas |
Definition at line 51 of file class.ilMediaItem.php.
ilMediaItem::$mob_id |
Definition at line 49 of file class.ilMediaItem.php.
Referenced by read().
ilMediaItem::$nr |
Definition at line 50 of file class.ilMediaItem.php.
Referenced by deleteMapArea(), getMapArea(), and read().
ilMediaItem::$parameters |
Definition at line 48 of file class.ilMediaItem.php.
ilMediaItem::$purpose |
Definition at line 40 of file class.ilMediaItem.php.
ilMediaItem::$width |
Definition at line 44 of file class.ilMediaItem.php.