ILIAS  release_7 Revision v7.30-3-g800a261c036
ilMediaItem Class Reference

Class ilMediaItem Media Item, component of a media object (file or reference) More...

+ Collaboration diagram for ilMediaItem:

Public Member Functions

 __construct ($a_id=0)
 
 setId ($a_id)
 set media item id More...
 
 getId ()
 get media item id More...
 
 setMobId ($a_mob_id)
 set id of parent media object More...
 
 getMobId ()
 get id of parent media object More...
 
 setNr ($a_nr)
 set number of media item within media object More...
 
 getNr ()
 
 setDuration ($a_val)
 Set duration. More...
 
 getDuration ()
 Get duration. More...
 
 setTextRepresentation ($a_val)
 Set text representation. More...
 
 getTextRepresentation ()
 Get text representation. More...
 
 setUploadHash ($a_val)
 Set upload hash. More...
 
 getUploadHash ()
 Get upload hash. More...
 
 create ()
 create persistent media item More...
 
 update ()
 update media item data (without map areas!) More...
 
 writeParameter ($a_name, $a_value)
 Write parameter. More...
 
 read ()
 read media item data (item id or (mob_id and nr) must be set) More...
 
 writeThumbTried ($a_tried)
 write thumbnail creation try data ("y"/"n") More...
 
 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 More...
 
getMapArea ($nr)
 get map area More...
 
 getMapAreas ()
 get map areas More...
 
 getWidth ()
 get width More...
 
 setWidth ($a_width)
 set width More...
 
 getHeight ()
 get height More...
 
 setHeight ($a_height)
 set height More...
 
 getOriginalSize ()
 get original size More...
 
 setCaption ($a_caption)
 set caption More...
 
 getCaption ()
 get caption More...
 
 setHAlign ($a_halign)
 set horizontal align More...
 
 getHAlign ()
 get horizontal align More...
 
 setParameter ($a_name, $a_value)
 set parameter More...
 
 resetParameters ()
 reset parameters More...
 
 setParameters ($a_par)
 set alle parameters via parameter string (format: par1="value1", par2="value2", ...) More...
 
 getParameters ()
 get all parameters (in array) More...
 
 getParameterString ()
 get all parameters (as string) More...
 
 getParameter ($a_name)
 get a single parameter More...
 
 getWorkDirectory ()
 get work directory for image map editing More...
 
 createWorkDirectory ()
 create work directory for image map editing More...
 
 getSuffix ()
 get location suffix More...
 
 getMapWorkCopyType ()
 get image type of image map work copy More...
 
 getMapWorkCopyName ($a_reference_copy=false)
 Get name of image map work copy file. More...
 
 getDirectory ()
 get media file directory More...
 
 getThumbnailDirectory ($a_mode="filesystem")
 get media file directory More...
 
 getThumbnailTarget ($a_size="")
 get thumbnail target More...
 
 copyOriginal ()
 Copy the orginal file. More...
 
 makeMapWorkCopy ($a_area_nr=0, $a_exclude=false)
 make map work copy of image More...
 
 addAreaToMapWorkCopy ($a_shape, $a_coords)
 draw a new area in work image More...
 
 outputMapWorkCopy ()
 output raw map work copy file More...
 
 buildMapWorkImage ()
 build image map work image More...
 
 saveMapWorkImage ()
 save image map work image More...
 
getMapWorkImage ()
 get image map work image More...
 
 getMapAreasXML ($a_insert_inst=false, $a_inst=0)
 get xml code of media items' areas More...
 
 extractUrlParameters ()
 Extract parameters of special external references to parameter array. More...
 
 determineDuration ()
 

Static Public Member Functions

static _lookupLocationForMobId ($a_mob_id, $a_purpose)
 Lookup location for mob id. More...
 
static _lookupMobId ($a_med_id)
 Lookup Mob ID. More...
 
static _getMediaItemsOfMObId ($a_mobId, $a_purpose)
 
static _getMediaItemsOfMOb (&$a_mob)
 read media items into media objects (static) More...
 
static deleteAllItemsOfMob ($a_mob_id)
 Delete all items of a mob. More...
 
static checkParameter ($a_par, $a_val)
 Check parameter (filter javascript related and other unsafe parameters/values) More...
 
static _resolveMapAreaLinks ($a_mob_id)
 resolve internal links of all media items of a media object More...
 
static _getMapAreasIntLinks ($a_mob_id)
 get all internal links of map areas of a mob More...
 
static getMediaItemsForUploadHash ($a_hash)
 Get media items for upload hash. More...
 

Data Fields

 $id
 
 $purpose
 
 $location
 
 $location_type
 
 $format
 
 $width
 
 $height
 
 $caption
 
 $halign
 
 $parameters
 
 $mob_id
 
 $nr
 
 $mapareas
 
 $map_cnt
 
 $map_image
 
 $color1
 
 $color2
 

Protected Attributes

 $db
 
 $lng
 
 $duration = 0
 
 $upload_hash
 

Detailed Description

Class ilMediaItem Media Item, component of a media object (file or reference)

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

Definition at line 13 of file class.ilMediaItem.php.

Constructor & Destructor Documentation

◆ __construct()

ilMediaItem::__construct (   $a_id = 0)

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

51 {
52 global $DIC;
53
54 $this->db = $DIC->database();
55 $this->lng = $DIC->language();
56 $this->parameters = array();
57 $this->mapareas = array();
58 $this->map_cnt = 0;
59
60 if ($a_id != 0) {
61 $this->setId($a_id);
62 $this->read();
63 }
64 }
setId($a_id)
set media item id
read()
read media item data (item id or (mob_id and nr) must be set)
global $DIC
Definition: goto.php:24

References $DIC, read(), and setId().

+ Here is the call graph for this function:

Member Function Documentation

◆ _getMapAreasIntLinks()

static ilMediaItem::_getMapAreasIntLinks (   $a_mob_id)
static

get all internal links of map areas of a mob

Parameters
int$a_mob_idmedia object id

Definition at line 1176 of file class.ilMediaItem.php.

1177 {
1178 global $DIC;
1179
1180 $ilDB = $DIC->database();
1181
1182 // read media_items records
1183 $query = "SELECT * FROM media_item WHERE mob_id = " .
1184 $ilDB->quote($a_mob_id, "integer") . " ORDER BY nr";
1185
1186 $item_set = $ilDB->query($query);
1187 $links = array();
1188 while ($item_rec = $ilDB->fetchAssoc($item_set)) {
1189 $map_links = ilMapArea::_getIntLinks($item_rec["id"]);
1190 foreach ($map_links as $key => $map_link) {
1191 $links[$key] = $map_link;
1192 }
1193 }
1194 return $links;
1195 }
static _getIntLinks($a_item_id)
get all internal links of a media items map areas
$query
global $ilDB

References $DIC, $ilDB, $query, and ilMapArea\_getIntLinks().

Referenced by ilPageObjectGUI\displayMedia(), ilCOPageHTMLExport\exportHTMLMOB(), ilObjMediaObject\exportMediaFullscreen(), ilPageObject\getInternalLinks(), ilLMPresentationGUI\ilMedia(), and ilGlossaryPresentationGUI\media().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ _getMediaItemsOfMOb()

static ilMediaItem::_getMediaItemsOfMOb ( $a_mob)
static

read media items into media objects (static)

Parameters
object$a_mobmedia object

Definition at line 417 of file class.ilMediaItem.php.

