aboutsummaryrefslogtreecommitdiff
path: root/model/Conference.php
blob: 8a8291b5d83c734a793b1a32cc35dca07d6754c9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
<?php

class Conference extends ModelBase
{
	public function getTitle() {
		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->isPreviewEnabled())
			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;
			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() {
		// on the preview-domain no conference ever ends
		if($this->isPreviewEnabled())
			return false;

		if($this->has('CONFERENCE.CLOSED')) {
			$closed = $this->get('CONFERENCE.CLOSED');

			if($closed == "after" || $closed === true)
				return true;
			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() {
		return $this->has('CONFERENCE.RELIVE_JSON');
	}
	public function getReliveUrl() {
		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');
	}
}