Done view settings/admins (lists the admins of the warehouse)

This commit is contained in:
xdrm-brackets 2017-11-07 12:58:32 +01:00
parent e1c5acf96c
commit d161f464fb
3 changed files with 56 additions and 3 deletions

View File

@ -3,10 +3,47 @@
namespace view\settings\admin\view;
use \generic\core\i_view;
use \api\core\Request;
use \error\core\Err;
class main extends i_view{
public function __construct(){}
/* (1) Attributes
---------------------------------------------------------*/
public $icon;
public $theme;
public $self_id;
public function __construct(){
/* (1) Setup attributes
---------------------------------------------------------*/
/* (1) Fill attributes */
$this->icon = [
'remove' => file_get_contents( __PUBLIC__.'/src/static/sub-menu-side/remove.svg' )
];
$this->theme = $_SESSION['WAREHOUSE']['theme'];
$this->self_id = $_SESSION['ADMIN']['id'];
}
public function get_admins(){
/* (1) On exécute la requête */
$adminListRq = new Request('authenticationDefault/get_admins');
/* (2) On recupere la reponse */
$adminListRs = $adminListRq->dispatch();
/* (3) si erreur vide */
if( $adminListRs->error->get() != Err::Success )
return [];
/* (4) On récupère la liste des utilisateurs */
return $adminListRs->get('admins');
}
}

View File

@ -1 +1,17 @@
<span class='in-dev'>In development.. This feature will soon be available.</span>
{% for admin in core.get_admins() %}
<article class='inline-row' id='{{ admin.id_admin }}'>
<span data-admin='{{ admin.id_admin }}' class='title'><span style='color: {{ core.theme }};'>#{{ admin.username }}</span></span>
<span>
<span>{{ admin.mail }}</span>
</span>
<span>
<span class='link_remove list' data-admin='{{ admin.id_admin }}'>{{ core.icon.remove | raw }}</span>
</span>
</article>
{% endfor %}

View File

@ -57,7 +57,7 @@
/* LISTE ADMINISTRATEURS
*
*/
echo "<section data-sublink='admins'>";
echo "<section data-sublink='admins' class='list fstart'>>";
$view = View::load('settings.admin.view');
echo $view->render();