<?php
/*
 * PuzzleApp
 * Webemyos
 * Jérôme Oliva
 * GNU Licence
 */

namespace Apps\Calendar\Module\Member;

use Core\Controller\Controller;
use Core\View\View;
use Core\View\ElementView;

use Apps\Calendar\Entity\CalendarEvent;

/*
 * 
 */
 class MemberController extends Controller
 {
    /**
     * Constructeur
     */
    function _construct($core="")
    {
          $this->Core = $core;
    }

    /**
     * Create
     */
    function Create()
    {
    }

    /**
     * Init
     */
    function Init()
    {
    }

    /**
     * Render
     */
    function Show($all=true)
    {
         return $this->Index();
    }
    
    /*
    * Get the home page
    */
   function Index()
   {
       $view = new View(__DIR__."/View/index.tpl", $this->Core);
   
       $userEvent = new CalendarEvent($this->Core);
       $userEvent->join("CalendarEventUser ", "CalendarEventUser", "LEFT" ,   "CalendarEventUser.EventId = CalendarEvent.Id");
       
       $view->AddElement(new ElementView("Events", $userEvent->Find("CalendarEventUser.UserId=" .$this->Core->User->IdEntite)));
    
       return $view->Render();
   }
 
   
   }