Fixing classic admin.

1.10.x
Julio Montoya 10 years ago
parent 630cfde440
commit d12b6b47c9
  1. 3
      app/Resources/views/layout.html.twig
  2. 2
      app/config/routing.yml
  3. 4
      app/config/sonata/sonata_page.yml
  4. 11
      src/ChamiloLMS/CoreBundle/Controller/Admin/AdminController.php
  5. 63
      src/ChamiloLMS/CoreBundle/Menu/SimpleMenuBuilder.php
  6. 129
      src/ChamiloLMS/CoreBundle/Resources/views/Admin/index.html.twig
  7. 2
      web/app_dev.php

@ -42,7 +42,8 @@
{{ mopa_bootstrap_menu('ChamiloLMSCoreBundle:SimpleMenuBuilder:loginMenu', {'automenu': 'pills', 'stacked':true}) }}
{% endif %}
{{ mopa_bootstrap_menu('ChamiloLMSCoreBundle:SimpleMenuBuilder:helpMenu', {'automenu': 'pills', 'stacked':true}) }}
{#{{ mopa_bootstrap_menu('ChamiloLMSCoreBundle:SimpleMenuBuilder:helpMenu', {'automenu': 'pills', 'stacked':true}) }}#}
{% endblock %}
{% block javascripts_head %}

@ -10,7 +10,7 @@ _front:
_admin:
resource: routing_admin.yml
prefix: /admin
prefix: /administration
_api:
resource: routing_api.yml

@ -14,11 +14,11 @@ sonata_page:
use_streamed_response: false # set the value to false in debug mode or if the reverse proxy does not handle streamed response
ignore_uri_patterns:
- ^/admin(.*)
- ^/administration(.*) # sonata admin
- ^/api/(.*)
ignore_route_patterns:
- (.*)admin(.*) # ignore admin route, ie route containing 'admin'
- (.*)administration(.*) # ignore admin route, ie route containing 'admin' # sonata admin
- ^_(.*) # ignore symfony routes
- login
- home

@ -24,12 +24,11 @@ class AdminController extends BaseController
*/
public function indexAction()
{
$template = $this->getTemplate();
$security = $this->getSecurity();
if (!$security->isGranted('ROLE_ADMIN')) {
//return $this->abort(403, 'Access denied');
}
// Already filter by the router
/*if (!$security->isGranted('ROLE_ADMIN')) {
return $this->abort(403, 'Access denied');
}*/
if ($security->isGranted('ROLE_ADMIN')) {
return $this->loadAdminMenu();
@ -214,7 +213,7 @@ class AdminController extends BaseController
$items[] = array('url' => $adminUrl.'filler.php', 'label' => get_lang('DataFiller'));
}
$items[] = array('url' => $adminUrl.'archive_cleanup.php', 'label' => get_lang('ArchiveDirCleanup'));
$items[] = array('url' => $adminUrl.'system_management.php', 'label' => get_lang('SystemManagement'));
//$items[] = array('url' => $adminUrl.'system_management.php', 'label' => get_lang('SystemManagement'));
$blocks['settings']['items'] = $items;
$blocks['settings']['extra'] = null;

@ -91,7 +91,68 @@ class SimpleMenuBuilder extends ContainerAware
)
);
$menu->addChild('Administration',array('route' => 'administration'));
/*$menu->addChild(
'Plugins',
array(
'route' => 'main',
'routeParameters' => array('name' => urlencode('admin/plugins.php')),
array("attributes" => array("id" => 'nav'))
)
);*/
/*$menu->addChild(
'Sonata Admin',
array(
'route' => 'admin'
)
);*/
$admin = $menu->addChild(
'Administration',
array(
'route' => 'administration',
)
);
$admin->addChild(
'Users',
array(
'route' => 'main',
'routeParameters' => array('name' => 'admin/user_list.php'),
array("attributes" => array("id" => 'nav'))
)
);
$admin->addChild(
'Courses',
array(
'route' => 'main',
'routeParameters' => array('name' => 'admin/course_list.php'),
array("attributes" => array("id" => 'nav'))
)
);
$admin->addChild(
'Sessions',
array(
'route' => 'main',
'routeParameters' => array('name' => 'session/session_list.php'),
array("attributes" => array("id" => 'nav'))
)
);
$menu->addChild(
'Sonata Admin',
array(
'route' => 'sonata_admin_dashboard'
)
);
// Sonata admin
//$menu->addChild('Administration', array('route' => 'administration'));
/*
$dropdownExtrasOptions = $isFooter ? array(

@ -1,78 +1,67 @@
{% extends '::Themes/page.html.twig' %}
{% block layout %}
{% embed '::Layouts/3-9.html.twig' %}
{% block content %}
{% autoescape false %}
<div id="settings">
{% for block_item in blocks %}
<div id="tabs-{{ loop.index }}" class="col-md-6">
<div class="well_border">
<h4>{{ block_item.icon }} {{ block_item.label }}</h4>
<div>
{{ block_item.search_form }}
</div>
{% if block_item.items is not empty %}
<ul>
{% for url in block_item.items %}
{% if url.url is not empty %}
<li>
<a href="{{ url.url }}">
{{ url.label }}
</a>
</li>
{% endif %}
{% endfor %}
</ul>
{% endif %}
{% if block_item.extra is not null %}
<div>
{{ block_item.extra }}
</div>
{% endif %}
</div>
{% extends "::layout.html.twig" %}
{% block page_content %}
{% autoescape false %}
<div id="settings">
{% for block_item in blocks %}
<div id="tabs-{{ loop.index }}" class="col-md-6">
<div class="well_border">
<h4>{{ block_item.icon }} {{ block_item.label }}</h4>
<div>
{{ block_item.search_form }}
</div>
{% endfor %}
{% if block_item.items is not empty %}
<ul>
{% for url in block_item.items %}
{% if url.url is not empty %}
<li>
<a href="{{ url.url }}">
{{ url.label }}
</a>
</li>
{% endif %}
{% endfor %}
</ul>
{% endif %}
{% if block_item.extra is not null %}
<div>
{{ block_item.extra }}
</div>
{% endif %}
</div>
</div>
{% endfor %}
<div class="row">
{% for role in app.user.roles %}
{% set role = role | lower | replace ({ 'role_' : ''}) %}
<div class="row">
{% for role in app.user.roles %}
{% set role = role.role | lower | replace ({ 'role_' : ''}) %}
{% if role in ['global_admin'] %}
{% include "ChamiloLMSCoreBundle:Admin:" ~ role ~ "/role_index.html.twig" %}
{% endif %}
{% endfor %}
</div>
</div>
{% if role in ['global_admin'] %}
{% include "ChamiloLMSCoreBundle:Admin:" ~ role ~ "/role_index.html.twig" %}
{% endif %}
{% endfor %}
{% if is_granted('ROLE_ADMIN') %}
<script>
$(function() {
$.ajax({
url:'{{ web_admin_ajax_url }}?a=version',
success:function(version){
$(".admin-block-version").html(version);
}
});
});
</script>
<div class="row">
<div class="col-md-12">
<div class="well_border">
<h3>{{ 'VersionCheck' | trans }} </h3>
<div class="admin-block-version"></div>
</div>
</div>
{% if is_granted('ROLE_ADMIN') %}
<script>
$(function() {
$.ajax({
url:'{{ web_admin_ajax_url }}?a=version',
success:function(version){
$(".admin-block-version").html(version);
}
});
});
</script>
<div class="row">
<div class="col-md-12">
<div class="well_border">
<h3>{{ 'VersionCheck' | trans }} </h3>
<div class="admin-block-version"></div>
</div>
</div>
</div>
{% endif %}
{% endautoescape %}
{% endblock %}
{% endembed %}
</div>
{% endif %}
{% endautoescape %}
{% endblock %}

@ -22,7 +22,7 @@ require_once __DIR__.'/legacy.php';
// using different relative paths, you must change the request
// object to use the SiteRequest
//$request = Request::createFromGlobals('host_with_path');
$request = Sonata\PageBundle\Request\RequestFactory::createFromGlobals('host_with_path');
$request = Sonata\PageBundle\Request\RequestFactory::createFromGlobals('host_with_path_by_locale');
$kernel = new AppKernel('dev', true);

Loading…
Cancel
Save