ILIAS  trunk Revision v11.0_alpha-1866-gfa368f7776e
All Data Structures Namespaces Files Functions Variables Enumerations Enumerator Modules Pages
ilECSTimePlace Class Reference

Representation of ECS EContent Time Place. More...

+ Collaboration diagram for ilECSTimePlace:

Public Member Functions

 __construct ()
 
 __toString ()
 
 loadFromJson ($a_json)
 load from json More...
 
 setBegin ($a_begin)
 set begin More...
 
 getBegin ()
 get begin More...
 
 getUTBegin ()
 get begin as unix time More...
 
 setEnd (string $a_end)
 set end More...
 
 getEnd ()
 get end More...
 
 getUTEnd ()
 get end as unix time More...
 
 setRoom (string $a_room)
 set room More...
 
 getRoom ()
 get room More...
 
 setCycle ($a_cycle)
 set cycle More...
 
 getCycle ()
 get cycle More...
 

Private Attributes

ilLogger $logger
 
string $room = ''
 
string $begin = ''
 
string $end = ''
 
string $cycle = ''
 

Detailed Description

Representation of ECS EContent Time Place.

Author
Stefan Meyer meyer.nosp@m.@lei.nosp@m.fos.c.nosp@m.om
Version
$Id$

Definition at line 30 of file class.ilECSTimePlace.php.

Constructor & Destructor Documentation

◆ __construct()

ilECSTimePlace::__construct ( )

Definition at line 38 of file class.ilECSTimePlace.php.

References $DIC, and ILIAS\Repository\logger().

39  {
40  global $DIC;
41  $this->logger = $DIC->logger()->wsrv();
42  }
global $DIC
Definition: shib_login.php:22
+ Here is the call graph for this function:

Member Function Documentation

◆ __toString()

ilECSTimePlace::__toString ( )

Definition at line 44 of file class.ilECSTimePlace.php.

45  {
46  return "ECS Time and Place";
47  }

◆ getBegin()

ilECSTimePlace::getBegin ( )

get begin

Definition at line 96 of file class.ilECSTimePlace.php.

References $begin.

96  : string
97  {
98  return $this->begin;
99  }

◆ getCycle()

ilECSTimePlace::getCycle ( )

get cycle

Definition at line 166 of file class.ilECSTimePlace.php.

References $cycle.

166  : string
167  {
168  return $this->cycle;
169  }

◆ getEnd()

ilECSTimePlace::getEnd ( )

get end

Definition at line 126 of file class.ilECSTimePlace.php.

References $end.

126  : string
127  {
128  return $this->end;
129  }

◆ getRoom()

ilECSTimePlace::getRoom ( )

get room

Definition at line 150 of file class.ilECSTimePlace.php.

References $room.

150  : string
151  {
152  return $this->room;
153  }

◆ getUTBegin()

ilECSTimePlace::getUTBegin ( )

get begin as unix time

Definition at line 104 of file class.ilECSTimePlace.php.

References IL_CAL_DATE, IL_CAL_UNIX, and ilTimeZone\UTC.

Referenced by loadFromJson().

105  {
106  return (new ilDateTime($this->begin, IL_CAL_DATE, ilTimeZone::UTC))->get(IL_CAL_UNIX);
107  }
const IL_CAL_UNIX
const IL_CAL_DATE
+ Here is the caller graph for this function:

◆ getUTEnd()

ilECSTimePlace::getUTEnd ( )

get end as unix time

Definition at line 134 of file class.ilECSTimePlace.php.

References IL_CAL_DATE, IL_CAL_UNIX, and ilTimeZone\UTC.

Referenced by loadFromJson().

135  {
136  return (new ilDateTime($this->end, IL_CAL_DATE, ilTimeZone::UTC))->get(IL_CAL_UNIX);
137  }
const IL_CAL_UNIX
const IL_CAL_DATE
+ Here is the caller graph for this function:

◆ loadFromJson()

ilECSTimePlace::loadFromJson (   $a_json)

load from json

public

Parameters
objectjson representation
Exceptions
ilException

Definition at line 56 of file class.ilECSTimePlace.php.

