source: Dev/branches/jos-branch/classes/widgets/SessionEditorWidget.php @ 230

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

Made most functionality from the demo branch work with new database.

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