Fix sonata integration with chamilo

pull/2528/head
jmontoyaa 8 years ago
parent 4017113fca
commit 130c388705
  1. 4
      config/packages/sonata_admin.yaml
  2. 8
      config/packages/sonata_block.yaml
  3. 6
      config/packages/sonata_media.yaml
  4. 10
      config/packages/sonata_page.yaml
  5. 2
      config/services.yaml
  6. 2
      main/install/install.lib.php
  7. 1
      public/.htaccess
  8. 47
      src/AdminBundle/Resources/views/standard_layout.html.twig
  9. 16
      src/CoreBundle/Menu/NavBuilder.php
  10. 62
      src/MediaBundle/Resources/views/Block/block_gallery.html.twig
  11. 5
      src/PageBundle/Resources/views/1column_layout.html.twig
  12. 21
      src/PageBundle/Resources/views/2columns_layout.html.twig
  13. 18
      src/PageBundle/Resources/views/base_layout.html.twig
  14. 38
      src/PageBundle/Resources/views/demo_2columns_layout.html.twig
  15. 130
      src/TimelineBundle/Resources/views/Block/timeline.html.twig

@ -39,8 +39,8 @@ sonata_admin:
dashboard:
blocks:
- {position: left, type: sonata.admin.block.admin_list}
# - { position: right, type: sonata.timeline.block.timeline, settings: { context: SONATA_ADMIN, max_per_page: 25, template: 'ChamiloTimelineBundle:Block:timeline.html.twig',}}
# - { position: right, type: sonata.admin_doctrine_orm.block.audit}
- {position: right, type: sonata.timeline.block.timeline, settings: {context: SONATA_ADMIN, max_per_page: 25, template: 'ChamiloTimelineBundle:Block:timeline.html.twig'}}
# - {position: right, type: sonata.admin_doctrine_orm.block.audit}
# - { position: center, type: sonata.block.service.text, settings: { content: "<h2>Welcome!</h2> You can customize this dashboard by editing the sonata_admin.yml file. The current dashboard presents the recent items from the NewsBundle and a timeline with the latest action"} }
#- { position: center, type: sonata.news.block.recent_posts, settings: { title: Recent Posts, number: 7, mode: admin }}
# - { position: left, type: sonata.block.service.text, settings: { content: "<div class='panel panel-default'><div class='panel-heading'><h3 class='panel-title'>Welcome!</h3></div><div class='panel-body'>You can customize this dashboard by editing the <code>sonata_admin.yml</code> file. The current dashboard presents the recent items from the NewsBundle and a non-statistical e-commerce information.</div></div>"} }

@ -1,7 +1,6 @@
sonata_block:
context_manager: sonata.page.block.context_manager
default_contexts: [sonata_page_bundle]
http_cache:
listener: true
# menus:
@ -10,16 +9,15 @@ sonata_block:
blocks:
# Chamilo blocks
chamilo_core.block.breadcrumb: ~
chamilo_core.block.course: ~
chamilo_core.block.skill: ~
# chamilo_core.block.breadcrumb: ~
# chamilo_core.block.course: ~
# chamilo_core.block.skill: ~
sonata.admin.block.stats:
contexts: [admin]
sonata.admin.block.admin_list:
contexts: [admin]
sonata.admin.block.search_result:
contexts: [admin]
sonata.admin_doctrine_orm.block.audit:
contexts: [admin]

@ -18,6 +18,7 @@ sonata_media:
- sonata.media.provider.vimeo
formats:
small: {width: 100, quality: 100}
medium: {width: 300, quality: 100}
big: {width: 970, quality: 100}
course:
providers:
@ -34,7 +35,6 @@ sonata_media:
- sonata.media.provider.dailymotion
- sonata.media.provider.youtube
- sonata.media.provider.image
formats:
abstract: {width: 100, quality: 100}
wide: {width: 820, quality: 100}
@ -55,14 +55,13 @@ sonata_media:
user:
providers:
- sonata.media.provider.image
formats:
small: {width: 100, quality: 100}
big: {width: 970, quality: 100}
cdn:
# define the public base url for the uploaded media
server:
path: '%url_append%%sonata_media.cdn.host%'
path: '%sonata_media.cdn.host%'
filesystem:
# define where the uploaded file will be stored
local:
@ -74,6 +73,7 @@ sonata_media:
# the resizer must be set to false, otherwhise this can delete icon files from the fs
resizer: false
image:
# resizer: sonata.media.resizer.square
thumbnail: sonata.media.thumbnail.format # default value
# thumbnail: sonata.media.thumbnail.consumer.format # can be used to dispatch the resize action to async task
# thumbnail: sonata.media.thumbnail.liip_imagine # use the LiipImagineBundle to resize the image

