diff --git a/main/inc/lib/api.lib.php b/main/inc/lib/api.lib.php index 10709fd45c5..d17f590ed68 100644 --- a/main/inc/lib/api.lib.php +++ b/main/inc/lib/api.lib.php @@ -7406,10 +7406,13 @@ function api_get_course_url($courseCode = null, $sessionId = null, $groupId = nu if (!empty($courseDirectory)) { // directory not empty, so we do have a course $url = api_get_path(WEB_COURSE_PATH).$courseDirectory.'/index.php?id_session='.$sessionId.'&gidReq='.$groupId; - } elseif (!empty($sessionId) && api_get_configuration_value('remove_session_url') !== true) { + } elseif (!empty($sessionId) && + api_get_setting('session.remove_session_url') !== 'true' + ) { // if the course was unset and the session was set, send directly to the session $url = api_get_path(WEB_CODE_PATH).'session/index.php?session_id='.$sessionId; } + // if not valid combination was found, return an empty string return $url; } diff --git a/main/inc/lib/userportal.lib.php b/main/inc/lib/userportal.lib.php index db5649d3d19..01ac5d51047 100755 --- a/main/inc/lib/userportal.lib.php +++ b/main/inc/lib/userportal.lib.php @@ -1784,7 +1784,7 @@ public function returnCoursesAndSessions( $this->tpl->assign('session', $listSession); $this->tpl->assign('show_tutor', (api_get_setting('show_session_coach') === 'true' ? true : false)); $this->tpl->assign('gamification_mode', $gameModeIsActive); - $this->tpl->assign('remove_session_url', api_get_configuration_value('remove_session_url')); + $this->tpl->assign('remove_session_url', api_get_setting('session.remove_session_url')); if ($viewGridCourses) { $sessions_with_no_category = $this->tpl->fetch( diff --git a/main/install/configuration.dist.php b/main/install/configuration.dist.php index b493db261c9..67c659b22e7 100755 --- a/main/install/configuration.dist.php +++ b/main/install/configuration.dist.php @@ -359,10 +359,7 @@ ] ]; */ -// Hide session link of course_block on index/userportal -//$_configuration['remove_session_url']= false ; -// -// + // ------ AGENDA CONFIGURATION SETTINGS // Shows a legend in the agenda tool /* diff --git a/main/template/default/user_portal/classic_session.html.twig b/main/template/default/user_portal/classic_session.html.twig index b45f4b8796a..378af01c822 100644 --- a/main/template/default/user_portal/classic_session.html.twig +++ b/main/template/default/user_portal/classic_session.html.twig @@ -5,7 +5,7 @@
{% if row.course_list_session_style == 1 %} {# Classic #} - {% if remove_session_url == true %} + {% if remove_session_url == 'true' %} {% else %} diff --git a/src/CoreBundle/Settings/SessionSettingsSchema.php b/src/CoreBundle/Settings/SessionSettingsSchema.php index 40c4f157de0..4fdb78337bf 100644 --- a/src/CoreBundle/Settings/SessionSettingsSchema.php +++ b/src/CoreBundle/Settings/SessionSettingsSchema.php @@ -5,6 +5,7 @@ use Chamilo\CoreBundle\Form\Type\YesNoType; use Sylius\Bundle\SettingsBundle\Schema\SettingsBuilderInterface; +use Symfony\Component\Form\Extension\Core\Type\TextType; use Symfony\Component\Form\FormBuilderInterface; /** @@ -44,6 +45,7 @@ public function buildSettings(SettingsBuilderInterface $builder) 'session_days_after_coach_access' => '', 'session_days_before_coach_access' => '', 'show_session_description' => 'false', + 'remove_session_url' => 'false' ] ) ; @@ -81,7 +83,7 @@ public function buildForm(FormBuilderInterface $builder) ->add('prevent_session_admins_to_manage_all_users', YesNoType::class) ->add( 'session_course_ordering', - 'text', + TextType::class, [ 'label' => 'SessionCourseOrderingTitle', 'help_block' => 'SessionCourseOrderingComment', ] @@ -95,6 +97,7 @@ public function buildForm(FormBuilderInterface $builder) ->add('session_days_after_coach_access') ->add('session_days_before_coach_access') ->add('show_session_description', YesNoType::class) + ->add('remove_session_url', YesNoType::class) ; } }