[195] | 1 | <?php
|
---|
| 2 | /**
|
---|
| 3 | * Description of SessionInstance
|
---|
| 4 | *
|
---|
| 5 | * @author jkraaijeveld
|
---|
| 6 | */
|
---|
| 7 |
|
---|
| 8 | class SessionInstance extends ResearchToolObject
|
---|
| 9 | {
|
---|
| 10 | public $title;
|
---|
| 11 | public $location;
|
---|
| 12 | public $facilitator;
|
---|
| 13 | public $starttime;
|
---|
| 14 | public $endtime;
|
---|
| 15 | public $notes;
|
---|
| 16 | public $session;
|
---|
| 17 | public $resultset;
|
---|
| 18 |
|
---|
| 19 | /**
|
---|
| 20 | * Constructor for a SessionInstance object
|
---|
| 21 | * @param type $uid
|
---|
| 22 | * @param type $title
|
---|
| 23 | * @param type $location
|
---|
| 24 | * @param type $facilitator
|
---|
| 25 | * @param type $starttime
|
---|
| 26 | * @param type $endtime
|
---|
| 27 | * @param type $notes
|
---|
| 28 | * @param type $session
|
---|
| 29 | * @param type $resultset
|
---|
| 30 | */
|
---|
| 31 | public function __construct($uid = null, $title = null, $location = null, $facilitator = null, $starttime = null, $endtime = null, $notes = null, $session = null, $resultset = null)
|
---|
| 32 | {
|
---|
| 33 | if(!isset($uid))
|
---|
| 34 | {
|
---|
| 35 | $uid = md5(uniqid(rand(), true));
|
---|
| 36 | }
|
---|
| 37 | $this->uid = $uid;
|
---|
| 38 | $this->title = $title;
|
---|
| 39 | $this->location = $location;
|
---|
| 40 | $this->facilitator = $facilitator;
|
---|
| 41 | $this->starttime = $starttime;
|
---|
| 42 | $this->endtime = $endtime;
|
---|
| 43 | $this->notes = $notes;
|
---|
| 44 | $this->session = $session;
|
---|
| 45 | $this->resultset = $resultset;
|
---|
| 46 | }
|
---|
| 47 |
|
---|
| 48 | /*
|
---|
| 49 | * function evaluate()
|
---|
| 50 | * Evaluates all the references of this object.
|
---|
| 51 | */
|
---|
| 52 | public function evaluate()
|
---|
| 53 | {
|
---|
| 54 | $dbi = new DatabaseInterface();
|
---|
| 55 | if(is_string($this->facilitator))
|
---|
| 56 | {
|
---|
| 57 | $result = $dbi->get("user", array("uid" => $this->facilitator));
|
---|
| 58 | if(!isset($result[0]))
|
---|
| 59 | return false;
|
---|
| 60 | $this->facilitator = $result[0];
|
---|
| 61 | }
|
---|
| 62 |
|
---|
| 63 | if(is_string($this->session))
|
---|
| 64 | {
|
---|
| 65 | $result = $dbi->get("session", array("uid" => $this->session));
|
---|
| 66 | if(!isset($result[0]))
|
---|
| 67 | return false;
|
---|
| 68 | $this->session = $result[0];
|
---|
| 69 | }
|
---|
| 70 |
|
---|
| 71 | if(is_string($this->resultset))
|
---|
| 72 | {
|
---|
| 73 | $result = $dbi->get("resultset", array("uid" => $this->resultset));
|
---|
| 74 | if(!isset($result[0]))
|
---|
| 75 | return true;
|
---|
| 76 | $newResultSets[] = $result[0];
|
---|
| 77 | }
|
---|
| 78 | return true;
|
---|
| 79 | }
|
---|
| 80 |
|
---|
| 81 |
|
---|
| 82 | }
|
---|