ILIAS  release_5-2 Revision v5.2.25-18-g3f80b828510
ilMediaItem Class Reference

Class ilMediaItem. More...

+ Collaboration diagram for ilMediaItem:

Public Member Functions

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

Static Public Member Functions

static _lookupLocationForMobId ($a_mob_id, $a_purpose)
 Lookup location for mob id. More...
 
static _lookupMobId ($a_med_id)
 Lookup Mob ID. More...
 
static _getMediaItemsOfMObId ($a_mobId, $a_purpose)
 
static _getMediaItemsOfMOb (&$a_mob)
 read media items into media objects (static) More...
 
static deleteAllItemsOfMob ($a_mob_id)
 Delete all items of a mob. More...
 
static checkParameter ($a_par, $a_val)
 Check parameter (filter javascript related and other unsafe parameters/values) More...
 
static _resolveMapAreaLinks ($a_mob_id)
 resolve internal links of all media items of a media object More...
 
static _getMapAreasIntLinks ($a_mob_id)
 get all internal links of map areas of a mob More...
 

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.

Constructor & Destructor Documentation

◆ __construct()

ilMediaItem::__construct (   $a_id = 0)

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

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)

References read(), and setId().

+ Here is the call graph for this function:

Member Function Documentation

◆ _getMapAreasIntLinks()

static ilMediaItem::_getMapAreasIntLinks (   $a_mob_id)
static

get all internal links of map areas of a mob

Parameters
int$a_mob_idmedia object id

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

1179 {
1180 global $ilDB;
1181
1182 // read media_items records
1183 $query = "SELECT * FROM media_item WHERE mob_id = ".
1184 $ilDB->quote($a_mob_id, "integer")." ORDER BY nr";
1185
1186 $item_set = $ilDB->query($query);
1187 $links = array();
1188 while ($item_rec = $ilDB->fetchAssoc($item_set))
1189 {
1190 $map_links = ilMapArea::_getIntLinks($item_rec["id"]);
1191 foreach($map_links as $key => $map_link)
1192 {
1193 $links[$key] = $map_link;
1194 }
1195 }
1196 return $links;
1197 }
static _getIntLinks($a_item_id)
get all internal links of a media items map areas
global $ilDB

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

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

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

◆ _getMediaItemsOfMOb()

static ilMediaItem::_getMediaItemsOfMOb ( $a_mob)
static

read media items into media objects (static)

Parameters
object$a_mobmedia object

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

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 }
Class ilMapArea.
static _getMaxNr($a_item_id)
get maximum nr of media item (static)
Class ilMediaItem.

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

Referenced by ilObjMediaObject\read().

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

◆ _getMediaItemsOfMObId()

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

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

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 }

References $ilDB, and $query.

Referenced by ilObjectFeedWriter\__construct().

+ Here is the caller graph for this function:

◆ _lookupLocationForMobId()

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

Lookup location for mob id.

Parameters
int$a_mob_idmedia object id
string$a_purposepurpose

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

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 }

References $ilDB, and $query.

Referenced by ilObjMediaObject\_lookupItemPath().

+ Here is the caller graph for this function:

◆ _lookupMobId()

static ilMediaItem::_lookupMobId (   $a_med_id)
static

Lookup Mob ID.

Parameters
int$a_med_idmedia item id

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

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 }

References $ilDB, and $query.

Referenced by ilMapArea\_getMobsForTarget().

+ Here is the caller graph for this function:

◆ _resolveMapAreaLinks()

static ilMediaItem::_resolveMapAreaLinks (   $a_mob_id)
static

resolve internal links of all media items of a media object

Parameters
int$a_mob_idmedia object id

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

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

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

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

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

◆ addAreaToMapWorkCopy()

ilMediaItem::addAreaToMapWorkCopy (   $a_shape,
  $a_coords 
)

draw a new area in work image

Parameters
string$a_shapeshape
string$a_coordscoordinates string

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

