From c1c54bd1295d9de8b3575cef25efa3dd5f6b0c85 Mon Sep 17 00:00:00 2001 From: MaZderMind Date: Wed, 23 Dec 2015 13:53:05 +0100 Subject: [PATCH] show warning when running in preview mode --- assets/css/_structure.less | 22 ++++++++++++++++++++++ model/Conference.php | 12 ++++++------ template/assemblies/header.phtml | 7 +++++++ template/page.phtml | 6 ++++++ 4 files changed, 41 insertions(+), 6 deletions(-) diff --git a/assets/css/_structure.less b/assets/css/_structure.less index 422bfaba..13cd86a6 100644 --- a/assets/css/_structure.less +++ b/assets/css/_structure.less @@ -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; diff --git a/model/Conference.php b/model/Conference.php index 701d7c75..8a8291b5 100644 --- a/model/Conference.php +++ b/model/Conference.php @@ -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'); diff --git a/template/assemblies/header.phtml b/template/assemblies/header.phtml index 955d0747..57beb5f5 100644 --- a/template/assemblies/header.phtml +++ b/template/assemblies/header.phtml @@ -31,3 +31,10 @@ + + +isPreviewEnabled()): ?> +
+ PREVIEW MODE +
+ \ No newline at end of file diff --git a/template/page.phtml b/template/page.phtml index a358a277..73a12ad0 100644 --- a/template/page.phtml +++ b/template/page.phtml @@ -1,5 +1,11 @@ +isPreviewEnabled()): ?> + +