<?php

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

namespace Apps\Reward\Module\DialogAdminReward;

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

use Apps\Reward\Entity\RewardReward;
use Apps\Reward\Widget\RewardForm\RewardForm;

use Apps\Reward\Entity\RewardGifts;
use Apps\Reward\Widget\RewardGiftForm\RewardGiftForm;

/*
 * 
 */
 class DialogAdminRewardController 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();
   }
     
   /***
    * Ajout d'une récompense
    */
   function AddReward($rewardId){

        $rewardForm = new RewardForm($this->Core);

        if($rewardId != ""){
            $reward = new RewardReward($this->Core);
            $reward->GetById($rewardId);
            $rewardForm->Load($reward);
        }

        return $rewardForm->Render();
   } 

   /***
    * Ajout d'un cadeau
    */
   function AddGift($giftId){

        $rewardGiftForm = new RewardGiftForm($this->Core);

        if($giftId != ""){
            $reward = new RewardGifts($this->Core);
            $reward->GetById($giftId);
            $rewardGiftForm->Load($reward);
        }

        return $rewardGiftForm->Render();
   }

          /*action*/
 }?>