ILIAS  trunk Revision v11.0_alpha-1831-g8615d53dadb
All Data Structures Namespaces Files Functions Variables Enumerations Enumerator Modules Pages
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.

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

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  }
parameters()
description: > This shows how different states are being used in the same Prompt according to parame...
Definition: parameters.php:39
read()
read media item data (item id or (mob_id and nr) must be set)
global $DIC
Definition: shib_login.php:22
setId(int $a_id)
set media item id
+ 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.

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

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

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
global $DIC
Definition: shib_login.php:22
+ Here is the call graph for this function:
+ 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.

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

Referenced by ilObjMediaObject\read().

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  }
static _getMaxNr(int $a_item_id)
get maximum nr of media item (static)
addMediaItem(ilMediaItem $a_item)
global $DIC
Definition: shib_login.php:22
Class ilMediaItem Media Item, component of a media object (file or reference)
Class ilMapArea.
+ 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.

References $DIC, $ilDB, and null.

Referenced by ilObjectFeedWriter\__construct().

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  }
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
global $DIC
Definition: shib_login.php:22
+ 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.

References $DIC, and $ilDB.

Referenced by ilObjMediaObject\_lookupItemPath().

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  }
global $DIC
Definition: shib_login.php:22
+ Here is the caller graph for this function:

◆ _lookupMobId()

static ilMediaItem::_lookupMobId ( int  $a_med_id)
static

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

References $DIC, and $ilDB.

Referenced by ilMapArea\_getMobsForTarget().

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  }
global $DIC
Definition: shib_login.php:22
+ Here is the caller graph for this function:

◆ _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.

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

Referenced by ilQuestionPageParser\processPagesToParse(), and ILIAS\Data\Link\LinkManager\resolveIntLinks().

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
global $DIC
Definition: shib_login.php:22
+ 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.

References getHeight(), getMapWorkImage(), getOriginalSource(), and getWidth().

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  }
Class ilMapArea.
+ Here is the call graph for this function:

◆ addMapArea()

ilMediaItem::addMapArea ( ilMapArea  $a_map_area)

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

References $map_cnt.

Referenced by read().

565  : void
566  {
567  $this->mapareas[$this->map_cnt] = $a_map_area;
568  $this->map_cnt++;
569  }
+ Here is the caller graph for this function:

◆ buildMapWorkImage()

ilMediaItem::buildMapWorkImage ( )

build image map work image

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

References getMapWorkCopyType(), and getOriginalSource().

Referenced by makeMapWorkCopy(), and ilMediaAliasItem\makeMapWorkCopy().

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
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

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

Referenced by ilMediaAliasItem\setParameters().

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  }
+ Here is the caller graph for this function:

◆ create()

ilMediaItem::create ( )

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

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

202  : void
203  {
204  $ilDB = $this->db;
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  }
if(! $DIC->user() ->getId()||!ilLTIConsumerAccess::hasCustomProviderCreationAccess()) $params
Definition: ltiregstart.php:31
ilDBInterface $db
setId(int $a_id)
set media item id
+ 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.

References $DIC, and $ilDB.

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

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  }
global $DIC
Definition: shib_login.php:22
+ Here is the caller graph for this function:

◆ deleteMapArea()

ilMediaItem::deleteMapArea ( int  $nr)

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

References $map_cnt.

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.

References Vendor\Package\$e, ilExternalMediaAnalyzer\extractVimeoParameters(), getLocation(), getLocationSrc(), ilExternalMediaAnalyzer\getVimeoMetadata(), ilFileUtils\ilTempnam(), ilExternalMediaAnalyzer\isVimeo(), ilFileUtils\makeDir(), and setDuration().

Referenced by ilObjMediaCastGUI\getDuration().

