ILIAS  release_4-4 Revision
ilMediaItem Class Reference

Class ilMediaItem. More...

+ Collaboration diagram for ilMediaItem:

Public Member Functions

 ilMediaItem ($a_id=0)
 
 setId ($a_id)
 set media item id More...
 
 getId ()
 get media item id More...
 
 setMobId ($a_mob_id)
 set id of parent media object More...
 
 getMobId ()
 get id of parent media object More...
 
 setNr ($a_nr)
 set number of media item within media object More...
 
 getNr ()
 
 setTextRepresentation ($a_val)
 Set text representation. More...
 
 getTextRepresentation ()
 Get text representation. More...
 
 create ()
 create persistent media item More...
 
 update ()
 update media item data (without map areas!) More...
 
 writeParameter ($a_name, $a_value)
 Write parameter. More...
 
 read ()
 read media item data (item id or (mob_id and nr) must be set) More...
 
 writeThumbTried ($a_tried)
 write thumbnail creation try data ("y"/"n") More...
 
 _getMediaItemsOfMObId ($a_mobId, $a_purpose)
 
 _getMediaItemsOfMOb (&$a_mob)
 read media items into media objects (static) More...
 
 deleteAllItemsOfMob ($a_mob_id)
 static More...
 
 setPurpose ($a_purpose)
 
 getPurpose ()
 
 setLocation ($a_location)
 
 getLocation ()
 
 setLocationType ($a_type)
 
 getLocationType ()
 
 setFormat ($a_format)
 
 getFormat ()
 
 setThumbTried ($a_tried)
 
 getThumbTried ()
 
 addMapArea (&$a_map_area)
 
 deleteMapArea ($nr)
 delete map area More...
 
getMapArea ($nr)
 get map area More...
 
 getMapAreas ()
 get map areas More...
 
 getWidth ()
 get width More...
 
 setWidth ($a_width)
 set width More...
 
 getHeight ()
 get height More...
 
 setHeight ($a_height)
 set height More...
 
 getOriginalSize ()
 get original size More...
 
 setCaption ($a_caption)
 set caption More...
 
 getCaption ()
 get caption More...
 
 setHAlign ($a_halign)
 set horizontal align More...
 
 getHAlign ()
 get horizontal align More...
 
 setParameter ($a_name, $a_value)
 set parameter More...
 
 resetParameters ()
 reset parameters More...
 
 setParameters ($a_par)
 set alle parameters via parameter string (format: par1="value1", par2="value2", ...) More...
 
 getParameters ()
 get all parameters (in array) More...
 
 getParameterString ()
 get all parameters (as string) More...
 
 getParameter ($a_name)
 get a single parameter More...
 
 getWorkDirectory ()
 get work directory for image map editing More...
 
 createWorkDirectory ()
 create work directory for image map editing More...
 
 getSuffix ()
 get location suffix More...
 
 getMapWorkCopyType ()
 get image type of image map work copy More...
 
 getMapWorkCopyName ($a_reference_copy=false)
 Get name of image map work copy file. More...
 
 getDirectory ()
 get media file directory More...
 
 getThumbnailDirectory ($a_mode="filesystem")
 get media file directory More...
 
 getThumbnailTarget ($a_size="")
 get thumbnail target More...
 
 copyOriginal ()
 Copy the orginal file. More...
 
 makeMapWorkCopy ($a_area_nr=0, $a_exclude=false)
 make map work copy of image More...
 
 addAreaToMapWorkCopy ($a_shape, $a_coords)
 draw a new area in work image More...
 
 outputMapWorkCopy ()
 output raw map work copy file More...
 
 buildMapWorkImage ()
 build image map work image More...
 
 saveMapWorkImage ()
 save image map work image More...
 
getMapWorkImage ()
 get image map work image More...
 
 getMapAreasXML ($a_insert_inst=false, $a_inst=0)
 get xml code of media items' areas More...
 
 _resolveMapAreaLinks ($a_mob_id)
 resolve internal links of all media items of a media object More...
 
 _getMapAreasIntLinks ($a_mob_id)
 get all internal links of map areas of a mob More...
 
 extractUrlParameters ()
 Extract parameters of special external references to parameter array. More...
 

Static Public Member Functions

static _lookupLocationForMobId ($a_mob_id, $a_purpose)
 Lookup location for mob id. More...
 
static _lookupMobId ($a_med_id)
 Lookup Mob ID. More...
 

Data Fields

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

Detailed Description

Class ilMediaItem.

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

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

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

Member Function Documentation

◆ _getMapAreasIntLinks()

ilMediaItem::_getMapAreasIntLinks (   $a_mob_id)

get all internal links of map areas of a mob

Parameters
int$a_mob_idmedia object id

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

References $query, and ilMapArea\_getIntLinks().

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

1139  {
1140  global $ilDB;
1141 
1142  // read media_items records
1143  $query = "SELECT * FROM media_item WHERE mob_id = ".
1144  $ilDB->quote($a_mob_id, "integer")." ORDER BY nr";
1145 
1146  $item_set = $ilDB->query($query);
1147  $links = array();
1148  while ($item_rec = $ilDB->fetchAssoc($item_set))
1149  {
1150  $map_links = ilMapArea::_getIntLinks($item_rec["id"]);
1151  foreach($map_links as $key => $map_link)
1152  {
1153  $links[$key] = $map_link;
1154  }
1155  }
1156  return $links;
1157  }
_getIntLinks($a_item_id)
get all internal links of a media items map areas
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ _getMediaItemsOfMOb()

ilMediaItem::_getMediaItemsOfMOb ( $a_mob)

read media items into media objects (static)

Parameters
object$a_mobmedia object

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

References $query, ilMapArea\_getMaxNr(), and ilMediaItem().

Referenced by ilObjMediaObject\read().

