ILIAS  release_6 Revision v6.24-5-g0c8bfefb3b8
ilMediaItem Class Reference

Class ilMediaItem. 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 ()
 
 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...
 

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
 
 $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 16 of file class.ilMediaItem.php.

Constructor & Destructor Documentation

◆ __construct()

ilMediaItem::__construct (   $a_id = 0)

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

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

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 1183 of file class.ilMediaItem.php.

1184 {
1185 global $DIC;
1186
1187 $ilDB = $DIC->database();
1188
1189 // read media_items records
1190 $query = "SELECT * FROM media_item WHERE mob_id = " .
1191 $ilDB->quote($a_mob_id, "integer") . " ORDER BY nr";
1192
1193 $item_set = $ilDB->query($query);
1194 $links = array();
1195 while ($item_rec = $ilDB->fetchAssoc($item_set)) {
1196 $map_links = ilMapArea::_getIntLinks($item_rec["id"]);
1197 foreach ($map_links as $key => $map_link) {
1198 $links[$key] = $map_link;
1199 }
1200 }
1201 return $links;
1202 }
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 410 of file class.ilMediaItem.php.

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

388 {
389 global $DIC;
390
391 $ilDB = $DIC->database();
392
393 // read media_object record
394 $query = "SELECT * FROM media_item WHERE mob_id = " .
395 $ilDB->quote($a_mobId, "integer") . " " .
396 "AND purpose=" . $ilDB->quote($a_purpose, "text") . " ORDER BY nr";
397 $item_set = $ilDB->query($query);
398
399 while ($item_rec = $ilDB->fetchAssoc($item_set)) {
400 return $item_rec;
401 }
402 return false;
403 }

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 341 of file class.ilMediaItem.php.

342 {
343 global $DIC;
344
345 $ilDB = $DIC->database();
346
347 // read media_object record
348 $query = "SELECT * FROM media_item WHERE mob_id = " .
349 $ilDB->quote($a_mob_id, "integer") . " " .
350 "AND purpose = " . $ilDB->quote($a_purpose, "text");
351 $set = $ilDB->query($query);
352 if ($rec = $ilDB->fetchAssoc($set)) {
353 return $rec["location"];
354 }
355
356 return "";
357 }

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 364 of file class.ilMediaItem.php.

365 {
366 global $DIC;
367
368 $ilDB = $DIC->database();
369
370 // read media_object record
371 $query = "SELECT * FROM media_item WHERE id = " .
372 $ilDB->quote($a_med_id, "integer");
373 $set = $ilDB->query($query);
374 if ($rec = $ilDB->fetchAssoc($set)) {
375 return $rec["mob_id"];
376 }
377
378 return "";
379 }

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 1161 of file class.ilMediaItem.php.

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

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

Referenced by ilContObjParser\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 994 of file class.ilMediaItem.php.

995 {
996 $this->buildMapWorkImage();
997
998 // determine ratios
999 $size = @getimagesize($this->getMapWorkCopyName());
1000 $x_ratio = 1;
1001 if ($size[0] > 0 && $this->getWidth() > 0) {
1002 $x_ratio = $this->getWidth() / $size[0];
1003 }
1004 $y_ratio = 1;
1005 if ($size[1] > 0 && $this->getHeight() > 0) {
1006 $y_ratio = $this->getHeight() / $size[1];
1007 }
1008
1009 // add new area to work image
1010 $area = new ilMapArea();
1011 $area->setShape($a_shape);
1012 $area->setCoords($a_coords);
1013 $area->draw(
1014 $this->getMapWorkImage(),
1015 $this->color1,
1016 $this->color2,
1017 false,
1018 $x_ratio,
1019 $y_ratio
1020 );
1021
1022 $this->saveMapWorkImage();
1023 }
$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 541 of file class.ilMediaItem.php.

542 {
543 $this->mapareas[$this->map_cnt] = $a_map_area;
544 $this->map_cnt++;
545 }

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 1042 of file class.ilMediaItem.php.

