<?php

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

namespace Apps\Courses\Module\DialogAdminCourses;

use Core\Control\Button\Button;
use Core\Controller\Controller;
use Core\View\View;

use Apps\Courses\Entity\CourseCour;
use Apps\Courses\Widget\CoursesCourForm\CoursesCourForm;

/*
 * 
 */
 class DialogAdminCoursesController 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);
       return $view->Render();
   }

   /***
    * Ajoute/Edit un cour
    */
   function AddCour($courId){

    $courForm = new CoursesCourForm($this->Core);

    if($courId != ""){
        $cours = new CourseCour($this->Core);
        $cours->GetById($courId);
        $courForm->Load($cours);
    }

    return $courForm->Render();
   }
          
          /*action*/
 }?>