parent
50f5c546ec
commit
17de9b3800
@ -1,5 +1,4 @@ |
|||||||
debug: |
debug: |
||||||
# Forwards VarDumper Data clones to a centralized server allowing to inspect dumps on CLI or in your browser. |
# Forwards VarDumper Data clones to a centralized server allowing to inspect dumps on CLI or in your browser. |
||||||
# See the "server:dump" command to start a new server. |
# See the "server:dump" command to start a new server. |
||||||
#dump_destination: "tcp://%env(VAR_DUMPER_SERVER)%" |
dump_destination: "tcp://%env(VAR_DUMPER_SERVER)%" |
||||||
dump_destination: null |
|
||||||
|
|||||||
@ -1,7 +0,0 @@ |
|||||||
jms_serializer: |
|
||||||
visitors: |
|
||||||
json_serialization: |
|
||||||
options: |
|
||||||
- JSON_PRETTY_PRINT |
|
||||||
- JSON_UNESCAPED_SLASHES |
|
||||||
- JSON_PRESERVE_ZERO_FRACTION |
|
||||||
@ -1,5 +1,5 @@ |
|||||||
translation: |
#translation: |
||||||
symfony_profiler: |
# symfony_profiler: |
||||||
enabled: true |
# enabled: true |
||||||
webui: |
# webui: |
||||||
enabled: true |
# enabled: true |
||||||
|
|||||||
@ -1,6 +0,0 @@ |
|||||||
#jms_serializer: |
|
||||||
# visitors: |
|
||||||
# json: |
|
||||||
# options: |
|
||||||
# - JSON_UNESCAPED_SLASHES |
|
||||||
# - JSON_PRESERVE_ZERO_FRACTION |
|
||||||
@ -1,5 +1,4 @@ |
|||||||
framework: |
framework: |
||||||
test: ~ |
test: true |
||||||
# Uncomment this section if you're using sessions |
session: |
||||||
#session: |
storage_id: session.storage.mock_file |
||||||
# storage_id: session.storage.mock_file |
|
||||||
|
|||||||
@ -1,5 +1,6 @@ |
|||||||
web_profiler: |
web_profiler: |
||||||
toolbar: false |
toolbar: false |
||||||
intercept_redirects: false |
intercept_redirects: false |
||||||
|
|
||||||
framework: |
framework: |
||||||
profiler: {collect: false} |
profiler: {collect: false} |
||||||
|
|||||||
@ -1,14 +0,0 @@ |
|||||||
<?php |
|
||||||
|
|
||||||
/* For licensing terms, see /license.txt */ |
|
||||||
|
|
||||||
namespace Chamilo\AdminBundle; |
|
||||||
|
|
||||||
use Symfony\Component\HttpKernel\Bundle\Bundle; |
|
||||||
|
|
||||||
/** |
|
||||||
* Class ChamiloAdminBundle. |
|
||||||
*/ |
|
||||||
class ChamiloAdminBundle extends Bundle |
|
||||||
{ |
|
||||||
} |
|
||||||
@ -1,44 +0,0 @@ |
|||||||
{# See vendor/sonata-project/admin-bundle/Resources/views/standard_layout.html.twig#} |
|
||||||
{% extends '@ChamiloAdmin/standard_layout.html.twig' %} |
|
||||||
|
|
||||||
{#{% block stylesheets %}#} |
|
||||||
{#{{ parent() }}#} |
|
||||||
|
|
||||||
{#<link rel="stylesheet"#} |
|
||||||
{#href="{{ asset('bundles/sonataformatter/markitup/skins/sonata/style.css') }}"#} |
|
||||||
{#type="text/css" media="all"/>#} |
|
||||||
{#<link rel="stylesheet"#} |
|
||||||
{#href="{{ asset('bundles/sonataformatter/markitup/sets/markdown/style.css') }}"#} |
|
||||||
{#type="text/css" media="all"/>#} |
|
||||||
{#<link rel="stylesheet"#} |
|
||||||
{#href="{{ asset('bundles/sonataformatter/markitup/sets/html/style.css') }}"#} |
|
||||||
{#type="text/css" media="all"/>#} |
|
||||||
{#<link rel="stylesheet"#} |
|
||||||
{#href="{{ asset('bundles/sonataformatter/markitup/sets/textile/style.css') }}"#} |
|
||||||
{#type="text/css" media="all"/>#} |
|
||||||
{#<link rel="stylesheet"#} |
|
||||||
{#href="{{ asset('bundles/sonatacore/vendor/eonasdan-bootstrap-datetimepicker/build/css/bootstrap-datetimepicker.min.css') }}"/>#} |
|
||||||
|
|
||||||
{#{% endblock %}#} |
|
||||||
|
|
||||||
{#{% block javascripts %}#} |
|
||||||
{#{{ parent() }}#} |
|
||||||
|
|
||||||
{#<script src="{{ asset('libs/ckeditor/ckeditor.js') }}"></script>#} |
|
||||||
{#<script src="{{ asset('bundles/sonataformatter/vendor/markitup-markitup/markitup/jquery.markitup.js') }}"#} |
|
||||||
{#type="text/javascript"></script>#} |
|
||||||
{#<script src="{{ asset('bundles/sonataformatter/markitup/sets/markdown/set.js') }}"#} |
|
||||||
{#type="text/javascript"></script>#} |
|
||||||
{#<script src="{{ asset('bundles/sonataformatter/markitup/sets/html/set.js') }}"#} |
|
||||||
{#type="text/javascript"></script>#} |
|
||||||
{#<script src="{{ asset('bundles/sonataformatter/markitup/sets/textile/set.js') }}"#} |
|
||||||
{#type="text/javascript"></script>#} |
|
||||||
{#<script src="{{ asset('bundles/sonatacore/vendor/moment/min/moment.min.js') }}"#} |
|
||||||
{#type="text/javascript"></script>#} |
|
||||||
{#<script src="{{ asset('bundles/sonatacore/vendor/eonasdan-bootstrap-datetimepicker/build/js/bootstrap-datetimepicker.min.js') }}"#} |
|
||||||
{#type="text/javascript"></script>#} |
|
||||||
|
|
||||||
{#{% endblock %}#} |
|
||||||
|
|
||||||
{#{% block footer %}#} |
|
||||||
{#{% endblock %}#} |
|
||||||
@ -1,373 +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. |
|
||||||
|
|
||||||
#} |
|
||||||
|
|
||||||
{%- set _preview = block('preview') is defined ? block('preview')|trim : null %} |
|
||||||
{% set _form = block('form') is defined ? block('form')|trim : null %} |
|
||||||
{% set _show = block('show') is defined ? block('show')|trim : null %} |
|
||||||
{% set _list_table = block('list_table') is defined ? block('list_table')|trim : null %} |
|
||||||
{% set _list_filters = block('list_filters') is defined ? block('list_filters')|trim : null %} |
|
||||||
{% set _tab_menu = block('tab_menu') is defined ? block('tab_menu')|trim : null %} |
|
||||||
{% set _content = block('content') is defined ? block('content')|trim : null %} |
|
||||||
{% set _title = block('title') is defined ? block('title')|trim : null %} |
|
||||||
{% set _breadcrumb = block('breadcrumb') is defined ? block('breadcrumb')|trim : null %} |
|
||||||
{% set _actions = block('actions') is defined ? block('actions')|trim : null %} |
|
||||||
{% set _navbar_title = block('navbar_title') is defined ? block('navbar_title')|trim : null %} |
|
||||||
{% set _list_filters_actions = block('list_filters_actions') is defined ? block('list_filters_actions')|trim : null -%} |
|
||||||
|
|
||||||
<!DOCTYPE html> |
|
||||||
<html {% block html_attributes %}class="no-js"{% endblock %}> |
|
||||||
<head> |
|
||||||
{% block meta_tags %} |
|
||||||
<meta http-equiv="X-UA-Compatible" content="IE=edge"> |
|
||||||
<meta charset="UTF-8"> |
|
||||||
<meta content='width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no' name='viewport'> |
|
||||||
{% endblock %} |
|
||||||
|
|
||||||
<meta data-sonata-admin='{{ { |
|
||||||
config: { |
|
||||||
CONFIRM_EXIT: sonata_admin.adminPool.getOption('confirm_exit'), |
|
||||||
USE_SELECT2: sonata_admin.adminPool.getOption('use_select2'), |
|
||||||
USE_ICHECK: sonata_admin.adminPool.getOption('use_icheck'), |
|
||||||
USE_STICKYFORMS: sonata_admin.adminPool.getOption('use_stickyforms'), |
|
||||||
}, |
|
||||||
translations: { |
|
||||||
CONFIRM_EXIT: 'confirm_exit'|trans({}, 'SonataAdminBundle'), |
|
||||||
}, |
|
||||||
}|json_encode()|raw }}' |
|
||||||
> |
|
||||||
|
|
||||||
{% block stylesheets %} |
|
||||||
{% for stylesheet in sonata_admin.adminPool.getOption('stylesheets', []) %} |
|
||||||
<link rel="stylesheet" href="{{ asset(stylesheet) }}"> |
|
||||||
{% endfor %} |
|
||||||
{% endblock %} |
|
||||||
|
|
||||||
{% block javascripts %} |
|
||||||
{% block sonata_javascript_config %} |
|
||||||
{% endblock %} |
|
||||||
|
|
||||||
{% block sonata_javascript_pool %} |
|
||||||
{% for javascript in sonata_admin.adminPool.getOption('javascripts', []) %} |
|
||||||
<script src="{{ asset(javascript) }}"></script> |
|
||||||
{% endfor %} |
|
||||||
{% endblock %} |
|
||||||
|
|
||||||
{# localize moment #} |
|
||||||
{% set localeForMoment = canonicalize_locale_for_moment() %} |
|
||||||
{% if localeForMoment %} |
|
||||||
<script src="{{ asset( |
|
||||||
'bundles/sonatacore/vendor/moment/locale/' ~ |
|
||||||
localeForMoment ~ |
|
||||||
'.js' |
|
||||||
) }}"></script> |
|
||||||
{% endif %} |
|
||||||
|
|
||||||
{# localize select2 #} |
|
||||||
{% if sonata_admin.adminPool.getOption('use_select2') %} |
|
||||||
{% set localeForSelect2 = canonicalize_locale_for_select2() %} |
|
||||||
{% if localeForSelect2 %} |
|
||||||
<script src="{{ asset('bundles/sonatacore/vendor/select2/select2_locale_' ~ localeForSelect2 ~ '.js') }}"></script> |
|
||||||
{% endif %} |
|
||||||
{% endif %} |
|
||||||
{% endblock %} |
|
||||||
|
|
||||||
<title> |
|
||||||
{% block sonata_head_title %} |
|
||||||
{{ 'Admin'|trans({}, 'SonataAdminBundle') }} |
|
||||||
|
|
||||||
{% if _title is not empty %} |
|
||||||
{{ _title|striptags|raw }} |
|
||||||
{% else %} |
|
||||||
{% if action is defined %} |
|
||||||
- |
|
||||||
{% for menu in breadcrumbs_builder.breadcrumbs(admin, action) %} |
|
||||||
{% if not loop.first %} |
|
||||||
{% if loop.index != 2 %} |
|
||||||
> |
|
||||||
{% endif %} |
|
||||||
|
|
||||||
{%- set translation_domain = menu.extra('translation_domain', 'messages') -%} |
|
||||||
{%- set label = menu.label -%} |
|
||||||
{%- if translation_domain is not same as(false) -%} |
|
||||||
{%- set label = label|trans(menu.extra('translation_params', {}), translation_domain) -%} |
|
||||||
{%- endif -%} |
|
||||||
|
|
||||||
{{ label }} |
|
||||||
{% endif %} |
|
||||||
{% endfor %} |
|
||||||
{% endif %} |
|
||||||
{% endif %} |
|
||||||
{% endblock %} |
|
||||||
</title> |
|
||||||
</head> |
|
||||||
<body |
|
||||||
{% block body_attributes -%} |
|
||||||
class="sonata-bc skin-black fixed |
|
||||||
{% if app.request.cookies.get('sonata_sidebar_hide') -%} |
|
||||||
sidebar-collapse |
|
||||||
{%- endif -%}" |
|
||||||
{%- endblock -%} |
|
||||||
> |
|
||||||
|
|
||||||
<div class="wrapper"> |
|
||||||
|
|
||||||
{% block sonata_header %} |
|
||||||
<header class="main-header"> |
|
||||||
{% block sonata_header_noscript_warning %} |
|
||||||
<noscript> |
|
||||||
<div class="noscript-warning"> |
|
||||||
{{ 'noscript_warning'|trans({}, 'SonataAdminBundle') }} |
|
||||||
</div> |
|
||||||
</noscript> |
|
||||||
{% endblock %} |
|
||||||
{% block logo %} |
|
||||||
{% apply spaceless %} |
|
||||||
<a class="logo" href="{{ path('sonata_admin_dashboard') }}"> |
|
||||||
{% if 'single_image' == sonata_admin.adminPool.getOption('title_mode') or 'both' == sonata_admin.adminPool.getOption('title_mode') %} |
|
||||||
<img src="{{ asset(sonata_admin.adminPool.titlelogo) }}" alt="{{ sonata_admin.adminPool.title }}"> |
|
||||||
{% endif %} |
|
||||||
{% if 'single_text' == sonata_admin.adminPool.getOption('title_mode') or 'both' == sonata_admin.adminPool.getOption('title_mode') %} |
|
||||||
<span>{{ sonata_admin.adminPool.title }}</span> |
|
||||||
{% endif %} |
|
||||||
</a> |
|
||||||
{% endapply %} |
|
||||||
{% endblock %} |
|
||||||
{% block sonata_nav %} |
|
||||||
<nav class="navbar navbar-static-top" role="navigation"> |
|
||||||
<a href="#" class="sidebar-toggle" data-toggle="offcanvas" |
|
||||||
role="button" title="{{ 'toggle_navigation'|trans({}, 'SonataAdminBundle') }}"> |
|
||||||
<span class="sr-only">{{ 'toggle_navigation'|trans({}, 'SonataAdminBundle') }}</span> |
|
||||||
</a> |
|
||||||
|
|
||||||
<div class="navbar-left"> |
|
||||||
{% block sonata_breadcrumb %} |
|
||||||
<div class="hidden-xs"> |
|
||||||
{% if _breadcrumb is not empty or action is defined %} |
|
||||||
<ol class="nav navbar-top-links breadcrumb"> |
|
||||||
{% if _breadcrumb is empty %} |
|
||||||
{% if action is defined %} |
|
||||||
{% for menu in breadcrumbs_builder.breadcrumbs(admin, action) %} |
|
||||||
{%- set translation_domain = menu.extra('translation_domain', 'messages') -%} |
|
||||||
{%- set label = menu.label -%} |
|
||||||
{%- if translation_domain is not same as(false) -%} |
|
||||||
{%- set label = label|trans(menu.extra('translation_params', {}), translation_domain) -%} |
|
||||||
{%- endif -%} |
|
||||||
|
|
||||||
{% if not loop.last %} |
|
||||||
<li> |
|
||||||
{% if menu.uri is not empty %} |
|
||||||
<a href="{{ menu.uri }}"> |
|
||||||
{% if menu.extra('safe_label', true) %} |
|
||||||
{{- label|raw -}} |
|
||||||
{% else %} |
|
||||||
{{- label -}} |
|
||||||
{% endif %} |
|
||||||
</a> |
|
||||||
{% else %} |
|
||||||
<span>{{ label }}</span> |
|
||||||
{% endif %} |
|
||||||
</li> |
|
||||||
{% else %} |
|
||||||
<li class="active"><span>{{ label }}</span></li> |
|
||||||
{% endif %} |
|
||||||
{% endfor %} |
|
||||||
{% endif %} |
|
||||||
{% else %} |
|
||||||
{{ _breadcrumb|raw }} |
|
||||||
{% endif %} |
|
||||||
</ol> |
|
||||||
{% endif %} |
|
||||||
</div> |
|
||||||
{% endblock sonata_breadcrumb %} |
|
||||||
</div> |
|
||||||
|
|
||||||
{% block sonata_top_nav_menu %} |
|
||||||
{% if app.user and is_granted(sonata_admin.adminPool.getOption('role_admin')) %} |
|
||||||
<div class="navbar-custom-menu"> |
|
||||||
<ul class="nav navbar-nav"> |
|
||||||
{% block sonata_top_nav_menu_add_block %} |
|
||||||
<li class="dropdown"> |
|
||||||
<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 get_global_template('add_block') %} |
|
||||||
</li> |
|
||||||
{% endblock %} |
|
||||||
{% block sonata_top_nav_menu_user_block %} |
|
||||||
<li class="dropdown user-menu"> |
|
||||||
<a class="dropdown-toggle" data-toggle="dropdown" href="#"> |
|
||||||
<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 get_global_template('user_block') %} |
|
||||||
</ul> |
|
||||||
</li> |
|
||||||
{% endblock %} |
|
||||||
</ul> |
|
||||||
</div> |
|
||||||
{% endif %} |
|
||||||
{% endblock %} |
|
||||||
</nav> |
|
||||||
{% endblock sonata_nav %} |
|
||||||
</header> |
|
||||||
{% endblock sonata_header %} |
|
||||||
|
|
||||||
{% block sonata_wrapper %} |
|
||||||
{% block sonata_left_side %} |
|
||||||
<aside class="main-sidebar"> |
|
||||||
<section class="sidebar"> |
|
||||||
{% block sonata_side_nav %} |
|
||||||
{% block sonata_sidebar_search %} |
|
||||||
{% 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: 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 %} |
|
||||||
{% endblock %} |
|
||||||
</p> |
|
||||||
{% endblock %} |
|
||||||
{% endblock sonata_side_nav %} |
|
||||||
</section> |
|
||||||
</aside> |
|
||||||
{% endblock sonata_left_side %} |
|
||||||
|
|
||||||
<div class="content-wrapper"> |
|
||||||
{% block sonata_page_content %} |
|
||||||
<section class="content-header"> |
|
||||||
|
|
||||||
{% block sonata_page_content_header %} |
|
||||||
{% block sonata_page_content_nav %} |
|
||||||
{% if _navbar_title is not empty |
|
||||||
or _tab_menu is not empty |
|
||||||
or _actions is not empty |
|
||||||
or _list_filters_actions is not empty |
|
||||||
%} |
|
||||||
<nav class="navbar navbar-default" role="navigation"> |
|
||||||
<div class="container-fluid"> |
|
||||||
{% block tab_menu_navbar_header %} |
|
||||||
{% if _navbar_title is not empty %} |
|
||||||
<div class="navbar-header"> |
|
||||||
<a class="navbar-brand" href="#">{{ _navbar_title|raw }}</a> |
|
||||||
</div> |
|
||||||
{% endif %} |
|
||||||
{% endblock %} |
|
||||||
|
|
||||||
<div class="navbar-collapse"> |
|
||||||
{% if _tab_menu is not empty %} |
|
||||||
<div class="navbar-left"> |
|
||||||
{{ _tab_menu|raw }} |
|
||||||
</div> |
|
||||||
{% endif %} |
|
||||||
|
|
||||||
{% if admin is defined and action is defined and action == 'list' and admin.listModes|length > 1 %} |
|
||||||
<div class="nav navbar-right btn-group"> |
|
||||||
{% for mode, settings in admin.listModes %} |
|
||||||
<a href="{{ admin.generateUrl('list', app.request.query.all|merge({_list_mode: mode})) }}" class="btn btn-default navbar-btn btn-sm{% if admin.getListMode() == mode %} active{% endif %}"><i class="{{ settings.class }}"></i></a> |
|
||||||
{% endfor %} |
|
||||||
</div> |
|
||||||
{% endif %} |
|
||||||
|
|
||||||
{% block sonata_admin_content_actions_wrappers %} |
|
||||||
{% if _actions|replace({ '<li>': '', '</li>': '' })|trim is not empty %} |
|
||||||
<ul class="nav navbar-nav navbar-right"> |
|
||||||
{% if _actions|split('</a>')|length > 2 %} |
|
||||||
<li class="dropdown sonata-actions"> |
|
||||||
<a href="#" class="dropdown-toggle" data-toggle="dropdown">{{ 'link_actions'|trans({}, 'SonataAdminBundle') }} <b class="caret"></b></a> |
|
||||||
<ul class="dropdown-menu" role="menu"> |
|
||||||
{{ _actions|raw }} |
|
||||||
</ul> |
|
||||||
</li> |
|
||||||
{% else %} |
|
||||||
{{ _actions|raw }} |
|
||||||
{% endif %} |
|
||||||
</ul> |
|
||||||
{% endif %} |
|
||||||
{% endblock sonata_admin_content_actions_wrappers %} |
|
||||||
|
|
||||||
{% if _list_filters_actions is not empty %} |
|
||||||
{{ _list_filters_actions|raw }} |
|
||||||
{% endif %} |
|
||||||
</div> |
|
||||||
</div> |
|
||||||
</nav> |
|
||||||
{% endif %} |
|
||||||
{% endblock sonata_page_content_nav %} |
|
||||||
{% endblock sonata_page_content_header %} |
|
||||||
</section> |
|
||||||
|
|
||||||
<section class="content"> |
|
||||||
{% block sonata_admin_content %} |
|
||||||
|
|
||||||
{% block notice %} |
|
||||||
{% include '@SonataCore/FlashMessage/render.html.twig' %} |
|
||||||
{% endblock notice %} |
|
||||||
|
|
||||||
{% if _preview is not empty %} |
|
||||||
<div class="sonata-ba-preview">{{ _preview|raw }}</div> |
|
||||||
{% endif %} |
|
||||||
|
|
||||||
{% if _content is not empty %} |
|
||||||
<div class="sonata-ba-content">{{ _content|raw }}</div> |
|
||||||
{% endif %} |
|
||||||
|
|
||||||
{% if _show is not empty %} |
|
||||||
<div class="sonata-ba-show">{{ _show|raw }}</div> |
|
||||||
{% endif %} |
|
||||||
|
|
||||||
{% if _form is not empty %} |
|
||||||
<div class="sonata-ba-form">{{ _form|raw }}</div> |
|
||||||
{% endif %} |
|
||||||
|
|
||||||
{% if _list_filters is not empty %} |
|
||||||
<div class="row"> |
|
||||||
{{ _list_filters|raw }} |
|
||||||
</div> |
|
||||||
{% endif %} |
|
||||||
|
|
||||||
{% if _list_table is not empty %} |
|
||||||
<div class="row"> |
|
||||||
{{ _list_table|raw }} |
|
||||||
</div> |
|
||||||
{% endif %} |
|
||||||
{% endblock sonata_admin_content %} |
|
||||||
</section> |
|
||||||
{% endblock sonata_page_content %} |
|
||||||
</div> |
|
||||||
{% endblock sonata_wrapper %} |
|
||||||
</div> |
|
||||||
|
|
||||||
{% if sonata_admin.adminPool.getOption('use_bootlint') %} |
|
||||||
{% block bootlint %} |
|
||||||
{# Bootlint - https://github.com/twbs/bootlint#in-the-browser #} |
|
||||||
<script type="text/javascript"> |
|
||||||
javascript:(function(){var s=document.createElement("script");s.onload=function(){bootlint.showLintReportForCurrentDocument([], {hasProblems: false, problemFree: false});};s.src="https://maxcdn.bootstrapcdn.com/bootlint/latest/bootlint.min.js";document.body.appendChild(s)})(); |
|
||||||
</script> |
|
||||||
{% endblock %} |
|
||||||
{% endif %} |
|
||||||
|
|
||||||
</body> |
|
||||||
</html> |
|
||||||
@ -1,14 +0,0 @@ |
|||||||
<?php |
|
||||||
|
|
||||||
/* For licensing terms, see /license.txt */ |
|
||||||
|
|
||||||
namespace Chamilo\ClassificationBundle; |
|
||||||
|
|
||||||
use Symfony\Component\HttpKernel\Bundle\Bundle; |
|
||||||
|
|
||||||
/** |
|
||||||
* Class ChamiloClassificationBundle. |
|
||||||
*/ |
|
||||||
class ChamiloClassificationBundle extends Bundle |
|
||||||
{ |
|
||||||
} |
|
||||||
@ -1,40 +0,0 @@ |
|||||||
<?php |
|
||||||
|
|
||||||
/** |
|
||||||
* This file is part of the <name> project. |
|
||||||
* |
|
||||||
* (c) <yourname> <youremail> |
|
||||||
* |
|
||||||
* For the full copyright and license information, please view the LICENSE |
|
||||||
* file that was distributed with this source code. |
|
||||||
*/ |
|
||||||
|
|
||||||
namespace Chamilo\ClassificationBundle\Document; |
|
||||||
|
|
||||||
use Sonata\ClassificationBundle\Document\BaseCategory as BaseCategory; |
|
||||||
|
|
||||||
/** |
|
||||||
* This file has been generated by the EasyExtends bundle ( http://sonata-project.org/bundles/easy-extends ). |
|
||||||
* |
|
||||||
* References : |
|
||||||
* working with object : http://www.doctrine-project.org/docs/mongodb_odm/1.0/en/reference/working-with-objects.html |
|
||||||
* |
|
||||||
* @author <yourname> <youremail> |
|
||||||
*/ |
|
||||||
class Category extends BaseCategory |
|
||||||
{ |
|
||||||
/** |
|
||||||
* @var int |
|
||||||
*/ |
|
||||||
protected $id; |
|
||||||
|
|
||||||
/** |
|
||||||
* Get id. |
|
||||||
* |
|
||||||
* @return int |
|
||||||
*/ |
|
||||||
public function getId() |
|
||||||
{ |
|
||||||
return $this->id; |
|
||||||
} |
|
||||||
} |
|
||||||
@ -1,40 +0,0 @@ |
|||||||
<?php |
|
||||||
|
|
||||||
/** |
|
||||||
* This file is part of the <name> project. |
|
||||||
* |
|
||||||
* (c) <yourname> <youremail> |
|
||||||
* |
|
||||||
* For the full copyright and license information, please view the LICENSE |
|
||||||
* file that was distributed with this source code. |
|
||||||
*/ |
|
||||||
|
|
||||||
namespace Chamilo\ClassificationBundle\Document; |
|
||||||
|
|
||||||
use Sonata\ClassificationBundle\Document\BaseTag as BaseTag; |
|
||||||
|
|
||||||
/** |
|
||||||
* This file has been generated by the EasyExtends bundle ( http://sonata-project.org/bundles/easy-extends ). |
|
||||||
* |
|
||||||
* References : |
|
||||||
* working with object : http://www.doctrine-project.org/docs/mongodb_odm/1.0/en/reference/working-with-objects.html |
|
||||||
* |
|
||||||
* @author <yourname> <youremail> |
|
||||||
*/ |
|
||||||
class Tag extends BaseTag |
|
||||||
{ |
|
||||||
/** |
|
||||||
* @var int |
|
||||||
*/ |
|
||||||
protected $id; |
|
||||||
|
|
||||||
/** |
|
||||||
* Get id. |
|
||||||
* |
|
||||||
* @return int |
|
||||||
*/ |
|
||||||
public function getId() |
|
||||||
{ |
|
||||||
return $this->id; |
|
||||||
} |
|
||||||
} |
|
||||||
@ -1,26 +0,0 @@ |
|||||||
<?php |
|
||||||
|
|
||||||
/* For licensing terms, see /license.txt */ |
|
||||||
|
|
||||||
namespace Chamilo\ClassificationBundle\Entity; |
|
||||||
|
|
||||||
use Sonata\ClassificationBundle\Entity\BaseCategory; |
|
||||||
|
|
||||||
/** |
|
||||||
* Class Category. |
|
||||||
*/ |
|
||||||
class Category extends BaseCategory |
|
||||||
{ |
|
||||||
/** |
|
||||||
* @var int |
|
||||||
*/ |
|
||||||
protected $id; |
|
||||||
|
|
||||||
/** |
|
||||||
* Get id. |
|
||||||
*/ |
|
||||||
public function getId(): int |
|
||||||
{ |
|
||||||
return $this->id; |
|
||||||
} |
|
||||||
} |
|
||||||
@ -1,26 +0,0 @@ |
|||||||
<?php |
|
||||||
|
|
||||||
/* For licensing terms, see /license.txt */ |
|
||||||
|
|
||||||
namespace Chamilo\ClassificationBundle\Entity; |
|
||||||
|
|
||||||
use Sonata\ClassificationBundle\Entity\BaseCollection; |
|
||||||
|
|
||||||
/** |
|
||||||
* Class Collection. |
|
||||||
*/ |
|
||||||
class Collection extends BaseCollection |
|
||||||
{ |
|
||||||
/** |
|
||||||
* @var int |
|
||||||
*/ |
|
||||||
protected $id; |
|
||||||
|
|
||||||
/** |
|
||||||
* Get id. |
|
||||||
*/ |
|
||||||
public function getId(): int |
|
||||||
{ |
|
||||||
return $this->id; |
|
||||||
} |
|
||||||
} |
|
||||||
@ -1,28 +0,0 @@ |
|||||||
<?php |
|
||||||
|
|
||||||
/* For licensing terms, see /license.txt */ |
|
||||||
|
|
||||||
namespace Chamilo\ClassificationBundle\Entity; |
|
||||||
|
|
||||||
use Sonata\ClassificationBundle\Entity\BaseContext; |
|
||||||
|
|
||||||
/** |
|
||||||
* Class Context. |
|
||||||
*/ |
|
||||||
class Context extends BaseContext |
|
||||||
{ |
|
||||||
/** |
|
||||||
* @var int |
|
||||||
*/ |
|
||||||
protected $id; |
|
||||||
|
|
||||||
/** |
|
||||||
* Get id. |
|
||||||
* |
|
||||||
* @return int |
|
||||||
*/ |
|
||||||
public function getId() |
|
||||||
{ |
|
||||||
return $this->id; |
|
||||||
} |
|
||||||
} |
|
||||||
@ -1,26 +0,0 @@ |
|||||||
<?php |
|
||||||
|
|
||||||
/* For licensing terms, see /license.txt */ |
|
||||||
|
|
||||||
namespace Chamilo\ClassificationBundle\Entity; |
|
||||||
|
|
||||||
use Sonata\ClassificationBundle\Entity\BaseTag; |
|
||||||
|
|
||||||
/** |
|
||||||
* Class Tag. |
|
||||||
*/ |
|
||||||
class Tag extends BaseTag |
|
||||||
{ |
|
||||||
/** |
|
||||||
* @var int |
|
||||||
*/ |
|
||||||
protected $id; |
|
||||||
|
|
||||||
/** |
|
||||||
* Get id. |
|
||||||
*/ |
|
||||||
public function getId(): int |
|
||||||
{ |
|
||||||
return $this->id; |
|
||||||
} |
|
||||||
} |
|
||||||
@ -1,27 +0,0 @@ |
|||||||
<?xml version="1.0" encoding="utf-8"?> |
|
||||||
<doctrine-mapping |
|
||||||
xmlns="http://doctrine-project.org/schemas/orm/doctrine-mapping" |
|
||||||
xsi="http://www.w3.org/2001/XMLSchema-instance" |
|
||||||
schemaLocation="http://doctrine-project.org/schemas/orm/doctrine-mapping http://doctrine-project.org/schemas/orm/doctrine-mapping.xsd"> |
|
||||||
<!-- |
|
||||||
This file has been generated by the EasyExtends bundle ( http://sonata-project.org/easy-extends ) |
|
||||||
|
|
||||||
References : |
|
||||||
xsd : https://github.com/doctrine/doctrine2/blob/master/doctrine-mapping.xsd |
|
||||||
xml mapping : http://www.doctrine-project.org/projects/orm/2.0/docs/reference/xml-mapping/en |
|
||||||
association mapping : http://www.doctrine-project.org/projects/orm/2.0/docs/reference/association-mapping/en |
|
||||||
--> |
|
||||||
<entity |
|
||||||
name="Chamilo\ClassificationBundle\Entity\Category" |
|
||||||
table="classification__category" |
|
||||||
repository-class="Doctrine\ORM\EntityRepository"> |
|
||||||
|
|
||||||
<id name="id" type="integer" column="id"> |
|
||||||
<generator strategy="AUTO"/> |
|
||||||
</id> |
|
||||||
<options> |
|
||||||
<option name="row_format">DYNAMIC</option> |
|
||||||
</options> |
|
||||||
|
|
||||||
</entity> |
|
||||||
</doctrine-mapping> |
|
||||||
@ -1,32 +0,0 @@ |
|||||||
<?xml version="1.0" encoding="utf-8"?> |
|
||||||
<doctrine-mapping |
|
||||||
xmlns="http://doctrine-project.org/schemas/orm/doctrine-mapping" |
|
||||||
xsi="http://www.w3.org/2001/XMLSchema-instance" |
|
||||||
schemaLocation="http://doctrine-project.org/schemas/orm/doctrine-mapping http://doctrine-project.org/schemas/orm/doctrine-mapping.xsd"> |
|
||||||
<!-- |
|
||||||
This file has been generated by the EasyExtends bundle ( http://sonata-project.org/easy-extends ) |
|
||||||
|
|
||||||
References : |
|
||||||
xsd : https://github.com/doctrine/doctrine2/blob/master/doctrine-mapping.xsd |
|
||||||
xml mapping : http://www.doctrine-project.org/projects/orm/2.0/docs/reference/xml-mapping/en |
|
||||||
association mapping : http://www.doctrine-project.org/projects/orm/2.0/docs/reference/association-mapping/en |
|
||||||
--> |
|
||||||
<entity |
|
||||||
name="Chamilo\ClassificationBundle\Entity\Collection" |
|
||||||
table="classification__collection" |
|
||||||
repository-class="Doctrine\ORM\EntityRepository"> |
|
||||||
|
|
||||||
<id name="id" type="integer" column="id"> |
|
||||||
<generator strategy="AUTO"/> |
|
||||||
</id> |
|
||||||
<attribute-overrides> |
|
||||||
<attribute-override name="slug"> |
|
||||||
<field column="slug" length="190" unique="true" type="string" /> |
|
||||||
</attribute-override> |
|
||||||
</attribute-overrides> |
|
||||||
<options> |
|
||||||
<option name="row_format">DYNAMIC</option> |
|
||||||
</options> |
|
||||||
|
|
||||||
</entity> |
|
||||||
</doctrine-mapping> |
|
||||||
@ -1,27 +0,0 @@ |
|||||||
<?xml version="1.0" encoding="utf-8"?> |
|
||||||
<doctrine-mapping |
|
||||||
xmlns="http://doctrine-project.org/schemas/orm/doctrine-mapping" |
|
||||||
xsi="http://www.w3.org/2001/XMLSchema-instance" |
|
||||||
schemaLocation="http://doctrine-project.org/schemas/orm/doctrine-mapping http://doctrine-project.org/schemas/orm/doctrine-mapping.xsd"> |
|
||||||
<!-- |
|
||||||
This file has been generated by the EasyExtends bundle ( https://sonata-project.org/easy-extends ) |
|
||||||
|
|
||||||
References : |
|
||||||
xsd : https://github.com/doctrine/doctrine2/blob/master/doctrine-mapping.xsd |
|
||||||
xml mapping : http://www.doctrine-project.org/projects/orm/2.0/docs/reference/xml-mapping/en |
|
||||||
association mapping : http://www.doctrine-project.org/projects/orm/2.0/docs/reference/association-mapping/en |
|
||||||
--> |
|
||||||
<entity |
|
||||||
name="Chamilo\ClassificationBundle\Entity\Context" |
|
||||||
table="classification__context" |
|
||||||
repository-class="Doctrine\ORM\EntityRepository"> |
|
||||||
|
|
||||||
<id name="id" type="string" column="id"> |
|
||||||
<generator strategy="NONE"/> |
|
||||||
</id> |
|
||||||
<options> |
|
||||||
<option name="row_format">DYNAMIC</option> |
|
||||||
</options> |
|
||||||
|
|
||||||
</entity> |
|
||||||
</doctrine-mapping> |
|
||||||
@ -1,32 +0,0 @@ |
|||||||
<?xml version="1.0" encoding="utf-8"?> |
|
||||||
<doctrine-mapping |
|
||||||
xmlns="http://doctrine-project.org/schemas/orm/doctrine-mapping" |
|
||||||
xsi="http://www.w3.org/2001/XMLSchema-instance" |
|
||||||
schemaLocation="http://doctrine-project.org/schemas/orm/doctrine-mapping http://doctrine-project.org/schemas/orm/doctrine-mapping.xsd"> |
|
||||||
<!-- |
|
||||||
This file has been generated by the EasyExtends bundle ( http://sonata-project.org/easy-extends ) |
|
||||||
|
|
||||||
References : |
|
||||||
xsd : https://github.com/doctrine/doctrine2/blob/master/doctrine-mapping.xsd |
|
||||||
xml mapping : http://www.doctrine-project.org/projects/orm/2.0/docs/reference/xml-mapping/en |
|
||||||
association mapping : http://www.doctrine-project.org/projects/orm/2.0/docs/reference/association-mapping/en |
|
||||||
--> |
|
||||||
<entity |
|
||||||
name="Chamilo\ClassificationBundle\Entity\Tag" |
|
||||||
table="classification__tag" |
|
||||||
repository-class="Doctrine\ORM\EntityRepository"> |
|
||||||
|
|
||||||
<id name="id" type="integer" column="id"> |
|
||||||
<generator strategy="AUTO"/> |
|
||||||
</id> |
|
||||||
<attribute-overrides> |
|
||||||
<attribute-override name="slug"> |
|
||||||
<field column="slug" length="190" unique="true" type="string" /> |
|
||||||
</attribute-override> |
|
||||||
</attribute-overrides> |
|
||||||
<options> |
|
||||||
<option name="row_format">DYNAMIC</option> |
|
||||||
</options> |
|
||||||
|
|
||||||
</entity> |
|
||||||
</doctrine-mapping> |
|
||||||
@ -1,17 +0,0 @@ |
|||||||
<?xml version="1.0" encoding="UTF-8"?> |
|
||||||
<serializer> |
|
||||||
<!-- |
|
||||||
This file has been generated by the EasyExtends bundle ( http://sonata-project.org/bundles/easy-extends ) |
|
||||||
|
|
||||||
@author <yourname> <youremail> |
|
||||||
--> |
|
||||||
|
|
||||||
<class name="Chamilo\ClassificationBundle\Document\Category" |
|
||||||
exclusion-policy="all" xml-root-name="_category"> |
|
||||||
|
|
||||||
<property xml-attribute-map="true" name="id" type="integer" |
|
||||||
expose="true" since-version="1.0" |
|
||||||
groups="sonata_api_read,sonata_api_write,sonata_search"/> |
|
||||||
|
|
||||||
</class> |
|
||||||
</serializer> |
|
||||||
@ -1,17 +0,0 @@ |
|||||||
<?xml version="1.0" encoding="UTF-8"?> |
|
||||||
<serializer> |
|
||||||
<!-- |
|
||||||
This file has been generated by the EasyExtends bundle ( http://sonata-project.org/bundles/easy-extends ) |
|
||||||
|
|
||||||
@author <yourname> <youremail> |
|
||||||
--> |
|
||||||
|
|
||||||
<class name="Chamilo\ClassificationBundle\Document\Tag" |
|
||||||
exclusion-policy="all" xml-root-name="_tag"> |
|
||||||
|
|
||||||
<property xml-attribute-map="true" name="id" type="integer" |
|
||||||
expose="true" since-version="1.0" |
|
||||||
groups="sonata_api_read,sonata_api_write,sonata_search"/> |
|
||||||
|
|
||||||
</class> |
|
||||||
</serializer> |
|
||||||
@ -1,17 +0,0 @@ |
|||||||
<?xml version="1.0" encoding="UTF-8"?> |
|
||||||
<serializer> |
|
||||||
<!-- |
|
||||||
This file has been generated by the EasyExtends bundle ( http://sonata-project.org/bundles/easy-extends ) |
|
||||||
|
|
||||||
@author <yourname> <youremail> |
|
||||||
--> |
|
||||||
|
|
||||||
<class name="Chamilo\ClassificationBundle\Entity\Category" |
|
||||||
exclusion-policy="all" xml-root-name="_category"> |
|
||||||
|
|
||||||
<property xml-attribute-map="true" name="id" type="integer" |
|
||||||
expose="true" since-version="1.0" |
|
||||||
groups="sonata_api_read,sonata_api_write,sonata_search"/> |
|
||||||
|
|
||||||
</class> |
|
||||||
</serializer> |
|
||||||
@ -1,17 +0,0 @@ |
|||||||
<?xml version="1.0" encoding="UTF-8"?> |
|
||||||
<serializer> |
|
||||||
<!-- |
|
||||||
This file has been generated by the EasyExtends bundle ( http://sonata-project.org/bundles/easy-extends ) |
|
||||||
|
|
||||||
@author <yourname> <youremail> |
|
||||||
--> |
|
||||||
|
|
||||||
<class name="Chamilo\ClassificationBundle\Entity\Collection" |
|
||||||
exclusion-policy="all" xml-root-name="_collection"> |
|
||||||
|
|
||||||
<property xml-attribute-map="true" name="id" type="integer" |
|
||||||
expose="true" since-version="1.0" |
|
||||||
groups="sonata_api_read,sonata_api_write,sonata_search"/> |
|
||||||
|
|
||||||
</class> |
|
||||||
</serializer> |
|
||||||
@ -1,17 +0,0 @@ |
|||||||
<?xml version="1.0" encoding="UTF-8"?> |
|
||||||
<serializer> |
|
||||||
<!-- |
|
||||||
This file has been generated by the EasyExtends bundle ( http://sonata-project.org/bundles/easy-extends ) |
|
||||||
|
|
||||||
@author <yourname> <youremail> |
|
||||||
--> |
|
||||||
|
|
||||||
<class name="Chamilo\ClassificationBundle\Entity\Context" |
|
||||||
exclusion-policy="all" xml-root-name="_context"> |
|
||||||
|
|
||||||
<property xml-attribute-map="true" name="id" type="integer" |
|
||||||
expose="true" since-version="1.0" |
|
||||||
groups="sonata_api_read,sonata_api_write,sonata_search"/> |
|
||||||
|
|
||||||
</class> |
|
||||||
</serializer> |
|
||||||
@ -1,17 +0,0 @@ |
|||||||
<?xml version="1.0" encoding="UTF-8"?> |
|
||||||
<serializer> |
|
||||||
<!-- |
|
||||||
This file has been generated by the EasyExtends bundle ( http://sonata-project.org/bundles/easy-extends ) |
|
||||||
|
|
||||||
@author <yourname> <youremail> |
|
||||||
--> |
|
||||||
|
|
||||||
<class name="Chamilo\ClassificationBundle\Entity\Tag" exclusion-policy="all" |
|
||||||
xml-root-name="_tag"> |
|
||||||
|
|
||||||
<property xml-attribute-map="true" name="id" type="integer" |
|
||||||
expose="true" since-version="1.0" |
|
||||||
groups="sonata_api_read,sonata_api_write,sonata_search"/> |
|
||||||
|
|
||||||
</class> |
|
||||||
</serializer> |
|
||||||
@ -1,44 +0,0 @@ |
|||||||
<?php |
|
||||||
|
|
||||||
/* For licensing terms, see /license.txt */ |
|
||||||
|
|
||||||
namespace Chamilo\ContactBundle\Admin; |
|
||||||
|
|
||||||
use A2lix\TranslationFormBundle\Form\Type\TranslationsType; |
|
||||||
use Sonata\AdminBundle\Admin\AbstractAdmin; |
|
||||||
use Sonata\AdminBundle\Datagrid\DatagridMapper; |
|
||||||
use Sonata\AdminBundle\Datagrid\ListMapper; |
|
||||||
use Sonata\AdminBundle\Form\FormMapper; |
|
||||||
|
|
||||||
/** |
|
||||||
* Class UserAdmin. |
|
||||||
*/ |
|
||||||
class CategoryAdmin extends AbstractAdmin |
|
||||||
{ |
|
||||||
protected function configureListFields(ListMapper $listMapper) |
|
||||||
{ |
|
||||||
$listMapper |
|
||||||
//->add('headline', null, array('identifier' => true)) |
|
||||||
//->add('name', null, array('identifier' => true)) |
|
||||||
->add('translations', null, ['identifier' => true]) |
|
||||||
->add('email', null, ['identifier' => true]) |
|
||||||
; |
|
||||||
} |
|
||||||
|
|
||||||
protected function configureFormFields(FormMapper $formMapper) |
|
||||||
{ |
|
||||||
$formMapper |
|
||||||
//->add('name') |
|
||||||
->add('translations', TranslationsType::class, []) |
|
||||||
->add('email') |
|
||||||
; |
|
||||||
} |
|
||||||
|
|
||||||
protected function configureDatagridFilters(DatagridMapper $datagridMapper) |
|
||||||
{ |
|
||||||
$datagridMapper |
|
||||||
->add('translations', null, ['identifier' => true]) |
|
||||||
->add('email', null, ['identifier' => true]) |
|
||||||
; |
|
||||||
} |
|
||||||
} |
|
||||||
@ -1,14 +0,0 @@ |
|||||||
<?php |
|
||||||
|
|
||||||
/* For licensing terms, see /license.txt */ |
|
||||||
|
|
||||||
namespace Chamilo\ContactBundle; |
|
||||||
|
|
||||||
use Symfony\Component\HttpKernel\Bundle\Bundle; |
|
||||||
|
|
||||||
/** |
|
||||||
* Class ChamiloContactBundle. |
|
||||||
*/ |
|
||||||
class ChamiloContactBundle extends Bundle |
|
||||||
{ |
|
||||||
} |
|
||||||
@ -1,88 +0,0 @@ |
|||||||
<?php |
|
||||||
|
|
||||||
/* For licensing terms, see /license.txt */ |
|
||||||
|
|
||||||
namespace Chamilo\ContactBundle\Controller; |
|
||||||
|
|
||||||
use Chamilo\ContactBundle\Entity\Category; |
|
||||||
use Chamilo\ContactBundle\Form\Type\ContactType; |
|
||||||
use Chamilo\UserBundle\Entity\User; |
|
||||||
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController; |
|
||||||
use Symfony\Component\HttpFoundation\Request; |
|
||||||
use Symfony\Component\Mailer\MailerInterface; |
|
||||||
use Symfony\Component\Mime\Email; |
|
||||||
use Symfony\Component\Routing\Annotation\Route; |
|
||||||
|
|
||||||
/** |
|
||||||
* Class ContactController. |
|
||||||
* |
|
||||||
* @Route("/") |
|
||||||
*/ |
|
||||||
class ContactController extends AbstractController |
|
||||||
{ |
|
||||||
/** |
|
||||||
* @Route("/", name="contact") |
|
||||||
*/ |
|
||||||
public function indexAction(Request $request, MailerInterface $mailer) |
|
||||||
{ |
|
||||||
/** @var User $user */ |
|
||||||
$user = $this->getUser(); |
|
||||||
$data = []; |
|
||||||
|
|
||||||
if ($user) { |
|
||||||
$data = [ |
|
||||||
'firstname' => $user->getFirstname(), |
|
||||||
'lastname' => $user->getFirstname(), |
|
||||||
'email' => $user->getEmail(), |
|
||||||
]; |
|
||||||
} |
|
||||||
|
|
||||||
$form = $this->createForm(ContactType::class, $data); |
|
||||||
|
|
||||||
if ($request->isMethod('POST')) { |
|
||||||
$form->bind($request); |
|
||||||
|
|
||||||
$em = $this->getDoctrine()->getManager(); |
|
||||||
|
|
||||||
$category = $form->get('category')->getData(); |
|
||||||
/** @var Category $category */ |
|
||||||
$category = $em->getRepository('ChamiloContactBundle:Category')->find($category); |
|
||||||
|
|
||||||
if ($form->isValid()) { |
|
||||||
$message = new Email(); |
|
||||||
$message->subject($form->get('subject')->getData()) |
|
||||||
->from($form->get('email')->getData()) |
|
||||||
->to($category->getEmail()) |
|
||||||
->setBody( |
|
||||||
$this->renderView( |
|
||||||
'@ChamiloContact/contact.html.twig', |
|
||||||
[ |
|
||||||
'ip' => $request->getClientIp(), |
|
||||||
'firstname' => $form->get('firstname')->getData(), |
|
||||||
'lastname' => $form->get('lastname')->getData(), |
|
||||||
'subject' => $form->get('subject')->getData(), |
|
||||||
'email' => $form->get('email')->getData(), |
|
||||||
'message' => $form->get('message')->getData(), |
|
||||||
] |
|
||||||
) |
|
||||||
); |
|
||||||
|
|
||||||
$mailer->send($message); |
|
||||||
|
|
||||||
$this->addFlash( |
|
||||||
'success', |
|
||||||
$this->get('translator')->trans('Your email has been sent! Thanks!') |
|
||||||
); |
|
||||||
|
|
||||||
return $this->redirect($this->generateUrl('contact')); |
|
||||||
} |
|
||||||
} |
|
||||||
|
|
||||||
return $this->render( |
|
||||||
'@ChamiloContact/index.html.twig', |
|
||||||
[ |
|
||||||
'form' => $form->createView(), |
|
||||||
] |
|
||||||
); |
|
||||||
} |
|
||||||
} |
|
||||||
@ -1,24 +0,0 @@ |
|||||||
<?php |
|
||||||
|
|
||||||
/* For licensing terms, see /license.txt */ |
|
||||||
|
|
||||||
namespace Chamilo\ContactBundle\DependencyInjection; |
|
||||||
|
|
||||||
use Symfony\Component\Config\FileLocator; |
|
||||||
use Symfony\Component\DependencyInjection\ContainerBuilder; |
|
||||||
use Symfony\Component\DependencyInjection\Loader; |
|
||||||
use Symfony\Component\HttpKernel\DependencyInjection\Extension; |
|
||||||
|
|
||||||
/** |
|
||||||
* This is the class that loads and manages your bundle configuration. |
|
||||||
* |
|
||||||
* To learn more see {@link http://symfony.com/doc/current/cookbook/bundles/extension.html} |
|
||||||
*/ |
|
||||||
class ChamiloContactExtension extends Extension |
|
||||||
{ |
|
||||||
public function load(array $configs, ContainerBuilder $container) |
|
||||||
{ |
|
||||||
$loader = new Loader\YamlFileLoader($container, new FileLocator(__DIR__.'/../Resources/config')); |
|
||||||
$loader->load('admin.yml'); |
|
||||||
} |
|
||||||
} |
|
||||||
@ -1,120 +0,0 @@ |
|||||||
<?php |
|
||||||
|
|
||||||
/* For licensing terms, see /license.txt */ |
|
||||||
|
|
||||||
namespace Chamilo\ContactBundle\Entity; |
|
||||||
|
|
||||||
use Doctrine\ORM\Mapping as ORM; |
|
||||||
use Knp\DoctrineBehaviors\Contract\Entity\TranslatableInterface; |
|
||||||
use Knp\DoctrineBehaviors\Model\Translatable\TranslatableTrait; |
|
||||||
|
|
||||||
/** |
|
||||||
* Class Category. |
|
||||||
* |
|
||||||
* @ORM\Entity |
|
||||||
* @ORM\Table(name="contact_category") |
|
||||||
*/ |
|
||||||
class Category implements TranslatableInterface |
|
||||||
{ |
|
||||||
use TranslatableTrait; |
|
||||||
|
|
||||||
/** |
|
||||||
* @var int |
|
||||||
* |
|
||||||
* @ORM\Column(name="id", type="integer") |
|
||||||
* @ORM\Id |
|
||||||
* @ORM\GeneratedValue() |
|
||||||
*/ |
|
||||||
protected $id; |
|
||||||
|
|
||||||
/** |
|
||||||
* @var string |
|
||||||
* |
|
||||||
* @ORM\Column(name="name", type="string", nullable=false) |
|
||||||
*/ |
|
||||||
protected $name; |
|
||||||
|
|
||||||
/** |
|
||||||
* @var string |
|
||||||
* |
|
||||||
* @ORM\Column(name="email", type="string") |
|
||||||
*/ |
|
||||||
protected $email; |
|
||||||
|
|
||||||
/** |
|
||||||
* @param $method |
|
||||||
* @param $arguments |
|
||||||
*/ |
|
||||||
public function __call($method, $arguments) |
|
||||||
{ |
|
||||||
return $this->proxyCurrentLocaleTranslation($method, $arguments); |
|
||||||
} |
|
||||||
|
|
||||||
/** |
|
||||||
* @return string |
|
||||||
*/ |
|
||||||
public function __toString() |
|
||||||
{ |
|
||||||
return (string) $this->getName(); |
|
||||||
} |
|
||||||
|
|
||||||
/** |
|
||||||
* @return string |
|
||||||
*/ |
|
||||||
public function getName() |
|
||||||
{ |
|
||||||
return $this->name; |
|
||||||
} |
|
||||||
|
|
||||||
/** |
|
||||||
* @param string $name |
|
||||||
* |
|
||||||
* @return Category |
|
||||||
*/ |
|
||||||
public function setName($name) |
|
||||||
{ |
|
||||||
$this->name = $name; |
|
||||||
|
|
||||||
return $this; |
|
||||||
} |
|
||||||
|
|
||||||
/** |
|
||||||
* @return string |
|
||||||
*/ |
|
||||||
public function getEmail() |
|
||||||
{ |
|
||||||
return $this->email; |
|
||||||
} |
|
||||||
|
|
||||||
/** |
|
||||||
* @param string $email |
|
||||||
* |
|
||||||
* @return Category |
|
||||||
*/ |
|
||||||
public function setEmail($email) |
|
||||||
{ |
|
||||||
$this->email = $email; |
|
||||||
|
|
||||||
return $this; |
|
||||||
} |
|
||||||
|
|
||||||
/** |
|
||||||
* @return int |
|
||||||
*/ |
|
||||||
public function getId() |
|
||||||
{ |
|
||||||
return $this->id; |
|
||||||
} |
|
||||||
|
|
||||||
/** |
|
||||||
* @param int $id |
|
||||||
* |
|
||||||
* @return Category |
|
||||||
*/ |
|
||||||
public function setId($id) |
|
||||||
{ |
|
||||||
$this->id = $id; |
|
||||||
|
|
||||||
return $this; |
|
||||||
} |
|
||||||
} |
|
||||||
@ -1,70 +0,0 @@ |
|||||||
<?php |
|
||||||
|
|
||||||
/* For licensing terms, see /license.txt */ |
|
||||||
|
|
||||||
namespace Chamilo\ContactBundle\Entity; |
|
||||||
|
|
||||||
use Doctrine\ORM\Mapping as ORM; |
|
||||||
use Knp\DoctrineBehaviors\Contract\Entity\TranslationInterface; |
|
||||||
use Knp\DoctrineBehaviors\Model\Translatable\TranslationTrait; |
|
||||||
|
|
||||||
/** |
|
||||||
* Class CategoryTranslation. |
|
||||||
* |
|
||||||
* @ORM\Entity |
|
||||||
* @ORM\Table( |
|
||||||
* name="contact_category_translation", |
|
||||||
* options={"row_format":"DYNAMIC"} |
|
||||||
* ) |
|
||||||
*/ |
|
||||||
class CategoryTranslation implements TranslationInterface |
|
||||||
{ |
|
||||||
use TranslationTrait; |
|
||||||
|
|
||||||
/** |
|
||||||
* @var int |
|
||||||
* |
|
||||||
* @ORM\Column(name="id", type="integer") |
|
||||||
* @ORM\Id |
|
||||||
* @ORM\GeneratedValue() |
|
||||||
*/ |
|
||||||
protected $id; |
|
||||||
|
|
||||||
/** |
|
||||||
* @ORM\Column(type="string", length=255, nullable=false) |
|
||||||
*/ |
|
||||||
protected $name; |
|
||||||
|
|
||||||
/** |
|
||||||
* @var string |
|
||||||
* |
|
||||||
* @ORM\Column(type="string", length=190, nullable=false) |
|
||||||
*/ |
|
||||||
protected $locale; |
|
||||||
|
|
||||||
/** |
|
||||||
* @return string |
|
||||||
*/ |
|
||||||
public function __toString() |
|
||||||
{ |
|
||||||
return (string) $this->name; |
|
||||||
} |
|
||||||
|
|
||||||
/** |
|
||||||
* @return string |
|
||||||
*/ |
|
||||||
public function getName() |
|
||||||
{ |
|
||||||
return $this->name; |
|
||||||
} |
|
||||||
|
|
||||||
/** |
|
||||||
* @return CategoryTranslation |
|
||||||
*/ |
|
||||||
public function setName($name) |
|
||||||
{ |
|
||||||
$this->name = $name; |
|
||||||
|
|
||||||
return $this; |
|
||||||
} |
|
||||||
} |
|
||||||
@ -1,9 +0,0 @@ |
|||||||
<?php |
|
||||||
|
|
||||||
/* For licensing terms, see /license.txt */ |
|
||||||
|
|
||||||
namespace Chamilo\ContactBundle\Entity; |
|
||||||
|
|
||||||
class Contact |
|
||||||
{ |
|
||||||
} |
|
||||||
@ -1,72 +0,0 @@ |
|||||||
<?php |
|
||||||
|
|
||||||
/* For licensing terms, see /license.txt */ |
|
||||||
|
|
||||||
namespace Chamilo\ContactBundle\Form\Type; |
|
||||||
|
|
||||||
use Symfony\Bridge\Doctrine\Form\Type\EntityType; |
|
||||||
use Symfony\Component\Form\AbstractType; |
|
||||||
use Symfony\Component\Form\Extension\Core\Type\SubmitType; |
|
||||||
use Symfony\Component\Form\Extension\Core\Type\TextareaType; |
|
||||||
use Symfony\Component\Form\FormBuilderInterface; |
|
||||||
use Symfony\Component\OptionsResolver\OptionsResolverInterface; |
|
||||||
use Symfony\Component\Validator\Constraints\Collection; |
|
||||||
use Symfony\Component\Validator\Constraints\Email; |
|
||||||
use Symfony\Component\Validator\Constraints\Length; |
|
||||||
use Symfony\Component\Validator\Constraints\NotBlank; |
|
||||||
|
|
||||||
/** |
|
||||||
* Class ContactType. |
|
||||||
*/ |
|
||||||
class ContactType extends AbstractType |
|
||||||
{ |
|
||||||
public function buildForm(FormBuilderInterface $builder, array $options) |
|
||||||
{ |
|
||||||
$builder |
|
||||||
->add( |
|
||||||
'category', |
|
||||||
EntityType::class, |
|
||||||
['class' => 'Chamilo\ContactBundle\Entity\Category'] |
|
||||||
) |
|
||||||
->add('firstname') |
|
||||||
->add('lastname') |
|
||||||
->add('email') |
|
||||||
->add('subject') |
|
||||||
->add('message', TextareaType::class) |
|
||||||
->add('send', SubmitType::class, ['attr' => ['class' => 'btn btn-primary']]) |
|
||||||
; |
|
||||||
} |
|
||||||
|
|
||||||
public function setDefaultOptions(OptionsResolverInterface $resolver) |
|
||||||
{ |
|
||||||
$collectionConstraint = new Collection([ |
|
||||||
'category' => [ |
|
||||||
new NotBlank(['message' => 'Category should not be blank.']), |
|
||||||
], |
|
||||||
'firstname' => [ |
|
||||||
new NotBlank(['message' => 'Firstname should not be blank.']), |
|
||||||
new Length(['min' => 2]), |
|
||||||
], |
|
||||||
'lastname' => [ |
|
||||||
new NotBlank(['message' => 'Lastname should not be blank.']), |
|
||||||
new Length(['min' => 2]), |
|
||||||
], |
|
||||||
'email' => [ |
|
||||||
new NotBlank(['message' => 'Email should not be blank.']), |
|
||||||
new Email(['message' => 'Invalid email address.']), |
|
||||||
], |
|
||||||
'subject' => [ |
|
||||||
new NotBlank(['message' => 'Subject should not be blank.']), |
|
||||||
new Length(['min' => 3]), |
|
||||||
], |
|
||||||
'message' => [ |
|
||||||
new NotBlank(['message' => 'Message should not be blank.']), |
|
||||||
new Length(['min' => 5]), |
|
||||||
], |
|
||||||
]); |
|
||||||
|
|
||||||
$resolver->setDefaults([ |
|
||||||
'constraints' => $collectionConstraint, |
|
||||||
]); |
|
||||||
} |
|
||||||
} |
|
||||||
@ -1,9 +0,0 @@ |
|||||||
services: |
|
||||||
sonata.admin.contact_category: |
|
||||||
class: Chamilo\ContactBundle\Admin\CategoryAdmin |
|
||||||
tags: |
|
||||||
- {name: sonata.admin, manager_type: orm, group: "LMS", label: "Contact category"} |
|
||||||
arguments: |
|
||||||
- ~ |
|
||||||
- Chamilo\ContactBundle\Entity\Category |
|
||||||
- ~ |
|
||||||
@ -1,3 +0,0 @@ |
|||||||
contact: |
|
||||||
resource: "@ChamiloContactBundle/Controller/ContactController.php" |
|
||||||
type: annotation |
|
||||||
@ -1,26 +0,0 @@ |
|||||||
msgid "Category" |
|
||||||
msgstr "Categoría" |
|
||||||
|
|
||||||
msgid "Firstname" |
|
||||||
msgstr "Apellidos" |
|
||||||
|
|
||||||
msgid "Lastname" |
|
||||||
msgstr "Nombre" |
|
||||||
|
|
||||||
msgid "Email" |
|
||||||
msgstr "Correo electrónico" |
|
||||||
|
|
||||||
msgid "Subject" |
|
||||||
msgstr "Asunto" |
|
||||||
|
|
||||||
msgid "Message" |
|
||||||
msgstr "Mensaje" |
|
||||||
|
|
||||||
msgid "Send" |
|
||||||
msgstr "Enviar" |
|
||||||
|
|
||||||
msgid "You had a new message from %url%" |
|
||||||
msgstr "Ha recibido un nuevo mensaje de %url%" |
|
||||||
|
|
||||||
msgid "Your email has been sent! Thanks!" |
|
||||||
msgstr "Su mensaje ha sido enviado! Gracias!" |
|
||||||
@ -1,11 +0,0 @@ |
|||||||
{{ 'You had a new message from %url%' | trans({'%url%': url(app.request.attributes.get('_route'))} ) }} |
|
||||||
|
|
||||||
{{ 'Firstname' | trans }} : {{ firstname }} |
|
||||||
{{ 'Lastname' | trans }} : {{ lastname }} |
|
||||||
|
|
||||||
Email: {{ email }} |
|
||||||
IP: {{ ip }} |
|
||||||
|
|
||||||
{{ 'Subject' | trans }} : {{ subject }} |
|
||||||
{{ 'Message' | trans }} : |
|
||||||
{{ message|raw }} |
|
||||||
@ -1,13 +0,0 @@ |
|||||||
{% extends "@ChamiloTheme/Layout/base-layout.html.twig" %} |
|
||||||
|
|
||||||
{% block chamilo_content %} |
|
||||||
|
|
||||||
<section id="main_content"> |
|
||||||
<div class="page-header"> |
|
||||||
<h2>{{ 'Contact' | trans }}</h2> |
|
||||||
</div> |
|
||||||
{{ form_start(form) }} |
|
||||||
{{ form_widget(form, {'attr': {'class': ''}}) }} |
|
||||||
{{ form_end(form) }} |
|
||||||
</section> |
|
||||||
{% endblock %} |
|
||||||
@ -1,65 +0,0 @@ |
|||||||
<?php |
|
||||||
|
|
||||||
/* For licensing terms, see /license.txt */ |
|
||||||
|
|
||||||
namespace Chamilo\FaqBundle\Admin; |
|
||||||
|
|
||||||
use A2lix\TranslationFormBundle\Form\Type\TranslationsType; |
|
||||||
use Sonata\AdminBundle\Admin\AbstractAdmin; |
|
||||||
use Sonata\AdminBundle\Datagrid\DatagridMapper; |
|
||||||
use Sonata\AdminBundle\Datagrid\ListMapper; |
|
||||||
use Sonata\AdminBundle\Form\FormMapper; |
|
||||||
|
|
||||||
/** |
|
||||||
* Class QuestionAdmin. |
|
||||||
*/ |
|
||||||
class CategoryAdmin extends AbstractAdmin |
|
||||||
{ |
|
||||||
protected $datagridValues = [ |
|
||||||
'_page' => 1, |
|
||||||
'_sort_by' => 'created_at', |
|
||||||
'_sort_order' => 'Desc', |
|
||||||
]; |
|
||||||
|
|
||||||
protected function configureDatagridFilters(DatagridMapper $datagridMapper) |
|
||||||
{ |
|
||||||
$datagridMapper |
|
||||||
//->add('headline') |
|
||||||
//->add('body') |
|
||||||
->add('rank') |
|
||||||
->add('isActive') |
|
||||||
; |
|
||||||
} |
|
||||||
|
|
||||||
protected function configureListFields(ListMapper $listMapper) |
|
||||||
{ |
|
||||||
$listMapper |
|
||||||
//->add('headline', null, array('identifier' => true)) |
|
||||||
->add('translations', null, ['identifier' => true]) |
|
||||||
->add('rank') |
|
||||||
->add( |
|
||||||
'_action', |
|
||||||
'actions', |
|
||||||
[ |
|
||||||
'actions' => [ |
|
||||||
//'show' => array(), |
|
||||||
'preview' => ['template' => 'ChamiloFaqBundle:Faq:preview_category_partial.html.twig'], |
|
||||||
'edit' => [], |
|
||||||
'delete' => [], |
|
||||||
], |
|
||||||
] |
|
||||||
) |
|
||||||
; |
|
||||||
} |
|
||||||
|
|
||||||
protected function configureFormFields(FormMapper $formMapper) |
|
||||||
{ |
|
||||||
$formMapper |
|
||||||
->add('translations', TranslationsType::class, []) |
|
||||||
->add('rank', null, ['required' => false]) |
|
||||||
// ->add('slug') |
|
||||||
->add('isActive') |
|
||||||
->end() |
|
||||||
; |
|
||||||
} |
|
||||||
} |
|
||||||
@ -1,71 +0,0 @@ |
|||||||
<?php |
|
||||||
|
|
||||||
/* For licensing terms, see /license.txt */ |
|
||||||
|
|
||||||
namespace Chamilo\FaqBundle\Admin; |
|
||||||
|
|
||||||
use A2lix\TranslationFormBundle\Form\Type\TranslationsType; |
|
||||||
use Sonata\AdminBundle\Admin\AbstractAdmin; |
|
||||||
use Sonata\AdminBundle\Datagrid\DatagridMapper; |
|
||||||
use Sonata\AdminBundle\Datagrid\ListMapper; |
|
||||||
use Sonata\AdminBundle\Form\FormMapper; |
|
||||||
|
|
||||||
/** |
|
||||||
* Class QuestionAdmin. |
|
||||||
*/ |
|
||||||
class QuestionAdmin extends AbstractAdmin |
|
||||||
{ |
|
||||||
protected $datagridValues = [ |
|
||||||
'_page' => 1, |
|
||||||
'_sort_by' => 'issueDate', |
|
||||||
'_sort_order' => 'Desc', |
|
||||||
]; |
|
||||||
|
|
||||||
protected function configureDatagridFilters(DatagridMapper $datagridMapper) |
|
||||||
{ |
|
||||||
$datagridMapper |
|
||||||
->add('id') |
|
||||||
->add('isActive') |
|
||||||
; |
|
||||||
} |
|
||||||
|
|
||||||
protected function configureListFields(ListMapper $listMapper) |
|
||||||
{ |
|
||||||
$listMapper |
|
||||||
->addIdentifier('id') |
|
||||||
->add('translations', null, ['identifier' => true]) |
|
||||||
->add('Category') |
|
||||||
->add('rank') |
|
||||||
->add( |
|
||||||
'_action', |
|
||||||
'actions', |
|
||||||
[ |
|
||||||
'actions' => [ |
|
||||||
//'show' => array(), |
|
||||||
'preview' => ['template' => 'ChamiloFaqBundle:Faq:preview_question_partial.html.twig'], |
|
||||||
'edit' => [], |
|
||||||
'delete' => [], |
|
||||||
], |
|
||||||
] |
|
||||||
); |
|
||||||
} |
|
||||||
|
|
||||||
protected function configureFormFields(FormMapper $formMapper) |
|
||||||
{ |
|
||||||
$formMapper |
|
||||||
->add('translations', TranslationsType::class, []) |
|
||||||
->add( |
|
||||||
'category', |
|
||||||
null, |
|
||||||
[ |
|
||||||
'expanded' => true, |
|
||||||
'required' => true, |
|
||||||
'attr' => ['class' => 'radio-list vertical'], |
|
||||||
] |
|
||||||
) |
|
||||||
->add('rank', null, ['required' => false]) |
|
||||||
->add('onlyAuthUsers') |
|
||||||
->add('isActive') |
|
||||||
->end(); |
|
||||||
} |
|
||||||
} |
|
||||||
@ -1,16 +0,0 @@ |
|||||||
<?php |
|
||||||
|
|
||||||
/* For licensing terms, see /license.txt */ |
|
||||||
|
|
||||||
namespace Chamilo\FaqBundle; |
|
||||||
|
|
||||||
use Symfony\Component\HttpKernel\Bundle\Bundle; |
|
||||||
|
|
||||||
/** |
|
||||||
* Class ChamiloFaqBundle. |
|
||||||
* |
|
||||||
* Based in GenjFaqBundle |
|
||||||
*/ |
|
||||||
class ChamiloFaqBundle extends Bundle |
|
||||||
{ |
|
||||||
} |
|
||||||
@ -1,188 +0,0 @@ |
|||||||
<?php |
|
||||||
|
|
||||||
/* For licensing terms, see /license.txt */ |
|
||||||
|
|
||||||
namespace Chamilo\FaqBundle\Controller; |
|
||||||
|
|
||||||
use Chamilo\FaqBundle\Entity\Category; |
|
||||||
use Chamilo\FaqBundle\Entity\CategoryRepository; |
|
||||||
use Chamilo\FaqBundle\Entity\Question; |
|
||||||
use Chamilo\FaqBundle\Entity\QuestionRepository; |
|
||||||
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController; |
|
||||||
|
|
||||||
/** |
|
||||||
* Class FaqController. |
|
||||||
*/ |
|
||||||
class FaqController extends AbstractController |
|
||||||
{ |
|
||||||
/** |
|
||||||
* Default index. Shows one category/question at a time. If you want to just show everything at once, use the |
|
||||||
* indexWithoutCollapse action instead. |
|
||||||
* |
|
||||||
* @param string $categorySlug |
|
||||||
* @param string $questionSlug |
|
||||||
* |
|
||||||
* @throws \Symfony\Component\HttpKernel\Exception\NotFoundHttpException |
|
||||||
* |
|
||||||
* @return \Symfony\Component\HttpFoundation\Response |
|
||||||
*/ |
|
||||||
public function indexAction($categorySlug, $questionSlug) |
|
||||||
{ |
|
||||||
if (!$categorySlug || !$questionSlug) { |
|
||||||
$redirect = $this->generateRedirectToDefaultSelection($categorySlug, $questionSlug); |
|
||||||
if ($redirect) { |
|
||||||
return $redirect; |
|
||||||
} |
|
||||||
} |
|
||||||
|
|
||||||
// Otherwise get the selected category and/or question as usual |
|
||||||
$questions = []; |
|
||||||
$categories = $this->getCategoryRepository()->retrieveActive(); |
|
||||||
$selectedCategory = $this->getSelectedCategory($categorySlug); |
|
||||||
$selectedQuestion = $this->getSelectedQuestion($questionSlug); |
|
||||||
|
|
||||||
if ($selectedCategory) { |
|
||||||
$questions = $selectedCategory->getQuestions(); |
|
||||||
} |
|
||||||
|
|
||||||
// Throw 404 if there is no category in the database |
|
||||||
if (!$categories) { |
|
||||||
throw $this->createNotFoundException('You need at least 1 active faq category in the database'); |
|
||||||
} |
|
||||||
|
|
||||||
return $this->render( |
|
||||||
'@ChamiloFaq/Faq/index.html.twig', |
|
||||||
[ |
|
||||||
'categories' => $categories, |
|
||||||
'questions' => $questions, |
|
||||||
'selectedCategory' => $selectedCategory, |
|
||||||
'selectedQuestion' => $selectedQuestion, |
|
||||||
] |
|
||||||
); |
|
||||||
} |
|
||||||
|
|
||||||
/** |
|
||||||
* Index without any collapsing. Will just show all categories and questions at once. |
|
||||||
* |
|
||||||
* @param string $categorySlug |
|
||||||
* |
|
||||||
* @throws \Symfony\Component\HttpKernel\Exception\NotFoundHttpException |
|
||||||
* |
|
||||||
* @return \Symfony\Component\HttpFoundation\Response |
|
||||||
*/ |
|
||||||
public function indexWithoutCollapseAction($categorySlug) |
|
||||||
{ |
|
||||||
if ($categorySlug) { |
|
||||||
$categories = $this->getCategoryRepository()->retrieveActiveBySlug($categorySlug); |
|
||||||
} else { |
|
||||||
$categories = $this->getCategoryRepository()->retrieveActive(); |
|
||||||
} |
|
||||||
|
|
||||||
if (!$categories) { |
|
||||||
throw $this->createNotFoundException('Faq category not found'); |
|
||||||
} |
|
||||||
|
|
||||||
return $this->render( |
|
||||||
'@ChamiloFaq/Faq/index_without_collapse.html.twig', |
|
||||||
[ |
|
||||||
'categories' => $categories, |
|
||||||
'categorySlug' => $categorySlug, |
|
||||||
] |
|
||||||
); |
|
||||||
} |
|
||||||
|
|
||||||
/** |
|
||||||
* Open first category or question if none was selected so far. |
|
||||||
* |
|
||||||
* @param string $categorySlug |
|
||||||
* @param string $questionSlug |
|
||||||
* |
|
||||||
* @throws \Symfony\Component\HttpKernel\Exception\NotFoundHttpException |
|
||||||
* |
|
||||||
* @return \Symfony\Component\HttpFoundation\RedirectResponse |
|
||||||
*/ |
|
||||||
protected function generateRedirectToDefaultSelection($categorySlug, $questionSlug) |
|
||||||
{ |
|
||||||
$doRedirect = false; |
|
||||||
//$config = $this->container->getParameter('faq'); |
|
||||||
$config = []; |
|
||||||
$config['select_first_category_by_default'] = false; |
|
||||||
$config['select_first_question_by_default'] = false; |
|
||||||
|
|
||||||
if (!$categorySlug && $config['select_first_category_by_default']) { |
|
||||||
$firstCategory = $this->getCategoryRepository()->retrieveFirst(); |
|
||||||
if ($firstCategory instanceof Category) { |
|
||||||
$categorySlug = $firstCategory->getSlug(); |
|
||||||
$doRedirect = true; |
|
||||||
} else { |
|
||||||
throw $this->createNotFoundException('Tried to open the first faq category by default, but there was none.'); |
|
||||||
} |
|
||||||
} |
|
||||||
|
|
||||||
if (!$questionSlug && $config['select_first_question_by_default']) { |
|
||||||
$firstQuestion = $this->getQuestionRepository()->retrieveFirstByCategorySlug($categorySlug); |
|
||||||
if ($firstQuestion instanceof Question) { |
|
||||||
$questionSlug = $firstQuestion->getSlug(); |
|
||||||
$doRedirect = true; |
|
||||||
} else { |
|
||||||
throw $this->createNotFoundException('Tried to open the first faq question by default, but there was none.'); |
|
||||||
} |
|
||||||
} |
|
||||||
|
|
||||||
if ($doRedirect) { |
|
||||||
return $this->redirect( |
|
||||||
$this->generateUrl('faq', ['categorySlug' => $categorySlug, 'questionSlug' => $questionSlug], true) |
|
||||||
); |
|
||||||
} |
|
||||||
|
|
||||||
return false; |
|
||||||
} |
|
||||||
|
|
||||||
/** |
|
||||||
* @param string $questionSlug |
|
||||||
* |
|
||||||
* @return Question |
|
||||||
*/ |
|
||||||
protected function getSelectedQuestion($questionSlug = null) |
|
||||||
{ |
|
||||||
$selectedQuestion = null; |
|
||||||
|
|
||||||
if (null !== $questionSlug) { |
|
||||||
$selectedQuestion = $this->getQuestionRepository()->getQuestionBySlug($questionSlug); |
|
||||||
} |
|
||||||
|
|
||||||
return $selectedQuestion; |
|
||||||
} |
|
||||||
|
|
||||||
/** |
|
||||||
* @param string $categorySlug |
|
||||||
* |
|
||||||
* @return Category |
|
||||||
*/ |
|
||||||
protected function getSelectedCategory($categorySlug = null) |
|
||||||
{ |
|
||||||
$selectedCategory = null; |
|
||||||
|
|
||||||
if (null !== $categorySlug) { |
|
||||||
$selectedCategory = $this->getCategoryRepository()->getCategoryActiveBySlug($categorySlug); |
|
||||||
} |
|
||||||
|
|
||||||
return $selectedCategory; |
|
||||||
} |
|
||||||
|
|
||||||
/** |
|
||||||
* @return QuestionRepository |
|
||||||
*/ |
|
||||||
protected function getQuestionRepository() |
|
||||||
{ |
|
||||||
return $this->container->get('faq.entity.question_repository'); |
|
||||||
} |
|
||||||
|
|
||||||
/** |
|
||||||
* @return CategoryRepository |
|
||||||
*/ |
|
||||||
protected function getCategoryRepository() |
|
||||||
{ |
|
||||||
return $this->container->get('faq.entity.category_repository'); |
|
||||||
} |
|
||||||
} |
|
||||||
@ -1,25 +0,0 @@ |
|||||||
<?php |
|
||||||
|
|
||||||
/* For licensing terms, see /license.txt */ |
|
||||||
|
|
||||||
namespace Chamilo\FaqBundle\DependencyInjection; |
|
||||||
|
|
||||||
use Symfony\Component\Config\FileLocator; |
|
||||||
use Symfony\Component\DependencyInjection\ContainerBuilder; |
|
||||||
use Symfony\Component\DependencyInjection\Loader; |
|
||||||
use Symfony\Component\HttpKernel\DependencyInjection\Extension; |
|
||||||
|
|
||||||
/** |
|
||||||
* This is the class that loads and manages your bundle configuration. |
|
||||||
* |
|
||||||
* To learn more see {@link http://symfony.com/doc/current/cookbook/bundles/extension.html} |
|
||||||
*/ |
|
||||||
class ChamiloFaqExtension extends Extension |
|
||||||
{ |
|
||||||
public function load(array $configs, ContainerBuilder $container) |
|
||||||
{ |
|
||||||
$loader = new Loader\YamlFileLoader($container, new FileLocator(__DIR__.'/../Resources/config')); |
|
||||||
$loader->load('admin.yml'); |
|
||||||
$loader->load('services.yml'); |
|
||||||
} |
|
||||||
} |
|
||||||
@ -1,179 +0,0 @@ |
|||||||
<?php |
|
||||||
|
|
||||||
/* For licensing terms, see /license.txt */ |
|
||||||
|
|
||||||
namespace Chamilo\FaqBundle\Entity; |
|
||||||
|
|
||||||
use Doctrine\ORM\Mapping as ORM; |
|
||||||
use Gedmo\Mapping\Annotation as Gedmo; |
|
||||||
use Gedmo\Timestampable\Traits\TimestampableEntity; |
|
||||||
use Knp\DoctrineBehaviors\Contract\Entity\TranslatableInterface; |
|
||||||
use Knp\DoctrineBehaviors\Model\Translatable\TranslatableTrait; |
|
||||||
|
|
||||||
/** |
|
||||||
* Class Category. |
|
||||||
* |
|
||||||
* @ORM\Entity(repositoryClass="Chamilo\FaqBundle\Repository\CategoryRepository") |
|
||||||
* @ORM\Table( |
|
||||||
* name="faq_category", |
|
||||||
* indexes={@ORM\Index(name="is_active_idx", columns={"is_active"})} |
|
||||||
* ) |
|
||||||
*/ |
|
||||||
class Category implements TranslatableInterface |
|
||||||
{ |
|
||||||
use TimestampableEntity; |
|
||||||
use TranslatableTrait; |
|
||||||
|
|
||||||
/** |
|
||||||
* @ORM\Column(type="integer") |
|
||||||
* @ORM\Id |
|
||||||
* @ORM\GeneratedValue(strategy="AUTO") |
|
||||||
*/ |
|
||||||
protected $id; |
|
||||||
|
|
||||||
/** |
|
||||||
* @ORM\OneToMany(targetEntity="Question", mappedBy="category") |
|
||||||
*/ |
|
||||||
protected $questions; |
|
||||||
|
|
||||||
/** |
|
||||||
* @Gedmo\SortablePosition |
|
||||||
* |
|
||||||
* @ORM\Column(name="`rank`", type="integer") |
|
||||||
*/ |
|
||||||
protected $rank; |
|
||||||
|
|
||||||
/** |
|
||||||
* @ORM\Column(name="is_active", type="boolean") |
|
||||||
*/ |
|
||||||
protected $isActive; |
|
||||||
|
|
||||||
/** |
|
||||||
* @param $method |
|
||||||
* @param $arguments |
|
||||||
*/ |
|
||||||
public function __call($method, $arguments) |
|
||||||
{ |
|
||||||
return $this->proxyCurrentLocaleTranslation($method, $arguments); |
|
||||||
} |
|
||||||
|
|
||||||
/** |
|
||||||
* Returns a string representation of this object. |
|
||||||
* |
|
||||||
* @return string |
|
||||||
*/ |
|
||||||
public function __toString() |
|
||||||
{ |
|
||||||
return (string) $this->getHeadline(); |
|
||||||
} |
|
||||||
|
|
||||||
/** |
|
||||||
* Get id. |
|
||||||
* |
|
||||||
* @return int |
|
||||||
*/ |
|
||||||
public function getId() |
|
||||||
{ |
|
||||||
return $this->id; |
|
||||||
} |
|
||||||
|
|
||||||
/** |
|
||||||
* Get rank. |
|
||||||
* |
|
||||||
* @return string |
|
||||||
*/ |
|
||||||
public function getRank() |
|
||||||
{ |
|
||||||
return $this->rank; |
|
||||||
} |
|
||||||
|
|
||||||
/** |
|
||||||
* Set rank. |
|
||||||
* |
|
||||||
* @param string $rank |
|
||||||
* |
|
||||||
* @return Question |
|
||||||
*/ |
|
||||||
public function setRank($rank) |
|
||||||
{ |
|
||||||
$this->rank = $rank; |
|
||||||
|
|
||||||
return $this; |
|
||||||
} |
|
||||||
|
|
||||||
/** |
|
||||||
* Set is_active. |
|
||||||
* |
|
||||||
* @param bool $isActive |
|
||||||
* |
|
||||||
* @return Category |
|
||||||
*/ |
|
||||||
public function setIsActive($isActive) |
|
||||||
{ |
|
||||||
$this->isActive = $isActive; |
|
||||||
|
|
||||||
return $this; |
|
||||||
} |
|
||||||
|
|
||||||
/** |
|
||||||
* Get isActive. |
|
||||||
* |
|
||||||
* @return bool |
|
||||||
*/ |
|
||||||
public function getIsActive() |
|
||||||
{ |
|
||||||
return $this->isActive; |
|
||||||
} |
|
||||||
|
|
||||||
/** |
|
||||||
* Add question. |
|
||||||
* |
|
||||||
* @return Category |
|
||||||
*/ |
|
||||||
public function addQuestion(Question $question) |
|
||||||
{ |
|
||||||
$this->questions[] = $question; |
|
||||||
|
|
||||||
return $this; |
|
||||||
} |
|
||||||
|
|
||||||
/** |
|
||||||
* Remove question. |
|
||||||
*/ |
|
||||||
public function removeQuestion(Question $question) |
|
||||||
{ |
|
||||||
$this->questions->removeElement($question); |
|
||||||
} |
|
||||||
|
|
||||||
/** |
|
||||||
* Get questions. |
|
||||||
* |
|
||||||
* @return \Doctrine\Common\Collections\Collection |
|
||||||
*/ |
|
||||||
public function getQuestions() |
|
||||||
{ |
|
||||||
return $this->questions; |
|
||||||
} |
|
||||||
|
|
||||||
/** |
|
||||||
* Returns the route name for url generation. |
|
||||||
* |
|
||||||
* @return string |
|
||||||
*/ |
|
||||||
public function getRouteName() |
|
||||||
{ |
|
||||||
return 'faq'; |
|
||||||
} |
|
||||||
|
|
||||||
/** |
|
||||||
* Returns the route parameters for url generation. |
|
||||||
* |
|
||||||
* @return array |
|
||||||
*/ |
|
||||||
public function getRouteParameters() |
|
||||||
{ |
|
||||||
return [ |
|
||||||
'categorySlug' => $this->getSlug(), |
|
||||||
]; |
|
||||||
} |
|
||||||
} |
|
||||||
@ -1,117 +0,0 @@ |
|||||||
<?php |
|
||||||
|
|
||||||
/* For licensing terms, see /license.txt */ |
|
||||||
|
|
||||||
namespace Chamilo\FaqBundle\Entity; |
|
||||||
|
|
||||||
use Doctrine\ORM\Mapping as ORM; |
|
||||||
use Gedmo\Mapping\Annotation as Gedmo; |
|
||||||
use Knp\DoctrineBehaviors\Contract\Entity\TranslationInterface; |
|
||||||
use Knp\DoctrineBehaviors\Model\Translatable\TranslationTrait; |
|
||||||
|
|
||||||
/** |
|
||||||
* Class CategoryTranslation. |
|
||||||
* |
|
||||||
* @ORM\Entity |
|
||||||
* @ORM\Table( |
|
||||||
* name="faq_category_translation", |
|
||||||
* options={"row_format":"DYNAMIC"} |
|
||||||
* ) |
|
||||||
* @ORM\AttributeOverrides({ |
|
||||||
* @ORM\AttributeOverride(name="locale", |
|
||||||
* column=@ORM\Column( |
|
||||||
* name="locale", |
|
||||||
* type="string", |
|
||||||
* length=190 |
|
||||||
* ) |
|
||||||
* ) |
|
||||||
* }) |
|
||||||
*/ |
|
||||||
class CategoryTranslation implements TranslationInterface |
|
||||||
{ |
|
||||||
use TranslationTrait; |
|
||||||
|
|
||||||
/** |
|
||||||
* @ORM\Column(name="id", type="integer") |
|
||||||
* @ORM\Id |
|
||||||
* @ORM\GeneratedValue(strategy="AUTO") |
|
||||||
*/ |
|
||||||
protected $id; |
|
||||||
|
|
||||||
/** |
|
||||||
* @ORM\Column(type="string", length=255, nullable=false) |
|
||||||
*/ |
|
||||||
protected $headline; |
|
||||||
|
|
||||||
/** |
|
||||||
* @ORM\Column(type="text", nullable=true) |
|
||||||
*/ |
|
||||||
protected $body; |
|
||||||
|
|
||||||
/** |
|
||||||
* @Gedmo\Slug(fields={"headline"}, updatable=false) |
|
||||||
* |
|
||||||
* @ORM\Column(type="string", length=50, nullable=false) |
|
||||||
*/ |
|
||||||
protected $slug; |
|
||||||
|
|
||||||
/** |
|
||||||
* @var string |
|
||||||
* |
|
||||||
* @ORM\Column(type="string", length=190, nullable=false) |
|
||||||
*/ |
|
||||||
protected $locale; |
|
||||||
|
|
||||||
/** |
|
||||||
* @return string |
|
||||||
*/ |
|
||||||
public function __toString() |
|
||||||
{ |
|
||||||
return (string) $this->headline; |
|
||||||
} |
|
||||||
|
|
||||||
public function getHeadline() |
|
||||||
{ |
|
||||||
return $this->headline; |
|
||||||
} |
|
||||||
|
|
||||||
/** |
|
||||||
* @return CategoryTranslation |
|
||||||
*/ |
|
||||||
public function setHeadline($headline) |
|
||||||
{ |
|
||||||
$this->headline = $headline; |
|
||||||
|
|
||||||
return $this; |
|
||||||
} |
|
||||||
|
|
||||||
public function getBody() |
|
||||||
{ |
|
||||||
return $this->body; |
|
||||||
} |
|
||||||
|
|
||||||
/** |
|
||||||
* @return CategoryTranslation |
|
||||||
*/ |
|
||||||
public function setBody($body) |
|
||||||
{ |
|
||||||
$this->body = $body; |
|
||||||
|
|
||||||
return $this; |
|
||||||
} |
|
||||||
|
|
||||||
public function getSlug() |
|
||||||
{ |
|
||||||
return $this->slug; |
|
||||||
} |
|
||||||
|
|
||||||
/** |
|
||||||
* @return CategoryTranslation |
|
||||||
*/ |
|
||||||
public function setSlug($slug) |
|
||||||
{ |
|
||||||
$this->slug = $slug; |
|
||||||
|
|
||||||
return $this; |
|
||||||
} |
|
||||||
} |
|
||||||
@ -1,209 +0,0 @@ |
|||||||
<?php |
|
||||||
|
|
||||||
/* For licensing terms, see /license.txt */ |
|
||||||
|
|
||||||
namespace Chamilo\FaqBundle\Entity; |
|
||||||
|
|
||||||
use Doctrine\ORM\Mapping as ORM; |
|
||||||
use Gedmo\Mapping\Annotation as Gedmo; |
|
||||||
use Gedmo\Timestampable\Traits\TimestampableEntity; |
|
||||||
use Knp\DoctrineBehaviors\Contract\Entity\TranslatableInterface; |
|
||||||
use Knp\DoctrineBehaviors\Model\Translatable\TranslatableTrait; |
|
||||||
|
|
||||||
/** |
|
||||||
* Class Question. |
|
||||||
* |
|
||||||
* @ORM\Entity(repositoryClass="Chamilo\FaqBundle\Repository\QuestionRepository") |
|
||||||
* @ORM\Table(name="faq_question") |
|
||||||
*/ |
|
||||||
class Question implements TranslatableInterface |
|
||||||
{ |
|
||||||
use TranslatableTrait; |
|
||||||
use TimestampableEntity; |
|
||||||
|
|
||||||
/** |
|
||||||
* @ORM\Column(type="integer") |
|
||||||
* @ORM\Id |
|
||||||
* @ORM\GeneratedValue(strategy="AUTO") |
|
||||||
*/ |
|
||||||
protected $id; |
|
||||||
|
|
||||||
/** |
|
||||||
* @ORM\ManyToOne(targetEntity="Category", inversedBy="questions") |
|
||||||
* @ORM\OrderBy({"rank" = "asc"}) |
|
||||||
*/ |
|
||||||
protected $category; |
|
||||||
|
|
||||||
/** |
|
||||||
* @Gedmo\SortablePosition |
|
||||||
* |
|
||||||
* @ORM\Column(name="`rank`", type="integer") |
|
||||||
*/ |
|
||||||
protected $rank; |
|
||||||
|
|
||||||
/** |
|
||||||
* @var bool |
|
||||||
* |
|
||||||
* @ORM\Column(name="only_auth_users", type="boolean", nullable=false) |
|
||||||
*/ |
|
||||||
protected $onlyAuthUsers; |
|
||||||
|
|
||||||
/** |
|
||||||
* @ORM\Column(name="is_active", type="boolean") |
|
||||||
*/ |
|
||||||
protected $isActive; |
|
||||||
|
|
||||||
/** |
|
||||||
* @param $method |
|
||||||
* @param $arguments |
|
||||||
*/ |
|
||||||
public function __call($method, $arguments) |
|
||||||
{ |
|
||||||
return $this->proxyCurrentLocaleTranslation($method, $arguments); |
|
||||||
} |
|
||||||
|
|
||||||
/** |
|
||||||
* Returns a string representation of this object. |
|
||||||
* |
|
||||||
* @return string |
|
||||||
*/ |
|
||||||
public function __toString() |
|
||||||
{ |
|
||||||
return (string) $this->getHeadline(); |
|
||||||
} |
|
||||||
|
|
||||||
/** |
|
||||||
* Get id. |
|
||||||
* |
|
||||||
* @return int |
|
||||||
*/ |
|
||||||
public function getId() |
|
||||||
{ |
|
||||||
return $this->id; |
|
||||||
} |
|
||||||
|
|
||||||
/** |
|
||||||
* Get rank. |
|
||||||
* |
|
||||||
* @return string |
|
||||||
*/ |
|
||||||
public function getRank() |
|
||||||
{ |
|
||||||
return $this->rank; |
|
||||||
} |
|
||||||
|
|
||||||
/** |
|
||||||
* Set rank. |
|
||||||
* |
|
||||||
* @param string $rank |
|
||||||
* |
|
||||||
* @return Question |
|
||||||
*/ |
|
||||||
public function setRank($rank) |
|
||||||
{ |
|
||||||
$this->rank = $rank; |
|
||||||
|
|
||||||
return $this; |
|
||||||
} |
|
||||||
|
|
||||||
/** |
|
||||||
* Set category. |
|
||||||
* |
|
||||||
* @param Category $category |
|
||||||
* |
|
||||||
* @return Question |
|
||||||
*/ |
|
||||||
public function setCategory(Category $category = null) |
|
||||||
{ |
|
||||||
$this->category = $category; |
|
||||||
|
|
||||||
return $this; |
|
||||||
} |
|
||||||
|
|
||||||
/** |
|
||||||
* Get category. |
|
||||||
* |
|
||||||
* @return Category |
|
||||||
*/ |
|
||||||
public function getCategory() |
|
||||||
{ |
|
||||||
return $this->category; |
|
||||||
} |
|
||||||
|
|
||||||
/** |
|
||||||
* Returns the route name for url generation. |
|
||||||
* |
|
||||||
* @return string |
|
||||||
*/ |
|
||||||
public function getRouteName() |
|
||||||
{ |
|
||||||
return 'faq'; |
|
||||||
} |
|
||||||
|
|
||||||
/** |
|
||||||
* Returns the route parameters for url generation. |
|
||||||
* |
|
||||||
* @return array |
|
||||||
*/ |
|
||||||
public function getRouteParameters() |
|
||||||
{ |
|
||||||
return [ |
|
||||||
'categorySlug' => $this->getCategory()->getSlug(), |
|
||||||
'questionSlug' => $this->getSlug(), |
|
||||||
]; |
|
||||||
} |
|
||||||
|
|
||||||
/** |
|
||||||
* Returns a string representation of the entity build out of BundleName + EntityName + EntityId. |
|
||||||
* |
|
||||||
* @return string |
|
||||||
*/ |
|
||||||
public function getEntityIdentifier() |
|
||||||
{ |
|
||||||
return 'GenjFaqBundle:Question:'.$this->getId(); |
|
||||||
} |
|
||||||
|
|
||||||
/** |
|
||||||
* @return bool |
|
||||||
*/ |
|
||||||
public function isOnlyAuthUsers() |
|
||||||
{ |
|
||||||
return $this->onlyAuthUsers; |
|
||||||
} |
|
||||||
|
|
||||||
/** |
|
||||||
* @param bool $onlyAuthUsers |
|
||||||
* |
|
||||||
* @return Question |
|
||||||
*/ |
|
||||||
public function setOnlyAuthUsers($onlyAuthUsers) |
|
||||||
{ |
|
||||||
$this->onlyAuthUsers = $onlyAuthUsers; |
|
||||||
|
|
||||||
return $this; |
|
||||||
} |
|
||||||
|
|
||||||
/** |
|
||||||
* Set is_active. |
|
||||||
* |
|
||||||
* @param bool $isActive |
|
||||||
* |
|
||||||
* @return Question |
|
||||||
*/ |
|
||||||
public function setIsActive($isActive) |
|
||||||
{ |
|
||||||
$this->isActive = $isActive; |
|
||||||
|
|
||||||
return $this; |
|
||||||
} |
|
||||||
|
|
||||||
/** |
|
||||||
* Get isActive. |
|
||||||
* |
|
||||||
* @return bool |
|
||||||
*/ |
|
||||||
public function getIsActive() |
|
||||||
{ |
|
||||||
return $this->isActive; |
|
||||||
} |
|
||||||
} |
|
||||||
@ -1,131 +0,0 @@ |
|||||||
<?php |
|
||||||
|
|
||||||
/* For licensing terms, see /license.txt */ |
|
||||||
|
|
||||||
namespace Chamilo\FaqBundle\Entity; |
|
||||||
|
|
||||||
use Doctrine\ORM\Mapping as ORM; |
|
||||||
use Gedmo\Mapping\Annotation as Gedmo; |
|
||||||
use Knp\DoctrineBehaviors\Contract\Entity\TranslationInterface; |
|
||||||
use Knp\DoctrineBehaviors\Model\Translatable\TranslationTrait; |
|
||||||
|
|
||||||
/** |
|
||||||
* Class CategoryTranslation. |
|
||||||
* |
|
||||||
* @ORM\Entity |
|
||||||
* @ORM\Table( |
|
||||||
* name="faq_question_translation", |
|
||||||
* options={"row_format":"DYNAMIC"} |
|
||||||
* ) |
|
||||||
* |
|
||||||
* @ORM\AttributeOverrides({ |
|
||||||
* @ORM\AttributeOverride(name="locale", |
|
||||||
* column=@ORM\Column( |
|
||||||
* name="locale", |
|
||||||
* type="string", |
|
||||||
* length=190 |
|
||||||
* ) |
|
||||||
* ) |
|
||||||
* }) |
|
||||||
*/ |
|
||||||
class QuestionTranslation implements TranslationInterface |
|
||||||
{ |
|
||||||
use TranslationTrait; |
|
||||||
|
|
||||||
/** |
|
||||||
* @ORM\Column(name="id", type="integer") |
|
||||||
* @ORM\Id |
|
||||||
* @ORM\GeneratedValue(strategy="AUTO") |
|
||||||
*/ |
|
||||||
protected $id; |
|
||||||
|
|
||||||
/** |
|
||||||
* @ORM\Column(type="string", length=255, nullable=false) |
|
||||||
*/ |
|
||||||
protected $headline; |
|
||||||
|
|
||||||
/** |
|
||||||
* @ORM\Column(type="text", nullable=true) |
|
||||||
*/ |
|
||||||
protected $body; |
|
||||||
|
|
||||||
/** |
|
||||||
* @Gedmo\Slug(fields={"headline"}, updatable=false) |
|
||||||
* @ORM\Column(type="string", length=50, nullable=false) |
|
||||||
*/ |
|
||||||
protected $slug; |
|
||||||
|
|
||||||
/** |
|
||||||
* @var string |
|
||||||
* @ORM\Column(type="string", length=190, nullable=false) |
|
||||||
*/ |
|
||||||
protected $locale; |
|
||||||
|
|
||||||
/** |
|
||||||
* @return string |
|
||||||
*/ |
|
||||||
public function __toString() |
|
||||||
{ |
|
||||||
return (string) $this->headline; |
|
||||||
} |
|
||||||
|
|
||||||
/** |
|
||||||
* @return string |
|
||||||
*/ |
|
||||||
public function getHeadline() |
|
||||||
{ |
|
||||||
return $this->headline; |
|
||||||
} |
|
||||||
|
|
||||||
/** |
|
||||||
* @param string $headline |
|
||||||
* |
|
||||||
* @return QuestionTranslation |
|
||||||
*/ |
|
||||||
public function setHeadline($headline) |
|
||||||
{ |
|
||||||
$this->headline = $headline; |
|
||||||
|
|
||||||
return $this; |
|
||||||
} |
|
||||||
|
|
||||||
/** |
|
||||||
* @return string |
|
||||||
*/ |
|
||||||
public function getBody() |
|
||||||
{ |
|
||||||
return $this->body; |
|
||||||
} |
|
||||||
|
|
||||||
/** |
|
||||||
* @param string $body |
|
||||||
* |
|
||||||
* @return QuestionTranslation |
|
||||||
*/ |
|
||||||
public function setBody($body) |
|
||||||
{ |
|
||||||
$this->body = $body; |
|
||||||
|
|
||||||
return $this; |
|
||||||
} |
|
||||||
|
|
||||||
/** |
|
||||||
* @return string |
|
||||||
*/ |
|
||||||
public function getSlug() |
|
||||||
{ |
|
||||||
return $this->slug; |
|
||||||
} |
|
||||||
|
|
||||||
/** |
|
||||||
* @param string $slug |
|
||||||
* |
|
||||||
* @return QuestionTranslation |
|
||||||
*/ |
|
||||||
public function setSlug($slug) |
|
||||||
{ |
|
||||||
$this->slug = $slug; |
|
||||||
|
|
||||||
return $this; |
|
||||||
} |
|
||||||
} |
|
||||||
@ -1,76 +0,0 @@ |
|||||||
<?php |
|
||||||
|
|
||||||
/* For licensing terms, see /license.txt */ |
|
||||||
|
|
||||||
namespace Chamilo\FaqBundle\Repository; |
|
||||||
|
|
||||||
use Chamilo\FaqBundle\Entity\Category; |
|
||||||
use Doctrine\ORM\EntityRepository; |
|
||||||
|
|
||||||
/** |
|
||||||
* Class CategoryRepository. |
|
||||||
*/ |
|
||||||
class CategoryRepository extends EntityRepository |
|
||||||
{ |
|
||||||
public function retrieveActive() |
|
||||||
{ |
|
||||||
$query = $this->createQueryBuilder('c') |
|
||||||
->where('c.isActive = :isActive') |
|
||||||
->orderBy('c.rank', 'ASC') |
|
||||||
->getQuery(); |
|
||||||
|
|
||||||
$query->setParameter('isActive', true); |
|
||||||
|
|
||||||
return $query->execute(); |
|
||||||
} |
|
||||||
|
|
||||||
/** |
|
||||||
* @param string $slug |
|
||||||
*/ |
|
||||||
public function retrieveActiveBySlug($slug) |
|
||||||
{ |
|
||||||
$query = $this->createQueryBuilder('c') |
|
||||||
->where('c.isActive = :isActive') |
|
||||||
->andWhere('c.slug = :slug') |
|
||||||
->orderBy('c.rank', 'ASC') |
|
||||||
->getQuery(); |
|
||||||
|
|
||||||
$query->setParameter('isActive', true); |
|
||||||
$query->setParameter('slug', $slug); |
|
||||||
|
|
||||||
return $query->execute(); |
|
||||||
} |
|
||||||
|
|
||||||
/** |
|
||||||
* @param string $slug |
|
||||||
*/ |
|
||||||
public function getCategoryActiveBySlug($slug) |
|
||||||
{ |
|
||||||
$query = $this->createQueryBuilder('c') |
|
||||||
->join('c.translations', 't') |
|
||||||
->where('c.isActive = :isActive') |
|
||||||
->andWhere('t.slug = :slug') |
|
||||||
->getQuery(); |
|
||||||
|
|
||||||
$query->setParameter('isActive', true); |
|
||||||
$query->setParameter('slug', $slug); |
|
||||||
|
|
||||||
return $query->getOneOrNullResult(); |
|
||||||
} |
|
||||||
|
|
||||||
/** |
|
||||||
* @return Category|null |
|
||||||
*/ |
|
||||||
public function retrieveFirst() |
|
||||||
{ |
|
||||||
$query = $this->createQueryBuilder('c') |
|
||||||
->where('c.isActive = :isActive') |
|
||||||
->orderBy('c.rank', 'ASC') |
|
||||||
->setMaxResults(1) |
|
||||||
->getQuery(); |
|
||||||
|
|
||||||
$query->setParameter('isActive', true); |
|
||||||
|
|
||||||
return $query->getOneOrNullResult(); |
|
||||||
} |
|
||||||
} |
|
||||||
@ -1,53 +0,0 @@ |
|||||||
<?php |
|
||||||
|
|
||||||
/* For licensing terms, see /license.txt */ |
|
||||||
|
|
||||||
namespace Chamilo\FaqBundle\Repository; |
|
||||||
|
|
||||||
use Chamilo\FaqBundle\Entity\Question; |
|
||||||
use Doctrine\ORM\EntityRepository; |
|
||||||
|
|
||||||
/** |
|
||||||
* Class QuestionRepository. |
|
||||||
*/ |
|
||||||
class QuestionRepository extends EntityRepository |
|
||||||
{ |
|
||||||
/** |
|
||||||
* @param string $categorySlug |
|
||||||
* |
|
||||||
* @return Question|null |
|
||||||
*/ |
|
||||||
public function retrieveFirstByCategorySlug($categorySlug) |
|
||||||
{ |
|
||||||
$query = $this->createQueryBuilder('q') |
|
||||||
->join('q.category', 'c') |
|
||||||
->join('c.translations', 't') |
|
||||||
->where('t.slug = :categorySlug') |
|
||||||
->orderBy('q.rank', 'ASC') |
|
||||||
->setMaxResults(1) |
|
||||||
->getQuery(); |
|
||||||
|
|
||||||
$query->setParameter('categorySlug', $categorySlug); |
|
||||||
|
|
||||||
return $query->getOneOrNullResult(); |
|
||||||
} |
|
||||||
|
|
||||||
/** |
|
||||||
* @param string $slug |
|
||||||
* |
|
||||||
* @return Question|null |
|
||||||
*/ |
|
||||||
public function getQuestionBySlug($slug) |
|
||||||
{ |
|
||||||
$query = $this->createQueryBuilder('q') |
|
||||||
->join('q.translations', 't') |
|
||||||
->where('t.slug = :slug') |
|
||||||
->orderBy('q.rank', 'ASC') |
|
||||||
->setMaxResults(1) |
|
||||||
->getQuery(); |
|
||||||
|
|
||||||
$query->setParameter('slug', $slug); |
|
||||||
|
|
||||||
return $query->getOneOrNullResult(); |
|
||||||
} |
|
||||||
} |
|
||||||
@ -1,18 +0,0 @@ |
|||||||
services: |
|
||||||
sonata.admin.faq_question: |
|
||||||
class: Chamilo\FaqBundle\Admin\QuestionAdmin |
|
||||||
tags: |
|
||||||
- {name: sonata.admin, manager_type: orm, group: "Content", label: "Question"} |
|
||||||
arguments: |
|
||||||
- ~ |
|
||||||
- Chamilo\FaqBundle\Entity\Question |
|
||||||
- ~ |
|
||||||
|
|
||||||
sonata.admin.faq_category: |
|
||||||
class: Chamilo\FaqBundle\Admin\CategoryAdmin |
|
||||||
tags: |
|
||||||
- {name: sonata.admin, manager_type: orm, group: "Content", label: "Category"} |
|
||||||
arguments: |
|
||||||
- ~ |
|
||||||
- Chamilo\FaqBundle\Entity\Category |
|
||||||
- ~ |
|
||||||
@ -1,12 +0,0 @@ |
|||||||
faq_index: |
|
||||||
path: /faq |
|
||||||
defaults: {_controller: 'Chamilo\FaqBundle\Controller\FaqController::indexAction', categorySlug: null, questionSlug: null} |
|
||||||
|
|
||||||
faq: |
|
||||||
path: /faq/{categorySlug}/{questionSlug} |
|
||||||
defaults: {_controller: 'Chamilo\FaqBundle\Controller\FaqController::indexAction', categorySlug: null, questionSlug: null} |
|
||||||
|
|
||||||
# Shows the entire FAQ at once, without collapsing any categories or questions. Useful if your FAQ is not that big. |
|
||||||
faq_without_collapse: |
|
||||||
path: /faq-without-collapse/{categorySlug} |
|
||||||
defaults: {_controller: 'Chamilo\FaqBundle\Controller\FaqController::indexWithoutCollapseAction', categorySlug: null} |
|
||||||
@ -1,3 +0,0 @@ |
|||||||
services: |
|
||||||
_defaults: |
|
||||||
autowire: true |
|
||||||
@ -1,80 +0,0 @@ |
|||||||
{% extends '@ChamiloTheme/Layout/layout_cms.html.twig' %} |
|
||||||
|
|
||||||
{% block sonata_page_container %} |
|
||||||
<script> |
|
||||||
function backToTopGo() { |
|
||||||
window.scroll(0, 0); |
|
||||||
backToTopScroll(); |
|
||||||
} |
|
||||||
|
|
||||||
$(function () { |
|
||||||
var positionCurrent, positionNew = 0; |
|
||||||
$(window).scroll(function () { |
|
||||||
positionNew = $(this).scrollTop(); |
|
||||||
if (positionNew > positionCurrent) { |
|
||||||
$('#barra').show('slow'); |
|
||||||
} else if (positionNew < positionCurrent) { |
|
||||||
$('#barra').hide('slow'); |
|
||||||
} |
|
||||||
positionCurrent = positionNew; |
|
||||||
}); |
|
||||||
}); |
|
||||||
</script> |
|
||||||
|
|
||||||
<a id="barra" class="btn btn-primary back_to_top_wrap" onclick="backToTopGo()"> |
|
||||||
<div class="back_to_top"> |
|
||||||
<i class="fa fa-arrow-up" aria-hidden="true"></i> Go up |
|
||||||
</div> |
|
||||||
</a> |
|
||||||
|
|
||||||
<div class="page-faq"> |
|
||||||
<h1 class="title">FAQ</h1> |
|
||||||
<div class="list-faq"> |
|
||||||
<ul> |
|
||||||
{% for category in categories %} |
|
||||||
<li class="active"> |
|
||||||
<h3 class="list-title">{{ category.getHeadline|e }}</h3> |
|
||||||
</li> |
|
||||||
<ul class="list-items-faq"> |
|
||||||
{% set list = [false] %} |
|
||||||
{% if is_granted('IS_AUTHENTICATED_FULLY') %} |
|
||||||
{% set list = [false, true] %} |
|
||||||
{% endif %} |
|
||||||
|
|
||||||
{% for question in category.questions if question.onlyAuthUsers in list %} |
|
||||||
{% if question.isActive %} |
|
||||||
<li> |
|
||||||
<a href="#{{ question.id }}"><i class="fa fa-file-text-o" aria-hidden="true"></i> |
|
||||||
{{ question.getHeadline|e }} |
|
||||||
</a> |
|
||||||
</li> |
|
||||||
{% endif %} |
|
||||||
{% endfor %} |
|
||||||
</ul> |
|
||||||
{% endfor %} |
|
||||||
</ul> |
|
||||||
</div> |
|
||||||
<div class="block-faq"> |
|
||||||
{% for category in categories %} |
|
||||||
{% set list = [false] %} |
|
||||||
{% if is_granted('IS_AUTHENTICATED_FULLY') %} |
|
||||||
{% set list = [false, true] %} |
|
||||||
<h2 class="title"><i class="fa fa-question-circle" aria-hidden="true"></i> {{ category.getHeadline|e }}</h2> |
|
||||||
{% endif %} |
|
||||||
|
|
||||||
{% for question in category.questions if question.onlyAuthUsers in list %} |
|
||||||
{% if question.isActive %} |
|
||||||
<div class="panel panel-default"> |
|
||||||
<div class="panel-heading"> |
|
||||||
{{ question.getHeadline|e }} <a name="{{ question.id }}" id="{{ question.id }}"></a> |
|
||||||
</div> |
|
||||||
<div class="panel-body"> |
|
||||||
<p>{{ question.getBody }}</p> |
|
||||||
</div> |
|
||||||
</div> |
|
||||||
{% endif %} |
|
||||||
{% endfor %} |
|
||||||
{% endfor %} |
|
||||||
</div> |
|
||||||
</div> |
|
||||||
{% endblock %} |
|
||||||
@ -1,10 +0,0 @@ |
|||||||
<h1>FAQ</h1> |
|
||||||
|
|
||||||
{% for category in categories %} |
|
||||||
<h2>{{ category.headline|e }}</h2> |
|
||||||
{% for question in category.questions %} |
|
||||||
{{ question.isAuth |var_dump }} |
|
||||||
<p><strong>{{ question.headline|e }}</strong></p> |
|
||||||
<p>{{ question.body }}</p> |
|
||||||
{% endfor %} |
|
||||||
{% endfor %} |
|
||||||
@ -1,9 +0,0 @@ |
|||||||
<a target = "_blank" |
|
||||||
href="{{ url('faq', {'categorySlug': object.getSlug}) }}" |
|
||||||
class="btn btn-sm btn-default" |
|
||||||
title="{{ 'Preview'|trans({}, 'SonataAdminBundle') }}" |
|
||||||
> |
|
||||||
<i class="fa fa-external-link"></i> |
|
||||||
{{ 'Preview'|trans({}, 'SonataAdminBundle') }} |
|
||||||
</a> |
|
||||||
|
|
||||||
@ -1,11 +0,0 @@ |
|||||||
{% if object.category %} |
|
||||||
<a target = "_blank" |
|
||||||
href="{{ url('faq', {'categorySlug': object.category.getSlug, 'questionSlug' : object.getSlug }) }}" |
|
||||||
class="btn btn-sm btn-default" |
|
||||||
title="{{ 'Preview'|trans({}, 'SonataAdminBundle') }}" |
|
||||||
> |
|
||||||
<i class="fa fa-external-link"></i> |
|
||||||
{{ 'Preview'|trans({}, 'SonataAdminBundle') }} |
|
||||||
</a> |
|
||||||
{% endif %} |
|
||||||
|
|
||||||
@ -1,19 +0,0 @@ |
|||||||
<?php |
|
||||||
|
|
||||||
/* For licensing terms, see /license.txt */ |
|
||||||
|
|
||||||
namespace Chamilo\MediaBundle; |
|
||||||
|
|
||||||
use Symfony\Component\HttpKernel\Bundle\Bundle; |
|
||||||
|
|
||||||
/** |
|
||||||
* This file has been generated by the EasyExtends bundle ( http://sonata-project.org/easy-extends ). |
|
||||||
* |
|
||||||
* References : |
|
||||||
* bundles : http://symfony.com/doc/current/book/bundles.html |
|
||||||
* |
|
||||||
* @author <yourname> <youremail> |
|
||||||
*/ |
|
||||||
class ChamiloMediaBundle extends Bundle |
|
||||||
{ |
|
||||||
} |
|
||||||
@ -1,35 +0,0 @@ |
|||||||
<?php |
|
||||||
|
|
||||||
/* For licensing terms, see /license.txt */ |
|
||||||
|
|
||||||
namespace Chamilo\MediaBundle\Entity; |
|
||||||
|
|
||||||
use Sonata\MediaBundle\Entity\BaseGallery; |
|
||||||
use Sonata\MediaBundle\Model\GalleryHasMediaInterface; |
|
||||||
|
|
||||||
/** |
|
||||||
* Class Gallery. |
|
||||||
*/ |
|
||||||
class Gallery extends BaseGallery |
|
||||||
{ |
|
||||||
/** |
|
||||||
* @var int |
|
||||||
*/ |
|
||||||
protected $id; |
|
||||||
|
|
||||||
/** |
|
||||||
* Get id. |
|
||||||
*/ |
|
||||||
public function getId(): int |
|
||||||
{ |
|
||||||
return $this->id; |
|
||||||
} |
|
||||||
|
|
||||||
public function addGalleryHasMedia(GalleryHasMediaInterface $galleryHasMedia) |
|
||||||
{ |
|
||||||
} |
|
||||||
|
|
||||||
public function removeGalleryHasMedia(GalleryHasMediaInterface $galleryHasMedia) |
|
||||||
{ |
|
||||||
} |
|
||||||
} |
|
||||||
@ -1,28 +0,0 @@ |
|||||||
<?php |
|
||||||
|
|
||||||
/* For licensing terms, see /license.txt */ |
|
||||||
|
|
||||||
namespace Chamilo\MediaBundle\Entity; |
|
||||||
|
|
||||||
use Sonata\MediaBundle\Entity\BaseGalleryHasMedia as BaseGalleryHasMedia; |
|
||||||
|
|
||||||
/** |
|
||||||
* Class GalleryHasMedia. |
|
||||||
*/ |
|
||||||
class GalleryHasMedia extends BaseGalleryHasMedia |
|
||||||
{ |
|
||||||
/** |
|
||||||
* @var int |
|
||||||
*/ |
|
||||||
protected $id; |
|
||||||
|
|
||||||
/** |
|
||||||
* Get id. |
|
||||||
* |
|
||||||
* @return int |
|
||||||
*/ |
|
||||||
public function getId() |
|
||||||
{ |
|
||||||
return $this->id; |
|
||||||
} |
|
||||||
} |
|
||||||
@ -1,30 +0,0 @@ |
|||||||
<?php |
|
||||||
|
|
||||||
///* For licensing terms, see /license.txt */ |
|
||||||
// |
|
||||||
//namespace Chamilo\MediaBundle\Entity; |
|
||||||
// |
|
||||||
//use Sonata\MediaBundle\Entity\BaseGalleryItem; |
|
||||||
// |
|
||||||
///** |
|
||||||
// * Class GalleryItem. |
|
||||||
// * |
|
||||||
// * @package Chamilo\MediaBundle\Entity |
|
||||||
// */ |
|
||||||
//class GalleryItem extends BaseGalleryItem |
|
||||||
//{ |
|
||||||
// /** |
|
||||||
// * @var int |
|
||||||
// */ |
|
||||||
// protected $id; |
|
||||||
// |
|
||||||
// /** |
|
||||||
// * Get id. |
|
||||||
// * |
|
||||||
// * @return int $id |
|
||||||
// */ |
|
||||||
// public function getId() |
|
||||||
// { |
|
||||||
// return $this->id; |
|
||||||
// } |
|
||||||
//} |
|
||||||
@ -1,28 +0,0 @@ |
|||||||
<?php |
|
||||||
|
|
||||||
/* For licensing terms, see /license.txt */ |
|
||||||
|
|
||||||
namespace Chamilo\MediaBundle\Entity; |
|
||||||
|
|
||||||
use Sonata\MediaBundle\Entity\BaseMedia; |
|
||||||
|
|
||||||
/** |
|
||||||
* Class Media. |
|
||||||
*/ |
|
||||||
class Media extends BaseMedia |
|
||||||
{ |
|
||||||
/** |
|
||||||
* @var int |
|
||||||
*/ |
|
||||||
protected $id; |
|
||||||
|
|
||||||
/** |
|
||||||
* Get id. |
|
||||||
* |
|
||||||
* @return int |
|
||||||
*/ |
|
||||||
public function getId() |
|
||||||
{ |
|
||||||
return $this->id; |
|
||||||
} |
|
||||||
} |
|
||||||
@ -1,24 +0,0 @@ |
|||||||
<?xml version="1.0" encoding="utf-8"?> |
|
||||||
<doctrine-mapping |
|
||||||
xmlns="http://doctrine-project.org/schemas/orm/doctrine-mapping" |
|
||||||
xsi="http://www.w3.org/2001/XMLSchema-instance" |
|
||||||
schemaLocation="http://doctrine-project.org/schemas/orm/doctrine-mapping http://doctrine-project.org/schemas/orm/doctrine-mapping.xsd"> |
|
||||||
<!-- |
|
||||||
This file has been generated by the EasyExtends bundle ( http://sonata-project.org/easy-extends ) |
|
||||||
|
|
||||||
References : |
|
||||||
xsd : https://github.com/doctrine/doctrine2/blob/master/doctrine-mapping.xsd |
|
||||||
xml mapping : http://www.doctrine-project.org/projects/orm/2.0/docs/reference/xml-mapping/en |
|
||||||
association mapping : http://www.doctrine-project.org/projects/orm/2.0/docs/reference/association-mapping/en |
|
||||||
--> |
|
||||||
<entity |
|
||||||
name="Chamilo\MediaBundle\Entity\Gallery" |
|
||||||
table="media__gallery" |
|
||||||
> |
|
||||||
|
|
||||||
<id name="id" type="integer" column="id"> |
|
||||||
<generator strategy="AUTO"/> |
|
||||||
</id> |
|
||||||
|
|
||||||
</entity> |
|
||||||
</doctrine-mapping> |
|
||||||
@ -1,24 +0,0 @@ |
|||||||
<?xml version="1.0" encoding="utf-8"?> |
|
||||||
<doctrine-mapping |
|
||||||
xmlns="http://doctrine-project.org/schemas/orm/doctrine-mapping" |
|
||||||
xsi="http://www.w3.org/2001/XMLSchema-instance" |
|
||||||
schemaLocation="http://doctrine-project.org/schemas/orm/doctrine-mapping http://doctrine-project.org/schemas/orm/doctrine-mapping.xsd"> |
|
||||||
<!-- |
|
||||||
This file has been generated by the EasyExtends bundle ( http://sonata-project.org/easy-extends ) |
|
||||||
|
|
||||||
References : |
|
||||||
xsd : https://github.com/doctrine/doctrine2/blob/master/doctrine-mapping.xsd |
|
||||||
xml mapping : http://www.doctrine-project.org/projects/orm/2.0/docs/reference/xml-mapping/en |
|
||||||
association mapping : http://www.doctrine-project.org/projects/orm/2.0/docs/reference/association-mapping/en |
|
||||||
--> |
|
||||||
<entity |
|
||||||
name="Chamilo\MediaBundle\Entity\GalleryHasMedia" |
|
||||||
table="media__gallery_media" |
|
||||||
> |
|
||||||
|
|
||||||
<id name="id" type="integer" column="id"> |
|
||||||
<generator strategy="AUTO"/> |
|
||||||
</id> |
|
||||||
|
|
||||||
</entity> |
|
||||||
</doctrine-mapping> |
|
||||||
@ -1,24 +0,0 @@ |
|||||||
<?xml version="1.0" encoding="utf-8"?> |
|
||||||
<doctrine-mapping |
|
||||||
xmlns="http://doctrine-project.org/schemas/orm/doctrine-mapping" |
|
||||||
xsi="http://www.w3.org/2001/XMLSchema-instance" |
|
||||||
schemaLocation="http://doctrine-project.org/schemas/orm/doctrine-mapping http://doctrine-project.org/schemas/orm/doctrine-mapping.xsd"> |
|
||||||
<!-- |
|
||||||
This file has been generated by the EasyExtends bundle ( http://sonata-project.org/easy-extends ) |
|
||||||
|
|
||||||
References : |
|
||||||
xsd : https://github.com/doctrine/doctrine2/blob/master/doctrine-mapping.xsd |
|
||||||
xml mapping : http://www.doctrine-project.org/projects/orm/2.0/docs/reference/xml-mapping/en |
|
||||||
association mapping : http://www.doctrine-project.org/projects/orm/2.0/docs/reference/association-mapping/en |
|
||||||
--> |
|
||||||
<entity |
|
||||||
name="Chamilo\MediaBundle\Entity\Media" |
|
||||||
table="media__media" |
|
||||||
> |
|
||||||
|
|
||||||
<id name="id" type="integer" column="id"> |
|
||||||
<generator strategy="AUTO"/> |
|
||||||
</id> |
|
||||||
|
|
||||||
</entity> |
|
||||||
</doctrine-mapping> |
|
||||||
@ -1,17 +0,0 @@ |
|||||||
<?xml version="1.0" encoding="UTF-8"?> |
|
||||||
<serializer> |
|
||||||
<!-- |
|
||||||
This file has been generated by the EasyExtends bundle ( http://sonata-project.org/bundles/easy-extends ) |
|
||||||
|
|
||||||
@author <yourname> <youremail> |
|
||||||
--> |
|
||||||
|
|
||||||
<class name="Chamilo\MediaBundle\Entity\Gallery" exclusion-policy="all" |
|
||||||
xml-root-name="_gallery"> |
|
||||||
|
|
||||||
<property xml-attribute-map="true" name="id" type="integer" |
|
||||||
expose="true" since-version="1.0" |
|
||||||
groups="sonata_api_read,sonata_api_write,sonata_search"/> |
|
||||||
|
|
||||||
</class> |
|
||||||
</serializer> |
|
||||||
@ -1,17 +0,0 @@ |
|||||||
<!--<?xml version="1.0" encoding="UTF-8"?>--> |
|
||||||
<!--<serializer>--> |
|
||||||
<!--<!–--> |
|
||||||
<!--This file has been generated by the EasyExtends bundle ( http://sonata-project.org/bundles/easy-extends )--> |
|
||||||
|
|
||||||
<!--@author <yourname> <youremail>--> |
|
||||||
<!--–>--> |
|
||||||
|
|
||||||
<!--<class name="Chamilo\MediaBundle\Entity\GalleryItem"--> |
|
||||||
<!--exclusion-policy="all" xml-root-name="_gallery_has_media">--> |
|
||||||
|
|
||||||
<!--<property xml-attribute-map="true" name="id" type="integer"--> |
|
||||||
<!--expose="true" since-version="1.0"--> |
|
||||||
<!--groups="sonata_api_read,sonata_api_write,sonata_search"/>--> |
|
||||||
|
|
||||||
<!--</class>--> |
|
||||||
<!--</serializer>--> |
|
||||||
@ -1,17 +0,0 @@ |
|||||||
<?xml version="1.0" encoding="UTF-8"?> |
|
||||||
<serializer> |
|
||||||
<!-- |
|
||||||
This file has been generated by the EasyExtends bundle ( http://sonata-project.org/bundles/easy-extends ) |
|
||||||
|
|
||||||
@author <yourname> <youremail> |
|
||||||
--> |
|
||||||
|
|
||||||
<class name="Chamilo\MediaBundle\Entity\Media" exclusion-policy="all" |
|
||||||
xml-root-name="_media"> |
|
||||||
|
|
||||||
<property xml-attribute-map="true" name="id" type="integer" |
|
||||||
expose="true" since-version="1.0" |
|
||||||
groups="sonata_api_read,sonata_api_write,sonata_search"/> |
|
||||||
|
|
||||||
</class> |
|
||||||
</serializer> |
|
||||||
@ -1,62 +0,0 @@ |
|||||||
{% 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 %} |
|
||||||
@ -1,14 +0,0 @@ |
|||||||
<?php |
|
||||||
|
|
||||||
/* For licensing terms, see /license.txt */ |
|
||||||
|
|
||||||
namespace Chamilo\NotificationBundle; |
|
||||||
|
|
||||||
use Symfony\Component\HttpKernel\Bundle\Bundle; |
|
||||||
|
|
||||||
/** |
|
||||||
* Bundle needed for sonata pages (CMS). |
|
||||||
*/ |
|
||||||
class ChamiloNotificationBundle extends Bundle |
|
||||||
{ |
|
||||||
} |
|
||||||
@ -1,28 +0,0 @@ |
|||||||
<?php |
|
||||||
|
|
||||||
/* For licensing terms, see /license.txt */ |
|
||||||
|
|
||||||
namespace Chamilo\NotificationBundle\Entity; |
|
||||||
|
|
||||||
use Sonata\NotificationBundle\Entity\BaseMessage; |
|
||||||
|
|
||||||
/** |
|
||||||
* Class Message. |
|
||||||
*/ |
|
||||||
class Message extends BaseMessage |
|
||||||
{ |
|
||||||
/** |
|
||||||
* @var int |
|
||||||
*/ |
|
||||||
protected $id; |
|
||||||
|
|
||||||
/** |
|
||||||
* Get id. |
|
||||||
* |
|
||||||
* @return int |
|
||||||
*/ |
|
||||||
public function getId() |
|
||||||
{ |
|
||||||
return $this->id; |
|
||||||
} |
|
||||||
} |
|
||||||
@ -1,24 +0,0 @@ |
|||||||
<?xml version="1.0" encoding="utf-8"?> |
|
||||||
<doctrine-mapping |
|
||||||
xmlns="http://doctrine-project.org/schemas/orm/doctrine-mapping" |
|
||||||
xsi="http://www.w3.org/2001/XMLSchema-instance" |
|
||||||
schemaLocation="http://doctrine-project.org/schemas/orm/doctrine-mapping http://doctrine-project.org/schemas/orm/doctrine-mapping.xsd"> |
|
||||||
<!-- |
|
||||||
This file has been generated by the EasyExtends bundle ( http://sonata-project.org/easy-extends ) |
|
||||||
|
|
||||||
References : |
|
||||||
xsd : https://github.com/doctrine/doctrine2/blob/master/doctrine-mapping.xsd |
|
||||||
xml mapping : http://www.doctrine-project.org/projects/orm/2.0/docs/reference/xml-mapping/en |
|
||||||
association mapping : http://www.doctrine-project.org/projects/orm/2.0/docs/reference/association-mapping/en |
|
||||||
--> |
|
||||||
<entity |
|
||||||
name="Chamilo\NotificationBundle\Entity\Message" |
|
||||||
table="notification__message" |
|
||||||
repository-class="Doctrine\ORM\EntityRepository"> |
|
||||||
|
|
||||||
<id name="id" type="integer" column="id"> |
|
||||||
<generator strategy="AUTO"/> |
|
||||||
</id> |
|
||||||
|
|
||||||
</entity> |
|
||||||
</doctrine-mapping> |
|
||||||
@ -1,17 +0,0 @@ |
|||||||
<?xml version="1.0" encoding="UTF-8"?> |
|
||||||
<serializer> |
|
||||||
<!-- |
|
||||||
This file has been generated by the EasyExtends bundle ( http://sonata-project.org/bundles/easy-extends ) |
|
||||||
|
|
||||||
@author <yourname> <youremail> |
|
||||||
--> |
|
||||||
|
|
||||||
<class name="Chamilo\NotificationBundle\Entity\Message" |
|
||||||
exclusion-policy="all" xml-root-name="_message"> |
|
||||||
|
|
||||||
<property xml-attribute-map="true" name="id" type="integer" |
|
||||||
expose="true" since-version="1.0" |
|
||||||
groups="sonata_api_read,sonata_api_write,sonata_search"/> |
|
||||||
|
|
||||||
</class> |
|
||||||
</serializer> |
|
||||||
@ -1,14 +0,0 @@ |
|||||||
<?php |
|
||||||
|
|
||||||
/* For licensing terms, see /license.txt */ |
|
||||||
|
|
||||||
namespace Chamilo\PageBundle; |
|
||||||
|
|
||||||
use Symfony\Component\HttpKernel\Bundle\Bundle; |
|
||||||
|
|
||||||
/** |
|
||||||
* Class ChamiloPageBundle. |
|
||||||
*/ |
|
||||||
class ChamiloPageBundle extends Bundle |
|
||||||
{ |
|
||||||
} |
|
||||||
@ -1,352 +0,0 @@ |
|||||||
<?php |
|
||||||
|
|
||||||
/* For licensing terms, see /license.txt */ |
|
||||||
|
|
||||||
namespace Chamilo\PageBundle\Controller; |
|
||||||
|
|
||||||
use Chamilo\CoreBundle\Controller\BaseController; |
|
||||||
use Chamilo\CoreBundle\Traits\ControllerTrait; |
|
||||||
use Chamilo\PageBundle\Entity\Block; |
|
||||||
use Chamilo\PageBundle\Entity\Page; |
|
||||||
use Chamilo\PageBundle\Entity\Snapshot; |
|
||||||
use FOS\CKEditorBundle\Form\Type\CKEditorType; |
|
||||||
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Security; |
|
||||||
use Sonata\PageBundle\Entity\BlockInteractor; |
|
||||||
use Sonata\PageBundle\Entity\BlockManager; |
|
||||||
use Sonata\PageBundle\Entity\PageManager; |
|
||||||
use Sonata\PageBundle\Entity\SiteManager; |
|
||||||
use Sonata\PageBundle\Page\TemplateManager; |
|
||||||
use Symfony\Component\Form\Extension\Core\Type\SubmitType; |
|
||||||
use Symfony\Component\HttpFoundation\Request; |
|
||||||
use Symfony\Component\HttpFoundation\Response; |
|
||||||
use Symfony\Component\Routing\Annotation\Route; |
|
||||||
|
|
||||||
/** |
|
||||||
* Class PageController. |
|
||||||
*/ |
|
||||||
class PageController extends BaseController |
|
||||||
{ |
|
||||||
use ControllerTrait; |
|
||||||
|
|
||||||
/** |
|
||||||
* @Route("/cms/page/latest/{number}") |
|
||||||
* |
|
||||||
* @param int $number |
|
||||||
*/ |
|
||||||
public function getLatestPages($number, PageManager $pageManager): Response |
|
||||||
{ |
|
||||||
$site = $this->get('sonata.page.site.selector')->retrieve(); |
|
||||||
|
|
||||||
$criteria = ['enabled' => 1, 'site' => $site, 'decorate' => 1, 'routeName' => 'page_slug']; |
|
||||||
$order = ['createdAt' => 'desc']; |
|
||||||
// Get latest pages |
|
||||||
$pages = $pageManager->findBy($criteria, $order, $number); |
|
||||||
$pagesToShow = []; |
|
||||||
/** @var Page $page */ |
|
||||||
foreach ($pages as $page) { |
|
||||||
// Skip homepage |
|
||||||
if ('/' === $page->getUrl()) { |
|
||||||
continue; |
|
||||||
} |
|
||||||
$criteria = ['pageId' => $page]; |
|
||||||
/** @var Snapshot $snapshot */ |
|
||||||
// Check if page has a valid snapshot |
|
||||||
$snapshot = $this->get('sonata.page.manager.snapshot')->findEnableSnapshot($criteria); |
|
||||||
if ($snapshot) { |
|
||||||
$pagesToShow[] = $page; |
|
||||||
} |
|
||||||
} |
|
||||||
|
|
||||||
return $this->render( |
|
||||||
'@ChamiloPage/latest.html.twig', |
|
||||||
['pages' => $pagesToShow] |
|
||||||
); |
|
||||||
} |
|
||||||
|
|
||||||
/** |
|
||||||
* Creates a site if needed checking the host and locale. |
|
||||||
* Creates a first root page. |
|
||||||
* Creates a page if it doesn't exists. |
|
||||||
* Updates the page if page exists. |
|
||||||
* |
|
||||||
* @param string $pageSlug |
|
||||||
* @param bool $redirect |
|
||||||
* |
|
||||||
* @throws \Exception |
|
||||||
* |
|
||||||
* @return \Symfony\Component\HttpFoundation\RedirectResponse|Response |
|
||||||
*/ |
|
||||||
public function createPage( |
|
||||||
$pageSlug, |
|
||||||
$redirect, |
|
||||||
Request $request, |
|
||||||
SiteManager $siteManager, |
|
||||||
PageManager $pageManager, |
|
||||||
TemplateManager $templateManager, |
|
||||||
BlockInteractor $blockInteractor, |
|
||||||
BlockManager $blockManager |
|
||||||
) { |
|
||||||
$host = $request->getHost(); |
|
||||||
$locale = $request->get('_locale'); |
|
||||||
$criteria = [ |
|
||||||
'locale' => $locale, |
|
||||||
'host' => $host, |
|
||||||
]; |
|
||||||
|
|
||||||
$site = $siteManager->findOneBy($criteria); |
|
||||||
// If site doesn't exists or the site has a different locale from request, create new one. |
|
||||||
if (!$site || ($site && ($locale !== $site->getLocale()))) { |
|
||||||
// Create new site for this host and language |
|
||||||
$site = $siteManager->create(); |
|
||||||
$site->setHost($host); |
|
||||||
$site->setEnabled(true); |
|
||||||
$site->setName($host.' in language '.$locale); |
|
||||||
$site->setEnabledFrom(new \DateTime('now')); |
|
||||||
$site->setEnabledTo(new \DateTime('+20 years')); |
|
||||||
$site->setRelativePath(''); |
|
||||||
$site->setIsDefault(false); |
|
||||||
$site->setLocale($locale); |
|
||||||
$site = $siteManager->save($site); |
|
||||||
|
|
||||||
// Create first root page |
|
||||||
/** @var \Sonata\PageBundle\Model\Page $page */ |
|
||||||
$page = $pageManager->create(); |
|
||||||
$page->setSlug('homepage'); |
|
||||||
$page->setUrl('/'); |
|
||||||
$page->setName('homepage'); |
|
||||||
$page->setTitle('home'); |
|
||||||
$page->setEnabled(true); |
|
||||||
$page->setDecorate(1); |
|
||||||
$page->setRequestMethod('GET|POST|HEAD|DELETE|PUT'); |
|
||||||
$page->setTemplateCode('default'); |
|
||||||
$page->setRouteName('homepage'); |
|
||||||
//$page->setParent($this->getReference('page-homepage')); |
|
||||||
$page->setSite($site); |
|
||||||
$pageManager->save($page); |
|
||||||
} |
|
||||||
|
|
||||||
$em = $this->getDoctrine()->getManager(); |
|
||||||
$page = null; |
|
||||||
|
|
||||||
$form = $this->createFormBuilder() |
|
||||||
->add('content', CKEditorType::class) |
|
||||||
->add('save', SubmitType::class, ['label' => 'Update']) |
|
||||||
->getForm(); |
|
||||||
|
|
||||||
$blockToEdit = null; |
|
||||||
if ($site) { |
|
||||||
// Getting parent |
|
||||||
$criteria = ['site' => $site, 'enabled' => true, 'parent' => null]; |
|
||||||
/** @var Page $page */ |
|
||||||
$parent = $pageManager->findOneBy($criteria); |
|
||||||
|
|
||||||
// Check if a page exists for this site |
|
||||||
$criteria = ['site' => $site, 'enabled' => true, 'parent' => $parent, 'slug' => $pageSlug]; |
|
||||||
|
|
||||||
/** @var Page $page */ |
|
||||||
$page = $pageManager->findOneBy($criteria); |
|
||||||
if ($page) { |
|
||||||
$blocks = $page->getBlocks(); |
|
||||||
/** @var Block $block */ |
|
||||||
foreach ($blocks as $block) { |
|
||||||
if ('Main content' === $block->getName()) { |
|
||||||
$code = $block->getSetting('code'); |
|
||||||
if ('content' === $code) { |
|
||||||
$children = $block->getChildren(); |
|
||||||
/** @var Block $child */ |
|
||||||
foreach ($children as $child) { |
|
||||||
if ('sonata.formatter.block.formatter' === $child->getType()) { |
|
||||||
$blockToEdit = $child; |
|
||||||
|
|
||||||
break 2; |
|
||||||
} |
|
||||||
} |
|
||||||
} |
|
||||||
} |
|
||||||
} |
|
||||||
} else { |
|
||||||
$page = $pageManager->create(); |
|
||||||
$page->setSlug($pageSlug); |
|
||||||
$page->setUrl('/'.$pageSlug); |
|
||||||
$page->setName($pageSlug); |
|
||||||
$page->setTitle($pageSlug); |
|
||||||
$page->setEnabled(true); |
|
||||||
$page->setDecorate(1); |
|
||||||
$page->setRequestMethod('GET'); |
|
||||||
$page->setTemplateCode('default'); |
|
||||||
$page->setRouteName($pageSlug); |
|
||||||
$page->setParent($parent); |
|
||||||
$page->setSite($site); |
|
||||||
|
|
||||||
$pageManager->save($page); |
|
||||||
|
|
||||||
$template = $templateManager->get('default'); |
|
||||||
$templateContainers = $template->getContainers(); |
|
||||||
|
|
||||||
$containers = []; |
|
||||||
foreach ($templateContainers as $id => $area) { |
|
||||||
$containers[$id] = [ |
|
||||||
'area' => $area, |
|
||||||
'block' => false, |
|
||||||
]; |
|
||||||
} |
|
||||||
|
|
||||||
// Create blocks for this page |
|
||||||
$parentBlock = null; |
|
||||||
foreach ($containers as $id => $area) { |
|
||||||
if (false === $area['block'] && false === $templateContainers[$id]['shared']) { |
|
||||||
$block = $blockInteractor->createNewContainer( |
|
||||||
[ |
|
||||||
'page' => $page, |
|
||||||
'name' => $templateContainers[$id]['name'], |
|
||||||
'code' => $id, |
|
||||||
] |
|
||||||
); |
|
||||||
|
|
||||||
if ('content' === $id && 'Main content' === $templateContainers[$id]['name']) { |
|
||||||
$parentBlock = $block; |
|
||||||
} |
|
||||||
} |
|
||||||
} |
|
||||||
|
|
||||||
// Create block in main content |
|
||||||
$myBlock = $blockManager->create(); |
|
||||||
$myBlock->setType('sonata.formatter.block.formatter'); |
|
||||||
$myBlock->setSetting('format', 'richhtml'); |
|
||||||
$myBlock->setSetting('content', ''); |
|
||||||
$myBlock->setSetting('rawContent', ''); |
|
||||||
$myBlock->setSetting('template', '@SonataFormatter/Block/block_formatter.html.twig'); |
|
||||||
$myBlock->setParent($parentBlock); |
|
||||||
$page->addBlocks($myBlock); |
|
||||||
$pageManager->save($page); |
|
||||||
} |
|
||||||
} |
|
||||||
|
|
||||||
if ($blockToEdit) { |
|
||||||
$form->setData(['content' => $blockToEdit->getSetting('content')]); |
|
||||||
} |
|
||||||
|
|
||||||
$form->handleRequest($request); |
|
||||||
|
|
||||||
if ($form->isSubmitted() && $form->isValid() && $blockToEdit) { |
|
||||||
$data = $form->getData(); |
|
||||||
$content = $data['content']; |
|
||||||
/** @var Block $blockToEdit */ |
|
||||||
$blockToEdit->setSetting('rawContent', $content); |
|
||||||
$blockToEdit->setSetting('content', $content); |
|
||||||
$em->persist($blockToEdit); |
|
||||||
$em->flush(); |
|
||||||
$this->addFlash('success', $this->trans('Updated')); |
|
||||||
|
|
||||||
if (!empty($redirect)) { |
|
||||||
return $this->redirect($redirect); |
|
||||||
} |
|
||||||
|
|
||||||
return $this->redirectToRoute('home'); |
|
||||||
} |
|
||||||
|
|
||||||
return $this->render( |
|
||||||
'@ChamiloTheme/Index/page_edit.html.twig', |
|
||||||
[ |
|
||||||
'page' => $page, |
|
||||||
'form' => $form->createView(), |
|
||||||
'current_locale' => $locale, |
|
||||||
] |
|
||||||
); |
|
||||||
} |
|
||||||
|
|
||||||
/** |
|
||||||
* The Chamilo index home page. |
|
||||||
* |
|
||||||
* @Route("/internal_page/edit/{slug}", methods={"GET", "POST"}, name="edit_page") |
|
||||||
* |
|
||||||
* @Security("has_role('ROLE_ADMIN')") |
|
||||||
* |
|
||||||
* @param string $slug |
|
||||||
*/ |
|
||||||
public function editPageAction($slug, Request $request): Response |
|
||||||
{ |
|
||||||
$defaultLocale = $request->getLocale(); |
|
||||||
$localeFromGet = $request->get('_locale'); |
|
||||||
if (!empty($localeFromGet)) { |
|
||||||
$defaultLocale = $localeFromGet; |
|
||||||
} |
|
||||||
|
|
||||||
return $this->forward( |
|
||||||
'Chamilo\PageBundle\Controller\PageController:createPage', |
|
||||||
[ |
|
||||||
'pageSlug' => $slug, |
|
||||||
'redirect' => $this->generateUrl('edit_page', ['slug' => $slug, '_locale' => $defaultLocale]), |
|
||||||
'request' => $request, |
|
||||||
] |
|
||||||
); |
|
||||||
} |
|
||||||
|
|
||||||
/** |
|
||||||
* @Route("/internal_page/{slug}") |
|
||||||
* |
|
||||||
* @param bool $showEditPageLink |
|
||||||
* |
|
||||||
* @return Response |
|
||||||
*/ |
|
||||||
public function renderPageAction( |
|
||||||
string $slug, |
|
||||||
Request $request, |
|
||||||
$showEditPageLink = true, |
|
||||||
SiteManager $siteManager, |
|
||||||
PageManager $pageManager |
|
||||||
) { |
|
||||||
$host = $request->getHost(); |
|
||||||
$criteria = [ |
|
||||||
'locale' => $request->getLocale(), |
|
||||||
'host' => $host, |
|
||||||
]; |
|
||||||
$site = $siteManager->findOneBy($criteria); |
|
||||||
|
|
||||||
$page = null; |
|
||||||
$contentText = null; |
|
||||||
|
|
||||||
if ($site) { |
|
||||||
// Parents only of homepage |
|
||||||
$criteria = ['site' => $site, 'enabled' => true, 'slug' => $slug]; |
|
||||||
/** @var Page $page */ |
|
||||||
$page = $pageManager->findOneBy($criteria); |
|
||||||
$blocks = $page->getBlocks(); |
|
||||||
|
|
||||||
foreach ($blocks as $block) { |
|
||||||
if ('Main content' !== $block->getName()) { |
|
||||||
continue; |
|
||||||
} |
|
||||||
|
|
||||||
$code = $block->getSetting('code'); |
|
||||||
|
|
||||||
if ('content' !== $code) { |
|
||||||
continue; |
|
||||||
} |
|
||||||
|
|
||||||
$children = $block->getChildren(); |
|
||||||
|
|
||||||
/** @var Block $child */ |
|
||||||
foreach ($children as $child) { |
|
||||||
if ('sonata.formatter.block.formatter' !== $child->getType()) { |
|
||||||
continue; |
|
||||||
} |
|
||||||
|
|
||||||
$contentText = $child->getSetting('content'); |
|
||||||
|
|
||||||
break 2; |
|
||||||
} |
|
||||||
} |
|
||||||
} |
|
||||||
|
|
||||||
return $this->render( |
|
||||||
'@ChamiloTheme/Index/page.html.twig', |
|
||||||
[ |
|
||||||
'page' => $page, |
|
||||||
'slug' => $slug, |
|
||||||
'show_edit_page_link' => $showEditPageLink, |
|
||||||
'content' => $contentText, |
|
||||||
] |
|
||||||
); |
|
||||||
} |
|
||||||
} |
|
||||||
@ -1,28 +0,0 @@ |
|||||||
<?php |
|
||||||
|
|
||||||
/* For licensing terms, see /license.txt */ |
|
||||||
|
|
||||||
namespace Chamilo\PageBundle\Entity; |
|
||||||
|
|
||||||
use Sonata\PageBundle\Entity\BaseBlock; |
|
||||||
|
|
||||||
/** |
|
||||||
* Class Block. |
|
||||||
*/ |
|
||||||
class Block extends BaseBlock |
|
||||||
{ |
|
||||||
/** |
|
||||||
* @var int |
|
||||||
*/ |
|
||||||
protected $id; |
|
||||||
|
|
||||||
/** |
|
||||||
* Get id. |
|
||||||
* |
|
||||||
* @return int |
|
||||||
*/ |
|
||||||
public function getId() |
|
||||||
{ |
|
||||||
return $this->id; |
|
||||||
} |
|
||||||
} |
|
||||||
@ -1,28 +0,0 @@ |
|||||||
<?php |
|
||||||
|
|
||||||
/* For licensing terms, see /license.txt */ |
|
||||||
|
|
||||||
namespace Chamilo\PageBundle\Entity; |
|
||||||
|
|
||||||
use Sonata\PageBundle\Entity\BasePage; |
|
||||||
|
|
||||||
/** |
|
||||||
* Class Page. |
|
||||||
*/ |
|
||||||
class Page extends BasePage |
|
||||||
{ |
|
||||||
/** |
|
||||||
* @var int |
|
||||||
*/ |
|
||||||
protected $id; |
|
||||||
|
|
||||||
/** |
|
||||||
* Get id. |
|
||||||
* |
|
||||||
* @return int |
|
||||||
*/ |
|
||||||
public function getId() |
|
||||||
{ |
|
||||||
return $this->id; |
|
||||||
} |
|
||||||
} |
|
||||||
@ -1,28 +0,0 @@ |
|||||||
<?php |
|
||||||
|
|
||||||
/* For licensing terms, see /license.txt */ |
|
||||||
|
|
||||||
namespace Chamilo\PageBundle\Entity; |
|
||||||
|
|
||||||
use Sonata\PageBundle\Entity\BaseSite; |
|
||||||
|
|
||||||
/** |
|
||||||
* Class Site. |
|
||||||
*/ |
|
||||||
class Site extends BaseSite |
|
||||||
{ |
|
||||||
/** |
|
||||||
* @var int |
|
||||||
*/ |
|
||||||
protected $id; |
|
||||||
|
|
||||||
/** |
|
||||||
* Get id. |
|
||||||
* |
|
||||||
* @return int |
|
||||||
*/ |
|
||||||
public function getId() |
|
||||||
{ |
|
||||||
return $this->id; |
|
||||||
} |
|
||||||
} |
|
||||||
@ -1,28 +0,0 @@ |
|||||||
<?php |
|
||||||
|
|
||||||
/* For licensing terms, see /license.txt */ |
|
||||||
|
|
||||||
namespace Chamilo\PageBundle\Entity; |
|
||||||
|
|
||||||
use Sonata\PageBundle\Entity\BaseSnapshot; |
|
||||||
|
|
||||||
/** |
|
||||||
* Class Snapshot. |
|
||||||
*/ |
|
||||||
class Snapshot extends BaseSnapshot |
|
||||||
{ |
|
||||||
/** |
|
||||||
* @var int |
|
||||||
*/ |
|
||||||
protected $id; |
|
||||||
|
|
||||||
/** |
|
||||||
* Get id. |
|
||||||
* |
|
||||||
* @return int |
|
||||||
*/ |
|
||||||
public function getId() |
|
||||||
{ |
|
||||||
return $this->id; |
|
||||||
} |
|
||||||
} |
|
||||||
@ -1,24 +0,0 @@ |
|||||||
<?xml version="1.0" encoding="utf-8"?> |
|
||||||
<doctrine-mapping |
|
||||||
xmlns="http://doctrine-project.org/schemas/orm/doctrine-mapping" |
|
||||||
xsi="http://www.w3.org/2001/XMLSchema-instance" |
|
||||||
schemaLocation="http://doctrine-project.org/schemas/orm/doctrine-mapping http://doctrine-project.org/schemas/orm/doctrine-mapping.xsd"> |
|
||||||
<!-- |
|
||||||
This file has been generated by the EasyExtends bundle ( http://sonata-project.org/easy-extends ) |
|
||||||
|
|
||||||
References : |
|
||||||
xsd : https://github.com/doctrine/doctrine2/blob/master/doctrine-mapping.xsd |
|
||||||
xml mapping : http://www.doctrine-project.org/projects/orm/2.0/docs/reference/xml-mapping/en |
|
||||||
association mapping : http://www.doctrine-project.org/projects/orm/2.0/docs/reference/association-mapping/en |
|
||||||
--> |
|
||||||
<entity |
|
||||||
name="Chamilo\PageBundle\Entity\Block" |
|
||||||
table="page__bloc" |
|
||||||
repository-class="Doctrine\ORM\EntityRepository"> |
|
||||||
|
|
||||||
<id name="id" type="integer" column="id"> |
|
||||||
<generator strategy="AUTO"/> |
|
||||||
</id> |
|
||||||
|
|
||||||
</entity> |
|
||||||
</doctrine-mapping> |
|
||||||
@ -1,24 +0,0 @@ |
|||||||
<?xml version="1.0" encoding="utf-8"?> |
|
||||||
<doctrine-mapping |
|
||||||
xmlns="http://doctrine-project.org/schemas/orm/doctrine-mapping" |
|
||||||
xsi="http://www.w3.org/2001/XMLSchema-instance" |
|
||||||
schemaLocation="http://doctrine-project.org/schemas/orm/doctrine-mapping http://doctrine-project.org/schemas/orm/doctrine-mapping.xsd"> |
|
||||||
<!-- |
|
||||||
This file has been generated by the EasyExtends bundle ( http://sonata-project.org/easy-extends ) |
|
||||||
|
|
||||||
References : |
|
||||||
xsd : https://github.com/doctrine/doctrine2/blob/master/doctrine-mapping.xsd |
|
||||||
xml mapping : http://www.doctrine-project.org/projects/orm/2.0/docs/reference/xml-mapping/en |
|
||||||
association mapping : http://www.doctrine-project.org/projects/orm/2.0/docs/reference/association-mapping/en |
|
||||||
--> |
|
||||||
<entity |
|
||||||
name="Chamilo\PageBundle\Entity\Page" |
|
||||||
table="page__page" |
|
||||||
> |
|
||||||
|
|
||||||
<id name="id" type="integer" column="id"> |
|
||||||
<generator strategy="AUTO"/> |
|
||||||
</id> |
|
||||||
|
|
||||||
</entity> |
|
||||||
</doctrine-mapping> |
|
||||||
@ -1,24 +0,0 @@ |
|||||||
<?xml version="1.0" encoding="utf-8"?> |
|
||||||
<doctrine-mapping |
|
||||||
xmlns="http://doctrine-project.org/schemas/orm/doctrine-mapping" |
|
||||||
xsi="http://www.w3.org/2001/XMLSchema-instance" |
|
||||||
schemaLocation="http://doctrine-project.org/schemas/orm/doctrine-mapping http://doctrine-project.org/schemas/orm/doctrine-mapping.xsd"> |
|
||||||
<!-- |
|
||||||
This file has been generated by the EasyExtends bundle ( http://sonata-project.org/easy-extends ) |
|
||||||
|
|
||||||
References : |
|
||||||
xsd : https://github.com/doctrine/doctrine2/blob/master/doctrine-mapping.xsd |
|
||||||
xml mapping : http://www.doctrine-project.org/projects/orm/2.0/docs/reference/xml-mapping/en |
|
||||||
association mapping : http://www.doctrine-project.org/projects/orm/2.0/docs/reference/association-mapping/en |
|
||||||
--> |
|
||||||
<entity |
|
||||||
name="Chamilo\PageBundle\Entity\Site" |
|
||||||
table="page__site" |
|
||||||
> |
|
||||||
|
|
||||||
<id name="id" type="integer" column="id"> |
|
||||||
<generator strategy="AUTO"/> |
|
||||||
</id> |
|
||||||
|
|
||||||
</entity> |
|
||||||
</doctrine-mapping> |
|
||||||
@ -1,24 +0,0 @@ |
|||||||
<?xml version="1.0" encoding="utf-8"?> |
|
||||||
<doctrine-mapping |
|
||||||
xmlns="http://doctrine-project.org/schemas/orm/doctrine-mapping" |
|
||||||
xsi="http://www.w3.org/2001/XMLSchema-instance" |
|
||||||
schemaLocation="http://doctrine-project.org/schemas/orm/doctrine-mapping http://doctrine-project.org/schemas/orm/doctrine-mapping.xsd"> |
|
||||||
<!-- |
|
||||||
This file has been generated by the EasyExtends bundle ( http://sonata-project.org/easy-extends ) |
|
||||||
|
|
||||||
References : |
|
||||||
xsd : https://github.com/doctrine/doctrine2/blob/master/doctrine-mapping.xsd |
|
||||||
xml mapping : http://www.doctrine-project.org/projects/orm/2.0/docs/reference/xml-mapping/en |
|
||||||
association mapping : http://www.doctrine-project.org/projects/orm/2.0/docs/reference/association-mapping/en |
|
||||||
--> |
|
||||||
<entity |
|
||||||
name="Chamilo\PageBundle\Entity\Snapshot" |
|
||||||
table="page__snapshot" |
|
||||||
> |
|
||||||
|
|
||||||
<id name="id" type="integer" column="id"> |
|
||||||
<generator strategy="AUTO"/> |
|
||||||
</id> |
|
||||||
|
|
||||||
</entity> |
|
||||||
</doctrine-mapping> |
|
||||||
@ -1,3 +0,0 @@ |
|||||||
page: |
|
||||||
resource: '@ChamiloPageBundle/Controller/PageController.php' |
|
||||||
type: annotation |
|
||||||
@ -1,11 +0,0 @@ |
|||||||
<?xml version="1.0" encoding="UTF-8"?> |
|
||||||
<serializer> |
|
||||||
<class name="Chamilo\PageBundle\Entity\Block" exclusion-policy="all" |
|
||||||
xml-root-name="block"> |
|
||||||
|
|
||||||
<property xml-attribute-map="true" name="id" type="integer" |
|
||||||
expose="true" since-version="1.0" |
|
||||||
groups="sonata_api_read,sonata_api_write,sonata_search"/> |
|
||||||
|
|
||||||
</class> |
|
||||||
</serializer> |
|
||||||
@ -1,11 +0,0 @@ |
|||||||
<?xml version="1.0" encoding="UTF-8"?> |
|
||||||
<serializer> |
|
||||||
<class name="Chamilo\PageBundle\Entity\Page" exclusion-policy="all" |
|
||||||
xml-root-name="page"> |
|
||||||
|
|
||||||
<property xml-attribute-map="true" name="id" type="integer" |
|
||||||
expose="true" since-version="1.0" |
|
||||||
groups="sonata_api_read,sonata_api_write,sonata_search"/> |
|
||||||
|
|
||||||
</class> |
|
||||||
</serializer> |
|
||||||
@ -1,11 +0,0 @@ |
|||||||
<?xml version="1.0" encoding="UTF-8"?> |
|
||||||
<serializer> |
|
||||||
<class name="Chamilo\PageBundle\Entity\Site" exclusion-policy="all" |
|
||||||
xml-root-name="site"> |
|
||||||
|
|
||||||
<property xml-attribute-map="true" name="id" type="integer" |
|
||||||
expose="true" since-version="1.0" |
|
||||||
groups="sonata_api_read,sonata_api_write,sonata_search"/> |
|
||||||
|
|
||||||
</class> |
|
||||||
</serializer> |
|
||||||
@ -1,11 +0,0 @@ |
|||||||
<?xml version="1.0" encoding="UTF-8"?> |
|
||||||
<serializer> |
|
||||||
<class name="Chamilo\PageBundle\Entity\Snapshot" exclusion-policy="all" |
|
||||||
xml-root-name="snapshot"> |
|
||||||
|
|
||||||
<property xml-attribute-map="true" name="id" type="integer" |
|
||||||
expose="true" since-version="1.0" |
|
||||||
groups="sonata_api_read,sonata_api_write,sonata_search"/> |
|
||||||
|
|
||||||
</class> |
|
||||||
</serializer> |
|
||||||
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in new issue