1043 {
1044 $im_type = strtolower($this->getMapWorkCopyType());
1045
1046 switch ($im_type) {
1047 case "gif":
1048 $this->map_image = ImageCreateFromGIF($this->getMapWorkCopyName());
1049 break;
1050
1051 case "jpg":
1052 case "jpeg":
1053 $this->map_image = ImageCreateFromJPEG($this->getMapWorkCopyName());
1054 break;
1055
1056 case "png":
1057 $this->map_image = ImageCreateFromPNG($this->getMapWorkCopyName());
1058 break;
1059 }
1060
1061 // try to allocate black and white as color. if this is not possible, get the closest colors
1062 if (imagecolorstotal($this->map_image) > 250) {
1063 $this->color1 = imagecolorclosest($this->map_image, 0, 0, 0);
1064 $this->color2 = imagecolorclosest($this->map_image, 255, 255, 255);
1065 } else {
1066 $this->color1 = imagecolorallocate($this->map_image, 0, 0, 0);
1067 $this->color2 = imagecolorallocate($this->map_image, 255, 255, 255);
1068 }
1069 }
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 713 of file class.ilMediaItem.php.

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

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 164 of file class.ilMediaItem.php.

165 {
167
168 $item_id = $ilDB->nextId("media_item");
169 $query = "INSERT INTO media_item (id,mob_id, purpose, location, " .
170 "location_type, format, width, " .
171 "height, halign, caption, nr, text_representation, upload_hash) VALUES " .
172 "(" .
173 $ilDB->quote($item_id, "integer") . "," .
174 $ilDB->quote($this->getMobId(), "integer") . "," .
175 $ilDB->quote($this->getPurpose(), "text") . "," .
176 $ilDB->quote($this->getLocation(), "text") . "," .
177 $ilDB->quote($this->getLocationType(), "text") . "," .
178 $ilDB->quote($this->getFormat(), "text") . "," .
179 $ilDB->quote($this->getWidth(), "text") . "," .
180 $ilDB->quote($this->getHeight(), "text") . "," .
181 $ilDB->quote($this->getHAlign(), "text") . "," .
182 $ilDB->quote($this->getCaption(), "text") . "," .
183 $ilDB->quote($this->getNr(), "integer") . "," .
184 $ilDB->quote($this->getTextRepresentation(), "text") . "," .
185 $ilDB->quote($this->getUploadHash(), "text") .
186 ")";
187 $ilDB->manipulate($query);
188
189 $this->setId($item_id);
190
191 // create mob parameters
192 $params = $this->getParameters();
193 foreach ($params as $name => $value) {
194 $query = "INSERT INTO mob_parameter (med_item_id, name, value) VALUES " .
195 "(" . $ilDB->quote($item_id, "integer") . "," .
196 $ilDB->quote($name, "text") . "," .
197 $ilDB->quote($value, "text") . ")";
198 $ilDB->manipulate($query);
199 }
200
201 // create map areas
202 for ($i = 0; $i < count($this->mapareas); $i++) {
203 if (is_object($this->mapareas[$i])) {
204 $this->mapareas[$i]->setItemId($this->getId());
205 $this->mapareas[$i]->setNr($i + 1);
206 $this->mapareas[$i]->create();
207 }
208 }
209 }
getCaption()
get caption
getId()
get media item id
getHAlign()
get horizontal align
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(), 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 463 of file class.ilMediaItem.php.

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

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 550 of file class.ilMediaItem.php.

551 {
552 for ($i = 1; $i <= $this->map_cnt; $i++) {
553 if ($i > $nr) {
554 $this->mapareas[$i - 2] = $this->mapareas[$i - 1];
555 $this->mapareas[$i - 2]->setNr($i - 1);
556 }
557 }
558 if ($nr <= $this->map_cnt) {
559 unset($this->mapareas[$this->map_cnt - 1]);
560 $this->map_cnt--;
561 }
562 }

References $i, $map_cnt, and $nr.

◆ extractUrlParameters()

ilMediaItem::extractUrlParameters ( )

Extract parameters of special external references to parameter array.

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

