ILIAS  Release_4_2_x_branch Revision 61807
 All Data Structures Namespaces Files Functions Variables Groups Pages
class.ilECSTimePlace.php
Go to the documentation of this file.
1 <?php
2 
3 /*
4  +-----------------------------------------------------------------------------+
5  | ILIAS open source |
6  +-----------------------------------------------------------------------------+
7  | Copyright (c) 1998-2006 ILIAS open source, University of Cologne |
8  | |
9  | This program is free software; you can redistribute it and/or |
10  | modify it under the terms of the GNU General Public License |
11  | as published by the Free Software Foundation; either version 2 |
12  | of the License, or (at your option) any later version. |
13  | |
14  | This program is distributed in the hope that it will be useful, |
15  | but WITHOUT ANY WARRANTY; without even the implied warranty of |
16  | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
17  | GNU General Public License for more details. |
18  | |
19  | You should have received a copy of the GNU General Public License |
20  | along with this program; if not, write to the Free Software |
21  | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
22  +-----------------------------------------------------------------------------+
23  */
24 
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 
174  public function setRoom($a_room)
175  {
176  $this->room = $a_room;
177  }
178 
185  public function getRoom()
186  {
187  return $this->room;
188  }
189 
197  public function setCycle($a_cycle)
198  {
199  $this->cycle = $a_cycle;
200  }
201 
209  public function getCycle()
210  {
211  return $this->cycle;
212  }
213 
214 }
215 ?>