<?php

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

namespace Apps\Notify\Module\Front;

use Core\Controller\Controller;
use Core\View\View;
use Core\View\ElementView;
use Core\Control\Icone\EditIcone;
use Core\Control\Libelle\Libelle;
use Core\Control\TabStrip\TabStrip;
use Core\Control\EntityGrid\EntityGrid;
use Core\Control\EntityGrid\EntityColumn;
use Core\Control\EntityGrid\EntityIconColumn;
use Core\Control\EntityGrid\EntityFunctionColumn;
use Core\Entity\Entity\Argument;
use Core\Control\Button\Button;

use Apps\Notify\Widget\NotifyParametersForm\NotifyParametersForm;
use Apps\Notify\Entity\NotifyParameters;

use Apps\Notify\Widget\NotifyTemplateForm\NotifyTemplateForm;
use Apps\Notify\Entity\NotifyTemplate;

use Apps\Notify\Widget\NotifyPushForm\NotifyPushForm;
use Apps\Notify\Entity\NotifyPush;

use Apps\Notify\Helper\MessageHelper;

/*
 * 
 */
 class FrontController extends Controller
 {
    /**
     * Constructeur
     */
    function _construct($core="")
    {
          $this->Core = $core;
    }
 
     /***
    * Envoi un email Admin
    */
   function SendEmailAdmin($data, $params){
      $user = new \Core\Entity\User\User($this->Core);
      $users = $user->Find("GroupId=1");

      foreach($users as $user){
         echo "Envoi de message a " . $user->Email->Value . "; Message : " .json_encode($data); 
         
         //TODO MATCHER LES DATA ABEC LMES PARAMS 
         
         
       
         MessageHelper::SendMail($this->Core, $user->Email->Value, "Email Admin", $params);
      }
   }
    
}