<?php

use Joomla\CMS\Factory;
use Joomla\CMS\MVC\View\HtmlView;
use Joomla\CMS\Uri\Uri;
use Joomla\CMS\HTML\HTMLHelper;

// No direct access.
defined('_JEXEC') or die;

class ClubsViewClubAssoc extends HtmlView
{
    
    public function display(string $tpl = null)
    {
        // FIXME Insert code from DB
        $inp = Factory::getApplication()->input;
        
        $this->userName = 'Max Muster';
        $this->userMail = 'Foo@bar.com';
        $this->userPhone = '34';
        $this->userMobile = '4987';
        $this->userAddress="Foo\nBar\nBax";
        $this->userIsAdmin = true;
        
        $this->clubid = 43;
        
        $this->mailDedicated = true;
        
        $this->clubname = "Testclub";
        $this->address = "Strasse 1\n66123 Ort";
        $this->contactperson = "Max Mustermann";
        $this->email = "me@club.de";
        $this->phone = "012345";
        $this->internet = "http://wichtig.de";
        
        $this->options = array("Step" => NULL, "JMD" => 1, "Divers." => NULL);
        $this->hasOptions = false;
        foreach($this->options as $o)
            if(isset($o))
            {
                $this->hasOptions = true;
                break;
            }
        
        $this->trainingPlaces = array();
        //         $this->trainingPlaces[] = array('name'=>'Schule', 'street'=>'Straße', 'city'=>'SB', 'plz'=>'12345');
        //         $this->trainingPlaces[] = array('name'=>'Schule', 'street'=>'Straße', 'city'=>'SB', 'plz'=>'12345');
        
        $this->persons = array();
        $this->persons[] = array('name'=>'Max', 'position'=>'Präsident', 'id'=>3, 'assoc'=>6, 'modify'=>true);
        $this->persons[] = array('name'=>'Max', 'position'=>'Präsident', 'id'=>3, 'assoc'=>7, 'modify'=>false);
        
        $this->canModify = true;
        if($inp->get('assoc', -1, 'INT') == -1)
            $this->taskName = 'club.addassoc';
        else
            $this->taskName = 'club.chassoc';
        
        HTMLHelper::_('jquery.framework');
        Factory::getDocument()->addStyleSheet(Uri::base(true) .  "components/com_clubs/css/clubs.css");
        Factory::getDocument()->addScript(Uri::base(true) .  "components/com_clubs/js/assoc.js");
        
        parent::display($tpl);
    }
    
}