377  {
378  global $ilDB;
379 
380  // read media_object record
381  $query = "SELECT * FROM media_item WHERE mob_id = ".
382  $ilDB->quote($a_mob->getId(), "integer")." ".
383  "ORDER BY nr";
384  $item_set = $ilDB->query($query);
385  while ($item_rec = $ilDB->fetchAssoc($item_set))
386  {
387  $media_item =& new ilMediaItem();
388  $media_item->setNr($item_rec["nr"]);
389  $media_item->setId($item_rec["id"]);
390  $media_item->setLocation($item_rec["location"]);
391  $media_item->setLocationType($item_rec["location_type"]);
392  $media_item->setFormat($item_rec["format"]);
393  $media_item->setWidth($item_rec["width"]);
394  $media_item->setHeight($item_rec["height"]);
395  $media_item->setHAlign($item_rec["halign"]);
396  $media_item->setCaption($item_rec["caption"]);
397  $media_item->setPurpose($item_rec["purpose"]);
398  $media_item->setMobId($item_rec["mob_id"]);
399  $media_item->setThumbTried($item_rec["tried_thumb"]);
400  $media_item->setTextRepresentation($item_rec["text_representation"]);
401 
402  // get item parameter
403  $query = "SELECT * FROM mob_parameter WHERE med_item_id = ".
404  $ilDB->quote($item_rec["id"], "integer");
405  $par_set = $ilDB->query($query);
406  while ($par_rec = $ilDB->fetchAssoc($par_set))
407  {
408  $media_item->setParameter($par_rec["name"], $par_rec["value"]);
409  }
410 
411  // get item map areas
412  $max = ilMapArea::_getMaxNr($media_item->getId());
413  for ($i = 1; $i <= $max; $i++)
414  {
415  $area =& new ilMapArea($media_item->getId(), $i);
416  $media_item->addMapArea($area);
417  }
418 
419  // add media item to media object
420  $a_mob->addMediaItem($media_item);
421  }
422  }
_getMaxNr($a_item_id)
get maximum nr of media item (static)
Class ilMapArea.
ilMediaItem($a_id=0)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ _getMediaItemsOfMObId()

ilMediaItem::_getMediaItemsOfMObId (   $a_mobId,
  $a_purpose 
)

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

References $query.

Referenced by ilObjectFeedWriter\ilObjectFeedWriter().

355  {
356  global $ilDB;
357 
358  // read media_object record
359  $query = "SELECT * FROM media_item WHERE mob_id = ".
360  $ilDB->quote($a_mobId, "integer")." ".
361  "AND purpose=" . $ilDB->quote($a_purpose, "text")." ORDER BY nr";
362  $item_set = $ilDB->query($query);
363 
364  while ($item_rec = $ilDB->fetchAssoc($item_set))
365  {
366  return $item_rec;
367  }
368  return false;
369  }
+ Here is the caller graph for this function:

◆ _lookupLocationForMobId()

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

Lookup location for mob id.

Parameters
int$a_mob_idmedia object id
string$a_purposepurpose

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

References $query.

Referenced by ilObjMediaObject\_lookupItemPath().

311  {
312  global $ilDB;
313 
314  // read media_object record
315  $query = "SELECT * FROM media_item WHERE mob_id = ".
316  $ilDB->quote($a_mob_id, "integer")." ".
317  "AND purpose = ".$ilDB->quote($a_purpose, "text");
318  $set = $ilDB->query($query);
319  if ($rec = $ilDB->fetchAssoc($set))
320  {
321  return $rec["location"];
322  }
323 
324  return "";
325  }
+ Here is the caller graph for this function:

◆ _lookupMobId()

static ilMediaItem::_lookupMobId (   $a_med_id)
static

Lookup Mob ID.

Parameters
int$a_med_idmedia item id

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

References $query.

Referenced by ilMapArea\_getMobsForTarget().

333  {
334  global $ilDB;
335 
336  // read media_object record
337  $query = "SELECT * FROM media_item WHERE id = ".
338  $ilDB->quote($a_med_id, "integer");
339  $set = $ilDB->query($query);
340  if ($rec = $ilDB->fetchAssoc($set))
341  {
342  return $rec["mob_id"];
343  }
344 
345  return "";
346  }
+ Here is the caller graph for this function:

◆ _resolveMapAreaLinks()

ilMediaItem::_resolveMapAreaLinks (   $a_mob_id)

resolve internal links of all media items of a media object

Parameters
int$a_mob_idmedia object id

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

References $query, and ilMapArea\_resolveIntLinks().

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

1118  {
1119  global $ilDB;
1120 
1121 //echo "mediaItems::resolve<br>";
1122  // read media_object record
1123  $query = "SELECT * FROM media_item WHERE mob_id = ".
1124  $ilDB->quote($a_mob_id, "integer")." ".
1125  "ORDER BY nr";
1126  $item_set = $ilDB->query($query);
1127  while ($item_rec = $ilDB->fetchAssoc($item_set))
1128  {
1129  ilMapArea::_resolveIntLinks($item_rec["id"]);
1130  }
1131  }
_resolveIntLinks($a_item_id)
resolve internal links of an item id
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ addAreaToMapWorkCopy()

ilMediaItem::addAreaToMapWorkCopy (   $a_shape,
  $a_coords 
)

draw a new area in work image

Parameters
string$a_shapeshape
string$a_coordscoordinates string

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

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

945  {
946  $this->buildMapWorkImage();
947 
948  // determine ratios
949  $size = @getimagesize($this->getMapWorkCopyName());
950  $x_ratio = 1;
951  if ($size[0] > 0 && $this->getWidth() > 0)
952  {
953  $x_ratio = $this->getWidth() / $size[0];
954  }
955  $y_ratio = 1;
956  if ($size[1] > 0 && $this->getHeight() > 0)
957  {
958  $y_ratio = $this->getHeight() / $size[1];
959  }
960 
961  // add new area to work image
962  $area = new ilMapArea();
963  $area->setShape($a_shape);
964  $area->setCoords($a_coords);
965  $area->draw($this->getMapWorkImage(), $this->color1, $this->color2, false,
966  $x_ratio, $y_ratio);
967 
968  $this->saveMapWorkImage();
969  }
$size
Definition: RandomTest.php:79
getWidth()
get width
buildMapWorkImage()
build image map work image
& getMapWorkImage()
get image map work image
getMapWorkCopyName($a_reference_copy=false)
Get name of image map work copy file.
saveMapWorkImage()
save image map work image
Class ilMapArea.
getHeight()
get height
+ Here is the call graph for this function:

