ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
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. More...
 
 getCacheData ($pCoord)
 Get cell at a specific coordinate. More...
 
 getCellList ()
 Get a list of all cell addresses currently held in cache. More...
 
 copyCellCollection (PHPExcel_Worksheet $parent)
 Clone the cell collection. More...
 
 unsetWorksheetCells ()
 Clear the cell collection and disconnect from our parent. More...
 
 __construct (PHPExcel_Worksheet $parent, $arguments)
 Initialise this new cell collection. More...
 
 __destruct ()
 Destroy this cell collection. More...
 
- Public Member Functions inherited from PHPExcel_CachedObjectStorage_CacheBase
 __construct (PHPExcel_Worksheet $parent)
 Initialise this new cell collection. More...
 
 getParent ()
 Return the parent worksheet for this cell collection. More...
 
 isDataSet ($pCoord)
 Is a value set in the current PHPExcel_CachedObjectStorage_ICache for an indexed cell? More...
 
 moveCell ($fromAddress, $toAddress)
 Move a cell object from one address to another. More...
 
 updateCacheData (PHPExcel_Cell $cell)
 Add or Update a cell in cache. More...
 
 deleteCacheData ($pCoord)
 Delete a cell in cache identified by coordinate address. More...
 
 getCellList ()
 Get a list of all cell addresses currently held in cache. More...
 
 getSortedCellList ()
 Sort the list of all cell addresses currently held in cache by row and column. More...
 
 getHighestRowAndColumn ()
 Get highest worksheet column and highest row that have cell records. More...
 
 getCurrentAddress ()
 Return the cell address of the currently active cell object. More...
 
 getCurrentColumn ()
 Return the column address of the currently active cell object. More...
 
 getCurrentRow ()
 Return the row address of the currently active cell object. More...
 
 getHighestColumn ($row=null)
 Get highest worksheet column. More...
 
 getHighestRow ($column=null)
 Get highest worksheet row. More...
 
 copyCellCollection (PHPExcel_Worksheet $parent)
 Clone the cell collection. More...
 
 removeRow ($row)
 Remove a row, deleting all cells in that row. More...
 
 removeColumn ($column)
 Remove a column, deleting all cells in that column. More...
 
- Public Member Functions inherited from PHPExcel_CachedObjectStorage_ICache
 updateCacheData (PHPExcel_Cell $cell)
 Add or Update a cell in cache. More...
 
 deleteCacheData ($pCoord)
 Delete a cell in cache identified by coordinate address. More...
 
 isDataSet ($pCoord)
 Is a value set in the current PHPExcel_CachedObjectStorage_ICache for an indexed cell? More...
 
 getSortedCellList ()
 Get the list of all cell addresses currently held in cache sorted by column and row. More...
 

Protected Member Functions

 _storeData ()
 Store cell data in cache for the current cell object if it's "dirty", and the 'nullify' the current cell object. More...
 
- Protected Member Functions inherited from PHPExcel_CachedObjectStorage_CacheBase
 _getUniqueID ()
 Generate a unique ID for cache referencing. More...
 

Private Attributes

 $_fileName = NULL
 
 $_fileHandle = NULL
 
 $_cacheDirectory = NULL
 

Additional Inherited Members

- Static Public Member Functions inherited from PHPExcel_CachedObjectStorage_CacheBase
static cacheMethodIsAvailable ()
 Identify whether the caching method is currently available Some methods are dependent on the availability of certain extensions being enabled in the PHP build. More...
 
- Static Public Member Functions inherited from PHPExcel_CachedObjectStorage_ICache
static cacheMethodIsAvailable ()
 Identify whether the caching method is currently available Some methods are dependent on the availability of certain extensions being enabled in the PHP build. More...
 
- Protected Attributes inherited from PHPExcel_CachedObjectStorage_CacheBase
 $_parent
 
 $_currentObject = null
 
 $_currentObjectID = null
 
 $_currentCellIsDirty = true
 
 $_cellCache = array()
 

Detailed Description

Definition at line 36 of file DiscISAM.php.

