From f6c0270d40f6730fe1e1820f2866b08792df1db6 Mon Sep 17 00:00:00 2001 From: MaZderMind Date: Sat, 10 Dec 2016 18:22:34 +0100 Subject: rewrite data-model so that every configuration option is accessed through the conference --- model/Conference.php | 84 ++++++++++++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 81 insertions(+), 3 deletions(-) (limited to 'model/Conference.php') diff --git a/model/Conference.php b/model/Conference.php index c6afa98..07d72dd 100644 --- a/model/Conference.php +++ b/model/Conference.php @@ -2,6 +2,18 @@ class Conference extends ModelBase { + private $slug; + + public function __construct($config, $slug) + { + parent::__construct($config); + $this->slug = $slug; + } + + public function getSlug() { + return $this->slug; + } + public function getTitle() { return $this->get('CONFERENCE.TITLE', 'C3VOC'); } @@ -20,6 +32,14 @@ class Conference extends ModelBase return !$this->hasBegun() || $this->hasEnded(); } + public function startsAt() { + return $this->get('CONFERENCE.STARTS_AT'); + } + + public function endsAt() { + return $this->get('CONFERENCE.ENDS_AT'); + } + public function hasBegun() { // on the preview-domain all conferences are always open if($this->isPreviewEnabled()) @@ -101,10 +121,10 @@ class Conference extends ModelBase } public function getLink() { - return url_params(); + return forceslash($this->getSlug()).url_params(); } public function getAboutLink() { - return 'about/'.url_params(); + return joinpath([$this->getSlug(), 'about']).url_params(); } public function hasRelive() { @@ -112,12 +132,26 @@ class Conference extends ModelBase } public function getReliveUrl() { if($this->has('CONFERENCE.RELIVE_JSON')) - return 'relive/'.url_params(); + return joinpath([$this->getSlug(), 'relive']).url_params(); else return null; } + 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(); + } + public function hasBannerHtml() { return $this->has('CONFERENCE.BANNER_HTML'); } @@ -131,4 +165,48 @@ class Conference extends ModelBase public function getFooterHtml() { return $this->get('CONFERENCE.FOOTER_HTML'); } + + + 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); + } } -- cgit v1.2.3