Conditions | 18 |
Paths | > 20000 |
Total Lines | 653 |
Code Lines | 545 |
Lines | 0 |
Ratio | 0 % |
Changes | 0 |
Small methods make your code easier to understand, in particular if combined with a good name. Besides, if your method is small, finding a good name is usually much easier.
For example, if you find yourself adding comments to a method's body, this is usually a good sign to extract the commented part to a new method, and use the comment as a starting point when coming up with a good name for this new method.
Commonly applied refactorings include:
If many parameters/temporary variables are present:
1 | <?php |
||
22 | public function up(Schema $schema): void |
||
23 | { |
||
24 | $connection = $this->getEntityManager()->getConnection(); |
||
25 | $configurationValues = [ |
||
26 | 'Session' => [ |
||
27 | 'allow_redirect_to_session_after_inscription_about', |
||
28 | 'remove_session_url', |
||
29 | 'session_list_show_count_users', |
||
30 | 'session_admins_access_all_content', |
||
31 | 'session_admins_edit_courses_content', |
||
32 | 'limit_session_admin_list_users', |
||
33 | 'hide_search_form_in_session_list', |
||
34 | 'allow_delete_user_for_session_admin', |
||
35 | 'allow_disable_user_for_session_admin', |
||
36 | 'session_multiple_subscription_students_list_avoid_emptying', |
||
37 | 'hide_reporting_session_list', |
||
38 | 'allow_session_admin_read_careers', |
||
39 | 'session_list_order', |
||
40 | 'allow_user_session_collapsable', |
||
41 | 'allow_session_admin_login_as_teacher', |
||
42 | 'catalog_course_subscription_in_user_s_session', |
||
43 | 'default_session_list_view', |
||
44 | 'session_automatic_creation_user_id', |
||
45 | 'user_s_session_duration', |
||
46 | 'my_courses_session_order', |
||
47 | 'session_courses_read_only_mode', |
||
48 | 'session_import_settings', |
||
49 | 'catalog_settings', |
||
50 | 'allow_session_status', |
||
51 | 'tracking_columns', |
||
52 | 'my_progress_session_show_all_courses', |
||
53 | 'assignment_base_course_teacher_access_to_all_session', |
||
54 | 'allow_session_admin_extra_access', |
||
55 | 'hide_session_graph_in_my_progress', |
||
56 | 'show_users_in_active_sessions_in_tracking', |
||
57 | 'session_coach_access_after_duration_end', |
||
58 | 'session_course_users_subscription_limited_to_session_users', |
||
59 | 'session_classes_tab_disable', |
||
60 | 'email_template_subscription_to_session_confirmation_username', |
||
61 | 'email_template_subscription_to_session_confirmation_lost_password', |
||
62 | 'session_creation_user_course_extra_field_relation_to_prefill', |
||
63 | 'session_creation_form_set_extra_fields_mandatory', |
||
64 | ], |
||
65 | 'Security' => [ |
||
66 | 'allow_online_users_by_status', |
||
67 | 'password_requirements', |
||
68 | 'security_strict_transport', |
||
69 | 'security_content_policy', |
||
70 | 'security_content_policy_report_only', |
||
71 | 'security_public_key_pins', |
||
72 | 'security_public_key_pins_report_only', |
||
73 | 'security_x_frame_options', |
||
74 | 'security_xss_protection', |
||
75 | 'security_x_content_type_options', |
||
76 | 'security_referrer_policy', |
||
77 | 'security_block_inactive_users_immediately', |
||
78 | 'security_session_cookie_samesite_none', |
||
79 | ], |
||
80 | 'Course' => [ |
||
81 | 'view_grid_courses', |
||
82 | 'show_simple_session_info', |
||
83 | 'my_courses_show_courses_in_user_language_only', |
||
84 | 'allow_public_course_with_no_terms_conditions', |
||
85 | 'show_all_sessions_on_my_course_page', |
||
86 | 'disabled_edit_session_coaches_course_editing_course', |
||
87 | 'allow_base_course_category', |
||
88 | 'hide_course_sidebar', |
||
89 | 'allow_course_extra_field_in_catalog', |
||
90 | 'multiple_access_url_show_shared_course_marker', |
||
91 | 'course_category_code_to_use_as_model', |
||
92 | 'enable_unsubscribe_button_on_my_course_page', |
||
93 | 'course_creation_donate_message_show', |
||
94 | 'course_creation_donate_link', |
||
95 | 'courses_list_session_title_link', |
||
96 | 'hide_course_rating', |
||
97 | 'course_log_hide_columns', |
||
98 | 'course_student_info', |
||
99 | 'course_catalog_settings', |
||
100 | 'resource_sequence_show_dependency_in_course_intro', |
||
101 | 'block_registered_users_access_to_open_course_contents', |
||
102 | 'course_catalog_display_in_home', |
||
103 | 'course_creation_form_set_course_category_mandatory', |
||
104 | 'course_creation_form_hide_course_code', |
||
105 | 'course_about_teacher_name_hide', |
||
106 | 'course_visibility_change_only_admin', |
||
107 | 'catalog_hide_public_link', |
||
108 | 'course_log_default_extra_fields', |
||
109 | 'show_courses_in_catalogue', |
||
110 | 'courses_catalogue_show_only_category', |
||
111 | 'course_creation_by_teacher_extra_fields_to_show', |
||
112 | 'course_creation_form_set_extra_fields_mandatory', |
||
113 | 'course_configuration_tool_extra_fields_to_show_and_edit', |
||
114 | 'course_creation_user_course_extra_field_relation_to_prefill', |
||
115 | ], |
||
116 | 'Language' => [ |
||
117 | 'show_language_selector_in_menu', |
||
118 | 'language_flags_by_country', |
||
119 | 'allow_course_multiple_languages', |
||
120 | 'template_activate_language_filter', |
||
121 | ], |
||
122 | 'Platform' => [ |
||
123 | 'table_row_list', |
||
124 | 'video_features', |
||
125 | 'proxy_settings', |
||
126 | 'theme_fallback', |
||
127 | 'unoconv_binaries', |
||
128 | 'packager', |
||
129 | 'sync_db_with_schema', |
||
130 | 'hide_main_navigation_menu', |
||
131 | 'pdf_img_dpi', |
||
132 | 'tracking_skip_generic_data', |
||
133 | 'hide_complete_name_in_whoisonline', |
||
134 | 'table_default_row', |
||
135 | 'allow_double_validation_in_registration', |
||
136 | 'block_my_progress_page', |
||
137 | 'generate_random_login', |
||
138 | 'timepicker_increment', |
||
139 | 'allow_portfolio_tool', |
||
140 | 'session_stored_in_db_as_backup', |
||
141 | 'memcache_server', |
||
142 | 'session_stored_after_n_times', |
||
143 | 'default_template', |
||
144 | 'aspell_bin', |
||
145 | 'aspell_opts', |
||
146 | 'aspell_temp_dir', |
||
147 | 'webservice_return_user_field', |
||
148 | 'multiple_url_hide_disabled_settings', |
||
149 | 'login_max_attempt_before_blocking_account', |
||
150 | 'force_renew_password_at_first_login', |
||
151 | 'hide_breadcrumb_if_not_allowed', |
||
152 | 'extldap_config', |
||
153 | 'update_student_expiration_x_date', |
||
154 | 'user_status_show_options_enabled', |
||
155 | 'user_status_show_option', |
||
156 | 'user_number_of_days_for_default_expiration_date_per_role', |
||
157 | 'user_edition_extra_field_to_check', |
||
158 | 'user_hide_never_expire_option', |
||
159 | 'platform_logo_url', |
||
160 | 'use_career_external_id_as_identifier_in_diagrams', |
||
161 | 'disable_webservices', |
||
162 | 'webservice_enable_adminonly_api', |
||
163 | 'plugin_settings', |
||
164 | 'allow_working_time_edition', |
||
165 | 'ticket_project_user_roles', |
||
166 | 'disable_user_conditions_sender_id', |
||
167 | 'portfolio_advanced_sharing', |
||
168 | 'redirect_index_to_url_for_logged_users', |
||
169 | ], |
||
170 | 'Profile' => [ |
||
171 | 'linkedin_organization_id', |
||
172 | 'career_diagram_disclaimer', |
||
173 | 'career_diagram_legend', |
||
174 | 'allow_career_diagram', |
||
175 | 'hide_username_with_complete_name', |
||
176 | 'disable_change_user_visibility_for_public_courses', |
||
177 | 'my_space_users_items_per_page', |
||
178 | 'add_user_course_information_in_mailto', |
||
179 | 'pass_reminder_custom_link', |
||
180 | 'registration_add_helptext_for_2_names', |
||
181 | 'disable_gdpr', |
||
182 | 'data_protection_officer_name', |
||
183 | 'data_protection_officer_role', |
||
184 | 'data_protection_officer_email', |
||
185 | 'hide_user_field_from_list', |
||
186 | 'send_notification_when_user_added', |
||
187 | 'show_conditions_to_user', |
||
188 | 'allow_teachers_to_classes', |
||
189 | 'profile_fields_visibility', |
||
190 | 'user_import_settings', |
||
191 | 'user_search_on_extra_fields', |
||
192 | 'allow_career_users', |
||
193 | 'community_managers_user_list', |
||
194 | 'allow_social_map_fields', |
||
195 | 'hide_username_in_course_chat', |
||
196 | ], |
||
197 | 'Admin' => [ |
||
198 | 'user_status_option_only_for_admin_enabled', |
||
199 | 'show_link_request_hrm_user', |
||
200 | 'max_anonymous_users', |
||
201 | 'send_inscription_notification_to_general_admin_only', |
||
202 | 'plugin_redirection_enabled', |
||
203 | 'usergroup_do_not_unsubscribe_users_from_course_nor_session_on_user_unsubscribe', |
||
204 | 'usergroup_do_not_unsubscribe_users_from_course_on_course_unsubscribe', |
||
205 | 'usergroup_do_not_unsubscribe_users_from_session_on_session_unsubscribe', |
||
206 | 'drh_allow_access_to_all_students', |
||
207 | ], |
||
208 | 'Agenda' => [ |
||
209 | 'personal_agenda_show_all_session_events', |
||
210 | 'allow_agenda_edit_for_hrm', |
||
211 | 'agenda_legend', |
||
212 | 'agenda_colors', |
||
213 | 'agenda_on_hover_info', |
||
214 | 'personal_calendar_show_sessions_occupation', |
||
215 | 'agenda_collective_invitations', |
||
216 | 'agenda_event_subscriptions', |
||
217 | 'agenda_reminders', |
||
218 | 'agenda_reminders_sender_id', |
||
219 | 'fullcalendar_settings', |
||
220 | ], |
||
221 | 'Lp' => [ |
||
222 | 'add_all_files_in_lp_export', |
||
223 | 'show_prerequisite_as_blocked', |
||
224 | 'hide_lp_time', |
||
225 | 'lp_category_accordion', |
||
226 | 'lp_view_accordion', |
||
227 | 'disable_js_in_lp_view', |
||
228 | 'allow_teachers_to_access_blocked_lp_by_prerequisite', |
||
229 | 'allow_lp_chamilo_export', |
||
230 | 'hide_accessibility_label_on_lp_item', |
||
231 | 'lp_minimum_time', |
||
232 | 'validate_lp_prerequisite_from_other_session', |
||
233 | 'show_hidden_exercise_added_to_lp', |
||
234 | 'lp_menu_location', |
||
235 | 'lp_score_as_progress_enable', |
||
236 | 'lp_prevents_beforeunload', |
||
237 | 'disable_my_lps_page', |
||
238 | 'scorm_api_username_as_student_id', |
||
239 | 'scorm_api_extrafield_to_use_as_student_id', |
||
240 | 'allow_import_scorm_package_in_course_builder', |
||
241 | 'allow_htaccess_import_from_scorm', |
||
242 | 'allow_session_lp_category', |
||
243 | 'ticket_lp_quiz_info_add', |
||
244 | 'lp_subscription_settings', |
||
245 | 'lp_view_settings', |
||
246 | 'download_files_after_all_lp_finished', |
||
247 | 'allow_lp_subscription_to_usergroups', |
||
248 | 'lp_fixed_encoding', |
||
249 | 'lp_prerequisite_use_last_attempt_only', |
||
250 | 'show_invisible_exercise_in_lp_list', |
||
251 | 'force_edit_exercise_in_lp', |
||
252 | 'student_follow_page_add_LP_subscription_info', |
||
253 | 'lp_show_max_progress_instead_of_average', |
||
254 | 'lp_show_max_progress_or_average_enable_course_level_redefinition', |
||
255 | 'lp_allow_export_to_students', |
||
256 | 'show_invisible_lp_in_course_home', |
||
257 | 'lp_start_and_end_date_visible_in_student_view', |
||
258 | 'scorm_lms_update_sco_status_all_time', |
||
259 | 'scorm_upload_from_cache', |
||
260 | 'lp_prerequisit_on_quiz_unblock_if_max_attempt_reached', |
||
261 | 'student_follow_page_hide_lp_tests_average', |
||
262 | 'student_follow_page_add_LP_acquisition_info', |
||
263 | 'student_follow_page_add_LP_invisible_checkbox', |
||
264 | 'student_follow_page_include_not_subscribed_lp_students', |
||
265 | 'my_progress_course_tools_order', |
||
266 | 'lp_enable_flow', |
||
267 | 'lp_item_prerequisite_dates', |
||
268 | ], |
||
269 | 'Gradebook' => [ |
||
270 | 'gradebook_enable_best_score', |
||
271 | 'gradebook_hide_graph', |
||
272 | 'gradebook_hide_pdf_report_button', |
||
273 | 'hide_gradebook_percentage_user_result', |
||
274 | 'gradebook_use_exercise_score_settings_in_categories', |
||
275 | 'gradebook_use_apcu_cache', |
||
276 | 'gradebook_report_score_style', |
||
277 | 'gradebook_score_display_custom_standalone', |
||
278 | 'gradebook_use_exercise_score_settings_in_total', |
||
279 | 'gradebook_dependency', |
||
280 | 'gradebook_dependency_mandatory_courses', |
||
281 | 'gradebook_badge_sidebar', |
||
282 | 'gradebook_multiple_evaluation_attempts', |
||
283 | 'allow_gradebook_stats', |
||
284 | 'gradebook_flatview_extrafields_columns', |
||
285 | 'gradebook_pdf_export_settings', |
||
286 | 'allow_gradebook_comments', |
||
287 | 'gradebook_display_extra_stats', |
||
288 | 'gradebook_hide_table', |
||
289 | 'gradebook_hide_link_to_item_for_student', |
||
290 | 'gradebook_enable_subcategory_skills_independant_assignement', |
||
291 | ], |
||
292 | 'Exercise' => [ |
||
293 | 'block_quiz_mail_notification_general_coach', |
||
294 | 'allow_quiz_question_feedback', |
||
295 | 'allow_quiz_show_previous_button_setting', |
||
296 | 'allow_teacher_comment_audio', |
||
297 | 'quiz_prevent_copy_paste', |
||
298 | 'quiz_show_description_on_results_page', |
||
299 | 'quiz_generate_certificate_ending', |
||
300 | 'quiz_open_question_decimal_score', |
||
301 | 'quiz_check_button_enable', |
||
302 | 'allow_notification_setting_per_exercise', |
||
303 | 'hide_free_question_score', |
||
304 | 'hide_user_info_in_quiz_result', |
||
305 | 'exercise_attempts_report_show_username', |
||
306 | 'allow_exercise_auto_launch', |
||
307 | 'disable_clean_exercise_results_for_teachers', |
||
308 | 'show_exercise_question_certainty_ribbon_result', |
||
309 | 'quiz_results_answers_report', |
||
310 | 'send_score_in_exam_notification_mail_to_manager', |
||
311 | 'show_exercise_expected_choice', |
||
312 | 'exercise_hide_label', |
||
313 | 'exercise_category_round_score_in_export', |
||
314 | 'exercises_disable_new_attempts', |
||
315 | 'show_question_id', |
||
316 | 'show_question_pagination', |
||
317 | 'question_pagination_length', |
||
318 | 'limit_exercise_teacher_access', |
||
319 | 'block_category_questions', |
||
320 | 'exercise_score_format', |
||
321 | 'exercise_additional_teacher_modify_actions', |
||
322 | 'quiz_confirm_saved_answers', |
||
323 | 'allow_exercise_categories', |
||
324 | 'allow_quiz_results_page_config', |
||
325 | 'quiz_image_zoom', |
||
326 | 'quiz_answer_extra_recording', |
||
327 | 'allow_mandatory_question_in_category', |
||
328 | 'add_exercise_best_attempt_in_report', |
||
329 | 'exercise_category_report_user_extra_fields', |
||
330 | 'score_grade_model', |
||
331 | 'allow_time_per_question', |
||
332 | 'my_courses_show_pending_exercise_attempts', |
||
333 | 'allow_quick_question_description_popup', |
||
334 | 'exercise_hide_ip', |
||
335 | 'tracking_my_progress_show_deleted_exercises', |
||
336 | 'show_exercise_attempts_in_all_user_sessions', |
||
337 | 'show_exercise_session_attempts_in_base_course', |
||
338 | 'quiz_check_all_answers_before_end_test', |
||
339 | 'quiz_discard_orphan_in_course_export', |
||
340 | 'exercise_result_end_text_html_strict_filtering', |
||
341 | 'question_exercise_html_strict_filtering', |
||
342 | 'quiz_question_delete_automatically_when_deleting_exercise', |
||
343 | 'quiz_question_allow_inter_course_linking', |
||
344 | 'quiz_hide_attempts_table_on_start_page', |
||
345 | 'quiz_hide_question_number', |
||
346 | 'quiz_keep_alive_ping_interval', |
||
347 | ], |
||
348 | 'Glossary' => [ |
||
349 | 'default_glossary_view', |
||
350 | 'allow_remove_tags_in_glossary_export', |
||
351 | ], |
||
352 | 'Forum' => [ |
||
353 | 'global_forums_course_id', |
||
354 | 'hide_forum_post_revision_language', |
||
355 | 'allow_forum_post_revisions', |
||
356 | 'forum_fold_categories', |
||
357 | 'allow_forum_category_language_filter', |
||
358 | 'subscribe_users_to_forum_notifications_also_in_base_course', |
||
359 | ], |
||
360 | 'Message' => [ |
||
361 | 'private_messages_about_user', |
||
362 | 'private_messages_about_user_visible_to_user', |
||
363 | 'social_enable_messages_feedback', |
||
364 | 'disable_dislike_option', |
||
365 | 'enable_message_tags', |
||
366 | 'allow_user_message_tracking', |
||
367 | 'filter_interactivity_messages', |
||
368 | ], |
||
369 | 'Display' => [ |
||
370 | 'hide_social_media_links', |
||
371 | ], |
||
372 | 'Social' => [ |
||
373 | 'social_show_language_flag_in_profile', |
||
374 | 'social_make_teachers_friend_all', |
||
375 | ], |
||
376 | 'Editor' => [ |
||
377 | 'save_titles_as_html', |
||
378 | 'full_ckeditor_toolbar_set', |
||
379 | 'ck_editor_block_image_copy_paste', |
||
380 | 'translate_html', |
||
381 | 'editor_driver_list', |
||
382 | 'enable_uploadimage_editor', |
||
383 | 'editor_settings', |
||
384 | 'video_context_menu_hidden', |
||
385 | 'video_player_renderers', |
||
386 | ], |
||
387 | 'Chat' => [ |
||
388 | 'hide_chat_video', |
||
389 | 'course_chat_restrict_to_coach', |
||
390 | ], |
||
391 | 'Survey' => [ |
||
392 | 'allow_required_survey_questions', |
||
393 | 'hide_survey_reporting_button', |
||
394 | 'allow_survey_availability_datetime', |
||
395 | 'survey_mark_question_as_required', |
||
396 | 'survey_anonymous_show_answered', |
||
397 | 'survey_question_dependency', |
||
398 | 'survey_allow_answered_question_edit', |
||
399 | 'survey_duplicate_order_by_name', |
||
400 | 'survey_backwards_enable', |
||
401 | 'allow_mandatory_survey', |
||
402 | 'hide_survey_edition', |
||
403 | 'survey_additional_teacher_modify_actions', |
||
404 | 'allow_survey_tool_in_lp', |
||
405 | 'show_surveys_base_in_sessions', |
||
406 | ], |
||
407 | 'Document' => [ |
||
408 | 'send_notification_when_document_added', |
||
409 | 'thematic_pdf_orientation', |
||
410 | 'certificate_pdf_orientation', |
||
411 | 'allow_general_certificate', |
||
412 | 'group_document_access', |
||
413 | 'group_category_document_access', |
||
414 | 'allow_compilatio_tool', |
||
415 | 'compilatio_tool', |
||
416 | 'documents_hide_download_icon', |
||
417 | 'enable_x_sendfile_headers', |
||
418 | 'documents_custom_cloud_link_list', |
||
419 | ], |
||
420 | 'Announcement' => [ |
||
421 | 'disable_delete_all_announcements', |
||
422 | 'admin_chamilo_announcements_disable', |
||
423 | 'disable_announcement_attachment', |
||
424 | 'allow_scheduled_announcements', |
||
425 | 'hide_announcement_sent_to_users_info', |
||
426 | 'send_all_emails_to', |
||
427 | 'allow_careers_in_global_announcements', |
||
428 | 'announcements_hide_send_to_hrm_users', |
||
429 | 'allow_coach_to_edit_announcements', |
||
430 | 'course_announcement_scheduled_by_date', |
||
431 | ], |
||
432 | 'Skill' => [ |
||
433 | 'allow_private_skills', |
||
434 | 'allow_teacher_access_student_skills', |
||
435 | 'skills_teachers_can_assign_skills', |
||
436 | 'hide_skill_levels', |
||
437 | 'table_of_hierarchical_skill_presentation', |
||
438 | 'skill_levels_names', |
||
439 | 'allow_skill_rel_items', |
||
440 | ], |
||
441 | 'Mail' => [ |
||
442 | 'update_users_email_to_dummy_except_admins', |
||
443 | 'hosting_total_size_limit', |
||
444 | 'mail_header_style', |
||
445 | 'mail_content_style', |
||
446 | 'allow_email_editor_for_anonymous', |
||
447 | 'messages_hide_mail_content', |
||
448 | 'send_two_inscription_confirmation_mail', |
||
449 | 'show_user_email_in_notification', |
||
450 | 'send_notification_score_in_percentage', |
||
451 | 'mail_template_system', |
||
452 | 'cron_notification_mails', |
||
453 | 'cron_notification_help_desk', |
||
454 | 'notifications_extended_footer_message', |
||
455 | ], |
||
456 | 'Work' => [ |
||
457 | 'block_student_publication_edition', |
||
458 | 'block_student_publication_add_documents', |
||
459 | 'block_student_publication_score_edition', |
||
460 | 'allow_only_one_student_publication_per_user', |
||
461 | 'allow_my_student_publication_page', |
||
462 | 'assignment_prevent_duplicate_upload', |
||
463 | 'considered_working_time', |
||
464 | 'force_download_doc_before_upload_work', |
||
465 | 'allow_redirect_to_main_page_after_work_upload', |
||
466 | 'my_courses_show_pending_work', |
||
467 | ], |
||
468 | 'Wiki' => [ |
||
469 | 'wiki_categories_enabled', |
||
470 | 'wiki_html_strict_filtering', |
||
471 | ], |
||
472 | 'Certificate' => [ |
||
473 | 'hide_my_certificate_link', |
||
474 | 'add_certificate_pdf_footer', |
||
475 | ], |
||
476 | 'Attendance' => [ |
||
477 | 'enable_sign_attendance_sheet', |
||
478 | 'attendance_calendar_set_duration', |
||
479 | 'attendance_allow_comments', |
||
480 | ], |
||
481 | 'Registration' => [ |
||
482 | 'required_extra_fields_in_inscription', |
||
483 | 'allow_fields_inscription', |
||
484 | 'send_inscription_msg_to_inbox', |
||
485 | ], |
||
486 | ]; |
||
487 | foreach ($configurationValues as $category => $variables) { |
||
488 | foreach ($variables as $variable) { |
||
489 | $category = strtolower($category); |
||
490 | $result = $connection |
||
491 | ->executeQuery( |
||
492 | "SELECT COUNT(1) FROM settings_current WHERE variable = '$variable' AND category = '{$category}'" |
||
493 | ) |
||
494 | ; |
||
495 | $count = $result->fetchNumeric()[0]; |
||
496 | $selectedValue = $this->getConfigurationSelectedValue($variable); |
||
497 | error_log('Migration: Setting variable '.$variable.' category '.$category.' value '.$selectedValue); |
||
498 | |||
499 | // To use by default courses page if this option is not empty. |
||
500 | if ('redirect_index_to_url_for_logged_users' === $variable && !empty($selectedValue)) { |
||
501 | $selectedValue = 'courses'; |
||
502 | } |
||
503 | if (empty($count)) { |
||
504 | $this->addSql( |
||
505 | "INSERT INTO settings_current (access_url, variable, category, selected_value, title, access_url_changeable, access_url_locked) VALUES (1, '{$variable}', '{$category}', '{$selectedValue}', '{$variable}', 1, 1)" |
||
506 | ); |
||
507 | } else { |
||
508 | $this->addSql( |
||
509 | "UPDATE settings_current SET selected_value = '{$selectedValue}', category = '{$category}' WHERE variable = '$variable' AND category = '{$category}'" |
||
510 | ); |
||
511 | } |
||
512 | } |
||
513 | } |
||
514 | |||
515 | // Rename setting for hierarchical skill presentation. |
||
516 | $this->addSql( |
||
517 | "UPDATE settings_current SET variable = 'skills_hierarchical_view_in_user_tracking', title = 'skills_hierarchical_view_in_user_tracking' WHERE variable = 'table_of_hierarchical_skill_presentation'" |
||
518 | ); |
||
519 | |||
520 | // Insert extra fields required. |
||
521 | $result = $connection |
||
522 | ->executeQuery( |
||
523 | "SELECT COUNT(1) FROM extra_field WHERE variable = 'session_courses_read_only_mode' AND item_type = 2 AND value_type = 13" |
||
524 | ) |
||
525 | ; |
||
526 | $count = $result->fetchNumeric()[0]; |
||
527 | if (empty($count)) { |
||
528 | $this->addSql( |
||
529 | "INSERT INTO extra_field (item_type, value_type, variable, display_text, visible_to_self, changeable, filter, created_at) VALUES (2, 13, 'session_courses_read_only_mode', 'Lock Course In Session', 1, 1, 1, NOW())" |
||
530 | ); |
||
531 | } |
||
532 | |||
533 | // Insert extra fields required. |
||
534 | $result = $connection |
||
535 | ->executeQuery( |
||
536 | "SELECT COUNT(1) FROM extra_field WHERE variable = 'is_mandatory' AND item_type = 12 AND value_type = 13" |
||
537 | ) |
||
538 | ; |
||
539 | $count = $result->fetchNumeric()[0]; |
||
540 | if (empty($count)) { |
||
541 | $this->addSql( |
||
542 | "INSERT INTO extra_field (item_type, value_type, variable, display_text, visible_to_self, changeable, filter, created_at) VALUES (12, 13, 'is_mandatory', 'IsMandatory', 1, 1, 1, NOW())" |
||
543 | ); |
||
544 | } |
||
545 | |||
546 | $result = $connection |
||
547 | ->executeQuery( |
||
548 | "SELECT COUNT(1) FROM extra_field WHERE variable = 'show_in_catalogue' AND item_type = 2 AND value_type = 3" |
||
549 | ) |
||
550 | ; |
||
551 | $count = $result->fetchNumeric()[0]; |
||
552 | if (empty($count)) { |
||
553 | $this->addSql( |
||
554 | "INSERT INTO extra_field (item_type, value_type, variable, display_text, visible_to_self, changeable, filter, created_at) VALUES (2, 3, 'show_in_catalogue', 'Show in catalogue', 1, 1, 0, NOW())" |
||
555 | ); |
||
556 | $this->addSql( |
||
557 | 'SET @ef_id = LAST_INSERT_ID()' |
||
558 | ); |
||
559 | $this->addSql( |
||
560 | "INSERT INTO extra_field_options (field_id, option_value, display_text, priority, priority_message, option_order) VALUES (@ef_id, '1', 'Yes', NULL, NULL, 1), (@ef_id, '0', 'No', NULL, NULL, 2)" |
||
561 | ); |
||
562 | } |
||
563 | |||
564 | $result = $connection |
||
565 | ->executeQuery( |
||
566 | "SELECT COUNT(1) FROM extra_field WHERE variable = 'multiple_language' AND item_type = 2 AND value_type = 5" |
||
567 | ) |
||
568 | ; |
||
569 | $count = $result->fetchNumeric()[0]; |
||
570 | if (empty($count)) { |
||
571 | $this->addSql( |
||
572 | "INSERT INTO extra_field (item_type, value_type, variable, display_text, visible_to_self, changeable, filter, created_at) VALUES (2, 5, 'multiple_language', 'Multiple Language', 1, 1, 1, NOW())" |
||
573 | ); |
||
574 | } |
||
575 | |||
576 | $result = $connection |
||
577 | ->executeQuery( |
||
578 | "SELECT COUNT(1) FROM extra_field WHERE variable = 'send_notification_at_a_specific_date' AND item_type = 21 AND value_type = 13" |
||
579 | ) |
||
580 | ; |
||
581 | $count = $result->fetchNumeric()[0]; |
||
582 | if (empty($count)) { |
||
583 | $this->addSql( |
||
584 | "INSERT INTO extra_field (item_type, value_type, variable, display_text, visible_to_self, changeable, filter, created_at) VALUES (21, 13, 'send_notification_at_a_specific_date', 'Send notification at a specific date', 1, 1, 1, NOW())" |
||
585 | ); |
||
586 | } |
||
587 | |||
588 | $result = $connection |
||
589 | ->executeQuery( |
||
590 | "SELECT COUNT(1) FROM extra_field WHERE variable = 'date_to_send_notification' AND item_type = 21 AND value_type = 6" |
||
591 | ) |
||
592 | ; |
||
593 | $count = $result->fetchNumeric()[0]; |
||
594 | if (empty($count)) { |
||
595 | $this->addSql( |
||
596 | "INSERT INTO extra_field (item_type, value_type, variable, display_text, visible_to_self, changeable, filter, created_at) VALUES (21, 6, 'date_to_send_notification', 'Date to send notification', 1, 1, 1, NOW())" |
||
597 | ); |
||
598 | } |
||
599 | |||
600 | $result = $connection |
||
601 | ->executeQuery( |
||
602 | "SELECT COUNT(1) FROM extra_field WHERE variable = 'send_to_users_in_session' AND item_type = 21 AND value_type = 13" |
||
603 | ) |
||
604 | ; |
||
605 | $count = $result->fetchNumeric()[0]; |
||
606 | if (empty($count)) { |
||
607 | $this->addSql( |
||
608 | "INSERT INTO extra_field (item_type, value_type, variable, display_text, visible_to_self, changeable, filter, created_at) VALUES (21, 13, 'send_to_users_in_session', 'Send to users in session', 1, 1, 1, NOW())" |
||
609 | ); |
||
610 | } |
||
611 | |||
612 | $result = $connection |
||
613 | ->executeQuery( |
||
614 | "SELECT COUNT(1) FROM extra_field WHERE variable = 'tags' AND item_type = 22 AND value_type = 10" |
||
615 | ) |
||
616 | ; |
||
617 | $count = $result->fetchNumeric()[0]; |
||
618 | if (empty($count)) { |
||
619 | $this->addSql( |
||
620 | "INSERT INTO extra_field (item_type, value_type, variable, display_text, visible_to_self, changeable, filter, created_at) VALUES (22, 10, 'tags', 'Tags', 1, 1, 1, NOW())" |
||
621 | ); |
||
622 | } |
||
623 | |||
624 | $result = $connection |
||
625 | ->executeQuery( |
||
626 | "SELECT COUNT(1) FROM extra_field WHERE variable = 'acquisition' AND item_type = 20 AND value_type = 3" |
||
627 | ) |
||
628 | ; |
||
629 | $count = $result->fetchNumeric()[0]; |
||
630 | if (empty($count)) { |
||
631 | $this->addSql( |
||
632 | "INSERT INTO extra_field (item_type, value_type, variable, display_text, visible_to_self, changeable, filter, created_at) VALUES (20, 3, 'acquisition', 'Acquisition', 1, 1, 0, NOW())" |
||
633 | ); |
||
634 | $this->addSql( |
||
635 | 'SET @ef_id = LAST_INSERT_ID()' |
||
636 | ); |
||
637 | $this->addSql( |
||
638 | "INSERT INTO extra_field_options (field_id, option_value, display_text, priority, priority_message, option_order) VALUES (@ef_id, '1', 'Acquired', NULL, NULL, 1), (@ef_id, '2', 'In the process of acquisition', NULL, NULL, 2), (@ef_id, '3', 'Not acquired', NULL, NULL, 3)" |
||
639 | ); |
||
640 | } |
||
641 | |||
642 | $result = $connection |
||
643 | ->executeQuery( |
||
644 | "SELECT COUNT(1) FROM extra_field WHERE variable = 'invisible' AND item_type = 20 AND value_type = 13" |
||
645 | ) |
||
646 | ; |
||
647 | $count = $result->fetchNumeric()[0]; |
||
648 | if (empty($count)) { |
||
649 | $this->addSql( |
||
650 | "INSERT INTO extra_field (item_type, value_type, variable, display_text, visible_to_self, changeable, filter, created_at) VALUES (20, 13, 'invisible', 'Invisible', 1, 1, 1, NOW())" |
||
651 | ); |
||
652 | } |
||
653 | |||
654 | $result = $connection |
||
655 | ->executeQuery( |
||
656 | "SELECT COUNT(1) FROM extra_field WHERE variable = 'start_date' AND item_type = 7 AND value_type = 7" |
||
657 | ) |
||
658 | ; |
||
659 | $count = $result->fetchNumeric()[0]; |
||
660 | if (empty($count)) { |
||
661 | $this->addSql( |
||
662 | "INSERT INTO extra_field (item_type, value_type, variable, display_text, visible_to_self, changeable, filter, created_at) VALUES (7, 7, 'start_date', 'StartDate', 1, 1, 1, NOW())" |
||
663 | ); |
||
664 | } |
||
665 | |||
666 | $result = $connection |
||
667 | ->executeQuery( |
||
668 | "SELECT COUNT(1) FROM extra_field WHERE variable = 'end_date' AND item_type = 7 AND value_type = 7" |
||
669 | ) |
||
670 | ; |
||
671 | $count = $result->fetchNumeric()[0]; |
||
672 | if (empty($count)) { |
||
673 | $this->addSql( |
||
674 | "INSERT INTO extra_field (item_type, value_type, variable, display_text, visible_to_self, changeable, filter, created_at) VALUES (7, 7, 'end_date', 'EndDate', 1, 1, 1, NOW())" |
||
675 | ); |
||
1297 |