|
- <?php
-
- namespace Modules;
-
- class CConcert extends ContentType {
-
- public $keys = array(
- 'DATE' => 'date',
- 'TIME' => 'time',
- 'TITLE'=> 'title',
- 'DESCRIPTION' => 'description',
- 'DESCRIPTION2' => 'description2',
- 'LOCATION' => 'location',
- 'MARKER' => 'marker'
- );
- public $values;
- protected $layout;
- protected $layouts = array(
- 'toc' => 'view_in_toc',
- 'archive' => 'view_archive',
- 'archive_no_link' => 'view_archive_without_link',
- 'with_marker' => 'view_with_marker',
- 'short_reference' => 'only_name',
- 'header' => 'view_as_page_header',
- 'secondary' => 'rather_small',
- 'name_as_link' => 'view_name_as_link'
- );
-
- function __construct($keys,$config) {
- parent::__construct($keys,$config);
- }
-
-
-
- function view_in_toc() {
- $v = (object) $this->values;
- $TS = strtotime($v->date);
- $href = $this->href;
-
- $date = sprintf("<span class=\"month\">%s</span>"
- ."<span class=\"day-of-month\">%s</span>",
- $this->month_name(date('n',$TS)),
- date('d', $TS)
- );
-
- $description = sprintf("<h3><a href=\"/%s\">%s</a></h3>"
- ."<span>%s</span>"
- ."<footer>%s, %s</footer>",
- $href,
- $v->title,
- $v->description,
- $this->week_day_name(date('N',$TS)),
- $v->time
- );
-
- if (is_object($v->location)) {
- $v->location->set_layout("humble_two_liner");
- }
-
- return sprintf("<div class=\"entry concert toc\">"
- ."<div class=\"date\">%s</div>"
- ."<div class=\"description\">%s</div>"
- ."<div class=\"location\">%s</div>"
- ."</div>",
- $date,
- $description,
- $v->location
- );
- }
-
- function view_with_marker() {
- $v = (object) $this->values;
- $TS = strtotime($v->date);
- $href = $this->href;
-
- $date = sprintf("<span class=\"month\">%s</span>"
- ."<span class=\"day-of-month\">%s</span>",
- $this->month_name(date('n',$TS)),
- date('d', $TS)
- );
-
- $description = sprintf("<h3><a href=\"/%s\">%s</a> <span class=\"marker\">%s</span></h3>"
- ."<span>%s</span>"
- ."<footer>%s, %s</footer>",
- $href,
- $v->title,
- $v->marker,
- $v->description,
- $this->week_day_name(date('N',$TS)),
- $v->time
- );
-
- if (is_object($v->location)) {
- $v->location->set_layout("humble_two_liner");
- }
-
- return sprintf("<div class=\"entry marker\">"
- ."<div class=\"date\">%s</div>"
- ."<div class=\"description\">%s</div>"
- ."<div class=\"location\">%s</div>"
- ."</div>",
- $date,
- $description,
- $v->location
- );
- }
-
- function view_archive_without_link() {
- $v = (object) $this->values;
- $TS = strtotime($v->date);
-
- $date = sprintf("<span class=\"month\">%s</span>"
- ."<span class=\"day-of-month\">%s</span>",
- $this->month_name(date('n',$TS)),
- date('d', $TS)
- );
-
- $description = sprintf("<h3>%s</h3>"
- ."<span>%s</span>"
- ."<footer>%s</footer>",
- $v->title,
- $v->description,
- $v->description2
- );
-
- if (is_object($v->location)) {
- $v->location->set_layout("humble_two_liner");
- }
-
- return sprintf("<div class=\"entry concert archive\">"
- ."<div class=\"date\">%s</div>"
- ."<div class=\"description\">%s</div>"
- ."<div class=\"location\">%s</div>"
- ."</div>",
- $date,
- $description,
- $v->location
- );
- }
- function view_archive() {
- $v = (object) $this->values;
- $TS = strtotime($v->date);
-
- $date = sprintf("<span class=\"month\">%s</span>"
- ."<span class=\"day-of-month\">%s</span>",
- $this->month_name(date('n',$TS)),
- date('d', $TS)
- );
-
- $description = sprintf("<h3><a href=\"/%s\">%s</a></h3>"
- ."<span>%s</span>"
- ."<footer>%s</footer>",
- $this->href,
- $v->title,
- $v->description,
- $v->description2
- );
-
- if (is_object($v->location)) {
- $v->location->set_layout("humble_two_liner");
- }
-
- return sprintf("<div class=\"entry concert archive\">"
- ."<div class=\"date\">%s</div>"
- ."<div class=\"description\">%s</div>"
- ."<div class=\"location\">%s</div>"
- ."</div>",
- $date,
- $description,
- $v->location
- );
- }
-
- function view_as_page_header() {
- $v = (object) $this->values;
- $TS = strtotime($v->date);
-
- $time = sprintf("%s, %s - %s",
- $this->week_day_name(date('N',$TS)),
- date('d.m.y',$TS),
- $v->time
- );
-
- if (is_object($v->location)) {
- $v->location->set_layout('one_liner');
- }
-
- return sprintf("<div class=\"concert-info\">"
- ."<h1>%s</h1>"
- ."<h5>%s</h5>"
- ."<span class=\"time\">%s</span>"
- ."<span class=\"location\">%s</span>"
- ."</div>",
- $v->title,
- $v->description,
- $time,
- $v->location
- );
- }
-
- function rather_small() {
- $v = (object) $this->values;
- $TS = strtotime($v->date);
-
- $v->location->set_layout("town");
- $town = strip_tags(sprintf("%s",$v->location));
- $v->location->set_layout('collected_entry');
-
- return sprintf("<div class=\"entry-small\">"
- ."<h6 class=\"date-and-town\">%s %s<span class=\"time-in-header\"> - %s</span></h6>"
- ."<div class=\"venue\">%s</div>" // this used to be a span
- ."<h5 class=\"name\"><a href=\"/%s\">%s</a></h5>"
- ."</div>",
- date("d.m.", $TS),
- $town,
- $v->time,
- $v->location,
- $this->href,
- $v->title
- );
- }
-
- function only_name() {
- $v = (object) $this->values;
- return sprintf("<h6><a href=\"/%s\">%s</a></h6>",
- $this->href,
- $v->title
- );
- }
-
- function view_name_as_link() {
- $v = (object) $this->values;
- return sprintf("<a href=\"/%s\">%s</a>",
- $this->href,
- $v->title
- );
- }
-
- }
|