ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
ilMediaItem Class Reference

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

+ Collaboration diagram for ilMediaItem:

Public Member Functions

 __construct (int $a_id=0)
 
 setId (int $a_id)
 set media item id More...
 
 getId ()
 
 setMobId (int $a_mob_id)
 set id of parent media object More...
 
 getMobId ()
 
 setNr (int $a_nr)
 set number of media item within media object More...
 
 getNr ()
 
 setDuration (int $a_val)
 
 getDuration ()
 
 setTextRepresentation (string $a_val)
 
 getTextRepresentation ()
 
 setUploadHash (string $a_val)
 
 getUploadHash ()
 
 create ()
 
 update ()
 
 writeParameter (string $a_name, string $a_value)
 
 read ()
 read media item data (item id or (mob_id and nr) must be set) More...
 
 writeThumbTried (string $a_tried)
 write thumbnail creation try data ("y"/"n") More...
 
 setPurpose (string $a_purpose)
 
 getPurpose ()
 
 setLocation (string $a_location)
 
 getLocation ()
 
 setLocationType (string $a_type)
 
 getLocationType ()
 
 setFormat (string $a_format)
 
 getFormat ()
 
 setThumbTried (string $a_tried)
 
 getThumbTried ()
 
 addMapArea (ilMapArea $a_map_area)
 
 deleteMapArea (int $nr)
 
 getMapArea (int $nr)
 
 getMapAreas ()
 
 getWidth ()
 
 setWidth (string $a_width)
 
 getHeight ()
 
 setHeight (string $a_height)
 
 getOriginalSize ()
 
 setCaption (string $a_caption)
 
 getCaption ()
 
 setHAlign (string $a_halign)
 set horizontal align More...
 
 getHAlign ()
 
 setParameter (string $a_name, string $a_value)
 
 resetParameters ()
 
 setParameters (string $a_par)
 set all parameters via parameter string (format: par1="value1", par2="value2", ...) More...
 
 getParameters ()
 
 getParameterString ()
 
 getParameter (string $a_name)
 
 getSuffix ()
 get location suffix More...
 
 getMapWorkCopyType ()
 get image type of image map work copy More...
 
 getDirectory ()
 get media file directory More...
 
 getOriginalSource ()
 
 makeMapWorkCopy (int $a_area_nr=0, bool $a_exclude=false)
 make map work copy of image More...
 
 addAreaToMapWorkCopy (string $a_shape, string $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...
 
 outputWorkImage ()
 
 getMapWorkImage ()
 
 getMapAreasXML (bool $a_insert_inst=false, int $a_inst=0)
 get xml code of media items' areas More...
 
 extractUrlParameters ()
 Extract parameters of special external references to parameter array. More...
 
 determineDuration ()
 
 getLocationSrc (bool $autoplay=false)
 
 getLocationStream ()
 

Static Public Member Functions

static _lookupLocationForMobId (int $a_mob_id, string $a_purpose)
 
static _lookupMobId (int $a_med_id)
 
static _getMediaItemsOfMObId (int $a_mobId, string $a_purpose)
 read media item with specific purpose and mobId More...
 
static _getMediaItemsOfMOb (ilObjMediaObject $a_mob)
 Read media items into(!) media object (static) More...
 
static deleteAllItemsOfMob (int $a_mob_id)
 
static checkParameter (string $a_par, string $a_val)
 Check parameter (filter javascript related and other unsafe parameters/values) More...
 
static _resolveMapAreaLinks (int $a_mob_id)
 resolve internal links of all media items of a media object More...
 
static _getMapAreasIntLinks (int $a_mob_id)
 get all internal links of map areas of a mob More...
 
static getMediaItemsForUploadHash (string $a_hash)
 Get media items for upload hash. More...
 

Data Fields

int $id = 0
 
string $purpose = ""
 
string $location = ""
 
string $location_type = ""
 
string $format = ""
 
string $width = ""
 
string $height = ""
 
string $caption = ""
 
string $halign = ""
 
array $parameters = []
 
int $mob_id = 0
 
int $nr = 0
 
array $mapareas = []
 
int $map_cnt = 0
 
 $map_image = null
 
int $color1
 
int $color2
 

Protected Attributes

ILIAS MediaObjects MediaObjectManager $mob_manager
 
string $tried_thumb = ""
 
string $text_representation = ""
 
ilDBInterface $db
 
ilLanguage $lng
 
ILIAS Filesystem Util Convert LegacyImages $image_converter
 
int $duration = 0
 
string $upload_hash = ''
 

Static Private Member Functions

static getGDSupportedImageType (string $a_desired_type)
 returns the best supported image type by this PHP build More...
 

Detailed Description

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

Author
Alexander Killing killi.nosp@m.ng@l.nosp@m.eifos.nosp@m..de

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

Constructor & Destructor Documentation

◆ __construct()

ilMediaItem::__construct ( int  $a_id = 0)

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

60 {
61 global $DIC;
62
63 $this->db = $DIC->database();
64 $this->lng = $DIC->language();
65 $this->image_converter = $DIC->fileConverters()->legacyImages();
66 $this->parameters = array();
67 $this->mapareas = array();
68 $this->map_cnt = 0;
69
70 if ($a_id != 0) {
71 $this->setId($a_id);
72 $this->read();
73 }
74 $this->mob_manager = $DIC->mediaObjects()->internal()->domain()->mediaObject();
75 }
read()
read media item data (item id or (mob_id and nr) must be set)
setId(int $a_id)
set media item id
global $DIC
Definition: shib_login.php:26

References $DIC, ILIAS\Repository\lng(), ILIAS\UI\examples\Prompt\Standard\parameters(), read(), and setId().

+ Here is the call graph for this function:

Member Function Documentation

◆ _getMapAreasIntLinks()

static ilMediaItem::_getMapAreasIntLinks ( int  $a_mob_id)
static

get all internal links of map areas of a mob

Parameters
int$a_mob_idmedia object id

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

993 : array {
994 global $DIC;
995
996 $ilDB = $DIC->database();
997
998 // read media_items records
999 $query = "SELECT * FROM media_item WHERE mob_id = " .
1000 $ilDB->quote($a_mob_id, "integer") . " ORDER BY nr";
1001
1002 $item_set = $ilDB->query($query);
1003 $links = array();
1004 while ($item_rec = $ilDB->fetchAssoc($item_set)) {
1005 $map_links = ilMapArea::_getIntLinks($item_rec["id"]);
1006 foreach ($map_links as $key => $map_link) {
1007 $links[$key] = $map_link;
1008 }
1009 }
1010 return $links;
1011 }
static _getIntLinks(int $a_item_id)
get all internal links of a media items map areas

Referenced by ilPageObjectGUI\displayMedia(), ILIAS\COPage\Link\LinkManager\getDefaultMediaCollector(), ilLMPresentationGUI\ilMedia(), and ilGlossaryPresentationGUI\media().

+ Here is the caller graph for this function:

◆ _getMediaItemsOfMOb()

static ilMediaItem::_getMediaItemsOfMOb ( ilObjMediaObject  $a_mob)
static

Read media items into(!) media object (static)

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

439 : void {
440 global $DIC;
441
442 $ilDB = $DIC->database();
443
444 // read media_object record
445 $query = "SELECT * FROM media_item WHERE mob_id = " .
446 $ilDB->quote($a_mob->getId(), "integer") . " " .
447 "ORDER BY nr";
448 $item_set = $ilDB->query($query);
449 while ($item_rec = $ilDB->fetchAssoc($item_set)) {
450 $media_item = new ilMediaItem();
451 $media_item->setNr((int) $item_rec["nr"]);
452 $media_item->setId((int) $item_rec["id"]);
453 $media_item->setLocation((string) $item_rec["location"]);
454 $media_item->setLocationType((string) $item_rec["location_type"]);
455 $media_item->setFormat((string) $item_rec["format"]);
456 $media_item->setWidth((string) $item_rec["width"]);
457 $media_item->setHeight((string) $item_rec["height"]);
458 $media_item->setHAlign((string) $item_rec["halign"]);
459 $media_item->setCaption((string) $item_rec["caption"]);
460 $media_item->setPurpose((string) $item_rec["purpose"]);
461 $media_item->setMobId((int) $item_rec["mob_id"]);
462 $media_item->setThumbTried((string) $item_rec["tried_thumb"]);
463 $media_item->setTextRepresentation((string) $item_rec["text_representation"]);
464 $media_item->setUploadHash((string) $item_rec["upload_hash"]);
465 $media_item->setDuration((int) $item_rec["duration"]);
466
467 // get item parameter
468 $query = "SELECT * FROM mob_parameter WHERE med_item_id = " .
469 $ilDB->quote($item_rec["id"], "integer");
470 $par_set = $ilDB->query($query);
471 while ($par_rec = $ilDB->fetchAssoc($par_set)) {
472 $media_item->setParameter($par_rec["name"], $par_rec["value"]);
473 }
474
475 // get item map areas
476 $max = ilMapArea::_getMaxNr($media_item->getId());
477 for ($i = 1; $i <= $max; $i++) {
478 $area = new ilMapArea($media_item->getId(), $i);
479 $media_item->addMapArea($area);
480 }
481
482 // add media item to media object
483 $a_mob->addMediaItem($media_item);
484 }
485 }
Class ilMapArea.
static _getMaxNr(int $a_item_id)
get maximum nr of media item (static)
Class ilMediaItem Media Item, component of a media object (file or reference)
addMediaItem(ilMediaItem $a_item)

References $ilDB, ilMapArea\_getMaxNr(), and ilObjMediaObject\addMediaItem().

Referenced by ilObjMediaObject\read().

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

◆ _getMediaItemsOfMObId()

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

read media item with specific purpose and mobId

Parameters
int$a_mobId
string$a_purpose
Returns
?ilMediaItem[]

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

417 : ?array {
418 global $DIC;
419
420 $ilDB = $DIC->database();
421
422 // read media_object record
423 $query = "SELECT * FROM media_item WHERE mob_id = " .
424 $ilDB->quote($a_mobId, "integer") . " " .
425 "AND purpose=" . $ilDB->quote($a_purpose, "text") . " ORDER BY nr";
426 $item_set = $ilDB->query($query);
427
428 while ($item_rec = $ilDB->fetchAssoc($item_set)) {
429 return $item_rec;
430 }
431 return null;
432 }

Referenced by ilObjectFeedWriter\__construct().

+ Here is the caller graph for this function:

◆ _lookupLocationForMobId()

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

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

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

◆ _lookupMobId()

static ilMediaItem::_lookupMobId ( int  $a_med_id)
static

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

392 : int {
393 global $DIC;
394
395 $ilDB = $DIC->database();
396
397 // read media_object record
398 $query = "SELECT * FROM media_item WHERE id = " .
399 $ilDB->quote($a_med_id, "integer");
400 $set = $ilDB->query($query);
401 if ($rec = $ilDB->fetchAssoc($set)) {
402 return (int) $rec["mob_id"];
403 }
404
405 return 0;
406 }

◆ _resolveMapAreaLinks()

static ilMediaItem::_resolveMapAreaLinks ( int  $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 969 of file class.ilMediaItem.php.

971 : void {
972 global $DIC;
973
974 $ilDB = $DIC->database();
975
976 //echo "mediaItems::resolve<br>";
977 // read media_object record
978 $query = "SELECT * FROM media_item WHERE mob_id = " .
979 $ilDB->quote($a_mob_id, "integer") . " " .
980 "ORDER BY nr";
981 $item_set = $ilDB->query($query);
982 while ($item_rec = $ilDB->fetchAssoc($item_set)) {
983 ilMapArea::_resolveIntLinks($item_rec["id"]);
984 }
985 }
static _resolveIntLinks(int $a_item_id)
resolve internal links of an item id

References ilMapArea\_resolveIntLinks().

Referenced by ilQuestionPageParser\processPagesToParse().

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

◆ addAreaToMapWorkCopy()

ilMediaItem::addAreaToMapWorkCopy ( string  $a_shape,
string  $a_coords 
)

draw a new area in work image

Parameters
string$a_shapeshape
string$a_coordscoordinates string

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

811 : void {
812 // $this->buildMapWorkImage();
813
814 // determine ratios
815 $size = getimagesize($this->getOriginalSource());
816 $x_ratio = 1;
817 if ($size[0] > 0 && $this->getWidth() > 0) {
818 $x_ratio = $this->getWidth() / $size[0];
819 }
820 $y_ratio = 1;
821 if ($size[1] > 0 && $this->getHeight() > 0) {
822 $y_ratio = $this->getHeight() / $size[1];
823 }
824
825 // add new area to work image
826 $area = new ilMapArea();
827 $area->setShape($a_shape);
828 $area->setCoords($a_coords);
829 $area->draw(
830 $this->getMapWorkImage(),
831 $this->color1,
832 $this->color2,
833 false,
834 $x_ratio,
835 $y_ratio
836 );
837 }

◆ addMapArea()

ilMediaItem::addMapArea ( ilMapArea  $a_map_area)

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

565 : void
566 {
567 $this->mapareas[$this->map_cnt] = $a_map_area;
568 $this->map_cnt++;
569 }

◆ buildMapWorkImage()

ilMediaItem::buildMapWorkImage ( )

build image map work image

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

856 : void
857 {
858 $im_type = strtolower($this->getMapWorkCopyType());
859
860 switch ($im_type) {
861 case "gif":
862 $this->map_image = imagecreatefromgif($this->getOriginalSource());
863 break;
864
865 case "jpg":
866 case "jpeg":
867 $this->map_image = imagecreatefromjpeg($this->getOriginalSource());
868 break;
869
870 case "png":
871 $this->map_image = imagecreatefrompng($this->getOriginalSource());
872 break;
873 }
874
875 // try to allocate black and white as color. if this is not possible, get the closest colors
876 if (imagecolorstotal($this->map_image) > 250) {
877 $this->color1 = imagecolorclosest($this->map_image, 0, 0, 0);
878 $this->color2 = imagecolorclosest($this->map_image, 255, 255, 255);
879 } else {
880 $this->color1 = imagecolorallocate($this->map_image, 0, 0, 0);
881 $this->color2 = imagecolorallocate($this->map_image, 255, 255, 255);
882 }
883 }
getMapWorkCopyType()
get image type of image map work copy

◆ checkParameter()

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

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

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

685 : bool {
686 // do not allow event attributes
687 if (substr(strtolower(trim($a_par)), 0, 2) == "on") {
688 return false;
689 }
690 // no javascript in value
691 if (is_int(strpos(strtolower($a_val), "javascript"))) {
692 return false;
693 }
694 // do not allow to change the src attribute
695 if (strtolower(trim($a_par)) == "src") {
696 return false;
697 }
698
699 return true;
700 }

Referenced by ilMediaAliasItem\setParameters().

+ Here is the caller graph for this function:

◆ create()

ilMediaItem::create ( )

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

202 : void
203 {
205
206 $item_id = $ilDB->nextId("media_item");
207 $query = "INSERT INTO media_item (id,mob_id, purpose, location, " .
208 "location_type, format, width, " .
209 "height, halign, caption, nr, text_representation, upload_hash, duration) VALUES " .
210 "(" .
211 $ilDB->quote($item_id, "integer") . "," .
212 $ilDB->quote($this->getMobId(), "integer") . "," .
213 $ilDB->quote($this->getPurpose(), "text") . "," .
214 $ilDB->quote($this->getLocation(), "text") . "," .
215 $ilDB->quote($this->getLocationType(), "text") . "," .
216 $ilDB->quote($this->getFormat(), "text") . "," .
217 $ilDB->quote($this->getWidth(), "text") . "," .
218 $ilDB->quote($this->getHeight(), "text") . "," .
219 $ilDB->quote($this->getHAlign(), "text") . "," .
220 $ilDB->quote($this->getCaption(), "text") . "," .
221 $ilDB->quote($this->getNr(), "integer") . "," .
222 $ilDB->quote($this->getTextRepresentation(), "text") . "," .
223 $ilDB->quote($this->getUploadHash(), "text") . "," .
224 $ilDB->quote($this->getDuration(), "integer") .
225 ")";
226 $ilDB->manipulate($query);
227
228 $this->setId($item_id);
229
230 // create mob parameters
231 $params = $this->getParameters();
232 foreach ($params as $name => $value) {
233 $query = "INSERT INTO mob_parameter (med_item_id, name, value) VALUES " .
234 "(" . $ilDB->quote($item_id, "integer") . "," .
235 $ilDB->quote($name, "text") . "," .
236 $ilDB->quote($value, "text") . ")";
237 $ilDB->manipulate($query);
238 }
239
240 // create map areas
241 for ($i = 0; $i < count($this->mapareas); $i++) {
242 if (is_object($this->mapareas[$i])) {
243 $this->mapareas[$i]->setItemId($this->getId());
244 $this->mapareas[$i]->setNr($i + 1);
245 $this->mapareas[$i]->create();
246 }
247 }
248 }
ilDBInterface $db
if(! $DIC->user() ->getId()||!ilLTIConsumerAccess::hasCustomProviderCreationAccess()) $params
Definition: ltiregstart.php:31

References $db, $ilDB, $params, 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:

◆ deleteAllItemsOfMob()

static ilMediaItem::deleteAllItemsOfMob ( int  $a_mob_id)
static

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

487 : void
488 {
489 global $DIC;
490
491 $ilDB = $DIC->database();
492
493 // iterate all media items ob mob
494 $query = "SELECT * FROM media_item WHERE mob_id = " .
495 $ilDB->quote($a_mob_id, "integer");
496 $item_set = $ilDB->query($query);
497 while ($item_rec = $ilDB->fetchAssoc($item_set)) {
498 // delete all parameters of media item
499 $query = "DELETE FROM mob_parameter WHERE med_item_id = " .
500 $ilDB->quote($item_rec["id"], "integer");
501 $ilDB->manipulate($query);
502
503 // delete all map areas of media item
504 $query = "DELETE FROM map_area WHERE item_id = " .
505 $ilDB->quote($item_rec["id"], "integer");
506 $ilDB->manipulate($query);
507 }
508
509 // delete media items
510 $query = "DELETE FROM media_item WHERE mob_id = " .
511 $ilDB->quote($a_mob_id, "integer");
512 $ilDB->manipulate($query);
513 }

References $DIC, and $ilDB.

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

+ Here is the caller graph for this function:

◆ deleteMapArea()

ilMediaItem::deleteMapArea ( int  $nr)

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

571 : void
572 {
573 for ($i = 1; $i <= $this->map_cnt; $i++) {
574 if ($i > $nr) {
575 $this->mapareas[$i - 2] = $this->mapareas[$i - 1];
576 $this->mapareas[$i - 2]->setNr($i - 1);
577 }
578 }
579 if ($nr <= $this->map_cnt) {
580 unset($this->mapareas[$this->map_cnt - 1]);
581 $this->map_cnt--;
582 }
583 }

◆ determineDuration()

ilMediaItem::determineDuration ( )

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

1027 : void
1028 {
1029 $ana = new ilMediaAnalyzer();
1030
1034 if ($meta["duration"] > 0) {
1035 $this->setDuration((int) $meta["duration"]);
1036 }
1037 } else {
1038 $file = $this->getLocationSrc();
1039
1040 try {
1041 if (str_starts_with($file, 'http')) {
1042 $mob_logger = ilLoggerFactory::getLogger('mob');
1043
1044 try {
1045 $tmpdir = ilFileUtils::ilTempnam();
1046 ilFileUtils::makeDir($tmpdir);
1047 $localtempfilename = tempnam($tmpdir, 'getID3');
1048 $fp_local = fopen($localtempfilename, 'wb');
1049
1050 $mob_logger->debug('Determining duration of file: {file}', [
1051 'file' => $file,
1052 ]);
1053
1054 $curl = new ilCurlConnection($file);
1055 $curl->init(true);
1056 $curl->setOpt(CURLOPT_VERBOSE, true);
1057 $curl->setOpt(CURLOPT_FILE, $fp_local);
1058 $curl->setOpt(CURLOPT_FOLLOWLOCATION, true);
1059 $curl->setOpt(CURLOPT_TIMEOUT_MS, 600000);
1060 $curl->setOpt(CURLOPT_TIMEOUT, 600);
1061 $curl->setOpt(CURLOPT_FAILONERROR, true);
1062 $curl->setOpt(CURLOPT_SSL_VERIFYPEER, 1);
1063 $curl->setOpt(CURLOPT_SSL_VERIFYHOST, 2);
1064
1065 $success = $curl->exec();
1066 $info = $curl->getInfo();
1067
1068 $mob_logger->debug('cURL Info: {info}', [
1069 'info' => print_r($info, true)
1070 ]);
1071
1072 if ($success) {
1073 $mob_logger->debug('Successfully downloaded remote file: {file}', [
1074 'file' => $file,
1075 ]);
1076
1077 $file = $localtempfilename;
1078 } else {
1079 $mob_logger->error('Could not fetch file: {file}', [
1080 'file' => $file,
1081 ]);
1082 }
1083 } catch (Exception $e) {
1084 $mob_logger->error('Could not determine duration: {message}', [
1085 'message' => $e->getMessage(),
1086 ]);
1087 $mob_logger->error($e->getTraceAsString());
1088 }
1089 }
1090
1091 $ana->setFile($file);
1092 $ana->analyzeFile();
1093 $this->setDuration($ana->getPlaytimeSeconds());
1094 } catch (Exception) {
1095 }
1096 }
1097 }
static isVimeo(string $a_location)
Identify Vimeo links.
static extractVimeoParameters(string $a_location)
Extract Vimeo Parameter.
static makeDir(string $a_dir)
creates a new directory and inherits all filesystem permissions of the parent directory You may pass ...
static ilTempnam(?string $a_temp_path=null)
Returns a unique and non existing Path for e temporary file or directory.
static getLogger(string $a_component_id)
Get component logger.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
setDuration(int $a_val)
getLocationSrc(bool $autoplay=false)
$info
Definition: entry_point.php:21

References Vendor\Package\$e, $info, ilExternalMediaAnalyzer\extractVimeoParameters(), ilLoggerFactory\getLogger(), ilExternalMediaAnalyzer\getVimeoMetadata(), ilFileUtils\ilTempnam(), ilExternalMediaAnalyzer\isVimeo(), and ilFileUtils\makeDir().

Referenced by ilObjMediaCastGUI\getDuration().

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

◆ extractUrlParameters()

ilMediaItem::extractUrlParameters ( )

Extract parameters of special external references to parameter array.

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

1016 : void
1017 {
1019 $this->getLocation(),
1020 $this->getParameters()
1021 );
1022 foreach ($par as $k => $v) {
1023 $this->setParameter($k, $v);
1024 }
1025 }
static extractUrlParameters(string $a_location, array $a_parameter)
Extract URL information to parameter array.
setParameter(string $a_name, string $a_value)

