From 722803f55e882a7893914183be733e750e747ab2 Mon Sep 17 00:00:00 2001 From: Angel Fernando Quiroz Campos Date: Wed, 27 May 2015 10:45:33 -0500 Subject: [PATCH] Add gamification_mode setting - refs BT#9886 #TMI --- main/install/data.sql | 7 ++- .../Schema/V110/Version20150527101600.php | 56 +++++++++++++++++++ 2 files changed, 61 insertions(+), 2 deletions(-) create mode 100644 src/Chamilo/CoreBundle/Migrations/Schema/V110/Version20150527101600.php diff --git a/main/install/data.sql b/main/install/data.sql index 07064cc7d52..7763a9a1ffb 100644 --- a/main/install/data.sql +++ b/main/install/data.sql @@ -1705,7 +1705,8 @@ VALUES ('hide_certificate_export_link', NULL, 'radio', 'Gradebook', 'false', 'CertificateHideExportLinkTitle', 'CertificateHideExportLinkComment', NULL, NULL, 1), ('dropbox_hide_course_coach', NULL, 'radio', 'Tools', 'false', 'DropboxHideCourseCoachTitle', 'DropboxHideCourseCoachComment', NULL, NULL, 1), ('sso_force_redirect', NULL, 'radio', 'Security', 'false', 'SSOForceRedirectTitle', 'SSOForceRedirectComment', NULL, NULL, 1), -('session_course_ordering', NULL, 'radio', 'Session', 'false', 'SessionCourseOrderingTitle', 'SessionCourseOrderingComment', NULL, NULL, 1); +('session_course_ordering', NULL, 'radio', 'Session', 'false', 'SessionCourseOrderingTitle', 'SessionCourseOrderingComment', NULL, NULL, 1), +('gamification_mode', NULL, 'radio', 'Platform', 0, 'GamificationModeTitle', 'GamificationModeComment', NULL, NULL, 1); INSERT INTO settings_options (variable, value, display_text) VALUES @@ -1779,6 +1780,8 @@ VALUES ('sso_force_redirect', 'true', 'Yes'), ('sso_force_redirect', 'false', 'No'), ('session_course_ordering', 'true', 'Yes'), -('session_course_ordering', 'false', 'No'); +('session_course_ordering', 'false', 'No'), +('gamification_mode', '0', 'Yes'), +('gamification_mode', '1', 'No'); UPDATE settings_current SET selected_value = '1.10.0.40' WHERE variable = 'chamilo_database_version'; diff --git a/src/Chamilo/CoreBundle/Migrations/Schema/V110/Version20150527101600.php b/src/Chamilo/CoreBundle/Migrations/Schema/V110/Version20150527101600.php new file mode 100644 index 00000000000..393f070196c --- /dev/null +++ b/src/Chamilo/CoreBundle/Migrations/Schema/V110/Version20150527101600.php @@ -0,0 +1,56 @@ + autolaunch + * @package Chamilo\CoreBundle\Migrations\Schema\V110 + */ +class Version20150527101600 extends AbstractMigrationChamilo +{ + /** + * @param Schema $schema + */ + public function up(Schema $schema) + { + $value = api_get_configuration_value('gamification_mode'); + $this->addSettingCurrent( + 'gamification_mode', + '', + 'radio', + 'Platform', + $value == 0 ? 0: 1, + 'GamificationModeTitle', + 'GamificationModeComment', + null, + '', + 1, + true, + false, + [ + [ + 'value' => 1, + 'text' => 'Yes' + ], + [ + 'value' => 0, + 'text' => 'No' + ] + ] + ); + } + + /** + * @param Schema $schema + */ + public function down(Schema $schema) + { + $this->addSql("DELETE FROM settings_options WHERE variable = 'gamification_mode'"); + $this->addSql("DELETE FROM settings_current WHERE variable = 'gamification_mode'"); + } + +}