Changeset 152 for Dev/trunk/classes


Ignore:
Timestamp:
11/09/11 17:14:25 (13 years ago)
Author:
fpvanagthoven
Message:
  • getInfo.php returnet informatie over het aangevraagde object. Dit kan via ajax routines op verscheidene infopanels weergegeven worden. (Bijvoorbeeld in de huidige versie van selectSession.php). Deze script wordt later nog uitgebreid om verschillende soorten objecten en sets informatie weer te geven. (Momenteel alleen sessions!)
  • selectSession werkt grotendeels, op deleteSession en een non-fatal error bij createSession na.
  • logout.php gebruikt nu ook destroy_session();
  • sequencerScripts.js uitgebreid om een simpel aan te roepen AJAX routine mogelijk te maken. Dit biedt de mogelijkheid om pagina's aan te passen zonder een refresh.
Location:
Dev/trunk/classes
Files:
1 deleted
2 edited

Legend:

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

    r151 r152  
    6060                $uid = ""; $title = ""; $datetime = ""; $applications = ""; $surveys = ""; $answersets = "";
    6161                if(in_array("uid", $keys))
    62                         $uid = 'predicates:uid \''.$arguements["uid"].'\' ';
     62                        $uid = 'predicates:uid \''.$arguments["uid"].'\' ';
    6363                if(in_array("title", $keys))
    6464                        $title = 'predicates:title \''.$arguments["title"].'\' ';
  • Dev/trunk/classes/pipelineSequencer.php

    r151 r152  
    1313
    1414    // properties
    15     private $pipeline;      // array of UID strings.
    16     private $name = "empty";
    17     private $numStepsInArray = 0;
    18     private $maxNumStepsInArray = 10;
     15    private $loadedSession;
    1916    private $selectedStep;
    2017
    21     public function __construct($uid) {
    22         $dbi = new DatabaseInterface();
    23         $this->pipeline = $dbi->get("pipeline", array("uid" => $uid));
     18    public function __construct() {
     19        //nothing yet
    2420    }
    2521
     
    2824        <br /><form name="sequencer" action="pipelineEditor.php" method="post">
    2925            <fieldset id="sequencer">
    30                 <div class="title">Name: <?php echo $this->pipeline->name; ?> </div>
     26                <div class="title">Name: <?php echo $this->loadedSession->title; ?> </div>
    3127
    3228                <div id="seqContent">
     
    5652    private function Javascript() {
    5753        ?>
    58         <!--
    59         Add JS code for selecting steps, highlighting them, reordering, etc.
    60         Is a refresh of the page (with subsequent querying of database really necessary?
    61 
    62         -->
    63         <script type="text/javascript">
    64             function selectStep(uid) {
    65                 document.getElementById(uid).addClass("selected");
    66                 document.sequencer.controls.selectedStep.value = uid;
    67             }
    68                                                                            
    69                                                                            
    70             /*
    71              * ajaxStepRequest gets  the markup for displaying a step in the sequencer from returnStep.php
    72              * Using ajax principle allows for editing of pipeline without constantly refreshing the page.
    73              */
    74                                                                            
    75             function ajaxStepRequest(uid) {     
    76                 var xmlhttp;
    77                 if (window.XMLHttpRequest) {    // IE7+, FF, Chrome, Opera, Safari
    78                     xmlhttp = new XMLHttpRequest();
    79                 }
    80                 else {  //IE 5, 6
    81                     xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
    82                 }
    83                                                                                
    84                 xmlhttp.onreadystatechange = function () {
    85                     if (xmlhttp.readyState==4 && xmlhttp.status==200) {
    86                         if (xmlhttp.responseText.length > 0) {
    87                             var newDiv = xmlhttp.responseText;
    88                             document.getElementById("seqContent").appendChild(newDiv);
    89                         }   
    90                     }
    91                 }
    92                                        
    93                 xmlhttp.open("POST", "returnStep.php", true);
    94                 xmlhttp.send();
    95             }
    96                            
    97             function drawSteps() {
    98                 var sequencer = document.getElementById("sequencer");
    99                 var seqContent = document.getElementById("seqContent");
    100                
    101                 // first delete all current children of seqContent (to reset the sequencer).
    102                 while (seqContent.childNodes.length > 0) {
    103                     var step = seqContent.childNodes[0];
    104                     step.parentNode.removeChild(step);
    105                 }
    106                
    107                 // get pipeline contents from hidden form inputs.
    108                 var pipeline = sequencer.controls.pipeline.value;
    109                 var pipeline = pipeline.split(", ");
    110                
    111                 // then do an xmlhttp request for each step to be added to the sequencer
    112                 var numberOfSteps = pipeline.length;
    113                 for (var i = 0; i > numberOfSteps; i++) {
    114                     ajaxStepRequest(pipeline[i]);
    115                 }
    116                
    117             }
    118                                                                                
    119                                                
    120         </script>
    121 
     54        <script type="text/javascript" src="js/sequencerScripts.js"></script>
    12255
    12356        <?php
    12457    }
    12558
    126     public function GetDromDB() {   // Initialize variables on page load.
     59    public function GetFromDB($currentSession) {   // Initialize variables on page load.
    12760        $dbi = new DatabaseInterface();
    128         if (isset($_POST['currentSession'])) {
    129             $currentSession = $dbi->get("Session", array("UID" => $uid));
    130             $this->pipeline = $currentSession->pipeline;
     61        if (!isset($currentSession)) {
     62            $_SESSION['message'] = "No session set!";
     63            redirect("selectSession.php");
     64        }
     65       
     66        $sessionResults = $dbi->get("Session", array("uid" => $currentSession));
     67        if (count($sessionResults) > 0) {
     68            $this->loadedSession = $sessionResults[0];
     69        }
     70        else {
     71            die("Invalid session!");
    13172        }
    13273    }
Note: See TracChangeset for help on using the changeset viewer.