Skip to content

Commit

Permalink
Convert $_configuration['remove_session_url'] to a DB setting
Browse files Browse the repository at this point in the history
  • Loading branch information
jmontoyaa committed Aug 17, 2018
1 parent d0b3741 commit 46eb8c0
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 8 deletions.
5 changes: 4 additions & 1 deletion main/inc/lib/api.lib.php
Expand Up @@ -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;
}
Expand Down
2 changes: 1 addition & 1 deletion main/inc/lib/userportal.lib.php
Expand Up @@ -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(
Expand Down
5 changes: 1 addition & 4 deletions main/install/configuration.dist.php
Expand Up @@ -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
/*
Expand Down
Expand Up @@ -5,7 +5,7 @@
<div class="panel-heading">
{% if row.course_list_session_style == 1 %}
{# Classic #}
{% if remove_session_url == true %}
{% if remove_session_url == 'true' %}
<a style="cursor:default">
{% else %}
<a href="{{ _p.web_main ~ 'session/index.php?session_id=' ~ row.id }}">
Expand Down
5 changes: 4 additions & 1 deletion src/CoreBundle/Settings/SessionSettingsSchema.php
Expand Up @@ -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;

/**
Expand Down Expand Up @@ -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'
]
)
;
Expand Down Expand Up @@ -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', ]
Expand All @@ -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)
;
}
}

0 comments on commit 46eb8c0

Please sign in to comment.