<?php

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

namespace Apps\Profil\Module\DialogAdminProfil;

use Core\Controller\Controller;
use Core\Entity\User\User;
use Core\Control\VTab\VTab;
use Core\Control\Libelle\Libelle;


use Apps\Profil\Widget\ProfilForm\ProfilForm;

class DialogAdminProfilController extends Controller{

    /***
     * Edit a user
     */
    function EditUser($userId){
      
        $user = new User($this->Core);
        $user->GetById($userId);
        
        $profilForm = new ProfilForm($this->Core);
        $profilForm->Load($user);
        $profilForm->form->LoadImage($user);
        
        $tabStrip = new VTab("tdDetailUser");
        $tabStrip->AddTab("Information",new Libelle($profilForm->Render()));
        
         $skillplugin = \Apps\EeApp\Helper\AppHelper::GetPluginType($this->Core, "Profil" , "Skill");
        
        if($skillplugin != null){
            $tabStrip->AddTab($this->Core->GetCode("Profil.Competence"), new Libelle($skillplugin->RenderDetailMember($userId)));
        }
        
        $caracteristicplugin = \Apps\EeApp\Helper\AppHelper::GetPluginType($this->Core, "Profil" , "Caracteristic");
        
        if($caracteristicplugin != null){
            $tabStrip->AddTab($this->Core->GetCode("Profil.Caracteristic"), new Libelle($caracteristicplugin->RenderDetailMember($userId)));
        }
   
        $documentplugin = \Apps\EeApp\Helper\AppHelper::GetPluginType($this->Core, "Profil" , "Document");
        
        if ($documentplugin != null){
           $tabStrip->AddTab($this->Core->GetCode("Profil.Document"), new Libelle($documentplugin->RenderDetailMember("Profil", $userId)));
        }
        
      
        return $tabStrip->Show();
    }
}