Skip to content

Commit

Permalink
Updates to release v1.2.4 fixes #112
Browse files Browse the repository at this point in the history
  • Loading branch information
kartik-v committed Feb 4, 2016
1 parent e56aefb commit aef6d75
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 18 deletions.
10 changes: 7 additions & 3 deletions CHANGE.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,18 @@ Change Log: `yii2-export`

## version 1.2.4

**Date:** 28-Nov-2015
**Date:** 04-Feb-2016

- (enh #78): Add Portugese Brazilian transactions.
- (enh #87): Cache dataProvider total count (for performance).
- (enh #89): New property `onInitExcel` as an event for `initPHPExcel` method.
- (enh #98): More correct models count for `generateBody` method.
- (enh #99):New setter methods `setPHPExcel`, `setPHPExcelWriter`, `setPHPExcelSheet`
- (enh #98): More correct models count for generateBody.
- (enh #99): New setter methods `setPHPExcel`, `setPHPExcelWriter`, `setPHPExcelSheet`
- PHP comment formatting and PHPDoc updates.
- (enh #100): Add Czech language translations.
- (enh #100): Add Czech language translations.
- (enh #112): Added option to configure timeout.
- (enh #114): Add composer branch alias to allow getting latest `dev-master` updates.

## version 1.2.3

Expand Down
33 changes: 18 additions & 15 deletions ExportMenu.php
Original file line number Diff line number Diff line change
Expand Up @@ -181,6 +181,12 @@ class ExportMenu extends GridView
*/
public $template = "{columns}\n{menu}";

/**
* @var int timeout for the export function (in seconds), if timeout = -1 it doesn't set any timeout so default PHP
* timeout will be used
*/
public $timeout = -1;

/**
* @var array the HTML attributes for the export form.
*/
Expand Down Expand Up @@ -599,6 +605,9 @@ public function run()
echo $this->renderExportMenu();
return;
}
if ($this->timeout >= 0) {
set_time_limit($this->timeout);
}
if (!$this->_doNotStream) {
$this->clearOutputBuffers();
}
Expand All @@ -620,15 +629,6 @@ public function run()
$this->generateFooter($row);
$writer = $this->_objPHPExcelWriter;
$sheet = $this->_objPHPExcelSheet;
if ($this->_exportType === self::FORMAT_CSV || $this->_exportType === self::FORMAT_TEXT) {
/**
* @var PHPExcel_Writer_CSV $writer
*/
$writer->setExcelCompatibility(true);
if ($this->_exportType === self::FORMAT_TEXT) {
$writer->setDelimiter("\t");
}
}
if ($this->autoWidth) {
foreach ($this->getVisibleColumns() as $n => $column) {
$sheet->getColumnDimension(self::columnName($n + 1))->setAutoSize(true);
Expand Down Expand Up @@ -1140,16 +1140,19 @@ public function initPHPExcel()
/**
* Initializes PHP Excel Writer Object Instance
*
* @param string $writer the writer type as set in export config
* @param string $type the writer type as set in export config
*
* @return void
*/
public function initPHPExcelWriter($writer)
public function initPHPExcelWriter($type)
{
$this->_objPHPExcelWriter = PHPExcel_IOFactory::createWriter(
$this->_objPHPExcel,
$writer
);
/**
* @var PHPExcel_Writer_CSV $writer
*/
$writer = $this->_objPHPExcelWriter = PHPExcel_IOFactory::createWriter($this->_objPHPExcel, $type);
if ($this->_exportType === self::FORMAT_TEXT) {
$writer->setDelimiter("\t");
}
$this->raiseEvent('onInitWriter', [$this->_objPHPExcelWriter, $this]);
}

Expand Down
5 changes: 5 additions & 0 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,5 +34,10 @@
"psr-4": {
"kartik\\export\\": ""
}
},
"extra": {
"branch-alias": {
"dev-master": "1.2.x-dev"
}
}
}

0 comments on commit aef6d75

Please sign in to comment.