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.

clocation.php 2.4KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384
  1. <?php
  2. namespace Modules;
  3. class CLocation extends ContentType {
  4. public $keys = array(
  5. 'NAME' => 'name',
  6. 'TOWN' => 'town'
  7. );
  8. public $values;
  9. protected $layout;
  10. protected $layouts = array(
  11. 'toc' => 'view_in_toc',
  12. 'only_name' => 'view_only_name',
  13. 'humble_two_liner' => 'view_small_in_two_lines',
  14. 'one_liner' => 'view_all_in_one_line',
  15. 'collected_header' => 'only_town',
  16. 'collected_entry' => 'only_name_as_link',
  17. 'town' => 'town'
  18. );
  19. function __construct($keys,$config) {
  20. parent::__construct($keys,$config);
  21. }
  22. function view_in_toc() {
  23. $v = (object) $this->values;
  24. return sprintf("<div class=\"location\"><a href=\"%s\"><h3>%s</h3></a><span>%s</span></div>",
  25. $this->href,
  26. $v->name,
  27. $v->town
  28. );
  29. }
  30. function view_only_name() {
  31. $v = (object) $this->values;
  32. return sprintf("<div class=\"location\"><a href=\"%s\"><span>%s</span></a></div>",
  33. $this->href,
  34. $v->name
  35. );
  36. }
  37. function view_all_in_one_line() {
  38. $v = (object) $this->values;
  39. return sprintf("<div class=\"location\">"
  40. ."<span class=\"town\">%s</span>,&nbsp;"
  41. ."<span class=\"venue-name\"><a href=\"/%s\">%s</a></span>"
  42. ."</div>",
  43. $v->town,
  44. $this->href,
  45. $v->name
  46. );
  47. }
  48. function view_small_in_two_lines() {
  49. $v = (object) $this->values;
  50. return sprintf("<div class=\"location\">"
  51. ."<h6 class=\"town\">%s</h6>"
  52. ."<span class=\"venue-name\"><a href=\"/%s\">%s</a></span>"
  53. ."</div>",
  54. $v->town,
  55. $this->href,
  56. $v->name
  57. );
  58. }
  59. function only_name_as_link() {
  60. $v = (object) $this->values;
  61. return sprintf("<h5><a href=\"/%s\">%s</a></h5>",
  62. $this->href,
  63. $v->name
  64. );
  65. }
  66. function only_town() {
  67. $v = (object) $this->values;
  68. return sprintf("<h2>%s</h2>",$v->town);
  69. }
  70. function town() {
  71. $v = (object) $this->values;
  72. return $v->town;
  73. }
  74. }