blob: afffe16bdfc14457be1e4e3ca0487e2b6f3f18ef (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
|
<?php
/**
* @version $Header:$
*
* Copyright (c) 2006 bitweaver.org
* All Rights Reserved. See below for details and a complete list of authors.
* Licensed under the GNU LESSER GENERAL PUBLIC LICENSE. See http://www.gnu.org/copyleft/lesser.html for details
*
* @package bitexcel
*/
/**
* required setup
*/
require_once( UTIL_PKG_INCLUDE_PATH.'PHPAsync.php' );
require_once( UTIL_PKG_INCLUDE_PATH.'bitexcel/BitExcel.php' );
/**
* @package bitexcel
*/
class BitExcelAsync extends BitExcel{
private $mAsync;
public function __construct( $pConfig=array() ){
parent::__construct( $pConfig );
}
public function writeWorkbookAsync( $pParamHash ){
$config = array(
'append_log' => TRUE,
'memory_limit' => '256M',
);
$this->mAsync = new PHPAsync( NULL, $config );
$this->mAsync->runProcess( $this, 'writeWorkbook', $pParamHash, 'getUpdateInitOutput' );
}
public function writeWorkbook( $pParamHash ){
if( $rslt = parent::writeWorkbook( $pParamHash ) ){
// notify async
$this->mAsync->updateStatus( $rslt );
}else{
$this->mAsync->updateStatus( 'There was a problem' );
}
}
public function getUpdateInitOutput(){
return tra( "Generating Export File... please be patient" );
}
public function getUpdateStatus( $pPidId ){
$this->mAsync = new PHPAsync( $pPidId );
if( $status = $this->mAsync->getStatus() ){
return $status;
}
return 'Error: '.$this->mAsync->getErrorValue('get_status');
}
}
|