-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #18 from docmcfly/development
Development
- Loading branch information
Showing
21 changed files
with
181 additions
and
298 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -10,12 +10,11 @@ | |
* For the full copyright and license information, please read the | ||
* LICENSE.txt file that was distributed with this source code. | ||
* | ||
* (c) 2023 C. Gogolin <[email protected]> | ||
* (c) 2022 C. Gogolin <[email protected]> | ||
*/ | ||
class Event extends AbstractEntity | ||
{ | ||
|
||
|
||
|
||
/** | ||
* | ||
* @var ObjectStorage<FrontendUserGroup> | ||
|
@@ -74,15 +73,15 @@ class Event extends AbstractEntity | |
|
||
/** | ||
* | ||
* @var int | ||
* @var string | ||
*/ | ||
protected $beginDate = 0 ; | ||
protected $date = '0000-00-00'; | ||
|
||
/** | ||
* | ||
* @var int | ||
* @var string | ||
*/ | ||
protected $beginTime = 68400; // 19:00 | ||
protected $time = '00:00'; | ||
|
||
/** | ||
* | ||
|
@@ -146,7 +145,6 @@ public function __construct() | |
|
||
// Do not remove the next line: It would break the functionality | ||
$this->initStorageObjects(); | ||
|
||
} | ||
|
||
/** | ||
|
@@ -327,70 +325,42 @@ public function setFullDay($fullDay): void | |
$this->fullDay = $fullDay; | ||
} | ||
|
||
|
||
|
||
|
||
/** | ||
* | ||
* @return int | ||
* @return \DateTime | ||
*/ | ||
public function getBeginDate(): int | ||
public function getDate(): \DateTime | ||
{ | ||
return $this->beginDate; | ||
return \DateTime::createFromFormat('Y-m-d', $this->date); | ||
} | ||
|
||
/** | ||
* | ||
* @param int $beginDate | ||
* @param \DateTime $date | ||
* @return void | ||
*/ | ||
public function setBeginDate(\DateTime $beginDate): void | ||
public function setDate(\DateTime $date): void | ||
{ | ||
$this->beginDate = $beginDate; | ||
} | ||
|
||
/** | ||
* | ||
* @return \DateTime | ||
*/ | ||
public function getBeginDateUTC(): \DateTime | ||
{ | ||
$return = new \DateTime(); | ||
$return->setTimestamp($this->beginDate); | ||
$return->setTimezone(new \DateTimeZone ('UTC')); | ||
return $return; | ||
} | ||
|
||
|
||
/** | ||
* | ||
* @return int | ||
*/ | ||
public function getBeginTime(): int | ||
{ | ||
return $this->beginTime; | ||
$this->date = $date->format('Y-m-d'); | ||
} | ||
|
||
/** | ||
* | ||
* @return \DateTime | ||
*/ | ||
public function getBeginTimeUTC(): \DateTime | ||
{ | ||
$return = new \DateTime(); | ||
$return->setTimestamp($this->beginTime); | ||
$return->setTimezone(new \DateTimeZone ('UTC')); | ||
return $return; | ||
public function getTime(): \DateTime | ||
{ | ||
return \DateTime::createFromFormat('H:i:s', $this->time); | ||
} | ||
|
||
/** | ||
* | ||
* @param int $time | ||
* @param \DateTime $time | ||
* @return void | ||
*/ | ||
public function setTime(int $beginTime): void | ||
public function setTime(\DateTime $time): void | ||
{ | ||
$this->beginTime = $beginTime; | ||
$this->time = $time->format('H:i:s'); | ||
} | ||
|
||
/** | ||
|
@@ -414,14 +384,13 @@ public function setDuration($duration): void | |
|
||
/** | ||
* | ||
* @return int | ||
* @return \DateTime | ||
*/ | ||
public function getBeginTimestamp(): int | ||
public function getDateTime(): \DateTime | ||
{ | ||
return $this->getFullDay() ? $this->getBeginDate() : $this->getBeginDate() + $this->getBeginTime(); | ||
return $this->getFullDay() ? \DateTime::createFromFormat('Y-m-d', $this->date)->setTime(0, 0) : \DateTime::createFromFormat('Y-m-d H:i:s', $this->date . ' ' . $this->time); | ||
} | ||
|
||
|
||
/** | ||
* | ||
* @return void | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.