Constructor & Destructor Documentation

◆ __construct()

PHPExcel_CachedObjectStorage_DiscISAM::__construct ( PHPExcel_Worksheet  $parent,
  $arguments 
)

Initialise this new cell collection.

Parameters
PHPExcel_Worksheet$parentThe worksheet for this cell collection
arrayof mixed $arguments Additional initialisation arguments

Definition at line 194 of file DiscISAM.php.

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

194  {
195  $this->_cacheDirectory = ((isset($arguments['dir'])) && ($arguments['dir'] !== NULL))
196  ? $arguments['dir']
198 
199  parent::__construct($parent);
200  if (is_null($this->_fileHandle)) {
201  $baseUnique = $this->_getUniqueID();
202  $this->_fileName = $this->_cacheDirectory.'/PHPExcel.'.$baseUnique.'.cache';
203  $this->_fileHandle = fopen($this->_fileName,'a+');
204  }
205  } // function __construct()
_getUniqueID()
Generate a unique ID for cache referencing.
Definition: CacheBase.php:311
static sys_get_temp_dir()
Get the systems temporary directory.
Definition: File.php:135
+ Here is the call graph for this function:

◆ __destruct()

PHPExcel_CachedObjectStorage_DiscISAM::__destruct ( )

Destroy this cell collection.

Definition at line 211 of file DiscISAM.php.

Referenced by unsetWorksheetCells().

211  {
212  if (!is_null($this->_fileHandle)) {
213  fclose($this->_fileHandle);
214  unlink($this->_fileName);
215  }
216  $this->_fileHandle = null;
217  } // function __destruct()
+ Here is the caller graph for this function:

Member Function Documentation

◆ _storeData()

PHPExcel_CachedObjectStorage_DiscISAM::_storeData ( )
protected

Store cell data in cache for the current cell object if it's "dirty", and the 'nullify' the current cell object.

Returns
void
Exceptions
PHPExcel_Exception

Definition at line 67 of file DiscISAM.php.

References PHPExcel_CachedObjectStorage_CacheBase\$_currentObjectID, and array.

Referenced by addCacheData(), getCacheData(), and getCellList().

67  {
68  if ($this->_currentCellIsDirty && !empty($this->_currentObjectID)) {
69  $this->_currentObject->detach();
70 
71  fseek($this->_fileHandle,0,SEEK_END);
72 
73  $this->_cellCache[$this->_currentObjectID] = array(
74  'ptr' => ftell($this->_fileHandle),
75  'sz' => fwrite($this->_fileHandle, serialize($this->_currentObject))
76  );
77  $this->_currentCellIsDirty = false;
78  }
79  $this->_currentObjectID = $this->_currentObject = null;
80  } // function _storeData()
Create styles array
The data for the language used.
+ Here is the caller graph for this function:

◆ addCacheData()

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
PHPExcel_Cell
Exceptions
PHPExcel_Exception

Implements PHPExcel_CachedObjectStorage_ICache.

Definition at line 91 of file DiscISAM.php.

References _storeData().

91  {
92  if (($pCoord !== $this->_currentObjectID) && ($this->_currentObjectID !== null)) {
93  $this->_storeData();
94  }
95 
96  $this->_currentObjectID = $pCoord;
97  $this->_currentObject = $cell;
98  $this->_currentCellIsDirty = true;
99 
100  return $cell;
101  } // function addCacheData()
_storeData()
Store cell data in cache for the current cell object if it's "dirty", and the 'nullify' the current c...
Definition: DiscISAM.php:67
+ Here is the call graph for this function:

◆ copyCellCollection()

PHPExcel_CachedObjectStorage_DiscISAM::copyCellCollection ( PHPExcel_Worksheet  $parent)

Clone the cell collection.

Parameters
PHPExcel_Worksheet$parentThe new worksheet
Returns
void

Implements PHPExcel_CachedObjectStorage_ICache.

Definition at line 155 of file DiscISAM.php.

References PHPExcel_CachedObjectStorage_CacheBase\_getUniqueID().

