2015-03-15 18:13:25 +00:00
|
|
|
<?php
|
|
|
|
|
|
|
|
class Conference extends ModelBase
|
|
|
|
{
|
2016-12-10 17:22:34 +00:00
|
|
|
private $slug;
|
|
|
|
|
|
|
|
public function __construct($config, $slug)
|
|
|
|
{
|
|
|
|
parent::__construct($config);
|
|
|
|
$this->slug = $slug;
|
|
|
|
}
|
|
|
|
|
|
|
|
public function getSlug() {
|
|
|
|
return $this->slug;
|
|
|
|
}
|
|
|
|
|
2015-03-15 18:13:25 +00:00
|
|
|
public function getTitle() {
|
2015-12-25 20:42:12 +00:00
|
|
|
return $this->get('CONFERENCE.TITLE', 'C3VOC');
|
2015-03-15 18:13:25 +00:00
|
|
|
}
|
|
|
|
|
2015-12-23 12:53:05 +00:00
|
|
|
public function isPreviewEnabled() {
|
2016-12-11 20:17:30 +00:00
|
|
|
if(@$GLOBALS['forceopen'])
|
2016-09-03 17:50:34 +00:00
|
|
|
return true;
|
|
|
|
|
|
|
|
if($this->has('PREVIEW_DOMAIN') && ($this->get('PREVIEW_DOMAIN') == $_SERVER['SERVER_NAME']))
|
|
|
|
return true;
|
|
|
|
|
|
|
|
return false;
|
2015-12-23 12:53:05 +00:00
|
|
|
}
|
|
|
|
|
2015-04-04 18:11:25 +00:00
|
|
|
public function isClosed() {
|
2015-09-02 10:56:32 +00:00
|
|
|
return !$this->hasBegun() || $this->hasEnded();
|
|
|
|
}
|
|
|
|
|
2016-12-11 20:17:30 +00:00
|
|
|
public function isOpen() {
|
|
|
|
return !$this->isClosed();
|
|
|
|
}
|
|
|
|
|
2016-12-10 17:22:34 +00:00
|
|
|
public function startsAt() {
|
2016-12-11 19:27:35 +00:00
|
|
|
if(!$this->has('CONFERENCE.STARTS_AT'))
|
|
|
|
return null;
|
|
|
|
|
|
|
|
return DateTime::createFromFormat('U', $this->get('CONFERENCE.STARTS_AT'));
|
2016-12-10 17:22:34 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
public function endsAt() {
|
2016-12-11 19:27:35 +00:00
|
|
|
if(!$this->has('CONFERENCE.ENDS_AT'))
|
|
|
|
return null;
|
|
|
|
|
|
|
|
return DateTime::createFromFormat('U', $this->get('CONFERENCE.ENDS_AT'));
|
2016-12-10 17:22:34 +00:00
|
|
|
}
|
|
|
|
|
2015-09-02 10:56:32 +00:00
|
|
|
public function hasBegun() {
|
2015-12-23 10:58:44 +00:00
|
|
|
// on the preview-domain all conferences are always open
|
2015-12-23 12:53:05 +00:00
|
|
|
if($this->isPreviewEnabled())
|
2015-12-23 10:58:44 +00:00
|
|
|
return true;
|
|
|
|
|
2015-09-02 10:56:32 +00:00
|
|
|
if($this->has('CONFERENCE.CLOSED')) {
|
|
|
|
$closed = $this->get('CONFERENCE.CLOSED');
|
|
|
|
|
|
|
|
/* when CLOSED is a boolean, we're reading an old config where
|
|
|
|
* conferences didn't have a pre-beginning phase, thus we always
|
|
|
|
* return true.
|
|
|
|
*/
|
|
|
|
if(gettype($closed) == "boolean")
|
|
|
|
return true;
|
|
|
|
|
|
|
|
if($closed == "before")
|
|
|
|
return false;
|
2015-09-02 14:54:42 +00:00
|
|
|
else if($closed == "running" || $closed == "after")
|
2015-09-02 10:56:32 +00:00
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2015-09-09 01:40:40 +00:00
|
|
|
if($this->has('CONFERENCE.STARTS_AT')) {
|
2016-12-11 19:27:35 +00:00
|
|
|
$now = new DateTime('now');
|
|
|
|
return $now >= $this->startsAt();
|
2015-09-09 01:40:40 +00:00
|
|
|
} else {
|
|
|
|
return true;
|
|
|
|
}
|
2015-09-02 10:56:32 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
public function hasEnded() {
|
2015-12-23 10:58:44 +00:00
|
|
|
// on the preview-domain no conference ever ends
|
2015-12-23 12:53:05 +00:00
|
|
|
if($this->isPreviewEnabled())
|
2015-12-23 10:58:44 +00:00
|
|
|
return false;
|
|
|
|
|
2015-09-02 10:56:32 +00:00
|
|
|
if($this->has('CONFERENCE.CLOSED')) {
|
|
|
|
$closed = $this->get('CONFERENCE.CLOSED');
|
|
|
|
|
|
|
|
if($closed == "after" || $closed === true)
|
|
|
|
return true;
|
2015-09-02 14:54:42 +00:00
|
|
|
else if($closed == "running" || $closed == "before" ||
|
|
|
|
$closed === false)
|
2015-09-02 10:56:32 +00:00
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
2015-09-09 01:40:40 +00:00
|
|
|
if($this->has('CONFERENCE.ENDS_AT')) {
|
2016-12-11 19:27:35 +00:00
|
|
|
$now = new DateTime('now');
|
|
|
|
return $now >= $this->endsAt();
|
2015-09-09 01:40:40 +00:00
|
|
|
} else {
|
|
|
|
return false;
|
|
|
|
}
|
2015-04-04 18:11:25 +00:00
|
|
|
}
|
|
|
|
|
2015-03-15 18:13:25 +00:00
|
|
|
public function hasAuthor() {
|
|
|
|
return $this->has('CONFERENCE.AUTHOR');
|
|
|
|
}
|
|
|
|
public function getAuthor() {
|
|
|
|
return $this->get('CONFERENCE.AUTHOR', '');
|
|
|
|
}
|
|
|
|
|
|
|
|
public function hasDescription() {
|
|
|
|
return $this->has('CONFERENCE.DESCRIPTION');
|
|
|
|
}
|
|
|
|
public function getDescription() {
|
|
|
|
return $this->get('CONFERENCE.DESCRIPTION', '');
|
|
|
|
}
|
|
|
|
|
|
|
|
public function hasKeywords() {
|
|
|
|
return $this->has('CONFERENCE.KEYWORDS');
|
|
|
|
}
|
|
|
|
public function getKeywords() {
|
|
|
|
return $this->get('CONFERENCE.KEYWORDS', '');
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public function hasReleases() {
|
|
|
|
return $this->has('CONFERENCE.RELEASES');
|
|
|
|
}
|
|
|
|
public function getReleasesUrl() {
|
|
|
|
return $this->get('CONFERENCE.RELEASES');
|
|
|
|
}
|
|
|
|
|
2016-09-03 17:50:34 +00:00
|
|
|
public function getLink() {
|
2016-12-10 17:22:34 +00:00
|
|
|
return forceslash($this->getSlug()).url_params();
|
2016-09-03 17:50:34 +00:00
|
|
|
}
|
|
|
|
public function getAboutLink() {
|
2016-12-10 17:22:34 +00:00
|
|
|
return joinpath([$this->getSlug(), 'about']).url_params();
|
2016-09-03 17:50:34 +00:00
|
|
|
}
|
|
|
|
|
2015-03-15 18:13:25 +00:00
|
|
|
public function hasRelive() {
|
2016-12-11 20:46:54 +00:00
|
|
|
return $this->getRelive()->isEnabled();
|
2015-03-15 18:13:25 +00:00
|
|
|
}
|
|
|
|
public function getReliveUrl() {
|
2016-12-11 20:46:54 +00:00
|
|
|
if($this->getRelive()->isEnabled())
|
2016-12-10 17:22:34 +00:00
|
|
|
return joinpath([$this->getSlug(), 'relive']).url_params();
|
2015-03-15 18:13:25 +00:00
|
|
|
|
|
|
|
else
|
|
|
|
return null;
|
|
|
|
}
|
|
|
|
|
2016-12-10 17:22:34 +00:00
|
|
|
public function hasFeedback() {
|
|
|
|
return $this->has('FEEDBACK');
|
|
|
|
}
|
|
|
|
public function getFeedbackUrl() {
|
|
|
|
return joinpath([$this->getSlug(), 'feedback']).url_params();
|
|
|
|
}
|
|
|
|
public function getFeedbackReadUrl() {
|
|
|
|
return joinpath([$this->getSlug(), 'feedback', 'read']).url_params();
|
|
|
|
}
|
|
|
|
|
|
|
|
public function getScheduleJsonUrl() {
|
|
|
|
return joinpath([$this->getSlug(), 'schedule.json']).url_params();
|
|
|
|
}
|
|
|
|
|
2015-03-15 18:13:25 +00:00
|
|
|
public function hasBannerHtml() {
|
|
|
|
return $this->has('CONFERENCE.BANNER_HTML');
|
|
|
|
}
|
|
|
|
public function getBannerHtml() {
|
|
|
|
return $this->get('CONFERENCE.BANNER_HTML');
|
|
|
|
}
|
|
|
|
|
|
|
|
public function hasFooterHtml() {
|
|
|
|
return $this->has('CONFERENCE.FOOTER_HTML');
|
|
|
|
}
|
|
|
|
public function getFooterHtml() {
|
|
|
|
return $this->get('CONFERENCE.FOOTER_HTML');
|
|
|
|
}
|
2016-12-10 17:22:34 +00:00
|
|
|
|
|
|
|
|
|
|
|
public function getRooms()
|
|
|
|
{
|
|
|
|
$rooms = array();
|
|
|
|
foreach($this->get('ROOMS') as $slug => $room)
|
|
|
|
$rooms[] = $this->getRoom($slug);
|
|
|
|
|
|
|
|
return $rooms;
|
|
|
|
}
|
|
|
|
|
|
|
|
public function getRoomIfExists($room)
|
|
|
|
{
|
|
|
|
if($this->hasRoom($room))
|
|
|
|
return $this->getRoom($room);
|
|
|
|
|
|
|
|
return null;
|
|
|
|
}
|
|
|
|
|
|
|
|
public function hasRoom($slug)
|
|
|
|
{
|
|
|
|
return $this->has('ROOMS.'.$slug);
|
|
|
|
}
|
|
|
|
|
|
|
|
public function getRoom($room) {
|
|
|
|
return new Room($this, $room);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public function getFeedback() {
|
|
|
|
return new Feedback($this);
|
|
|
|
}
|
|
|
|
public function getSchedule() {
|
|
|
|
return new Schedule($this);
|
|
|
|
}
|
|
|
|
public function getSubtitles() {
|
|
|
|
return new Subtitles($this);
|
|
|
|
}
|
|
|
|
public function getOverview() {
|
|
|
|
return new Overview($this);
|
|
|
|
}
|
|
|
|
public function getRelive() {
|
|
|
|
return new Relive($this);
|
|
|
|
}
|
2016-12-11 20:46:01 +00:00
|
|
|
|
|
|
|
public function getExtraFiles() {
|
|
|
|
return $this->get('EXTRA_FILES', []);
|
|
|
|
}
|
2015-03-15 18:13:25 +00:00
|
|
|
}
|