mostly filebased Content Presentation System
Vous ne pouvez pas sélectionner plus de 25 sujets Les noms de sujets doivent commencer par une lettre ou un nombre, peuvent contenir des tirets ('-') et peuvent comporter jusqu'à 35 caractères.

cconcert.php 7.8KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239
  1. <?php
  2. namespace Modules;
  3. class CConcert extends ContentType {
  4. public $keys = array(
  5. 'DATE' => 'date',
  6. 'TIME' => 'time',
  7. 'TITLE'=> 'title',
  8. 'DESCRIPTION' => 'description',
  9. 'DESCRIPTION2' => 'description2',
  10. 'LOCATION' => 'location',
  11. 'MARKER' => 'marker'
  12. );
  13. public $values;
  14. protected $layout;
  15. protected $layouts = array(
  16. 'toc' => 'view_in_toc',
  17. 'archive' => 'view_archive',
  18. 'archive_no_link' => 'view_archive_without_link',
  19. 'with_marker' => 'view_with_marker',
  20. 'short_reference' => 'only_name',
  21. 'header' => 'view_as_page_header',
  22. 'secondary' => 'rather_small',
  23. 'name_as_link' => 'view_name_as_link'
  24. );
  25. function __construct($keys,$config) {
  26. parent::__construct($keys,$config);
  27. }
  28. function view_in_toc() {
  29. $v = (object) $this->values;
  30. $TS = strtotime($v->date);
  31. $href = $this->href;
  32. $date = sprintf("<span class=\"month\">%s</span>"
  33. ."<span class=\"day-of-month\">%s</span>",
  34. $this->month_name(date('n',$TS)),
  35. date('d', $TS)
  36. );
  37. $description = sprintf("<h3><a href=\"/%s\">%s</a></h3>"
  38. ."<span>%s</span>"
  39. ."<footer>%s, %s</footer>",
  40. $href,
  41. $v->title,
  42. $v->description,
  43. $this->week_day_name(date('N',$TS)),
  44. $v->time
  45. );
  46. if (is_object($v->location)) {
  47. $v->location->set_layout("humble_two_liner");
  48. }
  49. return sprintf("<div class=\"entry concert toc\">"
  50. ."<div class=\"date\">%s</div>"
  51. ."<div class=\"description\">%s</div>"
  52. ."<div class=\"location\">%s</div>"
  53. ."</div>",
  54. $date,
  55. $description,
  56. $v->location
  57. );
  58. }
  59. function view_with_marker() {
  60. $v = (object) $this->values;
  61. $TS = strtotime($v->date);
  62. $href = $this->href;
  63. $date = sprintf("<span class=\"month\">%s</span>"
  64. ."<span class=\"day-of-month\">%s</span>",
  65. $this->month_name(date('n',$TS)),
  66. date('d', $TS)
  67. );
  68. $description = sprintf("<h3><a href=\"/%s\">%s</a> <span class=\"marker\">%s</span></h3>"
  69. ."<span>%s</span>"
  70. ."<footer>%s, %s</footer>",
  71. $href,
  72. $v->title,
  73. $v->marker,
  74. $v->description,
  75. $this->week_day_name(date('N',$TS)),
  76. $v->time
  77. );
  78. if (is_object($v->location)) {
  79. $v->location->set_layout("humble_two_liner");
  80. }
  81. return sprintf("<div class=\"entry marker\">"
  82. ."<div class=\"date\">%s</div>"
  83. ."<div class=\"description\">%s</div>"
  84. ."<div class=\"location\">%s</div>"
  85. ."</div>",
  86. $date,
  87. $description,
  88. $v->location
  89. );
  90. }
  91. function view_archive_without_link() {
  92. $v = (object) $this->values;
  93. $TS = strtotime($v->date);
  94. $date = sprintf("<span class=\"month\">%s</span>"
  95. ."<span class=\"day-of-month\">%s</span>",
  96. $this->month_name(date('n',$TS)),
  97. date('d', $TS)
  98. );
  99. $description = sprintf("<h3>%s</h3>"
  100. ."<span>%s</span>"
  101. ."<footer>%s</footer>",
  102. $v->title,
  103. $v->description,
  104. $v->description2
  105. );
  106. if (is_object($v->location)) {
  107. $v->location->set_layout("humble_two_liner");
  108. }
  109. return sprintf("<div class=\"entry concert archive\">"
  110. ."<div class=\"date\">%s</div>"
  111. ."<div class=\"description\">%s</div>"
  112. ."<div class=\"location\">%s</div>"
  113. ."</div>",
  114. $date,
  115. $description,
  116. $v->location
  117. );
  118. }
  119. function view_archive() {
  120. $v = (object) $this->values;
  121. $TS = strtotime($v->date);
  122. $date = sprintf("<span class=\"month\">%s</span>"
  123. ."<span class=\"day-of-month\">%s</span>",
  124. $this->month_name(date('n',$TS)),
  125. date('d', $TS)
  126. );
  127. $description = sprintf("<h3><a href=\"/%s\">%s</a></h3>"
  128. ."<span>%s</span>"
  129. ."<footer>%s</footer>",
  130. $this->href,
  131. $v->title,
  132. $v->description,
  133. $v->description2
  134. );
  135. if (is_object($v->location)) {
  136. $v->location->set_layout("humble_two_liner");
  137. }
  138. return sprintf("<div class=\"entry concert archive\">"
  139. ."<div class=\"date\">%s</div>"
  140. ."<div class=\"description\">%s</div>"
  141. ."<div class=\"location\">%s</div>"
  142. ."</div>",
  143. $date,
  144. $description,
  145. $v->location
  146. );
  147. }
  148. function view_as_page_header() {
  149. $v = (object) $this->values;
  150. $TS = strtotime($v->date);
  151. $time = sprintf("%s, %s - %s",
  152. $this->week_day_name(date('N',$TS)),
  153. date('d.m.y',$TS),
  154. $v->time
  155. );
  156. if (is_object($v->location)) {
  157. $v->location->set_layout('one_liner');
  158. }
  159. return sprintf("<div class=\"concert-info\">"
  160. ."<h1>%s</h1>"
  161. ."<h5>%s</h5>"
  162. ."<span class=\"time\">%s</span>"
  163. ."<span class=\"location\">%s</span>"
  164. ."</div>",
  165. $v->title,
  166. $v->description,
  167. $time,
  168. $v->location
  169. );
  170. }
  171. function rather_small() {
  172. $v = (object) $this->values;
  173. $TS = strtotime($v->date);
  174. $v->location->set_layout("town");
  175. $town = strip_tags(sprintf("%s",$v->location));
  176. $v->location->set_layout('collected_entry');
  177. return sprintf("<div class=\"entry-small\">"
  178. ."<h6 class=\"date-and-town\">%s %s<span class=\"time-in-header\"> - %s</span></h6>"
  179. ."<span class=\"venue\">%s</span>"
  180. ."<h5 class=\"name\"><a href=\"/%s\">%s</a></h5>"
  181. ."</div>",
  182. date("d.m.", $TS),
  183. $town,
  184. $v->time,
  185. $v->location,
  186. $this->href,
  187. $v->title
  188. );
  189. }
  190. function only_name() {
  191. $v = (object) $this->values;
  192. return sprintf("<h6><a href=\"/%s\">%s</a></h6>",
  193. $this->href,
  194. $v->title
  195. );
  196. }
  197. function view_name_as_link() {
  198. $v = (object) $this->values;
  199. return sprintf("<a href=\"/%s\">%s</a>",
  200. $this->href,
  201. $v->title
  202. );
  203. }
  204. }