ILIAS  trunk Revision v13.0_alpha-62-g3b72d83f2e5
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 1003 of file class.ilMediaItem.php.

1005 : array {
1006 global $DIC;
1007
1008 $ilDB = $DIC->database();
1009
1010 // read media_items records
1011 $query = "SELECT * FROM media_item WHERE mob_id = " .
1012 $ilDB->quote($a_mob_id, "integer") . " ORDER BY nr";
1013
1014 $item_set = $ilDB->query($query);
1015 $links = array();
1016 while ($item_rec = $ilDB->fetchAssoc($item_set)) {
1017 $map_links = ilMapArea::_getIntLinks($item_rec["id"]);
1018 foreach ($map_links as $key => $map_link) {
1019 $links[$key] = $map_link;
1020 }
1021 }
1022 return $links;
1023 }
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 981 of file class.ilMediaItem.php.

983 : void {
984 global $DIC;
985
986 $ilDB = $DIC->database();
987
988 //echo "mediaItems::resolve<br>";
989 // read media_object record
990 $query = "SELECT * FROM media_item WHERE mob_id = " .
991 $ilDB->quote($a_mob_id, "integer") . " " .
992 "ORDER BY nr";
993 $item_set = $ilDB->query($query);
994 while ($item_rec = $ilDB->fetchAssoc($item_set)) {
995 ilMapArea::_resolveIntLinks($item_rec["id"]);
996 }
997 }
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 820 of file class.ilMediaItem.php.

823 : void {
824 // $this->buildMapWorkImage();
825
826 // determine ratios
827 $size = getimagesize($this->getOriginalSource());
828 $x_ratio = 1;
829 if ($size[0] > 0 && $this->getWidth() > 0) {
830 $x_ratio = $this->getWidth() / $size[0];
831 }
832 $y_ratio = 1;
833 if ($size[1] > 0 && $this->getHeight() > 0) {
834 $y_ratio = $this->getHeight() / $size[1];
835 }
836
837 // add new area to work image
838 $area = new ilMapArea();
839 $area->setShape($a_shape);
840 $area->setCoords($a_coords);
841 $area->draw(
842 $this->getMapWorkImage(),
843 $this->color1,
844 $this->color2,
845 false,
846 $x_ratio,
847 $y_ratio
848 );
849 }

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

868 : void
869 {
870 $im_type = strtolower($this->getMapWorkCopyType());
871
872 switch ($im_type) {
873 case "gif":
874 $this->map_image = imagecreatefromgif($this->getOriginalSource());
875 break;
876
877 case "jpg":
878 case "jpeg":
879 $this->map_image = imagecreatefromjpeg($this->getOriginalSource());
880 break;
881
882 case "png":
883 $this->map_image = imagecreatefrompng($this->getOriginalSource());
884 break;
885 }
886
887 // try to allocate black and white as color. if this is not possible, get the closest colors
888 if (imagecolorstotal($this->map_image) > 250) {
889 $this->color1 = imagecolorclosest($this->map_image, 0, 0, 0);
890 $this->color2 = imagecolorclosest($this->map_image, 255, 255, 255);
891 } else {
892 $this->color1 = imagecolorallocate($this->map_image, 0, 0, 0);
893 $this->color2 = imagecolorallocate($this->map_image, 255, 255, 255);
894 }
895 }
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

References $db, $ilDB, 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 1039 of file class.ilMediaItem.php.

1039 : void
1040 {
1041 $ana = new ilMediaAnalyzer();
1042
1046 if ($meta["duration"] > 0) {
1047 $this->setDuration((int) $meta["duration"]);
1048 }
1049 } else {
1050 $file = $this->getLocationSrc();
1051
1052 try {
1053 if (str_starts_with($file, 'http')) {
1054 $mob_logger = ilLoggerFactory::getLogger('mob');
1055
1056 try {
1057 $tmpdir = ilFileUtils::ilTempnam();
1058 ilFileUtils::makeDir($tmpdir);
1059 $localtempfilename = tempnam($tmpdir, 'getID3');
1060 $fp_local = fopen($localtempfilename, 'wb');
1061
1062 $mob_logger->debug('Determining duration of file: {file}', [
1063 'file' => $file,
1064 ]);
1065
1066 $curl = new ilCurlConnection($file);
1067 $curl->init(true);
1068 $curl->setOpt(CURLOPT_VERBOSE, true);
1069 $curl->setOpt(CURLOPT_FILE, $fp_local);
1070 $curl->setOpt(CURLOPT_FOLLOWLOCATION, true);
1071 $curl->setOpt(CURLOPT_TIMEOUT_MS, 600000);
1072 $curl->setOpt(CURLOPT_TIMEOUT, 600);
1073 $curl->setOpt(CURLOPT_FAILONERROR, true);
1074 $curl->setOpt(CURLOPT_SSL_VERIFYPEER, 1);
1075 $curl->setOpt(CURLOPT_SSL_VERIFYHOST, 2);
1076
1077 $success = $curl->exec();
1078 $info = $curl->getInfo();
1079
1080 $mob_logger->debug('cURL Info: {info}', [
1081 'info' => print_r($info, true)
1082 ]);
1083
1084 if ($success) {
1085 $mob_logger->debug('Successfully downloaded remote file: {file}', [
1086 'file' => $file,
1087 ]);
1088
1089 $file = $localtempfilename;
1090 } else {
1091 $mob_logger->error('Could not fetch file: {file}', [
1092 'file' => $file,
1093 ]);
1094 }
1095 } catch (Exception $e) {
1096 $mob_logger->error('Could not determine duration: {message}', [
1097 'message' => $e->getMessage(),
1098 ]);
1099 $mob_logger->error($e->getTraceAsString());
1100 }
1101 }
1102
1103 $ana->setFile($file);
1104 $ana->analyzeFile();
1105 $this->setDuration($ana->getPlaytimeSeconds());
1106 } catch (Exception) {
1107 }
1108 }
1109 }
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 1028 of file class.ilMediaItem.php.