1027  : void
1028  {
1029  $ana = new ilMediaAnalyzer();
1030 
1033  $meta = ilExternalMediaAnalyzer::getVimeoMetadata($par["id"]);
1034  if ($meta["duration"] > 0) {
1035  $this->setDuration((int) $meta["duration"]);
1036  }
1037  } else {
1038  $file = $this->getLocationSrc();
1039 
1040  $remote = false;
1041 
1042  try {
1043  if (substr($file, 0, 4) == "http") {
1044  if ($fp_remote = fopen($file, 'rb')) {
1045  $tmpdir = ilFileUtils::ilTempnam();
1046  ilFileUtils::makeDir($tmpdir);
1047  $localtempfilename = tempnam($tmpdir, 'getID3');
1048  if ($fp_local = fopen($localtempfilename, 'wb')) {
1049  while ($buffer = fread($fp_remote, 8192)) {
1050  fwrite($fp_local, $buffer);
1051  }
1052  fclose($fp_local);
1053  $file = $localtempfilename;
1054  }
1055  fclose($fp_remote);
1056  }
1057  }
1058 
1059  $ana->setFile($file);
1060  $ana->analyzeFile();
1061  $this->setDuration((int) $ana->getPlaytimeSeconds());
1062 
1063  if ($remote) {
1064  unlink($localtempfilename);
1065  }
1066  } catch (Exception $e) {
1067  }
1068  }
1069  }
setDuration(int $a_val)
static isVimeo(string $a_location)
Identify Vimeo links.
static ilTempnam(?string $a_temp_path=null)
Returns a unique and non existing Path for e temporary file or directory.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
getLocationSrc(bool $autoplay=false)
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 ...
+ 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.

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

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)
+ Here is the call graph for this function:

◆ getCaption()

ilMediaItem::getCaption ( )

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

References $caption.

Referenced by create(), and update().

633  : string
634  {
635  return $this->caption;
636  }
+ Here is the caller graph for this function:

◆ getDirectory()

ilMediaItem::getDirectory ( )

get media file directory

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

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

745  : string
746  {
747  return ilObjMediaObject::_getDirectory($this->getMobId());
748  }
static _getDirectory(int $a_mob_id)
Get absolute directory.
+ Here is the call graph for this function:

◆ getDuration()

ilMediaItem::getDuration ( )

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

References $duration.

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

177  : int
178  {
179  return $this->duration;
180  }
+ Here is the caller graph for this function:

◆ getFormat()

ilMediaItem::getFormat ( )

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

References $format.

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

550  : string
551  {
552  return $this->format;
553  }
+ 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.

References $halign.

Referenced by create(), and update().

646  : string
647  {
648  return $this->halign;
649  }
+ Here is the caller graph for this function:

◆ getHeight()

ilMediaItem::getHeight ( )

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

References $height.

Referenced by addAreaToMapWorkCopy(), create(), makeMapWorkCopy(), ilMediaAliasItem\makeMapWorkCopy(), and update().

605  : string
606  {
607  return $this->height;
608  }
+ Here is the caller graph for this function:

◆ getId()

ilMediaItem::getId ( )

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

References $id.

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

85  : int
86  {
87  return $this->id;
88  }
+ Here is the caller graph for this function:

◆ getLocation()

ilMediaItem::getLocation ( )

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

References $location.

Referenced by create(), determineDuration(), extractUrlParameters(), getLocationSrc(), getLocationStream(), getOriginalSource(), getSuffix(), update(), and ilObjMediaCastGUI\updateMediaItem().

530  : string
531  {
532  return $this->location;
533  }
+ Here is the caller graph for this function:

◆ getLocationSrc()

ilMediaItem::getLocationSrc ( bool  $autoplay = false)

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

References $params, ilExternalMediaAnalyzer\extractVimeoParameters(), ilExternalMediaAnalyzer\extractYouTubeParameters(), getFormat(), getLocation(), getLocationType(), and getMobId().

Referenced by determineDuration().

1071  : string
1072  {
1073  if (strcasecmp("Reference", $this->getLocationType()) === 0) {
1074  $src = $this->getLocation();
1075  if ($this->getFormat() === "video/vimeo") {
1076  $params = "";
1077  if ($autoplay) {
1078  $params = "&autoplay=1&muted=1";
1079  }
1081  $src = "//player.vimeo.com/video/" . $par["id"] . "?api=1" . $params;
1082  }
1083  if ($this->getFormat() === "video/youtube") {
1084  $params = "";
1085  if ($autoplay) {
1086  $params = "&autoplay=1&muted=1";
1087  }
1089  $src = "//www.youtube.com/embed/" . $par["v"] . "?enablejsapi=1" . $params;
1090  }
1091  } else {
1092  $src = $this->mob_manager->getLocalSrc(
1093  $this->getMobId(),
1094  $this->getLocation()
1095  );
1096  }
1097  return $src;
1098  }
if(! $DIC->user() ->getId()||!ilLTIConsumerAccess::hasCustomProviderCreationAccess()) $params
Definition: ltiregstart.php:31
static extractYouTubeParameters(string $a_location)
Extract YouTube Parameter.
static extractVimeoParameters(string $a_location)
Extract Vimeo Parameter.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getLocationStream()