1208 {
1209 include_once("./Services/MediaObjects/classes/class.ilExternalMediaAnalyzer.php");
1211 $this->getLocation(),
1212 $this->getParameters()
1213 );
1214 foreach ($par as $k => $v) {
1215 $this->setParameter($k, $v);
1216 }
1217 }
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 647 of file class.ilMediaItem.php.

648 {
649 return $this->caption;
650 }

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 821 of file class.ilMediaItem.php.

822 {
824 }
static _getDirectory($a_mob_id)
Get absolute directory.

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:

◆ getFormat()

ilMediaItem::getFormat ( )

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

527 {
528 return $this->format;
529 }

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 663 of file class.ilMediaItem.php.

664 {
665 return $this->halign;
666 }

References $halign.

Referenced by create(), and update().

+ Here is the caller graph for this function:

◆ getHeight()

ilMediaItem::getHeight ( )

get height

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

600 {
601 return $this->height;
602 }

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 82 of file class.ilMediaItem.php.

83 {
84 return $this->id;
85 }

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 506 of file class.ilMediaItem.php.

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

References $location.

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

+ Here is the caller graph for this function:

◆ getLocationType()

ilMediaItem::getLocationType ( )

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

517 {
519 }

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 567 of file class.ilMediaItem.php.

568 {
569 return $this->mapareas[$nr - 1];
570 }

References $nr.

◆ getMapAreas()

ilMediaItem::getMapAreas ( )

get map areas

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

576 {
577 return $this->mapareas;
578 }

References $mapareas.

◆ getMapAreasXML()

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

get xml code of media items' areas

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

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

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

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 1100 of file class.ilMediaItem.php.

1101 {
1102 return $this->map_image;
1103 }

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 102 of file class.ilMediaItem.php.

103 {
104 return $this->mob_id;
105 }

References $mob_id.

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

+ Here is the caller graph for this function:

◆ getNr()

ilMediaItem::getNr ( )

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

116 {
117 return $this->nr;
118 }

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 615 of file class.ilMediaItem.php.

616 {
617 $mob_dir = ilObjMediaObject::_getDirectory($this->getMobId());
618
619 if (ilUtil::deducibleSize($this->getFormat())) {
620 if ($this->getLocationType() == "LocalFile") {
621 $loc = $mob_dir . "/" . $this->getLocation();
622 } else {
623 $loc = $this->getLocation();
624 }
625
626 include_once("./Services/MediaObjects/classes/class.ilMediaImageUtil.php");
628 if ($size[0] > 0 && $size[1] > 0) {
629 return array("width" => $size[0], "height" => $size[1]);
630 }
631 }
632
633 return false;
634 }
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 735 of file class.ilMediaItem.php.

736 {
737 return $this->parameters;
738 }

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 744 of file class.ilMediaItem.php.

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

References ilUtil\assembleParameterString().

+ Here is the call graph for this function:

◆ getPurpose()

ilMediaItem::getPurpose ( )

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

497 {
498 return $this->purpose;
499 }

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 135 of file class.ilMediaItem.php.

136 {
137 return $this->text_representation;
138 }

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 829 of file class.ilMediaItem.php.

830 {
831 return ilObjMediaObject::_getThumbnailDirectory($this->getMobId(), $a_mode);
832 }
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 837 of file class.ilMediaItem.php.

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

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

+ Here is the call graph for this function:

◆ getThumbTried()

ilMediaItem::getThumbTried ( )

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

537 {
538 return $this->tried_thumb;
539 }

Referenced by getThumbnailTarget().

+ Here is the caller graph for this function:

◆ getUploadHash()

ilMediaItem::getUploadHash ( )

Get upload hash.

Returns
string upload hash

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

156 {
157 return $this->upload_hash;
158 }

References $upload_hash.

Referenced by create(), and update().

+ Here is the caller graph for this function:

◆ getWidth()

ilMediaItem::getWidth ( )

get width

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

584 {
585 return $this->width;
586 }

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 944 of file class.ilMediaItem.php.

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

