diff --git a/Controller/ListmembersController.php b/Controller/ListmembersController.php index 71e20b9..90dc8a9 100644 --- a/Controller/ListmembersController.php +++ b/Controller/ListmembersController.php @@ -12,8 +12,15 @@ public function index(){ $this->loadModel('ListMembers.Perm'); $permGetMailEtat = $this->Perm->getListMembersByPerm('mail_perm', 'etat'); $users = $this->Users->find('all', ['order' => 'id ASC']); - $this->set(compact("users")); - $this->set(compact("permGetMailEtat")); + + //RÉCUPÉRATION DES RANKS CUSTOMS + $this->loadModel('Rank'); + $custom_ranks = $this->Rank->find('all'); + foreach ($custom_ranks as $key => $value) { + $available_ranks[$value['Rank']['rank_id']] = $value['Rank']['name']; + } + + $this->set(compact("users", "permGetMailEtat", "available_ranks")); } public function profil(){ @@ -26,9 +33,23 @@ public function profil(){ //ISOLEMENT DES INFORMATIONS DE L'UTILISATEUR PORTANT L'ID USER SORTIS EN PARAMETRE + REQUETE SQL $conditions = array("User.id" => array($id)); $userFound = $this->User->find('first', array('conditions' => $conditions)); + + //RÉCUPÉRATION DU NOMBRE DE VOTES DU MEMBRE + if ($this->EyPlugin->isInstalled('eywek.vote')) { + $this->loadModel("Vote.Vote"); + $voteCount = count($this->Vote->find('all', ['conditions' => ['user_id' => $userFound["User"]["id"]]])); + } + + //RÉCUPÉRATION DES RANKS CUSTOMS + $this->loadModel('Rank'); + $custom_ranks = $this->Rank->find('all'); + foreach ($custom_ranks as $key => $value) { + $available_ranks[$value['Rank']['rank_id']] = $value['Rank']['name']; + } + //SORTIE DE LA VARIABLE POUR LE VIEW - $this->set(compact("userFound")); + $this->set(compact("userFound", "voteCount", "available_ranks")); //CREATION DE LA VARIABLE TITLE POUR LE TITRE DE L'ONGLET $this->set('title_for_layout', $this->Lang->get('LISTMEMBERS__PROFILE').' '.$userFound['User']['pseudo']); diff --git a/View/Listmembers/index.ctp b/View/Listmembers/index.ctp index 2a50e74..fa19699 100644 --- a/View/Listmembers/index.ctp +++ b/View/Listmembers/index.ctp @@ -42,7 +42,11 @@ }elseif($v['rank'] == 5){ echo $Lang->get('LISTMEMBERS__RANK_BANNED'); }else{ - echo $Lang->get('LISTMEMBERS__ERREUR'); + foreach ($available_ranks as $key => $value) { + if ($v['rank'] == $key) { + echo $value; + } + } } ?> diff --git a/View/Listmembers/profil.ctp b/View/Listmembers/profil.ctp index 6ce2eaf..2633db3 100644 --- a/View/Listmembers/profil.ctp +++ b/View/Listmembers/profil.ctp @@ -36,7 +36,11 @@ }elseif($userFound['User']['rank'] == 5){ echo $Lang->get('LISTMEMBERS__RANK_BANNED'); }else{ - echo $Lang->get('LISTMEMBERS__ERREUR'); + foreach ($available_ranks as $key => $value) { + if ($userFound['User']['rank'] == $key) { + echo $value; + } + } } ?> @@ -45,10 +49,12 @@ get('LISTMEMBERS__CREATE_DATE'); ?> date($userFound['User']['created']); ?> - - get('LISTMEMBERS__VOTE'); ?> - get('LISTMEMBERS__FS'); ?> - + isInstalled('eywek.vote')) { ?> + + get('LISTMEMBERS__VOTE'); ?> + get('LISTMEMBERS__FS'); ?> + + @@ -87,4 +93,4 @@ top: 10px; font-size: 20px; } - \ No newline at end of file +