@ -83,8 +83,7 @@ sonata_page:
default_template: default
templates:
default:
path: 'ChamiloPageBundle::page_layout.html.twig'
# path: '::layout.html.twig'
path: 'ChamiloPageBundle::1column_layout.html.twig'
name: 'default'
containers:
header:
@ -111,8 +110,7 @@ sonata_page:
B: content_bottom
F: footer
2columns:
path: 'ChamiloPageBundle::demo_2columns_layout.html.twig'
# path: '::layout.html.twig'
path: 'ChamiloPageBundle::2columns_layout.html.twig'
name: '2 columns layout'
containers:
header:
@ -121,7 +119,7 @@ sonata_page:
name: Top content
left_col:
name: Left content
rigth_col:
right_col:
name: Right content
content_bottom:
name: Bottom content
@ -138,7 +136,7 @@ sonata_page:
H: header
T: content_top
L: left_col
R: rigth_col
R: right_col
B: content_bottom
F: footer
page_defaults:

@ -16,6 +16,6 @@ parameters:
mailer_user: admin@example.com
mailer_password: null
course_info_is_not_editable: false
sonata_media.cdn.host: /uploads/media
sonata_media.cdn.host: /public/uploads/media
sonata_page.varnish.command: 'if [ ! -r "/etc/varnish/secret" ]; then echo "VALID ERROR :/"; else varnishadm -S /etc/varnish/secret -T 127.0.0.1:6082 {{ COMMAND }} "{{ EXPRESSION }}"; fi;'
router.request_context.base_url: '%url_append%'

