streaming-website/model/Conference.php

122 lines
2.7 KiB
PHP
Raw Normal View History

<?php
class Conference extends ModelBase
{
public function getTitle() {
return $this->get('CONFERENCE.TITLE', 'C3VOC Streaming');
}
public function isPreviewEnabled() {
2015-12-23 13:12:10 +00:00
return $this->has('PREVIEW_DOMAIN') && ($this->get('PREVIEW_DOMAIN') == $_SERVER['SERVER_NAME']);
}
public function isClosed() {
return !$this->hasBegun() || $this->hasEnded();
}
public function hasBegun() {
2015-12-23 10:58:44 +00:00
// on the preview-domain all conferences are always open
if($this->isPreviewEnabled())
2015-12-23 10:58:44 +00:00
return true;
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")
return true;
}
if($this->has('CONFERENCE.STARTS_AT')) {
return time() >= $this->get('CONFERENCE.STARTS_AT');
} else {
return true;
}
}
public function hasEnded() {
2015-12-23 10:58:44 +00:00
// on the preview-domain no conference ever ends
if($this->isPreviewEnabled())
2015-12-23 10:58:44 +00:00
return false;
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)
return false;
}
if($this->has('CONFERENCE.ENDS_AT')) {
return time() >= $this->get('CONFERENCE.ENDS_AT');
} else {
return false;
}
}
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');
}
public function hasRelive() {
2015-08-29 13:31:56 +00:00
return $this->has('CONFERENCE.RELIVE_JSON');
}
public function getReliveUrl() {
2015-08-29 13:31:56 +00:00
if($this->has('CONFERENCE.RELIVE_JSON'))
return 'relive/';
else
return null;
}
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');
}
}