Changeset 152 for Dev/trunk/classes
- Timestamp:
- 11/09/11 17:14:25 (13 years ago)
- Location:
- Dev/trunk/classes
- Files:
-
- 1 deleted
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
Dev/trunk/classes/SessionConnector.php
r151 r152 60 60 $uid = ""; $title = ""; $datetime = ""; $applications = ""; $surveys = ""; $answersets = ""; 61 61 if(in_array("uid", $keys)) 62 $uid = 'predicates:uid \''.$argu ements["uid"].'\' ';62 $uid = 'predicates:uid \''.$arguments["uid"].'\' '; 63 63 if(in_array("title", $keys)) 64 64 $title = 'predicates:title \''.$arguments["title"].'\' '; -
Dev/trunk/classes/pipelineSequencer.php
r151 r152 13 13 14 14 // properties 15 private $pipeline; // array of UID strings. 16 private $name = "empty"; 17 private $numStepsInArray = 0; 18 private $maxNumStepsInArray = 10; 15 private $loadedSession; 19 16 private $selectedStep; 20 17 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 24 20 } 25 21 … … 28 24 <br /><form name="sequencer" action="pipelineEditor.php" method="post"> 29 25 <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> 31 27 32 28 <div id="seqContent"> … … 56 52 private function Javascript() { 57 53 ?> 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> 122 55 123 56 <?php 124 57 } 125 58 126 public function Get DromDB() { // Initialize variables on page load.59 public function GetFromDB($currentSession) { // Initialize variables on page load. 127 60 $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!"); 131 72 } 132 73 }
Note: See TracChangeset
for help on using the changeset viewer.