ilMediaItem::getLocationStream ( )

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

References getLocation(), and getMobId().

1100  : ZIPStream
1101  {
1102  return $this->mob_manager->getLocationStream(
1103  $this->getMobId(),
1104  $this->getLocation()
1105  );
1106  }
+ Here is the call graph for this function:

◆ getLocationType()

ilMediaItem::getLocationType ( )

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

References $location_type.

Referenced by create(), getLocationSrc(), getOriginalSource(), update(), and ilObjMediaCastGUI\updateMediaItem().

540  : string
541  {
542  return $this->location_type;
543  }
+ Here is the caller graph for this function:

◆ getMapArea()

ilMediaItem::getMapArea ( int  $nr)

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

References null.

585  : ?ilMapArea
586  {
587  return $this->mapareas[$nr - 1] ?? null;
588  }
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
Class ilMapArea.

◆ getMapAreas()

ilMediaItem::getMapAreas ( )

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

References $mapareas.

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.

References IL_INT_LINK.

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.

References getSuffix().

Referenced by buildMapWorkImage(), outputMapWorkCopy(), and outputWorkImage().

737  : string
738  {
739  return self::getGDSupportedImageType($this->getSuffix());
740  }
getSuffix()
get location suffix
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getMapWorkImage()

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

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

References $map_image.

Referenced by addAreaToMapWorkCopy(), makeMapWorkCopy(), and ilMediaAliasItem\makeMapWorkCopy().

910  {
911  return $this->map_image;
912  }
+ Here is the caller graph for this function:

◆ getMediaItemsForUploadHash()

static ilMediaItem::getMediaItemsForUploadHash ( string  $a_hash)
static

Get media items for upload hash.

Parameters
string$a_hashupload hash
Returns
array[]

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

References $DIC, ilDBInterface\fetchAssoc(), and ilDBInterface\queryF().

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

1115  : array {
1116  global $DIC;
1117 
1118  $db = $DIC->database();
1119 
1120  $set = $db->queryF(
1121  "SELECT * FROM media_item " .
1122  " WHERE upload_hash = %s ",
1123  array("text"),
1124  array($a_hash)
1125  );
1126  $media_items = array();
1127  while ($rec = $db->fetchAssoc($set)) {
1128  $media_items[] = $rec;
1129  }
1130  return $media_items;
1131  }
fetchAssoc(ilDBStatement $statement)
ilDBInterface $db
global $DIC
Definition: shib_login.php:22
queryF(string $query, array $types, array $values)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getMobId()

ilMediaItem::getMobId ( )

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

References $mob_id.

Referenced by create(), getDirectory(), getLocationSrc(), getLocationStream(), getOriginalSource(), read(), and update().

98  : int
99  {
100  return $this->mob_id;
101  }
+ Here is the caller graph for this function:

◆ getNr()

ilMediaItem::getNr ( )

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

References $nr.

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

111  : int
112  {
113  return $this->nr;
114  }
+ Here is the caller graph for this function:

◆ getOriginalSize()

ilMediaItem::getOriginalSize ( )

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

References ilUtil\deducibleSize(), getFormat(), ilMediaImageUtil\getImageSize(), getOriginalSource(), and null.

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  }
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
static deducibleSize(string $a_mime)
checks if mime type is provided by getimagesize()
static getImageSize(string $a_location)
Get image size from location.
+ Here is the call graph for this function:

◆ getOriginalSource()

ilMediaItem::getOriginalSource ( )

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

References getLocation(), getLocationType(), and getMobId().

Referenced by addAreaToMapWorkCopy(), buildMapWorkImage(), getOriginalSize(), makeMapWorkCopy(), and ilMediaAliasItem\makeMapWorkCopy().

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  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getParameter()

ilMediaItem::getParameter ( string  $a_name)

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

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

719  : string
720  {
721  return (string) ($this->parameters[$a_name] ?? "");
722  }
parameters()
description: > This shows how different states are being used in the same Prompt according to parame...
Definition: parameters.php:39
+ Here is the call graph for this function:

◆ getParameters()

ilMediaItem::getParameters ( )

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

References $parameters.

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

702  : array
703  {
704  return $this->parameters;
705  }
+ Here is the caller graph for this function:

◆ getParameterString()

ilMediaItem::getParameterString ( )

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

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

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  }
parameters()
description: > This shows how different states are being used in the same Prompt according to parame...
Definition: parameters.php:39
+ Here is the call graph for this function:

