From c2b4226459ddeb6dbc5964ee901880d2d487df0b Mon Sep 17 00:00:00 2001 From: Julio Montoya Date: Tue, 12 Aug 2014 18:49:31 +0200 Subject: [PATCH] Adding yes_no form type, adding settings, updating platform settings when installing. --- app/Resources/views/layout.html.twig | 5 +- app/config/config.yml | 5 + app/config/routing.yml | 16 --- app/config/sonata/sonata_page.yml | 6 +- .../CoreBundle/Form/Type/YesNoType.php | 29 +++++ .../Migrations/Data/ORM/LoadSettingsData.php | 74 ++++++------- .../CoreBundle/Resources/config/routing.yml | 15 +++ .../CoreBundle/Resources/config/services.yml | 5 + .../Resources/views/Form/fields.html.twig | 17 +++ .../views/Settings/default.html.twig | 28 +++++ .../views/Settings/platform.html.twig | 22 ---- .../Settings/AdminSettingsSchema.php | 41 +++++++ .../Settings/AgendaSettingsSchema.php | 16 ++- .../Settings/ChatSettingsSchema.php | 6 +- .../Settings/CourseSettingsSchema.php | 100 ++++++++++++++++-- .../Settings/DisplaySettingsSchema.php | 51 +++++---- .../Settings/DocumentSettingsSchema.php | 56 ++++++++-- .../Settings/DropboxSettingsSchema.php | 7 +- .../Settings/EditorSettingsSchema.php | 26 ++++- .../Settings/ExerciseSettingsSchema.php | 23 ++-- .../Settings/ForumSettingsSchema.php | 12 ++- .../Settings/GlossarySettingsSchema.php | 7 +- .../Settings/GradebookSettingsSchema.php | 22 +++- .../Settings/GroupSettingsSchema.php | 4 +- .../Settings/MailSettingsSchema.php | 3 +- .../Settings/MessageSettingsSchema.php | 9 +- .../Settings/PlatformSettingsSchema.php | 29 +++-- .../Settings/ProfileSettingsSchema.php | 38 +++++-- .../Settings/RegistrationSettingsSchema.php | 48 +++++++-- .../Settings/SearchSettingsSchema.php | 19 +++- .../Settings/SecuritySettingsSchema.php | 19 ++-- .../Settings/SessionSettingsSchema.php | 14 ++- .../Settings/SkillSettingsSchema.php | 8 +- .../Settings/SocialSettingsSchema.php | 8 +- .../Settings/SurveySettingsSchema.php | 16 ++- .../Settings/TrackingSettingsSchema.php | 8 +- .../Form/Type/Setup/PortalType.php | 23 ++-- .../Process/Step/SetupStep.php | 22 ++-- .../Resources/translations/messages.en.yml | 1 + .../views/Process/Step/installation.html.twig | 6 +- .../views/Process/Step/schema.html.twig | 1 - 41 files changed, 635 insertions(+), 230 deletions(-) create mode 100644 src/ChamiloLMS/CoreBundle/Form/Type/YesNoType.php create mode 100644 src/ChamiloLMS/CoreBundle/Resources/views/Form/fields.html.twig create mode 100644 src/ChamiloLMS/CoreBundle/Resources/views/Settings/default.html.twig delete mode 100644 src/ChamiloLMS/CoreBundle/Resources/views/Settings/platform.html.twig create mode 100644 src/ChamiloLMS/CoreBundle/Settings/AdminSettingsSchema.php diff --git a/app/Resources/views/layout.html.twig b/app/Resources/views/layout.html.twig index a587334f56..bcb4b5ea73 100644 --- a/app/Resources/views/layout.html.twig +++ b/app/Resources/views/layout.html.twig @@ -9,14 +9,13 @@ {##} {#{% endjavascripts %}#} - {% block title %} {#{{ parent() }}#} - {{- 'Institution' | get_setting }} - {{ 'siteName' | get_setting -}} + {{ 'site_name' | get_setting -}} {% endblock %} {% block avanzu_logo %} - {{- 'Institution' | get_setting -}} + {{- 'institution' | get_setting -}} {% endblock %} {% block page_title %} diff --git a/app/config/config.yml b/app/config/config.yml index fdf229d607..4ecd176054 100644 --- a/app/config/config.yml +++ b/app/config/config.yml @@ -49,6 +49,9 @@ framework: validation: { enable_annotations: true } templating: engines: ['twig'] + form: + resources: + - 'ChamiloLMSCoreBundle:Form' #assets_version: SomeVersionScheme default_locale: "%locale%" trusted_hosts: ~ @@ -74,6 +77,8 @@ twig: - 'SonataFormatterBundle:Form:formatter.html.twig' - 'SonataMediaBundle:Form:media_widgets.html.twig' - 'SonataCoreBundle:Form:datepicker.html.twig' + - 'ChamiloLMSCoreBundle:Form:fields.html.twig' + exception_controller: 'FOS\RestBundle\Controller\ExceptionController::showAction' paths: diff --git a/app/config/routing.yml b/app/config/routing.yml index b5b7a862ea..32ff0cf597 100644 --- a/app/config/routing.yml +++ b/app/config/routing.yml @@ -28,7 +28,6 @@ fos_comment_api: avanzu_admin_profile: path: /profile - avanzu_admin_all_messages: path: /messages/ avanzu_admin_show_message: @@ -56,21 +55,6 @@ login_check: chamilolms_installer: resource: "@ChamiloLMSInstallerBundle/Resources/config/routing.yml" -chamilolms_corebundle_platform_settings: - pattern: /settings/platform - defaults: - _controller: sylius.controller.settings:updateAction - namespace: platform - template: ChamiloLMSCoreBundle:Settings:platform.html.twig - -chamilolms_corebundle_course_settings: - pattern: /settings/course - defaults: - _controller: sylius.controller.settings:updateAction - namespace: course - template: ChamiloLMSCoreBundle:Settings:platform.html.twig - - # Always at the end core_bundle: resource: "@ChamiloLMSCoreBundle/Resources/config/routing.yml" diff --git a/app/config/sonata/sonata_page.yml b/app/config/sonata/sonata_page.yml index 1361ebcf58..10bab33e15 100644 --- a/app/config/sonata/sonata_page.yml +++ b/app/config/sonata/sonata_page.yml @@ -19,6 +19,7 @@ sonata_page: - ^installer - ^/installer/(.*) - install.php + - settings/(.*) ignore_route_patterns: - (.*)administration(.*) # ignore admin route, ie route containing 'admin' # sonata admin @@ -26,7 +27,8 @@ sonata_page: - login - home - homepage - - (.*)fos_user_(.*) + - _settings + - avanzu_admin_(.*) ignore_routes: - sonata_page_cache_esi @@ -122,7 +124,7 @@ sonata_page: F: footer page_defaults: - homepage: { decorate: false, enabled: true } + homepage: { decorate: true, enabled: true } caches: esi: diff --git a/src/ChamiloLMS/CoreBundle/Form/Type/YesNoType.php b/src/ChamiloLMS/CoreBundle/Form/Type/YesNoType.php new file mode 100644 index 0000000000..94f37ffc07 --- /dev/null +++ b/src/ChamiloLMS/CoreBundle/Form/Type/YesNoType.php @@ -0,0 +1,29 @@ +setDefaults(array( + 'choices' => array( + 'true' => 'Yes', + 'false' => 'No', + ) + )); + } + + public function getParent() + { + return 'choice'; + } + + public function getName() + { + return 'yes_no'; + } +} diff --git a/src/ChamiloLMS/CoreBundle/Migrations/Data/ORM/LoadSettingsData.php b/src/ChamiloLMS/CoreBundle/Migrations/Data/ORM/LoadSettingsData.php index bb25172fd8..811a6651d4 100644 --- a/src/ChamiloLMS/CoreBundle/Migrations/Data/ORM/LoadSettingsData.php +++ b/src/ChamiloLMS/CoreBundle/Migrations/Data/ORM/LoadSettingsData.php @@ -87,6 +87,7 @@ class LoadSettingsData extends AbstractFixture implements { //$this->generateSettingsCode($manager); $this->createSettings($manager); + return; $this->createOptions($manager); } @@ -96,11 +97,11 @@ class LoadSettingsData extends AbstractFixture implements public function createSettings(ObjectManager $manager) { $setting = new SettingsCurrent(); - $setting->setVariable('Institution'); + $setting->setVariable('institution'); $setting->setSubkey(''); $setting->setType('textfield'); $setting->setCategory('Platform'); - $setting->setSelectedValue('{ORGANISATIONNAME}'); + $setting->setSelectedValue('Chamilo'); $setting->setTitle('InstitutionTitle'); $setting->setComment('InstitutionComment'); $setting->setScope('platform'); @@ -108,13 +109,12 @@ class LoadSettingsData extends AbstractFixture implements $setting->setAccessUrlChangeable('1'); $manager->persist($setting); - $setting = new SettingsCurrent(); - $setting->setVariable('InstitutionUrl'); + $setting->setVariable('institution_url'); $setting->setSubkey(''); $setting->setType('textfield'); - $setting->setCategory('Platform'); - $setting->setSelectedValue('{ORGANISATIONURL}'); + $setting->setCategory('platform'); + $setting->setSelectedValue('http://www.chamilo.org'); $setting->setTitle('InstitutionUrlTitle'); $setting->setComment('InstitutionUrlComment'); $setting->setScope(''); @@ -122,13 +122,12 @@ class LoadSettingsData extends AbstractFixture implements $setting->setAccessUrlChangeable('1'); $manager->persist($setting); - $setting = new SettingsCurrent(); - $setting->setVariable('siteName'); + $setting->setVariable('site_name'); $setting->setSubkey(''); $setting->setType('textfield'); - $setting->setCategory('Platform'); - $setting->setSelectedValue('{CAMPUSNAME}'); + $setting->setCategory('platform'); + $setting->setSelectedValue('Campus Chamilo'); $setting->setTitle('SiteNameTitle'); $setting->setComment('SiteNameComment'); $setting->setScope(''); @@ -136,27 +135,12 @@ class LoadSettingsData extends AbstractFixture implements $setting->setAccessUrlChangeable('1'); $manager->persist($setting); - - $setting = new SettingsCurrent(); - $setting->setVariable('noreply_email_address'); - $setting->setSubkey(''); - $setting->setType('textfield'); - $setting->setCategory('Platform'); - $setting->setSelectedValue(''); - $setting->setTitle('NoReplyEmailAddress'); - $setting->setComment('NoReplyEmailAddressComment'); - $setting->setScope(''); - $setting->setSubkeytext(''); - $setting->setAccessUrlChangeable('0'); - $manager->persist($setting); - - $setting = new SettingsCurrent(); - $setting->setVariable('emailAdministrator'); + $setting->setVariable('administrator_email'); $setting->setSubkey(''); $setting->setType('textfield'); - $setting->setCategory('Admin'); - $setting->setSelectedValue('{ADMINEMAIL}'); + $setting->setCategory('admin'); + $setting->setSelectedValue('admin@example.org'); $setting->setTitle('emailAdministratorTitle'); $setting->setComment('emailAdministratorComment'); $setting->setScope(''); @@ -166,11 +150,11 @@ class LoadSettingsData extends AbstractFixture implements $setting = new SettingsCurrent(); - $setting->setVariable('administratorSurname'); + $setting->setVariable('administrator_surname'); $setting->setSubkey(''); $setting->setType('textfield'); - $setting->setCategory('Admin'); - $setting->setSelectedValue('{ADMINLASTNAME}'); + $setting->setCategory('admin'); + $setting->setSelectedValue('Doe'); $setting->setTitle('administratorSurnameTitle'); $setting->setComment('administratorSurnameComment'); $setting->setScope(''); @@ -180,11 +164,11 @@ class LoadSettingsData extends AbstractFixture implements $setting = new SettingsCurrent(); - $setting->setVariable('administratorName'); + $setting->setVariable('administrator_name'); $setting->setSubkey(''); $setting->setType('textfield'); - $setting->setCategory('Admin'); - $setting->setSelectedValue('{ADMINFIRSTNAME}'); + $setting->setCategory('admin'); + $setting->setSelectedValue('Jane'); $setting->setTitle('administratorNameTitle'); $setting->setComment('administratorNameComment'); $setting->setScope(''); @@ -194,10 +178,10 @@ class LoadSettingsData extends AbstractFixture implements $setting = new SettingsCurrent(); - $setting->setVariable('administratorTelephone'); + $setting->setVariable('administrator_phone'); $setting->setSubkey(''); $setting->setType('textfield'); - $setting->setCategory('Admin'); + $setting->setCategory('admin'); $setting->setSelectedValue('(000) 001 02 03'); $setting->setTitle('administratorTelephoneTitle'); $setting->setComment('administratorTelephoneComment'); @@ -206,6 +190,21 @@ class LoadSettingsData extends AbstractFixture implements $setting->setAccessUrlChangeable('1'); $manager->persist($setting); + return; + + $setting = new SettingsCurrent(); + $setting->setVariable('noreply_email_address'); + $setting->setSubkey(''); + $setting->setType('textfield'); + $setting->setCategory('Platform'); + $setting->setSelectedValue(''); + $setting->setTitle('NoReplyEmailAddress'); + $setting->setComment('NoReplyEmailAddressComment'); + $setting->setScope(''); + $setting->setSubkeytext(''); + $setting->setAccessUrlChangeable('0'); + $manager->persist($setting); + $setting = new SettingsCurrent(); $setting->setVariable('show_administrator_data'); @@ -1326,6 +1325,7 @@ class LoadSettingsData extends AbstractFixture implements $setting->setAccessUrlChangeable('0'); $manager->persist($setting); + //aqui $setting = new SettingsCurrent(); $setting->setVariable('upload_extensions_blacklist'); @@ -4394,7 +4394,7 @@ class LoadSettingsData extends AbstractFixture implements $setting = new SettingsCurrent(); - $setting->setVariable('login_as_allowed'); + $setting->setVariable('login_as_allowed'); // N??? $setting->setSubkey(''); $setting->setType('radio'); $setting->setCategory('Security'); diff --git a/src/ChamiloLMS/CoreBundle/Resources/config/routing.yml b/src/ChamiloLMS/CoreBundle/Resources/config/routing.yml index b39c9620e7..a08731226e 100644 --- a/src/ChamiloLMS/CoreBundle/Resources/config/routing.yml +++ b/src/ChamiloLMS/CoreBundle/Resources/config/routing.yml @@ -45,3 +45,18 @@ remove_trailing_slash: requirements: url: .*/$ _method: GET + +chamilolms_platform_settings: + pattern: /settings/platform + defaults: + _controller: ChamiloLMSSettingsBundle:Settings:update + namespace: platform + template: ChamiloLMSCoreBundle:Settings:default.html.twig + +chamilolms_course_settings: + pattern: /settings/course + defaults: + _controller: ChamiloLMSSettingsBundle:Settings:update + namespace: course + template: ChamiloLMSCoreBundle:Settings:default.html.twig + diff --git a/src/ChamiloLMS/CoreBundle/Resources/config/services.yml b/src/ChamiloLMS/CoreBundle/Resources/config/services.yml index c23bbcae85..46e65e89f0 100644 --- a/src/ChamiloLMS/CoreBundle/Resources/config/services.yml +++ b/src/ChamiloLMS/CoreBundle/Resources/config/services.yml @@ -1,4 +1,9 @@ services: + chamilolms.form.type.yes_no: + class: ChamiloLMS\CoreBundle\Form\Type\YesNoType + tags: + - { name: form.type, alias: yes_no } + # chamilolms.doctrine.entity_listener_resolver: # class: ChamiloLMS\CoreBundle\Doctrine\EntityListenerResolver # arguments: [ "@service_container" ] diff --git a/src/ChamiloLMS/CoreBundle/Resources/views/Form/fields.html.twig b/src/ChamiloLMS/CoreBundle/Resources/views/Form/fields.html.twig new file mode 100644 index 0000000000..99b0820cf2 --- /dev/null +++ b/src/ChamiloLMS/CoreBundle/Resources/views/Form/fields.html.twig @@ -0,0 +1,17 @@ +{% block yes_no_widget %} + {% spaceless %} + {% if expanded %} + + {% else %} + {# just let the choice widget render the select tag #} + {{ block('choice_widget') }} + {% endif %} + {% endspaceless %} +{% endblock %} diff --git a/src/ChamiloLMS/CoreBundle/Resources/views/Settings/default.html.twig b/src/ChamiloLMS/CoreBundle/Resources/views/Settings/default.html.twig new file mode 100644 index 0000000000..6f8c5cd97e --- /dev/null +++ b/src/ChamiloLMS/CoreBundle/Resources/views/Settings/default.html.twig @@ -0,0 +1,28 @@ +{% extends "::layout.html.twig" %} +{% from 'SyliusResourceBundle:Macros:actions.html.twig' import update %} + +{% set namespace = app.request.get('namespace') %} + +{% block page_title %} + {{ namespace }} +{% endblock %} + +{% block page_subtitle %} + {{ 'Settings' | trans }} +{% endblock %} + +{% block page_content %} +
+
+
+
+ {{ form_errors(form) }} +
+ {{ form_rest(form) }} + {{ update() }} +
+
+
+
+
+{% endblock %} diff --git a/src/ChamiloLMS/CoreBundle/Resources/views/Settings/platform.html.twig b/src/ChamiloLMS/CoreBundle/Resources/views/Settings/platform.html.twig deleted file mode 100644 index 7940957413..0000000000 --- a/src/ChamiloLMS/CoreBundle/Resources/views/Settings/platform.html.twig +++ /dev/null @@ -1,22 +0,0 @@ - -{% from 'SyliusResourceBundle:Macros:actions.html.twig' import update %} - -{% block topbar %} - -{% endblock %} - -{% block content %} - - -{{ form_errors(form) }} - -
- {{ form_rest(form) }} - {{ update() }} -
-{% endblock %} diff --git a/src/ChamiloLMS/CoreBundle/Settings/AdminSettingsSchema.php b/src/ChamiloLMS/CoreBundle/Settings/AdminSettingsSchema.php new file mode 100644 index 0000000000..abcc4b6c0d --- /dev/null +++ b/src/ChamiloLMS/CoreBundle/Settings/AdminSettingsSchema.php @@ -0,0 +1,41 @@ +setDefaults(array( + 'administrator_email' => '', + 'administrator_name' => '', + 'administrator_surname' => '', + 'administrator_phone' => '' + )) + ->setAllowedTypes(array( + 'administrator_email' => array('string'), + 'administrator_name' => array('string'), + 'administrator_surname' => array('string'), + 'administrator_phone' => array('integer'), + //'default_calendar_view' => array('string'), + + )) + ; + } + + public function buildForm(FormBuilderInterface $builder) + { + $builder + ->add('administrator_name') + ->add('administrator_surname') + ->add('administrator_email', 'email') + ->add('administrator_phone') + //->add('default_calendar_view', 'yes_no') + ; + } +} diff --git a/src/ChamiloLMS/CoreBundle/Settings/AgendaSettingsSchema.php b/src/ChamiloLMS/CoreBundle/Settings/AgendaSettingsSchema.php index 9e1927f259..b0d7f81bff 100644 --- a/src/ChamiloLMS/CoreBundle/Settings/AgendaSettingsSchema.php +++ b/src/ChamiloLMS/CoreBundle/Settings/AgendaSettingsSchema.php @@ -16,10 +16,15 @@ class CourseSettingsSchema implements SchemaInterface 'display_mini_month_calendar' => '', 'display_upcoming_events' => '', 'number_of_upcoming_events' => '', - 'default_calendar_view' => '', + //'default_calendar_view' => '', )) ->setAllowedTypes(array( - 'allow_personal_agenda' => array('string') + 'allow_personal_agenda' => array('string'), + 'display_mini_month_calendar' => array('string'), + 'display_upcoming_events' => array('string'), + 'number_of_upcoming_events' => array('integer'), + //'default_calendar_view' => array('string'), + )) ; } @@ -27,7 +32,12 @@ class CourseSettingsSchema implements SchemaInterface public function buildForm(FormBuilderInterface $builder) { $builder - ->add('allow_personal_agenda') + ->add('allow_personal_agenda', 'yes_no') + ->add('display_mini_month_calendar', 'yes_no') + ->add('display_upcoming_events', 'yes_no') + ->add('number_of_upcoming_events') + //->add('default_calendar_view', 'yes_no') + ; } } diff --git a/src/ChamiloLMS/CoreBundle/Settings/ChatSettingsSchema.php b/src/ChamiloLMS/CoreBundle/Settings/ChatSettingsSchema.php index 7dc7db015e..69bb6d4254 100644 --- a/src/ChamiloLMS/CoreBundle/Settings/ChatSettingsSchema.php +++ b/src/ChamiloLMS/CoreBundle/Settings/ChatSettingsSchema.php @@ -6,7 +6,7 @@ use Sylius\Bundle\SettingsBundle\Schema\SchemaInterface; use Sylius\Bundle\SettingsBundle\Schema\SettingsBuilderInterface; use Symfony\Component\Form\FormBuilderInterface; -class CourseSettingsSchema implements SchemaInterface +class ChatSettingsSchema implements SchemaInterface { public function buildSettings(SettingsBuilderInterface $builder) { @@ -14,7 +14,6 @@ class CourseSettingsSchema implements SchemaInterface ->setDefaults(array( 'show_chat_folder' => '', 'allow_global_chat' => '', - )) ->setAllowedTypes(array( 'allow_personal_agenda' => array('string') @@ -25,7 +24,8 @@ class CourseSettingsSchema implements SchemaInterface public function buildForm(FormBuilderInterface $builder) { $builder - ->add('allow_personal_agenda') + ->add('allow_personal_agenda', 'yes_no') + ->add('allow_global_chat', 'yes_no') ; } } diff --git a/src/ChamiloLMS/CoreBundle/Settings/CourseSettingsSchema.php b/src/ChamiloLMS/CoreBundle/Settings/CourseSettingsSchema.php index aac4208238..c5786a4313 100644 --- a/src/ChamiloLMS/CoreBundle/Settings/CourseSettingsSchema.php +++ b/src/ChamiloLMS/CoreBundle/Settings/CourseSettingsSchema.php @@ -8,13 +8,16 @@ use Symfony\Component\Form\FormBuilderInterface; class CourseSettingsSchema implements SchemaInterface { + /** + * @param SettingsBuilderInterface $builder + */ public function buildSettings(SettingsBuilderInterface $builder) { $builder ->setDefaults(array( - 'homepage_view' => '', - 'show_toolshortcuts' => '', - 'course_create_active_tools' => '', //course_progress attendances notebook glossary survey 'gradebook course_description, agenda, documents, learning_path,links, announcements, forums dropbox quiz users groups chat online_conference student_publications wiki + 'homepage_view' => 'activity_big', + 'show_tool_shortcuts' => '', + 'course_create_active_tools' => array('course_progress'), 'display_coursecode_in_courselist' => '', 'display_teacher_in_courselist' => '', 'student_view_enabled' => '', @@ -30,15 +33,15 @@ class CourseSettingsSchema implements SchemaInterface 'allow_user_course_subscription_by_course_admin' => '', 'course_validation' => '', 'course_validation_terms_and_conditions_url' => '', - 'course_hide_tools' => '', + 'course_hide_tools' => array(), 'scorm_cumulative_session_time' => '', 'courses_default_creation_visibility' => '', 'allow_public_certificates' => '', )) ->setAllowedTypes(array( 'homepage_view' => array('string'), - 'show_toolshortcuts' => array('string'), - 'course_create_active_tools' => array('string'), + 'show_tool_shortcuts' => array('string'), + 'course_create_active_tools' => array('array'), 'display_coursecode_in_courselist' => array('string'), 'display_teacher_in_courselist' => array('string'), 'student_view_enabled' => array('string'), @@ -46,14 +49,89 @@ class CourseSettingsSchema implements SchemaInterface ; } + /** + * @param FormBuilderInterface $builder + */ public function buildForm(FormBuilderInterface $builder) { + $tools = array( + 'course_progress', + 'attendances', + 'notebook', + 'glossary', + 'survey', + 'gradebook', + 'course_description', + 'agenda', + 'documents', + 'learning_path', + 'links', + 'announcements', + 'forums', + 'dropbox', + 'quiz', + 'users', + 'groups', + 'chat', + 'online_conference', + 'student_publications', + 'wiki' + ); + $builder - ->add('homepage_view') - ->add('show_toolshortcuts') - ->add('course_create_active_tools') - ->add('display_coursecode_in_courselist') - ->add('display_teacher_in_courselist') + ->add('homepage_view', 'choice', array( + 'choices' => array('activity' => 'activity', 'activity_big' => 'activity_big')) + ) + ->add('show_tool_shortcuts', 'yes_no') + ->add('course_create_active_tools', 'choice', array( + 'choices' => $tools, + 'multiple' => true, + 'expanded' => true + )) + ->add('display_coursecode_in_courselist', 'yes_no') + ->add('display_teacher_in_courselist', 'yes_no') + ->add('student_view_enabled', 'yes_no') + ->add('go_to_course_after_login', 'yes_no') + ->add('show_navigation_menu', 'choice', array( + 'choices' => array( + 'false' => 'No', + 'icons' => 'Icons', + 'text' => 'text', + 'iconstext' => 'iconstext', + ) + )) + ->add('enable_tool_introduction', 'yes_no') + ->add('breadcrumbs_course_homepage', 'choice', array( + 'choices' => array( + 'course_home' => 'Course home', + 'course_code' => 'Course code', + 'course_title' => 'Course title', + 'session_name_and_course_title' => 'Session and course name' + ) + )) + ->add('example_material_course_creation', 'yes_no') + ->add('allow_course_theme', 'yes_no') + ->add('allow_users_to_create_courses', 'yes_no') + ->add('show_courses_descriptions_in_catalog', 'yes_no') + ->add('send_email_to_admin_when_create_course', 'yes_no') + ->add('allow_user_course_subscription_by_course_admin', 'yes_no') + ->add('course_validation', 'yes_no') + ->add('course_validation_terms_and_conditions_url', 'url') + ->add('course_hide_tools', 'choice', array( + 'choices' => $tools, + 'multiple' => true, + 'expanded' => true + )) + ->add('scorm_cumulative_session_time', 'yes_no') + ->add('courses_default_creation_visibility', 'choice', array( + 'choices' => array( + '3' => 'Public', + '2' => 'Open', + '1' => 'Private', + '0' => 'Closed' + ) + )) + ->add('allow_public_certificates', 'yes_no') ; } } diff --git a/src/ChamiloLMS/CoreBundle/Settings/DisplaySettingsSchema.php b/src/ChamiloLMS/CoreBundle/Settings/DisplaySettingsSchema.php index fd395dfde3..0f85ff71dc 100644 --- a/src/ChamiloLMS/CoreBundle/Settings/DisplaySettingsSchema.php +++ b/src/ChamiloLMS/CoreBundle/Settings/DisplaySettingsSchema.php @@ -19,7 +19,6 @@ class DisplaySettingsSchema implements SchemaInterface 'showonline' => '', 'allow_user_headings' => '', 'time_limit_whosonline' => '', - 'allow_email_editor' => '', 'show_email_addresses' => '', 'show_number_of_courses' => '', 'show_empty_course_categories' => '', @@ -32,22 +31,15 @@ class DisplaySettingsSchema implements SchemaInterface 'accessibility_font_resize' => '', 'show_admin_toolbar' => '', 'show_hot_courses' => '', - 'user_name_order' => '', - 'user_name_sort_by' => '', + 'user_name_order' => '', // ? + 'user_name_sort_by' => '', // ? 'use_virtual_keyboard' => '', 'disable_copy_paste' => '', 'breadcrumb_navigation_display' => '', 'bug_report_link' => '' - - )) ->setAllowedTypes(array( - 'enable_help_link' => array('string'), - 'show_administrator_data' => array('string'), - 'show_tutor_data' => array('string'), - 'show_teacher_data' => array('string'), - 'showonline' => array('string'), - 'allow_user_headings' => array('string'), + 'time_limit_whosonline' => array('integer') )) ; } @@ -55,14 +47,37 @@ class DisplaySettingsSchema implements SchemaInterface public function buildForm(FormBuilderInterface $builder) { $builder - ->add('enable_help_link', 'choice', array('choices' => - array('true' => 'Yes', 'no' => 'No')) + ->add('enable_help_link', 'yes_no') + ->add('show_administrator_data', 'yes_no') + ->add('show_tutor_data', 'yes_no') + ->add('show_teacher_data', 'yes_no') + ->add( + 'showonline', + 'choice', + array( + 'choices' => + array('course', 'users', 'world') + ) ) - ->add('show_administrator_data') - ->add('show_tutor_data') - ->add('show_teacher_data') - ->add('showonline') - ->add('allow_user_headings') + ->add('allow_user_headings', 'yes_no') + ->add('time_limit_whosonline') + ->add('show_email_addresses', 'yes_no') + ->add('show_number_of_courses', 'yes_no') + ->add('show_empty_course_categories', 'yes_no') + ->add('show_back_link_on_top_of_tree', 'yes_no') + ->add('show_empty_course_categories', 'yes_no') + ->add('show_different_course_language', 'yes_no') + ->add('display_categories_on_homepage', 'yes_no') + ->add('show_closed_courses', 'yes_no') + ->add('allow_students_to_browse_courses', 'yes_no') + ->add('show_link_bug_notification', 'yes_no') + ->add('accessibility_font_resize', 'yes_no') + ->add('show_admin_toolbar', 'yes_no') + ->add('show_hot_courses', 'yes_no') + ->add('use_virtual_keyboard', 'yes_no') + ->add('disable_copy_paste', 'yes_no') + ->add('breadcrumb_navigation_display', 'yes_no') + ->add('bug_report_link', 'yes_no') ; } } diff --git a/src/ChamiloLMS/CoreBundle/Settings/DocumentSettingsSchema.php b/src/ChamiloLMS/CoreBundle/Settings/DocumentSettingsSchema.php index 96c16d50e7..c8a22ac4ae 100644 --- a/src/ChamiloLMS/CoreBundle/Settings/DocumentSettingsSchema.php +++ b/src/ChamiloLMS/CoreBundle/Settings/DocumentSettingsSchema.php @@ -36,13 +36,13 @@ class DocumentSettingsSchema implements SchemaInterface 'show_documents_preview' => '', 'enable_wami_record' => '', 'enable_webcam_clip' => '', - 'tool_visible_by_default_at_creation' => '',// documents - 'documents_default_visibility_defined_in_course' => '', - 'allow_personal_user_files' => '', + 'tool_visible_by_default_at_creation' => '',// documents ? + 'documents_default_visibility_defined_in_course' => '', // ? + 'allow_personal_user_files' => '', // ? )) ->setAllowedTypes(array( - 'default_document_quotum' => array('string'), - 'default_group_quotum' => array('string'), + 'default_document_quotum' => array('integer'), + 'default_group_quotum' => array('integer'), 'permanently_remove_deleted_files' => array('string'), )) ; @@ -53,7 +53,51 @@ class DocumentSettingsSchema implements SchemaInterface $builder ->add('default_document_quotum') ->add('default_group_quotum') - ->add('permanently_remove_deleted_files') + ->add('permanently_remove_deleted_files', 'yes_no') + ->add( + 'upload_extensions_list_type', + 'choice', + array( + 'choices' => array( + 'blacklist' => 'blacklist', + 'whitelist' => 'whitelist' + ) + ) + ) + ->add('upload_extensions_blacklist', 'textarea') + ->add('upload_extensions_whitelist', 'textarea') + ->add('upload_extensions_skip', 'textarea') + ->add('upload_extensions_replace_by', 'textarea') + ->add('permissions_for_new_directories') + ->add('permissions_for_new_files') + ->add('show_glossary_in_documents', 'yes_no') + ->add('students_download_folders', 'yes_no') + ->add('users_copy_files', 'yes_no') + ->add('pdf_export_watermark_enable', 'yes_no') + ->add('pdf_export_watermark_by_course', 'yes_no') + ->add('pdf_export_watermark_text', 'textarea') + ->add('students_export2pdf', 'yes_no') + ->add('show_users_folders', 'yes_no') + ->add('show_default_folders', 'yes_no') + ->add('enabled_text2audio', 'yes_no') + ->add('enable_nanogong', 'yes_no') + ->add('show_documents_preview', 'yes_no') + ->add('enable_wami_record', 'yes_no') + ->add('enable_webcam_clip', 'yes_no') + ->add('tool_visible_by_default_at_creation', 'yes_no') // ? + + + + + + + + + + + + + ; } } diff --git a/src/ChamiloLMS/CoreBundle/Settings/DropboxSettingsSchema.php b/src/ChamiloLMS/CoreBundle/Settings/DropboxSettingsSchema.php index 31c4e2cac7..014c8c84b3 100644 --- a/src/ChamiloLMS/CoreBundle/Settings/DropboxSettingsSchema.php +++ b/src/ChamiloLMS/CoreBundle/Settings/DropboxSettingsSchema.php @@ -29,7 +29,12 @@ class DropboxSettingsSchema implements SchemaInterface public function buildForm(FormBuilderInterface $builder) { $builder - ->add('dropbox_allow_overwrite') + ->add('dropbox_allow_overwrite', 'yes_no') + ->add('dropbox_max_filesize') + ->add('dropbox_allow_just_upload', 'yes_no') + ->add('dropbox_allow_student_to_student', 'yes_no') + ->add('dropbox_allow_group', 'yes_no') + ->add('dropbox_allow_mailing', 'yes_no') ; } } diff --git a/src/ChamiloLMS/CoreBundle/Settings/EditorSettingsSchema.php b/src/ChamiloLMS/CoreBundle/Settings/EditorSettingsSchema.php index ffce0dd938..d6a8f7e0de 100644 --- a/src/ChamiloLMS/CoreBundle/Settings/EditorSettingsSchema.php +++ b/src/ChamiloLMS/CoreBundle/Settings/EditorSettingsSchema.php @@ -6,12 +6,13 @@ use Sylius\Bundle\SettingsBundle\Schema\SchemaInterface; use Sylius\Bundle\SettingsBundle\Schema\SettingsBuilderInterface; use Symfony\Component\Form\FormBuilderInterface; -class CourseSettingsSchema implements SchemaInterface +class EditorSettingsSchema implements SchemaInterface { public function buildSettings(SettingsBuilderInterface $builder) { $builder ->setDefaults(array( + 'allow_email_editor' => '', 'math_mimetex' => '', 'math_asciimathML' => '', 'enabled_asciisvg' => '', @@ -28,10 +29,10 @@ class CourseSettingsSchema implements SchemaInterface 'enabled_insertHtml' => '', 'enabled_support_pixlr' => '', 'htmlpurifier_wiki' => '', - 'enable_iframe_inclusion' => '', + 'enable_iframe_inclusion' => '' )) ->setAllowedTypes(array( - 'allow_personal_agenda' => array('string') + //'allow_personal_agenda' => array('string') )) ; } @@ -39,7 +40,24 @@ class CourseSettingsSchema implements SchemaInterface public function buildForm(FormBuilderInterface $builder) { $builder - ->add('allow_personal_agenda') + ->add('allow_email_editor', 'yes_no') + ->add('math_mimetex', 'yes_no') + ->add('math_asciimathML', 'yes_no') + ->add('enabled_asciisvg', 'yes_no') + ->add('include_asciimathml_script', 'yes_no') + ->add('youtube_for_students', 'yes_no') + ->add('block_copy_paste_for_students', 'yes_no') + ->add('more_buttons_maximized_mode', 'yes_no') + ->add('enabled_wiris', 'yes_no') + ->add('allow_spellcheck', 'yes_no') + ->add('force_wiki_paste_as_plain_text', 'yes_no') + ->add('enabled_googlemaps', 'yes_no') + ->add('enabled_imgmap', 'yes_no') + ->add('enabled_support_svg', 'yes_no') + ->add('enabled_insertHtml', 'yes_no') + ->add('enabled_support_pixlr', 'yes_no') + ->add('htmlpurifier_wiki', 'yes_no') + ->add('enable_iframe_inclusion', 'yes_no') ; } } diff --git a/src/ChamiloLMS/CoreBundle/Settings/ExerciseSettingsSchema.php b/src/ChamiloLMS/CoreBundle/Settings/ExerciseSettingsSchema.php index 386eb4f2e4..500cdf7daa 100644 --- a/src/ChamiloLMS/CoreBundle/Settings/ExerciseSettingsSchema.php +++ b/src/ChamiloLMS/CoreBundle/Settings/ExerciseSettingsSchema.php @@ -6,23 +6,20 @@ use Sylius\Bundle\SettingsBundle\Schema\SchemaInterface; use Sylius\Bundle\SettingsBundle\Schema\SettingsBuilderInterface; use Symfony\Component\Form\FormBuilderInterface; -class CourseSettingsSchema implements SchemaInterface +class ExerciseSettingsSchema implements SchemaInterface { public function buildSettings(SettingsBuilderInterface $builder) { $builder ->setDefaults(array( - 'exercise_min_score' => '', - 'exercise_max_score' => '', + 'exercise_min_score' => 0, + 'exercise_max_score' => 0, 'enable_quiz_scenario' => '', )) ->setAllowedTypes(array( - 'homepage_view' => array('string'), - 'show_toolshortcuts' => array('string'), - 'course_create_active_tools' => array('string'), - 'display_coursecode_in_courselist' => array('string'), - 'display_teacher_in_courselist' => array('string'), - 'student_view_enabled' => array('string'), + 'exercise_min_score' => array('integer'), + 'exercise_max_score' => array('integer'), + 'enable_quiz_scenario' => array('string'), )) ; } @@ -30,11 +27,9 @@ class CourseSettingsSchema implements SchemaInterface public function buildForm(FormBuilderInterface $builder) { $builder - ->add('homepage_view') - ->add('show_toolshortcuts') - ->add('course_create_active_tools') - ->add('display_coursecode_in_courselist') - ->add('display_teacher_in_courselist') + ->add('exercise_min_score') + ->add('exercise_max_score') + ->add('enable_quiz_scenario') ; } } diff --git a/src/ChamiloLMS/CoreBundle/Settings/ForumSettingsSchema.php b/src/ChamiloLMS/CoreBundle/Settings/ForumSettingsSchema.php index b4064c053e..dbc1337b8a 100644 --- a/src/ChamiloLMS/CoreBundle/Settings/ForumSettingsSchema.php +++ b/src/ChamiloLMS/CoreBundle/Settings/ForumSettingsSchema.php @@ -23,7 +23,17 @@ class ForumSettingsSchema implements SchemaInterface public function buildForm(FormBuilderInterface $builder) { $builder - ->add('default_forum_view') + ->add( + 'default_forum_view', + 'choice', + array( + 'choices' => array( + 'flat' => 'Flat', + 'threaded' => 'Threaded', + 'nested' => 'Nested' + ) + ) + ) ; } } diff --git a/src/ChamiloLMS/CoreBundle/Settings/GlossarySettingsSchema.php b/src/ChamiloLMS/CoreBundle/Settings/GlossarySettingsSchema.php index 7b94750d67..8819f0b7fe 100644 --- a/src/ChamiloLMS/CoreBundle/Settings/GlossarySettingsSchema.php +++ b/src/ChamiloLMS/CoreBundle/Settings/GlossarySettingsSchema.php @@ -6,7 +6,7 @@ use Sylius\Bundle\SettingsBundle\Schema\SchemaInterface; use Sylius\Bundle\SettingsBundle\Schema\SettingsBuilderInterface; use Symfony\Component\Form\FormBuilderInterface; -class DisplaySettingsSchema implements SchemaInterface +class GlossarySettingsSchema implements SchemaInterface { public function buildSettings(SettingsBuilderInterface $builder) { @@ -25,9 +25,8 @@ class DisplaySettingsSchema implements SchemaInterface public function buildForm(FormBuilderInterface $builder) { $builder - ->add('enable_help_link', 'choice', array('choices' => - array('true' => 'Yes', 'no' => 'No')) - ); + ->add('show_glossary_in_extra_tools', 'yes_no') + ; } } diff --git a/src/ChamiloLMS/CoreBundle/Settings/GradebookSettingsSchema.php b/src/ChamiloLMS/CoreBundle/Settings/GradebookSettingsSchema.php index 926d7fab8d..38afa8389c 100644 --- a/src/ChamiloLMS/CoreBundle/Settings/GradebookSettingsSchema.php +++ b/src/ChamiloLMS/CoreBundle/Settings/GradebookSettingsSchema.php @@ -25,10 +25,13 @@ class GradebookSettingsSchema implements SchemaInterface 'gradebook_default_weight' => '', 'gradebook_locking_enabled' => '', 'gradebook_default_grade_model_id' => '', - 'gradebook_show_percentage_in_rep' => '' + 'gradebook_show_percentage_in_rep' => '' // ? )) ->setAllowedTypes(array( - 'gradebook_enable' => array('string') + 'gradebook_enable' => array('string'), + 'gradebook_number_decimals' => array('integer'), + 'gradebook_default_weight' => array('integer'), + )) ; } @@ -36,7 +39,20 @@ class GradebookSettingsSchema implements SchemaInterface public function buildForm(FormBuilderInterface $builder) { $builder - ->add('gradebook_enable') + ->add('gradebook_enable', 'yes_no') + ->add('gradebook_score_display_coloring', 'yes_no') + ->add('gradebook_score_display_custom', 'yes_no') + ->add('gradebook_score_display_colorspl') + ->add('gradebook_score_display_upperlim', 'yes_no') + ->add('gradebook_number_decimals') + ->add('allow_hr_skills_management', 'yes_no') + ->add('teachers_can_change_score_settin', 'yes_no') + ->add('gradebook_enable_grade_model', 'yes_no') + ->add('teachers_can_change_grade_model_', 'yes_no') + ->add('gradebook_default_weight') + ->add('gradebook_locking_enabled', 'yes_no') + ->add('gradebook_default_grade_model_id') + ->add('gradebook_show_percentage_in_rep') ; } } diff --git a/src/ChamiloLMS/CoreBundle/Settings/GroupSettingsSchema.php b/src/ChamiloLMS/CoreBundle/Settings/GroupSettingsSchema.php index 152daeb593..fb35ddae63 100644 --- a/src/ChamiloLMS/CoreBundle/Settings/GroupSettingsSchema.php +++ b/src/ChamiloLMS/CoreBundle/Settings/GroupSettingsSchema.php @@ -23,9 +23,7 @@ class GroupSettingsSchema implements SchemaInterface public function buildForm(FormBuilderInterface $builder) { $builder - ->add('allow_group_categories', 'choice', array('choices' => - array('true' => 'Yes', 'no' => 'No')) - ) + ->add('allow_group_categories', 'yes_no') ; } } diff --git a/src/ChamiloLMS/CoreBundle/Settings/MailSettingsSchema.php b/src/ChamiloLMS/CoreBundle/Settings/MailSettingsSchema.php index efb193f7d2..e65d75febf 100644 --- a/src/ChamiloLMS/CoreBundle/Settings/MailSettingsSchema.php +++ b/src/ChamiloLMS/CoreBundle/Settings/MailSettingsSchema.php @@ -13,7 +13,7 @@ class MailSettingsSchema implements SchemaInterface $builder ->setDefaults(array( 'noreply_email_address' => '', - activate_email_template + 'activate_email_template' => '', )) ->setAllowedTypes(array( @@ -26,6 +26,7 @@ class MailSettingsSchema implements SchemaInterface { $builder ->add('noreply_email_address', 'email') + ->add('activate_email_template', 'yes_no') ; } } diff --git a/src/ChamiloLMS/CoreBundle/Settings/MessageSettingsSchema.php b/src/ChamiloLMS/CoreBundle/Settings/MessageSettingsSchema.php index b55023d116..5b85a5eb72 100644 --- a/src/ChamiloLMS/CoreBundle/Settings/MessageSettingsSchema.php +++ b/src/ChamiloLMS/CoreBundle/Settings/MessageSettingsSchema.php @@ -6,7 +6,7 @@ use Sylius\Bundle\SettingsBundle\Schema\SchemaInterface; use Sylius\Bundle\SettingsBundle\Schema\SettingsBuilderInterface; use Symfony\Component\Form\FormBuilderInterface; -class CourseSettingsSchema implements SchemaInterface +class MessageSettingsSchema implements SchemaInterface { public function buildSettings(SettingsBuilderInterface $builder) { @@ -18,7 +18,8 @@ class CourseSettingsSchema implements SchemaInterface )) ->setAllowedTypes(array( - 'allow_personal_agenda' => array('string') + 'allow_message_tool' => array('string'), + 'message_max_upload_filesize' => array('integer') )) ; } @@ -26,7 +27,9 @@ class CourseSettingsSchema implements SchemaInterface public function buildForm(FormBuilderInterface $builder) { $builder - ->add('allow_personal_agenda') + ->add('allow_message_tool', 'yes_no') + ->add('allow_send_message_to_all_platform_users', 'yes_no') + ->add('message_max_upload_filesize') ; } } diff --git a/src/ChamiloLMS/CoreBundle/Settings/PlatformSettingsSchema.php b/src/ChamiloLMS/CoreBundle/Settings/PlatformSettingsSchema.php index 200024db21..ffdfc2c836 100644 --- a/src/ChamiloLMS/CoreBundle/Settings/PlatformSettingsSchema.php +++ b/src/ChamiloLMS/CoreBundle/Settings/PlatformSettingsSchema.php @@ -6,8 +6,15 @@ use Sylius\Bundle\SettingsBundle\Schema\SchemaInterface; use Sylius\Bundle\SettingsBundle\Schema\SettingsBuilderInterface; use Symfony\Component\Form\FormBuilderInterface; +/** + * Class PlatformSettingsSchema + * @package ChamiloLMS\CoreBundle\Settings + */ class PlatformSettingsSchema implements SchemaInterface { + /** + * @param SettingsBuilderInterface $builder + */ public function buildSettings(SettingsBuilderInterface $builder) { $builder @@ -15,12 +22,11 @@ class PlatformSettingsSchema implements SchemaInterface 'institution' => 'Campus Chamilo', 'institution_url' => 'http://www.chamilo.org', 'site_name' => 'Chamilo Association', - 'administrator_email' => '', - 'administrator_name' => '', - 'administrator_surname' => '', - 'administrator_phone' => '', - 'timezone_value' => '', - 'settings_latest_update' => '', + 'administrator_email' => 'admin@example.org', + 'administrator_name' => 'Jane', + 'administrator_surname' => 'Doe', + 'administrator_phone' => '123456', + 'timezone' => 'Europe/Paris', )) ->setAllowedTypes(array( 'institution' => array('string'), @@ -29,21 +35,26 @@ class PlatformSettingsSchema implements SchemaInterface 'administrator_email' => array('string'), 'administrator_name' => array('string'), 'administrator_surname' => array('string'), - 'administrator_phone' => array('string') + 'administrator_phone' => array('string'), + 'timezone' => array('string'), )) ; } + /** + * @param FormBuilderInterface $builder + */ public function buildForm(FormBuilderInterface $builder) { $builder ->add('institution') - ->add('institution_url') + ->add('institution_url', 'url') ->add('site_name') - ->add('administrator_email') + ->add('administrator_email', 'email') ->add('administrator_name') ->add('administrator_surname') ->add('administrator_phone') + ->add('timezone', 'timezone') ; } } diff --git a/src/ChamiloLMS/CoreBundle/Settings/ProfileSettingsSchema.php b/src/ChamiloLMS/CoreBundle/Settings/ProfileSettingsSchema.php index dce51162aa..437f13c198 100644 --- a/src/ChamiloLMS/CoreBundle/Settings/ProfileSettingsSchema.php +++ b/src/ChamiloLMS/CoreBundle/Settings/ProfileSettingsSchema.php @@ -12,7 +12,7 @@ class ProfileSettingsSchema implements SchemaInterface { $builder ->setDefaults(array( - 'profile' => '', // name, officialcode, email, picture, login, password, language, phone openid, theme apikeys + 'profile' => '', // 'extended_profile' => '', 'account_valid_duration' => '', 'split_users_upload_directory' => '', @@ -20,11 +20,10 @@ class ProfileSettingsSchema implements SchemaInterface 'use_users_timezone' => '', 'allow_users_to_change_email_with_no_password' => '', 'login_is_email' => '', - - )) ->setAllowedTypes(array( - 'profile' => array('string') + 'profile' => array('string'), + 'account_valid_duration' => array('integer') )) ; } @@ -32,11 +31,32 @@ class ProfileSettingsSchema implements SchemaInterface public function buildForm(FormBuilderInterface $builder) { $builder - ->add('profile') - - /*->add('enable_help_link', 'choice', array('choices' => - array('true' => 'Yes', 'no' => 'No')) - )*/ + ->add( + 'profile', + 'choice', + array( + 'choices' => array( + 'name', + 'officialcode', + 'email', + 'picture', + 'login', + 'password', + 'language', + 'phone', + 'openid', + 'theme', + 'apikeys' + ) + ) + ) + ->add('extended_profile', 'yes_no') + ->add('account_valid_duration') + ->add('split_users_upload_directory', 'yes_no') + ->add('user_selected_theme', 'yes_no') + ->add('use_users_timezone', 'yes_no') + ->add('allow_users_to_change_email_with_no_password', 'yes_no') + ->add('login_is_email', 'yes_no') ; } } diff --git a/src/ChamiloLMS/CoreBundle/Settings/RegistrationSettingsSchema.php b/src/ChamiloLMS/CoreBundle/Settings/RegistrationSettingsSchema.php index 2d9bc63e4d..ddecc0cf4d 100644 --- a/src/ChamiloLMS/CoreBundle/Settings/RegistrationSettingsSchema.php +++ b/src/ChamiloLMS/CoreBundle/Settings/RegistrationSettingsSchema.php @@ -41,15 +41,45 @@ class CourseSettingsSchema implements SchemaInterface public function buildForm(FormBuilderInterface $builder) { $builder - ->add('registration') - ->add('allow_registration') - ->add('allow_registration_as_teacher') - ->add('allow_lostpassword') - - - /*->add('enable_help_link', 'choice', array('choices' => - array('true' => 'Yes', 'no' => 'No')) - )*/ + ->add( + 'registration', + 'choice', + array('choices' => array('officialcode', 'email', 'language', 'phone')) + ) + ->add( + 'allow_registration', + 'choice', + array( + 'choices' => array( + 'true' => 'Yes', + 'false' => 'No', + 'approval' => 'Approval' + ) + ) + ) + ->add('allow_registration_as_teacher', 'yes_no') + ->add('allow_lostpassword', 'yes_no') + ->add( + 'page_after_login', 'choice', + array( + 'choices' => array( + 'index.php' => 'Homepage', + 'user_portal.php' => 'My courses', + 'main/auth/courses.php' => 'Course catalog' + ) + ) + ) + //->add('extendedprofile_registration', '') // ? + ->add('allow_terms_conditions', 'yes_no') + ->add('student_page_after_login') + ->add('teacher_page_after_login') + ->add('drh_page_after_login') + ->add('sessionadmin_page_after_login') + ->add('student_autosubscribe') // ? + ->add('teacher_autosubscribe') // ? + ->add('drh_autosubscribe', '') // ? + ->add('sessionadmin_autosubscribe', '') // ? + ->add('platform_unsubscribe_allowed', 'yes_no') ; } } diff --git a/src/ChamiloLMS/CoreBundle/Settings/SearchSettingsSchema.php b/src/ChamiloLMS/CoreBundle/Settings/SearchSettingsSchema.php index 31ade78551..68011ed1e3 100644 --- a/src/ChamiloLMS/CoreBundle/Settings/SearchSettingsSchema.php +++ b/src/ChamiloLMS/CoreBundle/Settings/SearchSettingsSchema.php @@ -6,7 +6,7 @@ use Sylius\Bundle\SettingsBundle\Schema\SchemaInterface; use Sylius\Bundle\SettingsBundle\Schema\SettingsBuilderInterface; use Symfony\Component\Form\FormBuilderInterface; -class CourseSettingsSchema implements SchemaInterface +class SearchSettingsSchema implements SchemaInterface { public function buildSettings(SettingsBuilderInterface $builder) { @@ -19,7 +19,8 @@ class CourseSettingsSchema implements SchemaInterface )) ->setAllowedTypes(array( - 'allow_personal_agenda' => array('string') + 'allow_personal_agenda' => array('string'), + 'number_of_upcoming_events' => array('integer') )) ; } @@ -27,7 +28,19 @@ class CourseSettingsSchema implements SchemaInterface public function buildForm(FormBuilderInterface $builder) { $builder - ->add('allow_personal_agenda') + ->add('search_enabled', 'yes_no') + ->add('search_prefilter_prefix', 'yes_no') + ->add( + 'search_show_unlinked_results', + 'choice', + array( + 'choices' => array( + 'search_show_unlinked_results', + 'search_show_unlinked_results' + ) + ) + ) + ->add('number_of_upcoming_events') ; } } diff --git a/src/ChamiloLMS/CoreBundle/Settings/SecuritySettingsSchema.php b/src/ChamiloLMS/CoreBundle/Settings/SecuritySettingsSchema.php index aef59aecff..5f29bbd01c 100644 --- a/src/ChamiloLMS/CoreBundle/Settings/SecuritySettingsSchema.php +++ b/src/ChamiloLMS/CoreBundle/Settings/SecuritySettingsSchema.php @@ -14,15 +14,12 @@ class SecuritySettingsSchema implements SchemaInterface ->setDefaults(array( 'filter_terms' => '', 'allow_browser_sniffer' => '', - 'admins_can_set_users_pass' => '', + 'admins_can_set_users_pass' => '', // ? )) ->setAllowedTypes(array( - 'homepage_view' => array('string'), - 'show_toolshortcuts' => array('string'), - 'course_create_active_tools' => array('string'), - 'display_coursecode_in_courselist' => array('string'), - 'display_teacher_in_courselist' => array('string'), - 'student_view_enabled' => array('string'), + 'filter_terms' => array('string'), + 'allow_browser_sniffer' => array('string'), + 'admins_can_set_users_pass' => array('string'), )) ; } @@ -30,11 +27,9 @@ class SecuritySettingsSchema implements SchemaInterface public function buildForm(FormBuilderInterface $builder) { $builder - ->add('homepage_view') - ->add('show_toolshortcuts') - ->add('course_create_active_tools') - ->add('display_coursecode_in_courselist') - ->add('display_teacher_in_courselist') + ->add('filter_terms', 'textarea') + ->add('allow_browser_sniffer', 'yes_no') + ->add('admins_can_set_users_pass') ; } } diff --git a/src/ChamiloLMS/CoreBundle/Settings/SessionSettingsSchema.php b/src/ChamiloLMS/CoreBundle/Settings/SessionSettingsSchema.php index 2a59fc66f8..b0d5058510 100644 --- a/src/ChamiloLMS/CoreBundle/Settings/SessionSettingsSchema.php +++ b/src/ChamiloLMS/CoreBundle/Settings/SessionSettingsSchema.php @@ -12,7 +12,7 @@ class SessionSettingsSchema implements SchemaInterface { $builder ->setDefaults(array( - 'add_users_by_coach' => '', + 'add_users_by_coach' => 'false', 'extend_rights_for_coach' => '', 'show_session_coach' => '', 'show_session_data' => '', @@ -33,7 +33,17 @@ class SessionSettingsSchema implements SchemaInterface public function buildForm(FormBuilderInterface $builder) { $builder - ->add('add_users_by_coach') + ->add('add_users_by_coach', 'yes_no') + ->add('extend_rights_for_coach', 'yes_no') + ->add('show_session_coach', 'yes_no') + ->add('show_session_data', 'yes_no') + ->add('allow_coach_to_edit_course_session', 'yes_no') + ->add('show_groups_to_users', 'yes_no') + ->add('hide_courses_in_sessions', 'yes_no') + ->add('allow_session_admins_to_manage_all_sessions', 'yes_no') + ->add('session_tutor_reports_visibility', 'yes_no') + ->add('session_page_enabled', 'yes_no') + ->add('allow_teachers_to_create_sessions', 'yes_no') ; } } diff --git a/src/ChamiloLMS/CoreBundle/Settings/SkillSettingsSchema.php b/src/ChamiloLMS/CoreBundle/Settings/SkillSettingsSchema.php index f5d309a005..3925465396 100644 --- a/src/ChamiloLMS/CoreBundle/Settings/SkillSettingsSchema.php +++ b/src/ChamiloLMS/CoreBundle/Settings/SkillSettingsSchema.php @@ -13,13 +13,9 @@ class SkillSettingsSchema implements SchemaInterface $builder ->setDefaults(array( 'allow_skills_tool' => '', - 'display_mini_month_calendar' => '', - 'display_upcoming_events' => '', - 'number_of_upcoming_events' => '', - )) ->setAllowedTypes(array( - 'allow_personal_agenda' => array('string') + 'allow_skills_tool' => array('string') )) ; } @@ -27,7 +23,7 @@ class SkillSettingsSchema implements SchemaInterface public function buildForm(FormBuilderInterface $builder) { $builder - ->add('allow_personal_agenda') + ->add('allow_skills_tool', 'yes_no') ; } } diff --git a/src/ChamiloLMS/CoreBundle/Settings/SocialSettingsSchema.php b/src/ChamiloLMS/CoreBundle/Settings/SocialSettingsSchema.php index c7c3df2880..c279a50b7d 100644 --- a/src/ChamiloLMS/CoreBundle/Settings/SocialSettingsSchema.php +++ b/src/ChamiloLMS/CoreBundle/Settings/SocialSettingsSchema.php @@ -13,11 +13,12 @@ class SocialSettingsSchema implements SchemaInterface $builder ->setDefaults(array( 'allow_social_tool' => '', - allow_students_to_create_groups_in_social + 'allow_students_to_create_groups_in_social' => '' )) ->setAllowedTypes(array( - 'allow_social_tool' => array('string') + 'allow_social_tool' => array('string'), + 'allow_students_to_create_groups_in_social' => array('string') )) ; } @@ -25,7 +26,8 @@ class SocialSettingsSchema implements SchemaInterface public function buildForm(FormBuilderInterface $builder) { $builder - ->add('allow_social_tool') + ->add('allow_social_tool', 'yes_no') + ->add('allow_students_to_create_groups_in_social', 'yes_no') ; } } diff --git a/src/ChamiloLMS/CoreBundle/Settings/SurveySettingsSchema.php b/src/ChamiloLMS/CoreBundle/Settings/SurveySettingsSchema.php index 7cbf80e0e9..be2dc04c08 100644 --- a/src/ChamiloLMS/CoreBundle/Settings/SurveySettingsSchema.php +++ b/src/ChamiloLMS/CoreBundle/Settings/SurveySettingsSchema.php @@ -6,14 +6,14 @@ use Sylius\Bundle\SettingsBundle\Schema\SchemaInterface; use Sylius\Bundle\SettingsBundle\Schema\SettingsBuilderInterface; use Symfony\Component\Form\FormBuilderInterface; -class CourseSettingsSchema implements SchemaInterface +class SurveySettingsSchema implements SchemaInterface { public function buildSettings(SettingsBuilderInterface $builder) { $builder ->setDefaults(array( 'survey_email_sender_noreply' => '', - extend_rights_for_coach_on_survey + 'extend_rights_for_coach_on_survey' => '' )) ->setAllowedTypes(array( @@ -25,7 +25,17 @@ class CourseSettingsSchema implements SchemaInterface public function buildForm(FormBuilderInterface $builder) { $builder - ->add('survey_email_sender_noreply') + ->add( + 'survey_email_sender_noreply', + 'choice', + array( + 'choices' => array( + 'coach' => 'Coach email address', + 'noreply' => 'No reply address' + ) + ) + ) + ->add('extend_rights_for_coach_on_survey', 'yes_no') ; } } diff --git a/src/ChamiloLMS/CoreBundle/Settings/TrackingSettingsSchema.php b/src/ChamiloLMS/CoreBundle/Settings/TrackingSettingsSchema.php index d58a88578d..3debdf1ca7 100644 --- a/src/ChamiloLMS/CoreBundle/Settings/TrackingSettingsSchema.php +++ b/src/ChamiloLMS/CoreBundle/Settings/TrackingSettingsSchema.php @@ -13,11 +13,12 @@ class TrackingSettingsSchema implements SchemaInterface $builder ->setDefaults(array( 'header_extra_content' => '', - footer_extra_content + 'footer_extra_content' => '' )) ->setAllowedTypes(array( - 'allow_personal_agenda' => array('string') + 'header_extra_content' => array('string'), + 'footer_extra_content' => array('string') )) ; } @@ -25,7 +26,8 @@ class TrackingSettingsSchema implements SchemaInterface public function buildForm(FormBuilderInterface $builder) { $builder - ->add('allow_personal_agenda') + ->add('header_extra_content', 'textarea') + ->add('footer_extra_content', 'textarea') ; } } diff --git a/src/ChamiloLMS/InstallerBundle/Form/Type/Setup/PortalType.php b/src/ChamiloLMS/InstallerBundle/Form/Type/Setup/PortalType.php index f76961238f..e311b95ae6 100644 --- a/src/ChamiloLMS/InstallerBundle/Form/Type/Setup/PortalType.php +++ b/src/ChamiloLMS/InstallerBundle/Form/Type/Setup/PortalType.php @@ -13,10 +13,10 @@ class PortalType extends AbstractType { $builder ->add( - 'portal_name', + 'institution', 'text', array( - 'label' => 'form.setup.portal.portal_name', + 'label' => 'form.setup.portal.institution', 'mapped' => false, 'constraints' => array( new Assert\NotBlank(), @@ -25,19 +25,19 @@ class PortalType extends AbstractType ) ) ->add( - 'company_title', + 'site_name', 'text', array( - 'label' => 'form.setup.portal.company_title', + 'label' => 'form.setup.portal.site_name', 'mapped' => false, 'required' => false, ) ) ->add( - 'company_url', + 'institution_url', 'url', array( - 'label' => 'form.setup.portal.company_url', + 'label' => 'form.setup.portal.institution_url', 'mapped' => false, 'required' => false, ) @@ -69,7 +69,18 @@ class PortalType extends AbstractType '0' => 'No', ), ) + ) + ->add( + 'timezone', + 'timezone', + array( + 'label' => 'form.setup.portal.timezone', + 'mapped' => false, + 'required' => false, + 'preferred_choices' => array('Europe/Paris'), + ) ); + } /** diff --git a/src/ChamiloLMS/InstallerBundle/Process/Step/SetupStep.php b/src/ChamiloLMS/InstallerBundle/Process/Step/SetupStep.php index 998eaf9fe3..2caeb06f02 100644 --- a/src/ChamiloLMS/InstallerBundle/Process/Step/SetupStep.php +++ b/src/ChamiloLMS/InstallerBundle/Process/Step/SetupStep.php @@ -12,17 +12,26 @@ class SetupStep extends AbstractStep { public function displayAction(ProcessContextInterface $context) { - $form = $this->createForm('chamilo_installer_setup'); + //$form = $this->createForm('chamilo_installer_setup'); + $form = $this->createSetupForm(); + + /** @var SettingsManager $settingsManager */ + $settingsManager = $this->get('sylius.settings.manager'); + $settings = $settingsManager->loadSettings('platform'); /** @var ConfigManager $configManager */ //$configManager = $this->get('oro_config.global'); - //$form->get('company_name')->setData($configManager->get('oro_ui.application_name')); - //$form->get('company_title')->setData($configManager->get('oro_ui.application_title')); + $form->get('portal')->get('institution')->setData($settings->get('institution')); + $form->get('portal')->get('institution_url')->setData($settings->get('institution_url')); + $form->get('portal')->get('site_name')->setData($settings->get('site_name')); + $date = new \DateTime(); + $timezone = $date->getTimezone(); + $form->get('portal')->get('timezone')->setData($timezone->getName()); return $this->render( 'ChamiloLMSInstallerBundle:Process/Step:setup.html.twig', array( - 'form' => $this->createSetupForm()->createView() + 'form' => $form->createView() ) ); } @@ -62,9 +71,10 @@ class SetupStep extends AbstractStep 'institution_url' => $form->get('portal')->get('institution_url')->getData(), 'site_name' => $form->get('portal')->get('site_name')->getData(), 'administrator_email' => $adminUser->getEmail(), - 'administrator_name' => $adminUser->getName(), + 'administrator_name' => $adminUser->getFirstName(), 'administrator_surname' => $adminUser->getLastName(), - 'administrator_phone' => $adminUser->getPhone() + 'administrator_phone' => $adminUser->getPhone(), + 'timezone' => $form->get('portal')->get('timezone')->getData(), ); $settings->setParameters($parameters); diff --git a/src/ChamiloLMS/InstallerBundle/Resources/translations/messages.en.yml b/src/ChamiloLMS/InstallerBundle/Resources/translations/messages.en.yml index 4391e45049..3d1f485f26 100644 --- a/src/ChamiloLMS/InstallerBundle/Resources/translations/messages.en.yml +++ b/src/ChamiloLMS/InstallerBundle/Resources/translations/messages.en.yml @@ -55,6 +55,7 @@ form: company_url: Company URL allow_self_registration_as_trainer: Allow self-registration as a trainer allow_self_registration: Allow self-registration + timezone: Timezone load_fixtures: Load Sample Data diff --git a/src/ChamiloLMS/InstallerBundle/Resources/views/Process/Step/installation.html.twig b/src/ChamiloLMS/InstallerBundle/Resources/views/Process/Step/installation.html.twig index 4380d55570..cc407491a2 100644 --- a/src/ChamiloLMS/InstallerBundle/Resources/views/Process/Step/installation.html.twig +++ b/src/ChamiloLMS/InstallerBundle/Resources/views/Process/Step/installation.html.twig @@ -1,6 +1,6 @@ {% extends 'ChamiloLMSInstallerBundle::layout.html.twig' %} {#{% set step, platformSteps = 'administration', ['navigation', 'js-routing', 'localization', 'assets', 'assetic', 'translation', 'requirejs'] %}#} -{% set step, platformSteps = 'administration', [ 'assets', 'assetic', 'fixtures' ] %} +{% set step, platformSteps = 'installation', [ 'assets', 'assetic', 'fixtures' ] %} {% use 'ChamiloLMSInstallerBundle::progress.html.twig' %} {% if loadFixtures %} @@ -28,8 +28,8 @@

{{ 'process.step.installation.header'|trans }}

-
- +
+
diff --git a/src/ChamiloLMS/InstallerBundle/Resources/views/Process/Step/schema.html.twig b/src/ChamiloLMS/InstallerBundle/Resources/views/Process/Step/schema.html.twig index c55bb54626..02a279fe64 100644 --- a/src/ChamiloLMS/InstallerBundle/Resources/views/Process/Step/schema.html.twig +++ b/src/ChamiloLMS/InstallerBundle/Resources/views/Process/Step/schema.html.twig @@ -13,7 +13,6 @@

{{ 'process.step.schema.header'|trans }}

-