Changeset 149 for Dev/trunk/classes/Session.php
- Timestamp:
- 11/07/11 16:55:36 (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
Dev/trunk/classes/Session.php
r69 r149 1 1 <?php 2 3 2 /** 4 3 * Description of Session 5 4 * 6 * @author fpvanagthoven5 * @author jkraaijeveld 7 6 */ 8 class Session {9 7 10 public $title; 11 public $description; 12 public $pipeline; 13 public $count; 8 class Session extends ResearchToolObject 9 { 10 public $title; 11 public $datetime; 12 public $pipeline; 13 public $answersets; 14 14 15 public function __construct($title, $description) { 16 $this->title = $title; 17 $this->description = $description; 18 $this->count = 0; 19 20 $this->pipeline = array(); 21 } 22 23 public static function getSession($info) 24 { 25 if (!empty($info)) 26 { 27 $title = $info['sessionTitle']; 28 $description = $info['sessionDescription']; 29 $session = new Session($title, $description); 30 $session->count = $info['pipelineCount']; 31 32 $pipelineCount = 1; 33 for ($i = 1; $i < $session->count + 1; $i++) 34 { 35 if (isset($info[$i . 's'])) 36 { 37 $session->pipeline[$i . 's'] = $info[$i . 's']; 38 } 39 else if (isset($info[$i . 'd'])) 40 { 41 $session->pipeline[$i . 'd'] = $info[$i . 'd']; 42 } 43 else if (isset($info[$i . 'a'])) 44 { 45 $session->pipeline[$i . 'a'] = $info[$i . 'a']; 46 } 15 16 /** 17 * Constructor for a Session object 18 * @param type $uid 19 * @param type $title 20 * @param type $datetime 21 * @param type $pipeline 22 */ 23 public function __construct($uid = null, $title = null, $datetime = null, $pipeline = null, $answersets = null) 24 { 25 if(!isset($uid)) 26 { 27 $uid = md5(uniqid(rand(), true)); 28 } 29 $this->uid = $uid; 30 $this->title = $title; 31 $this->datetime = $datetime; 32 $this->pipeline = $pipeline; 33 $this->answersets = $answersets; 34 } 35 } 47 36 48 $pipelineCount++;49 }50 51 return $session;52 }53 else54 return null;55 }56 37 57 }58 38 ?>
Note: See TracChangeset
for help on using the changeset viewer.