Ignore:
Timestamp:
12/15/11 17:09:49 (13 years ago)
Author:
fpvanagthoven
Message:
 
File:
1 edited

Legend:

Unmodified
Added
Removed
  • Dev/trunk/classes/pipelineSequencer.php

    r181 r185  
    8181        <script type="text/javascript">
    8282            $(document).ready(function() {
    83                 loadSequencer();      // true means it is the first refresh of the page.
     83                loadSequencer();
    8484            });
    8585        </script>
     
    8787    }
    8888
    89     public function LoadSession($currentSession) {   // Initialize variables on page load.
    90         if (!isset($currentSession)) {
     89    public function LoadSession() {   // Initialize variables on page load.
     90        // Redirect if no session is set
     91        if (!isset($_SESSION['currentSession'])) {
    9192            redirect("selectSession.php");
    9293        }
    93         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
    94             $sessionResults = $this->dbi->get("Session", array("uid" => $currentSession));
    95 
    96             if (count($sessionResults) > 0) {
    97                 $_SESSION['localSessionCopy'] = $sessionResults[0];
    98                 unset($_SESSION['updateNeeded']);
    99             } else {
    100                 die("No session with that UID found!");
    101             }
     94        // Store the current session in internal variable
     95        $results = $this->dbi->get("Session", array("uid"=> $_SESSION['currentSession']));
     96        if (!empty($results)) {
     97            (is_array($results)) ? $this->loadedSession = $results[0] : $this->loadedSession = $results;
    10298        }
    103 
    104         if (isset($_SESSION['localSessionCopy']) && !empty($_SESSION['localSessionCopy'])) {
    105 
    106             $this->loadedSession = $_SESSION['localSessionCopy'];
    107             unset($_SESSION['updateNeeded']);
     99        else {
     100            // Throw error and quit if no results found
     101            die("No session with that UID found!");
    108102        }
    109103    }
    110104
    111105    public function HandlePostData() {
    112         if (isset($_POST['editSelected'])) {
    113             if (isset($_POST['selectedStep']) && !empty($_POST['selectedStep'])) {
    114                 redirect("editredirect.php");
    115             }
    116         }
    117 
    118         if (isset($_POST['moveSelectedLeft'])) {
    119             if (isset($_POST['selectedStep']) && !empty($_POST['selectedStep'])) {
    120                 $this->MoveStep($_POST['selectedStep'], -1);
    121             }
    122         }
    123 
    124         if (isset($_POST['moveSelectedRight'])) {
    125             if (isset($_POST['selectedStep']) && !empty($_POST['selectedStep'])) {
    126                 $this->MoveStep($_POST['selectedStep'], 1);
    127             }
    128         }
    129 
    130         if (isset($_POST['objectToCreate']) && !empty($_POST['objectToCreate'])) {
    131             switch (strtolower($_POST['objectToCreate'])) {
    132                 case "survey":
    133                     redirect("createsurvey.php");
    134                     break;
    135                 case "application":
    136                     redirect("createapplication.php");
    137                     break;
    138                 case "dashboard":
    139                     redirect("createdashboard.php");
    140                     break;
    141                 default:
    142                     // Er is iets fout gegaan, want er is geen valid type meegegeven!
    143                     break;
    144             }
    145         }
     106               
    146107    }
    147108
Note: See TracChangeset for help on using the changeset viewer.