References ilExternalMediaAnalyzer\extractUrlParameters().

+ Here is the call graph for this function:

◆ getCaption()

ilMediaItem::getCaption ( )

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

633 : string
634 {
635 return $this->caption;
636 }

Referenced by create(), and update().

+ Here is the caller graph for this function:

◆ getDirectory()

ilMediaItem::getDirectory ( )

get media file directory

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

745 : string
746 {
748 }
static _getDirectory(int $a_mob_id)
Get absolute directory.

References ilObjMediaObject\_getDirectory().

+ Here is the call graph for this function:

◆ getDuration()

ilMediaItem::getDuration ( )

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

177 : int
178 {
179 return $this->duration;
180 }

References $duration.

Referenced by create(), ilObjMediaCastGUI\getDuration(), and update().

+ Here is the caller graph for this function:

◆ getFormat()

ilMediaItem::getFormat ( )

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

550 : string
551 {
552 return $this->format;
553 }

Referenced by create(), and update().

+ Here is the caller graph for this function:

◆ getGDSupportedImageType()

static ilMediaItem::getGDSupportedImageType ( string  $a_desired_type)
staticprivate

returns the best supported image type by this PHP build

Parameters
string$a_desired_type
Returns
string supported image type ("jpg" | "gif" | "png" | "")

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

