ILIAS  eassessment Revision 61809
 All Data Structures Namespaces Files Functions Variables Groups Pages
MemorySerialized.php
Go to the documentation of this file.
1 <?php
37 
38  private function _storeData() {
39  $this->_currentObject->detach();
40 
41  $this->_cellCache[$this->_currentObjectID] = serialize($this->_currentObject);
42  $this->_currentObjectID = $this->_currentObject = null;
43  } // function _storeData()
44 
45 
54  public function addCacheData($pCoord, PHPExcel_Cell $cell) {
55  if (($pCoord !== $this->_currentObjectID) && ($this->_currentObjectID !== null)) {
56  $this->_storeData();
57  }
58 
59  $this->_currentObjectID = $pCoord;
60  $this->_currentObject = $cell;
61 
62  return $cell;
63  } // function addCacheData()
64 
65 
73  public function getCacheData($pCoord) {
74  if ($pCoord === $this->_currentObjectID) {
75  return $this->_currentObject;
76  }
77  $this->_storeData();
78 
79  // Check if the entry that has been requested actually exists
80  if (!isset($this->_cellCache[$pCoord])) {
81  // Return null if requested entry doesn't exist in cache
82  return null;
83  }
84 
85  // Set current entry to the requested entry
86  $this->_currentObjectID = $pCoord;
87  $this->_currentObject = unserialize($this->_cellCache[$pCoord]);
88  // Re-attach the parent worksheet
89  $this->_currentObject->attach($this->_parent);
90 
91  // Return requested entry
92  return $this->_currentObject;
93  } // function getCacheData()
94 
95 
96  public function unsetWorksheetCells() {
97  if(!is_null($this->_currentObject)) {
98  $this->_currentObject->detach();
99  $this->_currentObject = $this->_currentObjectID = null;
100  }
101  $this->_cellCache = array();
102 
103  // detach ourself from the worksheet, so that it can then delete this object successfully
104  $this->_parent = null;
105  } // function unsetWorksheetCells()
106 
107 }