Changeset 163 for Dev/trunk/classes
- Timestamp:
- 11/18/11 15:28:51 (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
Dev/trunk/classes/pipelineSequencer.php
r156 r163 15 15 private $loadedSession; 16 16 private $selectedStep; 17 private $dbi; 17 18 18 19 public function __construct() { 19 //nothing yet20 $this->dbi = new DatabaseInterface(); 20 21 } 21 22 22 23 public function init() { 23 24 $stringPipeline = ""; 24 if (is_array($this->loadedSession->pipeline)){ 25 foreach ($this->loadedSession->pipeline as $object) { 26 $stringPipeline .= "$object->uid,"; 27 } 28 $stringPipeline = rtrim($stringPipeline, ","); 29 } 30 else { 25 if (is_array($this->loadedSession->pipeline)) { 26 foreach ($this->loadedSession->pipeline as $object) { 27 $stringPipeline .= "$object->uid,"; 28 } 29 $stringPipeline = rtrim($stringPipeline, ","); 30 } else { 31 31 $stringPipeline = $this->loadedSession->pipeline; 32 32 } … … 83 83 } 84 84 85 public function GetFromDB($currentSession) { // Initialize variables on page load. 86 $dbi = new DatabaseInterface(); 85 public function LoadSession($currentSession) { // Initialize variables on page load. 87 86 if (!isset($currentSession)) { 88 $_SESSION['message'] = "No session set!";89 87 redirect("selectSession.php"); 90 88 } 91 92 $sessionResults = $dbi->get("Session", array("uid" => $currentSession)); 93 if (count($sessionResults) > 0) { 94 $this->loadedSession = $sessionResults[0]; 95 } else { //No session with that UID found in database! 96 die("Invalid session!"); 89 if (isset($_SESSION['updateNeeded'])) { // user has performed an operation that flags session to be reloaded from DB, or is first load of page for that session 90 $sessionResults = $this->dbi->get("Session", array("uid" => $currentSession)); 91 92 if (count($sessionResults) > 0) { 93 $_SESSION['localSessionCopy'] = $sessionResults[0]; 94 } else { 95 die("No session with that UID found!"); 96 } 97 97 } 98 var_dump($this->loadedSession->pipeline); 98 var_dump($_SESSION['localSessionCopy']); 99 100 if (isset($_SESSION['localSessionCopy']) && !empty($_SESSION['localSessionCopy'])) { 101 102 $this->loadedSession = $_SESSION['localSessionCopy']; 103 unset($_SESSION['updateNeeded']); 104 } 105 99 106 } 100 107 … … 152 159 } 153 160 161 public function StoreToDb() { 162 if (isset($_SESSION['localSessionCopy']) && !empty($_SESSION['localSessionCopy'])) { 163 $this->dbi->set($_SESSION['localSessionCopy']); 164 unset($_SESSION['updateNeeded']); 165 } 166 } 167 154 168 } 155 169 ?>
Note: See TracChangeset
for help on using the changeset viewer.