123 : string
124 {
125 $a_desired_type = strtolower($a_desired_type);
126 // get supported Image Types
127 $im_types = ImageTypes();
128
129 switch ($a_desired_type) {
130 case "jpg":
131 case "jpeg":
132 if ($im_types & IMG_JPG) {
133 return "jpg";
134 }
135 if ($im_types & IMG_GIF) {
136 return "gif";
137 }
138 if ($im_types & IMG_PNG) {
139 return "png";
140 }
141 break;
142
143 case "gif":
144 if ($im_types & IMG_GIF) {
145 return "gif";
146 }
147 if ($im_types & IMG_JPG) {
148 return "jpg";
149 }
150 if ($im_types & IMG_PNG) {
151 return "png";
152 }
153 break;
154
155 case "svg":
156 case "png":
157 if ($im_types & IMG_PNG) {
158 return "png";
159 }
160 if ($im_types & IMG_JPG) {
161 return "jpg";
162 }
163 if ($im_types & IMG_GIF) {
164 return "gif";
165 }
166 break;
167 }
168
169 return "";
170 }

◆ getHAlign()

ilMediaItem::getHAlign ( )

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

646 : string
647 {
648 return $this->halign;
649 }

Referenced by create(), and update().

+ Here is the caller graph for this function:

◆ getHeight()

