ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
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. 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

 $_fileHandle = null
 
 $_memoryCacheSize = 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 PHPTemp.php.

Constructor & Destructor Documentation

◆ __construct()

PHPExcel_CachedObjectStorage_PHPTemp::__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 186 of file PHPTemp.php.

186  {
187  $this->_memoryCacheSize = (isset($arguments['memoryCacheSize'])) ? $arguments['memoryCacheSize'] : '1MB';
188 
189  parent::__construct($parent);
190  if (is_null($this->_fileHandle)) {
191  $this->_fileHandle = fopen('php://temp/maxmemory:'.$this->_memoryCacheSize,'a+');
192  }
193  } // function __construct()

◆ __destruct()

PHPExcel_CachedObjectStorage_PHPTemp::__destruct ( )

Destroy this cell collection.

Definition at line 199 of file PHPTemp.php.

Referenced by unsetWorksheetCells().

199  {
200  if (!is_null($this->_fileHandle)) {
201  fclose($this->_fileHandle);
202  }
203  $this->_fileHandle = null;
204  } // function __destruct()
+ Here is the caller graph for this function:

Member Function Documentation

◆ _storeData()

PHPExcel_CachedObjectStorage_PHPTemp::_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 59 of file PHPTemp.php.

References PHPExcel_CachedObjectStorage_CacheBase\$_currentObjectID, and array.

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

59  {
60  if ($this->_currentCellIsDirty && !empty($this->_currentObjectID)) {
61  $this->_currentObject->detach();
62 
63  fseek($this->_fileHandle,0,SEEK_END);
64 
65  $this->_cellCache[$this->_currentObjectID] = array(
66  'ptr' => ftell($this->_fileHandle),
67  'sz' => fwrite($this->_fileHandle, serialize($this->_currentObject))
68  );
69  $this->_currentCellIsDirty = false;
70  }
71  $this->_currentObjectID = $this->_currentObject = null;
72  } // function _storeData()
Create styles array
The data for the language used.
+ Here is the caller graph for this function:

◆ addCacheData()

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

Implements PHPExcel_CachedObjectStorage_ICache.

Definition at line 83 of file PHPTemp.php.

References _storeData().

83  {
84  if (($pCoord !== $this->_currentObjectID) && ($this->_currentObjectID !== null)) {
85  $this->_storeData();
86  }
87 
88  $this->_currentObjectID = $pCoord;
89  $this->_currentObject = $cell;
90  $this->_currentCellIsDirty = true;
91 
92  return $cell;
93  } // function addCacheData()
_storeData()
Store cell data in cache for the current cell object if it's "dirty", and the 'nullify' the current c...
Definition: PHPTemp.php:59
+ Here is the call graph for this function:

◆ copyCellCollection()

PHPExcel_CachedObjectStorage_PHPTemp::copyCellCollection ( PHPExcel_Worksheet  $parent)

Clone the cell collection.

Parameters
PHPExcel_Worksheet$parentThe new worksheet
Returns
void

Implements PHPExcel_CachedObjectStorage_ICache.

Definition at line 147 of file PHPTemp.php.

147  {
148  parent::copyCellCollection($parent);
149  // Open a new stream for the cell cache data
150  $newFileHandle = fopen('php://temp/maxmemory:'.$this->_memoryCacheSize,'a+');
151  // Copy the existing cell cache data to the new stream
152  fseek($this->_fileHandle,0);
153  while (!feof($this->_fileHandle)) {
154  fwrite($newFileHandle,fread($this->_fileHandle, 1024));
155  }
156  $this->_fileHandle = $newFileHandle;
157  } // function copyCellCollection()

◆ getCacheData()

PHPExcel_CachedObjectStorage_PHPTemp::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 103 of file PHPTemp.php.

References PHPExcel_CachedObjectStorage_CacheBase\$_currentObject, and _storeData().

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

◆ getCellList()

PHPExcel_CachedObjectStorage_PHPTemp::getCellList ( )

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

Returns
string[]

Implements PHPExcel_CachedObjectStorage_ICache.

Definition at line 132 of file PHPTemp.php.

References _storeData().

132  {
133  if ($this->_currentObjectID !== null) {
134  $this->_storeData();
135  }
136 
137  return parent::getCellList();
138  }
_storeData()
Store cell data in cache for the current cell object if it's "dirty", and the 'nullify' the current c...
Definition: PHPTemp.php:59
+ Here is the call graph for this function:

◆ unsetWorksheetCells()

PHPExcel_CachedObjectStorage_PHPTemp::unsetWorksheetCells ( )

Clear the cell collection and disconnect from our parent.

Returns
void

Definition at line 165 of file PHPTemp.php.

References __destruct(), and array.

165  {
166  if(!is_null($this->_currentObject)) {
167  $this->_currentObject->detach();
168  $this->_currentObject = $this->_currentObjectID = null;
169  }
170  $this->_cellCache = array();
171 
172  // detach ourself from the worksheet, so that it can then delete this object successfully
173  $this->_parent = null;
174 
175  // Close down the php://temp file
176  $this->__destruct();
177  } // function unsetWorksheetCells()
__destruct()
Destroy this cell collection.
Definition: PHPTemp.php:199
Create styles array
The data for the language used.
+ Here is the call graph for this function:

Field Documentation

◆ $_fileHandle

PHPExcel_CachedObjectStorage_PHPTemp::$_fileHandle = null
private

Definition at line 43 of file PHPTemp.php.

◆ $_memoryCacheSize

PHPExcel_CachedObjectStorage_PHPTemp::$_memoryCacheSize = null
private

Definition at line 50 of file PHPTemp.php.


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