983 {
984 $this->buildMapWorkImage();
985
986 // determine ratios
987 $size = @getimagesize($this->getMapWorkCopyName());
988 $x_ratio = 1;
989 if ($size[0] > 0 && $this->getWidth() > 0)
990 {
991 $x_ratio = $this->getWidth() / $size[0];
992 }
993 $y_ratio = 1;
994 if ($size[1] > 0 && $this->getHeight() > 0)
995 {
996 $y_ratio = $this->getHeight() / $size[1];
997 }
998
999 // add new area to work image
1000 $area = new ilMapArea();
1001 $area->setShape($a_shape);
1002 $area->setCoords($a_coords);
1003 $area->draw($this->getMapWorkImage(), $this->color1, $this->color2, false,
1004 $x_ratio, $y_ratio);
1005
1006 $this->saveMapWorkImage();
1007 }
$size
Definition: RandomTest.php:79
saveMapWorkImage()
save image map work image
getMapWorkCopyName($a_reference_copy=false)
Get name of image map work copy file.
buildMapWorkImage()
build image map work image
getHeight()
get height
& getMapWorkImage()
get image map work image
getWidth()
get width

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

+ Here is the call graph for this function:

◆ addMapArea()

ilMediaItem::addMapArea ( $a_map_area)

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

507 {
508 $this->mapareas[$this->map_cnt] = $a_map_area;
509 $this->map_cnt++;
510 }

References $map_cnt.

Referenced by read().

+ Here is the caller graph for this function:

◆ buildMapWorkImage()

ilMediaItem::buildMapWorkImage ( )

build image map work image

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

1028 {
1029 $im_type = strtolower($this->getMapWorkCopyType());
1030
1031 switch ($im_type)
1032 {
1033 case "gif":
1034 $this->map_image = ImageCreateFromGIF($this->getMapWorkCopyName());
1035 break;
1036
1037 case "jpg":
1038 case "jpeg":
1039 $this->map_image = ImageCreateFromJPEG($this->getMapWorkCopyName());
1040 break;
1041
1042 case "png":
1043 $this->map_image = ImageCreateFromPNG($this->getMapWorkCopyName());
1044 break;
1045 }
1046
1047 // try to allocate black and white as color. if this is not possible, get the closest colors
1048 if (imagecolorstotal($this->map_image) > 250)
1049 {
1050 $this->color1 = imagecolorclosest($this->map_image, 0, 0, 0);
1051 $this->color2 = imagecolorclosest($this->map_image, 255, 255, 255);
1052 }
1053 else
1054 {
1055 $this->color1 = imagecolorallocate($this->map_image, 0, 0, 0);
1056 $this->color2 = imagecolorallocate($this->map_image, 255, 255, 255);
1057 }
1058 }
getMapWorkCopyType()
get image type of image map work copy

References getMapWorkCopyName(), and getMapWorkCopyType().

Referenced by addAreaToMapWorkCopy(), and makeMapWorkCopy().

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

◆ checkParameter()

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

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

Parameters
string$a_parparameter
string$a_valvalue
Returns
bool

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

690 {
691 // do not allow event attributes
692 if (substr(strtolower(trim($a_par)), 0, 2) == "on")
693 {
694 return false;
695 }
696 // no javascript in value
697 if (is_int(strpos(strtolower($a_val), "javascript")))
698 {
699 return false;
700 }
701 // do not allow to change the src attribute
702 if (in_array(strtolower(trim($a_par)), array("src")))
703 {
704 return false;
705 }
706
707 return true;
708 }

Referenced by ilMediaAliasItem\setParameters().

+ Here is the caller graph for this function:

◆ copyOriginal()

ilMediaItem::copyOriginal ( )

Copy the orginal file.

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