ilMediaItem::getHeight ( )

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

605 : string
606 {
607 return $this->height;
608 }

Referenced by create(), and update().

+ Here is the caller graph for this function:

◆ getId()

ilMediaItem::getId ( )

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

85 : int
86 {
87 return $this->id;
88 }

References $id.

Referenced by create(), and update().

+ Here is the caller graph for this function:

◆ getLocation()

ilMediaItem::getLocation ( )

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

530 : string
531 {
532 return $this->location;
533 }

References $location.

Referenced by create(), and update().

+ Here is the caller graph for this function:

◆ getLocationSrc()

ilMediaItem::getLocationSrc ( bool  $autoplay = false)

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

1099 : string
1100 {
1101 if (strcasecmp("Reference", $this->getLocationType()) === 0) {
1102 $src = $this->getLocation();
1103 if ($this->getFormat() === "video/vimeo") {
1104 $params = "";
1105 if ($autoplay) {
1106 $params = "&autoplay=1&muted=1";
1107 }
1109 $src = "//player.vimeo.com/video/" . $par["id"] . "?api=1" . $params;
1110 }
1111 if ($this->getFormat() === "video/youtube") {
1112 $params = "";
1113 if ($autoplay) {
1114 $params = "&autoplay=1&muted=1";
1115 }
1117 $src = "//www.youtube.com/embed/" . $par["v"] . "?enablejsapi=1" . $params;
1118 }
1119 } else {
1120 $src = $this->mob_manager->getLocalSrc(
1121 $this->getMobId(),
1122 $this->getLocation()
1123 );
1124 }
1125 return $src;
1126 }
static extractYouTubeParameters(string $a_location)
Extract YouTube Parameter.

