ILIAS  eassessment Revision 61809
 All Data Structures Namespaces Files Functions Variables Groups Pages
class.ilECSTimePlace.php
Go to the documentation of this file.
1 <?php
2 /*
3  +-----------------------------------------------------------------------------+
4  | ILIAS open source |
5  +-----------------------------------------------------------------------------+
6  | Copyright (c) 1998-2006 ILIAS open source, University of Cologne |
7  | |
8  | This program is free software; you can redistribute it and/or |
9  | modify it under the terms of the GNU General Public License |
10  | as published by the Free Software Foundation; either version 2 |
11  | of the License, or (at your option) any later version. |
12  | |
13  | This program is distributed in the hope that it will be useful, |
14  | but WITHOUT ANY WARRANTY; without even the implied warranty of |
15  | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
16  | GNU General Public License for more details. |
17  | |
18  | You should have received a copy of the GNU General Public License |
19  | along with this program; if not, write to the Free Software |
20  | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
21  +-----------------------------------------------------------------------------+
22 */
23 
35 {
36  public $room = '';
37  public $begin = '';
38  public $end = '';
39  public $cycle = '';
40 
48  public function __construct()
49  {
50 
51  }
52 
60  public function loadFromJson($a_json)
61  {
62  global $ilLog;
63 
64  if(!is_object($a_json))
65  {
66  include_once('./Services/WebServices/ECS/classes/class.ilECSReaderException.php');
67  $ilLog->write(__METHOD__.': Cannot load from JSON. No object given.');
68  throw new ilECSReaderException('Cannot parse ECSContent.');
69  }
70 
71  $this->room = $a_json->room;
72  $this->begin = $a_json->begin;
73  $this->end = $a_json->end;
74  $this->cycle = $a_json->cycle;
75  $this->day = $a_json->day;
76  }
77 
84  public function setBegin($a_begin)
85  {
86  // is it unix time ?
87  if(is_numeric($a_begin) and $a_begin)
88  {
89  $this->begin = date('c',$a_begin);
90  }
91  else
92  {
93  $this->begin = $a_begin;
94  }
95  }
96 
102  public function getBegin()
103  {
104  return $this->begin;
105  }
106 
113  public function getUTBegin()
114  {
115  include_once('Date.php');
116 
117  $date = new Date();
118  $date->setDate($this->begin);
119  return $date->getDate(DATE_FORMAT_UNIXTIME);
120  }
121 
129  public function setEnd($a_end)
130  {
131  // is it unix time ?
132  if(is_numeric($a_end) and $a_end)
133  {
134  $this->end = date('c',$a_end);
135  }
136  else
137  {
138  $this->end = $a_end;
139  }
140  }
141 
147  public function getEnd()
148  {
149  return $this->end;
150  }
151 
158  public function getUTEnd()
159  {
160  include_once('Date.php');
161 
162  $date = new Date();
163  $date->setDate($this->end);
164  return $date->getDate(DATE_FORMAT_UNIXTIME);
165  }
166 
167 
175  public function setRoom($a_room)
176  {
177  $this->room = $a_room;
178  }
179 
186  public function getRoom()
187  {
188  return $this->room;
189  }
190 
198  public function setCycle($a_cycle)
199  {
200  $this->cycle = $a_cycle;
201  }
202 
210  public function getCycle()
211  {
212  return $this->cycle;
213  }
214 }
215 
216 
217 ?>