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

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)
 __destruct ()
- Public Member Functions inherited from PHPExcel_CachedObjectStorage_CacheBase
 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

 $_fileName = null
 $_fileHandle = 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 DiscISAM.php.

Constructor & Destructor Documentation

PHPExcel_CachedObjectStorage_DiscISAM::__construct ( PHPExcel_Worksheet  $parent)

Reimplemented from PHPExcel_CachedObjectStorage_CacheBase.

Definition at line 139 of file DiscISAM.php.

References PHPExcel_CachedObjectStorage_CacheBase\_getUniqueID(), and PHPExcel_Shared_File\sys_get_temp_dir().

{
if (is_null($this->_fileHandle)) {
$baseUnique = $this->_getUniqueID();
$this->_fileName = PHPExcel_Shared_File::sys_get_temp_dir().'/PHPExcel.'.$baseUnique.'.cache';
$this->_fileHandle = fopen($this->_fileName,'a+');
}
} // function __construct()

+ Here is the call graph for this function:

PHPExcel_CachedObjectStorage_DiscISAM::__destruct ( )

Definition at line 149 of file DiscISAM.php.

Referenced by unsetWorksheetCells().

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

+ Here is the caller graph for this function:

Member Function Documentation

PHPExcel_CachedObjectStorage_DiscISAM::_storeData ( )
private

Definition at line 42 of file DiscISAM.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_DiscISAM::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 63 of file DiscISAM.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_DiscISAM::copyCellCollection ( PHPExcel_Worksheet  $parent)

Clone the cell collection.

Returns
void

Reimplemented from PHPExcel_CachedObjectStorage_CacheBase.

Definition at line 111 of file DiscISAM.php.

References PHPExcel_CachedObjectStorage_CacheBase\_getUniqueID(), and PHPExcel_Shared_File\sys_get_temp_dir().

{
// Get a new id for the new file name
$baseUnique = $this->_getUniqueID();
$newFileName = PHPExcel_Shared_File::sys_get_temp_dir().'/PHPExcel.'.$baseUnique.'.cache';
// Copy the existing cell cache file
copy ($this->_fileName,$newFileName);
$this->_fileName = $newFileName;
// Open the copied cell cache file
$this->_fileHandle = fopen($this->_fileName,'a+');
} // function copyCellCollection()

+ Here is the call graph for this function:

PHPExcel_CachedObjectStorage_DiscISAM::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 82 of file DiscISAM.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_DiscISAM::unsetWorksheetCells ( )

Definition at line 124 of file DiscISAM.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 temporary cache file
$this->__destruct();
} // function unsetWorksheetCells()

+ Here is the call graph for this function:

Field Documentation

PHPExcel_CachedObjectStorage_DiscISAM::$_fileHandle = null
private

Definition at line 39 of file DiscISAM.php.

PHPExcel_CachedObjectStorage_DiscISAM::$_fileName = null
private

Definition at line 38 of file DiscISAM.php.


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