References $params, ilExternalMediaAnalyzer\extractVimeoParameters(), and ilExternalMediaAnalyzer\extractYouTubeParameters().

+ Here is the call graph for this function:

◆ getLocationStream()

ilMediaItem::getLocationStream ( )

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

1128 : ZIPStream
1129 {
1130 return $this->mob_manager->getLocationStream(
1131 $this->getMobId(),
1132 $this->getLocation()
1133 );
1134 }

◆ getLocationType()

ilMediaItem::getLocationType ( )

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

540 : string
541 {
543 }

Referenced by create(), and update().

+ Here is the caller graph for this function:

◆ getMapArea()

ilMediaItem::getMapArea ( int  $nr)

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

585 : ?ilMapArea
586 {
587 return $this->mapareas[$nr - 1] ?? null;
588 }

◆ getMapAreas()

ilMediaItem::getMapAreas ( )

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

590 : array
591 {
592 return $this->mapareas;
593 }

◆ getMapAreasXML()

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

get xml code of media items' areas

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

920 : string {
921 $xml = "";
922
923 // build xml of map areas
924 for ($i = 0; $i < count($this->mapareas); $i++) {
925 $area = $this->mapareas[$i];
926
927 // highlight mode
928 $hm = "";
929 if ($area->getHighlightMode() != "") {
930 $hm = ' HighlightMode="' . $area->getHighlightMode() . '" ';
931 $hcl = ($area->getHighlightClass() != "")
932 ? $area->getHighlightClass()
933 : "Accented";
934 $hm .= 'HighlightClass="' . $hcl . '" ';
935 }
936
937 $xml .= "<MapArea Shape=\"" . $area->getShape() . "\" Coords=\"" . $area->getCoords() . "\" " . $hm . ">";
938 if ($area->getLinkType() == IL_INT_LINK) {
939 $target_frame = $area->getTargetFrame();
940
941 if ($area->getType() == "GlossaryItem" && $target_frame == "") {
942 $target_frame = "Glossary";
943 }
944
945 $tf_str = ($target_frame == "")
946 ? ""
947 : "TargetFrame=\"" . $target_frame . "\"";
948
949 $xml .= "<IntLink Target=\"" . $area->getTarget($a_insert_inst, $a_inst) . "\" Type=\"" .
950 $area->getType() . "\" $tf_str>";
951 // see bug 17893 and http://stackoverflow.com/questions/4026502/xml-error-at-ampersand
952 $xml .= htmlspecialchars($area->getTitle(), ENT_QUOTES);
953 $xml .= "</IntLink>";
954 } else {
955 $xml .= "<ExtLink Href=\"" . str_replace("&", "&amp;", $area->getHref()) . "\" Title=\"" .
956 str_replace("&", "&amp;", $area->getExtTitle()) . "\">";
957 $xml .= str_replace("&", "&amp;", $area->getTitle());
958 $xml .= "</ExtLink>";
959 }
960 $xml .= "</MapArea>";
961 }
962 return $xml;
963 }
const IL_INT_LINK

◆ getMapWorkCopyType()

ilMediaItem::getMapWorkCopyType ( )

get image type of image map work copy

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

