parent
136793be5c
commit
2d2785100b
@ -0,0 +1,198 @@ |
|||||||
|
<?php |
||||||
|
/* For licensing terms, see /license.txt */ |
||||||
|
|
||||||
|
namespace Chamilo\CoreBundle\Menu; |
||||||
|
|
||||||
|
use Chamilo\UserBundle\Entity\User; |
||||||
|
use Knp\Menu\FactoryInterface; |
||||||
|
use Knp\Menu\ItemInterface; |
||||||
|
use Symfony\Component\DependencyInjection\ContainerAware; |
||||||
|
use Symfony\Component\Routing\RouterInterface; |
||||||
|
|
||||||
|
/** |
||||||
|
* Class NavBuilder |
||||||
|
* @package Chamilo\CoreBundle\Menu |
||||||
|
*/ |
||||||
|
class NavBuilder extends ContainerAware |
||||||
|
{ |
||||||
|
/** |
||||||
|
* @param array $itemOptions The options given to the created menuItem |
||||||
|
* @param string $currentUri The current URI |
||||||
|
* |
||||||
|
* @return \Knp\Menu\ItemInterface |
||||||
|
*/ |
||||||
|
public function createCategoryMenu(array $itemOptions = array(), $currentUri = null) |
||||||
|
{ |
||||||
|
$factory = $this->container->get('knp_menu.factory'); |
||||||
|
$menu = $factory->createItem('categories', $itemOptions); |
||||||
|
|
||||||
|
$this->buildCategoryMenu($menu, $itemOptions, $currentUri); |
||||||
|
|
||||||
|
return $menu; |
||||||
|
} |
||||||
|
|
||||||
|
/** |
||||||
|
* @param \Knp\Menu\ItemInterface $menu The item to fill with $routes |
||||||
|
* @param array $options The item options |
||||||
|
* @param string $currentUri The current URI |
||||||
|
*/ |
||||||
|
public function buildCategoryMenu(ItemInterface $menu, array $options = array(), $currentUri = null) |
||||||
|
{ |
||||||
|
//$categories = $this->categoryManager->getCategoryTree(); |
||||||
|
|
||||||
|
//$this->fillMenu($menu, $categories, $options, $currentUri); |
||||||
|
$menu->addChild('home', array('route' => 'home')); |
||||||
|
} |
||||||
|
|
||||||
|
/** |
||||||
|
* Top menu left |
||||||
|
* @param FactoryInterface $factory |
||||||
|
* @param array $options |
||||||
|
* @return \Knp\Menu\ItemInterface |
||||||
|
*/ |
||||||
|
public function leftMenu(FactoryInterface $factory, array $options) |
||||||
|
{ |
||||||
|
$checker = $this->container->get('security.authorization_checker'); |
||||||
|
$translator = $this->container->get('translator'); |
||||||
|
|
||||||
|
$menu = $factory->createItem('root'); |
||||||
|
$menu->setChildrenAttribute('class', 'nav navbar-nav'); |
||||||
|
|
||||||
|
$menu->addChild( |
||||||
|
$translator->trans('Home'), |
||||||
|
array('route' => 'home') |
||||||
|
); |
||||||
|
|
||||||
|
if ($checker->isGranted('IS_AUTHENTICATED_FULLY')) { |
||||||
|
|
||||||
|
$menu->addChild( |
||||||
|
$translator->trans('MyCourses'), |
||||||
|
array('route' => 'userportal') |
||||||
|
); |
||||||
|
|
||||||
|
$menu->addChild( |
||||||
|
$translator->trans('Calendar'), |
||||||
|
array( |
||||||
|
'route' => 'main', |
||||||
|
'routeParameters' => array( |
||||||
|
'name' => 'calendar/agenda_js.php', |
||||||
|
), |
||||||
|
) |
||||||
|
); |
||||||
|
|
||||||
|
$menu->addChild( |
||||||
|
$translator->trans('Reporting'), |
||||||
|
array( |
||||||
|
'route' => 'main', |
||||||
|
'routeParameters' => array( |
||||||
|
'name' => 'mySpace/index.php', |
||||||
|
), |
||||||
|
) |
||||||
|
); |
||||||
|
|
||||||
|
$menu->addChild( |
||||||
|
$translator->trans('Social'), |
||||||
|
array( |
||||||
|
'route' => 'main', |
||||||
|
'routeParameters' => array( |
||||||
|
'name' => 'social/home.php', |
||||||
|
), |
||||||
|
) |
||||||
|
); |
||||||
|
|
||||||
|
$menu->addChild( |
||||||
|
$translator->trans('Dashboard'), |
||||||
|
array( |
||||||
|
'route' => 'main', |
||||||
|
'routeParameters' => array( |
||||||
|
'name' => 'dashboard/index.php', |
||||||
|
), |
||||||
|
) |
||||||
|
); |
||||||
|
|
||||||
|
if ($checker->isGranted('ROLE_ADMIN')) { |
||||||
|
$menu->addChild( |
||||||
|
$translator->trans('Administration'), |
||||||
|
array( |
||||||
|
'route' => 'administration', |
||||||
|
) |
||||||
|
); |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
return $menu; |
||||||
|
} |
||||||
|
|
||||||
|
/** |
||||||
|
* Top menu right |
||||||
|
* @param FactoryInterface $factory |
||||||
|
* @param array $options |
||||||
|
* @return \Knp\Menu\ItemInterface |
||||||
|
*/ |
||||||
|
public function rightMenu(FactoryInterface $factory, array $options) |
||||||
|
{ |
||||||
|
$checker = $this->container->get('security.authorization_checker'); |
||||||
|
|
||||||
|
$translator = $this->container->get('translator'); |
||||||
|
$menu = $factory->createItem('root'); |
||||||
|
|
||||||
|
// <nav class="navbar navbar-default"> |
||||||
|
if ($checker->isGranted('IS_AUTHENTICATED_FULLY')) { |
||||||
|
|
||||||
|
$token = $this->container->get('security.token_storage'); |
||||||
|
/** @var User $user */ |
||||||
|
$user = $token->getToken()->getUser(); |
||||||
|
|
||||||
|
$menu->setChildrenAttribute('class', 'nav navbar-nav navbar-right'); |
||||||
|
|
||||||
|
$dropdown = $menu->addChild( |
||||||
|
$user->getUsername() |
||||||
|
)->setAttribute('dropdown', true); |
||||||
|
|
||||||
|
$dropdown->addChild( |
||||||
|
$translator->trans('Profile'), |
||||||
|
array('route' => 'fos_user_profile_show') |
||||||
|
)->setAttribute('divider_append', true); |
||||||
|
|
||||||
|
$dropdown->addChild( |
||||||
|
$translator->trans('Inbox'), |
||||||
|
array( |
||||||
|
'route' => 'main', |
||||||
|
'routeParameters' => array( |
||||||
|
'name' => 'messages/inbox.php', |
||||||
|
), |
||||||
|
) |
||||||
|
)->setAttribute('divider_append', true); |
||||||
|
|
||||||
|
|
||||||
|
$logoutLink = $menu->addChild('Logout', array('route' => 'logout')); |
||||||
|
$logoutLink |
||||||
|
->setLinkAttributes(array( |
||||||
|
'id' => 'logout_button', |
||||||
|
'class' => 'fa fa-power-off' |
||||||
|
)) |
||||||
|
->setAttributes(array( |
||||||
|
/*'id' => 'signin', |
||||||
|
'class' => 'dropdown'*/ |
||||||
|
)) |
||||||
|
; |
||||||
|
} |
||||||
|
|
||||||
|
return $menu; |
||||||
|
} |
||||||
|
|
||||||
|
/*public function profileMenu(FactoryInterface $factory, array $options) |
||||||
|
{ |
||||||
|
$menu = $factory->createItem('root'); |
||||||
|
$security = $this->container->get('security.context'); |
||||||
|
if ($security->isGranted('IS_AUTHENTICATED_FULLY')) { |
||||||
|
$menu->setChildrenAttribute('class', 'nav nav-pills nav-stacked'); |
||||||
|
|
||||||
|
$menu->addChild('Inbox', array('route' => 'logout')); |
||||||
|
$menu->addChild('Compose', array('route' => 'logout')); |
||||||
|
$menu->addChild('Edit', array('route' => 'logout')); |
||||||
|
} |
||||||
|
|
||||||
|
return $menu; |
||||||
|
}*/ |
||||||
|
} |
@ -0,0 +1,64 @@ |
|||||||
|
{#<footer {% block footer_open_attributes %}{% endblock footer_open_attributes %}>#} |
||||||
|
<footer> |
||||||
|
<!-- start of #footer section --> |
||||||
|
<div class="container"> |
||||||
|
<div class="row"> |
||||||
|
<div id="footer_left" class="col-md-4"> |
||||||
|
{% if session_teachers is not null %} |
||||||
|
<div id="session_teachers"> |
||||||
|
{{ session_teachers }} |
||||||
|
</div> |
||||||
|
{% endif %} |
||||||
|
|
||||||
|
{% if teachers is not null %} |
||||||
|
<div id="teachers"> |
||||||
|
{{ teachers }} |
||||||
|
</div> |
||||||
|
{% endif %} |
||||||
|
|
||||||
|
{# Plugins for footer section #} |
||||||
|
{% if plugin_footer_left is not null %} |
||||||
|
<div id="plugin_footer_left"> |
||||||
|
{{ plugin_footer_left }} |
||||||
|
</div> |
||||||
|
{% endif %} |
||||||
|
|
||||||
|
</div> |
||||||
|
|
||||||
|
<div id="footer_center" class="col-md-4"> |
||||||
|
{# Plugins for footer section #} |
||||||
|
{% if plugin_footer_center is not null %} |
||||||
|
<div id="plugin_footer_center"> |
||||||
|
{{ plugin_footer_center }} |
||||||
|
</div> |
||||||
|
{% endif %} |
||||||
|
|
||||||
|
</div> |
||||||
|
|
||||||
|
<div id="footer_right" class="col-md-4"> |
||||||
|
|
||||||
|
<div id="admin_name"> |
||||||
|
{{ 'Manager' | trans }} |
||||||
|
</div> |
||||||
|
|
||||||
|
<div id="software_name"> |
||||||
|
{{ "Platform"|trans }} |
||||||
|
<a href="" target="_blank"> |
||||||
|
{{ software_name }} |
||||||
|
</a> |
||||||
|
© {{ "now"|date("Y") }} |
||||||
|
</div> |
||||||
|
|
||||||
|
{# Plugins for footer section #} |
||||||
|
{% if plugin_footer_right is not null %} |
||||||
|
<div id="plugin_footer_right"> |
||||||
|
{{ plugin_footer_right }} |
||||||
|
</div> |
||||||
|
{% endif %} |
||||||
|
|
||||||
|
</div><!-- end of #footer_right --> |
||||||
|
</div><!-- end of #row --> |
||||||
|
</div><!-- end of #container --> |
||||||
|
</footer> |
||||||
|
|
||||||
|
{{ footer_extra_content }} |
@ -0,0 +1,4 @@ |
|||||||
|
{% extends "@ChamiloTheme/Layout/base-layout.html.twig" %} |
||||||
|
|
||||||
|
{#{% extends 'SonataPageBundle::base_layout.html.twig' %}#} |
||||||
|
|
Loading…
Reference in new issue