<?php

namespace Modules;

class CCalendar extends ContentType {

    public $keys = array(
        'VON' => 'from',
        'BIS' => 'to'
    );
    public $values;
    protected $layout;
    protected $layouts = array(
        'default' => 'weeks_compact'
    );
    
    function __construct($keys,$config) {
        parent::__construct($keys,$config);
    }

    

    function weeks_compact() {
    
        $v = (object) $this->values;
        //$TS = strtotime($v->date);
        //$href = $this->href;
        
        $TS = time();
        
        $start = $TS;
        $end = $TS + 50 * 86400;
        
        $days = "";
        for ($day = $start; $day<=$end; $day=$day+(86400)) {
            $days .= sprintf("<div class='calendar-day weekday-%s'>%s</div>",
                date("w",$day),
                date("D, d. ",$day)
                );
        }
        
        return sprintf("<div class=\"calendar calendar-week\">"
                       ."%s"
                       ."</div>",
                       $days
        );
    }
    
   

}