418 {
419 global $DIC;
420
421 $ilDB = $DIC->database();
422
423 // read media_object record
424 $query = "SELECT * FROM media_item WHERE mob_id = " .
425 $ilDB->quote($a_mob->getId(), "integer") . " " .
426 "ORDER BY nr";
427 $item_set = $ilDB->query($query);
428 while ($item_rec = $ilDB->fetchAssoc($item_set)) {
429 $media_item = new ilMediaItem();
430 $media_item->setNr($item_rec["nr"]);
431 $media_item->setId($item_rec["id"]);
432 $media_item->setLocation($item_rec["location"]);
433 $media_item->setLocationType($item_rec["location_type"]);
434 $media_item->setFormat($item_rec["format"]);
435 $media_item->setWidth($item_rec["width"]);
436 $media_item->setHeight($item_rec["height"]);
437 $media_item->setHAlign($item_rec["halign"]);
438 $media_item->setCaption($item_rec["caption"]);
439 $media_item->setPurpose($item_rec["purpose"]);
440 $media_item->setMobId($item_rec["mob_id"]);
441 $media_item->setThumbTried($item_rec["tried_thumb"]);
442 $media_item->setTextRepresentation($item_rec["text_representation"]);
443 $media_item->setUploadHash($item_rec["upload_hash"]);
444 $media_item->setDuration((int) $item_rec["duration"]);
445
446 // get item parameter
447 $query = "SELECT * FROM mob_parameter WHERE med_item_id = " .
448 $ilDB->quote($item_rec["id"], "integer");
449 $par_set = $ilDB->query($query);
450 while ($par_rec = $ilDB->fetchAssoc($par_set)) {
451 $media_item->setParameter($par_rec["name"], $par_rec["value"]);
452 }
453
454 // get item map areas
455 $max = ilMapArea::_getMaxNr($media_item->getId());
456 for ($i = 1; $i <= $max; $i++) {
457 $area = new ilMapArea($media_item->getId(), $i);
458 $media_item->addMapArea($area);
459 }
460
461 // add media item to media object
462 $a_mob->addMediaItem($media_item);
463 }
464 }
Class ilMapArea.
static _getMaxNr($a_item_id)
get maximum nr of media item (static)
Class ilMediaItem Media Item, component of a media object (file or reference)
$i
Definition: metadata.php:24

References $DIC, $i, $ilDB, $query, and ilMapArea\_getMaxNr().

Referenced by ilObjMediaObject\read().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ _getMediaItemsOfMObId()

static ilMediaItem::_getMediaItemsOfMObId (   $a_mobId,
  $a_purpose 
)
static

Definition at line 395 of file class.ilMediaItem.php.

396 {
397 global $DIC;
398
399 $ilDB = $DIC->database();
400
401 // read media_object record
402 $query = "SELECT * FROM media_item WHERE mob_id = " .
403 $ilDB->quote($a_mobId, "integer") . " " .
404 "AND purpose=" . $ilDB->quote($a_purpose, "text") . " ORDER BY nr";
405 $item_set = $ilDB->query($query);
406
407 while ($item_rec = $ilDB->fetchAssoc($item_set)) {
408 return $item_rec;
409 }
410 return false;
411 }

References $DIC, $ilDB, and $query.

Referenced by ilObjectFeedWriter\__construct().

+ Here is the caller graph for this function:

◆ _lookupLocationForMobId()

static ilMediaItem::_lookupLocationForMobId (   $a_mob_id,
  $a_purpose 
)
static

Lookup location for mob id.

Parameters
int$a_mob_idmedia object id
string$a_purposepurpose

Definition at line 350 of file class.ilMediaItem.php.

351 {
352 global $DIC;
353
354 $ilDB = $DIC->database();
355
356 // read media_object record
357 $query = "SELECT * FROM media_item WHERE mob_id = " .
358 $ilDB->quote($a_mob_id, "integer") . " " .
359 "AND purpose = " . $ilDB->quote($a_purpose, "text");
360 $set = $ilDB->query($query);
361 if ($rec = $ilDB->fetchAssoc($set)) {
362 return $rec["location"];
363 }
364
365 return "";
366 }

References $DIC, $ilDB, and $query.

Referenced by ilObjMediaObject\_lookupItemPath().

+ Here is the caller graph for this function:

◆ _lookupMobId()

static ilMediaItem::_lookupMobId (   $a_med_id)
static

Lookup Mob ID.

Parameters
int$a_med_idmedia item id

Definition at line 372 of file class.ilMediaItem.php.

373 {
374 global $DIC;
375
376 $ilDB = $DIC->database();
377
378 // read media_object record
379 $query = "SELECT * FROM media_item WHERE id = " .
380 $ilDB->quote($a_med_id, "integer");
381 $set = $ilDB->query($query);
382 if ($rec = $ilDB->fetchAssoc($set)) {
383 return $rec["mob_id"];
384 }
385
386 return "";
387 }

References $DIC, $ilDB, and $query.

Referenced by ilMapArea\_getMobsForTarget().

+ Here is the caller graph for this function:

◆ _resolveMapAreaLinks()

static ilMediaItem::_resolveMapAreaLinks (   $a_mob_id)
static

resolve internal links of all media items of a media object

Parameters
int$a_mob_idmedia object id

Definition at line 1155 of file class.ilMediaItem.php.

1156 {
1157 global $DIC;
1158
1159 $ilDB = $DIC->database();
1160
1161 //echo "mediaItems::resolve<br>";
1162 // read media_object record
1163 $query = "SELECT * FROM media_item WHERE mob_id = " .
1164 $ilDB->quote($a_mob_id, "integer") . " " .
1165 "ORDER BY nr";
1166 $item_set = $ilDB->query($query);
1167 while ($item_rec = $ilDB->fetchAssoc($item_set)) {
1168 ilMapArea::_resolveIntLinks($item_rec["id"]);
1169 }
1170 }
static _resolveIntLinks($a_item_id)
resolve internal links of an item id

References $DIC, $ilDB, $query, and ilMapArea\_resolveIntLinks().

Referenced by ilContObjParser\processPagesToParse(), ilQuestionPageParser\processPagesToParse(), and ilPageObject\resolveIntLinks().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ addAreaToMapWorkCopy()

ilMediaItem::addAreaToMapWorkCopy (   $a_shape,
  $a_coords 
)

draw a new area in work image

Parameters
string$a_shapeshape
string$a_coordscoordinates string

Definition at line 991 of file class.ilMediaItem.php.

992 {
993 $this->buildMapWorkImage();
994
995 // determine ratios
996 $size = @getimagesize($this->getMapWorkCopyName());
997 $x_ratio = 1;
998 if ($size[0] > 0 && $this->getWidth() > 0) {
999 $x_ratio = $this->getWidth() / $size[0];
1000 }
1001 $y_ratio = 1;
1002 if ($size[1] > 0 && $this->getHeight() > 0) {
1003 $y_ratio = $this->getHeight() / $size[1];
1004 }
1005
1006 // add new area to work image
1007 $area = new ilMapArea();
1008 $area->setShape($a_shape);
1009 $area->setCoords($a_coords);
1010 $area->draw(
1011 $this->getMapWorkImage(),
1012 $this->color1,
1013 $this->color2,
1014 false,
1015 $x_ratio,
1016 $y_ratio
1017 );
1018
1019 $this->saveMapWorkImage();
1020 }
$size
Definition: RandomTest.php:84
saveMapWorkImage()
save image map work image
getMapWorkCopyName($a_reference_copy=false)
Get name of image map work copy file.
buildMapWorkImage()
build image map work image
getHeight()
get height
& getMapWorkImage()
get image map work image
getWidth()
get width

References $size, buildMapWorkImage(), getHeight(), getMapWorkCopyName(), getMapWorkImage(), getWidth(), and saveMapWorkImage().

+ Here is the call graph for this function:

◆ addMapArea()

ilMediaItem::addMapArea ( $a_map_area)

Definition at line 548 of file class.ilMediaItem.php.

549 {
550 $this->mapareas[$this->map_cnt] = $a_map_area;
551 $this->map_cnt++;
552 }