References ilDateTime\_before(), getUTBegin(), getUTEnd(), IL_CAL_DATE, IL_CAL_UNIX, and ILIAS\Repository\logger().

56  : void
57  {
58  if (!is_object($a_json)) {
59  $this->logger->error(__METHOD__ . ': Cannot load from JSON. No object given.');
60  throw new ilException('Cannot parse ECSContent.');
61  }
62 
63  $this->logger->debug(__METHOD__ . ': ' . print_r($a_json, true));
64 
65  $this->room = $a_json->room ?? "";
66  $this->begin = $a_json->begin ?? "";
67  $this->end = $a_json->end ?? "";
68  $this->cycle = $a_json->cycle ?? "";
69 
70  $two = new ilDate('2000-01-02', IL_CAL_DATE);
71  if (ilDate::_before(new ilDateTime($this->getUTBegin(), IL_CAL_UNIX), $two)) {
72  $this->begin = '';
73  }
74  if (ilDate::_before(new ilDateTime($this->getUTEnd(), IL_CAL_UNIX), $two)) {
75  $this->end = '';
76  }
77  }
static _before(ilDateTime $start, ilDateTime $end, string $a_compare_field='', string $a_tz='')
compare two dates and check start is before end This method does not consider tz offsets.
const IL_CAL_UNIX
getUTBegin()
get begin as unix time
const IL_CAL_DATE
getUTEnd()
get end as unix time
+ Here is the call graph for this function:

◆ setBegin()

ilECSTimePlace::setBegin (   $a_begin)

set begin

Definition at line 82 of file class.ilECSTimePlace.php.

References IL_CAL_DATE, IL_CAL_UNIX, and ilTimeZone\UTC.

82  : void
83  {
84  // is it unix time ?
85  if (is_numeric($a_begin) && $a_begin) {
86  $dt = new ilDateTime($a_begin, IL_CAL_UNIX, ilTimeZone::UTC);
87  $this->end = $dt->get(IL_CAL_DATE);
88  } else {
89  $this->begin = $a_begin;
90  }
91  }
const IL_CAL_UNIX
const IL_CAL_DATE

◆ setCycle()

ilECSTimePlace::setCycle (   $a_cycle)

set cycle

Definition at line 158 of file class.ilECSTimePlace.php.

158  : void
159  {
160  $this->cycle = $a_cycle;
161  }

◆ setEnd()

ilECSTimePlace::setEnd ( string  $a_end)

set end

Definition at line 112 of file class.ilECSTimePlace.php.

References IL_CAL_DATE, IL_CAL_UNIX, and ilTimeZone\UTC.

112  : void
113  {
114  // is it unix time ?
115  if (is_numeric($a_end) && $a_end) {
116  $dt = new ilDateTime($a_end, IL_CAL_UNIX, ilTimeZone::UTC);
117  $this->end = $dt->get(IL_CAL_DATE);
118  } else {
119  $this->end = $a_end;
120  }
121  }
const IL_CAL_UNIX
const IL_CAL_DATE

◆ setRoom()

ilECSTimePlace::setRoom ( string  $a_room)

set room

Definition at line 142 of file class.ilECSTimePlace.php.

142  : void
143  {
144  $this->room = $a_room;
145  }

Field Documentation

◆ $begin

string ilECSTimePlace::$begin = ''
private

Definition at line 34 of file class.ilECSTimePlace.php.

Referenced by getBegin().

◆ $cycle

string ilECSTimePlace::$cycle = ''
private

Definition at line 36 of file class.ilECSTimePlace.php.

Referenced by getCycle().

◆ $end

string ilECSTimePlace::$end = ''
private

Definition at line 35 of file class.ilECSTimePlace.php.

Referenced by getEnd().

◆ $logger

ilLogger ilECSTimePlace::$logger
private

Definition at line 32 of file class.ilECSTimePlace.php.

◆ $room

string ilECSTimePlace::$room = ''
private

Definition at line 33 of file class.ilECSTimePlace.php.

Referenced by getRoom().


The documentation for this class was generated from the following file: