<?php

namespace Modules;

class CMember extends ContentType {

    public $keys = array(
        'NAME' => 'name',
        'FIRSTNAME' => 'firstname',
        'ROLE' => 'role'
    );
    public $values;
    protected $layout;
    protected $layouts = array(
        'default' => 'simple',
        'toc' => 'view_in_toc'
    );
    
    function __construct($keys,$config) {

        parent::__construct($keys,$config);
    }

    
    function simple() {
        return sprintf("sdsd");
    }
        
    function view_in_toc() {
        $f3 = \Base::instance();
        $v = (object) $this->values;

        $name = $v->name;
        if ($v->firstname) {
            $name = $v->firstname." ".$name;
            //$name .= ", ".$v->firstname;
        }
        
        $v->termine = new TOC(array(
            'concerts',
            '/spielplan/termine/',
            ''
        ),
                           $f3->get('CONTENT'),
                           'MEMBERS=@'.$this->id
        );
        //var_dump($v->test);
        $v->termine->dispatch();
        
        
        return sprintf("<h1><a href=\"/%s\">%s</a><span class=\"role\">%s</span></h1>%s<br>",
                       $this->href,
                       $name,
                       $v->role,
                       $v->termine
        );
    }

}
