source: Dev/trunk/classes/SessionEditorWidget.php @ 206

Last change on this file since 206 was 206, checked in by jkraaijeveld, 13 years ago

Made sessionEditor work

File size: 4.3 KB
Line 
1<?php
2/*
3 * To change this template, choose Tools | Templates
4 * and open the template in the editor.
5 */
6
7/**
8 * A visual interface object for editing and viewing a session's pipeline.
9 *
10 * @author Tschipper
11 */
12class SessionEditorWidget {
13
14    // properties
15    private $loadedSession;
16    private $selectedStep;
17    private $dbi;
18
19    public function __construct() {
20        $this->dbi = new DatabaseInterface();
21    }
22
23    public function init() {
24        $stringPipeline = "";
25        $stringPipelineType = "";
26        $stringPipelineUpdated = "";
27        $numberOfSteps = 0;
28
29        if (is_array($this->loadedSession->pipeline)) {
30            foreach ($this->loadedSession->pipeline as $object) {
31                $stringPipeline .= "$object->uid,";
32                $stringPipelineType .= get_class($object) . ",";
33                $stringPipelineUpdated .= "0,";
34                $numberOfSteps++;
35            }
36        } else {
37            $stringPipeline = $this->loadedSession->pipeline;
38            $stringPipelineType = $_POST['pipelineTypes'];
39            $stringPipelineUpdated = $_POST['pipelineUpdatedField'];
40        }
41        ?>
42        <br />
43
44        <div id="sequencer" class="largeFrame">
45            <div class="largeTitle">Name <?php echo $this->loadedSession->title; ?></div>
46           
47            <div id="seqContent" class="innerLargeFrame">
48                <div id="seqContentWrapper"></div>
49            </div>
50
51            <div class="controls">
52                <input type="button" id="moveSelectedL" value="< Move" class="smallButton"  onClick="moveStep(-1);" />
53                <input type="button" id="moveSelectedR" value="Move >" class="smallButton"  onClick="moveStep(1);" />
54                <input type="button" id="editSelected" value="Edit step" class="smallButton" onClick="editStep();" />
55                <input type="button" id="deleteSelected" value="Delete step" class="smallButton" onClick="deleteStep();" />
56                <input type="submit" id ="clearPipeline" name="clearPipeline" value="Clear pipeline" class="smallButton dis" disabled="true"/>
57                <input type="checkbox" id="confirmClear" name="confirmClear" onChange="IsCheckEnabled(this, document.getElementById('clearPipeline'));" />Really clear?
58                <input type="button" value="debug_save" onClick="savePipeline(true);" />
59            </div>
60           
61            <div id="hiddenInputs">
62                <input type="hidden" id="selectedStepField" value="" />
63                <input type="hidden" id="pipelineStringField" value="<?php echo $stringPipeline; ?>" />
64                <input type="hidden" id="pipelineTypeField" value="<?php echo $stringPipelineType; ?>" />
65                <input type="hidden" id="pipelineUpdatedField" value="<?php echo $stringPipelineUpdated; ?>" />
66                <input type="hidden" id="numSteps" value="<?php echo $numberOfSteps; ?>" />
67                <input type="hidden" id="sessionField" value="<?php echo $this->loadedSession->uid; ?>" />
68                <input type="hidden" id="sessionTitleField" value="<?php echo $this->loadedSession->title; ?>" />
69            </div>
70        </div>
71
72       
73        <?php
74    }
75
76    public function Javascript() {
77        ?>
78        <script type="text/javascript" src="js/generalScripts.js"></script>
79        <script type="text/javascript" src="js/sequencerScripts.js"></script>
80        <script type="text/javascript" src="js/jquery.js"></script>
81        <script type="text/javascript">
82            $(document).ready(function() {
83                loadSequencer();
84            });
85        </script>
86        <?php
87    }
88
89    public function LoadSession() {   // Initialize variables on page load.
90                // Redirect if no session is set
91        if (!isset($_SESSION['currentSession'])) {
92            redirect("selectSession.php");
93        }
94        // Store the current session in internal variable
95        $results = $this->dbi->get("Session", array("uid"=> $_SESSION['currentSession']));
96                print_r($results);
97        if (!empty($results)) {
98            if ($results[0]->evaluate()) {
99                $this->loadedSession = $results[0];
100            }
101        }
102        else {
103            // Throw error and quit if no results found
104            die("No session with that UID found!");
105        }
106    }
107
108    public function HandlePostData() {
109               
110    }
111
112}
113?>
Note: See TracBrowser for help on using the repository browser.