◆ addMapArea()

ilMediaItem::addMapArea ( $a_map_area)

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

References $map_cnt.

Referenced by read().

505  {
506  $this->mapareas[$this->map_cnt] =& $a_map_area;
507  $this->map_cnt++;
508  }
+ Here is the caller graph for this function:

◆ buildMapWorkImage()

ilMediaItem::buildMapWorkImage ( )

build image map work image

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

References getMapWorkCopyName(), and getMapWorkCopyType().

Referenced by addAreaToMapWorkCopy(), and makeMapWorkCopy().

990  {
991  $im_type = strtolower($this->getMapWorkCopyType());
992 
993  switch ($im_type)
994  {
995  case "gif":
996  $this->map_image = ImageCreateFromGIF($this->getMapWorkCopyName());
997  break;
998 
999  case "jpg":
1000  $this->map_image = ImageCreateFromJPEG($this->getMapWorkCopyName());
1001  break;
1002 
1003  case "png":
1004  $this->map_image = ImageCreateFromPNG($this->getMapWorkCopyName());
1005  break;
1006  }
1007 
1008  // try to allocate black and white as color. if this is not possible, get the closest colors
1009  if (imagecolorstotal($this->map_image) > 250)
1010  {
1011  $this->color1 = imagecolorclosest($this->map_image, 0, 0, 0);
1012  $this->color2 = imagecolorclosest($this->map_image, 255, 255, 255);
1013  }
1014  else
1015  {
1016  $this->color1 = imagecolorallocate($this->map_image, 0, 0, 0);
1017  $this->color2 = imagecolorallocate($this->map_image, 255, 255, 255);
1018  }
1019  }
getMapWorkCopyType()
get image type of image map work copy
getMapWorkCopyName($a_reference_copy=false)
Get name of image map work copy file.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ copyOriginal()

ilMediaItem::copyOriginal ( )

Copy the orginal file.

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

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

Referenced by makeMapWorkCopy().

845  {
846  global $lng;
847  $this->createWorkDirectory();
848 
849  if ($this->getLocationType() != "Reference")
850  {
851  ilUtil::convertImage($this->getDirectory()."/".$this->getLocation(),
852  $this->getMapWorkCopyName(),
853  $this->getMapWorkCopyType());
854  }
855  else
856  {
857  // first copy the external file, if necessary
858  if (!is_file($this->getMapWorkCopyName(true)) || (filesize($this->getMapWorkCopyName(true)) == 0))
859  {
860  $handle = @fopen($this->getLocation(), "r");
861  $lcopy = fopen($this->getMapWorkCopyName(true), "w");
862  if ($handle && $lcopy)
863  {
864  while (!feof($handle))
865  {
866  $content = fread($handle, 4096);
867  fwrite($lcopy, $content);
868  }
869  }
870  @fclose($lcopy);
871  @fclose($handle);
872  }
873 
874  // now, create working copy
876  $this->getMapWorkCopyName(),
877  $this->getMapWorkCopyType());
878  }
879 
880  if (!is_file($this->getMapWorkCopyName()))
881  {
882 
883  ilUtil::sendFailure($lng->txt("cont_map_file_not_generated"));
884  return false;
885  }
886  return true;
887  }
getMapWorkCopyType()
get image type of image map work copy
getMapWorkCopyName($a_reference_copy=false)
Get name of image map work copy file.
getDirectory()
get media file directory
static sendFailure($a_info="", $a_keep=false)
Send Failure Message to Screen.
createWorkDirectory()
create work directory for image map editing
static convertImage($a_from, $a_to, $a_target_format="", $a_geometry="", $a_background_color="")
convert image
global $lng
Definition: privfeed.php:40
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ create()

ilMediaItem::create ( )

create persistent media item

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

References $query, getCaption(), getFormat(), getHAlign(), getHeight(), getId(), getLocation(), getLocationType(), getMobId(), getNr(), getParameters(), getPurpose(), getTextRepresentation(), getWidth(), and setId().

127  {
128  global $ilDB;
129 
130  $item_id = $ilDB->nextId("media_item");
131  $query = "INSERT INTO media_item (id,mob_id, purpose, location, ".
132  "location_type, format, width, ".
133  "height, halign, caption, nr, text_representation) VALUES ".
134  "(".
135  $ilDB->quote($item_id, "integer").",".
136  $ilDB->quote($this->getMobId(), "integer").",".
137  $ilDB->quote($this->getPurpose(), "text").",".
138  $ilDB->quote($this->getLocation(), "text").",".
139  $ilDB->quote($this->getLocationType(), "text").",".
140  $ilDB->quote($this->getFormat(), "text").",".
141  $ilDB->quote($this->getWidth(), "text").",".
142  $ilDB->quote($this->getHeight(), "text").",".
143  $ilDB->quote($this->getHAlign(), "text").",".
144  $ilDB->quote($this->getCaption(), "text").",".
145  $ilDB->quote($this->getNr(), "integer").",".
146  $ilDB->quote($this->getTextRepresentation(), "text").")";
147  $ilDB->manipulate($query);
148 
149  $this->setId($item_id);
150 
151  // create mob parameters
152  $params = $this->getParameters();
153  foreach($params as $name => $value)
154  {
155  $query = "INSERT INTO mob_parameter (med_item_id, name, value) VALUES ".
156  "(".$ilDB->quote($item_id, "integer").",".
157  $ilDB->quote($name, "text").",".
158  $ilDB->quote($value, "text").")";
159  $ilDB->manipulate($query);
160  }
161 
162  // create map areas
163  for ($i=0; $i < count($this->mapareas); $i++)
164  {
165  if (is_object($this->mapareas[$i]))
166  {
167  $this->mapareas[$i]->setItemId($this->getId());
168  $this->mapareas[$i]->setNr($i + 1);
169  $this->mapareas[$i]->create();
170  }
171  }
172  }
getId()
get media item id
getWidth()
get width
setId($a_id)
set media item id
getMobId()
get id of parent media object
getCaption()
get caption
getParameters()
get all parameters (in array)
getHAlign()
get horizontal align
getTextRepresentation()
Get text representation.
getHeight()
get height
+ Here is the call graph for this function:

