show warning when running in preview mode

This commit is contained in:
MaZderMind 2015-12-23 13:53:05 +01:00
parent 2b671e30da
commit c1c54bd129
4 changed files with 41 additions and 6 deletions

View file

@ -61,6 +61,28 @@ nav {
}
}
.preview-warning {
position: fixed;
top: 0;
right: 0;
background: red;
width: 190px;
height: 100px;
z-index: 2000;
text-align: center;
border-bottom-left-radius: 60px;
line-height: 40px;
padding-left: 10px;
font-size: 30px;
padding-top: 9px;
color: white;
cursor: default;
&:hover {
opacity: 0.1;
}
}
body {
padding: 50px 0;

View file

@ -6,16 +6,18 @@ class Conference extends ModelBase
return $this->get('CONFERENCE.TITLE', 'C3Voc Streaming');
}
public function isPreviewEnabled() {
return $this->has('PREVIEW_DOMAIN') && ($this->get('PREVIEW_DOMAIN') == $_SERVER['HTTP_HOST']);
}
public function isClosed() {
return !$this->hasBegun() || $this->hasEnded();
}
public function hasBegun() {
// on the preview-domain all conferences are always open
if($this->has('PREVIEW_DOMAIN') && $this->get('PREVIEW_DOMAIN') == $_SERVER['HTTP_HOST'])
{
if($this->isPreviewEnabled())
return true;
}
if($this->has('CONFERENCE.CLOSED')) {
$closed = $this->get('CONFERENCE.CLOSED');
@ -42,10 +44,8 @@ class Conference extends ModelBase
public function hasEnded() {
// on the preview-domain no conference ever ends
if($this->has('PREVIEW_DOMAIN') && $this->get('PREVIEW_DOMAIN') == $_SERVER['HTTP_HOST'])
{
if($this->isPreviewEnabled())
return false;
}
if($this->has('CONFERENCE.CLOSED')) {
$closed = $this->get('CONFERENCE.CLOSED');

View file

@ -31,3 +31,10 @@
</div>
</div>
</nav>
<? if($conference->isPreviewEnabled()): ?>
<div class="preview-warning">
PREVIEW MODE
</div>
<? endif ?>

View file

@ -1,5 +1,11 @@
<!DOCTYPE html>
<? if($conference->isPreviewEnabled()): ?>
<!--
RUNNING IN PREVIEW MODE
OPEN/CLOSED INFORMATION IS IGNORED!
-->
<? endif ?>
<html>
<head>