◆ getPurpose()

ilMediaItem::getPurpose ( )

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

References $purpose.

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

520  : string
521  {
522  return $this->purpose;
523  }
+ Here is the caller graph for this function:

◆ getSuffix()

ilMediaItem::getSuffix ( )

get location suffix

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

References getLocation().

Referenced by getMapWorkCopyType().

727  : string
728  {
729  $loc_arr = explode(".", $this->getLocation());
730 
731  return $loc_arr[count($loc_arr) - 1];
732  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getTextRepresentation()

ilMediaItem::getTextRepresentation ( )

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

References $text_representation.

Referenced by create(), and update().

187  : string
188  {
190  }
string $text_representation
+ Here is the caller graph for this function:

◆ getThumbTried()

ilMediaItem::getThumbTried ( )

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

References $tried_thumb.

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

◆ getUploadHash()

ilMediaItem::getUploadHash ( )

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

References $upload_hash.

Referenced by create(), and update().

197  : string
198  {
199  return $this->upload_hash;
200  }
+ Here is the caller graph for this function:

◆ getWidth()

ilMediaItem::getWidth ( )

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

References $width.

Referenced by addAreaToMapWorkCopy(), create(), makeMapWorkCopy(), ilMediaAliasItem\makeMapWorkCopy(), and update().

595  : string
596  {
597  return $this->width;
598  }
+ 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.

References buildMapWorkImage(), getHeight(), getMapWorkImage(), getOriginalSource(), and getWidth().

Referenced by ilImageMapEditorGUI\makeMapWorkCopy().

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(),
793  $this->color1,
794  $this->color2,
795  true,
796  $x_ratio,
797  $y_ratio
798  );
799  }
800  }
801  }
buildMapWorkImage()
build image map work image
+ Here is the call graph for this function:
+ 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.

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

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  }
getMapWorkCopyType()
get image type of image map work copy
header()
expected output: > ILIAS shows the rendered Component.
Definition: header.php:29
exit
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
+ Here is the call graph for this function:

◆ outputWorkImage()

ilMediaItem::outputWorkImage ( )

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

References getMapWorkCopyType().

Referenced by outputMapWorkCopy().

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  }
getMapWorkCopyType()
get image type of image map work copy
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

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

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

Referenced by __construct().

303  : void
304  {
305  $ilDB = $this->db;
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  }
setPurpose(string $a_purpose)
addMapArea(ilMapArea $a_map_area)
setParameter(string $a_name, string $a_value)
static _getMaxNr(int $a_item_id)
get maximum nr of media item (static)
setDuration(int $a_val)
setLocation(string $a_location)
setFormat(string $a_format)
setCaption(string $a_caption)
setHAlign(string $a_halign)
set horizontal align
ilDBInterface $db
setMobId(int $a_mob_id)
set id of parent media object
setTextRepresentation(string $a_val)
setHeight(string $a_height)
setUploadHash(string $a_val)
setThumbTried(string $a_tried)
Class ilMapArea.
setWidth(string $a_width)
setNr(int $a_nr)
set number of media item within media object
setLocationType(string $a_type)
setId(int $a_id)
set media item id
+ 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.

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

Referenced by setParameters().

660  : void
661  {
662  $this->parameters = [];
663  }
parameters()
description: > This shows how different states are being used in the same Prompt according to parame...
Definition: parameters.php:39
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ setCaption()

ilMediaItem::setCaption ( string  $a_caption)

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

Referenced by read().

628  : void
629  {
630  $this->caption = $a_caption;
631  }
+ Here is the caller graph for this function:

◆ setDuration()

ilMediaItem::setDuration ( int  $a_val)

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

Referenced by determineDuration(), and read().

172  : void
173  {
174  $this->duration = $a_val;
175  }
+ Here is the caller graph for this function:

◆ setFormat()

ilMediaItem::setFormat ( string  $a_format)

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

Referenced by read(), and ilObjMediaCastGUI\updateMediaItem().

545  : void
546  {
547  $this->format = $a_format;
548  }
+ 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.

Referenced by read(), and ilObjMediaCastGUI\updateMediaItem().

641  : void
642  {
643  $this->halign = $a_halign;
644  }
+ Here is the caller graph for this function:

◆ setHeight()

ilMediaItem::setHeight ( string  $a_height)

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

Referenced by read(), and ilObjMediaCastGUI\updateMediaItem().

610  : void
611  {
612  $this->height = $a_height;
613  }
+ 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.

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

