ILIAS  eassessment Revision 61809
 All Data Structures Namespaces Files Functions Variables Groups Pages
PHPExcel_CachedObjectStorage_PHPTemp Class Reference
+ Inheritance diagram for PHPExcel_CachedObjectStorage_PHPTemp:
+ Collaboration diagram for PHPExcel_CachedObjectStorage_PHPTemp:

Public Member Functions

 addCacheData ($pCoord, PHPExcel_Cell $cell)
 Add or Update a cell in cache identified by coordinate address.
 getCacheData ($pCoord)
 Get cell at a specific coordinate.
 copyCellCollection (PHPExcel_Worksheet $parent)
 Clone the cell collection.
 unsetWorksheetCells ()
 __construct (PHPExcel_Worksheet $parent, $memoryCacheSize= '1MB')
 __destruct ()
- Public Member Functions inherited from PHPExcel_CachedObjectStorage_CacheBase
 __construct (PHPExcel_Worksheet $parent)
 isDataSet ($pCoord)
 Is a value set in the current PHPExcel_CachedObjectStorage_ICache for an indexed cell?
 updateCacheData (PHPExcel_Cell $cell)
 Add or Update a cell in cache.
 deleteCacheData ($pCoord)
 Delete a cell in cache identified by coordinate address.
 getCellList ()
 Get a list of all cell addresses currently held in cache.
 getSortedCellList ()
 Sort the list of all cell addresses currently held in cache by row and column.
- Public Member Functions inherited from PHPExcel_CachedObjectStorage_ICache
 updateCacheData (PHPExcel_Cell $cell)
 Add or Update a cell in cache.
 deleteCacheData ($pCoord)
 Delete a cell in cache identified by coordinate address.
 isDataSet ($pCoord)
 Is a value set in the current PHPExcel_CachedObjectStorage_ICache for an indexed cell?
 getCellList ()
 Get a list of all cell addresses currently held in cache.
 getSortedCellList ()
 Get the list of all cell addresses currently held in cache sorted by column and row.

Private Member Functions

 _storeData ()

Private Attributes

 $_fileHandle = null
 $_memoryCacheSize = null

Additional Inherited Members

- Protected Member Functions inherited from PHPExcel_CachedObjectStorage_CacheBase
 _getUniqueID ()
- Protected Attributes inherited from PHPExcel_CachedObjectStorage_CacheBase
 $_parent
 $_currentObject = null
 $_currentObjectID = null
 $_cellCache = array()

Detailed Description

Definition at line 36 of file PHPTemp.php.

Constructor & Destructor Documentation

PHPExcel_CachedObjectStorage_PHPTemp::__construct ( PHPExcel_Worksheet  $parent,
  $memoryCacheSize = '1MB' 
)

Definition at line 140 of file PHPTemp.php.

{
$this->_memoryCacheSize = (isset($arguments['memoryCacheSize'])) ? $arguments['memoryCacheSize'] : '1MB';
if (is_null($this->_fileHandle)) {
$this->_fileHandle = fopen('php://temp/maxmemory:'.$this->_memoryCacheSize,'a+');
}
} // function __construct()
PHPExcel_CachedObjectStorage_PHPTemp::__destruct ( )

Definition at line 150 of file PHPTemp.php.

Referenced by unsetWorksheetCells().

{
if (!is_null($this->_fileHandle)) {
fclose($this->_fileHandle);
}
$this->_fileHandle = null;
} // function __destruct()

+ Here is the caller graph for this function:

Member Function Documentation

PHPExcel_CachedObjectStorage_PHPTemp::_storeData ( )
private

Definition at line 43 of file PHPTemp.php.

References PHPExcel_CachedObjectStorage_CacheBase\$_currentObjectID.

Referenced by addCacheData(), and getCacheData().

