source: Dev/trunk/classes/Step.php @ 151

Last change on this file since 151 was 150, checked in by fpvanagthoven, 13 years ago
File size: 1.9 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 * Placeholder class, for testing of pipelineEditor.php only.
9 * Will eventually be replaced by functioning Questionnaire, Notice, Dashboard and Application objects in array steps[].
10 *
11 * @author Thijs Schipper
12 */
13class Step {
14
15    public $type;
16    public $name;
17    public $uid;
18    // merging step and displayStep
19
20    public $imageURL;
21
22    public function __construct($type, $name, $uid) {
23
24        // check if type given is valid, set internal variables
25        if (strtolower($type) == "application" || strtolower($type) == "dashboard" || strtolower($type) == "questionnaire") {
26            $this->type = strtolower($type);
27            $this->name = strtolower($name);
28            $this->id = strtolower($uid);
29        } else {
30            die("Invalid type given: " . $type . "\n $name $uid");
31        }
32
33        // assign relevant icon
34        switch ($this->type) {
35            case "questionnaire":
36                $this->imageURL = "images/icons/questionnaire.png";
37                break;
38            case "dashboard":
39                $this->imageURL = "images/icons/dashboard.png";
40                break;
41            case "application":
42                $this->imageURL = "images/icons/application.png";
43                break;
44            default:
45                $this->imageURL = "images/icons/unknowntype.png";
46                break;
47        }
48    }
49
50    public function init() {
51        if (isset($this->type) && isset($this->imageURL) && isset($this->name)) {
52            ?>
53            <div class="displayStep" onClick="checkSelectedStep('<?php echo $this->id; ?>');"><div class="displayStepIcon"><img src="<?php echo $this->imageURL; ?>" /></div><?php echo $this->name; ?></div>
54            <?php
55        }
56    }
57
58    public function AdjustID($offset) {
59        $this->id += $offset;
60    }
61
62}
63?>
Note: See TracBrowser for help on using the repository browser.