737 : string
738 {
740 }
getSuffix()
get location suffix
static getGDSupportedImageType(string $a_desired_type)
returns the best supported image type by this PHP build

◆ getMapWorkImage()

ilMediaItem::getMapWorkImage ( )
Returns
GdImage|resource|null

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

910 {
911 return $this->map_image;
912 }

◆ getMediaItemsForUploadHash()

static ilMediaItem::getMediaItemsForUploadHash ( string  $a_hash)
static

Get media items for upload hash.

Parameters
string$a_hashupload hash
Returns
array[]

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

1143 : array {
1144 global $DIC;
1145
1146 $db = $DIC->database();
1147
1148 $set = $db->queryF(
1149 "SELECT * FROM media_item " .
1150 " WHERE upload_hash = %s ",
1151 array("text"),
1152 array($a_hash)
1153 );
1154 $media_items = array();
1155 while ($rec = $db->fetchAssoc($set)) {
1156 $media_items[] = $rec;
1157 }
1158 return $media_items;
1159 }
fetchAssoc(ilDBStatement $statement)
queryF(string $query, array $types, array $values)

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

+ Here is the caller graph for this function:

◆ getMobId()

ilMediaItem::getMobId ( )

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

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

References $mob_id.

Referenced by create(), and update().

+ Here is the caller graph for this function:

◆ getNr()

ilMediaItem::getNr ( )

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

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

References $nr.

Referenced by create(), and update().

+ Here is the caller graph for this function:

◆ getOriginalSize()

ilMediaItem::getOriginalSize ( )

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

615 : ?array
616 {
617 if (ilUtil::deducibleSize($this->getFormat())) {
618 $loc = $this->getOriginalSource();
619 $size = ilMediaImageUtil::getImageSize($loc);
620 if ($size[0] > 0 && $size[1] > 0) {
621 return array("width" => $size[0], "height" => $size[1]);
622 }
623 }
624
625 return null;
626 }
static getImageSize(string $a_location)
Get image size from location.
static deducibleSize(string $a_mime)
checks if mime type is provided by getimagesize()

References ilUtil\deducibleSize(), and ilMediaImageUtil\getImageSize().

+ Here is the call graph for this function:

◆ getOriginalSource()

ilMediaItem::getOriginalSource ( )

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

751 : string
752 {
753 if ($this->getLocationType() !== "Reference") {
754 return $this->mob_manager->getLocalSrc(
755 $this->getMobId(),
756 $this->getLocation()
757 );
758 }
759 return $this->getLocation();
760 }

◆ getParameter()

ilMediaItem::getParameter ( string  $a_name)

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

719 : string
720 {
721 return (string) ($this->parameters[$a_name] ?? "");
722 }

References ILIAS\UI\examples\Prompt\Standard\parameters().

+ Here is the call graph for this function:

◆ getParameters()

ilMediaItem::getParameters ( )

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

702 : array
703 {
704 return $this->parameters;
705 }

Referenced by create(), and update().

+ Here is the caller graph for this function:

◆ getParameterString()

ilMediaItem::getParameterString ( )

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

707 : string
708 {
709 if (is_array($this->parameters)) {
710 $target_arr = [];
711 foreach ($this->parameters as $par => $val) {
712 $target_arr[] = "$par=\"$val\"";
713 }
714 return implode(", ", $target_arr);
715 }
716 return "";
717 }

References ILIAS\UI\examples\Prompt\Standard\parameters().

+ Here is the call graph for this function:

◆ getPurpose()

ilMediaItem::getPurpose ( )

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

520 : string
521 {
522 return $this->purpose;
523 }

Referenced by create(), and update().

+ Here is the caller graph for this function:

◆ getSuffix()

ilMediaItem::getSuffix ( )

get location suffix

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

727 : string
728 {
729 $loc_arr = explode(".", $this->getLocation());
730
731 return $loc_arr[count($loc_arr) - 1];
732 }

◆ getTextRepresentation()

ilMediaItem::getTextRepresentation ( )

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

187 : string
188 {
190 }
string $text_representation

References $text_representation.

Referenced by create(), and update().

+ Here is the caller graph for this function:

◆ getThumbTried()

ilMediaItem::getThumbTried ( )

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

560 : string
561 {
562 return $this->tried_thumb;
563 }

◆ getUploadHash()

ilMediaItem::getUploadHash ( )

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

197 : string
198 {
199 return $this->upload_hash;
200 }

References $upload_hash.

Referenced by create(), and update().

+ Here is the caller graph for this function:

◆ getWidth()

ilMediaItem::getWidth ( )

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

595 : string
596 {
597 return $this->width;
598 }

Referenced by create(), and update().

+ Here is the caller graph for this function:

◆ makeMapWorkCopy()

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

make map work copy of image

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

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

770 : void {
771 $this->buildMapWorkImage();
772
773 // determine ratios
774 $size = getimagesize($this->getOriginalSource());
775 $x_ratio = 1;
776 if ($size[0] > 0 && $this->getWidth() > 0) {
777 $x_ratio = $this->getWidth() / $size[0];
778 }
779 $y_ratio = 1;
780 if ($size[1] > 0 && $this->getHeight() > 0) {
781 $y_ratio = $this->getHeight() / $size[1];
782 }
783
784 // draw map areas
785 for ($i = 0; $i < count($this->mapareas); $i++) {
786 if (((($i + 1) == $a_area_nr) && !$a_exclude) ||
787 ((($i + 1) != $a_area_nr) && $a_exclude) ||
788 ($a_area_nr == 0)
789 ) {
790 $area = $this->mapareas[$i];
791 $area->draw(
792 $this->getMapWorkImage(),
795 true,
796 $x_ratio,
797 $y_ratio
798 );
799 }
800 }
801 }
buildMapWorkImage()
build image map work image

Referenced by ilImageMapEditorGUI\makeMapWorkCopy().

+ Here is the caller graph for this function:

◆ outputMapWorkCopy()

ilMediaItem::outputMapWorkCopy ( )

output raw map work copy file

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