879 {
880 global $lng;
881 $this->createWorkDirectory();
882
883 $geom = ($this->getWidth() != "" && $this->getHeight() != "")
884 ? $this->getWidth()."x".$this->getHeight()
885 : "";
886
887 if ($this->getLocationType() != "Reference")
888 {
889 ilUtil::convertImage($this->getDirectory()."/".$this->getLocation(),
890 $this->getMapWorkCopyName(),
891 $this->getMapWorkCopyType(), $geom);
892 }
893 else
894 {
895 // first copy the external file, if necessary
896 if (!is_file($this->getMapWorkCopyName(true)) || (filesize($this->getMapWorkCopyName(true)) == 0))
897 {
898 $handle = @fopen($this->getLocation(), "r");
899 $lcopy = fopen($this->getMapWorkCopyName(true), "w");
900 if ($handle && $lcopy)
901 {
902 while (!feof($handle))
903 {
904 $content = fread($handle, 4096);
905 fwrite($lcopy, $content);
906 }
907 }
908 @fclose($lcopy);
909 @fclose($handle);
910 }
911
912 // now, create working copy
914 $this->getMapWorkCopyName(),
915 $this->getMapWorkCopyType(), $geom);
916 }
917
918 if (!is_file($this->getMapWorkCopyName()))
919 {
920
921 ilUtil::sendFailure($lng->txt("cont_map_file_not_generated"));
922 return false;
923 }
924 return true;
925 }
createWorkDirectory()
create work directory for image map editing
getDirectory()
get media file directory
static sendFailure($a_info="", $a_keep=false)
Send Failure Message to Screen.
static convertImage($a_from, $a_to, $a_target_format="", $a_geometry="", $a_background_color="")
convert image
global $lng
Definition: privfeed.php:17

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

Referenced by makeMapWorkCopy().

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

◆ create()

ilMediaItem::create ( )

create persistent media item

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

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 }
getCaption()
get caption
getId()
get media item id
getHAlign()
get horizontal align
getParameters()
get all parameters (in array)
getMobId()
get id of parent media object
getTextRepresentation()
Get text representation.
$params
Definition: example_049.php:96

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

+ Here is the call graph for this function:

◆ createWorkDirectory()

ilMediaItem::createWorkDirectory ( )

create work directory for image map editing

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

749 {
750 if(!@is_dir(ilUtil::getDataDir()."/map_workfiles"))
751 {
753 }
754 $work_dir = $this->getWorkDirectory();
755 if(!@is_dir($work_dir))
756 {
757 ilUtil::createDirectory($work_dir);
758 }
759 }
getWorkDirectory()
get work directory for image map editing
static getDataDir()
get data directory (outside webspace)
static createDirectory($a_dir, $a_mod=0755)
create directory

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

Referenced by copyOriginal().

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

◆ deleteAllItemsOfMob()

static ilMediaItem::deleteAllItemsOfMob (   $a_mob_id)
static

Delete all items of a mob.

Parameters
int$a_mob_idmedia object id

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

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

References $ilDB, and $query.

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

+ Here is the caller graph for this function:

◆ deleteMapArea()

ilMediaItem::deleteMapArea (   $nr)

delete map area

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

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

References $map_cnt, and $nr.

◆ extractUrlParameters()

ilMediaItem::extractUrlParameters ( )

Extract parameters of special external references to parameter array.

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

1203 {
1204 include_once("./Services/MediaObjects/classes/class.ilExternalMediaAnalyzer.php");
1206 $this->getLocation(), $this->getParameters());
1207 foreach ($par as $k => $v)
1208 {
1209 $this->setParameter($k, $v);
1210 }
1211 }
static extractUrlParameters($a_location, $a_parameter)
Extract URL information to parameter array.
setParameter($a_name, $a_value)
set parameter

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

+ Here is the call graph for this function:

◆ getCaption()

ilMediaItem::getCaption ( )

get caption

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

621 {
622 return $this->caption;
623 }

References $caption.

Referenced by create(), and update().

+ Here is the caller graph for this function:

◆ getDirectory()

ilMediaItem::getDirectory ( )

get media file directory

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

806 {
808 }
static _getDirectory($a_mob_id)
get directory for files of media object (static)

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

Referenced by copyOriginal(), and getThumbnailTarget().

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

◆ getFormat()

ilMediaItem::getFormat ( )

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

492 {
493 return $this->format;
494 }

References $format.

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

+ Here is the caller graph for this function:

◆ getHAlign()

ilMediaItem::getHAlign ( )

get horizontal align

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

637 {
638 return $this->halign;
639 }

References $halign.

Referenced by create(), and update().

+ Here is the caller graph for this function:

◆ getHeight()

ilMediaItem::getHeight ( )

get height

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

568 {
569 return $this->height;
570 }

References $height.

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

+ Here is the caller graph for this function:

◆ getId()

ilMediaItem::getId ( )

get media item id

Returns
int media item id

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

65 {
66 return $this->id;
67 }

References $id.

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

+ Here is the caller graph for this function:

◆ getLocation()

ilMediaItem::getLocation ( )

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

472 {
473 return $this->location;
474 }

References $location.

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

+ Here is the caller graph for this function:

◆ getLocationType()

ilMediaItem::getLocationType ( )

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

482 {
484 }

References $location_type.

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

+ Here is the caller graph for this function:

◆ getMapArea()

& ilMediaItem::getMapArea (   $nr)

get map area

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

536 {
537 return $this->mapareas[$nr-1];
538 }

References $nr.

◆ getMapAreas()

ilMediaItem::getMapAreas ( )

get map areas

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

544 {
545 return $this->mapareas;
546 }

References $mapareas.

◆ getMapAreasXML()

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

get xml code of media items' areas

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

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

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

785 {
786 $file_arr = explode("/", $this->getLocation());
787 $o_file = $file_arr[count($file_arr) - 1];
788 $file_arr = explode(".", $o_file);
789 unset($file_arr[count($file_arr) - 1]);
790 $file = implode($file_arr, ".");
791
792 if (!$a_reference_copy)
793 {
794 return $this->getWorkDirectory()."/".$file.".".$this->getMapWorkCopyType();
795 }
796 else
797 {
798 return $this->getWorkDirectory()."/l_copy_".$o_file;
799 }
800 }
if(!file_exists("$old.txt")) if( $old===$new) if(file_exists("$new.txt")) $file

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

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

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

◆ getMapWorkCopyType()

ilMediaItem::getMapWorkCopyType ( )

get image type of image map work copy

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

775 {
777 }
getSuffix()
get location suffix
static getGDSupportedImageType($a_desired_type)
returns the best supported image type by this PHP build

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

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

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

◆ getMapWorkImage()

& ilMediaItem::getMapWorkImage ( )

get image map work image

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

1091 {
1092 return $this->map_image;
1093 }

References $map_image.

Referenced by addAreaToMapWorkCopy(), and makeMapWorkCopy().

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

85 {
86 return $this->mob_id;
87 }

References $mob_id.

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

+ Here is the caller graph for this function:

◆ getNr()

ilMediaItem::getNr ( )

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

98 {
99 return $this->nr;
100 }

References $nr.

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

+ Here is the caller graph for this function:

◆ getOriginalSize()

ilMediaItem::getOriginalSize ( )

get original size

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

584 {
585 $mob_dir = ilObjMediaObject::_getDirectory($this->getMobId());
586
587 if (ilUtil::deducibleSize($this->getFormat()))
588 {
589 if ($this->getLocationType() == "LocalFile")
590 {
591 $loc = $mob_dir."/".$this->getLocation();
592 }
593 else
594 {
595 $loc = $this->getLocation();
596 }
597
598 include_once("./Services/MediaObjects/classes/class.ilMediaImageUtil.php");
600 if ($size[0] > 0 && $size[1] > 0)
601 {
602 return array("width" => $size[0], "height" => $size[1]);
603 }
604 }
605
606 return false;
607 }
static getImageSize($a_location)
Get image size from location.
static deducibleSize($a_mime)
checks if mime type is provided by getimagesize()

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

+ Here is the call graph for this function:

◆ getParameter()

ilMediaItem::getParameter (   $a_name)

get a single parameter

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

733 {
734 return $this->parameters[$a_name];
735 }

◆ getParameters()

ilMediaItem::getParameters ( )

get all parameters (in array)

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

715 {
716 return $this->parameters;
717 }

References $parameters.

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

+ Here is the caller graph for this function:

◆ getParameterString()

ilMediaItem::getParameterString ( )

get all parameters (as string)

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

724 {
725 return ilUtil::assembleParameterString($this->parameters);
726 }
static assembleParameterString($a_par_arr)

References ilUtil\assembleParameterString().

+ Here is the call graph for this function:

◆ getPurpose()

ilMediaItem::getPurpose ( )

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

462 {
463 return $this->purpose;
464 }

References $purpose.

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

+ Here is the caller graph for this function:

◆ getSuffix()

ilMediaItem::getSuffix ( )

get location suffix

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

765 {
766 $loc_arr = explode(".", $this->getLocation());
767
768 return $loc_arr[count($loc_arr) - 1];
769 }

References getLocation().

Referenced by getMapWorkCopyType().

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

◆ getTextRepresentation()

ilMediaItem::getTextRepresentation ( )

Get text representation.

Returns
string text representation

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

118 {
119 return $this->text_representation;
120 }

Referenced by create(), and update().

+ Here is the caller graph for this function:

◆ getThumbnailDirectory()

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

get media file directory

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

814 {
815 return ilObjMediaObject::_getThumbnailDirectory($this->getMobId(), $a_mode);
816 }
static _getThumbnailDirectory($a_mob_id, $a_mode="filesystem")
get directory for files of media object (static)

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

Referenced by getThumbnailTarget().

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

◆ getThumbnailTarget()

ilMediaItem::getThumbnailTarget (   $a_size = "")

get thumbnail target

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

822 {
823 if (is_int(strpos($this->getFormat(), "image")))
824 {
825 $thumb_file = $this->getThumbnailDirectory()."/".
826 $this->getPurpose().".jpeg";
827
828 $thumb_file_small = $this->getThumbnailDirectory()."/".
829 $this->getPurpose()."_small.jpeg";
830
831 // generate thumbnail (if not tried before)
832 if ($this->getThumbTried() == "n" && $this->getLocationType() == "LocalFile")
833 {
834 if (is_file($thumb_file))
835 {
836 unlink($thumb_file);
837 }
838 if (is_file($thumb_file_small))
839 {
840 unlink($thumb_file_small);
841 }
842 $this->writeThumbTried("y");
844 $med_file = $this->getDirectory()."/".$this->getLocation();
845
846 if (is_file($med_file))
847 {
848 ilUtil::convertImage($med_file, $thumb_file, "jpeg", "80");
849 ilUtil::convertImage($med_file, $thumb_file_small, "jpeg", "40");
850 }
851 }
852
853 if ($a_size == "small")
854 {
855 if (is_file($thumb_file_small))
856 {
857 return $this->getThumbnailDirectory("output")."/".
858 $this->getPurpose()."_small.jpeg?dummy=".rand(1, 999999);
859 }
860 }
861 else
862 {
863 if (is_file($thumb_file))
864 {
865 return $this->getThumbnailDirectory("output")."/".
866 $this->getPurpose().".jpeg?dummy=".rand(1, 999999);
867 }
868 }
869 }
870
871 return "";
872 }
writeThumbTried($a_tried)
write thumbnail creation try data ("y"/"n")
getThumbnailDirectory($a_mode="filesystem")
get media file directory
static _createThumbnailDirectory($a_obj_id)
Create thumbnail directory.

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

+ Here is the call graph for this function:

◆ getThumbTried()

ilMediaItem::getThumbTried ( )

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

502 {
503 return $this->tried_thumb;
504 }

Referenced by getThumbnailTarget().

+ Here is the caller graph for this function:

◆ getWidth()

ilMediaItem::getWidth ( )

get width

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

552 {
553 return $this->width;
554 }

References $width.

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

+ Here is the caller graph for this function:

◆ getWorkDirectory()

ilMediaItem::getWorkDirectory ( )

get work directory for image map editing

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

741 {
742 return ilUtil::getDataDir()."/map_workfiles/item_".$this->getId();
743 }

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

Referenced by createWorkDirectory(), and getMapWorkCopyName().

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

◆ makeMapWorkCopy()

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

make map work copy of image

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

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

934 {
935 global $lng;
936
937 if (!$this->copyOriginal())
938 {
939 return false;
940 }
941 $this->buildMapWorkImage();
942
943 // determine ratios
944 $size = @getimagesize($this->getMapWorkCopyName());
945 $x_ratio = 1;
946 if ($size[0] > 0 && $this->getWidth() > 0)
947 {
948 $x_ratio = $this->getWidth() / $size[0];
949 }
950 $y_ratio = 1;
951 if ($size[1] > 0 && $this->getHeight() > 0)
952 {
953 $y_ratio = $this->getHeight() / $size[1];
954 }
955
956 // draw map areas
957 for ($i=0; $i < count($this->mapareas); $i++)
958 {
959 if ( ((($i+1) == $a_area_nr) && !$a_exclude) ||
960 ((($i+1) != $a_area_nr) && $a_exclude) ||
961 ($a_area_nr == 0)
962 )
963 {
964 $area = $this->mapareas[$i];
965 $area->draw($this->getMapWorkImage(), $this->color1, $this->color2, true,
966 $x_ratio, $y_ratio);
967 }
968 }
969
970 $this->saveMapWorkImage();
971
972 return true;
973 }
copyOriginal()
Copy the orginal file.

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

+ Here is the call graph for this function:

◆ outputMapWorkCopy()

ilMediaItem::outputMapWorkCopy ( )

output raw map work copy file

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

1013 {
1014 if ($this->getMapWorkCopyType() != "")
1015 {
1016 header("Pragma: no-cache");
1017 header("Expires: 0");
1018 header("Content-type: image/".strtolower($this->getMapWorkCopyType()));
1019 readfile($this->getMapWorkCopyName());
1020 }
1021 exit;
1022 }

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

+ Here is the call graph for this function:

◆ read()

ilMediaItem::read ( )

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

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

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 }
setMobId($a_mob_id)
set id of parent media object
setPurpose($a_purpose)
addMapArea(&$a_map_area)
setNr($a_nr)
set number of media item within media object
setWidth($a_width)
set width
setHAlign($a_halign)
set horizontal align
setTextRepresentation($a_val)
Set text representation.
setFormat($a_format)
setLocation($a_location)
setLocationType($a_type)
setCaption($a_caption)
set caption
setThumbTried($a_tried)
setHeight($a_height)
set height

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

Referenced by __construct().

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

◆ resetParameters()

ilMediaItem::resetParameters ( )

reset parameters

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

660 {
661 $this->parameters = array();
662 }

Referenced by setParameters().

+ Here is the caller graph for this function:

◆ saveMapWorkImage()

ilMediaItem::saveMapWorkImage ( )

save image map work image

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

1064 {
1065 $im_type = strtolower($this->getMapWorkCopyType());
1066
1067 // save image work-copy and free memory
1068 switch ($im_type)
1069 {
1070 case "gif":
1071 ImageGIF($this->map_image, $this->getMapWorkCopyName());
1072 break;
1073
1074 case "jpg":
1075 case "jpeg":
1076 ImageJPEG($this->map_image, $this->getMapWorkCopyName());
1077 break;
1078
1079 case "png":
1080 ImagePNG($this->map_image, $this->getMapWorkCopyName());
1081 break;
1082 }
1083
1084 ImageDestroy($this->map_image);
1085 }

References getMapWorkCopyName(), and getMapWorkCopyType().

Referenced by addAreaToMapWorkCopy(), and makeMapWorkCopy().

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

◆ setCaption()

ilMediaItem::setCaption (   $a_caption)

set caption

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

613 {
614 $this->caption = $a_caption;
615 }

Referenced by read().

+ Here is the caller graph for this function:

◆ setFormat()

ilMediaItem::setFormat (   $a_format)

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

487 {
488 $this->format = $a_format;
489 }

Referenced by read().

+ Here is the caller graph for this function:

◆ setHAlign()

ilMediaItem::setHAlign (   $a_halign)

set horizontal align

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

629 {
630 $this->halign = $a_halign;
631 }

Referenced by read().

+ Here is the caller graph for this function:

◆ setHeight()

ilMediaItem::setHeight (   $a_height)

set height

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

576 {
577 $this->height = $a_height;
578 }

Referenced by read().

+ Here is the caller graph for this function:

◆ setId()

ilMediaItem::setId (   $a_id)

set media item id

Parameters
int$a_idmedia item id

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

55 {
56 $this->id = $a_id;
57 }

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

+ Here is the caller graph for this function:

◆ setLocation()

ilMediaItem::setLocation (   $a_location)

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

467 {
468 $this->location = $a_location;
469 }

Referenced by read().

+ Here is the caller graph for this function:

◆ setLocationType()

ilMediaItem::setLocationType (   $a_type)

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

477 {
478 $this->location_type = $a_type;
479 }
$a_type
Definition: workflow.php:93

References $a_type.

Referenced by read().

+ Here is the caller graph for this function:

◆ setMobId()

ilMediaItem::setMobId (   $a_mob_id)

set id of parent media object

Parameters
int$a_mob_idmedia object id

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

75 {
76 $this->mob_id = $a_mob_id;
77 }

Referenced by read().

+ Here is the caller graph for this function:

◆ setNr()

ilMediaItem::setNr (   $a_nr)

set number of media item within media object

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

93 {
94 $this->nr = $a_nr;
95 }

Referenced by read().

+ Here is the caller graph for this function:

◆ setParameter()

ilMediaItem::setParameter (   $a_name,
  $a_value 
)

set parameter

Parameters
string$a_nameparameter name
string$a_valueparameter value

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

649 {
650 if (self::checkParameter($a_name, $a_value))
651 {
652 $this->parameters[$a_name] = $a_value;
653 }
654 }

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

+ Here is the caller graph for this function:

◆ setParameters()

ilMediaItem::setParameters (   $a_par)

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

Parameters
string$a_parparameter string

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

670 {
671 $this->resetParameters();
672 $par_arr = ilUtil::extractParameterString($a_par);
673 if(is_array($par_arr))
674 {
675 foreach($par_arr as $par => $val)
676 {
677 $this->setParameter($par, $val);
678 }
679 }
680 }
resetParameters()
reset parameters
static extractParameterString($a_parstr)
extracts parameter value pairs from a string into an array

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

+ Here is the call graph for this function:

◆ setPurpose()

ilMediaItem::setPurpose (   $a_purpose)

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

457 {
458 $this->purpose = $a_purpose;
459 }

Referenced by read().

+ Here is the caller graph for this function:

◆ setTextRepresentation()

ilMediaItem::setTextRepresentation (   $a_val)

Set text representation.

Parameters
stringtext representation

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

108 {
109 $this->text_representation = $a_val;
110 }

Referenced by read().

+ Here is the caller graph for this function:

◆ setThumbTried()

ilMediaItem::setThumbTried (   $a_tried)

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

497 {
498 $this->tried_thumb = $a_tried;
499 }

Referenced by read().

+ Here is the caller graph for this function:

◆ setWidth()

ilMediaItem::setWidth (   $a_width)

set width

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

560 {
561 $this->width = $a_width;
562 }

Referenced by read().

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

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 }

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

+ Here is the call graph for this function:

◆ writeParameter()

ilMediaItem::writeParameter (   $a_name,
  $a_value 
)

Write parameter.

Parameters

return

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

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 }

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

+ Here is the call graph for this function:

◆ writeThumbTried()

ilMediaItem::writeThumbTried (   $a_tried)

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

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

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 }

References $ilDB, and getId().

Referenced by getThumbnailTarget().

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

Field Documentation

◆ $caption

ilMediaItem::$caption

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

Referenced by getCaption().

◆ $color1

ilMediaItem::$color1

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

Referenced by makeMapWorkCopy().

◆ $color2

ilMediaItem::$color2

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

Referenced by makeMapWorkCopy().

◆ $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 deleteMapArea(), getMapArea(), getNr(), and read().

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