◆ createWorkDirectory()

ilMediaItem::createWorkDirectory ( )

create work directory for image map editing

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

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

Referenced by copyOriginal().

715  {
716  if(!@is_dir(ilUtil::getDataDir()."/map_workfiles"))
717  {
718  ilUtil::createDirectory(ilUtil::getDataDir()."/map_workfiles");
719  }
720  $work_dir = $this->getWorkDirectory();
721  if(!@is_dir($work_dir))
722  {
723  ilUtil::createDirectory($work_dir);
724  }
725  }
getWorkDirectory()
get work directory for image map editing
static createDirectory($a_dir, $a_mod=0755)
create directory
static getDataDir()
get data directory (outside webspace)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ deleteAllItemsOfMob()

ilMediaItem::deleteAllItemsOfMob (   $a_mob_id)

static

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

References $query.

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

428  {
429  global $ilDB;
430 
431  // iterate all media items ob mob
432  $query = "SELECT * FROM media_item WHERE mob_id = ".
433  $ilDB->quote($a_mob_id, "integer");
434  $item_set = $ilDB->query($query);
435  while ($item_rec = $ilDB->fetchAssoc($item_set))
436  {
437  // delete all parameters of media item
438  $query = "DELETE FROM mob_parameter WHERE med_item_id = ".
439  $ilDB->quote($item_rec["id"], "integer");
440  $ilDB->manipulate($query);
441 
442  // delete all map areas of media item
443  $query = "DELETE FROM map_area WHERE item_id = ".
444  $ilDB->quote($item_rec["id"], "integer");
445  $ilDB->manipulate($query);
446  }
447 
448  // delete media items
449  $query = "DELETE FROM media_item WHERE mob_id = ".
450  $ilDB->quote($a_mob_id, "integer");
451  $ilDB->manipulate($query);
452  }
+ Here is the caller graph for this function:

◆ deleteMapArea()

ilMediaItem::deleteMapArea (   $nr)

delete map area

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

References $map_cnt.

514  {
515  for ($i=1; $i<=$this->map_cnt; $i++)
516  {
517  if($i > $nr)
518  {
519  $this->mapareas[$i-2] =& $this->mapareas[$i-1];
520  $this->mapareas[$i-2]->setNr($i-1);
521  }
522  }
523  if($nr <= $this->map_cnt)
524  {
525  unset($this->mapareas[$this->map_cnt - 1]);
526  $this->map_cnt--;
527  }
528  }

◆ extractUrlParameters()

ilMediaItem::extractUrlParameters ( )

Extract parameters of special external references to parameter array.

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

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

1163  {
1164  include_once("./Services/MediaObjects/classes/class.ilExternalMediaAnalyzer.php");
1166  $this->getLocation(), $this->getParameters());
1167  foreach ($par as $k => $v)
1168  {
1169  $this->setParameter($k, $v);
1170  }
1171  }
static extractUrlParameters($a_location, $a_parameter)
Extract URL information to parameter array.
getParameters()
get all parameters (in array)
setParameter($a_name, $a_value)
set parameter
+ Here is the call graph for this function:

◆ getCaption()

ilMediaItem::getCaption ( )

get caption

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

References $caption.

Referenced by create(), and update().

618  {
619  return $this->caption;
620  }
+ Here is the caller graph for this function:

◆ getDirectory()

ilMediaItem::getDirectory ( )

get media file directory

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

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

Referenced by copyOriginal(), and getThumbnailTarget().

772  {
773  return ilObjMediaObject::_getDirectory($this->getMobId());
774  }
getMobId()
get id of parent media object
_getDirectory($a_mob_id)
get directory for files of media object (static)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getFormat()

ilMediaItem::getFormat ( )

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

References $format.

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

490  {
491  return $this->format;
492  }
+ Here is the caller graph for this function:

◆ getHAlign()

ilMediaItem::getHAlign ( )

get horizontal align

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

References $halign.

Referenced by create(), and update().

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

◆ getHeight()

ilMediaItem::getHeight ( )

get height

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

References $height.

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

566  {
567  return $this->height;
568  }
+ Here is the caller graph for this function:

◆ getId()

ilMediaItem::getId ( )

get media item id

Returns
int media item id

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

References $id.

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

65  {
66  return $this->id;
67  }
+ Here is the caller graph for this function:

◆ getLocation()

ilMediaItem::getLocation ( )

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

References $location.

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

470  {
471  return $this->location;
472  }
+ Here is the caller graph for this function:

◆ getLocationType()

ilMediaItem::getLocationType ( )

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

References $location_type.

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

480  {
481  return $this->location_type;
482  }
+ Here is the caller graph for this function:

◆ getMapArea()

& ilMediaItem::getMapArea (   $nr)

get map area

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

534  {
535  return $this->mapareas[$nr-1];
536  }

◆ getMapAreas()

ilMediaItem::getMapAreas ( )

get map areas

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

References $mapareas.

542  {
543  return $this->mapareas;
544  }

◆ getMapAreasXML()

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

get xml code of media items' areas

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

References IL_INT_LINK.

