diff --git a/app/Migrations/Schema/V111/Version20160302133200.php b/app/Migrations/Schema/V111/Version20160302133200.php new file mode 100644 index 0000000000..d8ae222134 --- /dev/null +++ b/app/Migrations/Schema/V111/Version20160302133200.php @@ -0,0 +1,82 @@ +getConfigurationValue('messaging_allow_send_push_notification'); + + $this->addSettingCurrent( + 'messaging_allow_send_push_notification', + null, + 'radio', + 'Platform', + ($allowSendPushNotification ? 'true' : 'false'), + 'MessagingAllowSendPushNotificationTitle', + 'MessagingAllowSendPushNotificationComment', + null, + '', + 1, + true, + false, + [ + ['value' => 'true', 'text' => 'Yes'], + ['value' => 'false', 'text' => 'No'], + ] + ); + + $gdcProjectNumber = $this->getConfigurationValue('messaging_gdc_project_number'); + $this->addSettingCurrent( + 'messaging_gdc_project_number', + null, + 'textfield', + 'Platform', + !empty($gdcProjectNumber) ? $gdcProjectNumber : '', + 'MessagingGDCProjectNumberTitle', + 'MessagingGDCProjectNumberComment', + null, + '', + 1, + true, + false + ); + + $gdcApiKey = $this->getConfigurationValue('messaging_gdc_api_key'); + $this->addSettingCurrent( + 'messaging_gdc_api_key', + null, + 'textfield', + 'Platform', + !empty($gdcApiKey) ? $gdcApiKey : '', + 'MessagingGDCApiKeyTitle', + 'MessagingGDCApiKeyComment', + null, + '', + 1, + true, + false + ); + } + + /** + * @param Schema $schema + */ + public function down(Schema $schema) + { + + } +} diff --git a/main/inc/lib/webservices/MessagesWebService.class.php b/main/inc/lib/webservices/MessagesWebService.class.php index 26b7ea8365..60fa934656 100644 --- a/main/inc/lib/webservices/MessagesWebService.class.php +++ b/main/inc/lib/webservices/MessagesWebService.class.php @@ -170,11 +170,11 @@ class MessagesWebService extends WebService */ public static function sendPushNotification(array $userIds, $title, $content) { - if (api_get_configuration_value('messaging_allow_send_push_notification') !== 'true') { + if (api_get_setting('messaging_allow_send_push_notification') !== 'true') { return false; } - $gdcApiKey = api_get_configuration_value('messaging_gdc_api_key'); + $gdcApiKey = api_get_setting('messaging_gdc_api_key'); if ($gdcApiKey === false) { return false; diff --git a/main/install/configuration.dist.php b/main/install/configuration.dist.php index 4bf6bd3384..8dac1b4a2a 100755 --- a/main/install/configuration.dist.php +++ b/main/install/configuration.dist.php @@ -232,9 +232,3 @@ $_configuration['system_stable'] = NEW_VERSION_STABLE; //$_configuration['session_hide_tab_list'] = array(); // Show invisible exercise in LP list //$_configuration['show_invisible_exercise_in_lp_list'] = false; -//Allow send a push notification when an email are sent -//$_configuration['messaging_allow_send_push_notification'] = 'true'; -//Project number in the Google Developer Console -//$_configuration['messaging_gdc_project_number'] = ''; -//Api Key in the Google Developer Console -//$_configuration['messaging_gdc_api_key'] = ''; diff --git a/main/install/data.sql b/main/install/data.sql index b4972c4574..dc44aab874 100644 --- a/main/install/data.sql +++ b/main/install/data.sql @@ -1802,4 +1802,17 @@ VALUES ('show_full_skill_name_on_skill_wheel', 'true', 'Yes'), ('show_full_skill_name_on_skill_wheel', 'false', 'No'); -UPDATE settings_current SET selected_value = '1.10.0.51' WHERE variable = 'chamilo_database_version'; +-- Version 1.10.0.52 + +INSERT INTO settings_current (variable, subkey, type, category, selected_value, title, comment, scope, subkeytext, access_url_changeable) +VALUES +('messaging_allow_send_push_notification', NULL, 'radio', 'Platform', 'false', 'MessagingAllowSendPushNotificationText', 'MessagingAllowSendPushNotificationComment', NULL, NULL, 0), +('messaging_gdc_project_number', NULL, 'textfield', 'Platform', '', 'MessagingGDCProjectNumberTitle', 'MessagingGDCProjectNumberComment', NULL, NULL, 0), +('messaging_gdc_api_key', NULL, 'textfield', 'Platform', '', 'MessagingGDCApiKeyTitle', 'MessagingGDCApiKeyComment', NULL, NULL, 0); + +INSERT INTO settings_options (variable, value, display_text) +VALUES +('messaging_allow_send_push_notification', 'true', 'Yes'), +('messaging_allow_send_push_notification', 'false', 'No'), + +UPDATE settings_current SET selected_value = '1.10.0.52' WHERE variable = 'chamilo_database_version'; diff --git a/main/webservices/rest.php b/main/webservices/rest.php index e8123e0bed..8b40465c02 100644 --- a/main/webservices/rest.php +++ b/main/webservices/rest.php @@ -30,7 +30,7 @@ switch ($action) { $json = array( 'status' => true, 'apiKey' => $apiKey, - 'gcmSenderId' => api_get_configuration_value('messaging_gdc_project_number'), + 'gcmSenderId' => api_get_setting('messaging_gdc_project_number'), ); } else { $json = array(