@ -2924,7 +2924,7 @@ function finishInstallationWithContainer(
$page = $pageManager->create();
$page->setSlug('homepage');
$page->setUrl('/homepage');
$page->setUrl('/');
$page->setName('homepage');
$page->setTitle('home');
$page->setEnabled(true);

@ -58,6 +58,7 @@ DirectoryIndex index.php
RewriteRule ^(bundles)($|/) - [L]
RewriteRule ^(img)($|/) - [L]
RewriteRule ^(libs)($|/) - [L]
RewriteRule ^(uploads)($|/) - [L]
# Rewrite all other queries to the front controller.
RewriteRule ^ %{ENV:BASE}/index.php [L]

@ -65,23 +65,21 @@ file that was distributed with this source code.
{% endfor %}
{% endblock %}
{% set locale = app.request.locale %}
{# localize moment #}
{% if locale[:2] != 'en' %}
{% set localeForMoment = canonicalize_locale_for_moment() %}
{% if localeForMoment %}
<script src="{{ asset(
'bundles/sonatacore/vendor/moment/locale/' ~
locale|lower|replace({'_':'-'}) ~
localeForMoment ~
'.js'
) }}"></script>
{% endif %}
{# localize select2 #}
{% if sonata_admin.adminPool.getOption('use_select2') %}
{% if locale == 'pt' %}{% set locale = 'pt_PT' %}{% endif %}
{# omit default EN locale #}
{% if locale[:2] != 'en' %}
<script src="{{ asset('bundles/sonatacore/vendor/select2/select2_locale_' ~ locale|replace({'_':'-'}) ~ '.js') }}"></script>
{% set localeForSelect2 = canonicalize_locale_for_select2() %}
{% if localeForSelect2 %}
<script src="{{ asset('bundles/sonatacore/vendor/select2/select2_locale_' ~ localeForSelect2 ~ '.js') }}"></script>
{% endif %}
{% endif %}
{% endblock %}
@ -150,7 +148,7 @@ file that was distributed with this source code.
{% block sonata_nav %}
<nav class="navbar navbar-static-top" role="navigation">
<a href="#" class="sidebar-toggle" data-toggle="offcanvas" role="button">
<span class="sr-only">Toggle navigation</span>
<span class="sr-only">{{ 'toggle_navigation'|trans({}, 'SonataAdminBundle') }}</span>
</a>
<div class="navbar-left">
@ -204,7 +202,7 @@ file that was distributed with this source code.
<a class="dropdown-toggle" data-toggle="dropdown" href="#">
<i class="fa fa-plus-square fa-fw" aria-hidden="true"></i> <i class="fa fa-caret-down" aria-hidden="true"></i>
</a>
{% include sonata_admin.adminPool.getTemplate('add_block') %}
{% include get_global_template('add_block') %}
</li>
{% endblock %}
{% block sonata_top_nav_menu_user_block %}
@ -213,7 +211,7 @@ file that was distributed with this source code.
<i class="fa fa-user fa-fw" aria-hidden="true"></i> <i class="fa fa-caret-down" aria-hidden="true"></i>
</a>
<ul class="dropdown-menu dropdown-user">
{% include sonata_admin.adminPool.getTemplate('user_block') %}
{% include get_global_template('user_block') %}
</ul>
</li>
{% endblock %}
@ -232,26 +230,27 @@ file that was distributed with this source code.
<section class="sidebar">
{% block sonata_side_nav %}
{% block sonata_sidebar_search %}
<form action="{{ path('sonata_admin_search') }}" method="GET" class="sidebar-form" role="search">
<div class="input-group custom-search-form">
<input type="text" name="q" value="{{ app.request.get('q') }}" class="form-control" placeholder="{{ 'search_placeholder'|trans({}, 'SonataAdminBundle') }}">
<span class="input-group-btn">
<button class="btn btn-flat" type="submit">
<i class="fa fa-search" aria-hidden="true"></i>
</button>
</span>
</div>
</form>
{% if sonata_admin.adminPool.getOption('search') %}
<form action="{{ path('sonata_admin_search') }}" method="GET" class="sidebar-form" role="search">
<div class="input-group custom-search-form">
<input type="text" name="q" value="{{ app.request.get('q') }}" class="form-control" placeholder="{{ 'search_placeholder'|trans({}, 'SonataAdminBundle') }}">
<span class="input-group-btn">
<button class="btn btn-flat" type="submit">
<i class="fa fa-search" aria-hidden="true"></i>
</button>
</span>
</div>
</form>
{% endif %}
{% endblock sonata_sidebar_search %}
{% block side_bar_before_nav %} {% endblock %}
{% block side_bar_nav %}
{{ knp_menu_render('sonata_admin_sidebar', {template: sonata_admin.adminPool.getTemplate('knp_menu_template')}) }}
{{ knp_menu_render('sonata_admin_sidebar', {template: get_global_template('knp_menu_template')}) }}
{% endblock side_bar_nav %}
{% block side_bar_after_nav %}
<p class="text-center small" style="border-top: 1px solid #444444; padding-top: 10px">
{% block side_bar_after_nav_content %}
<a href="https://sonata-project.org" rel="noreferrer" target="_blank">sonata project</a>
{% endblock %}
</p>
{% endblock %}
@ -375,4 +374,4 @@ file that was distributed with this source code.
{% endif %}
</body>
</html>
</html>

@ -59,8 +59,9 @@ class NavBuilder implements ContainerAwareInterface
*/
public function leftMenu(FactoryInterface $factory, array $options)
{
$checker = $this->container->get('security.authorization_checker');
$translator = $this->container->get('translator');
$container = $this->container;
$checker = $container->get('security.authorization_checker');
$translator = $container->get('translator');
$menu = $factory->createItem('root');
$menu->setChildrenAttribute('class', 'nav navbar-nav');
@ -134,8 +135,8 @@ class NavBuilder implements ContainerAwareInterface
}
}
$categories = $this->container->get('doctrine')->getRepository('ChamiloFaqBundle:Category')->retrieveActive();
//$categories = $this->container->get('Chamilo\FaqBundle\Repository\CategoryRepository')->retrieveActive();
$categories = $container->get('doctrine')->getRepository('ChamiloFaqBundle:Category')->retrieveActive();
//$categories = $container->get('Chamilo\FaqBundle\Repository\CategoryRepository')->retrieveActive();
if ($categories) {
$faq = $menu->addChild(
'FAQ',
@ -159,9 +160,9 @@ class NavBuilder implements ContainerAwareInterface
}
// Getting site information
$site = $this->container->get('sonata.page.site.selector');
$site = $container->get('sonata.page.site.selector');
$host = $site->getRequestContext()->getHost();
$siteManager = $this->container->get('sonata.page.manager.site');
$siteManager = $container->get('sonata.page.manager.site');
/** @var Site $site */
$site = $siteManager->findOneBy([
'host' => [$host, 'localhost'],
@ -169,8 +170,7 @@ class NavBuilder implements ContainerAwareInterface
]);
if ($site) {
$pageManager = $this->container->get('sonata.page.manager.page');
$pageManager = $container->get('sonata.page.manager.page');
// Parents only of homepage
$criteria = ['site' => $site, 'enabled' => true, 'parent' => 1];
$pages = $pageManager->findBy($criteria);

@ -0,0 +1,62 @@
{% extends '@SonataBlock/Block/block_base.html.twig' %}
{% block block %}
{% if settings.format %}
<div class="{{ settings.class }}">
{% if settings.title %}
<h3>
{% if settings.icon %}
<i class="{{ settings.icon }}" aria-hidden="true"></i>
{% endif %}
{% if settings.translation_domain %}
{{ settings.title|trans({}, settings.translation_domain) }}
{% else %}
{{ settings.title }}
{% endif %}
</h3>
{% endif %}
<div id="carousel-{{ block.id }}" class="carousel slide"
data-interval="{{ settings.pauseTime }}"
{% if settings.startPaused != 1 %}data-ride="carousel"{% endif %}
>
<!-- Indicators -->
<ol class="carousel-indicators">
{% for element in elements %}
{{ block('element_indicator') }}
{% endfor %}
</ol>
<!-- Wrapper for slides -->
<div class="carousel-inner">
{% for element in elements %}
{{ block('element_display') }}
{% endfor %}
</div>
<!-- Controls -->
<a class="left carousel-control" href="#carousel-{{ block.id }}" data-slide="prev">
<span class="glyphicon glyphicon-chevron-left"></span>
</a>
<a class="right carousel-control" href="#carousel-{{ block.id }}" data-slide="next">
<span class="glyphicon glyphicon-chevron-right"></span>
</a>
</div>
</div>
{% endif %}
{% endblock %}
{% block element_indicator %}
<li data-target="#carousel-{{ block.id }}" data-slide-to="{{ loop.index0 }}"{% if loop.first %} class="active"{% endif %}></li>
{% endblock element_indicator %}
{% block element_display %}
<div class="item{% if loop.first %} active{% endif %}">
{% media element.media, settings.format %}
<div class="carousel-caption">
<h4>{{ element.title }}</h4>
<p>{{ element.caption }}</p>
</div>
</div>
{% endblock element_display %}

@ -0,0 +1,5 @@
{% extends '@ChamiloPage/base_layout.html.twig' %}
{% block page_content %}
{{ parent() }}
{% endblock %}

@ -0,0 +1,21 @@
{% extends '@ChamiloPage/base_layout.html.twig' %}
{% block sonata_page_content %}
{{ parent() }}
{% if page is defined %}
<div class="col-md-6">
{% if page.name != 'global'%}
{{ sonata_page_render_container('left_col', 'global') }}
{% endif %}
{{ sonata_page_render_container('left_col', page) }}
</div>
<div class="col-md-6">
{% if page.name != 'global'%}
{{ sonata_page_render_container('right_col', 'global') }}
{% endif %}
{{ sonata_page_render_container('right_col', page) }}
</div>
<div style="clear: both"></div>
{% endif %}
{% endblock %}

@ -1,7 +1,6 @@
{% extends '@ChamiloTheme/Layout/base-layout.html.twig' %}
{% block page_content %}
{% block sonata_page_top_bar %}
{% block page_top_bar %} {# Deprecated block #}
{% if sonata_page.isEditor or ( app.user and is_granted('ROLE_PREVIOUS_ADMIN') ) %}
@ -149,6 +148,7 @@
</div>
{% endif %}
{% block sonata_page_content %}
<div class="row">
{% if content is defined %}
{{ content|raw }}
@ -161,6 +161,8 @@
{% endif %}
{% endif %}
</div>
{% endblock %}
{% if page is defined %}
<div class="row">
@ -172,13 +174,13 @@
{% endif %}
</div>
<div class="row">
{{ sonata_page_render_container('footer', 'global') }}
{% if page.name != 'global' %}
{{ sonata_page_render_container('footer', page) }}
{% endif %}
</div>
</div>
<div class="row">
{{ sonata_page_render_container('footer', 'global') }}
{% if page.name != 'global' %}
{{ sonata_page_render_container('footer', page) }}
{% endif %}
</div>
</div>
{% endblock %}
{% endblock %}

@ -1,38 +0,0 @@
{#
This file is part of the Sonata package.
(c) Thomas Rabaix <thomas.rabaix@sonata-project.org>
For the full copyright and license information, please view the LICENSE
file that was distributed with this source code.
#}
{% extends 'SonataPageBundle::2columns_layout.html.twig' %}
{% block sonata_page_body_tag %}
{{ parent() }}
{% include "SonataSeoBundle:Block:_facebook_sdk.html.twig" %}
{% include "SonataSeoBundle:Block:_twitter_sdk.html.twig" %}
{% include "SonataSeoBundle:Block:_pinterest_sdk.html.twig" %}
{% endblock %}
{% block sonata_page_javascripts %}
<script type="text/javascript">
var basket_update_confirmation_message = '{{ 'sonata_basket_update_confirmation'|trans({}, 'SonataDemoBundle')|escape('js') }}';
</script>
<script src="{{ asset('assetic/sonata_front_js.js') }}" type="text/javascript"></script>
{% endblock %}
{% block sonata_page_container %}
<div class="demonstration-bar">{{ 'sonata.demo.demonstration.message'|trans({}, 'SonataDemoBundle') }}</div>
<a href="https://github.com/sonata-project"><img style="position: absolute; top: 0; right: 0; border: 0;" src="https://s3.amazonaws.com/github/ribbons/forkme_right_green_007200.png" alt="Fork me on GitHub"></a>
{{ parent() }}
{% endblock %}
{% block sonata_page_breadcrumb %}{% endblock %}

@ -1,62 +1,90 @@
{#
This file is part of the Sonata package.
(c) Thomas Rabaix <thomas.rabaix@sonata-project.org>
For the full copyright and license information, please view the LICENSE
file that was distributed with this source code.
#}
{% extends sonata_block.templates.block_base %}
{% block block %}
<div class="box box-primary">
<div class="panel panel-default {{ settings.class }}">
{% if settings.title is not empty %}
<div class="box-header with-border">
<h4 class="box-title">
<i class="fa fa-clock-o fa-fw"></i> {{ settings.title }}
<div class="panel-heading">
<h4 class="panel-title">
{% if settings.icon %}
<i class="{{ settings.icon }}" aria-hidden="true"></i>
{% endif %}
{% if settings.translation_domain %}
{{ settings.title|trans({}, settings.translation_domain) }}
{% else %}
{{ settings.title }}
{% endif %}
</h4>
</div>
{% endif %}
<div class="box-body">
<div class="row">
<div class="col-md-12">
<ul class="timeline">
{% for entry in entries %}
{% if currentDay is not defined or currentDay != entry.createdAt|format_date %}
{% set currentDay = entry.createdAt|format_date %}
<li class="time-label">
<span class="bg-red">{{ currentDay }}</span>
</li>
{% endif %}
{% set subject = entry.getComponent('subject') %}
{% set target = entry.getComponent('target') %}
{% set target_text_component = entry.getComponent('target_text') %}
{% if subject.data %}
{% set subject_text = sonata_timeline_generate_link(subject, entry) %}
{% else %}
{% set subject_text = '<abbr title="' ~ 'element_reference_deleted'|trans({'%reference%': target.hash}, "SonataTimelineBundle") ~ '">' ~ 'element_deleted'|trans({}, "SonataTimelineBundle") ~ '</abbr>' %}
{% endif %}
{% if target.data is defined and target.data is not empty %}
{% set target_text = sonata_timeline_generate_link(target, entry) %}
{% elseif target_text_component %}
{% set target_text = '<abbr title="' ~ 'element_deleted'|trans({}, "SonataTimelineBundle") ~ '">'~target_text_component~'</abbr>' %}
{% else %}
{% set target_text = '<abbr title="' ~ 'element_reference_deleted'|trans({'%reference%': target.hash}, "SonataTimelineBundle") ~ '">' ~ 'element_deleted'|trans({}, "SonataTimelineBundle") ~ '</abbr>' %}
{% endif %}
{% set verb = "actions."~entry.verb %}
{% set icon = "actions.icon."~entry.verb %}
<li>
<i class="{{ icon|trans({}, "SonataTimelineBundle") }}"></i>
<div class="timeline-item" style="background: #f3f4f5;">
<span class="time"><i class="fa fa-clock-o"></i> {{ entry.createdAt|format_time }}</span>
<div class="timeline-body" style="border-bottom: none;">{{ verb|trans({'%subject%': subject_text, '%target%': target_text}, "SonataTimelineBundle")|raw }}</div>
</div>
</li>
{% else %}
{{ 'no_action'|trans({}, "SonataTimelineBundle") }}
{% endfor %}
</ul>
</div>
</div>
<div class="panel-body">
<ul class="timeline">
{% for entry in entries %}
{% if currentDay is not defined or currentDay != entry.createdAt|format_date %}
{% set currentDay = entry.createdAt|format_date %}
<li class="time-label">
<span class="bg-red">{{ currentDay }}</span>
</li>
{% endif %}
{% set subject = entry.getComponent('subject') %}
{% set target = entry.getComponent('target') %}
{% set target_text_component = entry.getComponent('target_text') %}
{% if subject.data %}
{% set subject_text = sonata_timeline_generate_link(subject) %}
{% else %}
{% set subject_text %}
<abbr title="{{ 'element_reference_deleted'|trans({'%reference%': subject.hash}, "SonataTimelineBundle") }}">
{{ 'element_deleted'|trans({}, "SonataTimelineBundle") }}
</abbr>
{% endset %}
{% endif %}
{% if target.data is defined and target.data is not empty %}
{% set target_text = sonata_timeline_generate_link(target, entry) %}
{% elseif target_text_component %}
{% set target_text %}
<abbr title="{{ 'element_deleted'|trans({}, "SonataTimelineBundle") }}">
{{ target_text_component }}
</abbr>
{% endset %}
{% else %}
{% set target_text %}
<abbr title="{{ 'element_reference_deleted'|trans({'%reference%': target.hash}, "SonataTimelineBundle") }}">
{{ 'element_deleted'|trans({}, "SonataTimelineBundle") }}
</abbr>
{% endset %}
{% endif %}
{% set verb = "actions."~entry.verb %}
{% set icon = "actions.icon."~entry.verb %}
<li>
<i class="{{ icon|trans({}, "SonataTimelineBundle") }}"></i>
<div class="timeline-item" style="background: #f3f4f5;">
<span class="time">
<i class="fa fa-clock-o"></i> {{ entry.createdAt|format_time }}
</span>
<div class="timeline-body" style="border-bottom: none;">
{{ verb|trans({'%subject%': subject_text, '%target%': target_text}, "SonataTimelineBundle")|raw }}
</div>
</div>
</li>
{% else %}
<p>{{ 'no_action'|trans({}, "SonataTimelineBundle") }}</p>
{% endfor %}
</ul>
</div>
</div>
{% endblock %}

Loading…
Cancel
Save