References $map_cnt.

Referenced by read().

+ Here is the caller graph for this function:

◆ buildMapWorkImage()

ilMediaItem::buildMapWorkImage ( )

build image map work image

Definition at line 1039 of file class.ilMediaItem.php.

1040 {
1041 $im_type = strtolower($this->getMapWorkCopyType());
1042
1043 switch ($im_type) {
1044 case "gif":
1045 $this->map_image = ImageCreateFromGIF($this->getMapWorkCopyName());
1046 break;
1047
1048 case "jpg":
1049 case "jpeg":
1050 $this->map_image = ImageCreateFromJPEG($this->getMapWorkCopyName());
1051 break;
1052
1053 case "png":
1054 $this->map_image = ImageCreateFromPNG($this->getMapWorkCopyName());
1055 break;
1056 }
1057
1058 // try to allocate black and white as color. if this is not possible, get the closest colors
1059 if (imagecolorstotal($this->map_image) > 250) {
1060 $this->color1 = imagecolorclosest($this->map_image, 0, 0, 0);
1061 $this->color2 = imagecolorclosest($this->map_image, 255, 255, 255);
1062 } else {
1063 $this->color1 = imagecolorallocate($this->map_image, 0, 0, 0);
1064 $this->color2 = imagecolorallocate($this->map_image, 255, 255, 255);
1065 }
1066 }
getMapWorkCopyType()
get image type of image map work copy

References getMapWorkCopyName(), and getMapWorkCopyType().

Referenced by addAreaToMapWorkCopy(), and makeMapWorkCopy().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ checkParameter()

static ilMediaItem::checkParameter (   $a_par,
  $a_val 
)
static

Check parameter (filter javascript related and other unsafe parameters/values)

Parameters
string$a_parparameter
string$a_valvalue
Returns
bool

Definition at line 716 of file class.ilMediaItem.php.

717 {
718 // do not allow event attributes
719 if (substr(strtolower(trim($a_par)), 0, 2) == "on") {
720 return false;
721 }
722 // no javascript in value
723 if (is_int(strpos(strtolower($a_val), "javascript"))) {
724 return false;
725 }
726 // do not allow to change the src attribute
727 if (in_array(strtolower(trim($a_par)), array("src"))) {
728 return false;
729 }
730
731 return true;
732 }

Referenced by ilMediaAliasItem\setParameters().

+ Here is the caller graph for this function:

◆ copyOriginal()

ilMediaItem::copyOriginal ( )

Copy the orginal file.

Definition at line 891 of file class.ilMediaItem.php.

892 {
894 $this->createWorkDirectory();
895
896 $geom = ($this->getWidth() != "" && $this->getHeight() != "")
897 ? $this->getWidth() . "x" . $this->getHeight()
898 : "";
899
900 if ($this->getLocationType() != "Reference") {
902 $this->getDirectory() . "/" . $this->getLocation(),
903 $this->getMapWorkCopyName(),
904 $this->getMapWorkCopyType(),
905 $geom
906 );
907 } else {
908 // first copy the external file, if necessary
909 if (!is_file($this->getMapWorkCopyName(true)) || (filesize($this->getMapWorkCopyName(true)) == 0)) {
910 $handle = @fopen($this->getLocation(), "r");
911 $lcopy = fopen($this->getMapWorkCopyName(true), "w");
912 if ($handle && $lcopy) {
913 while (!feof($handle)) {
914 $content = fread($handle, 4096);
915 fwrite($lcopy, $content);
916 }
917 }
918 @fclose($lcopy);
919 @fclose($handle);
920 }
921
922 // now, create working copy
924 $this->getMapWorkCopyName(true),
925 $this->getMapWorkCopyName(),
926 $this->getMapWorkCopyType(),
927 $geom
928 );
929 }
930
931 if (!is_file($this->getMapWorkCopyName())) {
932 ilUtil::sendFailure($lng->txt("cont_map_file_not_generated"));
933 return false;
934 }
935 return true;
936 }
createWorkDirectory()
create work directory for image map editing
getDirectory()
get media file directory
static convertImage( $a_from, $a_to, $a_target_format="", $a_geometry="", $a_background_color="")
convert image
static sendFailure($a_info="", $a_keep=false)
Send Failure Message to Screen.

References $lng, ilUtil\convertImage(), createWorkDirectory(), getDirectory(), getHeight(), getLocation(), getLocationType(), getMapWorkCopyName(), getMapWorkCopyType(), getWidth(), and ilUtil\sendFailure().

Referenced by makeMapWorkCopy().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ create()

ilMediaItem::create ( )

create persistent media item

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

173 {
175
176 $item_id = $ilDB->nextId("media_item");
177 $query = "INSERT INTO media_item (id,mob_id, purpose, location, " .
178 "location_type, format, width, " .
179 "height, halign, caption, nr, text_representation, upload_hash, duration) VALUES " .
180 "(" .
181 $ilDB->quote($item_id, "integer") . "," .
182 $ilDB->quote($this->getMobId(), "integer") . "," .
183 $ilDB->quote($this->getPurpose(), "text") . "," .
184 $ilDB->quote($this->getLocation(), "text") . "," .
185 $ilDB->quote($this->getLocationType(), "text") . "," .
186 $ilDB->quote($this->getFormat(), "text") . "," .
187 $ilDB->quote($this->getWidth(), "text") . "," .
188 $ilDB->quote($this->getHeight(), "text") . "," .
189 $ilDB->quote($this->getHAlign(), "text") . "," .
190 $ilDB->quote($this->getCaption(), "text") . "," .
191 $ilDB->quote($this->getNr(), "integer") . "," .
192 $ilDB->quote($this->getTextRepresentation(), "text") . "," .
193 $ilDB->quote($this->getUploadHash(), "text") . "," .
194 $ilDB->quote($this->getDuration(), "integer") .
195 ")";
196 $ilDB->manipulate($query);
197
198 $this->setId($item_id);
199
200 // create mob parameters
201 $params = $this->getParameters();
202 foreach ($params as $name => $value) {
203 $query = "INSERT INTO mob_parameter (med_item_id, name, value) VALUES " .
204 "(" . $ilDB->quote($item_id, "integer") . "," .
205 $ilDB->quote($name, "text") . "," .
206 $ilDB->quote($value, "text") . ")";
207 $ilDB->manipulate($query);
208 }
209
210 // create map areas
211 for ($i = 0; $i < count($this->mapareas); $i++) {
212 if (is_object($this->mapareas[$i])) {
213 $this->mapareas[$i]->setItemId($this->getId());
214 $this->mapareas[$i]->setNr($i + 1);
215 $this->mapareas[$i]->create();
216 }
217 }
218 }
getCaption()
get caption
getId()
get media item id
getHAlign()
get horizontal align
getDuration()
Get duration.
getUploadHash()
Get upload hash.
getParameters()
get all parameters (in array)
getMobId()
get id of parent media object
getTextRepresentation()
Get text representation.
if($format !==null) $name
Definition: metadata.php:230

References $db, $i, $ilDB, $name, $query, getCaption(), getDuration(), getFormat(), getHAlign(), getHeight(), getId(), getLocation(), getLocationType(), getMobId(), getNr(), getParameters(), getPurpose(), getTextRepresentation(), getUploadHash(), getWidth(), and setId().

+ Here is the call graph for this function:

◆ createWorkDirectory()

ilMediaItem::createWorkDirectory ( )

create work directory for image map editing

Definition at line 769 of file class.ilMediaItem.php.

770 {
771 if (!@is_dir(ilUtil::getDataDir() . "/map_workfiles")) {
772 ilUtil::createDirectory(ilUtil::getDataDir() . "/map_workfiles");
773 }
774 $work_dir = $this->getWorkDirectory();
775 if (!@is_dir($work_dir)) {
776 ilUtil::createDirectory($work_dir);
777 }
778 }
getWorkDirectory()
get work directory for image map editing
static getDataDir()
get data directory (outside webspace)
static createDirectory($a_dir, $a_mod=0755)
create directory

