source: Dev/trunk/classes/DisplayStep.php @ 150

Last change on this file since 150 was 146, checked in by fpvanagthoven, 13 years ago

Merged step/displaystep class functionality, division is unnecessary.
Added some javascript to manipulate editor objects in sequencerScripts.js

File size: 1.8 KB
Line 
1<?php
2
3/**
4 * DisplayStep object is the visual representation of an existing step in a pipeline, to be displayed in the pipeline sequencer.
5 * Note: Can also be used for creation icons in the Toolbox, as long as no reference to an existing step object is assigned.
6 *
7 * IMPORTANT: DisplayStep() should only be used to graphically display a certain Step object.
8 * It only contains a reference to an existing object ($reference), and is not the database object itself!
9 * General idea: handle real objects privately, only generate DisplaySteps() based on that data, not the other way around.
10 *
11 * @author tschipper
12 */
13class DisplayStep {
14
15//put your code here
16    private $type;
17    private $reference;
18    public $imageURL;
19    public $selected = false;
20    public $caption;
21    public $id;
22
23    public function __construct($t, $ref=null, $c, $id) {
24
25        $this->type = $t;
26        $this->reference = $ref;
27        $this->caption = $c;
28        $this->id = $id;
29
30        switch ($this->type) {
31            case "Questionnaire":
32                $this->imageURL = "images/icons/questionnaire.png";
33                break;
34            case "Dashboard":
35                $this->imageURL = "images/icons/dashboard.png";
36                break;
37            case "Application":
38                $this->imageURL = "images/icons/application.png";
39                break;
40            default:
41                $this->imageURL = null;
42                break;
43        }
44
45        //output a display object
46        //echo '<div class="displayStep"><div class="displayStepIcon" style="background-image: url('.$this->imageURL.');"></div>'.$this->caption.'</div>'."\n";
47        echo '<div class="displayStep" onClick="checkSelectedStep('.$this->id.');"><div class="displayStepIcon"><img src="' . $this->imageURL . '" /></div>' . $this->caption . '</div>';
48    }
49
50}
51
52?>
Note: See TracBrowser for help on using the repository browser.