Exemplo n.º 1
0
 /**
  *
  * @param string $id
  * @param array $options
  * @param array $data 
  */
 public function __construct($id, $options, $data)
 {
     $id = clearAccent($id);
     $this->setZoom($options['zoom']);
     $this->setId($id);
     $this->setType($options['type']);
     $this->setTitle($options['title']);
     if (!isset($options['adicionaLegenda'])) {
         $options['adicionaLegenda'] = true;
     }
     if (!isset($options['categoryAxisLabelRotation'])) {
         $options['categoryAxisLabelRotation'] = 45;
     }
     if (!isset($options['depth3D'])) {
         $options['depth3D'] = 15;
     }
     if (!isset($options['angle'])) {
         $options['angle'] = 30;
     }
     if (isset($options['titleSize'])) {
         $this->setTitleSize($options['titleSize']);
     }
     if (!isset($options['labelFontSize'])) {
         $options['labelFontSize'] = 10;
     }
     if (!isset($options['legendFontSize'])) {
         $options['legendFontSize'] = 10;
     }
     if (!isset($options['legendMarkerSize'])) {
         $options['legendMarkerSize'] = 16;
     }
     if (!isset($options['legendValueWidth'])) {
         $options['legendValueWidth'] = 80;
     }
     if (!isset($options['legendValueText'])) {
         $options['legendValueText'] = '[[value]]';
     }
     if (!isset($options['legendAlign'])) {
         $options['legendAlign'] = 'left';
     }
     if (!isset($options['pieLabelText'])) {
         $options['pieLabelText'] = '[[title]]: [[value]] ([[percents]]%)';
     }
     if (!isset($options['pieFontSize'])) {
         $options['pieFontSize'] = 11;
     }
     $this->_varNameJs = $id;
     $this->_options = $options;
     $this->_color = -1;
     $this->_load($data);
 }
Exemplo n.º 2
0
 /**
  *
  * @return string 
  */
 public function render($type = '')
 {
     $content = parent::render();
     if ($type == 'PDF') {
         return $content;
     }
     $title = $this->_options['title'];
     $name = strtolower(str_replace(array(' '), array('-'), utf8_decode($title)));
     $nameIframe = strtolower('ifr' . clearAccent($name));
     $driver = strtolower($this->_options['driver']);
     $download = Zend_Controller_Front::getInstance()->getRequest()->getParam('download');
     $iframeDownload = Zend_Controller_Front::getInstance()->getRequest()->getParam('iframeDownload');
     $iframeHeight = Zend_Controller_Front::getInstance()->getRequest()->getParam('iframeHeight');
     if (!$driver) {
         $driver = 'pdf';
     }
     $file = new ZendT_File($name . '.' . $driver, $content, 'application/' . strtolower($driver));
     $fileUri = $file->toArrayJson();
     $cmdHtml = '';
     $src = ZendT_Url::getBaseUrl() . '/file';
     if ($driver == 'xls' || $download) {
         $src .= '/download';
         $width = 0;
         $height = 0;
         if (!$iframeDownload) {
             $cmdHtml .= '<div class="ui-widget ui-state-default ui-corner-all" style="height:30px;padding:5px;">' . "\n";
             $cmdHtml .= '    <span style="float:left;" class="ui-icon ui-icon-arrowstop-1-s"></span>' . "\n";
             $cmdHtml .= '    <span style="float:left;"><a href="javascript:javascript:downloadReport();">Se o download não iniciar automaticamente clique aqui.</a></span>' . "\n";
             $cmdHtml .= '    <span style="clear:both"></span>' . "\n";
             $cmdHtml .= '</div>' . "\n";
         }
     } else {
         if ($driver == 'html') {
             return $content;
         } else {
             $src .= '/pdf';
             $width = '100%';
             $height = '520';
             if (isset($this->_options['width'])) {
                 $width = $this->_options['width'];
             }
             if (isset($this->_options['height'])) {
                 $height = $this->_options['height'];
             }
         }
     }
     $src .= '?filename=' . $fileUri['filename'];
     $src .= '&type=' . $fileUri['type'];
     $src .= '&name=' . $fileUri['name'];
     $src .= '#zoom=120';
     $cmdHtml .= '<iframe';
     $cmdHtml .= ' id="' . $nameIframe . '"';
     $cmdHtml .= ' name="' . $nameIframe . '"';
     $cmdHtml .= ' src="' . $src . '"';
     $cmdHtml .= ' width="' . $width . '"';
     $cmdHtml .= ' height="100%"';
     $cmdHtml .= ' style="min-height:' . $height . 'px"';
     $cmdHtml .= ' border="0"';
     $cmdHtml .= ' frameborder="0"';
     $cmdHtml .= ' align="center"';
     $cmdHtml .= ' noresize="noresize"';
     $cmdHtml .= ' scrolling="yes"';
     if ($iframeDownload) {
         $cmdHtml .= ' onload="history.go(-1);"';
     }
     $cmdHtml .= '></iframe>';
     $cmdHtml .= '<script>function downloadReport(){this.' . $nameIframe . '.location = \'' . $src . '\'; }</script>';
     return $cmdHtml;
 }
Exemplo n.º 3
0
 private function _id($value)
 {
     $newId = clearAccent(strtolower($value));
     return 'menu-' . $newId;
 }