function pImage::addToImageMap

5.x pImage.class.php pImage::addToImageMap($Type, $Plots, $Color = NULL, $Title = NULL, $Message = NULL, $HTMLEncode = FALSE)

File

inc/pchart/pchart/class/pImage.class.php, line 291

Class

pImage

Code

function addToImageMap($Type, $Plots, $Color = NULL, $Title = NULL, $Message = NULL, $HTMLEncode = FALSE) 
 {
  if ($this->ImageMapStorageMode == NULL) {
    $this->initialiseImageMap();
  }

  /* Encode the characters in the imagemap in HTML standards */
  $Title = str_replace("€", "\u20AC", $Title);
  $Title = htmlentities($Title, ENT_QUOTES, "ISO-8859-15");
  if ($HTMLEncode) 
   {
    $Message = htmlentities($Message, ENT_QUOTES, "ISO-8859-15");
    $Message = str_replace("&lt;", "<", $Message);
    $Message = str_replace("&gt;", ">", $Message);
  }

  if ($this->ImageMapStorageMode == IMAGE_MAP_STORAGE_SESSION) 
   {
    if (!isset($_SESSION)) {
      $this->initialiseImageMap();
    }
    $_SESSION [$this->ImageMapIndex][] = array($Type, $Plots, $Color, $Title, $Message);
  }
  elseif ($this->ImageMapStorageMode == IMAGE_MAP_STORAGE_FILE) 
   {
    $Handle = fopen($this->ImageMapStorageFolder . "/" . $this->ImageMapFileName . ".map", 'a');
    fwrite($Handle, $Type . IMAGE_MAP_DELIMITER . $Plots . IMAGE_MAP_DELIMITER . $Color . IMAGE_MAP_DELIMITER . $Title . IMAGE_MAP_DELIMITER . $Message . "\r\n");
    fclose($Handle);
  }
}