842 : void
843 {
844 if ($this->getMapWorkCopyType() != "") {
845 header("Pragma: no-cache");
846 header("Expires: 0");
847 header("Content-type: image/" . strtolower($this->getMapWorkCopyType()));
848 $this->outputWorkImage();
849 }
850 exit;
851 }
exit

References exit, and ILIAS\UI\examples\Symbol\Glyph\Header\header().

+ Here is the call graph for this function:

◆ outputWorkImage()

ilMediaItem::outputWorkImage ( )

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

885 : void
886 {
887 $im_type = strtolower($this->getMapWorkCopyType());
888
889 // save image work-copy and free memory
890 switch ($im_type) {
891 case "gif":
892 imagegif($this->map_image);
893 break;
894
895 case "jpg":
896 case "jpeg":
897 imagejpeg($this->map_image);
898 break;
899
900 case "png":
901 imagepng($this->map_image);
902 break;
903 }
904 }

◆ read()

ilMediaItem::read ( )

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

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

303 : void
304 {
306
307 $item_id = $this->getId();
308 $mob_id = $this->getMobId();
309 $nr = $this->getNr();
310 $query = "";
311 if ($item_id > 0) {
312 $query = "SELECT * FROM media_item WHERE id = " .
313 $ilDB->quote($this->getId(), "integer");
314 } elseif ($mob_id > 0 && $nr > 0) {
315 $query = "SELECT * FROM media_item WHERE mob_id = " .
316 $ilDB->quote($this->getMobId(), "integer") . " " .
317 "AND nr=" . $ilDB->quote($this->getNr(), "integer");
318 }
319 if ($query != "") {
320 $item_set = $ilDB->query($query);
321 $item_rec = $ilDB->fetchAssoc($item_set);
322
323 $this->setLocation((string) $item_rec["location"]);
324 $this->setLocationType((string) $item_rec["location_type"]);
325 $this->setFormat((string) $item_rec["format"]);
326 $this->setWidth((string) $item_rec["width"]);
327 $this->setHeight((string) $item_rec["height"]);
328 $this->setHAlign((string) $item_rec["halign"]);
329 $this->setCaption((string) $item_rec["caption"]);
330 $this->setPurpose((string) $item_rec["purpose"]);
331 $this->setNr((int) $item_rec["nr"]);
332 $this->setMobId((int) $item_rec["mob_id"]);
333 $this->setId((int) $item_rec["id"]);
334 $this->setThumbTried((string) $item_rec["tried_thumb"]);
335 $this->setTextRepresentation((string) $item_rec["text_representation"]);
336 $this->setUploadHash((string) $item_rec["upload_hash"]);
337 $this->setDuration((int) $item_rec["duration"]);
338
339 // get item parameter
340 $query = "SELECT * FROM mob_parameter WHERE med_item_id = " .
341 $ilDB->quote($this->getId(), "integer");
342 $par_set = $ilDB->query($query);
343 while ($par_rec = $ilDB->fetchAssoc($par_set)) {
344 $this->setParameter($par_rec["name"], $par_rec["value"]);
345 }
346
347 // get item map areas
348 $max = ilMapArea::_getMaxNr($this->getId());
349 for ($i = 1; $i <= $max; $i++) {
350 $area = new ilMapArea($this->getId(), $i);
351 $this->addMapArea($area);
352 }
353 }
354 }
setLocationType(string $a_type)
setNr(int $a_nr)
set number of media item within media object
setUploadHash(string $a_val)
setWidth(string $a_width)
addMapArea(ilMapArea $a_map_area)
setThumbTried(string $a_tried)
setLocation(string $a_location)
setCaption(string $a_caption)
setHeight(string $a_height)
setTextRepresentation(string $a_val)
setFormat(string $a_format)
setHAlign(string $a_halign)
set horizontal align
setPurpose(string $a_purpose)
setMobId(int $a_mob_id)
set id of parent media object

References $ilDB, ilMapArea\_getMaxNr(), and ILIAS\Survey\Mode\getId().

Referenced by __construct().

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

◆ resetParameters()

ilMediaItem::resetParameters ( )

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

660 : void
661 {
662 $this->parameters = [];
663 }

References ILIAS\UI\examples\Prompt\Standard\parameters().

+ Here is the call graph for this function:

◆ setCaption()

ilMediaItem::setCaption ( string  $a_caption)

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

628 : void
629 {
630 $this->caption = $a_caption;
631 }

◆ setDuration()

ilMediaItem::setDuration ( int  $a_val)

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

172 : void
173 {
174 $this->duration = $a_val;
175 }

◆ setFormat()

ilMediaItem::setFormat ( string  $a_format)

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

545 : void
546 {
547 $this->format = $a_format;
548 }

◆ setHAlign()

ilMediaItem::setHAlign ( string  $a_halign)

set horizontal align

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

641 : void
642 {
643 $this->halign = $a_halign;
644 }

◆ setHeight()

ilMediaItem::setHeight ( string  $a_height)

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

610 : void
611 {
612 $this->height = $a_height;
613 }

◆ setId()

ilMediaItem::setId ( int  $a_id)

set media item id

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

80 : void
81 {
82 $this->id = $a_id;
83 }

Referenced by __construct(), and create().

+ Here is the caller graph for this function:

◆ setLocation()

ilMediaItem::setLocation ( string  $a_location)

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

525 : void
526 {
527 $this->location = $a_location;
528 }

◆ setLocationType()

ilMediaItem::setLocationType ( string  $a_type)

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

535 : void
536 {
537 $this->location_type = $a_type;
538 }

◆ setMobId()

ilMediaItem::setMobId ( int  $a_mob_id)

set id of parent media object

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

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

◆ setNr()

ilMediaItem::setNr ( int  $a_nr)

set number of media item within media object

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

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

◆ setParameter()

ilMediaItem::setParameter ( string  $a_name,
string  $a_value 
)

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

654 : void {
655 if (self::checkParameter($a_name, $a_value)) {
656 $this->parameters[$a_name] = $a_value;
657 }
658 }

References ILIAS\UI\examples\Prompt\Standard\parameters().

+ Here is the call graph for this function:

◆ setParameters()

ilMediaItem::setParameters ( string  $a_par)

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

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

