Changeset 185 for Dev/trunk/classes
- Timestamp:
- 12/15/11 17:09:49 (13 years ago)
- Location:
- Dev/trunk/classes
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
Dev/trunk/classes/Toolbox.php
r177 r185 16 16 17 17 <br /> 18 18 19 19 <div id="toolbox" class="largeFrame"> 20 20 <div class="largeTitle">Toolbox</div> 21 21 <div class="content"> 22 22 <p style="float: left; clear:both; margin-bottom: 1em;">Add new:</p> 23 <div class="bigButton vert" onClick="SubmitToolbox('Survey');"><img src="images/icons/survey.png" class="buttonIcon" /><p>Survey</p></div>24 <div class="bigButton vert" onClick="SubmitToolbox('Application');"><img src="images/icons/application.png" class="buttonIcon" /><p>Application</p></div>25 <div class="bigButton vert" onClick="SubmitToolbox('Dashboard');"><img src="images/icons/dashboard.png" class="buttonIcon" /><p>Dashboard</p></div>23 <div class="bigButton toolbox" onClick="submitToolbox('Survey');"><img src="images/icons/survey.png" class="buttonIcon" /><p>Survey</p></div> 24 <div class="bigButton toolbox" onClick="submitToolbox('Application');"><img src="images/icons/application.png" class="buttonIcon" /><p>Application</p></div> 25 <div class="bigButton toolbox" onClick="submitToolbox('Dashboard');"><img src="images/icons/dashboard.png" class="buttonIcon" /><p>Dashboard</p></div> 26 26 </div> 27 27 </div> 28 29 30 <!--31 <form name="toolbox" action="pipelineEditor.php" method="POST">32 <fieldset id="toolbox">33 <div class="fieldsetTitle">Toolbox</div>34 <p>Add new: </p>35 <div class="creationButton" onClick="SubmitToolbox('Survey');"><img src="images/icons/survey.png" class="buttonIcon"/><p>Survey</p></div>36 <div class="creationButton" onClick="SubmitToolbox('Application');"><img src="images/icons/application.png" class="buttonIcon"/><p>Application</p></div>37 <div class="creationButton" onClick="SubmitToolbox('Dashboard');"><img src="images/icons/dashboard.png" class="buttonIcon"/><p>Dashboard</p></div>38 </fieldset>39 </form>40 41 -->42 28 <?php 43 29 } -
Dev/trunk/classes/pipelineSequencer.php
r181 r185 81 81 <script type="text/javascript"> 82 82 $(document).ready(function() { 83 loadSequencer(); // true means it is the first refresh of the page.83 loadSequencer(); 84 84 }); 85 85 </script> … … 87 87 } 88 88 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'])) { 91 92 redirect("selectSession.php"); 92 93 } 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; 102 98 } 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!"); 108 102 } 109 103 } 110 104 111 105 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 146 107 } 147 108 -
Dev/trunk/classes/surveyEditorWidget.php
r182 r185 12 12 class surveyEditorWidget { 13 13 14 private $loadedSession; 14 private $loadedSurvey; 15 private $dbi; 15 16 16 17 public function __construct() { 17 18 // Set basic variables 18 19 // Should probably include a default empty survey for the sake of safety 20 $dbi = new DatabaseInterface(); 19 21 } 20 22 21 23 public function handlePost() { 22 24 // Get POSTed data and store variables to class instance properties 23 // Most important: loadedSession!24 25 //var_dump($_POST);26 27 25 $dbi = new DatabaseInterface(); 28 26 if (isset($_POST['objectUid']) && !empty($_POST['objectUid'])) { 29 27 $surveyResults = $dbi->get("Survey", array("uid" => $_POST['objectUid'])); 30 if ( count($surveyResults) > 0) {31 $this->loadedSurvey = $surveyResults[0];28 if (!empty($surveyResults)) { 29 (is_array($surveyResults)) ? $this->loadedSurvey = $surveyResults[0] : $this->loadedSurvey = $surveyResults; 32 30 } else { 33 var_dump("No surveys found!");31 die("No surveys found!"); 34 32 } 35 33 } else { 36 var_dump("Incorrect or null uid passed!");34 die("Incorrect or null uid passed!"); 37 35 } 38 36 } 39 37 40 38 public function init() { 39 $questionString = ""; 40 foreach ($this->loadedSurvey->questions as $question) { 41 $questionString .= $question->uid . ","; 42 } 41 43 // echo the HTML markup to display the editor on the screen 42 44 ?> 43 45 44 46 <div id="surveyEditor" class="largeFrame"> 45 <div class="largeTitle" >46 Survey name47 <div class="largeTitle" id="surveyTitle"> 48 <?php echo $this->loadedSurvey->title; ?> 47 49 </div> 48 <div id="surveyEditorContent" class="innerLargeFrame"> 50 <div id="seqContent" class="innerLargeFrame"> 51 <div id="seqContentWrapper"> 49 52 50 <!--51 <div id="questionUID" class="smallFrame">52 <div class="smallTitle"><div class="listNumber">1</div>#QUESTION-IDENT-NO</div>53 <div class="content">54 <p class="questionBody">55 This is the question body text. This is what the user will read when he is answering the survey.This is the question body text. This is what the user will read when he is answering the survey.This is the question body text. This is what the user will read when he is answering the survey.56 </p>57 <div class="questionParamsView">58 PARAMETERS GO HERE, probably in one line (Only answer type and identifier?) Tags?59 </div>60 </div>61 <div id="questionDisplayControls" class="controls">62 <input type="button" value="Edit" onClick="javascript:alert('editing not yet supported');" class =" smallButton"/>63 <input type="button" value="Remove" onClick="javascript:alert('removing not yet supported');" class =" smallButton"/>64 </div>65 53 </div> 66 --> 67 54 </div> 55 <div id="surveyEditorVertControls" class="vertControls"> 56 <div class="segment"> 57 <label>Move</label> 58 <input type="button" id="vertControls_MoveUp" class="bigButton vertical" value="Ë" /> 59 <input type="button" id="vertControls_MoveDown" class="bigButton vertical" value="Ë 60 " /> 61 </div> 62 <input type="button" id="vertControls_Add" class="bigButton vertical" value="+" onClick="addQuestion_Click();" /> 68 63 </div> 69 64 <div id="surveyEditorControls" class="controls"> 65 <div id="pageControls"> 66 <input type="button" value="<<" id="pageControls_first" onClick="" /> 67 <input type="button" value="<" id="pageControls_previous" onClick="" /> 68 Page <input type="text" value="1" id="pageControls_current" onChange="" class="smallTextField" /> of 5 69 <input type="button" value=">" id="pageControls_next" onClick="" /> 70 <input type="button" value=">>" id="pageControls_last" onClick="" /> 71 </div> 72 70 73 <input type="button" value="Discard survey" onClick="javascript:alert('discard not yet supported');" class="smallButton" /> 71 74 <input type="button" value="Save survey" onClick="javascript:alert('save not yet supported');" class="smallButton" /> … … 75 78 76 79 77 <form name="hiddenFields">78 <input type="hidden" id="surveyUid " value="<?php echo $this->loadedSurvey->uid; ?>" />79 <input type="hidden" id="questionUids " value="<?php echo $this->loadedSurvey->questions;?>" />80 <input type="hidden" id="surveyTitle " value="<?php echo $this->loadedSurvey->title; ?>" />81 <input type="hidden" id="numQuestions " value="<?php echo count($this->loadedSurvey->questions); ?>" />82 <input type="hidden" id="surveyDescription " value="<?php echo $this->loadedSurvey->description; ?>" />80 <form id="hiddenInputs"> 81 <input type="hidden" id="surveyUidField" value="<?php echo $this->loadedSurvey->uid; ?>" /> 82 <input type="hidden" id="questionUidsField" value="<?php echo $questionString ?>" /> 83 <input type="hidden" id="surveyTitleField" value="<?php echo $this->loadedSurvey->title; ?>" /> 84 <input type="hidden" id="numQuestionsField" value="<?php echo count($this->loadedSurvey->questions); ?>" /> 85 <input type="hidden" id="surveyDescriptionField" value="<?php echo $this->loadedSurvey->description; ?>" /> 83 86 </form> 84 87 … … 90 93 // output the javascript tags and needed functions in the head of the page 91 94 ?> 92 <script type="text/javascript" src="js/surveyEditorScripts.js"></script> 95 <script type="text/javascript" src="js/sequencerScripts.js"></script> 96 <script type="text/javascript" src="js/generalscripts.js"></script> 93 97 <script type="text/javascript" src="js/jquery.js"></script> 94 98 <script type="text/javascript"> 95 99 $(document).ready(function() { 96 loadS urvey();100 loadSequencer(); 97 101 }); 98 102 </script>
Note: See TracChangeset
for help on using the changeset viewer.