ILIAS  release_8 Revision v8.19
All Data Structures Namespaces Files Functions Variables 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 29 of file class.ilECSTimePlace.php.

Constructor & Destructor Documentation

◆ __construct()

ilECSTimePlace::__construct ( )

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

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

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

Member Function Documentation

◆ __toString()

ilECSTimePlace::__toString ( )

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

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

◆ getBegin()

ilECSTimePlace::getBegin ( )

get begin

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

References $begin.

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

◆ getCycle()

ilECSTimePlace::getCycle ( )

get cycle

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

References $cycle.

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

◆ getEnd()

ilECSTimePlace::getEnd ( )

get end

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

References $end.

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

◆ getRoom()

ilECSTimePlace::getRoom ( )

get room

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

References $room.

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

◆ getUTBegin()

ilECSTimePlace::getUTBegin ( )

get begin as unix time

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

References IL_CAL_DATE, IL_CAL_UNIX, and ilTimeZone\UTC.

Referenced by loadFromJson().

104  {
105  return (new ilDateTime($this->begin, IL_CAL_DATE, ilTimeZone::UTC))->get(IL_CAL_UNIX);
106  }
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 133 of file class.ilECSTimePlace.php.

References IL_CAL_DATE, IL_CAL_UNIX, and ilTimeZone\UTC.

Referenced by loadFromJson().

134  {
135  return (new ilDateTime($this->end, IL_CAL_DATE, ilTimeZone::UTC))->get(IL_CAL_UNIX);
136  }
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 55 of file class.ilECSTimePlace.php.

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

55  : void
56  {
57  if (!is_object($a_json)) {
58  $this->logger->error(__METHOD__ . ': Cannot load from JSON. No object given.');
59  throw new ilException('Cannot parse ECSContent.');
60  }
61 
62  $this->logger->debug(__METHOD__ . ': ' . print_r($a_json, true));
63 
64  $this->room = $a_json->room ?? "";
65  $this->begin = $a_json->begin ?? "";
66  $this->end = $a_json->end ?? "";
67  $this->cycle = $a_json->cycle ?? "";
68 
69  $two = new ilDate('2000-01-02', IL_CAL_DATE);
70  if (ilDate::_before(new ilDateTime($this->getUTBegin(), IL_CAL_UNIX), $two)) {
71  $this->begin = '';
72  }
73  if (ilDate::_before(new ilDateTime($this->getUTEnd(), IL_CAL_UNIX), $two)) {
74  $this->end = '';
75  }
76  }
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 81 of file class.ilECSTimePlace.php.

References IL_CAL_DATE, IL_CAL_UNIX, and ilTimeZone\UTC.

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

◆ setCycle()

ilECSTimePlace::setCycle (   $a_cycle)

set cycle

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

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

◆ setEnd()

ilECSTimePlace::setEnd ( string  $a_end)

set end

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

References IL_CAL_DATE, IL_CAL_UNIX, and ilTimeZone\UTC.

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

◆ setRoom()

ilECSTimePlace::setRoom ( string  $a_room)

set room

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

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

Field Documentation

◆ $begin

string ilECSTimePlace::$begin = ''
private

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

Referenced by getBegin().

◆ $cycle

string ilECSTimePlace::$cycle = ''
private

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

Referenced by getCycle().

◆ $end

string ilECSTimePlace::$end = ''
private

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

Referenced by getEnd().

◆ $logger

ilLogger ilECSTimePlace::$logger
private

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

◆ $room

string ilECSTimePlace::$room = ''
private

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

Referenced by getRoom().


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