4 require_once(
"Services/MediaObjects/classes/class.ilMapArea.php");
50 $this->db = $DIC->database();
51 $this->lng = $DIC->language();
52 $this->parameters =
array();
53 $this->mapareas =
array();
89 $this->mob_id = $a_mob_id;
122 $this->text_representation = $a_val;
132 return $this->text_representation;
143 $item_id =
$ilDB->nextId(
"media_item");
144 $query =
"INSERT INTO media_item (id,mob_id, purpose, location, " .
145 "location_type, format, width, " .
146 "height, halign, caption, nr, text_representation) VALUES " .
148 $ilDB->quote($item_id,
"integer") .
"," .
158 $ilDB->quote($this->
getNr(),
"integer") .
"," .
162 $this->
setId($item_id);
167 $query =
"INSERT INTO mob_parameter (med_item_id, name, value) VALUES " .
168 "(" .
$ilDB->quote($item_id,
"integer") .
"," .
170 $ilDB->quote($value,
"text") .
")";
175 for (
$i=0;
$i < count($this->mapareas);
$i++) {
176 if (is_object($this->mapareas[
$i])) {
177 $this->mapareas[
$i]->setItemId($this->
getId());
178 $this->mapareas[
$i]->setNr($i + 1);
179 $this->mapareas[
$i]->create();
191 $query =
"UPDATE media_item SET " .
192 " mob_id = " .
$ilDB->quote($this->
getMobId(),
"integer") .
"," .
197 " width = " .
$ilDB->quote($this->
getWidth(),
"text") .
"," .
201 " nr = " .
$ilDB->quote($this->
getNr(),
"integer") .
"," .
203 " WHERE id = " .
$ilDB->quote($this->
getId(),
"integer");
207 $query =
"DELETE FROM mob_parameter WHERE med_item_id = " .
213 $query =
"INSERT INTO mob_parameter (med_item_id, name, value) VALUES " .
214 "(" .
$ilDB->quote($this->
getId(),
"integer") .
"," .
216 $ilDB->quote($value,
"text") .
")";
231 $query =
"INSERT INTO mob_parameter (med_item_id, name, value) VALUES " .
232 "(" .
$ilDB->quote($this->
getId(),
"integer") .
"," .
233 $ilDB->quote($a_name,
"text") .
"," .
234 $ilDB->quote($a_value,
"text") .
")";
245 $item_id = $this->
getId();
250 $query =
"SELECT * FROM media_item WHERE id = " .
253 $query =
"SELECT * FROM media_item WHERE mob_id = " .
255 "AND nr=" .
$ilDB->quote($this->
getNr(),
"integer");
259 $item_rec =
$ilDB->fetchAssoc($item_set);
264 $this->
setWidth($item_rec[
"width"]);
269 $this->
setNr($item_rec[
"nr"]);
270 $this->
setMobId($item_rec[
"mob_id"]);
271 $this->
setId($item_rec[
"id"]);
276 $query =
"SELECT * FROM mob_parameter WHERE med_item_id = " .
279 while ($par_rec =
$ilDB->fetchAssoc($par_set)) {
280 $this->
setParameter($par_rec[
"name"], $par_rec[
"value"]);
285 for (
$i = 1;
$i <= $max;
$i++) {
299 $q =
"UPDATE media_item SET tried_thumb = " .
300 $ilDB->quote($a_tried,
"text") .
301 " WHERE id = " .
$ilDB->quote($this->
getId(),
"integer");
303 $ilDB->manipulate($q);
316 $ilDB = $DIC->database();
319 $query =
"SELECT * FROM media_item WHERE mob_id = " .
320 $ilDB->quote($a_mob_id,
"integer") .
" " .
321 "AND purpose = " .
$ilDB->quote($a_purpose,
"text");
323 if ($rec =
$ilDB->fetchAssoc($set)) {
324 return $rec[
"location"];
339 $ilDB = $DIC->database();
342 $query =
"SELECT * FROM media_item WHERE id = " .
343 $ilDB->quote($a_med_id,
"integer");
345 if ($rec =
$ilDB->fetchAssoc($set)) {
346 return $rec[
"mob_id"];
362 $ilDB = $DIC->database();
365 $query =
"SELECT * FROM media_item WHERE mob_id = " .
366 $ilDB->quote($a_mobId,
"integer") .
" " .
367 "AND purpose=" .
$ilDB->quote($a_purpose,
"text") .
" ORDER BY nr";
370 while ($item_rec =
$ilDB->fetchAssoc($item_set)) {
385 $ilDB = $DIC->database();
388 $query =
"SELECT * FROM media_item WHERE mob_id = " .
389 $ilDB->quote($a_mob->getId(),
"integer") .
" " .
392 while ($item_rec =
$ilDB->fetchAssoc($item_set)) {
394 $media_item->setNr($item_rec[
"nr"]);
395 $media_item->setId($item_rec[
"id"]);
396 $media_item->setLocation($item_rec[
"location"]);
397 $media_item->setLocationType($item_rec[
"location_type"]);
398 $media_item->setFormat($item_rec[
"format"]);
399 $media_item->setWidth($item_rec[
"width"]);
400 $media_item->setHeight($item_rec[
"height"]);
401 $media_item->setHAlign($item_rec[
"halign"]);
402 $media_item->setCaption($item_rec[
"caption"]);
403 $media_item->setPurpose($item_rec[
"purpose"]);
404 $media_item->setMobId($item_rec[
"mob_id"]);
405 $media_item->setThumbTried($item_rec[
"tried_thumb"]);
406 $media_item->setTextRepresentation($item_rec[
"text_representation"]);
409 $query =
"SELECT * FROM mob_parameter WHERE med_item_id = " .
410 $ilDB->quote($item_rec[
"id"],
"integer");
412 while ($par_rec =
$ilDB->fetchAssoc($par_set)) {
413 $media_item->setParameter($par_rec[
"name"], $par_rec[
"value"]);
418 for (
$i = 1;
$i <= $max;
$i++) {
420 $media_item->addMapArea($area);
424 $a_mob->addMediaItem($media_item);
437 $ilDB = $DIC->database();
440 $query =
"SELECT * FROM media_item WHERE mob_id = " .
441 $ilDB->quote($a_mob_id,
"integer");
443 while ($item_rec =
$ilDB->fetchAssoc($item_set)) {
445 $query =
"DELETE FROM mob_parameter WHERE med_item_id = " .
446 $ilDB->quote($item_rec[
"id"],
"integer");
450 $query =
"DELETE FROM map_area WHERE item_id = " .
451 $ilDB->quote($item_rec[
"id"],
"integer");
456 $query =
"DELETE FROM media_item WHERE mob_id = " .
457 $ilDB->quote($a_mob_id,
"integer");
463 $this->purpose = $a_purpose;
473 $this->location = $a_location;
483 $this->location_type =
$a_type;
493 $this->
format = $a_format;
503 $this->tried_thumb = $a_tried;
508 return $this->tried_thumb;
524 $this->mapareas[
$i-2] = $this->mapareas[
$i-1];
525 $this->mapareas[
$i-2]->setNr(
$i-1);
528 if ($nr <= $this->map_cnt) {
529 unset($this->mapareas[$this->map_cnt - 1]);
539 return $this->mapareas[
$nr-1];
563 $this->width = $a_width;
579 $this->height = $a_height;
596 include_once(
"./Services/MediaObjects/classes/class.ilMediaImageUtil.php");
611 $this->caption = $a_caption;
627 $this->halign = $a_halign;
647 if (self::checkParameter($a_name, $a_value)) {
648 $this->parameters[$a_name] = $a_value;
657 $this->parameters =
array();
669 if (is_array($par_arr)) {
670 foreach ($par_arr as $par => $val) {
686 if (substr(strtolower(trim($a_par)), 0, 2) ==
"on") {
690 if (is_int(strpos(strtolower($a_val),
"javascript"))) {
694 if (in_array(strtolower(trim($a_par)),
array(
"src"))) {
725 return $this->parameters[$a_name];
745 if (!@is_dir($work_dir)) {
757 return $loc_arr[count($loc_arr) - 1];
776 $o_file = $file_arr[count($file_arr) - 1];
777 $file_arr = explode(
".", $o_file);
778 unset($file_arr[count($file_arr) - 1]);
779 $file = implode($file_arr,
".");
781 if (!$a_reference_copy) {
809 if (is_int(strpos($this->
getFormat(),
"image"))) {
818 if (is_file($thumb_file)) {
821 if (is_file($thumb_file_small)) {
822 unlink($thumb_file_small);
828 if (is_file($med_file)) {
834 if ($a_size ==
"small") {
835 if (is_file($thumb_file_small)) {
836 $random = new \ilRandom();
838 $this->
getPurpose() .
"_small.jpeg?dummy=" . $random->int(1, 999999);
841 if (is_file($thumb_file)) {
842 $random = new \ilRandom();
844 $this->
getPurpose() .
".jpeg?dummy=" . $random->int(1, 999999);
877 if ($handle && $lcopy) {
878 while (!feof($handle)) {
879 $content = fread($handle, 4096);
880 fwrite($lcopy, $content);
930 for (
$i=0;
$i < count($this->mapareas);
$i++) {
931 if ((((
$i+1) == $a_area_nr) && !$a_exclude) ||
932 (((
$i+1) != $a_area_nr) && $a_exclude) ||
935 $area = $this->mapareas[
$i];
976 $area->setShape($a_shape);
977 $area->setCoords($a_coords);
996 header(
"Pragma: no-cache");
1027 if (imagecolorstotal($this->map_image) > 250) {
1028 $this->color1 = imagecolorclosest($this->map_image, 0, 0, 0);
1029 $this->color2 = imagecolorclosest($this->map_image, 255, 255, 255);
1031 $this->color1 = imagecolorallocate($this->map_image, 0, 0, 0);
1032 $this->color2 = imagecolorallocate($this->map_image, 255, 255, 255);
1059 ImageDestroy($this->map_image);
1079 for (
$i=0;
$i < count($this->mapareas);
$i++) {
1080 $area = $this->mapareas[
$i];
1084 if ($area->getHighlightMode() !=
"") {
1085 $hm =
' HighlightMode="' . $area->getHighlightMode() .
'" ';
1086 $hcl = ($area->getHighlightClass() !=
"")
1087 ? $area->getHighlightClass()
1089 $hm.=
'HighlightClass="' . $hcl .
'" ';
1092 $xml .=
"<MapArea Shape=\"" . $area->getShape() .
"\" Coords=\"" . $area->getCoords() .
"\" " . $hm .
">";
1094 $target_frame = $area->getTargetFrame();
1096 if ($area->getType() ==
"GlossaryItem" && $target_frame ==
"") {
1097 $target_frame =
"Glossary";
1100 $tf_str = ($target_frame ==
"")
1102 :
"TargetFrame=\"" . $target_frame .
"\"";
1104 $xml .=
"<IntLink Target=\"" . $area->getTarget($a_insert_inst, $a_inst) .
"\" Type=\"" .
1105 $area->getType() .
"\" $tf_str>";
1107 $xml .= htmlspecialchars($area->getTitle(), ENT_QUOTES);
1108 $xml .=
"</IntLink>";
1110 $xml .=
"<ExtLink Href=\"" . str_replace(
"&",
"&", $area->getHref()) .
"\" Title=\"" .
1111 str_replace(
"&",
"&", $area->getExtTitle()) .
"\">";
1112 $xml .= str_replace(
"&",
"&", $area->getTitle());
1113 $xml .=
"</ExtLink>";
1115 $xml .=
"</MapArea>";
1130 $ilDB = $DIC->database();
1134 $query =
"SELECT * FROM media_item WHERE mob_id = " .
1135 $ilDB->quote($a_mob_id,
"integer") .
" " .
1138 while ($item_rec =
$ilDB->fetchAssoc($item_set)) {
1152 $ilDB = $DIC->database();
1155 $query =
"SELECT * FROM media_item WHERE mob_id = " .
1156 $ilDB->quote($a_mob_id,
"integer") .
" ORDER BY nr";
1160 while ($item_rec =
$ilDB->fetchAssoc($item_set)) {
1162 foreach ($map_links as
$key => $map_link) {
1174 include_once(
"./Services/MediaObjects/classes/class.ilExternalMediaAnalyzer.php");
1179 foreach ($par as $k => $v) {
static assembleParameterString($a_par_arr)
static deducibleSize($a_mime)
checks if mime type is provided by getimagesize()
static _getIntLinks($a_item_id)
get all internal links of a media items map areas
static _resolveIntLinks($a_item_id)
resolve internal links of an item id
static convertImage( $a_from, $a_to, $a_target_format="", $a_geometry="", $a_background_color="")
convert image
static getGDSupportedImageType($a_desired_type)
returns the best supported image type by this PHP build
static createDirectory($a_dir, $a_mod=0755)
create directory
Add a drawing to the header
Create styles array
The data for the language used.
static sendFailure($a_info="", $a_keep=false)
Send Failure Message to Screen.
static getDataDir()
get data directory (outside webspace)
Write to Excel2007 format
static _getMaxNr($a_item_id)
get maximum nr of media item (static)
if(!file_exists("$old.txt")) if($old===$new) if(file_exists("$new.txt")) $file
static extractParameterString($a_parstr)
extracts parameter value pairs from a string into an array