668 : void
669 {
670 $this->resetParameters();
671 $par_arr = ilUtil::extractParameterString($a_par);
672 if (is_array($par_arr)) {
673 foreach ($par_arr as $par => $val) {
674 $this->setParameter($par, $val);
675 }
676 }
677 }
static extractParameterString(string $a_parstr)

References ilUtil\extractParameterString().

+ Here is the call graph for this function:

◆ setPurpose()

ilMediaItem::setPurpose ( string  $a_purpose)

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

515 : void
516 {
517 $this->purpose = $a_purpose;
518 }

◆ setTextRepresentation()

ilMediaItem::setTextRepresentation ( string  $a_val)

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

182 : void
183 {
184 $this->text_representation = $a_val;
185 }

◆ setThumbTried()

ilMediaItem::setThumbTried ( string  $a_tried)

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

555 : void
556 {
557 $this->tried_thumb = $a_tried;
558 }

◆ setUploadHash()

ilMediaItem::setUploadHash ( string  $a_val)

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

192 : void
193 {
194 $this->upload_hash = $a_val;
195 }

◆ setWidth()

ilMediaItem::setWidth ( string  $a_width)

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

600 : void
601 {
602 $this->width = $a_width;
603 }

◆ update()

ilMediaItem::update ( )

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

250 : void
251 {
253
254 $query = "UPDATE media_item SET " .
255 " mob_id = " . $ilDB->quote($this->getMobId(), "integer") . "," .
256 " purpose = " . $ilDB->quote($this->getPurpose(), "text") . "," .
257 " location = " . $ilDB->quote($this->getLocation(), "text") . "," .
258 " location_type = " . $ilDB->quote($this->getLocationType(), "text") . "," .
259 " format = " . $ilDB->quote($this->getFormat(), "text") . "," .
260 " width = " . $ilDB->quote($this->getWidth(), "text") . "," .
261 " height = " . $ilDB->quote($this->getHeight(), "text") . "," .
262 " halign = " . $ilDB->quote($this->getHAlign(), "text") . "," .
263 " caption = " . $ilDB->quote($this->getCaption(), "text") . "," .
264 " nr = " . $ilDB->quote($this->getNr(), "integer") . "," .
265 " text_representation = " . $ilDB->quote($this->getTextRepresentation(), "text") . "," .
266 " upload_hash = " . $ilDB->quote($this->getUploadHash(), "text") . "," .
267 " duration = " . $ilDB->quote($this->getDuration(), "integer") .
268 " WHERE id = " . $ilDB->quote($this->getId(), "integer");
269 $ilDB->manipulate($query);
270
271 // delete mob parameters
272 $query = "DELETE FROM mob_parameter WHERE med_item_id = " .
273 $ilDB->quote($this->getId(), "integer");
274 $ilDB->manipulate($query);
275
276 // create mob parameters
277 $params = $this->getParameters();
278 foreach ($params as $name => $value) {
279 $query = "INSERT INTO mob_parameter (med_item_id, name, value) VALUES " .
280 "(" . $ilDB->quote($this->getId(), "integer") . "," .
281 $ilDB->quote($name, "text") . "," .
282 $ilDB->quote($value, "text") . ")";
283 $ilDB->manipulate($query);
284 }
285 }

References $db, $ilDB, $params, 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 ( string  $a_name,
string  $a_value 
)

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

290 : void {
292
293 $query = "INSERT INTO mob_parameter (med_item_id, name, value) VALUES " .
294 "(" . $ilDB->quote($this->getId(), "integer") . "," .
295 $ilDB->quote($a_name, "text") . "," .
296 $ilDB->quote($a_value, "text") . ")";
297 $ilDB->manipulate($query);
298 }

◆ writeThumbTried()

ilMediaItem::writeThumbTried ( string  $a_tried)

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

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

359 : void
360 {
362
363 $q = "UPDATE media_item SET tried_thumb = " .
364 $ilDB->quote($a_tried, "text") .
365 " WHERE id = " . $ilDB->quote($this->getId(), "integer");
366
367 $ilDB->manipulate($q);
368 }
$q
Definition: shib_logout.php:23

References $ilDB, $q, and ILIAS\Survey\Mode\getId().

+ Here is the call graph for this function:

Field Documentation

◆ $caption

string ilMediaItem::$caption = ""

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

◆ $color1

int ilMediaItem::$color1

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

◆ $color2

int ilMediaItem::$color2

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

◆ $db

ilDBInterface ilMediaItem::$db
protected

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

Referenced by create(), and update().

◆ $duration

int ilMediaItem::$duration = 0
protected

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

Referenced by getDuration().

◆ $format

string ilMediaItem::$format = ""

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

◆ $halign

string ilMediaItem::$halign = ""

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

◆ $height

string ilMediaItem::$height = ""

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

◆ $id

int ilMediaItem::$id = 0

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

Referenced by getId().

◆ $image_converter

ILIAS Filesystem Util Convert LegacyImages ilMediaItem::$image_converter
protected

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

◆ $lng

ilLanguage ilMediaItem::$lng
protected

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

◆ $location

string ilMediaItem::$location = ""

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

◆ $location_type

string ilMediaItem::$location_type = ""

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

◆ $map_cnt

int ilMediaItem::$map_cnt = 0

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

◆ $map_image

ilMediaItem::$map_image = null

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

◆ $mapareas

array ilMediaItem::$mapareas = []

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

◆ $mob_id

int ilMediaItem::$mob_id = 0

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

Referenced by getMobId().

◆ $mob_manager

ILIAS MediaObjects MediaObjectManager ilMediaItem::$mob_manager
protected

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

◆ $nr

int ilMediaItem::$nr = 0

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

Referenced by getNr().

◆ $parameters

array ilMediaItem::$parameters = []

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

◆ $purpose

string ilMediaItem::$purpose = ""

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

◆ $text_representation

string ilMediaItem::$text_representation = ""
protected

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

Referenced by getTextRepresentation().

◆ $tried_thumb

string ilMediaItem::$tried_thumb = ""
protected

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

◆ $upload_hash

string ilMediaItem::$upload_hash = ''
protected

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

Referenced by getUploadHash().

◆ $width

string ilMediaItem::$width = ""

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


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