示例#1
0
文件: Fpdf.php 项目: rtsantos/mais
 /**
  * Esta função pega uma ZendT_Report_Cell e transforma um array pronto para ser impresso como celula
  * 
  * @param ZendT_Report_Cell $cell
  * @return array 
  */
 public function makeCell($celula, $options = false)
 {
     if (!$celula instanceof ZendT_Report_Cell) {
         $celula = new ZendT_Report_Cell($celula);
     }
     $borders = $celula->getBorders();
     $this->SetFont($celula->getFontName(), $celula->getStyle(), $celula->getFontSize());
     $corFonteCelula = $this->hex2RGB($celula->getColor());
     $this->SetTextColor($corFonteCelula['red'], $corFonteCelula['green'], $corFonteCelula['blue']);
     if ($borders['borders']) {
         if (!$borders['color']) {
             $borders['color'] = '#000000';
         }
         $corBorda = $this->hex2RGB($borders['color']);
         $this->SetDrawColor($corBorda['red'], $corBorda['green'], $corBorda['blue']);
         $this->SetLineWidth($borders['width'] . 'px');
     }
     $backgroundColor = $celula->getBackgroundColor();
     if ($backgroundColor) {
         $colorFill = 1;
         $backgroundColor = $this->hex2RGB($backgroundColor);
         $this->SetFillColor($backgroundColor['red'], $backgroundColor['green'], $backgroundColor['blue']);
     } else {
         if (isset($options['backgroundColor'])) {
             $backgroundColor = $this->hex2RGB($options['backgroundColor']);
             $this->SetFillColor($backgroundColor['red'], $backgroundColor['green'], $backgroundColor['blue']);
             $colorFill = 1;
         } else {
             $colorFill = 0;
         }
     }
     return array('celula' => $celula, 'color' => $colorFill, 'border' => $borders['borders']);
 }