source: Dev/trunk/classes/surveyEditorWidget.php @ 178

Last change on this file since 178 was 178, checked in by fpvanagthoven, 13 years ago
  • returnQuestionDisplay.php is vergelijkbaar met returnStep.php. Stuur "uids=blablablabla" erheen en je krijgt de HTML markup voor de question display terug als plain text. Deze gaat worden gebruikt in de surveyEditor, zelfde principe als pipelineSequencer/returnStep.php
  • Nieuwe icons, alpha channel. Betere styling mee mogelijk, formaat/cropping is nog wel een beetje weird.
  • surveyEditorWidget.php is de survey versie van pipelineSequencer.php. (Ook hier weer een consistent naming scheme toepassen? Als in: pipelineEditor->pipelineEditorWidget, surveyEditor->surveyEditorWidget, etc...?
  • layout van pipelineEditor.php klopt nu weer en werkt nu helemaal op de nieuwe stylesheet, visualeditors.css. Logo, header en navbar stuff moet nog wel gemaakt worden.
  • surveyEditorScripts.js: scripts voor, verrassing, surveyEditor.php. loadSurvey werkt, drawQuestions ook bijna. BELANGRIJK! Deze editor werkt met global variables ipv de hidden fields die in pipelineSequencer.php gebruikt worden. Om conflicten te voorkomen wordt alles opgeslagen in een object literal "surveyEditor".
File size: 4.0 KB
RevLine 
[178]1<?php
2/*
3 * To change this template, choose Tools | Templates
4 * and open the template in the editor.
5 */
6
7/**
8 * The PHP class that implements the survey editor interface
9 *
10 * @author Thijs Schipper
11 */
12class surveyEditorWidget {
13
14    private $loadedSession;
15
16    public function __construct() {
17        // Set basic variables
18        // Should probably include a default empty survey for the sake of safety
19    }
20
21    public function handlePost() {
22        // Get POSTed data and store variables to class instance properties
23        // Most important: loadedSession!
24
25        //var_dump($_POST);
26
27        $dbi = new DatabaseInterface();
28        if (isset($_POST['objectUid']) && !empty($_POST['objectUid'])) {
29            $surveyResults = $dbi->get("Survey", array("uid" => $_POST['objectUid']));
30            if (count($surveyResults) > 0) {
31                $this->loadedSurvey = $surveyResults[0];
32            } else {
33                var_dump("No surveys found!");
34            }
35        } else {
36            var_dump("Incorrect or null uid passed!");
37        }
38    }
39
40    public function init() {
41        // echo the HTML markup to display the editor on the screen
42        ?>
43
44        <div id="surveyEditor" class="largeFrame">
45            <div class="largeTitle">
46                Survey name
47            </div>
48            <div id="surveyEditorContent" class="innerLargeFrame">
49
50                <div id="questionUID" class="smallFrame">
51                    <div class="smallTitle"><div class="listNumber">1</div>#QUESTION-IDENT-NO</div>
52                    <div class="content">
53                        <p class="questionBody">
54                            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.
55                        </p>
56                        <div class="questionParamsView">
57                            PARAMETERS GO HERE, probably in one line (Only answer type and identifier?) Tags?
58                        </div>
59                    </div>
60                    <div id="questionDisplayControls" class="controls">
61                        <input type="button" value="Edit" onClick="javascript:alert('editing not yet supported');" class =" smallButton"/>
62                        <input type="button" value="Remove" onClick="javascript:alert('removing not yet supported');" class =" smallButton"/>
63                    </div>
64                </div>
65
66
67            </div>
68            <div id="surveyEditorControls" class="controls">
69                <input type="button" value="Discard survey" onClick="javascript:alert('discard not yet supported');" class="smallButton" />
70                <input type="button" value="Save survey" onClick="javascript:alert('save not yet supported');" class="smallButton" />
71            </div>
72
73        </div>
74
75
76        <form name="hiddenFields">
77            <input type="hidden" id="surveyUid" value="<?php echo $this->loadedSurvey->uid; ?>" />
78            <input type="hidden" id="questionUids" value="<?php echo $this->loadedSurvey->questions; ?>" />
79            <input type="hidden" id="surveyTitle" value="<?php echo $this->loadedSurvey->title; ?>" />
80            <input type="hidden" id="numQuestions" value="<?php echo count($this->loadedSurvey->questions); ?>" />
81            <input type="hidden" id="surveyDescription" value="<?php echo $this->loadedSurvey->description; ?>" />
82        </form>
83
84
85        <?php
86    }
87
88    public function javascript() {
89        // output the javascript tags and needed functions in the head of the page
90        ?>
91        <script type="text/javascript" src="js/surveyEditorScripts.js"></script>
92        <script type="text/javascript" src="js/jquery.js"></script>
93        <script type="text/javascript">
94            $(document).ready(function() {
95                loadSurvey();
96            });
97        </script>
98        <?php
99    }
100
101}
102?>
Note: See TracBrowser for help on using the repository browser.