Changeset 150 for Dev/trunk/classes


Ignore:
Timestamp:
11/07/11 18:02:38 (13 years ago)
Author:
fpvanagthoven
Message:
 
Location:
Dev/trunk/classes
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • Dev/trunk/classes/Step.php

    r146 r150  
    11<?php
    2 
    32/*
    43 * To change this template, choose Tools | Templates
     
    1615    public $type;
    1716    public $name;
    18     public $id;
     17    public $uid;
    1918    // merging step and displayStep
    2019
    2120    public $imageURL;
    2221
    23     public function __construct($t, $n, $i) {
     22    public function __construct($type, $name, $uid) {
    2423
    25         if (strtolower($t) == "application" || strtolower($t) == "dashboard" || strtolower($t) == "questionnaire") {
    26             $this->type = $t;
    27             $this->name = $n;
    28             $this->id = $i;
     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);
    2929        } else {
    30             die("Invalid type given: " . $t . "\n $n $i");
     30            die("Invalid type given: " . $type . "\n $name $uid");
    3131        }
    3232
    33         switch (strtolower($this->type)) {
     33        // assign relevant icon
     34        switch ($this->type) {
    3435            case "questionnaire":
    3536                $this->imageURL = "images/icons/questionnaire.png";
     
    4748    }
    4849
     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
    4958    public function AdjustID($offset) {
    5059        $this->id += $offset;
    5160    }
    5261
    53     public function DrawStep() {
    54         if (isset($this->type) && isset($this->imageURL) && isset($this->name)) {
    55             ?>
    56 <div class="displayStep" onClick="checkSelectedStep('<?php echo $this->id; ?>');"><div class="displayStepIcon"><img src="<?php echo $this->imageURL; ?>" /></div><?php echo $this->name; ?></div>
    57 <?php       
    5862}
    59     }
    60 
    61 }
    62 
    6363?>
  • Dev/trunk/classes/pipelineSequencer.php

    r146 r150  
    1313
    1414    // properties
    15     private $pipeline = array();
    16     private $name = "testSequencer";
     15    private $pipeline;
     16    private $name = "empty";
    1717    private $numStepsInArray = 0;
    1818    private $maxNumStepsInArray = 10;
    1919    private $selectedStep;
    2020
    21     public function __construct($pipeline, $name, $id) {
    22         $this->pipeline = $pipeline;
    23         $this->name = $name;
     21    public function __construct($uid) {
     22        $dbi = new DatabaseInterface();
     23        $this->pipeline = $dbi->get("pipeline", array("uid"=>$uid));
    2424    }
    2525
    26     public function DrawSequencer() {
     26    public function init() {
    2727        ?>
    2828        <br /><form name="sequencer" action="pipelineEditor.php" method="post"><fieldset id="sequencer">
    29                 <div class="title">Name: <?php echo $this->name; ?> </div>
     29                <div class="title">Name: <?php echo $this->pipeline->name; ?> </div>
    3030
    3131                <div class="seqContent">
     
    9191                if ($this->numStepsInArray < $this->maxNumStepsInArray) {
    9292                    //var_dump($step);
    93                     $step->DrawStep();
     93                    $step->init();
    9494                    $this->numStepsInArray++;
    9595                    if ($this->numStepsInArray < $this->maxNumStepsInArray && $this->numStepsInArray < count($this->pipeline)) {
     
    133133    }
    134134
    135     public function GetFromDB() {
     135    public function HandlePost() {
    136136
     137        //this doesn't actually work, the sequencer doesn't know what the uid is yet. This data should be POSTed upon refresh!
     138       
     139       
     140       
    137141        if (isset($_POST['destroy'])) {
    138142            unset($_POST['destroy']);
     
    171175    }
    172176
     177    private function Javascript() {
     178        ?>
     179        <!--
     180        Add JS code for selecting steps, highlighting them, reordering, etc.
     181        Is a refresh of the page (with subsequent querying of database really necessary?
     182       
     183        -->
     184        <script type="text/javascript">
     185            function selectStep(step) {
     186                step.addClass("selected");
     187                document.sequencer.controls.selectedStep.value = step.name;
     188            }
     189        </script>
     190
     191
     192        <?php
     193    }
     194
    173195}
    174196?>
Note: See TracChangeset for help on using the changeset viewer.