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 | */ |
---|
12 | class PipelineSequencer { |
---|
13 | |
---|
14 | // properties |
---|
15 | private $loadedSession; |
---|
16 | private $selectedStep; |
---|
17 | |
---|
18 | public function __construct() { |
---|
19 | //nothing yet |
---|
20 | } |
---|
21 | |
---|
22 | public function init() { |
---|
23 | $stringPipeline = ""; |
---|
24 | foreach ($this->loadedSession->pipeline as $object) { |
---|
25 | $stringPipeline .= "$object->uid,"; |
---|
26 | } |
---|
27 | $stringPipeline = rtrim($stringPipeline, ","); |
---|
28 | ?> |
---|
29 | <br /><form name="sequencer" action="pipelineEditor.php" method="post"> |
---|
30 | <fieldset id="sequencer"> |
---|
31 | <div class="title">Name: <?php echo $this->loadedSession->title; ?> </div> |
---|
32 | |
---|
33 | <div id="seqContent"> |
---|
34 | |
---|
35 | </div> |
---|
36 | |
---|
37 | <div id="controls"> |
---|
38 | <input type="submit" name="moveSelectedLeft" value="< Move" class="surveyButton" /> |
---|
39 | <input type="submit" name="moveSelectedRight" value="Move >" class="surveyButton" /> |
---|
40 | <input type="submit" name="editSelected" value="Edit step" class="surveyButton" /> |
---|
41 | <input type="submit" name="deleteSelected" value="Delete step" class="surveyButton" /> |
---|
42 | <input type="submit" name="clearPipeline" value="Clear pipeline" class="surveyButton dis" disabled="true"/> |
---|
43 | <input type="checkbox" name="confirmClear" onChange="IsCheckEnabled(this, document.sequencer.clearPipeline);" />Really clear? |
---|
44 | </div> |
---|
45 | <div id="hiddeInputs"> |
---|
46 | <input type="hidden" name="selectedStep" id="selectedStepField" value="" /> |
---|
47 | <input type="hidden" name="pipelineString" id="pipelineStringField" value="123,456,123" /> |
---|
48 | </div> |
---|
49 | </fieldset> |
---|
50 | </form> |
---|
51 | <?php |
---|
52 | } |
---|
53 | |
---|
54 | public function DrawSteps() { |
---|
55 | // Use AJAX to draw visual representations of step objects in a pipeline |
---|
56 | // <TODO> Implement parameters such as screen size in the drawing of objects </TODO> |
---|
57 | ?> |
---|
58 | <script type="text/javascript"> |
---|
59 | drawSteps(); |
---|
60 | </script> |
---|
61 | |
---|
62 | |
---|
63 | <?php |
---|
64 | } |
---|
65 | |
---|
66 | public function Javascript() { |
---|
67 | $pipelineString = "ERROR"; |
---|
68 | |
---|
69 | echo "<!--$pipelineString-->"; |
---|
70 | |
---|
71 | ?> |
---|
72 | <script type="text/javascript" src="js/sequencerScripts.js"></script> |
---|
73 | <script type="text/javascript" src="js/jquery.js"></script> |
---|
74 | <script type="text/javascript"> |
---|
75 | $(document).ready(function() { |
---|
76 | drawSteps(); |
---|
77 | }); |
---|
78 | </script> |
---|
79 | <?php |
---|
80 | } |
---|
81 | |
---|
82 | public function GetFromDB($currentSession) { // Initialize variables on page load. |
---|
83 | $dbi = new DatabaseInterface(); |
---|
84 | if (!isset($currentSession)) { |
---|
85 | $_SESSION['message'] = "No session set!"; |
---|
86 | redirect("selectSession.php"); |
---|
87 | } |
---|
88 | |
---|
89 | $sessionResults = $dbi->get("Session", array("uid" => $currentSession)); |
---|
90 | if (count($sessionResults) > 0) { |
---|
91 | $this->loadedSession = $sessionResults[0]; |
---|
92 | } else { |
---|
93 | die("Invalid session!"); |
---|
94 | } |
---|
95 | } |
---|
96 | |
---|
97 | } |
---|
98 | ?> |
---|