1060  {
1061  $xml = "";
1062 
1063  // build xml of map areas
1064  for ($i=0; $i < count($this->mapareas); $i++)
1065  {
1066  $area =& $this->mapareas[$i];
1067 
1068  // highlight mode
1069  $hm = "";
1070  if ($area->getHighlightMode() != "")
1071  {
1072  $hm = ' HighlightMode="'.$area->getHighlightMode().'" ';
1073  $hcl = ($area->getHighlightClass() != "")
1074  ? $area->getHighlightClass()
1075  : "Accented";
1076  $hm.= 'HighlightClass="'.$hcl.'" ';
1077  }
1078 
1079  $xml .= "<MapArea Shape=\"".$area->getShape()."\" Coords=\"".$area->getCoords()."\" ".$hm.">";
1080  if ($area->getLinkType() == IL_INT_LINK)
1081  {
1082  $target_frame = $area->getTargetFrame();
1083 
1084  if ($area->getType() == "GlossaryItem" && $target_frame == "")
1085  {
1086  $target_frame = "Glossary";
1087  }
1088 
1089  $tf_str = ($target_frame == "")
1090  ? ""
1091  : "TargetFrame=\"".$target_frame."\"";
1092 
1093  $xml .= "<IntLink Target=\"".$area->getTarget($a_insert_inst, $a_inst)."\" Type=\"".
1094  $area->getType()."\" $tf_str>";
1095  $xml .= $area->getTitle();
1096  $xml .="</IntLink>";
1097  }
1098  else
1099  {
1100  $xml .= "<ExtLink Href=\"".str_replace("&", "&amp;",$area->getHref())."\" Title=\"".
1101  $area->getExtTitle()."\">";
1102  $xml .= $area->getTitle();
1103  $xml .="</ExtLink>";
1104  }
1105  $xml .= "</MapArea>";
1106  }
1107 
1108  return $xml;
1109  }
const IL_INT_LINK

◆ getMapWorkCopyName()

ilMediaItem::getMapWorkCopyName (   $a_reference_copy = false)

Get name of image map work copy file.

Parameters
stringGet name, for copy of external referenced image

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

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

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

751  {
752  $file_arr = explode("/", $this->getLocation());
753  $o_file = $file_arr[count($file_arr) - 1];
754  $file_arr = explode(".", $o_file);
755  unset($file_arr[count($file_arr) - 1]);
756  $file = implode($file_arr, ".");
757 
758  if (!$a_reference_copy)
759  {
760  return $this->getWorkDirectory()."/".$file.".".$this->getMapWorkCopyType();
761  }
762  else
763  {
764  return $this->getWorkDirectory()."/l_copy_".$o_file;
765  }
766  }
print $file
getMapWorkCopyType()
get image type of image map work copy
getWorkDirectory()
get work directory for image map editing
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getMapWorkCopyType()

ilMediaItem::getMapWorkCopyType ( )

get image type of image map work copy

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

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

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

741  {
743  }
getSuffix()
get location suffix
static getGDSupportedImageType($a_desired_type)
returns the best supported image type by this PHP build
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getMapWorkImage()

& ilMediaItem::getMapWorkImage ( )

get image map work image

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

References $map_image.

Referenced by addAreaToMapWorkCopy(), and makeMapWorkCopy().

1051  {
1052  return $this->map_image;
1053  }
+ Here is the caller graph for this function:

◆ getMobId()

ilMediaItem::getMobId ( )

get id of parent media object

Returns
int media object id

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

References $mob_id.

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

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

◆ getNr()

ilMediaItem::getNr ( )

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

References $nr.

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

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

◆ getOriginalSize()

ilMediaItem::getOriginalSize ( )

get original size

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

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

582  {
583  $mob_dir = ilObjMediaObject::_getDirectory($this->getMobId());
584 
585  if (ilUtil::deducibleSize($this->getFormat()))
586  {
587  if ($this->getLocationType() == "LocalFile")
588  {
589  $loc = $mob_dir."/".$this->getLocation();
590  }
591  else
592  {
593  $loc = $this->getLocation();
594  }
595  $size = @getimagesize($loc);
596 
597  if ($size[0] > 0 && $size[1] > 0)
598  {
599  return array("width" => $size[0], "height" => $size[1]);
600  }
601  }
602 
603  return false;
604  }
$size
Definition: RandomTest.php:79
getMobId()
get id of parent media object
static deducibleSize($a_mime)
checks if mime type is provided by getimagesize()
_getDirectory($a_mob_id)
get directory for files of media object (static)
+ Here is the call graph for this function:

◆ getParameter()

ilMediaItem::getParameter (   $a_name)

get a single parameter

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

699  {
700  return $this->parameters[$a_name];
701  }

◆ getParameters()

ilMediaItem::getParameters ( )

get all parameters (in array)

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

References $parameters.

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

681  {
682  return $this->parameters;
683  }
+ Here is the caller graph for this function:

◆ getParameterString()

ilMediaItem::getParameterString ( )

get all parameters (as string)

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

References ilUtil\assembleParameterString().

690  {
691  return ilUtil::assembleParameterString($this->parameters);
692  }
static assembleParameterString($a_par_arr)
+ Here is the call graph for this function:

◆ getPurpose()

ilMediaItem::getPurpose ( )

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

References $purpose.

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

460  {
461  return $this->purpose;
462  }
+ Here is the caller graph for this function:

◆ getSuffix()

ilMediaItem::getSuffix ( )

get location suffix

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

References getLocation().

Referenced by getMapWorkCopyType().

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

◆ getTextRepresentation()

ilMediaItem::getTextRepresentation ( )

Get text representation.

Returns
string text representation

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

Referenced by create(), and update().

118  {
119  return $this->text_representation;
120  }
+ Here is the caller graph for this function:

◆ getThumbnailDirectory()

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

get media file directory

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

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

Referenced by getThumbnailTarget().

780  {
781  return ilObjMediaObject::_getThumbnailDirectory($this->getMobId(), $a_mode);
782  }
getMobId()
get id of parent media object
_getThumbnailDirectory($a_mob_id, $a_mode="filesystem")
get directory for files of media object (static)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getThumbnailTarget()

ilMediaItem::getThumbnailTarget (   $a_size = "")

get thumbnail target

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

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