References ilUtil\createDirectory(), ilUtil\getDataDir(), and getWorkDirectory().

Referenced by copyOriginal().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ deleteAllItemsOfMob()

static ilMediaItem::deleteAllItemsOfMob (   $a_mob_id)
static

Delete all items of a mob.

Parameters
int$a_mob_idmedia object id

Definition at line 470 of file class.ilMediaItem.php.

471 {
472 global $DIC;
473
474 $ilDB = $DIC->database();
475
476 // iterate all media items ob mob
477 $query = "SELECT * FROM media_item WHERE mob_id = " .
478 $ilDB->quote($a_mob_id, "integer");
479 $item_set = $ilDB->query($query);
480 while ($item_rec = $ilDB->fetchAssoc($item_set)) {
481 // delete all parameters of media item
482 $query = "DELETE FROM mob_parameter WHERE med_item_id = " .
483 $ilDB->quote($item_rec["id"], "integer");
484 $ilDB->manipulate($query);
485
486 // delete all map areas of media item
487 $query = "DELETE FROM map_area WHERE item_id = " .
488 $ilDB->quote($item_rec["id"], "integer");
489 $ilDB->manipulate($query);
490 }
491
492 // delete media items
493 $query = "DELETE FROM media_item WHERE mob_id = " .
494 $ilDB->quote($a_mob_id, "integer");
495 $ilDB->manipulate($query);
496 }

References $DIC, $ilDB, and $query.

Referenced by ilObjMediaObject\delete(), and ilObjMediaObject\update().

+ Here is the caller graph for this function:

◆ deleteMapArea()

ilMediaItem::deleteMapArea (   $nr)

delete map area

Definition at line 557 of file class.ilMediaItem.php.

558 {
559 for ($i = 1; $i <= $this->map_cnt; $i++) {
560 if ($i > $nr) {
561 $this->mapareas[$i - 2] = $this->mapareas[$i - 1];
562 $this->mapareas[$i - 2]->setNr($i - 1);
563 }
564 }
565 if ($nr <= $this->map_cnt) {
566 unset($this->mapareas[$this->map_cnt - 1]);
567 $this->map_cnt--;
568 }
569 }

References $i, $map_cnt, and $nr.

◆ determineDuration()

ilMediaItem::determineDuration ( )

Definition at line 1212 of file class.ilMediaItem.php.

1213 {
1214 $ana = new ilMediaAnalyzer();
1215 $ana->setFile(ilObjMediaObject::_getDirectory($this->getMobId()) . "/" . $this->getLocation());
1216 $ana->analyzeFile();
1217 $this->setDuration((int) $ana->getPlaytimeSeconds());
1218 }
Analyzes media files.
setDuration($a_val)
Set duration.
static _getDirectory($a_mob_id)
Get absolute directory.

References ilObjMediaObject\_getDirectory(), getLocation(), getMobId(), and setDuration().

+ Here is the call graph for this function:

◆ extractUrlParameters()

ilMediaItem::extractUrlParameters ( )

Extract parameters of special external references to parameter array.

Definition at line 1200 of file class.ilMediaItem.php.

1201 {
1202 include_once("./Services/MediaObjects/classes/class.ilExternalMediaAnalyzer.php");
1204 $this->getLocation(),
1205 $this->getParameters()
1206 );
1207 foreach ($par as $k => $v) {
1208 $this->setParameter($k, $v);
1209 }
1210 }
static extractUrlParameters($a_location, $a_parameter)
Extract URL information to parameter array.
setParameter($a_name, $a_value)
set parameter

References ilExternalMediaAnalyzer\extractUrlParameters(), getLocation(), getParameters(), and setParameter().

+ Here is the call graph for this function:

◆ getCaption()

ilMediaItem::getCaption ( )

get caption

Definition at line 654 of file class.ilMediaItem.php.

655 {
656 return $this->caption;
657 }

References $caption.

Referenced by create(), and update().

+ Here is the caller graph for this function:

◆ getDirectory()

ilMediaItem::getDirectory ( )

get media file directory

Definition at line 820 of file class.ilMediaItem.php.

821 {
823 }

References ilObjMediaObject\_getDirectory(), and getMobId().

Referenced by copyOriginal(), and getThumbnailTarget().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getDuration()

ilMediaItem::getDuration ( )

Get duration.

Returns
int duration

Definition at line 128 of file class.ilMediaItem.php.

129 {
130 return $this->duration;
131 }

References $duration.

Referenced by create(), and update().

+ Here is the caller graph for this function:

◆ getFormat()

ilMediaItem::getFormat ( )

Definition at line 533 of file class.ilMediaItem.php.

534 {
535 return $this->format;
536 }

References $format.

Referenced by create(), getOriginalSize(), getThumbnailTarget(), and update().

+ Here is the caller graph for this function:

◆ getHAlign()

ilMediaItem::getHAlign ( )

get horizontal align

Definition at line 670 of file class.ilMediaItem.php.

671 {
672 return $this->halign;
673 }

References $halign.

Referenced by create(), and update().

+ Here is the caller graph for this function:

◆ getHeight()

ilMediaItem::getHeight ( )

get height

Definition at line 606 of file class.ilMediaItem.php.

607 {
608 return $this->height;
609 }

References $height.

Referenced by addAreaToMapWorkCopy(), copyOriginal(), create(), makeMapWorkCopy(), and update().

+ Here is the caller graph for this function:

◆ getId()

ilMediaItem::getId ( )

get media item id

Returns
int media item id

Definition at line 79 of file class.ilMediaItem.php.

80 {
81 return $this->id;
82 }

References $id.

Referenced by create(), getWorkDirectory(), read(), update(), writeParameter(), and writeThumbTried().

+ Here is the caller graph for this function:

◆ getLocation()

ilMediaItem::getLocation ( )

Definition at line 513 of file class.ilMediaItem.php.

514 {
515 return $this->location;
516 }

References $location.

Referenced by copyOriginal(), create(), determineDuration(), extractUrlParameters(), getMapWorkCopyName(), getOriginalSize(), getSuffix(), getThumbnailTarget(), and update().

+ Here is the caller graph for this function:

◆ getLocationType()

ilMediaItem::getLocationType ( )

Definition at line 523 of file class.ilMediaItem.php.

524 {
526 }

References $location_type.

Referenced by copyOriginal(), create(), getOriginalSize(), getThumbnailTarget(), and update().

+ Here is the caller graph for this function:

◆ getMapArea()

& ilMediaItem::getMapArea (   $nr)

get map area

Definition at line 574 of file class.ilMediaItem.php.

575 {
576 return $this->mapareas[$nr - 1];
577 }

References $nr.

◆ getMapAreas()

ilMediaItem::getMapAreas ( )

get map areas

Definition at line 582 of file class.ilMediaItem.php.

583 {
584 return $this->mapareas;
585 }

References $mapareas.

◆ getMapAreasXML()

ilMediaItem::getMapAreasXML (   $a_insert_inst = false,
  $a_inst = 0 
)

get xml code of media items' areas

Definition at line 1105 of file class.ilMediaItem.php.

