You are here

function pChart::printErrors in Visitors 8

Same name and namespace in other branches
  1. 7.0 pchart/pChart.inc \pChart::printErrors()
2 calls to pChart::printErrors()
pChart::Render in pchart/pChart.inc
pChart::Stroke in pchart/pChart.inc

File

pchart/pChart.inc, line 2561

Class

pChart

Code

function printErrors($Mode = "CLI") {
  if (count($this->Errors) == 0) {
    return 0;
  }
  if ($Mode == "CLI") {
    foreach ($this->Errors as $key => $Value) {
      echo $Value . "\r\n";
    }
  }
  elseif ($Mode == "GD") {
    $this
      ->setLineStyle($Width = 1);
    $MaxWidth = 0;
    foreach ($this->Errors as $key => $Value) {
      $Position = imageftbbox($this->ErrorFontSize, 0, $this->ErrorFontName, $Value);
      $TextWidth = $Position[2] - $Position[0];
      if ($TextWidth > $MaxWidth) {
        $MaxWidth = $TextWidth;
      }
    }
    $this
      ->drawFilledRoundedRectangle($this->XSize - ($MaxWidth + 20), $this->YSize - (20 + ($this->ErrorFontSize + 4) * count($this->Errors)), $this->XSize - 10, $this->YSize - 10, 6, 233, 185, 185);
    $this
      ->drawRoundedRectangle($this->XSize - ($MaxWidth + 20), $this->YSize - (20 + ($this->ErrorFontSize + 4) * count($this->Errors)), $this->XSize - 10, $this->YSize - 10, 6, 193, 145, 145);
    $C_TextColor = imagecolorallocate($this->Picture, 133, 85, 85);
    $YPos = $this->YSize - (18 + (count($this->Errors) - 1) * ($this->ErrorFontSize + 4));
    foreach ($this->Errors as $key => $Value) {
      imagettftext($this->Picture, $this->ErrorFontSize, 0, $this->XSize - ($MaxWidth + 15), $YPos, $C_TextColor, $this->ErrorFontName, $Value);
      $YPos = $YPos + ($this->ErrorFontSize + 4);
    }
  }
}