788  {
789  if (is_int(strpos($this->getFormat(), "image")))
790  {
791  $thumb_file = $this->getThumbnailDirectory()."/".
792  $this->getPurpose().".jpeg";
793 
794  $thumb_file_small = $this->getThumbnailDirectory()."/".
795  $this->getPurpose()."_small.jpeg";
796 
797  // generate thumbnail (if not tried before)
798  if ($this->getThumbTried() == "n" && $this->getLocationType() == "LocalFile")
799  {
800  if (is_file($thumb_file))
801  {
802  unlink($thumb_file);
803  }
804  if (is_file($thumb_file_small))
805  {
806  unlink($thumb_file_small);
807  }
808  $this->writeThumbTried("y");
810  $med_file = $this->getDirectory()."/".$this->getLocation();
811 
812  if (is_file($med_file))
813  {
814  ilUtil::convertImage($med_file, $thumb_file, "jpeg", "80");
815  ilUtil::convertImage($med_file, $thumb_file_small, "jpeg", "40");
816  }
817  }
818 
819  if ($a_size == "small")
820  {
821  if (is_file($thumb_file_small))
822  {
823  return $this->getThumbnailDirectory("output")."/".
824  $this->getPurpose()."_small.jpeg?dummy=".rand(1, 999999);
825  }
826  }
827  else
828  {
829  if (is_file($thumb_file))
830  {
831  return $this->getThumbnailDirectory("output")."/".
832  $this->getPurpose().".jpeg?dummy=".rand(1, 999999);
833  }
834  }
835  }
836 
837  return "";
838  }
getMobId()
get id of parent media object
_createThumbnailDirectory($a_obj_id)
Create thumbnail directory.
getThumbnailDirectory($a_mode="filesystem")
get media file directory
getDirectory()
get media file directory
static convertImage($a_from, $a_to, $a_target_format="", $a_geometry="", $a_background_color="")
convert image
writeThumbTried($a_tried)
write thumbnail creation try data ("y"/"n")
+ Here is the call graph for this function:

◆ getThumbTried()

ilMediaItem::getThumbTried ( )

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

Referenced by getThumbnailTarget().

500  {
501  return $this->tried_thumb;
502  }
+ Here is the caller graph for this function:

◆ getWidth()

ilMediaItem::getWidth ( )

get width

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

References $width.

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

550  {
551  return $this->width;
552  }
+ Here is the caller graph for this function:

◆ getWorkDirectory()

ilMediaItem::getWorkDirectory ( )

get work directory for image map editing

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

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

Referenced by createWorkDirectory(), and getMapWorkCopyName().

707  {
708  return ilUtil::getDataDir()."/map_workfiles/item_".$this->getId();
709  }
getId()
get media item id
static getDataDir()
get data directory (outside webspace)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ ilMediaItem()

ilMediaItem::ilMediaItem (   $a_id = 0)

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

References read(), and setId().

Referenced by _getMediaItemsOfMOb().

37  {
38  $this->parameters = array();
39  $this->mapareas = array();
40  $this->map_cnt = 0;
41 
42  if ($a_id != 0)
43  {
44  $this->setId($a_id);
45  $this->read();
46  }
47  }
setId($a_id)
set media item id
read()
read media item data (item id or (mob_id and nr) must be set)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ makeMapWorkCopy()

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

make map work copy of image

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

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

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

896  {
897  global $lng;
898 
899  if (!$this->copyOriginal())
900  {
901  return false;
902  }
903  $this->buildMapWorkImage();
904 
905  // determine ratios
906  $size = @getimagesize($this->getMapWorkCopyName());
907  $x_ratio = 1;
908  if ($size[0] > 0 && $this->getWidth() > 0)
909  {
910  $x_ratio = $this->getWidth() / $size[0];
911  }
912  $y_ratio = 1;
913  if ($size[1] > 0 && $this->getHeight() > 0)
914  {
915  $y_ratio = $this->getHeight() / $size[1];
916  }
917 
918  // draw map areas
919  for ($i=0; $i < count($this->mapareas); $i++)
920  {
921  if ( ((($i+1) == $a_area_nr) && !$a_exclude) ||
922  ((($i+1) != $a_area_nr) && $a_exclude) ||
923  ($a_area_nr == 0)
924  )
925  {
926  $area =& $this->mapareas[$i];
927  $area->draw($this->getMapWorkImage(), $this->color1, $this->color2, true,
928  $x_ratio, $y_ratio);
929  }
930  }
931 
932  $this->saveMapWorkImage();
933 
934  return true;
935  }
$size
Definition: RandomTest.php:79
getWidth()
get width
copyOriginal()
Copy the orginal file.
buildMapWorkImage()
build image map work image
& getMapWorkImage()
get image map work image
getMapWorkCopyName($a_reference_copy=false)
Get name of image map work copy file.
saveMapWorkImage()
save image map work image
global $lng
Definition: privfeed.php:40
getHeight()
get height
+ Here is the call graph for this function:

◆ outputMapWorkCopy()

ilMediaItem::outputMapWorkCopy ( )

output raw map work copy file

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

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

975  {
976  if ($this->getMapWorkCopyType() != "")
977  {
978  header("Pragma: no-cache");
979  header("Expires: 0");
980  header("Content-type: image/".strtolower($this->getMapWorkCopyType()));
981  readfile($this->getMapWorkCopyName());
982  }
983  exit;
984  }
exit
Definition: login.php:54
getMapWorkCopyType()
get image type of image map work copy
getMapWorkCopyName($a_reference_copy=false)
Get name of image map work copy file.
+ Here is the call graph for this function:

◆ read()

ilMediaItem::read ( )

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

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

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

Referenced by ilMediaItem().