1106 {
1107 $xml = "";
1108
1109 // build xml of map areas
1110 for ($i = 0; $i < count($this->mapareas); $i++) {
1111 $area = $this->mapareas[$i];
1112
1113 // highlight mode
1114 $hm = "";
1115 if ($area->getHighlightMode() != "") {
1116 $hm = ' HighlightMode="' . $area->getHighlightMode() . '" ';
1117 $hcl = ($area->getHighlightClass() != "")
1118 ? $area->getHighlightClass()
1119 : "Accented";
1120 $hm .= 'HighlightClass="' . $hcl . '" ';
1121 }
1122
1123 $xml .= "<MapArea Shape=\"" . $area->getShape() . "\" Coords=\"" . $area->getCoords() . "\" " . $hm . ">";
1124 if ($area->getLinkType() == IL_INT_LINK) {
1125 $target_frame = $area->getTargetFrame();
1126
1127 if ($area->getType() == "GlossaryItem" && $target_frame == "") {
1128 $target_frame = "Glossary";
1129 }
1130
1131 $tf_str = ($target_frame == "")
1132 ? ""
1133 : "TargetFrame=\"" . $target_frame . "\"";
1134
1135 $xml .= "<IntLink Target=\"" . $area->getTarget($a_insert_inst, $a_inst) . "\" Type=\"" .
1136 $area->getType() . "\" $tf_str>";
1137 // see bug 17893 and http://stackoverflow.com/questions/4026502/xml-error-at-ampersand
1138 $xml .= htmlspecialchars($area->getTitle(), ENT_QUOTES);
1139 $xml .= "</IntLink>";
1140 } else {
1141 $xml .= "<ExtLink Href=\"" . str_replace("&", "&amp;", $area->getHref()) . "\" Title=\"" .
1142 str_replace("&", "&amp;", $area->getExtTitle()) . "\">";
1143 $xml .= str_replace("&", "&amp;", $area->getTitle());
1144 $xml .= "</ExtLink>";
1145 }
1146 $xml .= "</MapArea>";
1147 }
1148 return $xml;
1149 }
const IL_INT_LINK
$xml
Definition: metadata.php:332

References $i, $xml, and IL_INT_LINK.

◆ getMapWorkCopyName()

ilMediaItem::getMapWorkCopyName (   $a_reference_copy = false)

Get name of image map work copy file.

Parameters
stringGet name, for copy of external referenced image

Definition at line 802 of file class.ilMediaItem.php.

803 {
804 $file_arr = explode("/", $this->getLocation());
805 $o_file = $file_arr[count($file_arr) - 1];
806 $file_arr = explode(".", $o_file);
807 unset($file_arr[count($file_arr) - 1]);
808 $file = implode(".", $file_arr);
809
810 if (!$a_reference_copy) {
811 return $this->getWorkDirectory() . "/" . $file . "." . $this->getMapWorkCopyType();
812 } else {
813 return $this->getWorkDirectory() . "/l_copy_" . $o_file;
814 }
815 }

References getLocation(), getMapWorkCopyType(), and getWorkDirectory().

Referenced by addAreaToMapWorkCopy(), buildMapWorkImage(), copyOriginal(), makeMapWorkCopy(), outputMapWorkCopy(), and saveMapWorkImage().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getMapWorkCopyType()

ilMediaItem::getMapWorkCopyType ( )

get image type of image map work copy

Definition at line 793 of file class.ilMediaItem.php.

794 {
796 }
getSuffix()
get location suffix
static getGDSupportedImageType($a_desired_type)
returns the best supported image type by this PHP build

References ilUtil\getGDSupportedImageType(), and getSuffix().

Referenced by buildMapWorkImage(), copyOriginal(), getMapWorkCopyName(), outputMapWorkCopy(), and saveMapWorkImage().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getMapWorkImage()

& ilMediaItem::getMapWorkImage ( )

get image map work image

Definition at line 1097 of file class.ilMediaItem.php.

1098 {
1099 return $this->map_image;
1100 }

References $map_image.

Referenced by addAreaToMapWorkCopy(), and makeMapWorkCopy().

+ Here is the caller graph for this function:

◆ getMediaItemsForUploadHash()

static ilMediaItem::getMediaItemsForUploadHash (   $a_hash)
static

Get media items for upload hash.

Parameters
string$a_hashupload hash
Returns
array

Definition at line 1225 of file class.ilMediaItem.php.

1226 {
1227 global $DIC;
1228
1229 $db = $DIC->database();
1230
1231 $set = $db->queryF(
1232 "SELECT * FROM media_item " .
1233 " WHERE upload_hash = %s ",
1234 array("text"),
1235 array($a_hash)
1236 );
1237 $media_items = array();
1238 while ($rec = $db->fetchAssoc($set)) {
1239 $media_items[] = $rec;
1240 }
1241 return $media_items;
1242 }

References $db, and $DIC.

Referenced by ilObjMediaPoolGUI\editTitlesAndDescriptions(), and ilObjMediaPoolGUI\saveTitlesAndDescriptions().

+ Here is the caller graph for this function:

◆ getMobId()

ilMediaItem::getMobId ( )

get id of parent media object

Returns
int media object id

Definition at line 97 of file class.ilMediaItem.php.

98 {
99 return $this->mob_id;
100 }

References $mob_id.

Referenced by create(), determineDuration(), getDirectory(), getOriginalSize(), getThumbnailDirectory(), getThumbnailTarget(), read(), and update().

+ Here is the caller graph for this function:

◆ getNr()

ilMediaItem::getNr ( )

Definition at line 110 of file class.ilMediaItem.php.

111 {
112 return $this->nr;
113 }

References $nr.

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

+ Here is the caller graph for this function:

◆ getOriginalSize()

ilMediaItem::getOriginalSize ( )

get original size

Definition at line 622 of file class.ilMediaItem.php.

623 {
624 $mob_dir = ilObjMediaObject::_getDirectory($this->getMobId());
625
626 if (ilUtil::deducibleSize($this->getFormat())) {
627 if ($this->getLocationType() == "LocalFile") {
628 $loc = $mob_dir . "/" . $this->getLocation();
629 } else {
630 $loc = $this->getLocation();
631 }
632
633 include_once("./Services/MediaObjects/classes/class.ilMediaImageUtil.php");
635 if ($size[0] > 0 && $size[1] > 0) {
636 return array("width" => $size[0], "height" => $size[1]);
637 }
638 }
639
640 return false;
641 }
static getImageSize($a_location)
Get image size from location.
static deducibleSize($a_mime)
checks if mime type is provided by getimagesize()

References $size, ilObjMediaObject\_getDirectory(), ilUtil\deducibleSize(), getFormat(), ilMediaImageUtil\getImageSize(), getLocation(), getLocationType(), and getMobId().

+ Here is the call graph for this function:

◆ getParameter()

ilMediaItem::getParameter (   $a_name)

get a single parameter

Definition at line 753 of file class.ilMediaItem.php.

754 {
755 return $this->parameters[$a_name];
756 }

◆ getParameters()

ilMediaItem::getParameters ( )

get all parameters (in array)

Definition at line 737 of file class.ilMediaItem.php.

738 {
739 return $this->parameters;
740 }

References $parameters.

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

+ Here is the caller graph for this function:

◆ getParameterString()

ilMediaItem::getParameterString ( )

get all parameters (as string)

Definition at line 745 of file class.ilMediaItem.php.

746 {
747 return ilUtil::assembleParameterString($this->parameters);
748 }
static assembleParameterString($a_par_arr)

References ilUtil\assembleParameterString().

+ Here is the call graph for this function:

◆ getPurpose()

ilMediaItem::getPurpose ( )

Definition at line 503 of file class.ilMediaItem.php.

504 {
505 return $this->purpose;
506 }

References $purpose.

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

+ Here is the caller graph for this function:

◆ getSuffix()

ilMediaItem::getSuffix ( )

get location suffix

Definition at line 783 of file class.ilMediaItem.php.

784 {
785 $loc_arr = explode(".", $this->getLocation());
786
787 return $loc_arr[count($loc_arr) - 1];
788 }

References getLocation().

Referenced by getMapWorkCopyType().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getTextRepresentation()

ilMediaItem::getTextRepresentation ( )

