| 
														
															@@ -15,20 +15,22 @@ class Mattermost 
														 | 
													
												
											
												
													
														| 
														 | 
														
															     protected $url; 
														 | 
														
														 | 
														
															     protected $url; 
														 | 
													
												
											
												
													
														| 
														 | 
														
															     protected $token; 
														 | 
														
														 | 
														
															     protected $token; 
														 | 
													
												
											
												
													
														| 
														 | 
														
															     protected $channelId; 
														 | 
														
														 | 
														
															     protected $channelId; 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+    protected $channelIdAdmin; 
														 | 
													
												
											
												
													
														| 
														 | 
														
															     protected $router; 
														 | 
														
														 | 
														
															     protected $router; 
														 | 
													
												
											
												
													
														| 
														 | 
														
															  
														 | 
														
														 | 
														
															  
														 | 
													
												
											
												
													
														| 
														 | 
														
															     /** 
														 | 
														
														 | 
														
															     /** 
														 | 
													
												
											
												
													
														| 
														 | 
														
															      * Mattermost Manager 
														 | 
														
														 | 
														
															      * Mattermost Manager 
														 | 
													
												
											
												
													
														| 
														 | 
														
															      */ 
														 | 
														
														 | 
														
															      */ 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-    public function __construct($url, $token, $channelId, UrlGeneratorInterface $router) 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+    public function __construct($url, $token, $channelId, $channelIdAdmin, UrlGeneratorInterface $router) 
														 | 
													
												
											
												
													
														| 
														 | 
														
															     { 
														 | 
														
														 | 
														
															     { 
														 | 
													
												
											
												
													
														| 
														 | 
														
															         $this->url = $url . "/api/v4/posts"; 
														 | 
														
														 | 
														
															         $this->url = $url . "/api/v4/posts"; 
														 | 
													
												
											
												
													
														| 
														 | 
														
															         $this->token = $token; 
														 | 
														
														 | 
														
															         $this->token = $token; 
														 | 
													
												
											
												
													
														| 
														 | 
														
															         $this->channelId = $channelId; 
														 | 
														
														 | 
														
															         $this->channelId = $channelId; 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+        $this->channelIdAdmin = $channelIdAdmin; 
														 | 
													
												
											
												
													
														| 
														 | 
														
															         $this->router = $router; 
														 | 
														
														 | 
														
															         $this->router = $router; 
														 | 
													
												
											
												
													
														| 
														 | 
														
															     } 
														 | 
														
														 | 
														
															     } 
														 | 
													
												
											
												
													
														| 
														 | 
														
															  
														 | 
														
														 | 
														
															  
														 | 
													
												
											
												
													
														| 
														 | 
														
															-    protected function SendNotif($message) 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+    protected function SendNotif($message, $isChanAdmin = False) :void 
														 | 
													
												
											
												
													
														| 
														 | 
														
															     { 
														 | 
														
														 | 
														
															     { 
														 | 
													
												
											
												
													
														| 
														 | 
														
															         // crée une nouvelle ressource cURL 
														 | 
														
														 | 
														
															         // crée une nouvelle ressource cURL 
														 | 
													
												
											
												
													
														| 
														 | 
														
															         $ch = curl_init(); 
														 | 
														
														 | 
														
															         $ch = curl_init(); 
														 | 
													
												
											
										
											
												
													
														 | 
														
															@@ -37,7 +39,7 @@ class Mattermost 
														 | 
													
												
											
												
													
														| 
														 | 
														
															         $options = array( 
														 | 
														
														 | 
														
															         $options = array( 
														 | 
													
												
											
												
													
														| 
														 | 
														
															             CURLOPT_URL => $this->url, 
														 | 
														
														 | 
														
															             CURLOPT_URL => $this->url, 
														 | 
													
												
											
												
													
														| 
														 | 
														
															             CURLOPT_HTTPHEADER => array('Content-Type: application/json', 'Authorization: Bearer ' . $this->token), 
														 | 
														
														 | 
														
															             CURLOPT_HTTPHEADER => array('Content-Type: application/json', 'Authorization: Bearer ' . $this->token), 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-            CURLOPT_POSTFIELDS  =>  '{"channel_id": "' . $this->channelId . '", "message": "' . $message . '"}' 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+            CURLOPT_POSTFIELDS  =>  '{"channel_id": "' . ($isChanAdmin ? $this->channelIdAdmin : $this->channelId) . '", "message": "' . $message . '"}' 
														 | 
													
												
											
												
													
														| 
														 | 
														
															         ); 
														 | 
														
														 | 
														
															         ); 
														 | 
													
												
											
												
													
														| 
														 | 
														
															  
														 | 
														
														 | 
														
															  
														 | 
													
												
											
												
													
														| 
														 | 
														
															         curl_setopt_array($ch, $options); 
														 | 
														
														 | 
														
															         curl_setopt_array($ch, $options); 
														 | 
													
												
											
										
											
												
													
														 | 
														
															@@ -49,7 +51,7 @@ class Mattermost 
														 | 
													
												
											
												
													
														| 
														 | 
														
															         curl_close($ch); 
														 | 
														
														 | 
														
															         curl_close($ch); 
														 | 
													
												
											
												
													
														| 
														 | 
														
															     } 
														 | 
														
														 | 
														
															     } 
														 | 
													
												
											
												
													
														| 
														 | 
														
															  
														 | 
														
														 | 
														
															  
														 | 
													
												
											
												
													
														| 
														 | 
														
															-    public function sendNouveauFilm(Film $film) 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+    public function sendNouveauFilm(Film $film) :void 
														 | 
													
												
											
												
													
														| 
														 | 
														
															     { 
														 | 
														
														 | 
														
															     { 
														 | 
													
												
											
												
													
														| 
														 | 
														
															         $message = 
														 | 
														
														 | 
														
															         $message = 
														 | 
													
												
											
												
													
														| 
														 | 
														
															             ":new: **" 
														 | 
														
														 | 
														
															             ":new: **" 
														 | 
													
												
											
										
											
												
													
														 | 
														
															@@ -57,11 +59,13 @@ class Mattermost 
														 | 
													
												
											
												
													
														| 
														 | 
														
															             ."** vient d'ajouter **" 
														 | 
														
														 | 
														
															             ."** vient d'ajouter **" 
														 | 
													
												
											
												
													
														| 
														 | 
														
															             ."[".$film->getTitre()."](" 
														 | 
														
														 | 
														
															             ."[".$film->getTitre()."](" 
														 | 
													
												
											
												
													
														| 
														 | 
														
															             .$this->router->generate('videotheque_voirfilm', ['id' => $film->getId()], UrlGeneratorInterface::ABSOLUTE_URL) 
														 | 
														
														 | 
														
															             .$this->router->generate('videotheque_voirfilm', ['id' => $film->getId()], UrlGeneratorInterface::ABSOLUTE_URL) 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-            .")** dans la [vidéothèque](https://videotheque.fdlibre.eu)."; 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+            .")** dans la [vidéothèque](" 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+            .$this->router->generate('videotheque_liste', [], UrlGeneratorInterface::ABSOLUTE_URL) 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+            .")."; 
														 | 
													
												
											
												
													
														| 
														 | 
														
															         $this->SendNotif($message); 
														 | 
														
														 | 
														
															         $this->SendNotif($message); 
														 | 
													
												
											
												
													
														| 
														 | 
														
															     } 
														 | 
														
														 | 
														
															     } 
														 | 
													
												
											
												
													
														| 
														 | 
														
															  
														 | 
														
														 | 
														
															  
														 | 
													
												
											
												
													
														| 
														 | 
														
															-    public function sendNouveauCommentaire(User $user, Film $film) 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+    public function sendNouveauCommentaire(User $user, Film $film) :void 
														 | 
													
												
											
												
													
														| 
														 | 
														
															     { 
														 | 
														
														 | 
														
															     { 
														 | 
													
												
											
												
													
														| 
														 | 
														
															         $message = 
														 | 
														
														 | 
														
															         $message = 
														 | 
													
												
											
												
													
														| 
														 | 
														
															             ":new: **" 
														 | 
														
														 | 
														
															             ":new: **" 
														 | 
													
												
											
										
											
												
													
														 | 
														
															@@ -69,10 +73,26 @@ class Mattermost 
														 | 
													
												
											
												
													
														| 
														 | 
														
															             ."** vient d'ajouter un commentaire sur le film **" 
														 | 
														
														 | 
														
															             ."** vient d'ajouter un commentaire sur le film **" 
														 | 
													
												
											
												
													
														| 
														 | 
														
															             ."[".$film->getTitre()."](" 
														 | 
														
														 | 
														
															             ."[".$film->getTitre()."](" 
														 | 
													
												
											
												
													
														| 
														 | 
														
															             .$this->router->generate('videotheque_voirfilm', ['id' => $film->getId()], UrlGeneratorInterface::ABSOLUTE_URL) 
														 | 
														
														 | 
														
															             .$this->router->generate('videotheque_voirfilm', ['id' => $film->getId()], UrlGeneratorInterface::ABSOLUTE_URL) 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-            .")** dans la [vidéothèque](https://videotheque.fdlibre.eu)."; 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+            .")** dans la [vidéothèque](" 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+            .$this->router->generate('videotheque_liste', [], UrlGeneratorInterface::ABSOLUTE_URL) 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+            .")."; 
														 | 
													
												
											
												
													
														| 
														 | 
														
															  
														 | 
														
														 | 
														
															  
														 | 
													
												
											
												
													
														| 
														 | 
														
															         $this->SendNotif($message); 
														 | 
														
														 | 
														
															         $this->SendNotif($message); 
														 | 
													
												
											
												
													
														| 
														 | 
														
															     } 
														 | 
														
														 | 
														
															     } 
														 | 
													
												
											
												
													
														| 
														 | 
														
															  
														 | 
														
														 | 
														
															  
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+    public function sendNewUser($userName) : void 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+    { 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+        $message = 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+        ":warning: Un utilisateur vient de s'enregistrer dans la [vidéothèque](" 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+        .$this->router->generate('videotheque_liste', [], UrlGeneratorInterface::ABSOLUTE_URL) 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+        .")** : " 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+        .$userName 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+        ."**. Accéder à la [liste des utilisateurs](" 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+        .$this->router->generate('admin_index', [],  UrlGeneratorInterface::ABSOLUTE_URL) 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+        .")."; 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+ 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+        $this->sendNotif($message, True); 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+    } 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+ 
														 | 
													
												
											
												
													
														| 
														 | 
														
															  
														 | 
														
														 | 
														
															  
														 | 
													
												
											
												
													
														| 
														 | 
														
															 } 
														 | 
														
														 | 
														
															 } 
														 |