Changeset 185 for Dev/trunk/classes/surveyEditorWidget.php
- Timestamp:
- 12/15/11 17:09:49 (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
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.