1029 {
1030 if ($this->getMapWorkCopyType() != "") {
1031 header("Pragma: no-cache");
1032 header("Expires: 0");
1033 header("Content-type: image/" . strtolower($this->getMapWorkCopyType()));
1034 readfile($this->getMapWorkCopyName());
1035 }
1036 exit;
1037 }
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 269 of file class.ilMediaItem.php.

270 {
272
273 $item_id = $this->getId();
274 $mob_id = $this->getMobId();
275 $nr = $this->getNr();
276 $query = "";
277 if ($item_id > 0) {
278 $query = "SELECT * FROM media_item WHERE id = " .
279 $ilDB->quote($this->getId(), "integer");
280 } elseif ($mob_id > 0 && $nr > 0) {
281 $query = "SELECT * FROM media_item WHERE mob_id = " .
282 $ilDB->quote($this->getMobId(), "integer") . " " .
283 "AND nr=" . $ilDB->quote($this->getNr(), "integer");
284 }
285 if ($query != "") {
286 $item_set = $ilDB->query($query);
287 $item_rec = $ilDB->fetchAssoc($item_set);
288
289 $this->setLocation($item_rec["location"]);
290 $this->setLocationType($item_rec["location_type"]);
291 $this->setFormat($item_rec["format"]);
292 $this->setWidth($item_rec["width"]);
293 $this->setHeight($item_rec["height"]);
294 $this->setHAlign($item_rec["halign"]);
295 $this->setCaption($item_rec["caption"]);
296 $this->setPurpose($item_rec["purpose"]);
297 $this->setNr($item_rec["nr"]);
298 $this->setMobId($item_rec["mob_id"]);
299 $this->setId($item_rec["id"]);
300 $this->setThumbTried($item_rec["tried_thumb"]);
301 $this->setTextRepresentation($item_rec["text_representation"]);
302 $this->setUploadHash($item_rec["upload_hash"]);
303
304 // get item parameter
305 $query = "SELECT * FROM mob_parameter WHERE med_item_id = " .
306 $ilDB->quote($this->getId(), "integer");
307 $par_set = $ilDB->query($query);
308 while ($par_rec = $ilDB->fetchAssoc($par_set)) {
309 $this->setParameter($par_rec["name"], $par_rec["value"]);
310 }
311
312 // get item map areas
313 $max = ilMapArea::_getMaxNr($this->getId());
314 for ($i = 1; $i <= $max; $i++) {
315 $area = new ilMapArea($this->getId(), $i);
316 $this->addMapArea($area);
317 }
318 }
319 }
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(), 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 685 of file class.ilMediaItem.php.

686 {
687 $this->parameters = array();
688 }

Referenced by setParameters().

+ Here is the caller graph for this function:

◆ saveMapWorkImage()

ilMediaItem::saveMapWorkImage ( )

save image map work image

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

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

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 639 of file class.ilMediaItem.php.

640 {
641 $this->caption = $a_caption;
642 }

Referenced by read().

+ Here is the caller graph for this function:

◆ setFormat()

ilMediaItem::setFormat (   $a_format)

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

522 {
523 $this->format = $a_format;
524 }

Referenced by read().

+ Here is the caller graph for this function:

◆ setHAlign()

ilMediaItem::setHAlign (   $a_halign)

set horizontal align

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

656 {
657 $this->halign = $a_halign;
658 }

Referenced by read().

+ Here is the caller graph for this function:

◆ setHeight()

ilMediaItem::setHeight (   $a_height)

set height

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

608 {
609 $this->height = $a_height;
610 }

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 72 of file class.ilMediaItem.php.

73 {
74 $this->id = $a_id;
75 }

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

+ Here is the caller graph for this function:

◆ setLocation()

ilMediaItem::setLocation (   $a_location)

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

502 {
503 $this->location = $a_location;
504 }

Referenced by read().

+ Here is the caller graph for this function:

◆ setLocationType()

ilMediaItem::setLocationType (   $a_type)

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

512 {
513 $this->location_type = $a_type;
514 }
$a_type
Definition: workflow.php:92

References $a_type.

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 92 of file class.ilMediaItem.php.