1028 : void
1029 {
1031 $this->getLocation(),
1032 $this->getParameters()
1033 );
1034 foreach ($par as $k => $v) {
1035 $this->setParameter($k, $v);
1036 }
1037 }
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 757 of file class.ilMediaItem.php.

757 : string
758 {
760 }
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(), ilPCMediaObjectGUI\getDefaultSize(), 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(), update(), and ilObjMediaCastGUI\updateMediaItem().

+ Here is the caller graph for this function:

◆ getLocationSrc()

ilMediaItem::getLocationSrc ( bool  $autoplay = false)

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

1111 : string
1112 {
1113 if (strcasecmp("Reference", $this->getLocationType()) === 0) {
1114 $src = $this->getLocation();
1115 if ($this->getFormat() === "video/vimeo") {
1116 $params = "";
1117 if ($autoplay) {
1118 $params = "&autoplay=1&muted=1";
1119 }
1121 $src = "//player.vimeo.com/video/" . $par["id"] . "?api=1" . $params;
1122 }
1123 if ($this->getFormat() === "video/youtube") {
1124 $params = "";
1125 if ($autoplay) {
1126 $params = "&autoplay=1&muted=1";
1127 }
1129 $src = "//www.youtube.com/embed/" . $par["v"] . "?enablejsapi=1" . $params;
1130 }
1131 } else {
1132 $src = $this->mob_manager->getLocalSrc(
1133 $this->getMobId(),
1134 $this->getLocation()
1135 );
1136 }
1137 return $src;
1138 }
static extractYouTubeParameters(string $a_location)
Extract YouTube Parameter.

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

+ Here is the call graph for this function:

◆ getLocationStream()

ilMediaItem::getLocationStream ( )

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

1140 : ZIPStream
1141 {
1142 return $this->mob_manager->getLocationStream(
1143 $this->getMobId(),
1144 $this->getLocation()
1145 );
1146 }

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

932 : string {
933 $xml = "";
934
935 // build xml of map areas
936 for ($i = 0; $i < count($this->mapareas); $i++) {
937 $area = $this->mapareas[$i];
938
939 // highlight mode
940 $hm = "";
941 if ($area->getHighlightMode() != "") {
942 $hm = ' HighlightMode="' . $area->getHighlightMode() . '" ';
943 $hcl = ($area->getHighlightClass() != "")
944 ? $area->getHighlightClass()
945 : "Accented";
946 $hm .= 'HighlightClass="' . $hcl . '" ';
947 }
948
949 $xml .= "<MapArea Shape=\"" . $area->getShape() . "\" Coords=\"" . $area->getCoords() . "\" " . $hm . ">";
950 if ($area->getLinkType() == IL_INT_LINK) {
951 $target_frame = $area->getTargetFrame();
952
953 if ($area->getType() == "GlossaryItem" && $target_frame == "") {
954 $target_frame = "Glossary";
955 }
956
957 $tf_str = ($target_frame == "")
958 ? ""
959 : "TargetFrame=\"" . $target_frame . "\"";
960
961 $xml .= "<IntLink Target=\"" . $area->getTarget($a_insert_inst, $a_inst) . "\" Type=\"" .
962 $area->getType() . "\" $tf_str>";
963 // see bug 17893 and http://stackoverflow.com/questions/4026502/xml-error-at-ampersand
964 $xml .= htmlspecialchars($area->getTitle(), ENT_QUOTES);
965 $xml .= "</IntLink>";
966 } else {
967 $xml .= "<ExtLink Href=\"" . str_replace("&", "&amp;", $area->getHref()) . "\" Title=\"" .
968 str_replace("&", "&amp;", $area->getExtTitle()) . "\">";
969 $xml .= str_replace("&", "&amp;", $area->getTitle());
970 $xml .= "</ExtLink>";
971 }
972 $xml .= "</MapArea>";
973 }
974 return $xml;
975 }
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 if ($type !== "") {
741 return $type;
742 }
743
744 $type = match ($this->getFormat()) {
745 "image/jpeg" => "jpg",
746 "image/gif" => "gif",
747 "image/png", "image/svg+xml" => "png",
748 default => ""
749 };
750
751 return self::getGDSupportedImageType($type);
752 }
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 921 of file class.ilMediaItem.php.