Get text representation.

Returns
string text representation

Definition at line 146 of file class.ilMediaItem.php.

147 {
148 return $this->text_representation;
149 }

Referenced by create(), and update().

+ Here is the caller graph for this function:

◆ getThumbnailDirectory()

ilMediaItem::getThumbnailDirectory (   $a_mode = "filesystem")

get media file directory

Definition at line 828 of file class.ilMediaItem.php.

829 {
830 return ilObjMediaObject::_getThumbnailDirectory($this->getMobId(), $a_mode);
831 }
static _getThumbnailDirectory($a_mob_id, $a_mode="filesystem")
get directory for files of media object (static)

References ilObjMediaObject\_getThumbnailDirectory(), and getMobId().

Referenced by getThumbnailTarget().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getThumbnailTarget()

ilMediaItem::getThumbnailTarget (   $a_size = "")

get thumbnail target

Definition at line 836 of file class.ilMediaItem.php.

837 {
838 $jpeg_file = $this->getThumbnailDirectory() . "/" .
839 $this->getPurpose() . ".jpeg";
840 $format = "png";
841 if (is_file($jpeg_file)) {
842 $format = "jpeg";
843 }
844 if (is_int(strpos($this->getFormat(), "image"))) {
845 $thumb_file = $this->getThumbnailDirectory() . "/" .
846 $this->getPurpose() . "." . $format;
847 $thumb_file_small = $this->getThumbnailDirectory() . "/" .
848 $this->getPurpose() . "_small." . $format;
849 // generate thumbnail (if not tried before)
850 if ($this->getThumbTried() == "n" && $this->getLocationType() == "LocalFile" && $this->getFormat() !== "image/svg+xml") {
851 if (is_file($thumb_file)) {
852 unlink($thumb_file);
853 }
854 if (is_file($thumb_file_small)) {
855 unlink($thumb_file_small);
856 }
857 $this->writeThumbTried("y");
859 $med_file = $this->getDirectory() . "/" . $this->getLocation();
860
861 if (is_file($med_file)) {
862 $mob = new ilObjMediaObject($this->getMobId());
863 $mob->makeThumbnail($this->getLocation(), $this->getPurpose() . "." . $format, $format, "80");
864 $mob->makeThumbnail($this->getLocation(), $this->getPurpose() . "_small." . $format, $format, "40");
865 }
866 }
867 if ($this->getFormat() === "image/svg+xml") {
868 return ilObjMediaObject::_getURL($this->getMobId()) . "/" . $this->getLocation();
869 }
870 if ($a_size == "small") {
871 if (is_file($thumb_file_small)) {
872 $random = new \ilRandom();
873 return $this->getThumbnailDirectory("output") . "/" .
874 $this->getPurpose() . "_small." . $format . "?dummy=" . $random->int(1, 999999);
875 }
876 } else {
877 if (is_file($thumb_file)) {
878 $random = new \ilRandom();
879 return $this->getThumbnailDirectory("output") . "/" .
880 $this->getPurpose() . "." . $format . "?dummy=" . $random->int(1, 999999);
881 }
882 }
883 }
884
885 return "";
886 }
writeThumbTried($a_tried)
write thumbnail creation try data ("y"/"n")
getThumbnailDirectory($a_mode="filesystem")
get media file directory
Class ilObjMediaObject.
static _createThumbnailDirectory($a_obj_id)
Create thumbnail directory.
static _getURL($a_mob_id)
get directory for files of media object (static)

References $format, ilObjMediaObject\_createThumbnailDirectory(), ilObjMediaObject\_getURL(), getDirectory(), getFormat(), getLocation(), getLocationType(), getMobId(), getPurpose(), getThumbnailDirectory(), getThumbTried(), and writeThumbTried().

+ Here is the call graph for this function:

◆ getThumbTried()

ilMediaItem::getThumbTried ( )

Definition at line 543 of file class.ilMediaItem.php.

544 {
545 return $this->tried_thumb;
546 }

Referenced by getThumbnailTarget().

+ Here is the caller graph for this function:

◆ getUploadHash()

ilMediaItem::getUploadHash ( )

Get upload hash.

Returns
string upload hash

Definition at line 164 of file class.ilMediaItem.php.

165 {
166 return $this->upload_hash;
167 }

References $upload_hash.

Referenced by create(), and update().

+ Here is the caller graph for this function:

◆ getWidth()

ilMediaItem::getWidth ( )

get width

Definition at line 590 of file class.ilMediaItem.php.

591 {
592 return $this->width;
593 }

References $width.

Referenced by addAreaToMapWorkCopy(), copyOriginal(), create(), makeMapWorkCopy(), and update().

+ Here is the caller graph for this function:

◆ getWorkDirectory()

ilMediaItem::getWorkDirectory ( )

get work directory for image map editing

Definition at line 761 of file class.ilMediaItem.php.

762 {
763 return ilUtil::getDataDir() . "/map_workfiles/item_" . $this->getId();
764 }

References ilUtil\getDataDir(), and getId().

Referenced by createWorkDirectory(), and getMapWorkCopyName().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ makeMapWorkCopy()

ilMediaItem::makeMapWorkCopy (   $a_area_nr = 0,
  $a_exclude = false 
)

make map work copy of image

Parameters
int$a_area_nrdraw area $a_area_nr only
boolean$a_excludetrue: draw all areas but area $a_area_nr

Definition at line 943 of file class.ilMediaItem.php.

944 {
946
947 if (!$this->copyOriginal()) {
948 return false;
949 }
950 $this->buildMapWorkImage();
951
952 // determine ratios
953 $size = @getimagesize($this->getMapWorkCopyName());
954 $x_ratio = 1;
955 if ($size[0] > 0 && $this->getWidth() > 0) {
956 $x_ratio = $this->getWidth() / $size[0];
957 }
958 $y_ratio = 1;
959 if ($size[1] > 0 && $this->getHeight() > 0) {
960 $y_ratio = $this->getHeight() / $size[1];
961 }
962
963 // draw map areas
964 for ($i = 0; $i < count($this->mapareas); $i++) {
965 if (((($i + 1) == $a_area_nr) && !$a_exclude) ||
966 ((($i + 1) != $a_area_nr) && $a_exclude) ||
967 ($a_area_nr == 0)
968 ) {
969 $area = $this->mapareas[$i];
970 $area->draw(
971 $this->getMapWorkImage(),
974 true,
975 $x_ratio,
976 $y_ratio
977 );
978 }
979 }
980
981 $this->saveMapWorkImage();
982
983 return true;
984 }
copyOriginal()
Copy the orginal file.

References $color1, $color2, $i, $lng, $size, buildMapWorkImage(), copyOriginal(), getHeight(), getMapWorkCopyName(), getMapWorkImage(), getWidth(), and saveMapWorkImage().

+ Here is the call graph for this function:

◆ outputMapWorkCopy()

ilMediaItem::outputMapWorkCopy ( )

output raw map work copy file

Definition at line 1025 of file class.ilMediaItem.php.

1026 {
1027 if ($this->getMapWorkCopyType() != "") {
1028 header("Pragma: no-cache");
1029 header("Expires: 0");
1030 header("Content-type: image/" . strtolower($this->getMapWorkCopyType()));
1031 readfile($this->getMapWorkCopyName());
1032 }
1033 exit;
1034 }
exit
Definition: login.php:29

References exit, getMapWorkCopyName(), and getMapWorkCopyType().

+ Here is the call graph for this function:

◆ read()

ilMediaItem::read ( )

read media item data (item id or (mob_id and nr) must be set)

Definition at line 278 of file class.ilMediaItem.php.

