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.

contenttype.php 2.9KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123
  1. <?php
  2. namespace Modules;
  3. class ContentType {
  4. protected $href;
  5. protected $config;
  6. public $keys=array();
  7. public $values=array();
  8. protected $layout;
  9. protected $layouts = array(
  10. 'default' => 'view_default'
  11. );
  12. public $id = "";
  13. function __construct($keys,$config) {
  14. $f3 = \Base::instance();
  15. $available_layouts = array_keys($this->layouts);
  16. $this->layout = $available_layouts[0];
  17. $this->config = $config;
  18. $this->href= $f3->get('SITE_URL').str_replace($f3->get('CONTENT'),"",$this->config['path']);
  19. foreach ($this->keys as $k=>$v) {
  20. $this->values[$v] = $keys[$k];
  21. }
  22. $ke = explode("/",$this->config['path']);
  23. array_pop($ke);
  24. $id = array_pop($ke);
  25. $this->id = $id;
  26. }
  27. function __toString() {
  28. return $this->{$this->layouts[$this->layout]}();
  29. }
  30. function set_layout($new) {
  31. if(array_key_exists($new,$this->layouts)) {
  32. $this->layout = $new;
  33. //echo "changed layout to: ".$new."<br>";
  34. }
  35. }
  36. function view_default() {
  37. return "";
  38. }
  39. function month_name($n) {
  40. $f3 = \Base::instance();
  41. switch (strtolower($f3->get('LANG'))) {
  42. case 'de':
  43. $month_names = array('',
  44. 'Jan',
  45. 'Feb',
  46. 'Mrz',
  47. 'Apr',
  48. 'Mai',
  49. 'Jun',
  50. 'Jul',
  51. 'Aug',
  52. 'Sep',
  53. 'Okt',
  54. 'Nov',
  55. 'Dez'
  56. );
  57. return $month_names[$n];
  58. break;
  59. case 'en':
  60. $month_names = array('',
  61. 'Jan',
  62. 'Feb',
  63. 'Mar',
  64. 'Apr',
  65. 'May',
  66. 'Jun',
  67. 'Jul',
  68. 'Aug',
  69. 'Sep',
  70. 'Oct',
  71. 'Nov',
  72. 'Dec'
  73. );
  74. return $month_names[$n];
  75. break;
  76. default:
  77. return "";
  78. }
  79. }
  80. function week_day_name($n) {
  81. $f3 = \Base::instance();
  82. switch (strtolower($f3->get('LANG'))) {
  83. case 'de':
  84. $wd_names = array('',
  85. 'Montag',
  86. 'Dienstag',
  87. 'Mittwoch',
  88. 'Donnerstag',
  89. 'Freitag',
  90. 'Samstag',
  91. 'Sonntag'
  92. );
  93. return $wd_names[$n];
  94. break;
  95. case 'en':
  96. $wd_names = array('',
  97. 'Monday',
  98. 'Tuesday',
  99. 'Wednesday',
  100. 'Thursday',
  101. 'Friday',
  102. 'Saturday',
  103. 'Sunday'
  104. );
  105. return $wd_names[$n];
  106. break;
  107. default:
  108. return "";
  109. }
  110. }
  111. }