80  : void
81  {
82  $this->id = $a_id;
83  }
+ Here is the caller graph for this function:

◆ setLocation()

ilMediaItem::setLocation ( string  $a_location)

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

Referenced by read(), and ilObjMediaCastGUI\updateMediaItem().

525  : void
526  {
527  $this->location = $a_location;
528  }
+ Here is the caller graph for this function:

◆ setLocationType()

ilMediaItem::setLocationType ( string  $a_type)

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

Referenced by read(), and ilObjMediaCastGUI\updateMediaItem().

535  : void
536  {
537  $this->location_type = $a_type;
538  }
+ 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.

Referenced by read().

93  : void
94  {
95  $this->mob_id = $a_mob_id;
96  }
+ Here is the caller graph for this function:

◆ setNr()

ilMediaItem::setNr ( int  $a_nr)

set number of media item within media object

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

Referenced by read().

106  : void
107  {
108  $this->nr = $a_nr;
109  }
+ Here is the caller graph for this function:

◆ setParameter()

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

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

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

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

654  : void {
655  if (self::checkParameter($a_name, $a_value)) {
656  $this->parameters[$a_name] = $a_value;
657  }
658  }
parameters()
description: > This shows how different states are being used in the same Prompt according to parame...
Definition: parameters.php:39
+ Here is the call graph for this function:
+ Here is the caller 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.

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

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  }
setParameter(string $a_name, string $a_value)
static extractParameterString(string $a_parstr)
+ Here is the call graph for this function:

◆ setPurpose()

ilMediaItem::setPurpose ( string  $a_purpose)

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

Referenced by read().

515  : void
516  {
517  $this->purpose = $a_purpose;
518  }
+ Here is the caller graph for this function:

◆ setTextRepresentation()

ilMediaItem::setTextRepresentation ( string  $a_val)

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

Referenced by read().

182  : void
183  {
184  $this->text_representation = $a_val;
185  }
+ Here is the caller graph for this function:

◆ setThumbTried()

ilMediaItem::setThumbTried ( string  $a_tried)

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

Referenced by read().

555  : void
556  {
557  $this->tried_thumb = $a_tried;
558  }
+ Here is the caller graph for this function:

◆ setUploadHash()

ilMediaItem::setUploadHash ( string  $a_val)

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

Referenced by read().

192  : void
193  {
194  $this->upload_hash = $a_val;
195  }
+ Here is the caller graph for this function:

◆ setWidth()

ilMediaItem::setWidth ( string  $a_width)

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

Referenced by read().

600  : void
601  {
602  $this->width = $a_width;
603  }
+ Here is the caller graph for this function:

◆ update()

ilMediaItem::update ( )

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

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

250  : void
251  {
252  $ilDB = $this->db;
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  }
if(! $DIC->user() ->getId()||!ilLTIConsumerAccess::hasCustomProviderCreationAccess()) $params
Definition: ltiregstart.php:31
ilDBInterface $db
+ 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.

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

290  : void {
291  $ilDB = $this->db;
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  }
ilDBInterface $db
+ Here is the call graph for this function:

◆ writeThumbTried()

ilMediaItem::writeThumbTried ( string  $a_tried)

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

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

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

359  : void
360  {
361  $ilDB = $this->db;
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  }
ilDBInterface $db
$q
Definition: shib_logout.php:21
+ Here is the call graph for this function:

Field Documentation

◆ $caption

string ilMediaItem::$caption = ""

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

Referenced by getCaption().

◆ $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(), read(), update(), writeParameter(), and writeThumbTried().

◆ $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.

Referenced by getFormat().

◆ $halign

string ilMediaItem::$halign = ""

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

Referenced by getHAlign().

◆ $height

string ilMediaItem::$height = ""

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

Referenced by getHeight().

◆ $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.

Referenced by getLocation().

◆ $location_type

string ilMediaItem::$location_type = ""

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

Referenced by getLocationType().

◆ $map_cnt

int ilMediaItem::$map_cnt = 0

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

Referenced by addMapArea(), and deleteMapArea().

◆ $map_image

ilMediaItem::$map_image = null

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

Referenced by getMapWorkImage().

◆ $mapareas

array ilMediaItem::$mapareas = []

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

Referenced by getMapAreas().

◆ $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.

Referenced by getParameters().

◆ $purpose

string ilMediaItem::$purpose = ""

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

Referenced by getPurpose().

◆ $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.

Referenced by getThumbTried().

◆ $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.

Referenced by getWidth().


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