93 {
94 $this->mob_id = $a_mob_id;
95 }

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 110 of file class.ilMediaItem.php.

111 {
112 $this->nr = $a_nr;
113 }

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 675 of file class.ilMediaItem.php.

676 {
677 if (self::checkParameter($a_name, $a_value)) {
678 $this->parameters[$a_name] = $a_value;
679 }
680 }

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 695 of file class.ilMediaItem.php.

696 {
697 $this->resetParameters();
698 $par_arr = ilUtil::extractParameterString($a_par);
699 if (is_array($par_arr)) {
700 foreach ($par_arr as $par => $val) {
701 $this->setParameter($par, $val);
702 }
703 }
704 }
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 491 of file class.ilMediaItem.php.

492 {
493 $this->purpose = $a_purpose;
494 }

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 125 of file class.ilMediaItem.php.

126 {
127 $this->text_representation = $a_val;
128 }

Referenced by read().

+ Here is the caller graph for this function:

◆ setThumbTried()

ilMediaItem::setThumbTried (   $a_tried)

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

532 {
533 $this->tried_thumb = $a_tried;
534 }

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 145 of file class.ilMediaItem.php.

146 {
147 $this->upload_hash = $a_val;
148 }

Referenced by read().

+ Here is the caller graph for this function:

◆ setWidth()

ilMediaItem::setWidth (   $a_width)

set width

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

592 {
593 $this->width = $a_width;
594 }

Referenced by read().

+ Here is the caller graph for this function:

◆ update()

ilMediaItem::update ( )

update media item data (without map areas!)

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

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

References $db, $ilDB, $name, $query, getCaption(), 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 255 of file class.ilMediaItem.php.

256 {
258
259 $query = "INSERT INTO mob_parameter (med_item_id, name, value) VALUES " .
260 "(" . $ilDB->quote($this->getId(), "integer") . "," .
261 $ilDB->quote($a_name, "text") . "," .
262 $ilDB->quote($a_value, "text") . ")";
263 $ilDB->manipulate($query);
264 }

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 324 of file class.ilMediaItem.php.

325 {
327
328 $q = "UPDATE media_item SET tried_thumb = " .
329 $ilDB->quote($a_tried, "text") .
330 " WHERE id = " . $ilDB->quote($this->getId(), "integer");
331
332 $ilDB->manipulate($q);
333 }

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 35 of file class.ilMediaItem.php.

Referenced by getCaption().

◆ $color1

ilMediaItem::$color1

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

Referenced by makeMapWorkCopy().

◆ $color2

ilMediaItem::$color2

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

Referenced by makeMapWorkCopy().

◆ $db

ilMediaItem::$db
protected

◆ $format

ilMediaItem::$format

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

Referenced by getFormat(), and getThumbnailTarget().

◆ $halign

ilMediaItem::$halign

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

Referenced by getHAlign().

◆ $height

ilMediaItem::$height

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

Referenced by getHeight().

◆ $id

ilMediaItem::$id

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

Referenced by getId().

◆ $lng

ilMediaItem::$lng
protected

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

Referenced by copyOriginal(), and makeMapWorkCopy().

◆ $location

ilMediaItem::$location

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

Referenced by getLocation().

◆ $location_type

ilMediaItem::$location_type

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

Referenced by getLocationType().

◆ $map_cnt

ilMediaItem::$map_cnt

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

Referenced by addMapArea(), and deleteMapArea().

◆ $map_image

ilMediaItem::$map_image

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

Referenced by getMapWorkImage().

◆ $mapareas

ilMediaItem::$mapareas

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

Referenced by getMapAreas().

◆ $mob_id

ilMediaItem::$mob_id

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

Referenced by getMobId(), and read().

◆ $nr

ilMediaItem::$nr

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

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

◆ $parameters

ilMediaItem::$parameters

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

Referenced by getParameters().

◆ $purpose

ilMediaItem::$purpose

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

Referenced by getPurpose().

◆ $upload_hash

ilMediaItem::$upload_hash
protected

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

Referenced by getUploadHash().

◆ $width

ilMediaItem::$width

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

Referenced by getWidth().


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