Ignore:
Timestamp:
11/07/11 16:55:36 (13 years ago)
Author:
jkraaijeveld
Message:

Added missing classes for the database connection

File:
1 edited

Legend:

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

    r69 r149  
    11<?php
    2 
    32/**
    43 * Description of Session
    54 *
    6  * @author fpvanagthoven
     5 * @author jkraaijeveld
    76 */
    8 class Session {
    97
    10     public $title;
    11     public $description;
    12     public $pipeline;
    13     public $count;
     8class Session extends ResearchToolObject
     9{
     10        public $title;
     11        public $datetime;
     12        public $pipeline;
     13        public $answersets;
    1414
    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}       
    4736
    48                 $pipelineCount++;
    49             }
    50            
    51             return $session;
    52         }
    53         else
    54             return null;
    55     }
    5637
    57 }
    5838?>
Note: See TracChangeset for help on using the changeset viewer.