Exemplo n.º 1
0
 public function __construct($options = false)
 {
     $this->_driver = 'CSV';
     $this->_badString = array(';', chr(10), chr(13));
     $this->_espapedString = array(' ', ' ', ' ');
     $this->_memoryManager = Zend_Memory::factory('none');
     $this->_memObject = $this->_memoryManager->create();
     try {
         $this->_fileName = 'Report_Excel_' . date('dmyhis') . '.csv';
         $file = new ZendT_File($this->_fileName);
         $this->_fileName = $file->getFilename();
         if (!$this->_fileName) {
             throw new ZendT_Exception('Impossivel criar aquivo', '2');
         }
     } catch (Exception $e) {
         throw new ZendT_Exception($e->getMessage(), $e->getCode());
     }
 }
 /**
  * Retrieve memory manager
  *
  */
 private function _getMemoryManager()
 {
     if ($this->_memoryManager === null) {
         $backendOptions = array('cache_dir' => $this->cacheDir);
         // Directory where to put the cache files
         $this->_memoryManager = Zend_Memory::factory('File', $backendOptions);
     }
     return $this->_memoryManager;
 }
Exemplo n.º 3
0
 protected function _initMemoryManager()
 {
     try {
         $memoryManager = Zend_Memory::factory('File', array('cache_dir' => APPLICATION_PATH . '/temporary/cache', 'file_name_prefix' => 'EngineInstallMemory'));
         $memoryManager->setMemoryLimit(24 * 1024 * 1024);
         Zend_Registry::set('MemoryManager', $memoryManager);
         return $memoryManager;
     } catch (Exception $e) {
     }
 }
Exemplo n.º 4
0
 /**
  * tests the Memory Manager creation
  *
  */
 public function testCreation()
 {
     /** 'None' backend */
     $memoryManager = Zend_Memory::factory('None');
     $this->assertTrue($memoryManager instanceof Zend_Memory_Manager);
     unset($memoryManager);
     /** 'File' backend */
     $backendOptions = array('cache_dir' => dirname(__FILE__) . '/_files/');
     // Directory where to put the cache files
     $memoryManager = Zend_Memory::factory('File', $backendOptions);
     $this->assertTrue($memoryManager instanceof Zend_Memory_Manager);
     unset($memoryManager);
 }
 /**
  * tests the processing of data
  */
 public function testProcessing()
 {
     /** 'File' backend */
     $backendOptions = array('cacheDir' => dirname(__FILE__) . '/_files/');
     // Directory where to put the cache files
     $memoryManager = Zend_Memory::factory('File', $backendOptions);
     $memoryManager->setMinSize(256);
     $memoryManager->setMemoryLimit(1024 * 32);
     $memObjects = array();
     for ($count = 0; $count < 64; $count++) {
         $memObject = $memoryManager->create(str_repeat((string) ($count % 10), 1024));
         $memObjects[] = $memObject;
     }
     for ($count = 0; $count < 64; $count += 2) {
         if (version_compare(PHP_VERSION, '5.2') < 0) {
             $value = $memObjects[$count]->getRef();
             $this->assertEquals($value[16], (string) ($count % 10));
         } else {
             $this->assertEquals($memObjects[$count]->value[16], (string) ($count % 10));
         }
     }
     for ($count = 63; $count > 0; $count -= 2) {
         if (version_compare(PHP_VERSION, '5.2') < 0) {
             $value =& $memObjects[$count]->getRef();
             $value[16] = '_';
         } else {
             $memObjects[$count]->value[16] = '_';
         }
     }
     for ($count = 1; $count < 64; $count += 2) {
         if (version_compare(PHP_VERSION, '5.2') < 0) {
             $value = $memObjects[$count]->getRef();
             $this->assertEquals($value[16], '_');
         } else {
             $this->assertEquals($memObjects[$count]->value[16], '_');
         }
     }
 }
Exemplo n.º 6
0
 /**
  * @group ZF-9883
  * @dataProvider Zend_Memory_MemoryTest::providerCacheBackend
  */
 public function testFactoryCacheBackendStandards($backend)
 {
     try {
         $memoryManager = Zend_Memory::factory($backend);
     } catch (Zend_Cache_Exception $exception) {
         $this->markTestSkipped($exception->getMessage());
     }
     $this->assertTrue($memoryManager instanceof Zend_Memory_Manager);
 }