{
$this->_currentObject->detach();
fseek($this->_fileHandle,0,SEEK_END);
$offset = ftell($this->_fileHandle);
fwrite($this->_fileHandle, serialize($this->_currentObject));
$this->_cellCache[$this->_currentObjectID] = array('ptr' => $offset,
'sz' => ftell($this->_fileHandle) - $offset
);
$this->_currentObjectID = $this->_currentObject = null;
} // function _storeData()

+ Here is the caller graph for this function:

PHPExcel_CachedObjectStorage_PHPTemp::addCacheData (   $pCoord,
PHPExcel_Cell  $cell 
)

Add or Update a cell in cache identified by coordinate address.

Parameters
string$pCoordCoordinate address of the cell to update
PHPExcel_Cell$cellCell to update
Returns
void
Exceptions
Exception

Implements PHPExcel_CachedObjectStorage_ICache.

Definition at line 64 of file PHPTemp.php.

References _storeData().

{
if (($pCoord !== $this->_currentObjectID) && ($this->_currentObjectID !== null)) {
$this->_storeData();
}
$this->_currentObjectID = $pCoord;
$this->_currentObject = $cell;
return $cell;
} // function addCacheData()

+ Here is the call graph for this function:

PHPExcel_CachedObjectStorage_PHPTemp::copyCellCollection ( PHPExcel_Worksheet  $parent)

Clone the cell collection.

Returns
void

Reimplemented from PHPExcel_CachedObjectStorage_CacheBase.

Definition at line 112 of file PHPTemp.php.

{
// Open a new stream for the cell cache data
$newFileHandle = fopen('php://temp/maxmemory:'.$this->_memoryCacheSize,'a+');
// Copy the existing cell cache data to the new stream
fseek($this->_fileHandle,0);
while (!feof($this->_fileHandle)) {
fwrite($newFileHandle,fread($this->_fileHandle, 1024));
}
$this->_fileHandle = $newFileHandle;
} // function copyCellCollection()
PHPExcel_CachedObjectStorage_PHPTemp::getCacheData (   $pCoord)

Get cell at a specific coordinate.

Parameters
string$pCoordCoordinate of the cell
Exceptions
Exception
Returns
PHPExcel_Cell Cell that was found, or null if not found

Implements PHPExcel_CachedObjectStorage_ICache.

Definition at line 83 of file PHPTemp.php.

References PHPExcel_CachedObjectStorage_CacheBase\$_currentObject, and _storeData().

{
if ($pCoord === $this->_currentObjectID) {
}
$this->_storeData();
// Check if the entry that has been requested actually exists
if (!isset($this->_cellCache[$pCoord])) {
// Return null if requested entry doesn't exist in cache
return null;
}
// Set current entry to the requested entry
$this->_currentObjectID = $pCoord;
fseek($this->_fileHandle,$this->_cellCache[$pCoord]['ptr']);
$this->_currentObject = unserialize(fread($this->_fileHandle,$this->_cellCache[$pCoord]['sz']));
// Re-attach the parent worksheet
$this->_currentObject->attach($this->_parent);
// Return requested entry
} // function getCacheData()

+ Here is the call graph for this function:

PHPExcel_CachedObjectStorage_PHPTemp::unsetWorksheetCells ( )

Definition at line 125 of file PHPTemp.php.

References __destruct().

{
if(!is_null($this->_currentObject)) {
$this->_currentObject->detach();
$this->_currentObject = $this->_currentObjectID = null;
}
$this->_cellCache = array();
// detach ourself from the worksheet, so that it can then delete this object successfully
$this->_parent = null;
// Close down the php://temp file
$this->__destruct();
} // function unsetWorksheetCells()

+ Here is the call graph for this function:

Field Documentation

PHPExcel_CachedObjectStorage_PHPTemp::$_fileHandle = null
private

Definition at line 38 of file PHPTemp.php.

PHPExcel_CachedObjectStorage_PHPTemp::$_memoryCacheSize = null
private

Definition at line 41 of file PHPTemp.php.


The documentation for this class was generated from the following file: