|
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123 |
- <?php
-
- namespace Modules;
-
- class ContentType {
-
- protected $href;
- protected $config;
- public $keys=array();
- public $values=array();
- protected $layout;
- protected $layouts = array(
- 'default' => 'view_default'
- );
- public $id = "";
-
- function __construct($keys,$config) {
- $f3 = \Base::instance();
- $available_layouts = array_keys($this->layouts);
- $this->layout = $available_layouts[0];
- $this->config = $config;
-
- $this->href= $f3->get('SITE_URL').str_replace($f3->get('CONTENT'),"",$this->config['path']);
-
- foreach ($this->keys as $k=>$v) {
- $this->values[$v] = $keys[$k];
- }
-
- $ke = explode("/",$this->config['path']);
- array_pop($ke);
- $id = array_pop($ke);
- $this->id = $id;
- }
-
- function __toString() {
- return $this->{$this->layouts[$this->layout]}();
- }
-
- function set_layout($new) {
- if(array_key_exists($new,$this->layouts)) {
- $this->layout = $new;
- //echo "changed layout to: ".$new."<br>";
- }
- }
-
- function view_default() {
- return "";
- }
-
- function month_name($n) {
- $f3 = \Base::instance();
- switch (strtolower($f3->get('LANG'))) {
- case 'de':
- $month_names = array('',
- 'Jan',
- 'Feb',
- 'Mrz',
- 'Apr',
- 'Mai',
- 'Jun',
- 'Jul',
- 'Aug',
- 'Sep',
- 'Okt',
- 'Nov',
- 'Dez'
- );
- return $month_names[$n];
- break;
- case 'en':
- $month_names = array('',
- 'Jan',
- 'Feb',
- 'Mar',
- 'Apr',
- 'May',
- 'Jun',
- 'Jul',
- 'Aug',
- 'Sep',
- 'Oct',
- 'Nov',
- 'Dec'
- );
- return $month_names[$n];
- break;
- default:
- return "";
- }
- }
- function week_day_name($n) {
- $f3 = \Base::instance();
- switch (strtolower($f3->get('LANG'))) {
- case 'de':
- $wd_names = array('',
- 'Montag',
- 'Dienstag',
- 'Mittwoch',
- 'Donnerstag',
- 'Freitag',
- 'Samstag',
- 'Sonntag'
- );
- return $wd_names[$n];
- break;
- case 'en':
- $wd_names = array('',
- 'Monday',
- 'Tuesday',
- 'Wednesday',
- 'Thursday',
- 'Friday',
- 'Saturday',
- 'Sunday'
- );
- return $wd_names[$n];
- break;
- default:
- return "";
- }
- }
-
- }
|