Exemplo n.º 7
0
    /**
     * Request used memory manager
     *
     * @return Zend_Memory_Manager
     */
    static public function getMemoryManager()
    {
        if (self::$_memoryManager === null) {
            require_once 'Zend/Memory.php';
            self::$_memoryManager = Zend_Memory::factory('none');
        }

        return self::$_memoryManager;
    }
Exemplo n.º 8
0
 /**
  * Request used memory manager
  *
  * @return Zend_Memory_Manager
  */
 public static function getMemoryManager()
 {
     if (self::$_memoryManager === null) {
         self::$_memoryManager = Zend_Memory::factory('none');
     }
     return self::$_memoryManager;
 }
Exemplo n.º 9
0
 public function __construct()
 {
     $user = new Pas_User_Details();
     $this->_user = $user->getPerson();
     $this->_dateTime = Zend_Date::now()->toString('yyyyMMddHHmmss');
     $backendOptions = array('cache_dir' => APPLICATION_PATH . '/tmp');
     $this->_memory = Zend_Memory::factory('File', $backendOptions);
     $params = Zend_Controller_Front::getInstance()->getRequest()->getParams();
     $this->_params = $this->_cleanParams($params);
     $this->_search = new Pas_Solr_Handler();
 }
Exemplo n.º 10
0
    public function __construct($options = false)
    {
        $default = array('empresa' => 'TA', 'orientation' => 'P', 'unit' => 'mm', 'size' => 'A4', 'outputName' => 'relatorio', 'lineIndex' => 0);
        $this->_badString = array('&', '<', '>', "'", '"', 'ª', 'º', '¿');
        $this->_espapedString = array('&amp;', '&lt;', '&gt;', '&apos;', '&quot;', '', '', '');
        $this->_memoryManager = Zend_Memory::factory('none');
        $this->_memObject = $this->_memoryManager->create();
        $this->_numColumns = 1;
        if (is_array($options)) {
            $options = array_merge($default, $options);
        } else {
            $options = $default;
        }
        foreach ($options as $key => $value) {
            $this->{'_' . $key} = $value;
        }
        $this->_objStyles = array('FontName', 'FontSize', 'FontColor', 'FontBold', 'FontItalic', 'TextDecoration', 'BackgroundColor', 'BorderTop', 'BorderLeft', 'BorderRight', 'BorderBottom', 'TextAlign', 'Type');
        $this->_alignArray = array('L' => 'Left', 'R' => 'Right', 'C' => 'Center');
        $this->_estruturaAntes = '<?xml version="1.0" encoding="UTF-8"?>
    <?mso-application progid="Excel.Sheet"?>
    <Workbook xmlns="urn:schemas-microsoft-com:office:spreadsheet"
    xmlns:o="urn:schemas-microsoft-com:office:office"
    xmlns:x="urn:schemas-microsoft-com:office:excel"
    xmlns:ss="urn:schemas-microsoft-com:office:spreadsheet"
    xmlns:html="http://www.w3.org/TR/REC-html40">
    <DocumentProperties xmlns="urn:schemas-microsoft-com:office:office">
    <Author>TA</Author>
    <LastAuthor>TA</LastAuthor>
    <Created>' . date('Y-m-d') . 'T' . date('H:i:s') . 'Z</Created>
    <Company>TA</Company>
    <Version>11.5606</Version>
    </DocumentProperties>
    <OfficeDocumentSettings xmlns="urn:schemas-microsoft-com:office:office">
    <AllowPNG/>
    </OfficeDocumentSettings>
    <ExcelWorkbook xmlns="urn:schemas-microsoft-com:office:excel">
    <WindowHeight>9345</WindowHeight>
    <WindowWidth>11340</WindowWidth>
    <WindowTopX>480</WindowTopX>
    <WindowTopY>60</WindowTopY>
    <ProtectStructure>False</ProtectStructure>
    <ProtectWindows>False</ProtectWindows>
    </ExcelWorkbook>
    <Styles>
    <Style ss:ID="Default" ss:Name="Normal">
    <Alignment ss:Vertical="Bottom"/>
    <Borders/>
    <Font/>
    <Interior/>
    <NumberFormat/>
    <Protection/>
    </Style>
    <Style ss:ID="Title">
    <Font x:Family="Swiss" ss:Bold="1"/>
    </Style>
    <Style ss:ID="String">
        <Font ss:FontName="Arial" ss:Size="7" ss:Color="#000000"/>
        <Alignment ss:Horizontal="Left" ss:Indent="0"/>    
    </Style>
    <Style ss:ID="Numeric">

    </Style>
    <Style ss:ID="Integer"></Style>
    <Style ss:ID="Date">
    <NumberFormat ss:Format="Short Date"/>
    </Style>
    <Style ss:ID="DateTime">
    <NumberFormat ss:Format="d/m/yy\\ h:mm;@"/>
    </Style>
    <Style ss:ID="Time">
    <NumberFormat ss:Format="Short Time"/>
    </Style>
    <Style ss:ID="NumberTime">
    <NumberFormat ss:Format="[hh]:mm:ss"/>
    </Style>
    TaStyles
    </Styles>
    <Worksheet ss:Name="titleFile">
    <Table ss:ExpandedColumnCount="columnQuantity" ss:ExpandedRowCount="rowQuantity" x:FullColumns="1" x:FullRows="1">
    columns';
        $this->_estruturaDepois = '
    </Table>
    <WorksheetOptions xmlns="urn:schemas-microsoft-com:office:excel">
    <PageSetup>
        <Header x:Margin="0.49212598499999999"/>
        <Footer x:Margin="0.49212598499999999"/>
        <PageMargins x:Bottom="0.984251969" x:Left="0.78740157499999996" x:Right="0.78740157499999996" x:Top="0.984251969"/>
    </PageSetup>
    <Print>
        <ValidPrinterInfo/>
        <PaperSizeIndex>9</PaperSizeIndex>
        <HorizontalResolution>600</HorizontalResolution>
        <VerticalResolution>600</VerticalResolution>
    </Print>
    <Selected/>
    <Panes>
        <Pane>
        <Number>3</Number>
        <ActiveRow>12</ActiveRow>
        <ActiveCol>6</ActiveCol>
        </Pane>
    </Panes>
    <ProtectObjects>False</ProtectObjects>
    <ProtectScenarios>False</ProtectScenarios>
    </WorksheetOptions>
    </Worksheet>
    <Worksheet ss:Name="Plan2">
    <Table ss:ExpandedColumnCount="1" ss:ExpandedRowCount="1" x:FullColumns="1"
    x:FullRows="1" ss:DefaultRowHeight="15">
    </Table>
    <WorksheetOptions xmlns="urn:schemas-microsoft-com:office:excel">
    <PageSetup>
        <Header x:Margin="0.49212598499999999"/>
        <Footer x:Margin="0.49212598499999999"/>
        <PageMargins x:Bottom="0.984251969" x:Left="0.78740157499999996" x:Right="0.78740157499999996" x:Top="0.984251969"/>
    </PageSetup>
    <ProtectObjects>False</ProtectObjects>
    <ProtectScenarios>False</ProtectScenarios>
    </WorksheetOptions>
    </Worksheet>
    <Worksheet ss:Name="Plan3">
    <Table ss:ExpandedColumnCount="1" ss:ExpandedRowCount="1" x:FullColumns="1"
    x:FullRows="1" ss:DefaultRowHeight="15">
    </Table>
    <WorksheetOptions xmlns="urn:schemas-microsoft-com:office:excel">
    <PageSetup>
        <Header x:Margin="0.49212598499999999"/>
        <Footer x:Margin="0.49212598499999999"/>
        <PageMargins x:Bottom="0.984251969" x:Left="0.78740157499999996" x:Right="0.78740157499999996" x:Top="0.984251969"/>
    </PageSetup>
    <ProtectObjects>False</ProtectObjects>
    <ProtectScenarios>False</ProtectScenarios>
    </WorksheetOptions>
    </Worksheet>
    </Workbook>
    ';
        $this->_lineIndex = 0;
        $this->_memObject->value = '';
        $this->_cellType = array('NumberTime' => 'DateTime', 'Numbertime' => 'DateTime', 'Time' => 'DateTime', 'Datetime' => 'DateTime', 'DateTime' => 'DateTime', 'Date' => 'DateTime', 'Number' => 'Number', 'Integer' => 'Number', 'Numeric' => 'Number', 'String' => 'String');
        try {
            $this->_name = 'Report_Excel_' . time() . '.xml';
            $file = new ZendT_File($this->_name);
            $this->_fileName = $file->getFilename();
            if (!$this->_fileName) {
                throw new ZendT_Exception('Impossivel criar aquivo', '2');
            }
            //$this->_fileStream = fopen($this->_fileName, 'r+');
        } catch (Exception $e) {
            throw new ZendT_Exception($e->getMessage(), $e->getCode());
        }
    }