/**
  * Get all records for the current key from the session.
  *
  * @return array
  */
 private function getRecordsFromSession()
 {
     return SessionStore::getInstance($this->_key)->getData();
 }
Esempio n. 2
0
 /**
  * Delete the database in the session.
  *
  * @return bool Results, true or false
  */
 protected function _doDeleteSession()
 {
     $selector = Tools::atkArrayNvl($this->m_postvars, 'atkselector', '');
     return SessionStore::getInstance()->deleteDataRowForSelector($selector);
 }
Esempio n. 3
0
 /**
  * Persist records from the session (in add mode) to the database.
  *
  * @param Db $db
  * @param array $record
  * @param string $mode
  *
  * @return bool
  */
 private function storeAdd($db, $record, $mode)
 {
     if (!$this->createDestination()) {
         return false;
     }
     $rows = SessionStore::getInstance($this->getSessionStoreKey())->getData();
     foreach ($rows as $row) {
         $this->updateSessionAddFakeId($row, $this->getSessionAddFakeId(), $record);
         $this->m_destInstance->addDb($row);
     }
     // after saving the rows, we can clear the sessionstore
     SessionStore::getInstance($this->getSessionStoreKey())->setData(null);
     return true;
 }
Esempio n. 4
0
 /**
  * Store a record in the session.
  *
  * @param array $record Record to store in the session
  *
  * @return bool Successfull save?
  */
 protected function storeRecordInSession(&$record)
 {
     Tools::atkdebug('STORING RECORD IN SESSION');
     $result = SessionStore::getInstance()->addDataRow($record, $this->m_node->primaryKeyField());
     return $result !== false;
 }
Esempio n. 5
0
 /**
  * Get the current record from the database with the current selector.
  *
  * @return array
  */
 protected function getRecordFromSession()
 {
     $selector = Tools::atkArrayNvl($this->m_node->m_postvars, 'atkselector', '');
     return SessionStore::getInstance()->getDataRowForSelector($selector);
 }
Esempio n. 6
0
 /**
  * Update a record in the session.
  *
  * @param array $record Record to update
  *
  * @return mixed Result of the update, true or false
  */
 private function updateRecordInSession($record)
 {
     $selector = Tools::atkArrayNvl($this->m_postvars, 'atkselector', '');
     return SessionStore::getInstance()->updateDataRowForSelector($selector, $record) !== false;
 }