Moved conversations classes

This commit is contained in:
Pierre 2018-04-23 19:12:49 +02:00
parent f84a8df0d8
commit f39d162277
2 changed files with 23 additions and 3 deletions

View File

@ -5,7 +5,7 @@
* @author Pierre HUBERT
*/
class conversationsController{
class ConversationsController{
/**
* Get the conversations list
@ -460,4 +460,24 @@ class conversationsController{
return $data;
}
/**
* Turn ConversationMessage object into API entry
*
* @param ConversationMessage $message The message to convert
* @return array Valid dataset for the api
*/
private static function ConvMessageToAPI(ConversationMessage $message) : array {
$data = array();
$data["ID"] = $message->get_id();
$data["ID_user"] = $message->get_userID();
$data["time_insert"] = $message->get_time_sent();
$data["message"] = $message->has_message() ? $message->get_message() : "";
$data["image_path"] = $message->has_image_path() ? $message->get_image_path() : null;
return $data;
}
}

View File

@ -5,7 +5,7 @@
* @author Pierre HUBERT
*/
class conversations {
class Conversations {
/**
* @var String $conversationsListTable Name of the conversation list table
@ -874,4 +874,4 @@ class conversations {
}
//Register component
Components::register("conversations", new conversations());
Components::register("conversations", new Conversations());