Skip to content

Commit 46eb8c0

Browse files
committed
Convert $_configuration['remove_session_url'] to a DB setting
#2637
1 parent d0b3741 commit 46eb8c0

File tree

5 files changed

+11
-8
lines changed

5 files changed

+11
-8
lines changed

main/inc/lib/api.lib.php

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7406,10 +7406,13 @@ function api_get_course_url($courseCode = null, $sessionId = null, $groupId = nu
74067406
if (!empty($courseDirectory)) {
74077407
// directory not empty, so we do have a course
74087408
$url = api_get_path(WEB_COURSE_PATH).$courseDirectory.'/index.php?id_session='.$sessionId.'&gidReq='.$groupId;
7409-
} elseif (!empty($sessionId) && api_get_configuration_value('remove_session_url') !== true) {
7409+
} elseif (!empty($sessionId) &&
7410+
api_get_setting('session.remove_session_url') !== 'true'
7411+
) {
74107412
// if the course was unset and the session was set, send directly to the session
74117413
$url = api_get_path(WEB_CODE_PATH).'session/index.php?session_id='.$sessionId;
74127414
}
7415+
74137416
// if not valid combination was found, return an empty string
74147417
return $url;
74157418
}

main/inc/lib/userportal.lib.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1784,7 +1784,7 @@ public function returnCoursesAndSessions(
17841784
$this->tpl->assign('session', $listSession);
17851785
$this->tpl->assign('show_tutor', (api_get_setting('show_session_coach') === 'true' ? true : false));
17861786
$this->tpl->assign('gamification_mode', $gameModeIsActive);
1787-
$this->tpl->assign('remove_session_url', api_get_configuration_value('remove_session_url'));
1787+
$this->tpl->assign('remove_session_url', api_get_setting('session.remove_session_url'));
17881788

17891789
if ($viewGridCourses) {
17901790
$sessions_with_no_category = $this->tpl->fetch(

main/install/configuration.dist.php

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -359,10 +359,7 @@
359359
]
360360
];
361361
*/
362-
// Hide session link of course_block on index/userportal
363-
//$_configuration['remove_session_url']= false ;
364-
//
365-
//
362+
366363
// ------ AGENDA CONFIGURATION SETTINGS
367364
// Shows a legend in the agenda tool
368365
/*

main/template/default/user_portal/classic_session.html.twig

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
<div class="panel-heading">
66
{% if row.course_list_session_style == 1 %}
77
{# Classic #}
8-
{% if remove_session_url == true %}
8+
{% if remove_session_url == 'true' %}
99
<a style="cursor:default">
1010
{% else %}
1111
<a href="{{ _p.web_main ~ 'session/index.php?session_id=' ~ row.id }}">

src/CoreBundle/Settings/SessionSettingsSchema.php

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55

66
use Chamilo\CoreBundle\Form\Type\YesNoType;
77
use Sylius\Bundle\SettingsBundle\Schema\SettingsBuilderInterface;
8+
use Symfony\Component\Form\Extension\Core\Type\TextType;
89
use Symfony\Component\Form\FormBuilderInterface;
910

1011
/**
@@ -44,6 +45,7 @@ public function buildSettings(SettingsBuilderInterface $builder)
4445
'session_days_after_coach_access' => '',
4546
'session_days_before_coach_access' => '',
4647
'show_session_description' => 'false',
48+
'remove_session_url' => 'false'
4749
]
4850
)
4951
;
@@ -81,7 +83,7 @@ public function buildForm(FormBuilderInterface $builder)
8183
->add('prevent_session_admins_to_manage_all_users', YesNoType::class)
8284
->add(
8385
'session_course_ordering',
84-
'text',
86+
TextType::class,
8587
[
8688
'label' => 'SessionCourseOrderingTitle',
8789
'help_block' => 'SessionCourseOrderingComment', ]
@@ -95,6 +97,7 @@ public function buildForm(FormBuilderInterface $builder)
9597
->add('session_days_after_coach_access')
9698
->add('session_days_before_coach_access')
9799
->add('show_session_description', YesNoType::class)
100+
->add('remove_session_url', YesNoType::class)
98101
;
99102
}
100103
}

0 commit comments

Comments
 (0)