[144] | 1 | <?php |
---|
| 2 | /* |
---|
| 3 | * To change this template, choose Tools | Templates |
---|
| 4 | * and open the template in the editor. |
---|
| 5 | */ |
---|
| 6 | |
---|
| 7 | /** |
---|
[151] | 8 | * A visual interface object for editing and viewing a session's pipeline. |
---|
[144] | 9 | * |
---|
[151] | 10 | * @author Tschipper |
---|
[144] | 11 | */ |
---|
[146] | 12 | class PipelineSequencer { |
---|
[144] | 13 | |
---|
| 14 | // properties |
---|
[152] | 15 | private $loadedSession; |
---|
[144] | 16 | private $selectedStep; |
---|
| 17 | |
---|
[152] | 18 | public function __construct() { |
---|
| 19 | //nothing yet |
---|
[146] | 20 | } |
---|
[144] | 21 | |
---|
[150] | 22 | public function init() { |
---|
[153] | 23 | $stringPipeline = ""; |
---|
| 24 | foreach ($this->loadedSession->pipeline as $object) { |
---|
| 25 | $stringPipeline .= "$object->uid,"; |
---|
| 26 | } |
---|
| 27 | $stringPipeline = rtrim($stringPipeline, ","); |
---|
[144] | 28 | ?> |
---|
[151] | 29 | <br /><form name="sequencer" action="pipelineEditor.php" method="post"> |
---|
| 30 | <fieldset id="sequencer"> |
---|
[152] | 31 | <div class="title">Name: <?php echo $this->loadedSession->title; ?> </div> |
---|
[144] | 32 | |
---|
[151] | 33 | <div id="seqContent"> |
---|
[153] | 34 | |
---|
[144] | 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" /> |
---|
[146] | 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? |
---|
[144] | 44 | </div> |
---|
[153] | 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> |
---|
[144] | 49 | </fieldset> |
---|
| 50 | </form> |
---|
| 51 | <?php |
---|
| 52 | } |
---|
| 53 | |
---|
[146] | 54 | public function DrawSteps() { |
---|
[153] | 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 |
---|
[146] | 64 | } |
---|
| 65 | |
---|
[153] | 66 | public function Javascript() { |
---|
| 67 | $pipelineString = "ERROR"; |
---|
| 68 | |
---|
| 69 | echo "<!--$pipelineString-->"; |
---|
| 70 | |
---|
[150] | 71 | ?> |
---|
[152] | 72 | <script type="text/javascript" src="js/sequencerScripts.js"></script> |
---|
[153] | 73 | <script type="text/javascript" src="js/jquery.js"></script> |
---|
| 74 | <script type="text/javascript"> |
---|
| 75 | $(document).ready(function() { |
---|
| 76 | drawSteps(); |
---|
| 77 | }); |
---|
| 78 | </script> |
---|
[150] | 79 | <?php |
---|
| 80 | } |
---|
| 81 | |
---|
[152] | 82 | public function GetFromDB($currentSession) { // Initialize variables on page load. |
---|
[151] | 83 | $dbi = new DatabaseInterface(); |
---|
[152] | 84 | if (!isset($currentSession)) { |
---|
| 85 | $_SESSION['message'] = "No session set!"; |
---|
| 86 | redirect("selectSession.php"); |
---|
[151] | 87 | } |
---|
[153] | 88 | |
---|
[152] | 89 | $sessionResults = $dbi->get("Session", array("uid" => $currentSession)); |
---|
| 90 | if (count($sessionResults) > 0) { |
---|
| 91 | $this->loadedSession = $sessionResults[0]; |
---|
[153] | 92 | } else { |
---|
[152] | 93 | die("Invalid session!"); |
---|
| 94 | } |
---|
[151] | 95 | } |
---|
| 96 | |
---|
[144] | 97 | } |
---|
| 98 | ?> |
---|