155  {
156  parent::copyCellCollection($parent);
157  // Get a new id for the new file name
158  $baseUnique = $this->_getUniqueID();
159  $newFileName = $this->_cacheDirectory.'/PHPExcel.'.$baseUnique.'.cache';
160  // Copy the existing cell cache file
161  copy ($this->_fileName,$newFileName);
162  $this->_fileName = $newFileName;
163  // Open the copied cell cache file
164  $this->_fileHandle = fopen($this->_fileName,'a+');
165  } // function copyCellCollection()
_getUniqueID()
Generate a unique ID for cache referencing.
Definition: CacheBase.php:311
+ Here is the call graph for this function:

◆ getCacheData()

PHPExcel_CachedObjectStorage_DiscISAM::getCacheData (   $pCoord)

Get cell at a specific coordinate.

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

Implements PHPExcel_CachedObjectStorage_ICache.

Definition at line 111 of file DiscISAM.php.

References PHPExcel_CachedObjectStorage_CacheBase\$_currentObject, and _storeData().

111  {
112  if ($pCoord === $this->_currentObjectID) {
113  return $this->_currentObject;
114  }
115  $this->_storeData();
116 
117  // Check if the entry that has been requested actually exists
118  if (!isset($this->_cellCache[$pCoord])) {
119  // Return null if requested entry doesn't exist in cache
120  return null;
121  }
122 
123  // Set current entry to the requested entry
124  $this->_currentObjectID = $pCoord;
125  fseek($this->_fileHandle, $this->_cellCache[$pCoord]['ptr']);
126  $this->_currentObject = unserialize(fread($this->_fileHandle, $this->_cellCache[$pCoord]['sz']));
127  // Re-attach this as the cell's parent
128  $this->_currentObject->attach($this);
129 
130  // Return requested entry
131  return $this->_currentObject;
132  } // function getCacheData()
_storeData()
Store cell data in cache for the current cell object if it's "dirty", and the 'nullify' the current c...
Definition: DiscISAM.php:67
+ Here is the call graph for this function:

◆ getCellList()

PHPExcel_CachedObjectStorage_DiscISAM::getCellList ( )

Get a list of all cell addresses currently held in cache.

Returns
string[]

Implements PHPExcel_CachedObjectStorage_ICache.

Definition at line 140 of file DiscISAM.php.

References _storeData().

140  {
141  if ($this->_currentObjectID !== null) {
142  $this->_storeData();
143  }
144 
145  return parent::getCellList();
146  }
_storeData()
Store cell data in cache for the current cell object if it's "dirty", and the 'nullify' the current c...
Definition: DiscISAM.php:67
+ Here is the call graph for this function:

◆ unsetWorksheetCells()

PHPExcel_CachedObjectStorage_DiscISAM::unsetWorksheetCells ( )

Clear the cell collection and disconnect from our parent.

Returns
void

Definition at line 173 of file DiscISAM.php.

References __destruct(), and array.

173  {
174  if(!is_null($this->_currentObject)) {
175  $this->_currentObject->detach();
176  $this->_currentObject = $this->_currentObjectID = null;
177  }
178  $this->_cellCache = array();
179 
180  // detach ourself from the worksheet, so that it can then delete this object successfully
181  $this->_parent = null;
182 
183  // Close down the temporary cache file
184  $this->__destruct();
185  } // function unsetWorksheetCells()
__destruct()
Destroy this cell collection.
Definition: DiscISAM.php:211
Create styles array
The data for the language used.
+ Here is the call graph for this function:

Field Documentation

◆ $_cacheDirectory

PHPExcel_CachedObjectStorage_DiscISAM::$_cacheDirectory = NULL
private

Definition at line 57 of file DiscISAM.php.

◆ $_fileHandle

PHPExcel_CachedObjectStorage_DiscISAM::$_fileHandle = NULL
private

Definition at line 50 of file DiscISAM.php.

◆ $_fileName

PHPExcel_CachedObjectStorage_DiscISAM::$_fileName = NULL
private

Definition at line 43 of file DiscISAM.php.


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