• Main Page
  • Related Pages
  • Namespaces
  • Data Structures
  • Files
  • File List
  • Globals

content/classes/Media/class.ilMediaItem.php

Go to the documentation of this file.
00001 <?php
00002 /*
00003         +-----------------------------------------------------------------------------+
00004         | ILIAS open source                                                           |
00005         +-----------------------------------------------------------------------------+
00006         | Copyright (c) 1998-2001 ILIAS open source, University of Cologne            |
00007         |                                                                             |
00008         | This program is free software; you can redistribute it and/or               |
00009         | modify it under the terms of the GNU General Public License                 |
00010         | as published by the Free Software Foundation; either version 2              |
00011         | of the License, or (at your option) any later version.                      |
00012         |                                                                             |
00013         | This program is distributed in the hope that it will be useful,             |
00014         | but WITHOUT ANY WARRANTY; without even the implied warranty of              |
00015         | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the               |
00016         | GNU General Public License for more details.                                |
00017         |                                                                             |
00018         | You should have received a copy of the GNU General Public License           |
00019         | along with this program; if not, write to the Free Software                 |
00020         | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA. |
00021         +-----------------------------------------------------------------------------+
00022 */
00023 
00024 require_once("content/classes/Media/class.ilMapArea.php");
00025 
00036 class ilMediaItem
00037 {
00038         var $ilias;
00039         var $id;
00040         var $purpose;
00041         var $location;
00042         var $location_type;
00043         var $format;
00044         var $width;
00045         var $height;
00046         var $caption;
00047         var $halign;
00048         var $parameters;
00049         var $mob_id;
00050         var $nr;
00051         var $mapareas;
00052         var $map_cnt;
00053         var $map_image;                 // image map work copy image
00054         var $color1;                    // map area line color 1
00055         var $color2;                    // map area line color 2
00056 
00057         function ilMediaItem($a_id = 0)
00058         {
00059                 global $ilias;
00060 
00061                 $this->ilias =& $ilias;
00062                 $this->parameters = array();
00063                 $this->mapareas = array();
00064                 $this->map_cnt = 0;
00065 
00066                 if ($a_id != 0)
00067                 {
00068                         $this->setId($a_id);
00069                         $this->read();
00070                 }
00071         }
00072 
00078         function setId($a_id)
00079         {
00080                 $this->id = $a_id;
00081         }
00082 
00088         function getId()
00089         {
00090                 return $this->id;
00091         }
00092 
00098         function setMobId($a_mob_id)
00099         {
00100                 $this->mob_id = $a_mob_id;
00101         }
00102 
00108         function getMobId()
00109         {
00110                 return $this->mob_id;
00111         }
00112 
00116         function setNr($a_nr)
00117         {
00118                 $this->nr = $a_nr;
00119         }
00120 
00121         function getNr()
00122         {
00123                 return $this->nr;
00124         }
00125 
00129         function create()
00130         {
00131                 global $ilDB;
00132 
00133                 $query = "INSERT INTO media_item (mob_id, purpose, location, ".
00134                         "location_type, format, width, ".
00135                         "height, halign, caption, nr) VALUES ".
00136                         "(".$ilDB->quote($this->getMobId()).",".
00137                         $ilDB->quote($this->getPurpose()).",".
00138                         $ilDB->quote($this->getLocation()).",".
00139                         $ilDB->quote($this->getLocationType()).",".
00140                         $ilDB->quote($this->getFormat()).",".
00141                         $ilDB->quote($this->getWidth()).",".
00142                         $ilDB->quote($this->getHeight()).",".
00143                         $ilDB->quote($this->getHAlign()).",".
00144                         $ilDB->quote($this->getCaption()).",".
00145                         $ilDB->quote($this->getNr()).")";
00146                 $this->ilias->db->query($query);
00147 //echo "create_mob:$query:<br>";
00148                 $item_id = $this->ilias->db->getLastInsertId();
00149                 $this->setId($item_id);
00150 
00151                 // create mob parameters
00152                 $params = $this->getParameters();
00153                 foreach($params as $name => $value)
00154                 {
00155                         $query = "INSERT INTO mob_parameter (med_item_id, name, value) VALUES ".
00156                                 "(".$ilDB->quote($item_id).",".
00157                                 $ilDB->quote($name).",".
00158                                 $ilDB->quote($value).")";
00159                         $this->ilias->db->query($query);
00160                 }
00161 
00162                 // create map areas
00163                 for ($i=0; $i < count($this->mapareas); $i++)
00164                 {
00165                         $this->mapareas[$i]->setItemId($this->getId());
00166                         $this->mapareas[$i]->setNr($i + 1);
00167                         $this->mapareas[$i]->create();
00168                 }
00169         }
00170 
00174         function update()
00175         {
00176                 global $ilDB;
00177 
00178                 $query = "UPDATE media_item SET ".
00179                         " mob_id = ".$ilDB->quote($this->getMobId()).",".
00180                         " purpose = ".$ilDB->quote($this->getPurpose()).",".
00181                         " location = ".$ilDB->quote($this->getLocation()).",".
00182                         " location_type = ".$ilDB->quote($this->getLocationType()).",".
00183                         " format = ".$ilDB->quote($this->getFormat()).",".
00184                         " width = ".$ilDB->quote($this->getWidth()).",".
00185                         " height = ".$ilDB->quote($this->getHeight()).",".
00186                         " halign = ".$ilDB->quote($this->getHAlign()).",".
00187                         " caption = ".$ilDB->quote($this->getCaption()).",".
00188                         " nr = ".$ilDB->quote($this->getNr()).
00189                         " WHERE id = ".$ilDB->quote($this->getId());
00190                 $this->ilias->db->query($query);
00191 
00192                 // delete mob parameters
00193                 $query = "DELETE FROM mob_parameter WHERE med_item_id = ".
00194                         $ilDB->quote($this->getId());
00195 
00196                 // create mob parameters
00197                 $params = $this->getParameters();
00198                 foreach($params as $name => $value)
00199                 {
00200                         $query = "INSERT INTO mob_parameter (med_item_id, name, value) VALUES ".
00201                                 "(".$ilDB->quote($this->getId()).",".
00202                                 $ilDB->quote($name).",".
00203                                 $ilDB->quote($value).")";
00204                         $this->ilias->db->query($query);
00205                 }
00206         }
00207 
00211         function read()
00212         {
00213                 $item_id = $this->getId();
00214                 $mob_id = $this->getMobId();
00215                 $nr = $this->getNr();
00216                 $query = "";
00217                 if($item_id > 0)
00218                 {
00219                         $query = "SELECT * FROM media_item WHERE id = '".$this->getId()."'";
00220                 }
00221                 else if ($mob_id > 0 && $nr > 0)
00222                 {
00223                         $query = "SELECT * FROM media_item WHERE mob_id = '".$this->getMobId()."' ".
00224                                 "AND nr='".$this->getNr()."'";
00225                 }
00226                 if ($query != "")
00227                 {
00228                         $item_set = $this->ilias->db->query($query);
00229                         $item_rec = $item_set->fetchRow(DB_FETCHMODE_ASSOC);
00230 
00231                         $this->setLocation($item_rec["location"]);
00232                         $this->setLocationType($item_rec["location_type"]);
00233                         $this->setFormat($item_rec["format"]);
00234                         $this->setWidth($item_rec["width"]);
00235                         $this->setHeight($item_rec["height"]);
00236                         $this->setHAlign($item_rec["halign"]);
00237                         $this->setCaption($item_rec["caption"]);
00238                         $this->setPurpose($item_rec["purpose"]);
00239                         $this->setNr($item_rec["nr"]);
00240                         $this->setMobId($item_rec["mob_id"]);
00241                         $this->setId($item_rec["id"]);
00242                         $this->setThumbTried($item_rec["tried_thumb"]);
00243 
00244                         // get item parameter
00245                         $query = "SELECT * FROM mob_parameter WHERE med_item_id = '".
00246                                 $this->getId()."'";
00247                         $par_set = $this->ilias->db->query($query);
00248                         while ($par_rec = $par_set->fetchRow(DB_FETCHMODE_ASSOC))
00249                         {
00250                                 $this->setParameter($par_rec["name"], $par_rec["value"]);
00251                         }
00252 
00253                         // get item map areas
00254                         $max = ilMapArea::_getMaxNr($this->getId());
00255                         for ($i = 1; $i <= $max; $i++)
00256                         {
00257                                 $area =& new ilMapArea($this->getId(), $i);
00258                                 $this->addMapArea($area);
00259                         }
00260                 }
00261 
00262         }
00263         
00267         function writeThumbTried($a_tried)
00268         {
00269                 global $ilDB;
00270                 
00271                 $q = "UPDATE media_item SET tried_thumb=".
00272                         $ilDB->quote($a_tried).
00273                         " WHERE id = ".$ilDB->quote($this->getId());
00274                         
00275                 $ilDB->query($q);
00276         }
00277 
00283         function _getMediaItemsOfMOb(&$a_mob)
00284         {
00285                 // read media_object record
00286                 $query = "SELECT * FROM media_item WHERE mob_id = '".$a_mob->getId()."' ".
00287                         "ORDER BY nr";
00288                 $item_set = $this->ilias->db->query($query);
00289                 while ($item_rec = $item_set->fetchRow(DB_FETCHMODE_ASSOC))
00290                 {
00291                         $media_item =& new ilMediaItem();
00292                         $media_item->setNr($item_rec["nr"]);
00293                         $media_item->setId($item_rec["id"]);
00294                         $media_item->setLocation($item_rec["location"]);
00295                         $media_item->setLocationType($item_rec["location_type"]);
00296                         $media_item->setFormat($item_rec["format"]);
00297                         $media_item->setWidth($item_rec["width"]);
00298                         $media_item->setHeight($item_rec["height"]);
00299                         $media_item->setHAlign($item_rec["halign"]);
00300                         $media_item->setCaption($item_rec["caption"]);
00301                         $media_item->setPurpose($item_rec["purpose"]);
00302                         $media_item->setMobId($item_rec["mob_id"]);
00303                         $media_item->setThumbTried($item_rec["tried_thumb"]);
00304 
00305                         // get item parameter
00306                         $query = "SELECT * FROM mob_parameter WHERE med_item_id = '".
00307                                 $item_rec["id"]."'";
00308                         $par_set = $this->ilias->db->query($query);
00309                         while ($par_rec = $par_set->fetchRow(DB_FETCHMODE_ASSOC))
00310                         {
00311                                 $media_item->setParameter($par_rec["name"], $par_rec["value"]);
00312                         }
00313 
00314                         // get item map areas
00315                         $max = ilMapArea::_getMaxNr($media_item->getId());
00316                         for ($i = 1; $i <= $max; $i++)
00317                         {
00318                                 $area =& new ilMapArea($media_item->getId(), $i);
00319                                 $media_item->addMapArea($area);
00320                         }
00321 
00322                         // add media item to media object
00323                         $a_mob->addMediaItem($media_item);
00324                 }
00325         }
00326 
00330         function deleteAllItemsOfMob($a_mob_id)
00331         {
00332                 // iterate all media items ob mob
00333                 $query = "SELECT * FROM media_item WHERE mob_id = '".$a_mob_id."'";
00334                 $item_set = $this->ilias->db->query($query);
00335                 while ($item_rec = $item_set->fetchRow(DB_FETCHMODE_ASSOC))
00336                 {
00337                         // delete all parameters of media item
00338                         $query = "DELETE FROM mob_parameter WHERE med_item_id = '".$item_rec["id"]."'";
00339                         $this->ilias->db->query($query);
00340 
00341                         // delete all map areas of media item
00342                         $query = "DELETE FROM map_area WHERE item_id = '".$item_rec["id"]."'";
00343                         $this->ilias->db->query($query);
00344                 }
00345 
00346                 // delete media items
00347                 $query = "DELETE FROM media_item WHERE mob_id = '".$a_mob_id."'";
00348                 $this->ilias->db->query($query);
00349         }
00350 
00351         function setPurpose($a_purpose)
00352         {
00353                 $this->purpose = $a_purpose;
00354         }
00355 
00356         function getPurpose()
00357         {
00358                 return $this->purpose;
00359         }
00360 
00361         function setLocation($a_location)
00362         {
00363                 $this->location = $a_location;
00364         }
00365 
00366         function getLocation()
00367         {
00368                 return $this->location;
00369         }
00370 
00371         function setLocationType($a_type)
00372         {
00373                 $this->location_type = $a_type;
00374         }
00375 
00376         function getLocationType()
00377         {
00378                 return $this->location_type;
00379         }
00380 
00381         function setFormat($a_format)
00382         {
00383                 $this->format = $a_format;
00384         }
00385 
00386         function getFormat()
00387         {
00388                 return $this->format;
00389         }
00390 
00391         function setThumbTried($a_tried)
00392         {
00393                 $this->tried_thumb = $a_tried;
00394         }
00395 
00396         function getThumbTried()
00397         {
00398                 return $this->tried_thumb;
00399         }
00400 
00401         function addMapArea(&$a_map_area)
00402         {
00403                 $this->mapareas[$this->map_cnt] =& $a_map_area;
00404                 $this->map_cnt++;
00405         }
00406 
00410         function deleteMapArea($nr)
00411         {
00412                 for ($i=1; $i<=$this->map_cnt; $i++)
00413                 {
00414                         if($i > $nr)
00415                         {
00416                                 $this->mapareas[$i-2] =& $this->mapareas[$i-1];
00417                                 $this->mapareas[$i-2]->setNr($i-1);
00418                         }
00419                 }
00420                 if($nr <= $this->map_cnt)
00421                 {
00422                         unset($this->mapareas[$this->map_cnt - 1]);
00423                         $this->map_cnt--;
00424                 }
00425         }
00426 
00430         function &getMapArea($nr)
00431         {
00432                 return $this->mapareas[$nr-1];
00433         }
00434 
00438         function getWidth()
00439         {
00440                 return $this->width;
00441         }
00442 
00446         function setWidth($a_width)
00447         {
00448                 $this->width = $a_width;
00449         }
00450 
00454         function getHeight()
00455         {
00456                 return $this->height;
00457         }
00458 
00462         function setHeight($a_height)
00463         {
00464                 $this->height = $a_height;
00465         }
00466 
00470         function getOriginalSize()
00471         {
00472                 $mob_dir = ilObjMediaObject::_getDirectory($this->getMobId());
00473 
00474                 if ($this->getLocationType() == "LocalFile" &&
00475                         ilUtil::deducibleSize($this->getFormat()))
00476                 {
00477                         $file = $mob_dir."/".$this->getLocation();
00478                         $size = getimagesize($file);
00479                         $size = array("width" => $size[0], "height" => $size[1]);
00480                         
00481                         return $size;
00482                 }
00483 
00484                 return false;
00485         }
00486 
00490         function setCaption($a_caption)
00491         {
00492                 $this->caption = $a_caption;
00493         }
00494 
00498         function getCaption()
00499         {
00500                 return $this->caption;
00501         }
00502 
00506         function setHAlign($a_halign)
00507         {
00508                 $this->halign = $a_halign;
00509         }
00510 
00514         function getHAlign()
00515         {
00516                 return $this->halign;
00517         }
00518 
00519 
00526         function setParameter($a_name, $a_value)
00527         {
00528                 $this->parameters[$a_name] = $a_value;
00529         }
00530 
00534         function resetParameters()
00535         {
00536                 $this->parameters = array();
00537         }
00538 
00544         function setParameters($a_par)
00545         {
00546                 $this->resetParameters();
00547                 $par_arr = ilUtil::extractParameterString($a_par);
00548                 if(is_array($par_arr))
00549                 {
00550                         foreach($par_arr as $par => $val)
00551                         {
00552                                 $this->setParameter($par, $val);
00553                         }
00554                 }
00555         }
00556 
00557 
00561         function getParameters()
00562         {
00563                 return $this->parameters;
00564         }
00565 
00566 
00570         function getParameterString()
00571         {
00572                 return ilUtil::assembleParameterString($this->parameters);
00573         }
00574 
00575 
00579         function getParameter($a_name)
00580         {
00581                 return $this->parameters[$a_name];
00582         }
00583 
00587         function getWorkDirectory()
00588         {
00589                 return ilUtil::getDataDir()."/map_workfiles/item_".$this->getId();
00590         }
00591 
00595         function createWorkDirectory()
00596         {
00597                 if(!@is_dir(ilUtil::getDataDir()."/map_workfiles"))
00598                 {
00599                         ilUtil::createDirectory(ilUtil::getDataDir()."/map_workfiles");
00600                 }
00601                 $work_dir = $this->getWorkDirectory();
00602                 if(!@is_dir($work_dir))
00603                 {
00604                         ilUtil::createDirectory($work_dir);
00605                 }
00606         }
00607 
00611         function getSuffix()
00612         {
00613                 $loc_arr = explode(".", $this->getLocation());
00614 
00615                 return $loc_arr[count($loc_arr) - 1];
00616         }
00617 
00621         function getMapWorkCopyType()
00622         {
00623                 return ilUtil::getGDSupportedImageType($this->getSuffix());
00624         }
00625 
00629         function getMapWorkCopyName()
00630         {
00631                 $file_arr = explode("/", $this->getLocation());
00632                 $file = $file_arr[count($file_arr) - 1];
00633                 $file_arr = explode(".", $file);
00634                 unset($file_arr[count($file_arr) - 1]);
00635                 $file = implode($file_arr, ".");
00636 
00637                 return $this->getWorkDirectory()."/".$file.".".$this->getMapWorkCopyType();
00638         }
00639 
00643         function getDirectory()
00644         {
00645                 return ilObjMediaObject::_getDirectory($this->getMobId());
00646         }
00647 
00651         function getThumbnailDirectory($a_mode = "filesystem")
00652         {
00653                 return ilObjMediaObject::_getThumbnailDirectory($this->getMobId(), $a_mode);
00654         }
00655 
00659         function getThumbnailTarget($a_size = "")
00660         {
00661                 if (is_int(strpos($this->getFormat(), "image")))
00662                 {
00663                         $thumb_file = $this->getThumbnailDirectory()."/".
00664                                 $this->getPurpose().".jpeg";
00665 
00666                         $thumb_file_small = $this->getThumbnailDirectory()."/".
00667                                 $this->getPurpose()."_small.jpeg";
00668 
00669                         // generate thumbnail (if not tried before)
00670                         if ($this->getThumbTried() == "n" && $this->getLocationType() == "LocalFile")
00671                         {
00672                                 if (is_file($thumb_file))
00673                                 {
00674                                         unlink($thumb_file);
00675                                 }
00676                                 if (is_file($thumb_file_small))
00677                                 {
00678                                         unlink($thumb_file_small);
00679                                 }
00680                                 $this->writeThumbTried("y");
00681                                 ilObjMediaObject::_createThumbnailDirectory($this->getMobId());
00682                                 $med_file = $this->getDirectory()."/".$this->getLocation();
00683 
00684                                 if (is_file($med_file))
00685                                 {
00686                                         ilUtil::convertImage($med_file, $thumb_file, "jpeg", "80");
00687                                         ilUtil::convertImage($med_file, $thumb_file_small, "jpeg", "40");
00688                                 }
00689                         }
00690 
00691                         if ($a_size == "small")
00692                         {
00693                                 if (is_file($thumb_file_small))
00694                                 {
00695                                         return $this->getThumbnailDirectory("output")."/".
00696                                                 $this->getPurpose()."_small.jpeg?dummy=".rand(1, 999999);
00697                                 }
00698                         }
00699                         else
00700                         {
00701                                 if (is_file($thumb_file))
00702                                 {
00703                                         return $this->getThumbnailDirectory("output")."/".
00704                                                 $this->getPurpose().".jpeg?dummy=".rand(1, 999999);
00705                                 }
00706                         }
00707                 }
00708 
00709                 return "";
00710         }
00711 
00712 
00719         function makeMapWorkCopy($a_area_nr = 0, $a_exclude = false)
00720         {
00721                 $this->createWorkDirectory();
00722                 ilUtil::convertImage($this->getDirectory()."/".$this->getLocation(),
00723                         $this->getMapWorkCopyName(),
00724                         $this->getMapWorkCopyType());
00725 
00726                 $this->buildMapWorkImage();
00727 
00728                 // draw map areas
00729                 for ($i=0; $i < count($this->mapareas); $i++)
00730                 {
00731                         if (    ((($i+1) == $a_area_nr) && !$a_exclude) ||
00732                                         ((($i+1) != $a_area_nr) && $a_exclude) ||
00733                                         ($a_area_nr == 0)
00734                                 )
00735                         {
00736                                 $area =& $this->mapareas[$i];
00737                                 $area->draw($this->getMapWorkImage(), $this->color1, $this->color2);
00738                         }
00739                 }
00740 
00741                 $this->saveMapWorkImage();
00742         }
00743 
00744 
00751         function addAreaToMapWorkCopy($a_shape, $a_coords)
00752         {
00753                 $this->buildMapWorkImage();
00754 
00755                 // add new area to work image
00756                 $area = new ilMapArea();
00757                 $area->setShape($a_shape);
00758 //echo "addAreaToMap:".$a_shape.":<br>";
00759                 $area->setCoords($a_coords);
00760                 $area->draw($this->getMapWorkImage(), $this->color1, $this->color2, false);
00761 
00762                 $this->saveMapWorkImage();
00763         }
00764 
00768         function outputMapWorkCopy()
00769         {
00770                 if ($this->getMapWorkCopyType() != "")
00771                 {
00772                         header("Pragma: no-cache");
00773                         header("Expires: 0");
00774                         header("Content-type: image/".strtolower($this->getMapWorkCopyType()));
00775                         readfile($this->getMapWorkCopyName());
00776                 }
00777                 exit;
00778         }
00779 
00783         function buildMapWorkImage()
00784         {
00785                 $im_type = strtolower($this->getMapWorkCopyType());
00786 
00787                 switch ($im_type)
00788                 {
00789                         case "gif":
00790                                 $this->map_image = ImageCreateFromGIF($this->getMapWorkCopyName());
00791                                 break;
00792 
00793                         case "jpg":
00794                                 $this->map_image = ImageCreateFromJPEG($this->getMapWorkCopyName());
00795                                 break;
00796 
00797                         case "png":
00798                                 $this->map_image = ImageCreateFromPNG($this->getMapWorkCopyName());
00799                                 break;
00800                 }
00801 
00802                 // try to allocate black and white as color. if this is not possible, get the closest colors
00803                 if (imagecolorstotal($this->map_image) > 250)
00804                 {
00805                         $this->color1 = imagecolorclosest($this->map_image, 0, 0, 0);
00806                         $this->color2 = imagecolorclosest($this->map_image, 255, 255, 255);
00807                 }
00808                 else
00809                 {
00810                         $this->color1 = imagecolorallocate($this->map_image, 0, 0, 0);
00811                         $this->color2 = imagecolorallocate($this->map_image, 255, 255, 255);
00812                 }
00813         }
00814 
00818         function saveMapWorkImage()
00819         {
00820                 $im_type = strtolower($this->getMapWorkCopyType());
00821 
00822                 // save image work-copy and free memory
00823                 switch ($im_type)
00824                 {
00825                         case "gif":
00826                                 ImageGIF($this->map_image, $this->getMapWorkCopyName());
00827                                 break;
00828 
00829                         case "jpg":
00830                                 ImageJPEG($this->map_image, $this->getMapWorkCopyName());
00831                                 break;
00832 
00833                         case "png":
00834                                 ImagePNG($this->map_image, $this->getMapWorkCopyName());
00835                                 break;
00836                 }
00837 
00838                 ImageDestroy($this->map_image);
00839         }
00840 
00844         function &getMapWorkImage()
00845         {
00846                 return $this->map_image;
00847         }
00848 
00849 
00853         function getMapAreasXML($a_insert_inst = false, $a_inst = 0)
00854         {
00855                 $xml = "";
00856 
00857                 // build xml of map areas
00858                 for ($i=0; $i < count($this->mapareas); $i++)
00859                 {
00860                         $area =& $this->mapareas[$i];
00861                         $xml .= "<MapArea Shape=\"".$area->getShape()."\" Coords=\"".$area->getCoords()."\">";
00862                         if ($area->getLinkType() == IL_INT_LINK)
00863                         {
00864                                 $target_frame = $area->getTargetFrame();
00865 
00866                                 if ($area->getType() == "GlossaryItem" && $target_frame == "")
00867                                 {
00868                                         $target_frame = "Glossary";
00869                                 }
00870 
00871                                 $xml .= "<IntLink Target=\"".$area->getTarget($a_insert_inst, $a_inst)."\" Type=\"".
00872                                         $area->getType()."\" TargetFrame=\"".$target_frame."\">";
00873                                 $xml .= $area->getTitle();
00874                                 $xml .="</IntLink>";
00875                         }
00876                         else
00877                         {
00878                                 $xml .= "<ExtLink Href=\"".str_replace("&", "&amp;",$area->getHref())."\" Title=\"".
00879                                         $area->getExtTitle()."\">";
00880                                 $xml .= $area->getTitle();
00881                                 $xml .="</ExtLink>";
00882                         }
00883                         $xml .= "</MapArea>";
00884                 }
00885 
00886                 return $xml;
00887         }
00888 
00889 
00895         function _resolveMapAreaLinks($a_mob_id)
00896         {
00897 //echo "mediaItems::resolve<br>";
00898                 // read media_object record
00899                 $query = "SELECT * FROM media_item WHERE mob_id = '".$a_mob_id."' ".
00900                         "ORDER BY nr";
00901                 $item_set = $this->ilias->db->query($query);
00902                 while ($item_rec = $item_set->fetchRow(DB_FETCHMODE_ASSOC))
00903                 {
00904                         ilMapArea::_resolveIntLinks($item_rec["id"]);
00905                 }
00906         }
00907 
00913         function _getMapAreasIntLinks($a_mob_id)
00914         {
00915                 // read media_items records
00916                 $query = "SELECT * FROM media_item WHERE mob_id = '".$a_mob_id."' ".
00917                         "ORDER BY nr";
00918                 $item_set = $this->ilias->db->query($query);
00919                 $links = array();
00920                 while ($item_rec = $item_set->fetchRow(DB_FETCHMODE_ASSOC))
00921                 {
00922                         $map_links = ilMapArea::_getIntLinks($item_rec["id"]);
00923                         foreach($map_links as $key => $map_link)
00924                         {
00925                                 $links[$key] = $map_link;
00926                         }
00927                 }
00928                 return $links;
00929         }
00930 
00931 }
00932 ?>

Generated on Fri Dec 13 2013 09:06:36 for ILIAS Release_3_4_x_branch .rev 46804 by  doxygen 1.7.1