fix menu courses - refs #2681

pull/2818/head
Alex Aragón 6 years ago
parent 505f5a0a69
commit 9f8e492b55
  1. 56
      assets/css/scss/_sidebar.scss
  2. 2
      assets/js/app.js
  3. 2
      src/CoreBundle/Menu/LeftMenuBuilder.php
  4. 126
      src/CoreBundle/Menu/NavBuilder.php
  5. 18
      src/ThemeBundle/Resources/views/Layout/sidebar.html.twig

@ -194,14 +194,39 @@
position: relative;
border-radius: 0;
&.dropdown{
&.open{
a{
.arrow{
transform: rotate(90deg);
}
}
}
.arrow{
line-height: 35px;
position: absolute;
right: 15px;
transition: all .05s ease-in;
i{
font-size: 12px;
}
}
ul{
&.dropdown-menu{
background-color: #3D66CA;
padding: 0;
border: none;
border-radius: 0;
.sidebar-link{
padding: 8px 15px;
.sub-link{
i{
height: 35px;
left: 0;
line-height: 35px;
margin-right: 14px;
position: relative;
text-align: center;
transition: all 0.3s ease;
width: 40px;
}
}
}
}
@ -215,19 +240,20 @@
padding: 5px 15px;
position: relative;
white-space: nowrap;
i {
border-radius: 6px;
display: inline-block;
font-size: 17px;
height: 35px;
left: 0;
line-height: 35px;
margin-right: 14px;
position: relative;
text-align: center;
transition: all 0.3s ease;
width: 40px;
.icon-holder{
i {
border-radius: 6px;
display: inline-block;
font-size: 17px;
height: 35px;
left: 0;
line-height: 35px;
margin-right: 14px;
position: relative;
text-align: center;
transition: all 0.3s ease;
width: 40px;
}
}
&.active {

@ -27,7 +27,7 @@ var disconnect_lang = 'ChatDisconnected';
$( document ).ready(function() {
console.log( "ready!" );
$("#menu_courses").prop("href", "#");
$("#menu_courses").prop("href", "javascript:void(0);");
});
$(function() {
var isInCourse = $("body").data("in-course");

@ -27,7 +27,7 @@ class LeftMenuBuilder implements ContainerAwareInterface
*/
public function courseMenu(FactoryInterface $factory, array $options)
{
$checker = $this->container->get('security.authorization_checker');
//$checker = $this->container->get('security.authorization_checker');
$menu = $factory->createItem('root');
$translator = $this->container->get('translator');
$checked = $this->container->get('session')->get('IS_AUTHENTICATED_FULLY');

@ -10,6 +10,7 @@ use Knp\Menu\FactoryInterface;
use Knp\Menu\ItemInterface;
use Symfony\Component\DependencyInjection\ContainerAwareInterface;
use Symfony\Component\DependencyInjection\ContainerAwareTrait;
use Chamilo\CoreBundle\Menu\LeftMenuBuilder;
/**
* Class NavBuilder.
@ -78,6 +79,14 @@ class NavBuilder implements ContainerAwareInterface
if ($checker && $checker->isGranted('IS_AUTHENTICATED_FULLY')) {
$menu->addChild(
'courses',
[
'label' => $translator->trans('Courses'),
'icon' => 'book'
]
);
$menu['courses']->addChild(
'courses',
[
'label' => $translator->trans('My courses'),
@ -90,21 +99,23 @@ class NavBuilder implements ContainerAwareInterface
);
$lang = $translator->trans('CreateCourse');
if ($settingsManager->getSetting('course.course_validation') == 'true') {
$lang = $translator->trans('CreateCourseRequest');
}
if (api_is_allowed_to_create_course()) {
$lang = $translator->trans('CreateCourse');
if ($settingsManager->getSetting('course.course_validation') == 'true') {
$lang = $translator->trans('CreateCourseRequest');
}
$menu['courses']->addChild(
'create-course',
[
'label' => $lang,
'route' => 'legacy_main',
'routeParameters' => [
'name' => 'create_course/add_course.php',
],
]
);
$menu['courses']->addChild(
'create-course',
[
'label' => $lang,
'route' => 'legacy_main',
'routeParameters' => [
'name' => 'create_course/add_course.php',
],
]
);
}
$browse = $settingsManager->getSetting('display.allow_students_to_browse_courses');
@ -125,6 +136,7 @@ class NavBuilder implements ContainerAwareInterface
}
}
$menu->addChild(
'calendar',
[
@ -288,4 +300,90 @@ class NavBuilder implements ContainerAwareInterface
return $menu;
}
/**
* Course menu.
*
* @param FactoryInterface $factory
* @param array $options
*
* @return ItemInterface
*/
public function courseMenu(FactoryInterface $factory, array $options)
{
$checker = $this->container->get('security.authorization_checker');
$menu = $factory->createItem('root');
$translator = $this->container->get('translator');
$checked = $this->container->get('session')->get('IS_AUTHENTICATED_FULLY');
$settingsManager = $this->container->get('chamilo.settings.manager');
if ($checked) {
$menu->setChildrenAttribute('class', 'nav nav-pills nav-stacked');
$menu->addChild(
$translator->trans('MyCourses'),
[
'route' => 'userportal',
'routeParameters' => ['type' => 'courses'],
]
);
return $menu;
if (api_is_allowed_to_create_course()) {
$lang = $translator->trans('CreateCourse');
if ($settingsManager->getSetting('course.course_validation') == 'true') {
$lang = $translator->trans('CreateCourseRequest');
}
$menu->addChild(
$lang,
['route' => 'add_course']
);
}
$link = $this->container->get('router')->generate('web.main');
$menu->addChild(
$translator->trans('ManageCourses'),
[
'uri' => $link.'auth/courses.php?action=sortmycourses',
]
);
$browse = $settingsManager->getSetting('display.allow_students_to_browse_courses');
if ($browse == 'true') {
if ($checker->isGranted('ROLE_STUDENT') && !api_is_drh(
) && !api_is_session_admin()
) {
$menu->addChild(
$translator->trans('CourseCatalog'),
[
'uri' => $link.'auth/courses.php',
]
);
} else {
$menu->addChild(
$translator->trans('Dashboard'),
[
'uri' => $link.'dashboard/index.php',
]
);
}
}
/** @var \Knp\Menu\MenuItem $menu */
$menu->addChild(
$translator->trans('History'),
[
'route' => 'userportal',
'routeParameters' => [
'type' => 'sessions',
'filter' => 'history',
],
]
);
}
return $menu;
}
}

@ -15,12 +15,16 @@
<span class="title">
{{ item.label }}
</span>
{% if children > 0 %}
<span class="arrow"><i class="fas fa-angle-right"></i></span>
{% endif %}
</a>
{% if children > 0 %}
<ul id="submenu_{{ item.name }}" class="dropdown-menu">
{% for item in item.children %}
<li>
<a href="{{ item.uri }}" class="sidebar-link">
<a href="{{ item.uri }}" class="sub-link">
<i class="far fa-circle"></i>
{{ item.label }}
</a>
</li>
@ -36,19 +40,25 @@
<li class="nav-item">
<a class='sidebar-link' href="https://docs.chamilo.org/">
<i class="far fa-file-alt"></i>
<span class="icon-holder">
<i class="far fa-file-alt"></i>
</span>
{{ "Documentation"|trans }}
</a>
</li>
<li class="nav-item">
<a class='sidebar-link' href="https://forum.chamilo.org/">
<i class="fa fa-users"></i>
<span class="icon-holder">
<i class="fa fa-users"></i>
</span>
{{ "Forums"|trans }}
</a>
</li>
<li class="nav-item">
<a class='sidebar-link' href="https://github.com/chamilo/chamilo-lms">
<i class="fab fa-github"></i>
<span class="icon-holder">
<i class="fab fa-github"></i>
</span>
{{ "GithubRepository"|trans }}
</a>
</li>

Loading…
Cancel
Save