Total Complexity | 62 |
Total Lines | 1038 |
Duplicated Lines | 0 % |
Changes | 0 |
Complex classes like SettingsManager often do a lot of different things. To break such a class down, we need to identify a cohesive component within that class. A common approach to find such a component is to look for fields/methods that share the same prefixes, or suffixes.
Once you have determined the fields that belong together, you can apply the Extract Class refactoring. If the component makes sense as a sub-class, Extract Subclass is also a candidate, and is often faster.
While breaking up the class, it is a good idea to analyze how other classes use SettingsManager, and based on these observations, apply Extract Interface, too.
1 | <?php |
||
30 | class SettingsManager implements SettingsManagerInterface |
||
31 | { |
||
32 | protected ?AccessUrl $url = null; |
||
33 | |||
34 | protected ServiceRegistryInterface $schemaRegistry; |
||
35 | |||
36 | protected EntityManager $manager; |
||
37 | |||
38 | protected EntityRepository $repository; |
||
39 | |||
40 | protected EventDispatcherInterface $eventDispatcher; |
||
41 | |||
42 | /** |
||
43 | * Runtime cache for resolved parameters. |
||
44 | * |
||
45 | * @var Settings[] |
||
46 | */ |
||
47 | protected array $resolvedSettings = []; |
||
48 | |||
49 | /** |
||
50 | * @var null|array<string, Settings>|mixed[] |
||
51 | */ |
||
52 | protected ?array $schemaList; |
||
53 | |||
54 | protected RequestStack $request; |
||
55 | |||
56 | public function __construct( |
||
69 | } |
||
70 | |||
71 | public function getUrl(): ?AccessUrl |
||
72 | { |
||
73 | return $this->url; |
||
74 | } |
||
75 | |||
76 | public function setUrl(AccessUrl $url): void |
||
77 | { |
||
78 | $this->url = $url; |
||
79 | } |
||
80 | |||
81 | public function updateSchemas(AccessUrl $url): void |
||
82 | { |
||
83 | $this->url = $url; |
||
84 | $schemas = array_keys($this->getSchemas()); |
||
85 | foreach ($schemas as $schema) { |
||
86 | $settings = $this->load($this->convertServiceToNameSpace($schema)); |
||
87 | $this->update($settings); |
||
88 | } |
||
89 | } |
||
90 | |||
91 | public function installSchemas(AccessUrl $url): void |
||
92 | { |
||
93 | $this->url = $url; |
||
94 | $schemas = array_keys($this->getSchemas()); |
||
95 | foreach ($schemas as $schema) { |
||
96 | $settings = $this->load($this->convertServiceToNameSpace($schema)); |
||
97 | $this->save($settings); |
||
98 | } |
||
99 | } |
||
100 | |||
101 | /** |
||
102 | * @return array|AbstractSettingsSchema[] |
||
103 | */ |
||
104 | public function getSchemas(): array |
||
105 | { |
||
106 | return $this->schemaRegistry->all(); |
||
107 | } |
||
108 | |||
109 | public function convertNameSpaceToService(string $category): string |
||
112 | } |
||
113 | |||
114 | public function convertServiceToNameSpace(string $category): string |
||
117 | } |
||
118 | |||
119 | public function updateSetting(string $name, $value): void |
||
120 | { |
||
121 | $name = $this->validateSetting($name); |
||
122 | |||
123 | [$category, $name] = explode('.', $name); |
||
124 | $settings = $this->load($category); |
||
125 | |||
126 | if (!$settings->has($name)) { |
||
127 | $message = sprintf("Parameter %s doesn't exists.", $name); |
||
128 | |||
129 | throw new InvalidArgumentException($message); |
||
130 | } |
||
131 | |||
132 | $settings->set($name, $value); |
||
133 | $this->update($settings); |
||
134 | } |
||
135 | |||
136 | public function getSetting(string $name, bool $loadFromDb = false) |
||
157 | /*exit; |
||
158 | |||
159 | $settings = $this->load($category, $name); |
||
160 | |||
161 | if (!$settings) { |
||
162 | throw new \InvalidArgumentException(sprintf("Parameter '$name' not found in category '$category'")); |
||
163 | } |
||
164 | |||
165 | $this->settings = $settings; |
||
166 | |||
167 | return $settings->get($name);*/ |
||
168 | } |
||
169 | |||
170 | public function loadAll(): void |
||
171 | { |
||
172 | $session = null; |
||
173 | if ($this->request->getCurrentRequest()) { |
||
174 | $session = $this->request->getCurrentRequest()->getSession(); |
||
175 | $schemaList = $session->get('schemas'); |
||
176 | $this->schemaList = $schemaList; |
||
177 | } |
||
178 | |||
179 | if (empty($this->schemaList)) { |
||
180 | $schemas = array_keys($this->getSchemas()); |
||
181 | $schemaList = []; |
||
182 | $settingsBuilder = new SettingsBuilder(); |
||
183 | $all = $this->getAllParametersByCategory(); |
||
184 | |||
185 | foreach ($schemas as $schema) { |
||
186 | $schemaRegister = $this->schemaRegistry->get($schema); |
||
187 | $schemaRegister->buildSettings($settingsBuilder); |
||
188 | $name = $this->convertServiceToNameSpace($schema); |
||
189 | $settings = new Settings(); |
||
190 | $parameters = $all[$name] ?? []; |
||
191 | $transformers = $settingsBuilder->getTransformers(); |
||
192 | foreach ($transformers as $parameter => $transformer) { |
||
193 | if (\array_key_exists($parameter, $parameters)) { |
||
194 | if ('course_creation_use_template' === $parameter) { |
||
195 | if (empty($parameters[$parameter])) { |
||
196 | $parameters[$parameter] = null; |
||
197 | } |
||
198 | } else { |
||
199 | $parameters[$parameter] = $transformer->reverseTransform($parameters[$parameter]); |
||
200 | } |
||
201 | } |
||
202 | } |
||
203 | $parameters = $settingsBuilder->resolve($parameters); |
||
204 | $settings->setParameters($parameters); |
||
205 | $schemaList[$name] = $settings; |
||
206 | } |
||
207 | $this->schemaList = $schemaList; |
||
208 | if ($session && $this->request->getCurrentRequest()) { |
||
209 | $session->set('schemas', $schemaList); |
||
210 | } |
||
211 | } |
||
212 | } |
||
213 | |||
214 | public function load(string $schemaAlias, string $namespace = null, bool $ignoreUnknown = true): SettingsInterface |
||
215 | { |
||
216 | $settings = new Settings(); |
||
217 | $schemaAliasNoPrefix = $schemaAlias; |
||
218 | $schemaAlias = 'chamilo_core.settings.'.$schemaAlias; |
||
219 | if ($this->schemaRegistry->has($schemaAlias)) { |
||
220 | /** @var SchemaInterface $schema */ |
||
221 | $schema = $this->schemaRegistry->get($schemaAlias); |
||
222 | } else { |
||
223 | return $settings; |
||
224 | } |
||
225 | |||
226 | $settings->setSchemaAlias($schemaAlias); |
||
227 | |||
228 | // We need to get a plain parameters array since we use the options resolver on it |
||
229 | $parameters = $this->getParameters($schemaAliasNoPrefix); |
||
230 | $settingsBuilder = new SettingsBuilder(); |
||
231 | $schema->buildSettings($settingsBuilder); |
||
232 | |||
233 | // Remove unknown settings' parameters (e.g. From a previous version of the settings schema) |
||
234 | if (true === $ignoreUnknown) { |
||
235 | foreach ($parameters as $name => $value) { |
||
236 | if (!$settingsBuilder->isDefined($name)) { |
||
237 | unset($parameters[$name]); |
||
238 | } |
||
239 | } |
||
240 | } |
||
241 | |||
242 | foreach ($settingsBuilder->getTransformers() as $parameter => $transformer) { |
||
243 | if (\array_key_exists($parameter, $parameters)) { |
||
244 | if ('course_creation_use_template' === $parameter) { |
||
245 | if (empty($parameters[$parameter])) { |
||
246 | $parameters[$parameter] = null; |
||
247 | } |
||
248 | } else { |
||
249 | $parameters[$parameter] = $transformer->reverseTransform($parameters[$parameter]); |
||
250 | } |
||
251 | } |
||
252 | } |
||
253 | |||
254 | $parameters = $settingsBuilder->resolve($parameters); |
||
255 | $settings->setParameters($parameters); |
||
256 | |||
257 | return $settings; |
||
258 | } |
||
259 | |||
260 | public function update(SettingsInterface $settings): void |
||
323 | } |
||
324 | |||
325 | /** |
||
326 | * @throws ValidatorException |
||
327 | */ |
||
328 | public function save(SettingsInterface $settings): void |
||
329 | { |
||
330 | $namespace = $settings->getSchemaAlias(); |
||
331 | |||
332 | /** @var SchemaInterface $schema */ |
||
333 | $schema = $this->schemaRegistry->get($settings->getSchemaAlias()); |
||
334 | |||
335 | $settingsBuilder = new SettingsBuilder(); |
||
336 | $schema->buildSettings($settingsBuilder); |
||
337 | $parameters = $settingsBuilder->resolve($settings->getParameters()); |
||
338 | // Transform value. Example array to string using transformer. Example: |
||
339 | // 1. Setting "tool_visible_by_default_at_creation" it's a multiple select |
||
340 | // 2. Is defined as an array in class DocumentSettingsSchema |
||
341 | // 3. Add transformer for that variable "ArrayToIdentifierTransformer" |
||
342 | // 4. Here we recover the transformer and convert the array to string |
||
343 | foreach ($settingsBuilder->getTransformers() as $parameter => $transformer) { |
||
344 | if (\array_key_exists($parameter, $parameters)) { |
||
345 | $parameters[$parameter] = $transformer->transform($parameters[$parameter]); |
||
346 | } |
||
347 | } |
||
348 | $settings->setParameters($parameters); |
||
349 | $persistedParameters = $this->repository->findBy([ |
||
350 | 'category' => $this->convertServiceToNameSpace($settings->getSchemaAlias()), |
||
351 | ]); |
||
352 | $persistedParametersMap = []; |
||
353 | foreach ($persistedParameters as $parameter) { |
||
354 | $persistedParametersMap[$parameter->getTitle()] = $parameter; |
||
355 | } |
||
356 | |||
357 | // @var SettingsEvent $event |
||
358 | /*$event = $this->eventDispatcher->dispatch( |
||
359 | SettingsEvent::PRE_SAVE, |
||
360 | new SettingsEvent($settings, $parameters) |
||
361 | );*/ |
||
362 | |||
363 | $url = $this->getUrl(); |
||
364 | $simpleCategoryName = str_replace('chamilo_core.settings.', '', $namespace); |
||
365 | |||
366 | foreach ($parameters as $name => $value) { |
||
367 | if (isset($persistedParametersMap[$name])) { |
||
368 | $parameter = $persistedParametersMap[$name]; |
||
369 | $parameter->setSelectedValue($value); |
||
370 | } else { |
||
371 | $parameter = (new SettingsCurrent()) |
||
372 | ->setVariable($name) |
||
373 | ->setCategory($simpleCategoryName) |
||
374 | ->setTitle($name) |
||
375 | ->setSelectedValue($value) |
||
376 | ->setUrl($url) |
||
377 | ->setAccessUrlChangeable(1) |
||
378 | ->setAccessUrlLocked(1) |
||
379 | ; |
||
380 | |||
381 | // @var ConstraintViolationListInterface $errors |
||
382 | /*$errors = $this->validator->validate($parameter); |
||
383 | if (0 < $errors->count()) { |
||
384 | throw new ValidatorException($errors->get(0)->getMessage()); |
||
385 | }*/ |
||
386 | $this->manager->persist($parameter); |
||
387 | } |
||
388 | $this->manager->persist($parameter); |
||
389 | } |
||
390 | |||
391 | $this->manager->flush(); |
||
392 | |||
393 | // $schemaAlias = $settings->getSchemaAlias(); |
||
394 | // $schemaAliasChamilo = str_replace('chamilo_core.settings.', '', $schemaAlias); |
||
395 | // |
||
396 | // $schema = $this->schemaRegistry->get($schemaAlias); |
||
397 | // |
||
398 | // $settingsBuilder = new SettingsBuilder(); |
||
399 | // $schema->buildSettings($settingsBuilder); |
||
400 | // |
||
401 | // $parameters = $settingsBuilder->resolve($settings->getParameters()); |
||
402 | // |
||
403 | // foreach ($settingsBuilder->getTransformers() as $parameter => $transformer) { |
||
404 | // if (array_key_exists($parameter, $parameters)) { |
||
405 | // $parameters[$parameter] = $transformer->transform($parameters[$parameter]); |
||
406 | // } |
||
407 | // } |
||
408 | // |
||
409 | // /** @var \Sylius\Bundle\SettingsBundle\Event\SettingsEvent $event */ |
||
410 | // $event = $this->eventDispatcher->dispatch( |
||
411 | // SettingsEvent::PRE_SAVE, |
||
412 | // new SettingsEvent($settings) |
||
413 | // ); |
||
414 | // |
||
415 | // /** @var SettingsCurrent $url */ |
||
416 | // $url = $event->getSettings()->getAccessUrl(); |
||
417 | // |
||
418 | // foreach ($parameters as $name => $value) { |
||
419 | // if (isset($persistedParametersMap[$name])) { |
||
420 | // if ($value instanceof Course) { |
||
421 | // $value = $value->getId(); |
||
422 | // } |
||
423 | // $persistedParametersMap[$name]->setValue($value); |
||
424 | // } else { |
||
425 | // $setting = new Settings(); |
||
426 | // $setting->setSchemaAlias($schemaAlias); |
||
427 | // |
||
428 | // $setting |
||
429 | // ->setNamespace($schemaAliasChamilo) |
||
430 | // ->setName($name) |
||
431 | // ->setValue($value) |
||
432 | // ->setUrl($url) |
||
433 | // ->setAccessUrlLocked(0) |
||
434 | // ->setAccessUrlChangeable(1) |
||
435 | // ; |
||
436 | // |
||
437 | // /** @var ConstraintViolationListInterface $errors */ |
||
438 | // /*$errors = $this->->validate($parameter); |
||
439 | // if (0 < $errors->count()) { |
||
440 | // throw new ValidatorException($errors->get(0)->getMessage()); |
||
441 | // }*/ |
||
442 | // $this->manager->persist($setting); |
||
443 | // $this->manager->flush(); |
||
444 | // } |
||
445 | // } |
||
446 | /*$parameters = $settingsBuilder->resolve($settings->getParameters()); |
||
447 | $settings->setParameters($parameters); |
||
448 | |||
449 | $this->eventDispatcher->dispatch(SettingsEvent::PRE_SAVE, new SettingsEvent($settings)); |
||
450 | |||
451 | $this->manager->persist($settings); |
||
452 | $this->manager->flush(); |
||
453 | |||
454 | $this->eventDispatcher->dispatch(SettingsEvent::POST_SAVE, new SettingsEvent($settings));*/ |
||
455 | } |
||
456 | |||
457 | /** |
||
458 | * @param string $keyword |
||
459 | */ |
||
460 | public function getParametersFromKeywordOrderedByCategory($keyword): array |
||
461 | { |
||
462 | $query = $this->repository->createQueryBuilder('s') |
||
463 | ->where('s.variable LIKE :keyword OR s.title LIKE :keyword') |
||
464 | ->setParameter('keyword', "%{$keyword}%") |
||
465 | ; |
||
466 | $parametersFromDb = $query->getQuery()->getResult(); |
||
467 | $parameters = []; |
||
468 | /** @var SettingsCurrent $parameter */ |
||
469 | foreach ($parametersFromDb as $parameter) { |
||
470 | $parameters[$parameter->getCategory()][] = $parameter; |
||
471 | } |
||
472 | |||
473 | return $parameters; |
||
474 | } |
||
475 | |||
476 | /** |
||
477 | * @param string $namespace |
||
478 | * @param string $keyword |
||
479 | * @param bool $returnObjects |
||
480 | * |
||
481 | * @return array |
||
482 | */ |
||
483 | public function getParametersFromKeyword($namespace, $keyword = '', $returnObjects = false) |
||
484 | { |
||
485 | if (empty($keyword)) { |
||
486 | $criteria = [ |
||
487 | 'category' => $namespace, |
||
488 | ]; |
||
489 | $parametersFromDb = $this->repository->findBy($criteria); |
||
490 | } else { |
||
491 | $query = $this->repository->createQueryBuilder('s') |
||
492 | ->where('s.variable LIKE :keyword') |
||
493 | ->setParameter('keyword', "%{$keyword}%") |
||
494 | ; |
||
495 | $parametersFromDb = $query->getQuery()->getResult(); |
||
496 | } |
||
497 | |||
498 | if ($returnObjects) { |
||
499 | return $parametersFromDb; |
||
500 | } |
||
501 | $parameters = []; |
||
502 | /** @var SettingsCurrent $parameter */ |
||
503 | foreach ($parametersFromDb as $parameter) { |
||
504 | $parameters[$parameter->getVariable()] = $parameter->getSelectedValue(); |
||
505 | } |
||
506 | |||
507 | return $parameters; |
||
508 | } |
||
509 | |||
510 | private function validateSetting(string $name): string |
||
536 | } |
||
537 | |||
538 | /** |
||
539 | * Load parameter from database. |
||
540 | * |
||
541 | * @param string $namespace |
||
542 | * |
||
543 | * @return array |
||
544 | */ |
||
545 | private function getParameters($namespace) |
||
546 | { |
||
547 | $parameters = []; |
||
548 | $category = $this->repository->findBy(['category' => $namespace]); |
||
549 | /** @var SettingsCurrent $parameter */ |
||
550 | foreach ($category as $parameter) { |
||
551 | $parameters[$parameter->getVariable()] = $parameter->getSelectedValue(); |
||
552 | } |
||
553 | |||
554 | return $parameters; |
||
555 | } |
||
556 | |||
557 | private function getAllParametersByCategory() |
||
558 | { |
||
559 | $parameters = []; |
||
560 | $all = $this->repository->findAll(); |
||
561 | /** @var SettingsCurrent $parameter */ |
||
562 | foreach ($all as $parameter) { |
||
563 | $parameters[$parameter->getCategory()][$parameter->getVariable()] = $parameter->getSelectedValue(); |
||
564 | } |
||
565 | |||
566 | return $parameters; |
||
567 | } |
||
568 | |||
569 | /*private function transformParameters(SettingsBuilder $settingsBuilder, array $parameters) |
||
570 | { |
||
571 | $transformedParameters = $parameters; |
||
572 | |||
573 | foreach ($settingsBuilder->getTransformers() as $parameter => $transformer) { |
||
574 | if (array_key_exists($parameter, $parameters)) { |
||
575 | $transformedParameters[$parameter] = $transformer->reverseTransform($parameters[$parameter]); |
||
576 | } |
||
577 | } |
||
578 | |||
579 | return $transformedParameters; |
||
580 | }*/ |
||
581 | |||
582 | /** |
||
583 | * Get variables and categories as in 1.11.x. |
||
584 | */ |
||
585 | private function getVariablesAndCategories(): array |
||
586 | { |
||
587 | return [ |
||
588 | 'Institution' => 'Platform', |
||
589 | 'InstitutionUrl' => 'Platform', |
||
590 | 'siteName' => 'Platform', |
||
591 | 'site_name' => 'Platform', |
||
592 | 'emailAdministrator' => 'admin', |
||
593 | //'emailAdministrator' => 'Platform', |
||
594 | 'administratorSurname' => 'admin', |
||
595 | 'administratorTelephone' => 'admin', |
||
596 | 'administratorName' => 'admin', |
||
597 | 'show_administrator_data' => 'Platform', |
||
598 | 'show_tutor_data' => 'Session', |
||
599 | 'show_teacher_data' => 'Platform', |
||
600 | 'homepage_view' => 'Course', |
||
601 | 'show_toolshortcuts' => 'Course', |
||
602 | 'allow_group_categories' => 'Course', |
||
603 | 'server_type' => 'Platform', |
||
604 | 'platformLanguage' => 'Language', |
||
605 | 'showonline' => 'Platform', |
||
606 | 'profile' => 'User', |
||
607 | 'default_document_quotum' => 'Course', |
||
608 | 'registration' => 'User', |
||
609 | 'default_group_quotum' => 'Course', |
||
610 | 'allow_registration' => 'Platform', |
||
611 | 'allow_registration_as_teacher' => 'Platform', |
||
612 | 'allow_lostpassword' => 'Platform', |
||
613 | 'allow_user_headings' => 'Course', |
||
614 | 'allow_personal_agenda' => 'agenda', |
||
615 | 'display_coursecode_in_courselist' => 'Platform', |
||
616 | 'display_teacher_in_courselist' => 'Platform', |
||
617 | 'permanently_remove_deleted_files' => 'Tools', |
||
618 | 'dropbox_allow_overwrite' => 'Tools', |
||
619 | 'dropbox_max_filesize' => 'Tools', |
||
620 | 'dropbox_allow_just_upload' => 'Tools', |
||
621 | 'dropbox_allow_student_to_student' => 'Tools', |
||
622 | 'dropbox_allow_group' => 'Tools', |
||
623 | 'dropbox_allow_mailing' => 'Tools', |
||
624 | 'extended_profile' => 'User', |
||
625 | 'student_view_enabled' => 'Platform', |
||
626 | 'show_navigation_menu' => 'Course', |
||
627 | 'enable_tool_introduction' => 'course', |
||
628 | 'page_after_login' => 'Platform', |
||
629 | 'time_limit_whosonline' => 'Platform', |
||
630 | 'breadcrumbs_course_homepage' => 'Course', |
||
631 | 'example_material_course_creation' => 'Platform', |
||
632 | 'account_valid_duration' => 'Platform', |
||
633 | 'use_session_mode' => 'Session', |
||
634 | 'allow_email_editor' => 'Tools', |
||
635 | //'registered' => null', |
||
636 | //'donotlistcampus' =>'null', |
||
637 | 'show_email_addresses' => 'Platform', |
||
638 | 'service_ppt2lp' => 'NULL', |
||
639 | 'stylesheets' => 'stylesheets', |
||
640 | 'upload_extensions_list_type' => 'Security', |
||
641 | 'upload_extensions_blacklist' => 'Security', |
||
642 | 'upload_extensions_whitelist' => 'Security', |
||
643 | 'upload_extensions_skip' => 'Security', |
||
644 | 'upload_extensions_replace_by' => 'Security', |
||
645 | 'show_number_of_courses' => 'Platform', |
||
646 | 'show_empty_course_categories' => 'Platform', |
||
647 | 'show_back_link_on_top_of_tree' => 'Platform', |
||
648 | 'show_different_course_language' => 'Platform', |
||
649 | 'split_users_upload_directory' => 'Tuning', |
||
650 | 'hide_dltt_markup' => 'Languages', |
||
651 | 'display_categories_on_homepage' => 'Platform', |
||
652 | 'permissions_for_new_directories' => 'Security', |
||
653 | 'permissions_for_new_files' => 'Security', |
||
654 | 'show_tabs' => 'Platform', |
||
655 | 'default_forum_view' => 'Course', |
||
656 | 'platform_charset' => 'Languages', |
||
657 | 'noreply_email_address' => 'Platform', |
||
658 | 'survey_email_sender_noreply' => 'Course', |
||
659 | 'gradebook_enable' => 'Gradebook', |
||
660 | 'gradebook_score_display_coloring' => 'Gradebook', |
||
661 | 'gradebook_score_display_custom' => 'Gradebook', |
||
662 | 'gradebook_score_display_colorsplit' => 'Gradebook', |
||
663 | 'gradebook_score_display_upperlimit' => 'Gradebook', |
||
664 | 'gradebook_number_decimals' => 'Gradebook', |
||
665 | 'user_selected_theme' => 'Platform', |
||
666 | 'allow_course_theme' => 'Course', |
||
667 | 'show_closed_courses' => 'Platform', |
||
668 | 'extendedprofile_registration' => 'User', |
||
669 | 'extendedprofile_registrationrequired' => 'User', |
||
670 | 'add_users_by_coach' => 'Session', |
||
671 | 'extend_rights_for_coach' => 'Security', |
||
672 | 'extend_rights_for_coach_on_survey' => 'Security', |
||
673 | 'course_create_active_tools' => 'Tools', |
||
674 | 'show_session_coach' => 'Session', |
||
675 | 'allow_users_to_create_courses' => 'Platform', |
||
676 | 'allow_message_tool' => 'Tools', |
||
677 | 'allow_social_tool' => 'Tools', |
||
678 | 'allow_students_to_browse_courses' => 'Platform', |
||
679 | 'show_session_data' => 'Session', |
||
680 | 'allow_use_sub_language' => 'language', |
||
681 | 'show_glossary_in_documents' => 'Course', |
||
682 | 'allow_terms_conditions' => 'Platform', |
||
683 | 'search_enabled' => 'Search', |
||
684 | 'search_prefilter_prefix' => 'Search', |
||
685 | 'search_show_unlinked_results' => 'Search', |
||
686 | 'show_courses_descriptions_in_catalog' => 'Course', |
||
687 | 'allow_coach_to_edit_course_session' => 'Session', |
||
688 | 'show_glossary_in_extra_tools' => 'Course', |
||
689 | 'send_email_to_admin_when_create_course' => 'Platform', |
||
690 | 'go_to_course_after_login' => 'Course', |
||
691 | 'math_asciimathML' => 'Editor', |
||
692 | 'enabled_asciisvg' => 'Editor', |
||
693 | 'include_asciimathml_script' => 'Editor', |
||
694 | 'youtube_for_students' => 'Editor', |
||
695 | 'block_copy_paste_for_students' => 'Editor', |
||
696 | 'more_buttons_maximized_mode' => 'Editor', |
||
697 | 'students_download_folders' => 'Document', |
||
698 | 'users_copy_files' => 'Tools', |
||
699 | 'allow_students_to_create_groups_in_social' => 'Tools', |
||
700 | 'allow_send_message_to_all_platform_users' => 'Message', |
||
701 | 'message_max_upload_filesize' => 'Tools', |
||
702 | 'use_users_timezone' => 'profile', |
||
703 | //'use_users_timezone' => 'Timezones', |
||
704 | 'timezone_value' => 'platform', |
||
705 | //'timezone_value' => 'Timezones', |
||
706 | 'allow_user_course_subscription_by_course_admin' => 'Security', |
||
707 | 'show_link_bug_notification' => 'Platform', |
||
708 | 'show_link_ticket_notification' => 'Platform', |
||
709 | 'course_validation' => 'course', |
||
710 | //'course_validation' => 'Platform', |
||
711 | 'course_validation_terms_and_conditions_url' => 'Platform', |
||
712 | 'enabled_wiris' => 'Editor', |
||
713 | 'allow_spellcheck' => 'Editor', |
||
714 | 'force_wiki_paste_as_plain_text' => 'Editor', |
||
715 | 'enabled_googlemaps' => 'Editor', |
||
716 | 'enabled_imgmap' => 'Editor', |
||
717 | 'enabled_support_svg' => 'Tools', |
||
718 | 'pdf_export_watermark_enable' => 'Platform', |
||
719 | 'pdf_export_watermark_by_course' => 'Platform', |
||
720 | 'pdf_export_watermark_text' => 'Platform', |
||
721 | 'enabled_insertHtml' => 'Editor', |
||
722 | 'students_export2pdf' => 'Document', |
||
723 | 'exercise_min_score' => 'Course', |
||
724 | 'exercise_max_score' => 'Course', |
||
725 | 'show_users_folders' => 'Tools', |
||
726 | 'show_default_folders' => 'Tools', |
||
727 | 'show_chat_folder' => 'Tools', |
||
728 | 'enabled_text2audio' => 'Tools', |
||
729 | 'course_hide_tools' => 'Course', |
||
730 | 'enabled_support_pixlr' => 'Tools', |
||
731 | 'show_groups_to_users' => 'Session', |
||
732 | 'accessibility_font_resize' => 'Platform', |
||
733 | 'hide_courses_in_sessions' => 'Session', |
||
734 | 'enable_quiz_scenario' => 'Course', |
||
735 | 'filter_terms' => 'Security', |
||
736 | 'header_extra_content' => 'Tracking', |
||
737 | 'footer_extra_content' => 'Tracking', |
||
738 | 'show_documents_preview' => 'Tools', |
||
739 | 'htmlpurifier_wiki' => 'Editor', |
||
740 | 'cas_activate' => 'CAS', |
||
741 | 'cas_server' => 'CAS', |
||
742 | 'cas_server_uri' => 'CAS', |
||
743 | 'cas_port' => 'CAS', |
||
744 | 'cas_protocol' => 'CAS', |
||
745 | 'cas_add_user_activate' => 'CAS', |
||
746 | 'update_user_info_cas_with_ldap' => 'CAS', |
||
747 | 'student_page_after_login' => 'Platform', |
||
748 | 'teacher_page_after_login' => 'Platform', |
||
749 | 'drh_page_after_login' => 'Platform', |
||
750 | 'sessionadmin_page_after_login' => 'Session', |
||
751 | 'student_autosubscribe' => 'Platform', |
||
752 | 'teacher_autosubscribe' => 'Platform', |
||
753 | 'drh_autosubscribe' => 'Platform', |
||
754 | 'sessionadmin_autosubscribe' => 'Session', |
||
755 | 'scorm_cumulative_session_time' => 'Course', |
||
756 | 'allow_hr_skills_management' => 'Gradebook', |
||
757 | 'enable_help_link' => 'Platform', |
||
758 | 'teachers_can_change_score_settings' => 'Gradebook', |
||
759 | 'allow_users_to_change_email_with_no_password' => 'User', |
||
760 | 'show_admin_toolbar' => 'display', |
||
761 | 'allow_global_chat' => 'Platform', |
||
762 | 'languagePriority1' => 'language', |
||
763 | 'languagePriority2' => 'language', |
||
764 | 'languagePriority3' => 'language', |
||
765 | 'languagePriority4' => 'language', |
||
766 | 'login_is_email' => 'Platform', |
||
767 | 'courses_default_creation_visibility' => 'Course', |
||
768 | 'gradebook_enable_grade_model' => 'Gradebook', |
||
769 | 'teachers_can_change_grade_model_settings' => 'Gradebook', |
||
770 | 'gradebook_default_weight' => 'Gradebook', |
||
771 | 'ldap_description' => 'LDAP', |
||
772 | 'shibboleth_description' => 'Shibboleth', |
||
773 | 'facebook_description' => 'Facebook', |
||
774 | 'gradebook_locking_enabled' => 'Gradebook', |
||
775 | 'gradebook_default_grade_model_id' => 'Gradebook', |
||
776 | 'allow_session_admins_to_manage_all_sessions' => 'Session', |
||
777 | 'allow_skills_tool' => 'Platform', |
||
778 | 'allow_public_certificates' => 'Course', |
||
779 | 'platform_unsubscribe_allowed' => 'Platform', |
||
780 | 'enable_iframe_inclusion' => 'Editor', |
||
781 | 'show_hot_courses' => 'Platform', |
||
782 | 'enable_webcam_clip' => 'Tools', |
||
783 | 'use_custom_pages' => 'Platform', |
||
784 | 'tool_visible_by_default_at_creation' => 'Tools', |
||
785 | 'prevent_session_admins_to_manage_all_users' => 'Session', |
||
786 | 'documents_default_visibility_defined_in_course' => 'Tools', |
||
787 | 'enabled_mathjax' => 'Editor', |
||
788 | 'meta_twitter_site' => 'Tracking', |
||
789 | 'meta_twitter_creator' => 'Tracking', |
||
790 | 'meta_title' => 'Tracking', |
||
791 | 'meta_description' => 'Tracking', |
||
792 | 'meta_image_path' => 'Tracking', |
||
793 | 'allow_teachers_to_create_sessions' => 'Session', |
||
794 | 'institution_address' => 'Platform', |
||
795 | 'chamilo_database_version' => 'null', |
||
796 | 'cron_remind_course_finished_activate' => 'Crons', |
||
797 | 'cron_remind_course_expiration_frequency' => 'Crons', |
||
798 | 'cron_remind_course_expiration_activate' => 'Crons', |
||
799 | 'allow_coach_feedback_exercises' => 'Session', |
||
800 | 'allow_my_files' => 'Platform', |
||
801 | 'ticket_allow_student_add' => 'Ticket', |
||
802 | 'ticket_send_warning_to_all_admins' => 'Ticket', |
||
803 | 'ticket_warn_admin_no_user_in_category' => 'Ticket', |
||
804 | 'ticket_allow_category_edition' => 'Ticket', |
||
805 | 'load_term_conditions_section' => 'Platform', |
||
806 | 'show_terms_if_profile_completed' => 'Ticket', |
||
807 | 'hide_home_top_when_connected' => 'Platform', |
||
808 | 'hide_global_announcements_when_not_connected' => 'Platform', |
||
809 | 'course_creation_use_template' => 'Course', |
||
810 | 'allow_strength_pass_checker' => 'Security', |
||
811 | 'allow_captcha' => 'Security', |
||
812 | 'captcha_number_mistakes_to_block_account' => 'Security', |
||
813 | 'captcha_time_to_block' => 'Security', |
||
814 | 'drh_can_access_all_session_content' => 'Session', |
||
815 | 'display_groups_forum_in_general_tool' => 'Tools', |
||
816 | 'allow_tutors_to_assign_students_to_session' => 'Session', |
||
817 | 'allow_lp_return_link' => 'Course', |
||
818 | 'hide_scorm_export_link' => 'Course', |
||
819 | 'hide_scorm_copy_link' => 'Course', |
||
820 | 'hide_scorm_pdf_link' => 'Course', |
||
821 | 'session_days_before_coach_access' => 'Session', |
||
822 | 'session_days_after_coach_access' => 'Session', |
||
823 | 'pdf_logo_header' => 'Course', |
||
824 | 'order_user_list_by_official_code' => 'Platform', |
||
825 | 'email_alert_manager_on_new_quiz' => 'exercise', |
||
826 | 'show_official_code_exercise_result_list' => 'Tools', |
||
827 | 'course_catalog_hide_private' => 'Platform', |
||
828 | 'catalog_show_courses_sessions' => 'Platform', |
||
829 | 'auto_detect_language_custom_pages' => 'Platform', |
||
830 | 'lp_show_reduced_report' => 'Course', |
||
831 | 'allow_session_course_copy_for_teachers' => 'Session', |
||
832 | 'hide_logout_button' => 'Platform', |
||
833 | 'redirect_admin_to_courses_list' => 'Platform', |
||
834 | 'course_images_in_courses_list' => 'Course', |
||
835 | 'student_publication_to_take_in_gradebook' => 'Gradebook', |
||
836 | 'certificate_filter_by_official_code' => 'Gradebook', |
||
837 | 'exercise_max_ckeditors_in_page' => 'Tools', |
||
838 | 'document_if_file_exists_option' => 'Tools', |
||
839 | 'add_gradebook_certificates_cron_task_enabled' => 'Gradebook', |
||
840 | 'openbadges_backpack' => 'Gradebook', |
||
841 | 'cookie_warning' => 'Tools', |
||
842 | 'hide_course_group_if_no_tools_available' => 'Tools', |
||
843 | 'catalog_allow_session_auto_subscription' => 'Session', |
||
844 | 'registration.soap.php.decode_utf8' => 'Platform', |
||
845 | 'allow_delete_attendance' => 'Tools', |
||
846 | 'gravatar_enabled' => 'Platform', |
||
847 | 'gravatar_type' => 'Platform', |
||
848 | 'limit_session_admin_role' => 'Session', |
||
849 | 'show_session_description' => 'Session', |
||
850 | 'hide_certificate_export_link_students' => 'Gradebook', |
||
851 | 'hide_certificate_export_link' => 'Gradebook', |
||
852 | 'dropbox_hide_course_coach' => 'Tools', |
||
853 | 'dropbox_hide_general_coach' => 'Tools', |
||
854 | 'session_course_ordering' => 'Session', |
||
855 | 'gamification_mode' => 'Platform', |
||
856 | 'prevent_multiple_simultaneous_login' => 'Security', |
||
857 | 'gradebook_detailed_admin_view' => 'Gradebook', |
||
858 | 'course_catalog_published' => 'Course', |
||
859 | 'user_reset_password' => 'Security', |
||
860 | 'user_reset_password_token_limit' => 'Security', |
||
861 | 'my_courses_view_by_session' => 'Session', |
||
862 | 'show_full_skill_name_on_skill_wheel' => 'Platform', |
||
863 | 'messaging_allow_send_push_notification' => 'WebServices', |
||
864 | 'messaging_gdc_project_number' => 'WebServices', |
||
865 | 'messaging_gdc_api_key' => 'WebServices', |
||
866 | 'teacher_can_select_course_template' => 'Course', |
||
867 | 'enable_record_audio' => 'Tools', |
||
868 | 'allow_show_skype_account' => 'Platform', |
||
869 | 'allow_show_linkedin_url' => 'Platform', |
||
870 | 'enable_profile_user_address_geolocalization' => 'User', |
||
871 | 'show_official_code_whoisonline' => 'Profile', |
||
872 | 'icons_mode_svg' => 'display', |
||
873 | 'user_name_order' => 'display', |
||
874 | 'user_name_sort_by' => 'display', |
||
875 | 'default_calendar_view' => 'agenda', |
||
876 | 'exercise_invisible_in_session' => 'exercise', |
||
877 | 'configure_exercise_visibility_in_course' => 'exercise', |
||
878 | 'allow_download_documents_by_api_key' => 'Webservices', |
||
879 | 'ProfilingFilterAddingUsers' => 'profile', |
||
880 | 'donotlistcampus' => 'platform', |
||
881 | 'gradebook_show_percentage_in_reports' => 'gradebook', |
||
882 | 'course_creation_splash_screen' => 'Course', |
||
883 | 'translate_html' => 'Editor', |
||
884 | 'enable_bootstrap_in_documents_html' => 'Course', |
||
885 | ]; |
||
886 | } |
||
887 | |||
888 | /** |
||
889 | * Rename old variable with variable used in Chamilo 2.0. |
||
890 | * |
||
891 | * @param string $variable |
||
892 | */ |
||
893 | private function renameVariable($variable) |
||
921 | } |
||
922 | |||
923 | /** |
||
924 | * Replace old Chamilo 1.x category with 2.0 version. |
||
925 | * |
||
926 | * @param string $variable |
||
927 | * @param string $defaultCategory |
||
928 | */ |
||
929 | private function fixCategory($variable, $defaultCategory) |
||
1068 | } |
||
1069 | } |
||
1070 |