parent
e87f25fbb3
commit
1aba0054c1
@ -0,0 +1,22 @@ |
||||
|
||||
{% from 'SyliusResourceBundle:Macros:actions.html.twig' import update %} |
||||
|
||||
{% block topbar %} |
||||
<ol class="breadcrumb"> |
||||
<li>{{ 'sylius.breadcrumb.configuration'|trans }}</li> |
||||
<li>{{ 'sylius.breadcrumb.general_settings'|trans }}</li> |
||||
</ol> |
||||
{% endblock %} |
||||
|
||||
{% block content %} |
||||
<div class="page-header"> |
||||
<h1><i class="glyphicon glyphicon-info-sign"></i> {{ 'sylius.settings.general_header'|trans|raw }}</h1> |
||||
</div> |
||||
|
||||
{{ form_errors(form) }} |
||||
|
||||
<form action="{{ path('chamilolms_corebundle_platform_settings') }}" method="post" class="form-horizontal" novalidate> |
||||
{{ form_rest(form) }} |
||||
{{ update() }} |
||||
</form> |
||||
{% endblock %} |
||||
@ -0,0 +1,33 @@ |
||||
<?php |
||||
|
||||
namespace ChamiloLMS\CoreBundle\Settings; |
||||
|
||||
use Sylius\Bundle\SettingsBundle\Schema\SchemaInterface; |
||||
use Sylius\Bundle\SettingsBundle\Schema\SettingsBuilderInterface; |
||||
use Symfony\Component\Form\FormBuilderInterface; |
||||
|
||||
class CourseSettingsSchema implements SchemaInterface |
||||
{ |
||||
public function buildSettings(SettingsBuilderInterface $builder) |
||||
{ |
||||
$builder |
||||
->setDefaults(array( |
||||
'allow_personal_agenda' => '', |
||||
'display_mini_month_calendar' => '', |
||||
'display_upcoming_events' => '', |
||||
'number_of_upcoming_events' => '', |
||||
'default_calendar_view' => '', |
||||
)) |
||||
->setAllowedTypes(array( |
||||
'allow_personal_agenda' => array('string') |
||||
)) |
||||
; |
||||
} |
||||
|
||||
public function buildForm(FormBuilderInterface $builder) |
||||
{ |
||||
$builder |
||||
->add('allow_personal_agenda') |
||||
; |
||||
} |
||||
} |
||||
@ -0,0 +1,31 @@ |
||||
<?php |
||||
|
||||
namespace ChamiloLMS\CoreBundle\Settings; |
||||
|
||||
use Sylius\Bundle\SettingsBundle\Schema\SchemaInterface; |
||||
use Sylius\Bundle\SettingsBundle\Schema\SettingsBuilderInterface; |
||||
use Symfony\Component\Form\FormBuilderInterface; |
||||
|
||||
class CourseSettingsSchema implements SchemaInterface |
||||
{ |
||||
public function buildSettings(SettingsBuilderInterface $builder) |
||||
{ |
||||
$builder |
||||
->setDefaults(array( |
||||
'show_chat_folder' => '', |
||||
'allow_global_chat' => '', |
||||
|
||||
)) |
||||
->setAllowedTypes(array( |
||||
'allow_personal_agenda' => array('string') |
||||
)) |
||||
; |
||||
} |
||||
|
||||
public function buildForm(FormBuilderInterface $builder) |
||||
{ |
||||
$builder |
||||
->add('allow_personal_agenda') |
||||
; |
||||
} |
||||
} |
||||
@ -0,0 +1,59 @@ |
||||
<?php |
||||
|
||||
namespace ChamiloLMS\CoreBundle\Settings; |
||||
|
||||
use Sylius\Bundle\SettingsBundle\Schema\SchemaInterface; |
||||
use Sylius\Bundle\SettingsBundle\Schema\SettingsBuilderInterface; |
||||
use Symfony\Component\Form\FormBuilderInterface; |
||||
|
||||
class CourseSettingsSchema implements SchemaInterface |
||||
{ |
||||
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 |
||||
'display_coursecode_in_courselist' => '', |
||||
'display_teacher_in_courselist' => '', |
||||
'student_view_enabled' => '', |
||||
'go_to_course_after_login' => '', |
||||
'show_navigation_menu' => '', |
||||
'enable_tool_introduction' => '', |
||||
'breadcrumbs_course_homepage' => '', |
||||
'example_material_course_creation' => '', |
||||
'allow_course_theme' => '', |
||||
'allow_users_to_create_courses' => '', |
||||
'show_courses_descriptions_in_catalog' => '', |
||||
'send_email_to_admin_when_create_course' => '', |
||||
'allow_user_course_subscription_by_course_admin' => '', |
||||
'course_validation' => '', |
||||
'course_validation_terms_and_conditions_url' => '', |
||||
'course_hide_tools' => '', |
||||
'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'), |
||||
'display_coursecode_in_courselist' => array('string'), |
||||
'display_teacher_in_courselist' => array('string'), |
||||
'student_view_enabled' => array('string'), |
||||
)) |
||||
; |
||||
} |
||||
|
||||
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') |
||||
; |
||||
} |
||||
} |
||||
@ -0,0 +1,68 @@ |
||||
<?php |
||||
|
||||
namespace ChamiloLMS\CoreBundle\Settings; |
||||
|
||||
use Sylius\Bundle\SettingsBundle\Schema\SchemaInterface; |
||||
use Sylius\Bundle\SettingsBundle\Schema\SettingsBuilderInterface; |
||||
use Symfony\Component\Form\FormBuilderInterface; |
||||
|
||||
class DisplaySettingsSchema implements SchemaInterface |
||||
{ |
||||
public function buildSettings(SettingsBuilderInterface $builder) |
||||
{ |
||||
$builder |
||||
->setDefaults(array( |
||||
'enable_help_link' => '', |
||||
'show_administrator_data' => '', |
||||
'show_tutor_data' => '', |
||||
'show_teacher_data' => '', |
||||
'showonline' => '', |
||||
'allow_user_headings' => '', |
||||
'time_limit_whosonline' => '', |
||||
'allow_email_editor' => '', |
||||
'show_email_addresses' => '', |
||||
'show_number_of_courses' => '', |
||||
'show_empty_course_categories' => '', |
||||
'show_back_link_on_top_of_tree' => '', |
||||
'show_different_course_language' => '', |
||||
'display_categories_on_homepage' => '', |
||||
'show_closed_courses' => '', |
||||
'allow_students_to_browse_courses' => '', |
||||
'show_link_bug_notification' => '', |
||||
'accessibility_font_resize' => '', |
||||
'show_admin_toolbar' => '', |
||||
'show_hot_courses' => '', |
||||
'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'), |
||||
)) |
||||
; |
||||
} |
||||
|
||||
public function buildForm(FormBuilderInterface $builder) |
||||
{ |
||||
$builder |
||||
->add('enable_help_link', 'choice', array('choices' => |
||||
array('true' => 'Yes', 'no' => 'No')) |
||||
) |
||||
->add('show_administrator_data') |
||||
->add('show_tutor_data') |
||||
->add('show_teacher_data') |
||||
->add('showonline') |
||||
->add('allow_user_headings') |
||||
; |
||||
} |
||||
} |
||||
@ -0,0 +1,59 @@ |
||||
<?php |
||||
|
||||
namespace ChamiloLMS\CoreBundle\Settings; |
||||
|
||||
use Sylius\Bundle\SettingsBundle\Schema\SchemaInterface; |
||||
use Sylius\Bundle\SettingsBundle\Schema\SettingsBuilderInterface; |
||||
use Symfony\Component\Form\FormBuilderInterface; |
||||
|
||||
class DocumentSettingsSchema implements SchemaInterface |
||||
{ |
||||
public function buildSettings(SettingsBuilderInterface $builder) |
||||
{ |
||||
$builder |
||||
->setDefaults(array( |
||||
'default_document_quotum' => '', |
||||
'default_group_quotum' => '', |
||||
'permanently_remove_deleted_files' => '', |
||||
'upload_extensions_list_type' => '', |
||||
'upload_extensions_blacklist' => '', |
||||
'upload_extensions_whitelist' => '', |
||||
'upload_extensions_skip' => '', |
||||
'upload_extensions_replace_by' => '', |
||||
'permissions_for_new_directories' => '', |
||||
'permissions_for_new_files' => '', |
||||
'show_glossary_in_documents' => '', |
||||
'students_download_folders' => '', |
||||
'users_copy_files' => '', |
||||
'pdf_export_watermark_enable' => '', |
||||
'pdf_export_watermark_by_course' => '', |
||||
'pdf_export_watermark_text' => '', |
||||
'students_export2pdf' => '', |
||||
'show_users_folders' => '', |
||||
'show_default_folders' => '', |
||||
'enabled_text2audio' => '', |
||||
'enable_nanogong' => '', |
||||
'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' => '', |
||||
)) |
||||
->setAllowedTypes(array( |
||||
'default_document_quotum' => array('string'), |
||||
'default_group_quotum' => array('string'), |
||||
'permanently_remove_deleted_files' => array('string'), |
||||
)) |
||||
; |
||||
} |
||||
|
||||
public function buildForm(FormBuilderInterface $builder) |
||||
{ |
||||
$builder |
||||
->add('default_document_quotum') |
||||
->add('default_group_quotum') |
||||
->add('permanently_remove_deleted_files') |
||||
; |
||||
} |
||||
} |
||||
@ -0,0 +1,35 @@ |
||||
<?php |
||||
|
||||
namespace ChamiloLMS\CoreBundle\Settings; |
||||
|
||||
use Sylius\Bundle\SettingsBundle\Schema\SchemaInterface; |
||||
use Sylius\Bundle\SettingsBundle\Schema\SettingsBuilderInterface; |
||||
use Symfony\Component\Form\FormBuilderInterface; |
||||
|
||||
class DropboxSettingsSchema implements SchemaInterface |
||||
{ |
||||
public function buildSettings(SettingsBuilderInterface $builder) |
||||
{ |
||||
$builder |
||||
->setDefaults(array( |
||||
'dropbox_allow_overwrite' => '', |
||||
'dropbox_max_filesize' => '', |
||||
'dropbox_allow_just_upload' => '', |
||||
'dropbox_allow_student_to_student' => '', |
||||
'dropbox_allow_group' => '', |
||||
'dropbox_allow_mailing' => '', |
||||
|
||||
)) |
||||
->setAllowedTypes(array( |
||||
'dropbox_allow_overwrite' => array('string') |
||||
)) |
||||
; |
||||
} |
||||
|
||||
public function buildForm(FormBuilderInterface $builder) |
||||
{ |
||||
$builder |
||||
->add('dropbox_allow_overwrite') |
||||
; |
||||
} |
||||
} |
||||
@ -0,0 +1,45 @@ |
||||
<?php |
||||
|
||||
namespace ChamiloLMS\CoreBundle\Settings; |
||||
|
||||
use Sylius\Bundle\SettingsBundle\Schema\SchemaInterface; |
||||
use Sylius\Bundle\SettingsBundle\Schema\SettingsBuilderInterface; |
||||
use Symfony\Component\Form\FormBuilderInterface; |
||||
|
||||
class CourseSettingsSchema implements SchemaInterface |
||||
{ |
||||
public function buildSettings(SettingsBuilderInterface $builder) |
||||
{ |
||||
$builder |
||||
->setDefaults(array( |
||||
'math_mimetex' => '', |
||||
'math_asciimathML' => '', |
||||
'enabled_asciisvg' => '', |
||||
'include_asciimathml_script' => '', |
||||
'youtube_for_students' => '', |
||||
'block_copy_paste_for_students' => '', |
||||
'more_buttons_maximized_mode' => '', |
||||
'enabled_wiris' => '', |
||||
'allow_spellcheck' => '', |
||||
'force_wiki_paste_as_plain_text' => '', |
||||
'enabled_googlemaps' => '', |
||||
'enabled_imgmap' => '', |
||||
'enabled_support_svg' => '', |
||||
'enabled_insertHtml' => '', |
||||
'enabled_support_pixlr' => '', |
||||
'htmlpurifier_wiki' => '', |
||||
'enable_iframe_inclusion' => '', |
||||
)) |
||||
->setAllowedTypes(array( |
||||
'allow_personal_agenda' => array('string') |
||||
)) |
||||
; |
||||
} |
||||
|
||||
public function buildForm(FormBuilderInterface $builder) |
||||
{ |
||||
$builder |
||||
->add('allow_personal_agenda') |
||||
; |
||||
} |
||||
} |
||||
@ -0,0 +1,40 @@ |
||||
<?php |
||||
|
||||
namespace ChamiloLMS\CoreBundle\Settings; |
||||
|
||||
use Sylius\Bundle\SettingsBundle\Schema\SchemaInterface; |
||||
use Sylius\Bundle\SettingsBundle\Schema\SettingsBuilderInterface; |
||||
use Symfony\Component\Form\FormBuilderInterface; |
||||
|
||||
class CourseSettingsSchema implements SchemaInterface |
||||
{ |
||||
public function buildSettings(SettingsBuilderInterface $builder) |
||||
{ |
||||
$builder |
||||
->setDefaults(array( |
||||
'exercise_min_score' => '', |
||||
'exercise_max_score' => '', |
||||
'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'), |
||||
)) |
||||
; |
||||
} |
||||
|
||||
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') |
||||
; |
||||
} |
||||
} |
||||
@ -0,0 +1,29 @@ |
||||
<?php |
||||
|
||||
namespace ChamiloLMS\CoreBundle\Settings; |
||||
|
||||
use Sylius\Bundle\SettingsBundle\Schema\SchemaInterface; |
||||
use Sylius\Bundle\SettingsBundle\Schema\SettingsBuilderInterface; |
||||
use Symfony\Component\Form\FormBuilderInterface; |
||||
|
||||
class ForumSettingsSchema implements SchemaInterface |
||||
{ |
||||
public function buildSettings(SettingsBuilderInterface $builder) |
||||
{ |
||||
$builder |
||||
->setDefaults(array( |
||||
'default_forum_view' => '', |
||||
)) |
||||
->setAllowedTypes(array( |
||||
'default_forum_view' => array('string') |
||||
)) |
||||
; |
||||
} |
||||
|
||||
public function buildForm(FormBuilderInterface $builder) |
||||
{ |
||||
$builder |
||||
->add('default_forum_view') |
||||
; |
||||
} |
||||
} |
||||
@ -0,0 +1,33 @@ |
||||
<?php |
||||
|
||||
namespace ChamiloLMS\CoreBundle\Settings; |
||||
|
||||
use Sylius\Bundle\SettingsBundle\Schema\SchemaInterface; |
||||
use Sylius\Bundle\SettingsBundle\Schema\SettingsBuilderInterface; |
||||
use Symfony\Component\Form\FormBuilderInterface; |
||||
|
||||
class DisplaySettingsSchema implements SchemaInterface |
||||
{ |
||||
public function buildSettings(SettingsBuilderInterface $builder) |
||||
{ |
||||
$builder |
||||
->setDefaults(array( |
||||
'show_glossary_in_extra_tools' |
||||
|
||||
)) |
||||
->setAllowedTypes(array( |
||||
'show_glossary_in_extra_tools' => array('string'), |
||||
|
||||
)) |
||||
; |
||||
} |
||||
|
||||
public function buildForm(FormBuilderInterface $builder) |
||||
{ |
||||
$builder |
||||
->add('enable_help_link', 'choice', array('choices' => |
||||
array('true' => 'Yes', 'no' => 'No')) |
||||
); |
||||
|
||||
} |
||||
} |
||||
@ -0,0 +1,42 @@ |
||||
<?php |
||||
|
||||
namespace ChamiloLMS\CoreBundle\Settings; |
||||
|
||||
use Sylius\Bundle\SettingsBundle\Schema\SchemaInterface; |
||||
use Sylius\Bundle\SettingsBundle\Schema\SettingsBuilderInterface; |
||||
use Symfony\Component\Form\FormBuilderInterface; |
||||
|
||||
class GradebookSettingsSchema implements SchemaInterface |
||||
{ |
||||
public function buildSettings(SettingsBuilderInterface $builder) |
||||
{ |
||||
$builder |
||||
->setDefaults(array( |
||||
'gradebook_enable' => '', |
||||
'gradebook_score_display_coloring' => '', |
||||
'gradebook_score_display_custom' => '', |
||||
'gradebook_score_display_colorspl' => '', |
||||
'gradebook_score_display_upperlim' => '', |
||||
'gradebook_number_decimals' => '', |
||||
'allow_hr_skills_management' => '', |
||||
'teachers_can_change_score_settin' => '', |
||||
'gradebook_enable_grade_model' => '', |
||||
'teachers_can_change_grade_model_' => '', |
||||
'gradebook_default_weight' => '', |
||||
'gradebook_locking_enabled' => '', |
||||
'gradebook_default_grade_model_id' => '', |
||||
'gradebook_show_percentage_in_rep' => '' |
||||
)) |
||||
->setAllowedTypes(array( |
||||
'gradebook_enable' => array('string') |
||||
)) |
||||
; |
||||
} |
||||
|
||||
public function buildForm(FormBuilderInterface $builder) |
||||
{ |
||||
$builder |
||||
->add('gradebook_enable') |
||||
; |
||||
} |
||||
} |
||||
@ -0,0 +1,31 @@ |
||||
<?php |
||||
|
||||
namespace ChamiloLMS\CoreBundle\Settings; |
||||
|
||||
use Sylius\Bundle\SettingsBundle\Schema\SchemaInterface; |
||||
use Sylius\Bundle\SettingsBundle\Schema\SettingsBuilderInterface; |
||||
use Symfony\Component\Form\FormBuilderInterface; |
||||
|
||||
class GroupSettingsSchema implements SchemaInterface |
||||
{ |
||||
public function buildSettings(SettingsBuilderInterface $builder) |
||||
{ |
||||
$builder |
||||
->setDefaults(array( |
||||
'allow_group_categories' => '' |
||||
)) |
||||
->setAllowedTypes(array( |
||||
'allow_group_categories' => array('string'), |
||||
)) |
||||
; |
||||
} |
||||
|
||||
public function buildForm(FormBuilderInterface $builder) |
||||
{ |
||||
$builder |
||||
->add('allow_group_categories', 'choice', array('choices' => |
||||
array('true' => 'Yes', 'no' => 'No')) |
||||
) |
||||
; |
||||
} |
||||
} |
||||
@ -0,0 +1,31 @@ |
||||
<?php |
||||
|
||||
namespace ChamiloLMS\CoreBundle\Settings; |
||||
|
||||
use Sylius\Bundle\SettingsBundle\Schema\SchemaInterface; |
||||
use Sylius\Bundle\SettingsBundle\Schema\SettingsBuilderInterface; |
||||
use Symfony\Component\Form\FormBuilderInterface; |
||||
|
||||
class MailSettingsSchema implements SchemaInterface |
||||
{ |
||||
public function buildSettings(SettingsBuilderInterface $builder) |
||||
{ |
||||
$builder |
||||
->setDefaults(array( |
||||
'noreply_email_address' => '', |
||||
activate_email_template |
||||
|
||||
)) |
||||
->setAllowedTypes(array( |
||||
'noreply_email_address' => array('string') |
||||
)) |
||||
; |
||||
} |
||||
|
||||
public function buildForm(FormBuilderInterface $builder) |
||||
{ |
||||
$builder |
||||
->add('noreply_email_address', 'email') |
||||
; |
||||
} |
||||
} |
||||
@ -0,0 +1,32 @@ |
||||
<?php |
||||
|
||||
namespace ChamiloLMS\CoreBundle\Settings; |
||||
|
||||
use Sylius\Bundle\SettingsBundle\Schema\SchemaInterface; |
||||
use Sylius\Bundle\SettingsBundle\Schema\SettingsBuilderInterface; |
||||
use Symfony\Component\Form\FormBuilderInterface; |
||||
|
||||
class CourseSettingsSchema implements SchemaInterface |
||||
{ |
||||
public function buildSettings(SettingsBuilderInterface $builder) |
||||
{ |
||||
$builder |
||||
->setDefaults(array( |
||||
'allow_message_tool' => '', |
||||
'allow_send_message_to_all_platform_users' => '', |
||||
'message_max_upload_filesize' => '', |
||||
|
||||
)) |
||||
->setAllowedTypes(array( |
||||
'allow_personal_agenda' => array('string') |
||||
)) |
||||
; |
||||
} |
||||
|
||||
public function buildForm(FormBuilderInterface $builder) |
||||
{ |
||||
$builder |
||||
->add('allow_personal_agenda') |
||||
; |
||||
} |
||||
} |
||||
@ -0,0 +1,42 @@ |
||||
<?php |
||||
|
||||
namespace ChamiloLMS\CoreBundle\Settings; |
||||
|
||||
use Sylius\Bundle\SettingsBundle\Schema\SchemaInterface; |
||||
use Sylius\Bundle\SettingsBundle\Schema\SettingsBuilderInterface; |
||||
use Symfony\Component\Form\FormBuilderInterface; |
||||
|
||||
class ProfileSettingsSchema implements SchemaInterface |
||||
{ |
||||
public function buildSettings(SettingsBuilderInterface $builder) |
||||
{ |
||||
$builder |
||||
->setDefaults(array( |
||||
'profile' => '', // name, officialcode, email, picture, login, password, language, phone openid, theme apikeys |
||||
'extended_profile' => '', |
||||
'account_valid_duration' => '', |
||||
'split_users_upload_directory' => '', |
||||
'user_selected_theme' => '', |
||||
'use_users_timezone' => '', |
||||
'allow_users_to_change_email_with_no_password' => '', |
||||
'login_is_email' => '', |
||||
|
||||
|
||||
)) |
||||
->setAllowedTypes(array( |
||||
'profile' => array('string') |
||||
)) |
||||
; |
||||
} |
||||
|
||||
public function buildForm(FormBuilderInterface $builder) |
||||
{ |
||||
$builder |
||||
->add('profile') |
||||
|
||||
/*->add('enable_help_link', 'choice', array('choices' => |
||||
array('true' => 'Yes', 'no' => 'No')) |
||||
)*/ |
||||
; |
||||
} |
||||
} |
||||
@ -0,0 +1,55 @@ |
||||
<?php |
||||
|
||||
namespace ChamiloLMS\CoreBundle\Settings; |
||||
|
||||
use Sylius\Bundle\SettingsBundle\Schema\SchemaInterface; |
||||
use Sylius\Bundle\SettingsBundle\Schema\SettingsBuilderInterface; |
||||
use Symfony\Component\Form\FormBuilderInterface; |
||||
|
||||
class CourseSettingsSchema implements SchemaInterface |
||||
{ |
||||
public function buildSettings(SettingsBuilderInterface $builder) |
||||
{ |
||||
$builder |
||||
->setDefaults(array( |
||||
'registration' => '', //officialcode, email, language, phone |
||||
'allow_registration' =>'' , |
||||
'allow_registration_as_teacher' => '', |
||||
'allow_lostpassword' => '', |
||||
'page_after_login' => '', |
||||
'extendedprofile_registration' => '', |
||||
'allow_terms_conditions' => '', |
||||
'student_page_after_login' => '', |
||||
'teacher_page_after_login' => '', |
||||
'drh_page_after_login' => '', |
||||
'sessionadmin_page_after_login' => '', |
||||
'student_autosubscribe' => '', |
||||
'teacher_autosubscribe' => '', |
||||
'drh_autosubscribe' => '', |
||||
'sessionadmin_autosubscribe' => '', |
||||
'platform_unsubscribe_allowed' => '', |
||||
)) |
||||
->setAllowedTypes(array( |
||||
'registration' => array('string'), |
||||
'allow_registration' => array('string'), |
||||
'allow_registration_as_teacher' => array('string'), |
||||
'allow_lostpassword' => array('string'), |
||||
)) |
||||
; |
||||
} |
||||
|
||||
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')) |
||||
)*/ |
||||
; |
||||
} |
||||
} |
||||
@ -0,0 +1,33 @@ |
||||
<?php |
||||
|
||||
namespace ChamiloLMS\CoreBundle\Settings; |
||||
|
||||
use Sylius\Bundle\SettingsBundle\Schema\SchemaInterface; |
||||
use Sylius\Bundle\SettingsBundle\Schema\SettingsBuilderInterface; |
||||
use Symfony\Component\Form\FormBuilderInterface; |
||||
|
||||
class CourseSettingsSchema implements SchemaInterface |
||||
{ |
||||
public function buildSettings(SettingsBuilderInterface $builder) |
||||
{ |
||||
$builder |
||||
->setDefaults(array( |
||||
'search_enabled' => '', |
||||
'search_prefilter_prefix' => '', |
||||
'search_show_unlinked_results' => '', |
||||
'number_of_upcoming_events' => '', |
||||
|
||||
)) |
||||
->setAllowedTypes(array( |
||||
'allow_personal_agenda' => array('string') |
||||
)) |
||||
; |
||||
} |
||||
|
||||
public function buildForm(FormBuilderInterface $builder) |
||||
{ |
||||
$builder |
||||
->add('allow_personal_agenda') |
||||
; |
||||
} |
||||
} |
||||
@ -0,0 +1,40 @@ |
||||
<?php |
||||
|
||||
namespace ChamiloLMS\CoreBundle\Settings; |
||||
|
||||
use Sylius\Bundle\SettingsBundle\Schema\SchemaInterface; |
||||
use Sylius\Bundle\SettingsBundle\Schema\SettingsBuilderInterface; |
||||
use Symfony\Component\Form\FormBuilderInterface; |
||||
|
||||
class SecuritySettingsSchema implements SchemaInterface |
||||
{ |
||||
public function buildSettings(SettingsBuilderInterface $builder) |
||||
{ |
||||
$builder |
||||
->setDefaults(array( |
||||
'filter_terms' => '', |
||||
'allow_browser_sniffer' => '', |
||||
'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'), |
||||
)) |
||||
; |
||||
} |
||||
|
||||
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') |
||||
; |
||||
} |
||||
} |
||||
@ -0,0 +1,39 @@ |
||||
<?php |
||||
|
||||
namespace ChamiloLMS\CoreBundle\Settings; |
||||
|
||||
use Sylius\Bundle\SettingsBundle\Schema\SchemaInterface; |
||||
use Sylius\Bundle\SettingsBundle\Schema\SettingsBuilderInterface; |
||||
use Symfony\Component\Form\FormBuilderInterface; |
||||
|
||||
class SessionSettingsSchema implements SchemaInterface |
||||
{ |
||||
public function buildSettings(SettingsBuilderInterface $builder) |
||||
{ |
||||
$builder |
||||
->setDefaults(array( |
||||
'add_users_by_coach' => '', |
||||
'extend_rights_for_coach' => '', |
||||
'show_session_coach' => '', |
||||
'show_session_data' => '', |
||||
'allow_coach_to_edit_course_session' => '', |
||||
'show_groups_to_users' => '', |
||||
'hide_courses_in_sessions' => '', |
||||
'allow_session_admins_to_manage_all_sessions' => '', |
||||
'session_tutor_reports_visibility' => '', |
||||
'session_page_enabled' => '', |
||||
'allow_teachers_to_create_sessions' => '', |
||||
)) |
||||
->setAllowedTypes(array( |
||||
'add_users_by_coach' => array('string') |
||||
)) |
||||
; |
||||
} |
||||
|
||||
public function buildForm(FormBuilderInterface $builder) |
||||
{ |
||||
$builder |
||||
->add('add_users_by_coach') |
||||
; |
||||
} |
||||
} |
||||
@ -0,0 +1,33 @@ |
||||
<?php |
||||
|
||||
namespace ChamiloLMS\CoreBundle\Settings; |
||||
|
||||
use Sylius\Bundle\SettingsBundle\Schema\SchemaInterface; |
||||
use Sylius\Bundle\SettingsBundle\Schema\SettingsBuilderInterface; |
||||
use Symfony\Component\Form\FormBuilderInterface; |
||||
|
||||
class SkillSettingsSchema implements SchemaInterface |
||||
{ |
||||
public function buildSettings(SettingsBuilderInterface $builder) |
||||
{ |
||||
$builder |
||||
->setDefaults(array( |
||||
'allow_skills_tool' => '', |
||||
'display_mini_month_calendar' => '', |
||||
'display_upcoming_events' => '', |
||||
'number_of_upcoming_events' => '', |
||||
|
||||
)) |
||||
->setAllowedTypes(array( |
||||
'allow_personal_agenda' => array('string') |
||||
)) |
||||
; |
||||
} |
||||
|
||||
public function buildForm(FormBuilderInterface $builder) |
||||
{ |
||||
$builder |
||||
->add('allow_personal_agenda') |
||||
; |
||||
} |
||||
} |
||||
@ -0,0 +1,31 @@ |
||||
<?php |
||||
|
||||
namespace ChamiloLMS\CoreBundle\Settings; |
||||
|
||||
use Sylius\Bundle\SettingsBundle\Schema\SchemaInterface; |
||||
use Sylius\Bundle\SettingsBundle\Schema\SettingsBuilderInterface; |
||||
use Symfony\Component\Form\FormBuilderInterface; |
||||
|
||||
class SocialSettingsSchema implements SchemaInterface |
||||
{ |
||||
public function buildSettings(SettingsBuilderInterface $builder) |
||||
{ |
||||
$builder |
||||
->setDefaults(array( |
||||
'allow_social_tool' => '', |
||||
allow_students_to_create_groups_in_social |
||||
|
||||
)) |
||||
->setAllowedTypes(array( |
||||
'allow_social_tool' => array('string') |
||||
)) |
||||
; |
||||
} |
||||
|
||||
public function buildForm(FormBuilderInterface $builder) |
||||
{ |
||||
$builder |
||||
->add('allow_social_tool') |
||||
; |
||||
} |
||||
} |
||||
@ -0,0 +1,31 @@ |
||||
<?php |
||||
|
||||
namespace ChamiloLMS\CoreBundle\Settings; |
||||
|
||||
use Sylius\Bundle\SettingsBundle\Schema\SchemaInterface; |
||||
use Sylius\Bundle\SettingsBundle\Schema\SettingsBuilderInterface; |
||||
use Symfony\Component\Form\FormBuilderInterface; |
||||
|
||||
class CourseSettingsSchema implements SchemaInterface |
||||
{ |
||||
public function buildSettings(SettingsBuilderInterface $builder) |
||||
{ |
||||
$builder |
||||
->setDefaults(array( |
||||
'survey_email_sender_noreply' => '', |
||||
extend_rights_for_coach_on_survey |
||||
|
||||
)) |
||||
->setAllowedTypes(array( |
||||
'survey_email_sender_noreply' => array('string') |
||||
)) |
||||
; |
||||
} |
||||
|
||||
public function buildForm(FormBuilderInterface $builder) |
||||
{ |
||||
$builder |
||||
->add('survey_email_sender_noreply') |
||||
; |
||||
} |
||||
} |
||||
@ -0,0 +1,31 @@ |
||||
<?php |
||||
|
||||
namespace ChamiloLMS\CoreBundle\Settings; |
||||
|
||||
use Sylius\Bundle\SettingsBundle\Schema\SchemaInterface; |
||||
use Sylius\Bundle\SettingsBundle\Schema\SettingsBuilderInterface; |
||||
use Symfony\Component\Form\FormBuilderInterface; |
||||
|
||||
class TrackingSettingsSchema implements SchemaInterface |
||||
{ |
||||
public function buildSettings(SettingsBuilderInterface $builder) |
||||
{ |
||||
$builder |
||||
->setDefaults(array( |
||||
'header_extra_content' => '', |
||||
footer_extra_content |
||||
|
||||
)) |
||||
->setAllowedTypes(array( |
||||
'allow_personal_agenda' => array('string') |
||||
)) |
||||
; |
||||
} |
||||
|
||||
public function buildForm(FormBuilderInterface $builder) |
||||
{ |
||||
$builder |
||||
->add('allow_personal_agenda') |
||||
; |
||||
} |
||||
} |
||||
@ -0,0 +1,13 @@ |
||||
<?php |
||||
|
||||
namespace ChamiloLMS\SettingsBundle; |
||||
|
||||
use Symfony\Component\HttpKernel\Bundle\Bundle; |
||||
|
||||
class ChamiloLMSSettingsBundle extends Bundle |
||||
{ |
||||
public function getParent() |
||||
{ |
||||
return 'SyliusSettingsBundle'; |
||||
} |
||||
} |
||||
@ -0,0 +1,25 @@ |
||||
<?php |
||||
|
||||
namespace ChamiloLMS\SettingsBundle\DependencyInjection; |
||||
|
||||
use Symfony\Component\DependencyInjection\ContainerBuilder; |
||||
use Symfony\Component\Config\FileLocator; |
||||
use Symfony\Component\HttpKernel\DependencyInjection\Extension; |
||||
use Symfony\Component\DependencyInjection\Loader; |
||||
|
||||
/** |
||||
* This is the class that loads and manages your bundle configuration |
||||
* |
||||
* To learn more see {@link http://symfony.com/doc/current/cookbook/bundles/extension.html} |
||||
*/ |
||||
class ChamiloLMSSettingsExtension extends Extension |
||||
{ |
||||
/** |
||||
* {@inheritDoc} |
||||
*/ |
||||
public function load(array $configs, ContainerBuilder $container) |
||||
{ |
||||
$loader = new Loader\XmlFileLoader($container, new FileLocator(__DIR__.'/../Resources/config')); |
||||
$loader->load('services.xml'); |
||||
} |
||||
} |
||||
@ -0,0 +1,29 @@ |
||||
<?php |
||||
|
||||
namespace ChamiloLMS\SettingsBundle\DependencyInjection; |
||||
|
||||
use Symfony\Component\Config\Definition\Builder\TreeBuilder; |
||||
use Symfony\Component\Config\Definition\ConfigurationInterface; |
||||
|
||||
/** |
||||
* This is the class that validates and merges configuration from your app/config files |
||||
* |
||||
* To learn more see {@link http://symfony.com/doc/current/cookbook/bundles/extension.html#cookbook-bundles-extension-config-class} |
||||
*/ |
||||
class Configuration implements ConfigurationInterface |
||||
{ |
||||
/** |
||||
* {@inheritDoc} |
||||
*/ |
||||
public function getConfigTreeBuilder() |
||||
{ |
||||
$treeBuilder = new TreeBuilder(); |
||||
$rootNode = $treeBuilder->root('chamilo_lms_settings'); |
||||
|
||||
// Here you should define the parameters that are allowed to |
||||
// configure your bundle. See the documentation linked above for |
||||
// more information on that topic. |
||||
|
||||
return $treeBuilder; |
||||
} |
||||
} |
||||
@ -0,0 +1,140 @@ |
||||
<?php |
||||
|
||||
/* |
||||
* This file is part of the Sylius package. |
||||
* |
||||
* (c) Paweł Jędrzejewski |
||||
* |
||||
* For the full copyright and license information, please view the LICENSE |
||||
* file that was distributed with this source code. |
||||
*/ |
||||
|
||||
namespace ChamiloLMS\SettingsBundle\Manager; |
||||
|
||||
use Doctrine\Common\Cache\Cache; |
||||
use Doctrine\Common\Persistence\ObjectManager; |
||||
use Sylius\Bundle\SettingsBundle\Model\Settings; |
||||
use Sylius\Bundle\SettingsBundle\Schema\SchemaRegistryInterface; |
||||
use Sylius\Bundle\SettingsBundle\Schema\SettingsBuilder; |
||||
use Sylius\Component\Resource\Repository\RepositoryInterface; |
||||
use Symfony\Component\Validator\ConstraintViolationListInterface; |
||||
use Symfony\Component\Validator\Exception\ValidatorException; |
||||
use Symfony\Component\Validator\ValidatorInterface; |
||||
use Sylius\Bundle\SettingsBundle\Manager\SettingsManager as SyliusSessionManager; |
||||
use ChamiloLMS\CoreBundle\Entity\SettingsCurrent; |
||||
|
||||
/** |
||||
* Settings manager. |
||||
* |
||||
* @author Paweł Jędrzejewski <pawel@sylius.org> |
||||
*/ |
||||
class SettingsManager extends SyliusSessionManager |
||||
{ |
||||
/** |
||||
* {@inheritdoc} |
||||
*/ |
||||
public function loadSettings($namespace) |
||||
{ |
||||
if (isset($this->resolvedSettings[$namespace])) { |
||||
return $this->resolvedSettings[$namespace]; |
||||
} |
||||
|
||||
if ($this->cache->contains($namespace)) { |
||||
$parameters = $this->cache->fetch($namespace); |
||||
} else { |
||||
$parameters = $this->getParameters($namespace); |
||||
} |
||||
|
||||
$schema = $this->schemaRegistry->getSchema($namespace); |
||||
|
||||
$settingsBuilder = new SettingsBuilder(); |
||||
$schema->buildSettings($settingsBuilder); |
||||
|
||||
foreach ($settingsBuilder->getTransformers() as $parameter => $transformer) { |
||||
if (array_key_exists($parameter, $parameters)) { |
||||
$parameters[$parameter] = $transformer->reverseTransform($parameters[$parameter]); |
||||
} |
||||
} |
||||
|
||||
$parameters = $settingsBuilder->resolve($parameters); |
||||
|
||||
return $this->resolvedSettings[$namespace] = new Settings($parameters); |
||||
} |
||||
|
||||
/** |
||||
* {@inheritdoc} |
||||
* @throws ValidatorException |
||||
*/ |
||||
public function saveSettings($namespace, Settings $settings) |
||||
{ |
||||
$schema = $this->schemaRegistry->getSchema($namespace); |
||||
|
||||
$settingsBuilder = new SettingsBuilder(); |
||||
$schema->buildSettings($settingsBuilder); |
||||
|
||||
$parameters = $settingsBuilder->resolve($settings->getParameters()); |
||||
|
||||
foreach ($settingsBuilder->getTransformers() as $parameter => $transformer) { |
||||
if (array_key_exists($parameter, $parameters)) { |
||||
$parameters[$parameter] = $transformer->transform($parameters[$parameter]); |
||||
} |
||||
} |
||||
|
||||
if (isset($this->resolvedSettings[$namespace])) { |
||||
$this->resolvedSettings[$namespace]->setParameters($parameters); |
||||
} |
||||
|
||||
$persistedParameters = $this->parameterRepository->findBy(array('category' => $namespace)); |
||||
$persistedParametersMap = array(); |
||||
|
||||
foreach ($persistedParameters as $parameter) { |
||||
$persistedParametersMap[$parameter->getName()] = $parameter; |
||||
} |
||||
|
||||
foreach ($parameters as $name => $value) { |
||||
if (isset($persistedParametersMap[$name])) { |
||||
$persistedParametersMap[$name]->setValue($value); |
||||
} else { |
||||
/** @var SettingsCurrent $parameter */ |
||||
$parameter = $this->parameterRepository->createNew(); |
||||
|
||||
$parameter |
||||
->setNamespace($namespace) |
||||
->setName($name) |
||||
->setValue($value) |
||||
->setAccessUrlChangeable(1) |
||||
; |
||||
|
||||
/* @var $errors ConstraintViolationListInterface */ |
||||
$errors = $this->validator->validate($parameter); |
||||
if (0 < $errors->count()) { |
||||
throw new ValidatorException($errors->get(0)->getMessage()); |
||||
} |
||||
|
||||
$this->parameterManager->persist($parameter); |
||||
} |
||||
} |
||||
|
||||
$this->parameterManager->flush(); |
||||
|
||||
$this->cache->save($namespace, $parameters); |
||||
} |
||||
|
||||
/** |
||||
* Load parameter from database. |
||||
* |
||||
* @param string $namespace |
||||
* |
||||
* @return array |
||||
*/ |
||||
private function getParameters($namespace) |
||||
{ |
||||
$parameters = array(); |
||||
|
||||
foreach ($this->parameterRepository->findBy(array('category' => $namespace)) as $parameter) { |
||||
$parameters[$parameter->getName()] = $parameter->getValue(); |
||||
} |
||||
|
||||
return $parameters; |
||||
} |
||||
} |
||||
@ -0,0 +1,11 @@ |
||||
<?xml version="1.0" ?> |
||||
|
||||
<container xmlns="http://symfony.com/schema/dic/services" |
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" |
||||
xsi:schemaLocation="http://symfony.com/schema/dic/services http://symfony.com/schema/dic/services/services-1.0.xsd"> |
||||
|
||||
<parameters> |
||||
<parameter key="sylius.settings.manager.class">ChamiloLMS\SettingsBundle\Manager\SettingsManager</parameter> |
||||
</parameters> |
||||
|
||||
</container> |
||||
@ -0,0 +1,11 @@ |
||||
<?xml version="1.0"?> |
||||
<xliff version="1.2" xmlns="urn:oasis:names:tc:xliff:document:1.2"> |
||||
<file source-language="en" datatype="plaintext" original="file.ext"> |
||||
<body> |
||||
<trans-unit id="1"> |
||||
<source>Symfony2 is great</source> |
||||
<target>J'aime Symfony2</target> |
||||
</trans-unit> |
||||
</body> |
||||
</file> |
||||
</xliff> |
||||
@ -0,0 +1 @@ |
||||
Hello {{ name }}! |
||||
Loading…
Reference in new issue