922 {
923 return $this->map_image;
924 }

◆ getMediaItemsForUploadHash()

static ilMediaItem::getMediaItemsForUploadHash ( string  $a_hash)
static

Get media items for upload hash.

Parameters
string$a_hashupload hash
Returns
array[]

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

1155 : array {
1156 global $DIC;
1157
1158 $db = $DIC->database();
1159
1160 $set = $db->queryF(
1161 "SELECT * FROM media_item " .
1162 " WHERE upload_hash = %s ",
1163 array("text"),
1164 array($a_hash)
1165 );
1166 $media_items = array();
1167 while ($rec = $db->fetchAssoc($set)) {
1168 $media_items[] = $rec;
1169 }
1170 return $media_items;
1171 }
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().

Referenced by ilPCMediaObjectGUI\getDefaultSize().

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

◆ getOriginalSource()

ilMediaItem::getOriginalSource ( )

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

763 : string
764 {
765 if ($this->getLocationType() !== "Reference") {
766 return $this->mob_manager->getLocalSrc(
767 $this->getMobId(),
768 $this->getLocation()
769 );
770 }
771 return $this->getLocation();
772 }

◆ 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 }

References $parameters.

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(), ilPCMediaObjectGUI\getDefaultSize(), 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 779 of file class.ilMediaItem.php.

782 : void {
783 $this->buildMapWorkImage();
784
785 // determine ratios
786 $size = getimagesize($this->getOriginalSource());
787 $x_ratio = 1;
788 if ($size[0] > 0 && $this->getWidth() > 0) {
789 $x_ratio = $this->getWidth() / $size[0];
790 }
791 $y_ratio = 1;
792 if ($size[1] > 0 && $this->getHeight() > 0) {
793 $y_ratio = $this->getHeight() / $size[1];
794 }
795
796 // draw map areas
797 for ($i = 0; $i < count($this->mapareas); $i++) {
798 if (((($i + 1) == $a_area_nr) && !$a_exclude) ||
799 ((($i + 1) != $a_area_nr) && $a_exclude) ||
800 ($a_area_nr == 0)
801 ) {
802 $area = $this->mapareas[$i];
803 $area->draw(
804 $this->getMapWorkImage(),
807 true,
808 $x_ratio,
809 $y_ratio
810 );
811 }
812 }
813 }
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 854 of file class.ilMediaItem.php.

854 : void
855 {
856 if ($this->getMapWorkCopyType() != "") {
857 header("Pragma: no-cache");
858 header("Expires: 0");
859 header("Content-type: image/" . strtolower($this->getMapWorkCopyType()));
860 $this->outputWorkImage();
861 }
862 exit;
863 }
exit
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...

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

+ Here is the call graph for this function:

◆ outputWorkImage()

ilMediaItem::outputWorkImage ( )

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

897 : void
898 {
899 $im_type = strtolower($this->getMapWorkCopyType());
900
901 // save image work-copy and free memory
902 switch ($im_type) {
903 case "gif":
904 imagegif($this->map_image);
905 break;
906
907 case "jpg":
908 case "jpeg":
909 imagejpeg($this->map_image);
910 break;
911
912 case "png":
913 imagepng($this->map_image);
914 break;
915 }
916 }

◆ 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 }

Referenced by ilObjMediaCastGUI\updateMediaItem().

+ Here is the caller graph for this function:

◆ 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 }

Referenced by ilObjMediaCastGUI\updateMediaItem().

+ Here is the caller graph for this function:

◆ setHeight()

ilMediaItem::setHeight ( string  $a_height)

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

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

Referenced by ilObjMediaCastGUI\updateMediaItem().

+ Here is the caller graph for this function:

◆ 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 }

References ILIAS\UI\examples\Symbol\Glyph\Location\location().

Referenced by ilObjMediaCastGUI\updateMediaItem().

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

◆ 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 }

Referenced by ilObjMediaCastGUI\updateMediaItem().

+ Here is the caller graph for this function:

◆ 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, 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 }

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