3namespace ceLTIc\LTI\Content;
20 private $startDateTime =
null;
27 private $endDateTime =
null;
37 if (is_int($startDateTime)) {
38 $this->startDateTime = $startDateTime;
40 if (is_int($endDateTime)) {
41 $this->endDateTime = $endDateTime;
62 $timePeriod = new \stdClass();
63 if (!is_null($this->startDateTime)) {
64 $timePeriod->startDateTime = gmdate(
'Y-m-d\TH:i:s\Z', $this->startDateTime);
66 $timePeriod->startDateTime =
null;
68 if (!is_null($this->endDateTime)) {
69 $timePeriod->endDateTime = gmdate(
'Y-m-d\TH:i:s\Z', $this->endDateTime);
71 $timePeriod->endDateTime =
null;
87 $startDateTime =
null;
89 if (is_object($item)) {
91 foreach (get_object_vars($item) as $name => $value) {
94 $startDateTime = strtotime($item->startDateTime);
97 $endDateTime = strtotime($item->endDateTime);
104 if ($startDateTime || $endDateTime) {
105 $obj =
new TimePeriod($startDateTime, $endDateTime);
Class to represent a time period object.
static fromJsonObject($item)
Generate a LineItem object from its JSON or JSON-LD representation.
__construct($startDateTime, $endDateTime)
Class constructor.
toJsonObject()
Generate the JSON object representation of the image.
toJsonldObject()
Generate the JSON-LD object representation of the time period.