/settings/get_general is working

This commit is contained in:
Pierre 2018-04-16 18:18:05 +02:00
parent 5ab89ec6d8
commit f2a5477f12

View File

@ -23,8 +23,35 @@ class SettingsController {
if(!$user_settings->isValid())
Rest_fatal_error(500, "Could not get user settings !");
print_r($user_settings);
//Parse and return settings entry
return $this->GeneralSettingsToAPI($user_settings);
}
/**
* Turn a GeneralSettings object into a valid API object
*
* @param GeneralSettings $settings The object to convert
* @return array Generated API object
*/
private function GeneralSettingsToAPI(GeneralSettings $settings) : array {
$data = array();
$data["id"] = $settings->get_id();
$data["email"] = $settings->get_email();
$data["firstName"] = $settings->get_firstName();
$data["lastName"] = $settings->get_lastName();
$data["is_public"] = $settings->is_publicPage();
$data["is_open"] = $settings->is_openPage();
$data["allow_comments"] = $settings->is_allowComments();
$data["allow_posts_from_friends"] = $settings->is_allowPostsFriends();
$data["allow_comunic_mails"] = $settings->is_allowComunicMails();
$data["public_friends_list"] = $settings->is_friendsListPublic();
$data["virtual_directory"] = $settings->get_virtualDirectory();
$data["personnal_website"] = $settings->get_personnalWebsite();
return $data;
}
}