279 {
281
282 $item_id = $this->getId();
283 $mob_id = $this->getMobId();
284 $nr = $this->getNr();
285 $query = "";
286 if ($item_id > 0) {
287 $query = "SELECT * FROM media_item WHERE id = " .
288 $ilDB->quote($this->getId(), "integer");
289 } elseif ($mob_id > 0 && $nr > 0) {
290 $query = "SELECT * FROM media_item WHERE mob_id = " .
291 $ilDB->quote($this->getMobId(), "integer") . " " .
292 "AND nr=" . $ilDB->quote($this->getNr(), "integer");
293 }
294 if ($query != "") {
295 $item_set = $ilDB->query($query);
296 $item_rec = $ilDB->fetchAssoc($item_set);
297
298 $this->setLocation($item_rec["location"]);
299 $this->setLocationType($item_rec["location_type"]);
300 $this->setFormat($item_rec["format"]);
301 $this->setWidth($item_rec["width"]);
302 $this->setHeight($item_rec["height"]);
303 $this->setHAlign($item_rec["halign"]);
304 $this->setCaption($item_rec["caption"]);
305 $this->setPurpose($item_rec["purpose"]);
306 $this->setNr($item_rec["nr"]);
307 $this->setMobId($item_rec["mob_id"]);
308 $this->setId($item_rec["id"]);
309 $this->setThumbTried($item_rec["tried_thumb"]);
310 $this->setTextRepresentation($item_rec["text_representation"]);
311 $this->setUploadHash($item_rec["upload_hash"]);
312 $this->setDuration((int) $item_rec["duration"]);
313
314 // get item parameter
315 $query = "SELECT * FROM mob_parameter WHERE med_item_id = " .
316 $ilDB->quote($this->getId(), "integer");
317 $par_set = $ilDB->query($query);
318 while ($par_rec = $ilDB->fetchAssoc($par_set)) {
319 $this->setParameter($par_rec["name"], $par_rec["value"]);
320 }
321
322 // get item map areas
323 $max = ilMapArea::_getMaxNr($this->getId());
324 for ($i = 1; $i <= $max; $i++) {
325 $area = new ilMapArea($this->getId(), $i);
326 $this->addMapArea($area);
327 }
328 }
329 }
setMobId($a_mob_id)
set id of parent media object
setPurpose($a_purpose)
addMapArea(&$a_map_area)
setNr($a_nr)
set number of media item within media object
setWidth($a_width)
set width
setHAlign($a_halign)
set horizontal align
setTextRepresentation($a_val)
Set text representation.
setFormat($a_format)
setLocation($a_location)
setUploadHash($a_val)
Set upload hash.
setLocationType($a_type)
setCaption($a_caption)
set caption
setThumbTried($a_tried)
setHeight($a_height)
set height

References $db, $i, $ilDB, $mob_id, $nr, $query, ilMapArea\_getMaxNr(), addMapArea(), getId(), getMobId(), getNr(), setCaption(), setDuration(), setFormat(), setHAlign(), setHeight(), setId(), setLocation(), setLocationType(), setMobId(), setNr(), setParameter(), setPurpose(), setTextRepresentation(), setThumbTried(), setUploadHash(), and setWidth().

Referenced by __construct().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ resetParameters()

ilMediaItem::resetParameters ( )

reset parameters

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

691 {
692 $this->parameters = array();
693 }

Referenced by setParameters().

+ Here is the caller graph for this function:

◆ saveMapWorkImage()

ilMediaItem::saveMapWorkImage ( )

save image map work image

Definition at line 1071 of file class.ilMediaItem.php.

1072 {
1073 $im_type = strtolower($this->getMapWorkCopyType());
1074
1075 // save image work-copy and free memory
1076 switch ($im_type) {
1077 case "gif":
1078 ImageGIF($this->map_image, $this->getMapWorkCopyName());
1079 break;
1080
1081 case "jpg":
1082 case "jpeg":
1083 ImageJPEG($this->map_image, $this->getMapWorkCopyName());
1084 break;
1085
1086 case "png":
1087 ImagePNG($this->map_image, $this->getMapWorkCopyName());
1088 break;
1089 }
1090
1091 ImageDestroy($this->map_image);
1092 }

References getMapWorkCopyName(), and getMapWorkCopyType().

Referenced by addAreaToMapWorkCopy(), and makeMapWorkCopy().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ setCaption()

ilMediaItem::setCaption (   $a_caption)

set caption

Definition at line 646 of file class.ilMediaItem.php.

647 {
648 $this->caption = $a_caption;
649 }

Referenced by read().

+ Here is the caller graph for this function:

◆ setDuration()

ilMediaItem::setDuration (   $a_val)

Set duration.

Parameters
int$a_valduration

Definition at line 119 of file class.ilMediaItem.php.

120 {
121 $this->duration = $a_val;
122 }

Referenced by determineDuration(), and read().

+ Here is the caller graph for this function:

◆ setFormat()

ilMediaItem::setFormat (   $a_format)

Definition at line 528 of file class.ilMediaItem.php.

529 {
530 $this->format = $a_format;
531 }

Referenced by read().

+ Here is the caller graph for this function:

◆ setHAlign()

ilMediaItem::setHAlign (   $a_halign)

set horizontal align

Definition at line 662 of file class.ilMediaItem.php.

663 {
664 $this->halign = $a_halign;
665 }

Referenced by read().

+ Here is the caller graph for this function:

◆ setHeight()

ilMediaItem::setHeight (   $a_height)

set height

Definition at line 614 of file class.ilMediaItem.php.

615 {
616 $this->height = $a_height;
617 }

Referenced by read().

+ Here is the caller graph for this function:

◆ setId()

ilMediaItem::setId (   $a_id)

set media item id

Parameters
int$a_idmedia item id

Definition at line 70 of file class.ilMediaItem.php.

71 {
72 $this->id = $a_id;
73 }

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

+ Here is the caller graph for this function:

◆ setLocation()

ilMediaItem::setLocation (   $a_location)

Definition at line 508 of file class.ilMediaItem.php.

509 {
510 $this->location = $a_location;
511 }

Referenced by read().

+ Here is the caller graph for this function:

◆ setLocationType()

ilMediaItem::setLocationType (   $a_type)

Definition at line 518 of file class.ilMediaItem.php.

519 {
520 $this->location_type = $a_type;
521 }

Referenced by read().

+ Here is the caller graph for this function:

◆ setMobId()

ilMediaItem::setMobId (   $a_mob_id)

set id of parent media object

Parameters
int$a_mob_idmedia object id

Definition at line 88 of file class.ilMediaItem.php.

89 {
90 $this->mob_id = $a_mob_id;
91 }

Referenced by read().

+ Here is the caller graph for this function:

◆ setNr()

ilMediaItem::setNr (   $a_nr)

set number of media item within media object

Definition at line 105 of file class.ilMediaItem.php.

106 {
107 $this->nr = $a_nr;
108 }

Referenced by read().

+ Here is the caller graph for this function:

◆ setParameter()

ilMediaItem::setParameter (   $a_name,
  $a_value 
)

set parameter

Parameters
string$a_nameparameter name
string$a_valueparameter value

Definition at line 680 of file class.ilMediaItem.php.

681 {
682 if (self::checkParameter($a_name, $a_value)) {
683 $this->parameters[$a_name] = $a_value;
684 }
685 }

Referenced by extractUrlParameters(), read(), and setParameters().

+ Here is the caller graph for this function:

◆ setParameters()

ilMediaItem::setParameters (   $a_par)

set alle parameters via parameter string (format: par1="value1", par2="value2", ...)

Parameters
string$a_parparameter string

Definition at line 699 of file class.ilMediaItem.php.

700 {
701 $this->resetParameters();
702 $par_arr = ilUtil::extractParameterString($a_par);
703 if (is_array($par_arr)) {
704 foreach ($par_arr as $par => $val) {
705 $this->setParameter($par, $val);
706 }
707 }
708 }
resetParameters()
reset parameters
static extractParameterString($a_parstr)
extracts parameter value pairs from a string into an array

