ILIAS  release_4-3 Revision
 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  $ilLog->write(__METHOD__ . ': Cannot load from JSON. No object given.');
67  throw new ilException('Cannot parse ECSContent.');
68  }
69 
70  $this->room = $a_json->room;
71  $this->begin = $a_json->begin;
72  $this->end = $a_json->end;
73  $this->cycle = $a_json->cycle;
74  #$this->day = $a_json->day;
75  }
76 
83  public function setBegin($a_begin)
84  {
85  // is it unix time ?
86  if(is_numeric($a_begin) and $a_begin)
87  {
88  $this->begin = date('c', $a_begin);
89  }
90  else
91  {
92  $this->begin = $a_begin;
93  }
94  }
95 
101  public function getBegin()
102  {
103  return $this->begin;
104  }
105 
112  public function getUTBegin()
113  {
114  include_once('Date.php');
115 
116  $date = new Date();
117  $date->setDate($this->begin);
118  return $date->getDate(DATE_FORMAT_UNIXTIME);
119  }
120 
128  public function setEnd($a_end)
129  {
130  // is it unix time ?
131  if(is_numeric($a_end) and $a_end)
132  {
133  $this->end = date('c', $a_end);
134  }
135  else
136  {
137  $this->end = $a_end;
138  }
139  }
140 
146  public function getEnd()
147  {
148  return $this->end;
149  }
150 
157  public function getUTEnd()
158  {
159  include_once('Date.php');
160 
161  $date = new Date();
162  $date->setDate($this->end);
163  return $date->getDate(DATE_FORMAT_UNIXTIME);
164  }
165 
173  public function setRoom($a_room)
174  {
175  $this->room = $a_room;
176  }
177 
184  public function getRoom()
185  {
186  return $this->room;
187  }
188 
196  public function setCycle($a_cycle)
197  {
198  $this->cycle = $a_cycle;
199  }
200 
208  public function getCycle()
209  {
210  return $this->cycle;
211  }
212 
213 }
214 ?>