233  {
234  global $ilDB;
235 
236  $item_id = $this->getId();
237  $mob_id = $this->getMobId();
238  $nr = $this->getNr();
239  $query = "";
240  if($item_id > 0)
241  {
242  $query = "SELECT * FROM media_item WHERE id = ".
243  $ilDB->quote($this->getId(), "integer");
244  }
245  else if ($mob_id > 0 && $nr > 0)
246  {
247  $query = "SELECT * FROM media_item WHERE mob_id = ".
248  $ilDB->quote($this->getMobId(), "integer")." ".
249  "AND nr=".$ilDB->quote($this->getNr(), "integer");
250  }
251  if ($query != "")
252  {
253  $item_set = $ilDB->query($query);
254  $item_rec = $ilDB->fetchAssoc($item_set);
255 
256  $this->setLocation($item_rec["location"]);
257  $this->setLocationType($item_rec["location_type"]);
258  $this->setFormat($item_rec["format"]);
259  $this->setWidth($item_rec["width"]);
260  $this->setHeight($item_rec["height"]);
261  $this->setHAlign($item_rec["halign"]);
262  $this->setCaption($item_rec["caption"]);
263  $this->setPurpose($item_rec["purpose"]);
264  $this->setNr($item_rec["nr"]);
265  $this->setMobId($item_rec["mob_id"]);
266  $this->setId($item_rec["id"]);
267  $this->setThumbTried($item_rec["tried_thumb"]);
268  $this->setTextRepresentation($item_rec["text_representation"]);
269 
270  // get item parameter
271  $query = "SELECT * FROM mob_parameter WHERE med_item_id = ".
272  $ilDB->quote($this->getId(), "integer");
273  $par_set = $ilDB->query($query);
274  while ($par_rec = $ilDB->fetchAssoc($par_set))
275  {
276  $this->setParameter($par_rec["name"], $par_rec["value"]);
277  }
278 
279  // get item map areas
280  $max = ilMapArea::_getMaxNr($this->getId());
281  for ($i = 1; $i <= $max; $i++)
282  {
283  $area =& new ilMapArea($this->getId(), $i);
284  $this->addMapArea($area);
285  }
286  }
287 
288  }
setCaption($a_caption)
set caption
getId()
get media item id
setId($a_id)
set media item id
setThumbTried($a_tried)
setLocation($a_location)
setHeight($a_height)
set height
getMobId()
get id of parent media object
setNr($a_nr)
set number of media item within media object
addMapArea(&$a_map_area)
setPurpose($a_purpose)
_getMaxNr($a_item_id)
get maximum nr of media item (static)
setMobId($a_mob_id)
set id of parent media object
setHAlign($a_halign)
set horizontal align
setTextRepresentation($a_val)
Set text representation.
Class ilMapArea.
setFormat($a_format)
setWidth($a_width)
set width
setParameter($a_name, $a_value)
set parameter
setLocationType($a_type)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ resetParameters()

ilMediaItem::resetParameters ( )

reset parameters

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

Referenced by setParameters().

654  {
655  $this->parameters = array();
656  }
+ Here is the caller graph for this function:

◆ saveMapWorkImage()

ilMediaItem::saveMapWorkImage ( )

save image map work image

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

References getMapWorkCopyName(), and getMapWorkCopyType().

Referenced by addAreaToMapWorkCopy(), and makeMapWorkCopy().

1025  {
1026  $im_type = strtolower($this->getMapWorkCopyType());
1027 
1028  // save image work-copy and free memory
1029  switch ($im_type)
1030  {
1031  case "gif":
1032  ImageGIF($this->map_image, $this->getMapWorkCopyName());
1033  break;
1034 
1035  case "jpg":
1036  ImageJPEG($this->map_image, $this->getMapWorkCopyName());
1037  break;
1038 
1039  case "png":
1040  ImagePNG($this->map_image, $this->getMapWorkCopyName());
1041  break;
1042  }
1043 
1044  ImageDestroy($this->map_image);
1045  }
getMapWorkCopyType()
get image type of image map work copy
getMapWorkCopyName($a_reference_copy=false)
Get name of image map work copy file.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ setCaption()

ilMediaItem::setCaption (   $a_caption)

set caption

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

Referenced by read().

610  {
611  $this->caption = $a_caption;
612  }
+ Here is the caller graph for this function:

◆ setFormat()

ilMediaItem::setFormat (   $a_format)

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

Referenced by read().

485  {
486  $this->format = $a_format;
487  }
+ Here is the caller graph for this function:

◆ setHAlign()

ilMediaItem::setHAlign (   $a_halign)

set horizontal align

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

Referenced by read().

626  {
627  $this->halign = $a_halign;
628  }
+ Here is the caller graph for this function:

◆ setHeight()

ilMediaItem::setHeight (   $a_height)

set height

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

Referenced by read().

574  {
575  $this->height = $a_height;
576  }
+ Here is the caller graph for this function:

◆ setId()

ilMediaItem::setId (   $a_id)

set media item id

Parameters
int$a_idmedia item id

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

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

55  {
56  $this->id = $a_id;
57  }
+ Here is the caller graph for this function:

◆ setLocation()

ilMediaItem::setLocation (   $a_location)

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

Referenced by read().

465  {
466  $this->location = $a_location;
467  }
+ Here is the caller graph for this function:

◆ setLocationType()

ilMediaItem::setLocationType (   $a_type)

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

Referenced by read().

475  {
476  $this->location_type = $a_type;
477  }
+ Here is the caller graph for this function:

◆ setMobId()

ilMediaItem::setMobId (   $a_mob_id)

set id of parent media object

Parameters
int$a_mob_idmedia object id

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

Referenced by read().

75  {
76  $this->mob_id = $a_mob_id;
77  }
+ Here is the caller graph for this function:

◆ setNr()

ilMediaItem::setNr (   $a_nr)

set number of media item within media object

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

Referenced by read().

93  {
94  $this->nr = $a_nr;
95  }
+ Here is the caller graph for this function:

◆ setParameter()

ilMediaItem::setParameter (   $a_name,
  $a_value 
)

set parameter

Parameters
string$a_nameparameter name
string$a_valueparameter value

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

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

646  {
647  $this->parameters[$a_name] = $a_value;
648  }
+ Here is the caller graph for this function:

◆ setParameters()

ilMediaItem::setParameters (   $a_par)

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

Parameters
string$a_parparameter string

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

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

664  {
665  $this->resetParameters();
666  $par_arr = ilUtil::extractParameterString($a_par);
667  if(is_array($par_arr))
668  {
669  foreach($par_arr as $par => $val)
670  {
671  $this->setParameter($par, $val);
672  }
673  }
674  }
resetParameters()
reset parameters
static extractParameterString($a_parstr)
extracts parameter value pairs from a string into an array
setParameter($a_name, $a_value)
set parameter
+ Here is the call graph for this function:

◆ setPurpose()

ilMediaItem::setPurpose (   $a_purpose)

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

Referenced by read().

455  {
456  $this->purpose = $a_purpose;
457  }
+ Here is the caller graph for this function:

◆ setTextRepresentation()

ilMediaItem::setTextRepresentation (   $a_val)

Set text representation.

Parameters
stringtext representation

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

Referenced by read().

108  {
109  $this->text_representation = $a_val;
110  }
+ Here is the caller graph for this function:

◆ setThumbTried()

ilMediaItem::setThumbTried (   $a_tried)

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

Referenced by read().

495  {
496  $this->tried_thumb = $a_tried;
497  }
+ Here is the caller graph for this function:

◆ setWidth()

ilMediaItem::setWidth (   $a_width)

set width

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

Referenced by read().

558  {
559  $this->width = $a_width;
560  }
+ Here is the caller graph for this function:

◆ update()

ilMediaItem::update ( )

update media item data (without map areas!)

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

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

178  {
179  global $ilDB;
180 
181  $query = "UPDATE media_item SET ".
182  " mob_id = ".$ilDB->quote($this->getMobId(), "integer").",".
183  " purpose = ".$ilDB->quote($this->getPurpose(), "text").",".
184  " location = ".$ilDB->quote($this->getLocation(), "text").",".
185  " location_type = ".$ilDB->quote($this->getLocationType(), "text").",".
186  " format = ".$ilDB->quote($this->getFormat(), "text").",".
187  " width = ".$ilDB->quote($this->getWidth(), "text").",".
188  " height = ".$ilDB->quote($this->getHeight(), "text").",".
189  " halign = ".$ilDB->quote($this->getHAlign(), "text").",".
190  " caption = ".$ilDB->quote($this->getCaption(), "text").",".
191  " nr = ".$ilDB->quote($this->getNr(), "integer").",".
192  " text_representation = ".$ilDB->quote($this->getTextRepresentation(), "text").
193  " WHERE id = ".$ilDB->quote($this->getId(), "integer");
194  $ilDB->manipulate($query);
195 
196  // delete mob parameters
197  $query = "DELETE FROM mob_parameter WHERE med_item_id = ".
198  $ilDB->quote($this->getId(), "integer");
199 
200  // create mob parameters
201  $params = $this->getParameters();
202  foreach($params as $name => $value)
203  {
204  $query = "INSERT INTO mob_parameter (med_item_id, name, value) VALUES ".
205  "(".$ilDB->quote($this->getId(), "integer").",".
206  $ilDB->quote($name, "text").",".
207  $ilDB->quote($value, "text").")";
208  $ilDB->manipulate($query);
209  }
210  }
getId()
get media item id
getWidth()
get width
getMobId()
get id of parent media object
getCaption()
get caption
getParameters()
get all parameters (in array)
getHAlign()
get horizontal align
getTextRepresentation()
Get text representation.
getHeight()
get height
+ Here is the call graph for this function:

◆ writeParameter()

ilMediaItem::writeParameter (   $a_name,
  $a_value 
)

Write parameter.

Parameters

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

References $query, and getId().

219  {
220  global $ilDB;
221 
222  $query = "INSERT INTO mob_parameter (med_item_id, name, value) VALUES ".
223  "(".$ilDB->quote($this->getId(), "integer").",".
224  $ilDB->quote($a_name, "text").",".
225  $ilDB->quote($a_value, "text").")";
226  $ilDB->manipulate($query);
227  }
getId()
get media item id
+ Here is the call graph for this function:

◆ writeThumbTried()

ilMediaItem::writeThumbTried (   $a_tried)

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

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

References getId().

Referenced by getThumbnailTarget().

294  {
295  global $ilDB;
296 
297  $q = "UPDATE media_item SET tried_thumb = ".
298  $ilDB->quote($a_tried, "text").
299  " WHERE id = ".$ilDB->quote($this->getId(), "integer");
300 
301  $ilDB->manipulate($q);
302  }
getId()
get media item id
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

Field Documentation

◆ $caption

ilMediaItem::$caption

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

Referenced by getCaption().

◆ $color1

ilMediaItem::$color1

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

◆ $color2

ilMediaItem::$color2

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

◆ $format

ilMediaItem::$format

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

Referenced by getFormat().

◆ $halign

ilMediaItem::$halign

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

Referenced by getHAlign().

◆ $height

ilMediaItem::$height

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

Referenced by getHeight().

◆ $id

ilMediaItem::$id

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

Referenced by getId().

◆ $location

ilMediaItem::$location

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

Referenced by getLocation().

◆ $location_type

ilMediaItem::$location_type

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

Referenced by getLocationType().

◆ $map_cnt

ilMediaItem::$map_cnt

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

Referenced by addMapArea(), and deleteMapArea().

◆ $map_image

ilMediaItem::$map_image

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

Referenced by getMapWorkImage().

◆ $mapareas

ilMediaItem::$mapareas

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

Referenced by getMapAreas().

◆ $mob_id

ilMediaItem::$mob_id

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

Referenced by getMobId().

◆ $nr

ilMediaItem::$nr

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

Referenced by getNr().

◆ $parameters

ilMediaItem::$parameters

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

Referenced by getParameters().

◆ $purpose

ilMediaItem::$purpose

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

Referenced by getPurpose().

◆ $width

ilMediaItem::$width

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

Referenced by getWidth().


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