References ilUtil\extractParameterString(), resetParameters(), and setParameter().

+ Here is the call graph for this function:

◆ setPurpose()

ilMediaItem::setPurpose (   $a_purpose)

Definition at line 498 of file class.ilMediaItem.php.

499 {
500 $this->purpose = $a_purpose;
501 }

Referenced by read().

+ Here is the caller graph for this function:

◆ setTextRepresentation()

ilMediaItem::setTextRepresentation (   $a_val)

Set text representation.

Parameters
stringtext representation

Definition at line 137 of file class.ilMediaItem.php.

138 {
139 $this->text_representation = $a_val;
140 }

Referenced by read().

+ Here is the caller graph for this function:

◆ setThumbTried()

ilMediaItem::setThumbTried (   $a_tried)

Definition at line 538 of file class.ilMediaItem.php.

539 {
540 $this->tried_thumb = $a_tried;
541 }

Referenced by read().

+ Here is the caller graph for this function:

◆ setUploadHash()

ilMediaItem::setUploadHash (   $a_val)

Set upload hash.

Parameters
string$a_valupload hash

Definition at line 155 of file class.ilMediaItem.php.

156 {
157 $this->upload_hash = $a_val;
158 }

Referenced by read().

+ Here is the caller graph for this function:

◆ setWidth()

ilMediaItem::setWidth (   $a_width)

set width

Definition at line 598 of file class.ilMediaItem.php.

599 {
600 $this->width = $a_width;
601 }

Referenced by read().

+ Here is the caller graph for this function:

◆ update()

ilMediaItem::update ( )

update media item data (without map areas!)

Definition at line 223 of file class.ilMediaItem.php.

224 {
226
227 $query = "UPDATE media_item SET " .
228 " mob_id = " . $ilDB->quote($this->getMobId(), "integer") . "," .
229 " purpose = " . $ilDB->quote($this->getPurpose(), "text") . "," .
230 " location = " . $ilDB->quote($this->getLocation(), "text") . "," .
231 " location_type = " . $ilDB->quote($this->getLocationType(), "text") . "," .
232 " format = " . $ilDB->quote($this->getFormat(), "text") . "," .
233 " width = " . $ilDB->quote($this->getWidth(), "text") . "," .
234 " height = " . $ilDB->quote($this->getHeight(), "text") . "," .
235 " halign = " . $ilDB->quote($this->getHAlign(), "text") . "," .
236 " caption = " . $ilDB->quote($this->getCaption(), "text") . "," .
237 " nr = " . $ilDB->quote($this->getNr(), "integer") . "," .
238 " text_representation = " . $ilDB->quote($this->getTextRepresentation(), "text") . "," .
239 " upload_hash = " . $ilDB->quote($this->getUploadHash(), "text") . "," .
240 " duration = " . $ilDB->quote($this->getDuration(), "integer") .
241 " WHERE id = " . $ilDB->quote($this->getId(), "integer");
242 $ilDB->manipulate($query);
243
244 // delete mob parameters
245 $query = "DELETE FROM mob_parameter WHERE med_item_id = " .
246 $ilDB->quote($this->getId(), "integer");
247
248 // create mob parameters
249 $params = $this->getParameters();
250 foreach ($params as $name => $value) {
251 $query = "INSERT INTO mob_parameter (med_item_id, name, value) VALUES " .
252 "(" . $ilDB->quote($this->getId(), "integer") . "," .
253 $ilDB->quote($name, "text") . "," .
254 $ilDB->quote($value, "text") . ")";
255 $ilDB->manipulate($query);
256 }
257 }

References $db, $ilDB, $name, $query, getCaption(), getDuration(), getFormat(), getHAlign(), getHeight(), getId(), getLocation(), getLocationType(), getMobId(), getNr(), getParameters(), getPurpose(), getTextRepresentation(), getUploadHash(), and getWidth().

+ Here is the call graph for this function:

◆ writeParameter()

ilMediaItem::writeParameter (   $a_name,
  $a_value 
)

Write parameter.

Parameters

return

Definition at line 264 of file class.ilMediaItem.php.

265 {
267
268 $query = "INSERT INTO mob_parameter (med_item_id, name, value) VALUES " .
269 "(" . $ilDB->quote($this->getId(), "integer") . "," .
270 $ilDB->quote($a_name, "text") . "," .
271 $ilDB->quote($a_value, "text") . ")";
272 $ilDB->manipulate($query);
273 }

References $db, $ilDB, $query, and getId().

+ Here is the call graph for this function:

◆ writeThumbTried()

ilMediaItem::writeThumbTried (   $a_tried)

write thumbnail creation try data ("y"/"n")

Definition at line 334 of file class.ilMediaItem.php.

335 {
337
338 $q = "UPDATE media_item SET tried_thumb = " .
339 $ilDB->quote($a_tried, "text") .
340 " WHERE id = " . $ilDB->quote($this->getId(), "integer");
341
342 $ilDB->manipulate($q);
343 }

References $db, $ilDB, and getId().

Referenced by getThumbnailTarget().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

Field Documentation

◆ $caption

ilMediaItem::$caption

Definition at line 32 of file class.ilMediaItem.php.

Referenced by getCaption().

◆ $color1

ilMediaItem::$color1

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

Referenced by makeMapWorkCopy().

◆ $color2

ilMediaItem::$color2

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

Referenced by makeMapWorkCopy().

◆ $db

ilMediaItem::$db
protected

◆ $duration

ilMediaItem::$duration = 0
protected

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

Referenced by getDuration().

◆ $format

ilMediaItem::$format

Definition at line 29 of file class.ilMediaItem.php.

Referenced by getFormat(), and getThumbnailTarget().

◆ $halign

ilMediaItem::$halign

Definition at line 33 of file class.ilMediaItem.php.

Referenced by getHAlign().

◆ $height

ilMediaItem::$height

Definition at line 31 of file class.ilMediaItem.php.

Referenced by getHeight().

◆ $id

ilMediaItem::$id

Definition at line 25 of file class.ilMediaItem.php.

Referenced by getId().

◆ $lng

ilMediaItem::$lng
protected

Definition at line 23 of file class.ilMediaItem.php.

Referenced by copyOriginal(), and makeMapWorkCopy().

◆ $location

ilMediaItem::$location

Definition at line 27 of file class.ilMediaItem.php.

Referenced by getLocation().

◆ $location_type

ilMediaItem::$location_type

Definition at line 28 of file class.ilMediaItem.php.

Referenced by getLocationType().

◆ $map_cnt

ilMediaItem::$map_cnt

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

Referenced by addMapArea(), and deleteMapArea().

◆ $map_image

ilMediaItem::$map_image

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

Referenced by getMapWorkImage().

◆ $mapareas

ilMediaItem::$mapareas

Definition at line 37 of file class.ilMediaItem.php.

Referenced by getMapAreas().

◆ $mob_id

ilMediaItem::$mob_id

Definition at line 35 of file class.ilMediaItem.php.

Referenced by getMobId(), and read().

◆ $nr

ilMediaItem::$nr

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

Referenced by deleteMapArea(), getMapArea(), getNr(), and read().

◆ $parameters

ilMediaItem::$parameters

Definition at line 34 of file class.ilMediaItem.php.

Referenced by getParameters().

◆ $purpose

ilMediaItem::$purpose

Definition at line 26 of file class.ilMediaItem.php.

Referenced by getPurpose().

◆ $upload_hash

ilMediaItem::$upload_hash
protected

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

Referenced by getUploadHash().

◆ $width

ilMediaItem::$width

Definition at line 30 of file class.ilMediaItem.php.

Referenced by getWidth().


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