Minor - Update settings options, use class ChoiceType instead of string

pull/2487/head
jmontoyaa 7 years ago
parent d3c2beeca4
commit 79cc408310
  1. 9
      src/CoreBundle/Settings/AgendaSettingsSchema.php
  2. 44
      src/CoreBundle/Settings/CourseSettingsSchema.php
  3. 20
      src/CoreBundle/Settings/DisplaySettingsSchema.php
  4. 24
      src/CoreBundle/Settings/DocumentSettingsSchema.php
  5. 10
      src/CoreBundle/Settings/ForumSettingsSchema.php
  6. 12
      src/CoreBundle/Settings/GlossarySettingsSchema.php
  7. 14
      src/CoreBundle/Settings/GradebookSettingsSchema.php
  8. 26
      src/CoreBundle/Settings/PlatformSettingsSchema.php
  9. 8
      src/CoreBundle/Settings/RegistrationSettingsSchema.php
  10. 8
      src/CoreBundle/Settings/SearchSettingsSchema.php
  11. 8
      src/CoreBundle/Settings/SurveySettingsSchema.php
  12. 1
      src/CourseBundle/Controller/SettingsController.php

@ -4,9 +4,9 @@
namespace Chamilo\CoreBundle\Settings;
use Chamilo\CoreBundle\Form\Type\YesNoType;
use Sylius\Bundle\SettingsBundle\Schema\SchemaInterface;
use Sylius\Bundle\SettingsBundle\Schema\SettingsBuilderInterface;
use Symfony\Component\Form\FormBuilderInterface;
use Symfony\Component\Form\Extension\Core\Type\ChoiceType;
/**
* Class AgendaSettingsSchema
@ -52,15 +52,14 @@ class AgendaSettingsSchema extends AbstractSettingsSchema
//->add('number_of_upcoming_events')
->add(
'default_calendar_view',
'choice',
ChoiceType::class,
[
'choices' => [
'month' => 'Month',
'week' => 'Week'
'Month' => 'month',
'Week' => 'week'
]
]
)
;
}
}

@ -4,6 +4,7 @@
namespace Chamilo\CoreBundle\Settings;
use Chamilo\CoreBundle\Form\Type\YesNoType;
use Symfony\Component\Form\Extension\Core\Type\ChoiceType;
use Chamilo\CoreBundle\Entity\Course;
use Chamilo\CoreBundle\Entity\Manager\CourseManager;
use Chamilo\CoreBundle\Entity\Repository\CourseRepository;
@ -146,18 +147,21 @@ class CourseSettingsSchema extends AbstractSettingsSchema
$builder
->add(
'homepage_view',
'choice',
ChoiceType::class,
[
'choices' => [
'activity' => 'activity',
'activity_big' => 'activity_big',
'HomepageView2column' => '2column',
'HomepageView3column' => '3column',
'HomepageViewVerticalActivity' => 'vertical_activity',
'HomepageViewActivity' => 'activity',
'HomepageViewActivityBig' => 'activity_big',
],
]
)
->add('show_tool_shortcuts', YesNoType::class)
->add(
'active_tools_on_create',
'choice',
ChoiceType::class,
[
'choices' => $tools,
'multiple' => true,
@ -170,26 +174,26 @@ class CourseSettingsSchema extends AbstractSettingsSchema
->add('go_to_course_after_login', YesNoType::class)
->add(
'show_navigation_menu',
'choice',
ChoiceType::class,
[
'choices' => [
'false' => 'No',
'icons' => 'IconsOnly',
'text' => 'TextOnly',
'iconstext' => 'IconsText',
'No' => 'false',
'IconsOnly' => 'icons',
'TextOnly' => 'text',
'IconsText' => 'iconstext'
],
]
)
->add('enable_tool_introduction', YesNoType::class)
->add(
'breadcrumbs_course_homepage',
'choice',
ChoiceType::class,
[
'choices' => [
'course_home' => 'CourseHomepage',
'course_code' => 'CourseCode',
'course_title' => 'CourseTitle',
'session_name_and_course_title' => 'SessionNameAndCourseTitle',
'CourseHomepage' => 'course_home',
'CourseCode' => 'course_code',
'CourseTitle' => 'course_title',
'SessionNameAndCourseTitle' => 'session_name_and_course_title',
],
]
)
@ -203,7 +207,7 @@ class CourseSettingsSchema extends AbstractSettingsSchema
->add('course_validation_terms_and_conditions_url', 'url')
->add(
'course_hide_tools',
'choice',
ChoiceType::class,
[
'choices' => $tools,
'multiple' => true,
@ -213,13 +217,13 @@ class CourseSettingsSchema extends AbstractSettingsSchema
->add('scorm_cumulative_session_time', YesNoType::class)
->add(
'courses_default_creation_visibility',
'choice',
ChoiceType::class,
[
'choices' => [
'3' => 'Public',
'2' => 'Open',
'1' => 'Private',
'0' => 'Closed',
'Public' => '3',
'Open' => '2',
'Private' => '1',
'Closed' => '0'
],
]
)

@ -4,7 +4,7 @@
namespace Chamilo\CoreBundle\Settings;
use Chamilo\CoreBundle\Form\Type\YesNoType;
use Sylius\Bundle\SettingsBundle\Schema\SchemaInterface;
use Symfony\Component\Form\Extension\Core\Type\ChoiceType;
use Sylius\Bundle\SettingsBundle\Schema\SettingsBuilderInterface;
use Symfony\Component\Form\FormBuilderInterface;
@ -72,12 +72,12 @@ class DisplaySettingsSchema extends AbstractSettingsSchema
->add('show_teacher_data', YesNoType::class)
->add(
'showonline',
'choice',
ChoiceType::class,
[
'choices' => [
'course' => 'Course',
'users' => 'Users',
'world' => 'World',
'Course' => 'course',
'Users' => 'users',
'World' => 'world',
],
]
)
@ -96,13 +96,13 @@ class DisplaySettingsSchema extends AbstractSettingsSchema
->add('accessibility_font_resize', YesNoType::class)
->add(
'show_admin_toolbar',
'choice',
ChoiceType::class,
[
'choices' => [
'do_not_show' => 'DoNotShow',
'show_to_admin' => 'ShowToAdminsOnly',
'show_to_admin_and_teachers' => 'ShowToAdminsAndTeachers',
'show_to_all' => 'ShowToAllUsers'
'DoNotShow' => 'do_not_show',
'ShowToAdminsOnly' => 'show_to_admin',
'ShowToAdminsAndTeachers' => 'show_to_admin_and_teachers',
'ShowToAllUsers' => 'show_to_all'
]
]
)

@ -4,8 +4,8 @@
namespace Chamilo\CoreBundle\Settings;
use Chamilo\CoreBundle\Form\Type\YesNoType;
use Symfony\Component\Form\Extension\Core\Type\ChoiceType;
use Chamilo\SettingsBundle\Transformer\ArrayToIdentifierTransformer;
use Sylius\Bundle\SettingsBundle\Schema\SchemaInterface;
use Sylius\Bundle\SettingsBundle\Schema\SettingsBuilderInterface;
use Symfony\Component\Form\FormBuilderInterface;
@ -86,11 +86,11 @@ class DocumentSettingsSchema extends AbstractSettingsSchema
->add('permanently_remove_deleted_files', YesNoType::class)
->add(
'upload_extensions_list_type',
'choice',
ChoiceType::class,
[
'choices' => [
'blacklist' => 'Blacklist',
'whitelist' => 'Whitelist',
'Blacklist' => 'blacklist',
'Whitelist' => 'whitelist',
],
]
)
@ -102,12 +102,12 @@ class DocumentSettingsSchema extends AbstractSettingsSchema
->add('permissions_for_new_files')
->add(
'show_glossary_in_documents',
'choice',
ChoiceType::class,
[
'choices' => [
'none' => 'ShowGlossaryInDocumentsIsNone',
'ismanual' => 'ShowGlossaryInDocumentsIsManual',
'isautomatic' => 'ShowGlossaryInDocumentsIsAutomatic',
'ShowGlossaryInDocumentsIsNone' => 'none',
'ShowGlossaryInDocumentsIsManual' => 'ismanual',
'ShowGlossaryInDocumentsIsAutomatic' => 'isautomatic',
]
]
)
@ -126,7 +126,7 @@ class DocumentSettingsSchema extends AbstractSettingsSchema
->add('enable_webcam_clip', YesNoType::class)
->add(
'tool_visible_by_default_at_creation',
'choice',
ChoiceType::class,
[
'multiple' => true,
'choices' => [
@ -142,11 +142,11 @@ class DocumentSettingsSchema extends AbstractSettingsSchema
)
->add(
'if_file_exists_option',
'choice',
ChoiceType::class,
[
'choices' => [
'rename' => 'Rename',
'overwrite' => 'Overwrite',
'Rename' => 'rename',
'Overwrite' => 'overwrite',
]
]
)

@ -4,7 +4,7 @@
namespace Chamilo\CoreBundle\Settings;
use Chamilo\CoreBundle\Form\Type\YesNoType;
use Sylius\Bundle\SettingsBundle\Schema\SchemaInterface;
use Symfony\Component\Form\Extension\Core\Type\ChoiceType;
use Sylius\Bundle\SettingsBundle\Schema\SettingsBuilderInterface;
use Symfony\Component\Form\FormBuilderInterface;
@ -42,12 +42,12 @@ class ForumSettingsSchema extends AbstractSettingsSchema
$builder
->add(
'default_forum_view',
'choice',
ChoiceType::class,
[
'choices' => [
'flat' => 'Flat',
'threaded' => 'Threaded',
'nested' => 'Nested',
'Flat' => 'flat',
'Threaded' => 'threaded',
'Nested' => 'nested',
],
]
)

@ -4,7 +4,7 @@
namespace Chamilo\CoreBundle\Settings;
use Chamilo\CoreBundle\Form\Type\YesNoType;
use Sylius\Bundle\SettingsBundle\Schema\SchemaInterface;
use Symfony\Component\Form\Extension\Core\Type\ChoiceType;
use Sylius\Bundle\SettingsBundle\Schema\SettingsBuilderInterface;
use Symfony\Component\Form\FormBuilderInterface;
@ -40,13 +40,13 @@ class GlossarySettingsSchema extends AbstractSettingsSchema
$builder
->add(
'show_glossary_in_extra_tools',
'choice',
ChoiceType::class,
[
'choices' => [
'none' => 'None',
'exercise' => 'Exercise',
'lp' => 'LearningPath',
'exercise_and_lp' => 'ExerciseAndLearningPath'
'None' => 'none',
'Exercise' => 'exercise',
'LearningPath' => 'lp',
'ExerciseAndLearningPath' => 'exercise_and_lp'
]
]
)

@ -4,9 +4,9 @@
namespace Chamilo\CoreBundle\Settings;
use Chamilo\CoreBundle\Form\Type\YesNoType;
use Sylius\Bundle\SettingsBundle\Schema\SchemaInterface;
use Sylius\Bundle\SettingsBundle\Schema\SettingsBuilderInterface;
use Symfony\Component\Form\FormBuilderInterface;
use Symfony\Component\Form\Extension\Core\Type\ChoiceType;
/**
* Class GradebookSettingsSchema
@ -76,11 +76,13 @@ class GradebookSettingsSchema extends AbstractSettingsSchema
->add('my_display_coloring')
->add(
'student_publication_to_take_in_gradebook',
'choice',
['choices' => [
'first' => 'First',
'last' => 'Last'
]]
ChoiceType::class,
[
'choices' => [
'First' => 'first',
'Last' => 'last',
],
]
)
->add('gradebook_detailed_admin_view')
->add('openbadges_backpack')

@ -5,7 +5,7 @@ namespace Chamilo\CoreBundle\Settings;
use Chamilo\CoreBundle\Form\Type\YesNoType;
use Chamilo\SettingsBundle\Transformer\ArrayToIdentifierTransformer;
use Sylius\Bundle\SettingsBundle\Schema\SchemaInterface;
use Symfony\Component\Form\Extension\Core\Type\ChoiceType;
use Sylius\Bundle\SettingsBundle\Schema\SettingsBuilderInterface;
use Symfony\Component\Form\FormBuilderInterface;
@ -44,13 +44,13 @@ class PlatformSettingsSchema extends AbstractSettingsSchema
'use_custom_pages' => 'false',
'pdf_logo_header' => '',
'allow_my_files' => 'true',
'chamilo_database_version' => '2.0.0',
'registered' => 'false',
'load_term_conditions_section' => 'login',
'server_type' => 'false',
'show_full_skill_name_on_skill_wheel' => 'false',
'show_official_code_whoisonline' => 'false',
'show_tabs' => []
'show_tabs' => [],
'chamilo_database_version' => '2.0.0'
//
//('catalog_show_courses_sessions', '0', 'CatalogueShowOnlyCourses'),
//('catalog_show_courses_sessions', '1', 'CatalogueShowOnlySessions'),
@ -111,10 +111,10 @@ class PlatformSettingsSchema extends AbstractSettingsSchema
->add('gravatar_enabled', YesNoType::class)
->add(
'gravatar_type',
'choice',
ChoiceType::class,
[
'choices' => [
'mm' => 'mistery-man',
'mistery-man' => 'mm',
'identicon' => 'identicon',
'monsterid' => 'monsterid',
'wavatar' => 'wavatar',
@ -128,11 +128,11 @@ class PlatformSettingsSchema extends AbstractSettingsSchema
->add('course_catalog_hide_private', YesNoType::class)
->add(
'catalog_show_courses_sessions',
'choice',
ChoiceType::class,
['choices' => [
'0' => 'CatalogueShowOnlyCourses',
'1' => 'CatalogueShowOnlySessions',
'2' => 'CatalogueShowCoursesAndSessions',
'CatalogueShowOnlyCourses' => '0',
'CatalogueShowOnlySessions' => '1',
'CatalogueShowCoursesAndSessions' => '2',
]]
)
->add('use_custom_pages', YesNoType::class)
@ -143,11 +143,11 @@ class PlatformSettingsSchema extends AbstractSettingsSchema
->add('registered', YesNoType::class)
->add(
'load_term_conditions_section',
'choice',
ChoiceType::class,
[
'choices' => [
'0' => 'Login',
'1' => 'Course',
'Login' => '0',
'Course' => '1',
],
]
)
@ -156,7 +156,7 @@ class PlatformSettingsSchema extends AbstractSettingsSchema
->add('show_official_code_whoisonline', YesNoType::class)
->add(
'show_tabs',
'choice',
ChoiceType::class,
[
'multiple' => true,
'choices' => $tabs,

@ -85,10 +85,10 @@ class RegistrationSettingsSchema extends AbstractSettingsSchema
[
'multiple' => true,
'choices' => [
'officialcode' => 'officialcode',
'email' => 'email',
'language' => 'language',
'phone' => 'phone',
'Official code' => 'officialcode',
'E-mail' => 'email',
'Language' => 'language',
'Phone' => 'phone',
],
]
)

@ -4,7 +4,7 @@
namespace Chamilo\CoreBundle\Settings;
use Chamilo\CoreBundle\Form\Type\YesNoType;
use Sylius\Bundle\SettingsBundle\Schema\SchemaInterface;
use Symfony\Component\Form\Extension\Core\Type\ChoiceType;
use Sylius\Bundle\SettingsBundle\Schema\SettingsBuilderInterface;
use Symfony\Component\Form\FormBuilderInterface;
@ -45,11 +45,11 @@ class SearchSettingsSchema extends AbstractSettingsSchema
->add('search_prefilter_prefix', YesNoType::class)
->add(
'search_show_unlinked_results',
'choice',
ChoiceType::class,
[
'choices' => [
'true' => 'SearchShowUnlinkedResults',
'false' => 'SearchHideUnlinkedResults',
'SearchShowUnlinkedResults' => 'true',
'SearchHideUnlinkedResults' => 'false',
],
]
)

@ -4,7 +4,7 @@
namespace Chamilo\CoreBundle\Settings;
use Chamilo\CoreBundle\Form\Type\YesNoType;
use Sylius\Bundle\SettingsBundle\Schema\SchemaInterface;
use Symfony\Component\Form\Extension\Core\Type\ChoiceType;
use Sylius\Bundle\SettingsBundle\Schema\SettingsBuilderInterface;
use Symfony\Component\Form\FormBuilderInterface;
@ -42,11 +42,11 @@ class SurveySettingsSchema extends AbstractSettingsSchema
$builder
->add(
'survey_email_sender_noreply',
'choice',
ChoiceType::class,
[
'choices' => [
'coach' => 'CourseCoachEmailSender',
'noreply' => 'NoReplyEmailSender',
'CourseCoachEmailSender' => 'coach',
'NoReplyEmailSender' => 'noreply',
],
]
)

@ -32,6 +32,7 @@ class SettingsController extends Controller
public function updateAction(Request $request, $namespace, $course)
{
$manager = $this->getSettingsManager();
$schemaAlias = $manager->convertNameSpaceToService($namespace);
$settings = $manager->load($namespace);

Loading…
Cancel
Save