mirror of
				https://github.com/pierre42100/ComunicAPI
				synced 2025-11-04 12:14:12 +00:00 
			
		
		
		
	Progress on create a conversation way
This commit is contained in:
		
							
								
								
									
										35
									
								
								RestControllers/conversationsController.php
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										35
									
								
								RestControllers/conversationsController.php
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,35 @@
 | 
			
		||||
<?php
 | 
			
		||||
/**
 | 
			
		||||
 * Conversations controller
 | 
			
		||||
 *
 | 
			
		||||
 * @author Pierre HUBERT
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
class conversationsController{
 | 
			
		||||
 | 
			
		||||
	/**
 | 
			
		||||
	 * Create a new conversation
 | 
			
		||||
	 *
 | 
			
		||||
	 * @url POST /conversations/create
 | 
			
		||||
	 */
 | 
			
		||||
	public function createConversation(){
 | 
			
		||||
		user_login_required();
 | 
			
		||||
 | 
			
		||||
		//Check for parametres
 | 
			
		||||
		if(!check_post_parametres(array("name", "follow", "users")))
 | 
			
		||||
			Rest_fatal_error(501, "Please check parametres passed with the request !");
 | 
			
		||||
		
 | 
			
		||||
		//Extract parametres
 | 
			
		||||
		$conversationName = ($_POST["name"] == "false" ? false : $_POST['name']);
 | 
			
		||||
		$followConversation = ($_POST['follow'] == "true" ? true : false);
 | 
			
		||||
		$users = users_list_to_array($_POST['users']);
 | 
			
		||||
 | 
			
		||||
		//Check users
 | 
			
		||||
		if(count($users) < 1)
 | 
			
		||||
			Rest_fatal_erro(501, "Please select at least one user !");
 | 
			
		||||
		
 | 
			
		||||
		//Perform the request
 | 
			
		||||
		
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
}
 | 
			
		||||
		Reference in New Issue
	
	Block a user