|
- <?php
-
- namespace Modules;
-
- class CLocation extends ContentType {
-
- public $keys = array(
- 'NAME' => 'name',
- 'TOWN' => 'town'
- );
- public $values;
- protected $layout;
- protected $layouts = array(
- 'toc' => 'view_in_toc',
- 'only_name' => 'view_only_name',
- 'humble_two_liner' => 'view_small_in_two_lines',
- 'one_liner' => 'view_all_in_one_line',
- 'collected_header' => 'only_town',
- 'collected_entry' => 'only_name_as_link',
- 'town' => 'town'
- );
-
- function __construct($keys,$config) {
-
- parent::__construct($keys,$config);
- }
-
-
-
- function view_in_toc() {
- $v = (object) $this->values;
- return sprintf("<div class=\"location\"><a href=\"/%s\"><h3>%s</h3></a><span>%s</span></div>",
- $this->href,
- $v->name,
- $v->town
- );
- }
- function view_only_name() {
- $v = (object) $this->values;
- return sprintf("<div class=\"location\"><a href=\"/%s\"><span>%s</span></a></div>",
- $this->href,
- $v->name
- );
- }
- function view_all_in_one_line() {
- $v = (object) $this->values;
- return sprintf("<div class=\"location\">"
- ."<span class=\"town\">%s</span>, "
- ."<span class=\"venue-name\"><a href=\"/%s\">%s</a></span>"
- ."</div>",
- $v->town,
- $this->href,
- $v->name
- );
- }
- function view_small_in_two_lines() {
- $v = (object) $this->values;
- return sprintf("<div class=\"location\">"
- ."<h6 class=\"town\">%s</h6>"
- ."<span class=\"venue-name\"><a href=\"/%s\">%s</a></span>"
- ."</div>",
- $v->town,
- $this->href,
- $v->name
- );
- }
-
- function only_name_as_link() {
- $v = (object) $this->values;
- return sprintf("<h5><a href=\"/%s\">%s</a></h5>",
- $this->href,
- $v->name
- );
- }
- function only_town() {
- $v = (object) $this->values;
- return sprintf("<h2>%s</h2>",$v->town);
- }
- function town() {
- $v = (object) $this->values;
- return $v->town;
- }
-
- }
|