src
This commit is contained in:
22
src/Chamilo/AdminBundle/ChamiloAdminBundle.php
Normal file
22
src/Chamilo/AdminBundle/ChamiloAdminBundle.php
Normal file
@@ -0,0 +1,22 @@
|
|||||||
|
<?php
|
||||||
|
/* For licensing terms, see /license.txt */
|
||||||
|
|
||||||
|
namespace Chamilo\AdminBundle;
|
||||||
|
|
||||||
|
use Symfony\Component\HttpKernel\Bundle\Bundle;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Class ApplicationSonataAdminBundle.
|
||||||
|
*
|
||||||
|
* @package Application\Sonata\AdminBundle
|
||||||
|
*/
|
||||||
|
class ChamiloAdminBundle extends Bundle
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* {@inheritdoc}
|
||||||
|
*/
|
||||||
|
public function getParent()
|
||||||
|
{
|
||||||
|
return 'SonataAdminBundle';
|
||||||
|
}
|
||||||
|
}
|
||||||
47
src/Chamilo/AdminBundle/Resources/views/layout.html.twig
Normal file
47
src/Chamilo/AdminBundle/Resources/views/layout.html.twig
Normal file
@@ -0,0 +1,47 @@
|
|||||||
|
{# 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') }}"/>
|
||||||
|
|
||||||
|
<link rel="stylesheet" href="{{ asset('bundles/sonatatranslation/css/sonata-translation.css') }}"/>
|
||||||
|
|
||||||
|
{% endblock %}
|
||||||
|
|
||||||
|
{% block javascripts %}
|
||||||
|
{{ parent() }}
|
||||||
|
|
||||||
|
<script src="{{ asset('bundles/ivoryckeditor/ckeditor.js') }}"
|
||||||
|
type="text/javascript"></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 %}
|
||||||
@@ -0,0 +1,339 @@
|
|||||||
|
{#
|
||||||
|
|
||||||
|
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') %}
|
||||||
|
{% set _form = block('form') %}
|
||||||
|
{% set _show = block('show') %}
|
||||||
|
{% set _list_table = block('list_table') %}
|
||||||
|
{% set _list_filters = block('list_filters') %}
|
||||||
|
{% set _tab_menu = block('tab_menu') %}
|
||||||
|
{% set _content = block('content') %}
|
||||||
|
{% set _title = block('title') %}
|
||||||
|
{% set _breadcrumb = block('breadcrumb') %}
|
||||||
|
{% set _actions = block('actions') %}
|
||||||
|
{% set _navbar_title = block('navbar_title') %}
|
||||||
|
{% set _list_filters_actions = block('list_filters_actions') %}
|
||||||
|
|
||||||
|
<!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 %}
|
||||||
|
|
||||||
|
{% block stylesheets %}
|
||||||
|
{% for stylesheet in sonata_admin.adminPool.getOption('stylesheets', []) %}
|
||||||
|
<link rel="stylesheet" href="{{ asset(stylesheet) }}">
|
||||||
|
{% endfor %}
|
||||||
|
{% endblock %}
|
||||||
|
|
||||||
|
{% block javascripts %}
|
||||||
|
<script>
|
||||||
|
window.SONATA_CONFIG = {
|
||||||
|
CONFIRM_EXIT: {% if sonata_admin.adminPool.getOption('confirm_exit') %}true{% else %}false{% endif %},
|
||||||
|
USE_SELECT2: {% if sonata_admin.adminPool.getOption('use_select2') %}true{% else %}false{% endif %},
|
||||||
|
USE_ICHECK: {% if sonata_admin.adminPool.getOption('use_icheck') %}true{% else %}false{% endif %},
|
||||||
|
USE_STICKYFORMS: {% if sonata_admin.adminPool.getOption('use_stickyforms') %}true{% else %}false{% endif %}
|
||||||
|
};
|
||||||
|
window.SONATA_TRANSLATIONS = {
|
||||||
|
CONFIRM_EXIT: '{{ 'confirm_exit'|trans({}, 'SonataAdminBundle')|escape('js') }}'
|
||||||
|
};
|
||||||
|
|
||||||
|
// http://getbootstrap.com/getting-started/#support-ie10-width
|
||||||
|
if (navigator.userAgent.match(/IEMobile\/10\.0/)) {
|
||||||
|
var msViewportStyle = document.createElement('style');
|
||||||
|
msViewportStyle.appendChild(document.createTextNode('@-ms-viewport{width:auto!important}'));
|
||||||
|
document.querySelector('head').appendChild(msViewportStyle);
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
{% for javascript in sonata_admin.adminPool.getOption('javascripts', []) %}
|
||||||
|
<script src="{{ asset(javascript) }}"></script>
|
||||||
|
{% endfor %}
|
||||||
|
|
||||||
|
{% set locale = app.request.locale %}
|
||||||
|
{# localize moment #}
|
||||||
|
{% if locale[:2] != 'en' %}
|
||||||
|
<script src="{{ asset('bundles/sonatacore/vendor/moment/locale/' ~ locale|replace({'_':'-'}) ~ '.js') }}"></script>
|
||||||
|
{% endif %}
|
||||||
|
|
||||||
|
{# localize select2 #}
|
||||||
|
{% if sonata_admin.adminPool.getOption('use_select2') %}
|
||||||
|
{% if locale == 'pt' %}{% set locale = 'pt_PT' %}{% endif %}
|
||||||
|
|
||||||
|
{# omit default EN locale #}
|
||||||
|
{% if locale[:2] != 'en' %}
|
||||||
|
<script src="{{ asset('bundles/sonatacore/vendor/select2/select2_locale_' ~ locale|replace({'_':'-'}) ~ '.js') }}"></script>
|
||||||
|
{% endif %}
|
||||||
|
{% endif %}
|
||||||
|
{% endblock %}
|
||||||
|
|
||||||
|
<title>
|
||||||
|
{% block sonata_head_title %}
|
||||||
|
{{ 'Admin'|trans({}, 'SonataAdminBundle') }}
|
||||||
|
|
||||||
|
{% if _title is not empty %}
|
||||||
|
{{ _title|raw }}
|
||||||
|
{% else %}
|
||||||
|
{% if action is defined %}
|
||||||
|
-
|
||||||
|
{% for menu in admin.breadcrumbs(action) %}
|
||||||
|
{% if not loop.first %}
|
||||||
|
{% if loop.index != 2 %}
|
||||||
|
>
|
||||||
|
{% endif %}
|
||||||
|
|
||||||
|
{{ menu.label }}
|
||||||
|
{% endif %}
|
||||||
|
{% endfor %}
|
||||||
|
{% endif %}
|
||||||
|
{% endif%}
|
||||||
|
{% endblock %}
|
||||||
|
</title>
|
||||||
|
</head>
|
||||||
|
<body {% block body_attributes %}class="sonata-bc skin-black fixed"{% 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 %}
|
||||||
|
{% 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>
|
||||||
|
{% endspaceless %}
|
||||||
|
{% endblock %}
|
||||||
|
{% block sonata_nav %}
|
||||||
|
<nav class="navbar navbar-static-top" role="navigation">
|
||||||
|
<a href="#" class="sidebar-toggle" data-toggle="offcanvas" role="button">
|
||||||
|
<span class="sr-only">Toggle navigation</span>
|
||||||
|
</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 admin.breadcrumbs(action) %}
|
||||||
|
{% if not loop.last %}
|
||||||
|
<li>
|
||||||
|
{% if menu.uri is not empty %}
|
||||||
|
<a href="{{ menu.uri }}">{{ menu.label|raw }}</a>
|
||||||
|
{% else %}
|
||||||
|
{{ menu.label }}
|
||||||
|
{% endif %}
|
||||||
|
</li>
|
||||||
|
{% else %}
|
||||||
|
<li class="active"><span>{{ menu.label }}</span></li>
|
||||||
|
{% endif %}
|
||||||
|
{% endfor %}
|
||||||
|
{% endif %}
|
||||||
|
{% else %}
|
||||||
|
{{ _breadcrumb|raw }}
|
||||||
|
{% endif %}
|
||||||
|
</ol>
|
||||||
|
{% endif %}
|
||||||
|
</div>
|
||||||
|
{% endblock sonata_breadcrumb %}
|
||||||
|
</div>
|
||||||
|
|
||||||
|
{% block sonata_top_nav_menu %}
|
||||||
|
<div class="navbar-custom-menu">
|
||||||
|
<ul class="nav navbar-nav">
|
||||||
|
<li class="dropdown">
|
||||||
|
<a class="dropdown-toggle" data-toggle="dropdown" href="#">
|
||||||
|
<i class="fa fa-plus-square fa-fw"></i> <i class="fa fa-caret-down"></i>
|
||||||
|
</a>
|
||||||
|
{% include sonata_admin.adminPool.getTemplate('add_block') %}
|
||||||
|
</li>
|
||||||
|
<li class="dropdown user-menu">
|
||||||
|
<a class="dropdown-toggle" data-toggle="dropdown" href="#">
|
||||||
|
<i class="fa fa-user fa-fw"></i> <i class="fa fa-caret-down"></i>
|
||||||
|
</a>
|
||||||
|
<ul class="dropdown-menu dropdown-user">
|
||||||
|
{% include sonata_admin.adminPool.getTemplate('user_block') %}
|
||||||
|
</ul>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
{% 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 app.user and is_granted('ROLE_SONATA_ADMIN') %}
|
||||||
|
<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"></i>
|
||||||
|
</button>
|
||||||
|
</span>
|
||||||
|
</div>
|
||||||
|
</form>
|
||||||
|
{% endif %}
|
||||||
|
{% endblock sonata_sidebar_search %}
|
||||||
|
|
||||||
|
{% block side_bar_before_nav %} {% endblock %}
|
||||||
|
{% block side_bar_nav %}
|
||||||
|
{% if app.user and is_granted('ROLE_SONATA_ADMIN') %}
|
||||||
|
{{ knp_menu_render('sonata_admin_sidebar', {template: sonata_admin.adminPool.getTemplate('knp_menu_template')}) }}
|
||||||
|
{% endif %}
|
||||||
|
{% endblock side_bar_nav %}
|
||||||
|
{% block side_bar_after_nav %}
|
||||||
|
<p class="text-center small" style="border-top: 1px solid #444444; padding-top: 10px">
|
||||||
|
{% block side_bar_after_nav_content %}
|
||||||
|
<a href="https://sonata-project.org" rel="noreferrer" target="_blank">sonata project</a>
|
||||||
|
{% endblock %}
|
||||||
|
</p>
|
||||||
|
{% endblock %}
|
||||||
|
{% 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 _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">
|
||||||
|
<div class="navbar-left">
|
||||||
|
{% if _tab_menu is not empty %}
|
||||||
|
{{ _tab_menu|raw }}
|
||||||
|
{% endif %}
|
||||||
|
</div>
|
||||||
|
|
||||||
|
{% 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 'SonataCoreBundle: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_table is not empty or _list_filters is not empty %}
|
||||||
|
{% if _list_filters|trim %}
|
||||||
|
<div class="row">
|
||||||
|
{{ _list_filters|raw }}
|
||||||
|
</div>
|
||||||
|
{% endif %}
|
||||||
|
|
||||||
|
<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>
|
||||||
@@ -0,0 +1,22 @@
|
|||||||
|
<?php
|
||||||
|
/* For licensing terms, see /license.txt */
|
||||||
|
|
||||||
|
namespace Chamilo\ClassificationBundle;
|
||||||
|
|
||||||
|
use Symfony\Component\HttpKernel\Bundle\Bundle;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Class ChamiloClassificationBundle.
|
||||||
|
*
|
||||||
|
* @package Chamilo\ClassificationBundle
|
||||||
|
*/
|
||||||
|
class ChamiloClassificationBundle extends Bundle
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* {@inheritdoc}
|
||||||
|
*/
|
||||||
|
public function getParent()
|
||||||
|
{
|
||||||
|
return 'SonataClassificationBundle';
|
||||||
|
}
|
||||||
|
}
|
||||||
40
src/Chamilo/ClassificationBundle/Document/Category.php
Normal file
40
src/Chamilo/ClassificationBundle/Document/Category.php
Normal file
@@ -0,0 +1,40 @@
|
|||||||
|
<?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 $id
|
||||||
|
*/
|
||||||
|
public function getId()
|
||||||
|
{
|
||||||
|
return $this->id;
|
||||||
|
}
|
||||||
|
}
|
||||||
40
src/Chamilo/ClassificationBundle/Document/Tag.php
Normal file
40
src/Chamilo/ClassificationBundle/Document/Tag.php
Normal file
@@ -0,0 +1,40 @@
|
|||||||
|
<?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 $id
|
||||||
|
*/
|
||||||
|
public function getId()
|
||||||
|
{
|
||||||
|
return $this->id;
|
||||||
|
}
|
||||||
|
}
|
||||||
40
src/Chamilo/ClassificationBundle/Entity/Category.php
Normal file
40
src/Chamilo/ClassificationBundle/Entity/Category.php
Normal file
@@ -0,0 +1,40 @@
|
|||||||
|
<?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\Entity;
|
||||||
|
|
||||||
|
use Sonata\ClassificationBundle\Entity\BaseCategory as BaseCategory;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This file has been generated by the Sonata EasyExtends bundle ( http://sonata-project.org/bundles/easy-extends ).
|
||||||
|
*
|
||||||
|
* References :
|
||||||
|
* working with object : http://www.doctrine-project.org/projects/orm/2.0/docs/reference/working-with-objects/en
|
||||||
|
*
|
||||||
|
* @author <yourname> <youremail>
|
||||||
|
*/
|
||||||
|
class Category extends BaseCategory
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* @var int
|
||||||
|
*/
|
||||||
|
protected $id;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get id.
|
||||||
|
*
|
||||||
|
* @return int $id
|
||||||
|
*/
|
||||||
|
public function getId()
|
||||||
|
{
|
||||||
|
return $this->id;
|
||||||
|
}
|
||||||
|
}
|
||||||
40
src/Chamilo/ClassificationBundle/Entity/Collection.php
Normal file
40
src/Chamilo/ClassificationBundle/Entity/Collection.php
Normal file
@@ -0,0 +1,40 @@
|
|||||||
|
<?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\Entity;
|
||||||
|
|
||||||
|
use Sonata\ClassificationBundle\Entity\BaseCollection as BaseCollection;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This file has been generated by the Sonata EasyExtends bundle ( http://sonata-project.org/bundles/easy-extends ).
|
||||||
|
*
|
||||||
|
* References :
|
||||||
|
* working with object : http://www.doctrine-project.org/projects/orm/2.0/docs/reference/working-with-objects/en
|
||||||
|
*
|
||||||
|
* @author <yourname> <youremail>
|
||||||
|
*/
|
||||||
|
class Collection extends BaseCollection
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* @var int
|
||||||
|
*/
|
||||||
|
protected $id;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get id.
|
||||||
|
*
|
||||||
|
* @return int $id
|
||||||
|
*/
|
||||||
|
public function getId()
|
||||||
|
{
|
||||||
|
return $this->id;
|
||||||
|
}
|
||||||
|
}
|
||||||
42
src/Chamilo/ClassificationBundle/Entity/Context.php
Normal file
42
src/Chamilo/ClassificationBundle/Entity/Context.php
Normal file
@@ -0,0 +1,42 @@
|
|||||||
|
<?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\Entity;
|
||||||
|
|
||||||
|
use Sonata\ClassificationBundle\Entity\BaseContext as BaseContext;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This file has been generated by the Sonata EasyExtends bundle.
|
||||||
|
*
|
||||||
|
* @see https://sonata-project.org/bundles/easy-extends
|
||||||
|
*
|
||||||
|
* References :
|
||||||
|
* working with object : http://www.doctrine-project.org/projects/orm/2.0/docs/reference/working-with-objects/en
|
||||||
|
*
|
||||||
|
* @author <yourname> <youremail>
|
||||||
|
*/
|
||||||
|
class Context extends BaseContext
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* @var int
|
||||||
|
*/
|
||||||
|
protected $id;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get id.
|
||||||
|
*
|
||||||
|
* @return int $id
|
||||||
|
*/
|
||||||
|
public function getId()
|
||||||
|
{
|
||||||
|
return $this->id;
|
||||||
|
}
|
||||||
|
}
|
||||||
40
src/Chamilo/ClassificationBundle/Entity/Tag.php
Normal file
40
src/Chamilo/ClassificationBundle/Entity/Tag.php
Normal file
@@ -0,0 +1,40 @@
|
|||||||
|
<?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\Entity;
|
||||||
|
|
||||||
|
use Sonata\ClassificationBundle\Entity\BaseTag as BaseTag;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This file has been generated by the Sonata EasyExtends bundle ( http://sonata-project.org/bundles/easy-extends ).
|
||||||
|
*
|
||||||
|
* References :
|
||||||
|
* working with object : http://www.doctrine-project.org/projects/orm/2.0/docs/reference/working-with-objects/en
|
||||||
|
*
|
||||||
|
* @author <yourname> <youremail>
|
||||||
|
*/
|
||||||
|
class Tag extends BaseTag
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* @var int
|
||||||
|
*/
|
||||||
|
protected $id;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get id.
|
||||||
|
*
|
||||||
|
* @return int $id
|
||||||
|
*/
|
||||||
|
public function getId()
|
||||||
|
{
|
||||||
|
return $this->id;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,12 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<doctrine-mongo-mapping
|
||||||
|
xmlns="http://doctrine-project.org/schemas/orm/doctrine-mongo-mapping"
|
||||||
|
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||||
|
xsi:schemaLocation="http://doctrine-project.org/schemas/orm/doctrine-mongo-mapping
|
||||||
|
http://doctrine-project.org/schemas/orm/doctrine-mongo-mapping.xsd">
|
||||||
|
|
||||||
|
<document name="Chamilo\ClassificationBundle\Document\Category"
|
||||||
|
collection="classificationCategory">
|
||||||
|
<id fieldName="id" id="true"/>
|
||||||
|
</document>
|
||||||
|
</doctrine-mongo-mapping>
|
||||||
@@ -0,0 +1,24 @@
|
|||||||
|
<?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>
|
||||||
|
|
||||||
|
</entity>
|
||||||
|
</doctrine-mapping>
|
||||||
@@ -0,0 +1,24 @@
|
|||||||
|
<?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>
|
||||||
|
|
||||||
|
</entity>
|
||||||
|
</doctrine-mapping>
|
||||||
@@ -0,0 +1,24 @@
|
|||||||
|
<?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>
|
||||||
|
|
||||||
|
</entity>
|
||||||
|
</doctrine-mapping>
|
||||||
@@ -0,0 +1,12 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<doctrine-mongo-mapping
|
||||||
|
xmlns="http://doctrine-project.org/schemas/orm/doctrine-mongo-mapping"
|
||||||
|
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||||
|
xsi:schemaLocation="http://doctrine-project.org/schemas/orm/doctrine-mongo-mapping
|
||||||
|
http://doctrine-project.org/schemas/orm/doctrine-mongo-mapping.xsd">
|
||||||
|
|
||||||
|
<document name="Chamilo\ClassificationBundle\Document\Tag"
|
||||||
|
collection="newsTag">
|
||||||
|
<id fieldName="id" id="true"/>
|
||||||
|
</document>
|
||||||
|
</doctrine-mongo-mapping>
|
||||||
@@ -0,0 +1,24 @@
|
|||||||
|
<?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>
|
||||||
|
|
||||||
|
</entity>
|
||||||
|
</doctrine-mapping>
|
||||||
@@ -0,0 +1,17 @@
|
|||||||
|
<?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>
|
||||||
@@ -0,0 +1,17 @@
|
|||||||
|
<?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>
|
||||||
@@ -0,0 +1,17 @@
|
|||||||
|
<?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>
|
||||||
@@ -0,0 +1,17 @@
|
|||||||
|
<?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>
|
||||||
@@ -0,0 +1,17 @@
|
|||||||
|
<?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>
|
||||||
@@ -0,0 +1,17 @@
|
|||||||
|
<?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>
|
||||||
45
src/Chamilo/ContactBundle/Admin/CategoryAdmin.php
Normal file
45
src/Chamilo/ContactBundle/Admin/CategoryAdmin.php
Normal file
@@ -0,0 +1,45 @@
|
|||||||
|
<?php
|
||||||
|
/* For licensing terms, see /license.txt */
|
||||||
|
|
||||||
|
namespace Chamilo\ContactBundle\Admin;
|
||||||
|
|
||||||
|
use Sonata\AdminBundle\Admin\Admin;
|
||||||
|
use Sonata\AdminBundle\Datagrid\DatagridMapper;
|
||||||
|
use Sonata\AdminBundle\Datagrid\ListMapper;
|
||||||
|
use Sonata\AdminBundle\Form\FormMapper;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Class UserAdmin.
|
||||||
|
*
|
||||||
|
* @package Chamilo\ContactBundle\Admin
|
||||||
|
*/
|
||||||
|
class CategoryAdmin extends Admin
|
||||||
|
{
|
||||||
|
protected function configureListFields(ListMapper $listMapper)
|
||||||
|
{
|
||||||
|
$listMapper
|
||||||
|
//->add('headline', null, array('identifier' => true))
|
||||||
|
->add('name', null, ['identifier' => true])
|
||||||
|
->add('email')
|
||||||
|
;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* {@inheritdoc}
|
||||||
|
*/
|
||||||
|
protected function configureFormFields(FormMapper $formMapper)
|
||||||
|
{
|
||||||
|
$formMapper
|
||||||
|
->add('name')
|
||||||
|
->add('email')
|
||||||
|
;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected function configureDatagridFilters(DatagridMapper $datagridMapper)
|
||||||
|
{
|
||||||
|
$datagridMapper
|
||||||
|
->add('name')
|
||||||
|
->add('email')
|
||||||
|
;
|
||||||
|
}
|
||||||
|
}
|
||||||
15
src/Chamilo/ContactBundle/ChamiloContactBundle.php
Normal file
15
src/Chamilo/ContactBundle/ChamiloContactBundle.php
Normal file
@@ -0,0 +1,15 @@
|
|||||||
|
<?php
|
||||||
|
/* For licensing terms, see /license.txt */
|
||||||
|
|
||||||
|
namespace Chamilo\ContactBundle;
|
||||||
|
|
||||||
|
use Symfony\Component\HttpKernel\Bundle\Bundle;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Class ChamiloContactBundle.
|
||||||
|
*
|
||||||
|
* @package Chamilo\ChamiloContactBundle
|
||||||
|
*/
|
||||||
|
class ChamiloContactBundle extends Bundle
|
||||||
|
{
|
||||||
|
}
|
||||||
89
src/Chamilo/ContactBundle/Controller/ContactController.php
Normal file
89
src/Chamilo/ContactBundle/Controller/ContactController.php
Normal file
@@ -0,0 +1,89 @@
|
|||||||
|
<?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 Sensio\Bundle\FrameworkExtraBundle\Configuration\Route;
|
||||||
|
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
|
||||||
|
use Symfony\Component\HttpFoundation\Request;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Class ContactController.
|
||||||
|
*
|
||||||
|
* @Route("/")
|
||||||
|
*
|
||||||
|
* @package Chamilo\ContactBundle\Controller
|
||||||
|
*/
|
||||||
|
class ContactController extends Controller
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* @Route("/", name="contact")
|
||||||
|
*
|
||||||
|
* @return mixed
|
||||||
|
*/
|
||||||
|
public function indexAction(Request $request)
|
||||||
|
{
|
||||||
|
$type = new ContactType();
|
||||||
|
/** @var User $user */
|
||||||
|
$user = $this->getUser();
|
||||||
|
$data = [];
|
||||||
|
|
||||||
|
if ($user) {
|
||||||
|
$data = [
|
||||||
|
'firstname' => $user->getFirstname(),
|
||||||
|
'lastname' => $user->getFirstname(),
|
||||||
|
'email' => $user->getEmail(),
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
$form = $this->createForm($type, $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 = \Swift_Message::newInstance()
|
||||||
|
->setSubject($form->get('subject')->getData())
|
||||||
|
->setFrom($form->get('email')->getData())
|
||||||
|
->setTo($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(),
|
||||||
|
]
|
||||||
|
)
|
||||||
|
);
|
||||||
|
|
||||||
|
$this->get('mailer')->send($message);
|
||||||
|
$this->addFlash(
|
||||||
|
'success',
|
||||||
|
'Your email has been sent! Thanks!'
|
||||||
|
);
|
||||||
|
|
||||||
|
return $this->redirect($this->generateUrl('contact'));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return $this->render(
|
||||||
|
'@ChamiloContact/index.html.twig',
|
||||||
|
[
|
||||||
|
'form' => $form->createView(),
|
||||||
|
]
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,26 @@
|
|||||||
|
<?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
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* {@inheritdoc}
|
||||||
|
*/
|
||||||
|
public function load(array $configs, ContainerBuilder $container)
|
||||||
|
{
|
||||||
|
$loader = new Loader\YamlFileLoader($container, new FileLocator(__DIR__.'/../Resources/config'));
|
||||||
|
$loader->load('admin.yml');
|
||||||
|
}
|
||||||
|
}
|
||||||
88
src/Chamilo/ContactBundle/Entity/Category.php
Normal file
88
src/Chamilo/ContactBundle/Entity/Category.php
Normal file
@@ -0,0 +1,88 @@
|
|||||||
|
<?php
|
||||||
|
/* For licensing terms, see /license.txt */
|
||||||
|
|
||||||
|
namespace Chamilo\ContactBundle\Entity;
|
||||||
|
|
||||||
|
use Doctrine\ORM\Mapping as ORM;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Class Category.
|
||||||
|
*
|
||||||
|
* @ORM\Entity
|
||||||
|
* @ORM\Table(
|
||||||
|
* name="contact_category"
|
||||||
|
* )
|
||||||
|
*
|
||||||
|
* @package Chamilo\FaqBundle\Entity
|
||||||
|
*/
|
||||||
|
class Category
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* @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;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @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;
|
||||||
|
}
|
||||||
|
}
|
||||||
8
src/Chamilo/ContactBundle/Entity/Contact.php
Normal file
8
src/Chamilo/ContactBundle/Entity/Contact.php
Normal file
@@ -0,0 +1,8 @@
|
|||||||
|
<?php
|
||||||
|
/* For licensing terms, see /license.txt */
|
||||||
|
|
||||||
|
namespace Chamilo\ContactBundle\Entity;
|
||||||
|
|
||||||
|
class Contact
|
||||||
|
{
|
||||||
|
}
|
||||||
72
src/Chamilo/ContactBundle/Form/Type/ContactType.php
Normal file
72
src/Chamilo/ContactBundle/Form/Type/ContactType.php
Normal file
@@ -0,0 +1,72 @@
|
|||||||
|
<?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\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.
|
||||||
|
*
|
||||||
|
* @package Chamilo\ContactBundle\Form\Type
|
||||||
|
*/
|
||||||
|
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', 'textarea')
|
||||||
|
->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,
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
}
|
||||||
9
src/Chamilo/ContactBundle/Resources/config/admin.yml
Normal file
9
src/Chamilo/ContactBundle/Resources/config/admin.yml
Normal file
@@ -0,0 +1,9 @@
|
|||||||
|
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
|
||||||
|
- ~
|
||||||
3
src/Chamilo/ContactBundle/Resources/config/routing.yml
Normal file
3
src/Chamilo/ContactBundle/Resources/config/routing.yml
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
contact:
|
||||||
|
resource: "@ChamiloContactBundle/Controller/ContactController.php"
|
||||||
|
type: annotation
|
||||||
11
src/Chamilo/ContactBundle/Resources/views/contact.html.twig
Normal file
11
src/Chamilo/ContactBundle/Resources/views/contact.html.twig
Normal file
@@ -0,0 +1,11 @@
|
|||||||
|
{{ 'You had a new message from %url%' | trans({'%url%': url(app.request.attributes.get('_route'))} ) }}
|
||||||
|
|
||||||
|
{{ 'Firstname' | trans }} : {{ firstname }}
|
||||||
|
{{ 'Lirstname' | trans }} : {{ lastname }}
|
||||||
|
|
||||||
|
Email: {{ email }}
|
||||||
|
IP: {{ ip }}
|
||||||
|
|
||||||
|
{{ 'Subject' | trans }} : {{ subject }}
|
||||||
|
{{ 'Message' | trans }} :
|
||||||
|
{{ message|raw }}
|
||||||
12
src/Chamilo/ContactBundle/Resources/views/index.html.twig
Normal file
12
src/Chamilo/ContactBundle/Resources/views/index.html.twig
Normal file
@@ -0,0 +1,12 @@
|
|||||||
|
{% extends '@ChamiloCore/layout_one_col.html.twig' %}
|
||||||
|
|
||||||
|
{% block 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 %}
|
||||||
57
src/Chamilo/CoreBundle/Admin/AccessUrlAdmin.php
Normal file
57
src/Chamilo/CoreBundle/Admin/AccessUrlAdmin.php
Normal file
@@ -0,0 +1,57 @@
|
|||||||
|
<?php
|
||||||
|
/* For licensing terms, see /license.txt */
|
||||||
|
|
||||||
|
namespace Chamilo\CoreBundle\Admin;
|
||||||
|
|
||||||
|
use Sonata\AdminBundle\Admin\AbstractAdmin;
|
||||||
|
use Sonata\AdminBundle\Datagrid\DatagridMapper;
|
||||||
|
use Sonata\AdminBundle\Datagrid\ListMapper;
|
||||||
|
use Sonata\AdminBundle\Form\FormMapper;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Class AccessUrlAdmin.
|
||||||
|
*
|
||||||
|
* @package Chamilo\CoreBundle\Admin
|
||||||
|
*/
|
||||||
|
class AccessUrlAdmin extends AbstractAdmin
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* @param $course
|
||||||
|
*
|
||||||
|
* @return mixed|void
|
||||||
|
*/
|
||||||
|
public function preUpdate($course)
|
||||||
|
{
|
||||||
|
//$course->setUsers($course->getUsers());
|
||||||
|
}
|
||||||
|
|
||||||
|
protected function configureFormFields(FormMapper $formMapper)
|
||||||
|
{
|
||||||
|
$formMapper
|
||||||
|
->add('url', 'url')
|
||||||
|
->add('description', 'ckeditor')
|
||||||
|
->add('active')
|
||||||
|
->add('limitCourses')
|
||||||
|
->add('limitActiveCourses')
|
||||||
|
->add('limitSessions')
|
||||||
|
->add('limitUsers')
|
||||||
|
->add('limitTeachers')
|
||||||
|
->add('limitDiskSpace')
|
||||||
|
->add('email', 'email')
|
||||||
|
;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected function configureDatagridFilters(DatagridMapper $datagridMapper)
|
||||||
|
{
|
||||||
|
$datagridMapper
|
||||||
|
->add('url')
|
||||||
|
;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected function configureListFields(ListMapper $listMapper)
|
||||||
|
{
|
||||||
|
$listMapper
|
||||||
|
->addIdentifier('url')
|
||||||
|
;
|
||||||
|
}
|
||||||
|
}
|
||||||
47
src/Chamilo/CoreBundle/Admin/AccessUrlRelCourseAdmin.php
Normal file
47
src/Chamilo/CoreBundle/Admin/AccessUrlRelCourseAdmin.php
Normal file
@@ -0,0 +1,47 @@
|
|||||||
|
<?php
|
||||||
|
/* For licensing terms, see /license.txt */
|
||||||
|
|
||||||
|
namespace Chamilo\CoreBundle\Admin;
|
||||||
|
|
||||||
|
use Sonata\AdminBundle\Admin\AbstractAdmin;
|
||||||
|
use Sonata\AdminBundle\Datagrid\DatagridMapper;
|
||||||
|
use Sonata\AdminBundle\Datagrid\ListMapper;
|
||||||
|
use Sonata\AdminBundle\Form\FormMapper;
|
||||||
|
use Sonata\AdminBundle\Show\ShowMapper;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Class CourseAdmin.
|
||||||
|
*
|
||||||
|
* @package Chamilo\CoreBundle\Admin
|
||||||
|
*/
|
||||||
|
class AccessUrlRelCourseAdmin extends AbstractAdmin
|
||||||
|
{
|
||||||
|
protected function configureShowField(ShowMapper $showMapper)
|
||||||
|
{
|
||||||
|
$showMapper
|
||||||
|
->add('id')
|
||||||
|
;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected function configureFormFields(FormMapper $formMapper)
|
||||||
|
{
|
||||||
|
$formMapper
|
||||||
|
->add('url')
|
||||||
|
->end()
|
||||||
|
;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected function configureDatagridFilters(DatagridMapper $datagridMapper)
|
||||||
|
{
|
||||||
|
$datagridMapper
|
||||||
|
->add('url')
|
||||||
|
;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected function configureListFields(ListMapper $listMapper)
|
||||||
|
{
|
||||||
|
$listMapper
|
||||||
|
->addIdentifier('url')
|
||||||
|
;
|
||||||
|
}
|
||||||
|
}
|
||||||
41
src/Chamilo/CoreBundle/Admin/BranchAdmin.php
Normal file
41
src/Chamilo/CoreBundle/Admin/BranchAdmin.php
Normal file
@@ -0,0 +1,41 @@
|
|||||||
|
<?php
|
||||||
|
/* For licensing terms, see /license.txt */
|
||||||
|
|
||||||
|
namespace Chamilo\CoreBundle\Admin;
|
||||||
|
|
||||||
|
use Sonata\AdminBundle\Admin\AbstractAdmin;
|
||||||
|
use Sonata\AdminBundle\Datagrid\DatagridMapper;
|
||||||
|
use Sonata\AdminBundle\Datagrid\ListMapper;
|
||||||
|
use Sonata\AdminBundle\Form\FormMapper;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Class BranchAdmin.
|
||||||
|
*
|
||||||
|
* @package Chamilo\CoreBundle\Admin
|
||||||
|
*/
|
||||||
|
class BranchAdmin extends AbstractAdmin
|
||||||
|
{
|
||||||
|
// Fields to be shown on create/edit forms
|
||||||
|
protected function configureFormFields(FormMapper $formMapper)
|
||||||
|
{
|
||||||
|
$formMapper
|
||||||
|
->add('id')
|
||||||
|
;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Fields to be shown on filter forms
|
||||||
|
protected function configureDatagridFilters(DatagridMapper $datagridMapper)
|
||||||
|
{
|
||||||
|
$datagridMapper
|
||||||
|
->add('id')
|
||||||
|
;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Fields to be shown on lists
|
||||||
|
protected function configureListFields(ListMapper $listMapper)
|
||||||
|
{
|
||||||
|
$listMapper
|
||||||
|
->addIdentifier('id')
|
||||||
|
;
|
||||||
|
}
|
||||||
|
}
|
||||||
42
src/Chamilo/CoreBundle/Admin/CareerAdmin.php
Normal file
42
src/Chamilo/CoreBundle/Admin/CareerAdmin.php
Normal file
@@ -0,0 +1,42 @@
|
|||||||
|
<?php
|
||||||
|
/* For licensing terms, see /license.txt */
|
||||||
|
|
||||||
|
namespace Chamilo\CoreBundle\Admin;
|
||||||
|
|
||||||
|
use Chamilo\CoreBundle\Entity\Career;
|
||||||
|
use Sonata\AdminBundle\Admin\AbstractAdmin;
|
||||||
|
use Sonata\AdminBundle\Datagrid\DatagridMapper;
|
||||||
|
use Sonata\AdminBundle\Datagrid\ListMapper;
|
||||||
|
use Sonata\AdminBundle\Form\FormMapper;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Class CareerAdmin.
|
||||||
|
*
|
||||||
|
* @package Chamilo\CoreBundle\Admin
|
||||||
|
*/
|
||||||
|
class CareerAdmin extends AbstractAdmin
|
||||||
|
{
|
||||||
|
protected function configureFormFields(FormMapper $formMapper)
|
||||||
|
{
|
||||||
|
$formMapper
|
||||||
|
->add('name')
|
||||||
|
->add('description', 'ckeditor')
|
||||||
|
->add('status', 'choice', ['choices' => Career::getStatusList()])
|
||||||
|
;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected function configureDatagridFilters(DatagridMapper $datagridMapper)
|
||||||
|
{
|
||||||
|
$datagridMapper
|
||||||
|
->add('name')
|
||||||
|
;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected function configureListFields(ListMapper $listMapper)
|
||||||
|
{
|
||||||
|
$listMapper
|
||||||
|
->addIdentifier('id')
|
||||||
|
->addIdentifier('name')
|
||||||
|
;
|
||||||
|
}
|
||||||
|
}
|
||||||
43
src/Chamilo/CoreBundle/Admin/PromotionAdmin.php
Normal file
43
src/Chamilo/CoreBundle/Admin/PromotionAdmin.php
Normal file
@@ -0,0 +1,43 @@
|
|||||||
|
<?php
|
||||||
|
/* For licensing terms, see /license.txt */
|
||||||
|
|
||||||
|
namespace Chamilo\CoreBundle\Admin;
|
||||||
|
|
||||||
|
use Chamilo\CoreBundle\Entity\Promotion;
|
||||||
|
use Sonata\AdminBundle\Admin\AbstractAdmin;
|
||||||
|
use Sonata\AdminBundle\Datagrid\DatagridMapper;
|
||||||
|
use Sonata\AdminBundle\Datagrid\ListMapper;
|
||||||
|
use Sonata\AdminBundle\Form\FormMapper;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Class PromotionAdmin.
|
||||||
|
*
|
||||||
|
* @package Chamilo\CoreBundle\Admin
|
||||||
|
*/
|
||||||
|
class PromotionAdmin extends AbstractAdmin
|
||||||
|
{
|
||||||
|
protected function configureFormFields(FormMapper $formMapper)
|
||||||
|
{
|
||||||
|
$formMapper
|
||||||
|
->add('name')
|
||||||
|
->add('description', 'ckeditor')
|
||||||
|
->add('status', 'choice', ['choices' => Promotion::getStatusList()])
|
||||||
|
->add('career')
|
||||||
|
;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected function configureDatagridFilters(DatagridMapper $datagridMapper)
|
||||||
|
{
|
||||||
|
$datagridMapper
|
||||||
|
->add('name')
|
||||||
|
;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected function configureListFields(ListMapper $listMapper)
|
||||||
|
{
|
||||||
|
$listMapper
|
||||||
|
->addIdentifier('id')
|
||||||
|
->addIdentifier('name')
|
||||||
|
;
|
||||||
|
}
|
||||||
|
}
|
||||||
107
src/Chamilo/CoreBundle/Admin/SessionAdmin.php
Normal file
107
src/Chamilo/CoreBundle/Admin/SessionAdmin.php
Normal file
@@ -0,0 +1,107 @@
|
|||||||
|
<?php
|
||||||
|
/* For licensing terms, see /license.txt */
|
||||||
|
|
||||||
|
namespace Chamilo\CoreBundle\Admin;
|
||||||
|
|
||||||
|
use Chamilo\CoreBundle\Entity\Session;
|
||||||
|
use Sonata\AdminBundle\Admin\AbstractAdmin;
|
||||||
|
use Sonata\AdminBundle\Datagrid\DatagridMapper;
|
||||||
|
use Sonata\AdminBundle\Datagrid\ListMapper;
|
||||||
|
use Sonata\AdminBundle\Form\FormMapper;
|
||||||
|
use Sonata\AdminBundle\Show\ShowMapper;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Class SessionAdmin.
|
||||||
|
*
|
||||||
|
* @package Chamilo\CoreBundle\Admin
|
||||||
|
*/
|
||||||
|
class SessionAdmin extends AbstractAdmin
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Very important in order to save the related entities!
|
||||||
|
*
|
||||||
|
* @param Session $session
|
||||||
|
*
|
||||||
|
* @return mixed|void
|
||||||
|
*/
|
||||||
|
public function preUpdate($session)
|
||||||
|
{
|
||||||
|
$session->setCourses($session->getCourses());
|
||||||
|
}
|
||||||
|
|
||||||
|
protected function configureFormFields(FormMapper $formMapper)
|
||||||
|
{
|
||||||
|
$formMapper
|
||||||
|
->add('name') //if no type is specified, SonataAdminBundle tries to guess it
|
||||||
|
->add('generalCoach')
|
||||||
|
->add('category')
|
||||||
|
->add('displayStartDate', 'sonata_type_datetime_picker')
|
||||||
|
->add(
|
||||||
|
'visibility',
|
||||||
|
'choice',
|
||||||
|
['choices' => Session::getStatusList()]
|
||||||
|
)
|
||||||
|
->add(
|
||||||
|
'courses',
|
||||||
|
'sonata_type_collection',
|
||||||
|
[
|
||||||
|
'cascade_validation' => true,
|
||||||
|
],
|
||||||
|
[
|
||||||
|
'edit' => 'inline',
|
||||||
|
'inline' => 'table',
|
||||||
|
//'sortable' => 'position',
|
||||||
|
//'link_parameters' => array('context' => $context),
|
||||||
|
'admin_code' => 'sonata.admin.session_rel_course',
|
||||||
|
]
|
||||||
|
)
|
||||||
|
/*->add('users', 'sonata_type_collection', array(
|
||||||
|
'cascade_validation' => true,
|
||||||
|
), array(
|
||||||
|
'allow_delete' => true,
|
||||||
|
'by_reference' => false,
|
||||||
|
//'edit' => 'inline',
|
||||||
|
|
||||||
|
//'sortable' => 'position',
|
||||||
|
//'link_parameters' => array('context' => $context),
|
||||||
|
//'admin_code' => 'sonata.admin.session_rel_user'
|
||||||
|
)
|
||||||
|
)*/
|
||||||
|
;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected function configureShowField(ShowMapper $showMapper)
|
||||||
|
{
|
||||||
|
$showMapper
|
||||||
|
->add('id', 'text', ['label' => 'Session'])
|
||||||
|
->add('name')
|
||||||
|
->add('display_start_date', 'sonata_type_date_picker')
|
||||||
|
;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected function configureDatagridFilters(DatagridMapper $datagridMapper)
|
||||||
|
{
|
||||||
|
$datagridMapper
|
||||||
|
->add('name')
|
||||||
|
->add(
|
||||||
|
'visibility',
|
||||||
|
null,
|
||||||
|
[],
|
||||||
|
'choice',
|
||||||
|
['choices' => Session::getStatusList()]
|
||||||
|
)
|
||||||
|
//->add('display_start_date', 'sonata_type_date_picker')
|
||||||
|
;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected function configureListFields(ListMapper $listMapper)
|
||||||
|
{
|
||||||
|
$listMapper
|
||||||
|
->addIdentifier('name')
|
||||||
|
->add('generalCoach')
|
||||||
|
->add('visibility', 'choice', [
|
||||||
|
'choices' => Session::getStatusList(),
|
||||||
|
])
|
||||||
|
;
|
||||||
|
}
|
||||||
|
}
|
||||||
50
src/Chamilo/CoreBundle/Admin/SessionCategoryAdmin.php
Normal file
50
src/Chamilo/CoreBundle/Admin/SessionCategoryAdmin.php
Normal file
@@ -0,0 +1,50 @@
|
|||||||
|
<?php
|
||||||
|
/* For licensing terms, see /license.txt */
|
||||||
|
|
||||||
|
namespace Chamilo\CoreBundle\Admin;
|
||||||
|
|
||||||
|
use Sonata\AdminBundle\Admin\AbstractAdmin;
|
||||||
|
use Sonata\AdminBundle\Datagrid\DatagridMapper;
|
||||||
|
use Sonata\AdminBundle\Datagrid\ListMapper;
|
||||||
|
use Sonata\AdminBundle\Form\FormMapper;
|
||||||
|
use Sonata\AdminBundle\Show\ShowMapper;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Class CourseRequestAdmin.
|
||||||
|
*
|
||||||
|
* @package Chamilo\CoreBundle\Admin
|
||||||
|
*/
|
||||||
|
class SessionCategoryAdmin extends AbstractAdmin
|
||||||
|
{
|
||||||
|
protected function configureFormFields(FormMapper $formMapper)
|
||||||
|
{
|
||||||
|
$formMapper
|
||||||
|
->add('name')
|
||||||
|
->add('url')
|
||||||
|
->add('dateStart', 'sonata_type_datetime_picker')
|
||||||
|
->add('dateEnd', 'sonata_type_datetime_picker')
|
||||||
|
;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected function configureShowField(ShowMapper $showMapper)
|
||||||
|
{
|
||||||
|
$showMapper
|
||||||
|
->add('id')
|
||||||
|
->add('name')
|
||||||
|
;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected function configureDatagridFilters(DatagridMapper $datagridMapper)
|
||||||
|
{
|
||||||
|
$datagridMapper
|
||||||
|
->add('name')
|
||||||
|
;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected function configureListFields(ListMapper $listMapper)
|
||||||
|
{
|
||||||
|
$listMapper
|
||||||
|
->addIdentifier('name')
|
||||||
|
;
|
||||||
|
}
|
||||||
|
}
|
||||||
59
src/Chamilo/CoreBundle/Admin/SessionRelCourseAdmin.php
Normal file
59
src/Chamilo/CoreBundle/Admin/SessionRelCourseAdmin.php
Normal file
@@ -0,0 +1,59 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Chamilo\CoreBundle\Admin;
|
||||||
|
|
||||||
|
use Sonata\AdminBundle\Admin\AbstractAdmin;
|
||||||
|
use Sonata\AdminBundle\Datagrid\DatagridMapper;
|
||||||
|
use Sonata\AdminBundle\Datagrid\ListMapper;
|
||||||
|
use Sonata\AdminBundle\Form\FormMapper;
|
||||||
|
use Sonata\AdminBundle\Show\ShowMapper;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Class SessionRelCourseAdmin.
|
||||||
|
*
|
||||||
|
* @package Chamilo\CoreBundle\Admin
|
||||||
|
*/
|
||||||
|
class SessionRelCourseAdmin extends AbstractAdmin
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* {@inheritdoc}
|
||||||
|
*/
|
||||||
|
protected function configureShowField(ShowMapper $showMapper)
|
||||||
|
{
|
||||||
|
$showMapper
|
||||||
|
->add('id')
|
||||||
|
;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* {@inheritdoc}
|
||||||
|
*/
|
||||||
|
protected function configureFormFields(FormMapper $formMapper)
|
||||||
|
{
|
||||||
|
$formMapper
|
||||||
|
->add('course')
|
||||||
|
//->add('session')
|
||||||
|
->end()
|
||||||
|
;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* {@inheritdoc}
|
||||||
|
*/
|
||||||
|
protected function configureDatagridFilters(DatagridMapper $datagridMapper)
|
||||||
|
{
|
||||||
|
$datagridMapper
|
||||||
|
->add('id')
|
||||||
|
;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* {@inheritdoc}
|
||||||
|
*/
|
||||||
|
protected function configureListFields(ListMapper $listMapper)
|
||||||
|
{
|
||||||
|
$listMapper
|
||||||
|
->addIdentifier('id')
|
||||||
|
;
|
||||||
|
}
|
||||||
|
}
|
||||||
57
src/Chamilo/CoreBundle/Admin/SessionRelUserAdmin.php
Normal file
57
src/Chamilo/CoreBundle/Admin/SessionRelUserAdmin.php
Normal file
@@ -0,0 +1,57 @@
|
|||||||
|
<?php
|
||||||
|
/* For licensing terms, see /license.txt */
|
||||||
|
|
||||||
|
namespace Chamilo\CoreBundle\Admin;
|
||||||
|
|
||||||
|
use Sonata\AdminBundle\Admin\AbstractAdmin;
|
||||||
|
use Sonata\AdminBundle\Datagrid\DatagridMapper;
|
||||||
|
use Sonata\AdminBundle\Datagrid\ListMapper;
|
||||||
|
use Sonata\AdminBundle\Form\FormMapper;
|
||||||
|
use Sonata\AdminBundle\Show\ShowMapper;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Class SessionAdmin.
|
||||||
|
*
|
||||||
|
* @package Chamilo\CoreBundle\Admin
|
||||||
|
*/
|
||||||
|
class SessionRelUserAdmin extends AbstractAdmin
|
||||||
|
{
|
||||||
|
protected function configureFormFields(FormMapper $formMapper)
|
||||||
|
{
|
||||||
|
$formMapper
|
||||||
|
->add('session') //if no type is specified, SonataAdminBundle tries to guess it
|
||||||
|
->add('user')
|
||||||
|
->add('relation_type', 'text')
|
||||||
|
;
|
||||||
|
|
||||||
|
/*->add('student', 'sonata_type_model', array(),
|
||||||
|
array(
|
||||||
|
'admin_code' => 'application.subscriber.admin.student'
|
||||||
|
))*/
|
||||||
|
}
|
||||||
|
|
||||||
|
protected function configureShowField(ShowMapper $showMapper)
|
||||||
|
{
|
||||||
|
$showMapper
|
||||||
|
->add('session')
|
||||||
|
->add('user')
|
||||||
|
;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected function configureDatagridFilters(DatagridMapper $datagridMapper)
|
||||||
|
{
|
||||||
|
$datagridMapper
|
||||||
|
->add('session')
|
||||||
|
->add('user')
|
||||||
|
//->add('display_start_date', 'sonata_type_date_picker')
|
||||||
|
;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected function configureListFields(ListMapper $listMapper)
|
||||||
|
{
|
||||||
|
$listMapper
|
||||||
|
->addIdentifier('session')
|
||||||
|
->addIdentifier('user')
|
||||||
|
;
|
||||||
|
}
|
||||||
|
}
|
||||||
50
src/Chamilo/CoreBundle/Admin/SettingsCurrentAdmin.php
Normal file
50
src/Chamilo/CoreBundle/Admin/SettingsCurrentAdmin.php
Normal file
@@ -0,0 +1,50 @@
|
|||||||
|
<?php
|
||||||
|
/* For licensing terms, see /license.txt */
|
||||||
|
|
||||||
|
namespace Chamilo\CoreBundle\Admin;
|
||||||
|
|
||||||
|
use Sonata\AdminBundle\Admin\AbstractAdmin;
|
||||||
|
use Sonata\AdminBundle\Datagrid\DatagridMapper;
|
||||||
|
use Sonata\AdminBundle\Datagrid\ListMapper;
|
||||||
|
use Sonata\AdminBundle\Form\FormMapper;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Class SettingsCurrentAdmin.
|
||||||
|
*
|
||||||
|
* @package Chamilo\CoreBundle\Admin
|
||||||
|
*/
|
||||||
|
class SettingsCurrentAdmin extends AbstractAdmin
|
||||||
|
{
|
||||||
|
protected function configureFormFields(FormMapper $formMapper)
|
||||||
|
{
|
||||||
|
$formMapper
|
||||||
|
->add('title')
|
||||||
|
->add('variable')
|
||||||
|
->add('subkey')
|
||||||
|
->add('type')
|
||||||
|
->add('category')
|
||||||
|
->add('selectedValue')
|
||||||
|
->add('comment', 'ckeditor')
|
||||||
|
->add('accessUrl')
|
||||||
|
;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected function configureDatagridFilters(DatagridMapper $datagridMapper)
|
||||||
|
{
|
||||||
|
$datagridMapper
|
||||||
|
->add('title')
|
||||||
|
->add('variable')
|
||||||
|
->add('category')
|
||||||
|
->add('accessUrl')
|
||||||
|
;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected function configureListFields(ListMapper $listMapper)
|
||||||
|
{
|
||||||
|
$listMapper
|
||||||
|
->addIdentifier('variable')
|
||||||
|
->add('selected_value')
|
||||||
|
->add('category')
|
||||||
|
;
|
||||||
|
}
|
||||||
|
}
|
||||||
70
src/Chamilo/CoreBundle/Admin/ToolAdmin.php
Normal file
70
src/Chamilo/CoreBundle/Admin/ToolAdmin.php
Normal file
@@ -0,0 +1,70 @@
|
|||||||
|
<?php
|
||||||
|
/* For licensing terms, see /license.txt */
|
||||||
|
|
||||||
|
namespace Chamilo\CoreBundle\Admin;
|
||||||
|
|
||||||
|
use Sonata\AdminBundle\Admin\AbstractAdmin;
|
||||||
|
use Sonata\AdminBundle\Datagrid\DatagridMapper;
|
||||||
|
use Sonata\AdminBundle\Datagrid\ListMapper;
|
||||||
|
use Sonata\AdminBundle\Form\FormMapper;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Class ToolAdmin.
|
||||||
|
*
|
||||||
|
* @package Chamilo\CoreBundle\Admin
|
||||||
|
*/
|
||||||
|
class ToolAdmin extends AbstractAdmin
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* {@inheritdoc}
|
||||||
|
*/
|
||||||
|
protected function configureFormFields(FormMapper $formMapper)
|
||||||
|
{
|
||||||
|
$formMapper
|
||||||
|
->add('name')
|
||||||
|
->add('description', 'ckeditor')
|
||||||
|
->add(
|
||||||
|
'toolResourceRights',
|
||||||
|
'sonata_type_collection',
|
||||||
|
[
|
||||||
|
'cascade_validation' => true,
|
||||||
|
],
|
||||||
|
[
|
||||||
|
//'allow_delete' => true,
|
||||||
|
//'by_reference' => false,
|
||||||
|
'edit' => 'inline',
|
||||||
|
'inline' => 'table',
|
||||||
|
//'btn_add' => true,
|
||||||
|
//'multiple' => true
|
||||||
|
//'sortable' => 'position',
|
||||||
|
//'link_parameters' => array('content' => $users),
|
||||||
|
'admin_code' => 'sonata.admin.tool_resource_rights',
|
||||||
|
]
|
||||||
|
)
|
||||||
|
/*->add('image', 'sonata_media_type', array(
|
||||||
|
'provider' => 'sonata.media.provider.image',
|
||||||
|
'context' => 'default'
|
||||||
|
));*/
|
||||||
|
;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* {@inheritdoc}
|
||||||
|
*/
|
||||||
|
protected function configureDatagridFilters(DatagridMapper $datagridMapper)
|
||||||
|
{
|
||||||
|
$datagridMapper
|
||||||
|
->add('name')
|
||||||
|
;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* {@inheritdoc}
|
||||||
|
*/
|
||||||
|
protected function configureListFields(ListMapper $listMapper)
|
||||||
|
{
|
||||||
|
$listMapper
|
||||||
|
->addIdentifier('name')
|
||||||
|
;
|
||||||
|
}
|
||||||
|
}
|
||||||
60
src/Chamilo/CoreBundle/Admin/ToolResourceRightsAdmin.php
Normal file
60
src/Chamilo/CoreBundle/Admin/ToolResourceRightsAdmin.php
Normal file
@@ -0,0 +1,60 @@
|
|||||||
|
<?php
|
||||||
|
/* For licensing terms, see /license.txt */
|
||||||
|
|
||||||
|
namespace Chamilo\CoreBundle\Admin;
|
||||||
|
|
||||||
|
use Chamilo\CoreBundle\Entity\ToolResourceRights;
|
||||||
|
use Sonata\AdminBundle\Admin\AbstractAdmin;
|
||||||
|
use Sonata\AdminBundle\Datagrid\DatagridMapper;
|
||||||
|
use Sonata\AdminBundle\Datagrid\ListMapper;
|
||||||
|
use Sonata\AdminBundle\Form\FormMapper;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Class ToolResourceRightsAdmin.
|
||||||
|
*
|
||||||
|
* @package Chamilo\CoreBundle\Admin
|
||||||
|
*/
|
||||||
|
class ToolResourceRightsAdmin extends AbstractAdmin
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* {@inheritdoc}
|
||||||
|
*/
|
||||||
|
protected function configureFormFields(FormMapper $formMapper)
|
||||||
|
{
|
||||||
|
$formMapper
|
||||||
|
->add('tool')
|
||||||
|
->add(
|
||||||
|
'role',
|
||||||
|
'choice',
|
||||||
|
['choices' => ToolResourceRights::getDefaultRoles()]
|
||||||
|
)
|
||||||
|
->add(
|
||||||
|
'mask',
|
||||||
|
'choice',
|
||||||
|
['choices' => ToolResourceRights::getMaskList()]
|
||||||
|
)
|
||||||
|
;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* {@inheritdoc}
|
||||||
|
*/
|
||||||
|
protected function configureDatagridFilters(DatagridMapper $datagridMapper)
|
||||||
|
{
|
||||||
|
$datagridMapper
|
||||||
|
->add('role')
|
||||||
|
;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* {@inheritdoc}
|
||||||
|
*/
|
||||||
|
protected function configureListFields(ListMapper $listMapper)
|
||||||
|
{
|
||||||
|
$listMapper
|
||||||
|
->addIdentifier('id')
|
||||||
|
->addIdentifier('role')
|
||||||
|
->addIdentifier('mask')
|
||||||
|
;
|
||||||
|
}
|
||||||
|
}
|
||||||
81
src/Chamilo/CoreBundle/Admin/UserGroupAdmin.php
Normal file
81
src/Chamilo/CoreBundle/Admin/UserGroupAdmin.php
Normal file
@@ -0,0 +1,81 @@
|
|||||||
|
<?php
|
||||||
|
/* For licensing terms, see /license.txt */
|
||||||
|
|
||||||
|
namespace Chamilo\CoreBundle\Admin;
|
||||||
|
|
||||||
|
use Chamilo\CoreBundle\Entity\Course;
|
||||||
|
use Sonata\AdminBundle\Admin\AbstractAdmin;
|
||||||
|
use Sonata\AdminBundle\Datagrid\DatagridMapper;
|
||||||
|
use Sonata\AdminBundle\Datagrid\ListMapper;
|
||||||
|
use Sonata\AdminBundle\Form\FormMapper;
|
||||||
|
use Sonata\AdminBundle\Show\ShowMapper;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Class UserGroupAdmin.
|
||||||
|
*
|
||||||
|
* @package Chamilo\CoreBundle\Admin
|
||||||
|
*/
|
||||||
|
class UserGroupAdmin extends AbstractAdmin
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Very important in order to save the related entities!
|
||||||
|
*
|
||||||
|
* @param Course $userGroup
|
||||||
|
*
|
||||||
|
* @return mixed|void
|
||||||
|
*/
|
||||||
|
public function preUpdate($userGroup)
|
||||||
|
{
|
||||||
|
//$userGroup->setUsers($userGroup->getUsers());
|
||||||
|
}
|
||||||
|
|
||||||
|
protected function configureFormFields(FormMapper $formMapper)
|
||||||
|
{
|
||||||
|
$formMapper
|
||||||
|
->add('name')
|
||||||
|
->add('description', 'ckeditor')
|
||||||
|
->add(
|
||||||
|
'users',
|
||||||
|
'sonata_type_collection',
|
||||||
|
[
|
||||||
|
'cascade_validation' => true,
|
||||||
|
],
|
||||||
|
[
|
||||||
|
// 'allow_delete' => true,
|
||||||
|
'by_reference' => false,
|
||||||
|
'edit' => 'inline',
|
||||||
|
'inline' => 'table',
|
||||||
|
//'btn_add' => true,
|
||||||
|
//'multiple' => true
|
||||||
|
//'sortable' => 'position',
|
||||||
|
//'link_parameters' => array('content' => $users),
|
||||||
|
'admin_code' => 'sonata.admin.user_group_rel_user',
|
||||||
|
]
|
||||||
|
)
|
||||||
|
;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected function configureShowField(ShowMapper $showMapper)
|
||||||
|
{
|
||||||
|
$showMapper
|
||||||
|
->add('id', 'text', ['label' => 'Usergroup'])
|
||||||
|
->add('name')
|
||||||
|
;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected function configureDatagridFilters(DatagridMapper $datagridMapper)
|
||||||
|
{
|
||||||
|
$datagridMapper
|
||||||
|
->add('id')
|
||||||
|
->add('name')
|
||||||
|
;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected function configureListFields(ListMapper $listMapper)
|
||||||
|
{
|
||||||
|
$listMapper
|
||||||
|
->addIdentifier('id')
|
||||||
|
->addIdentifier('name')
|
||||||
|
;
|
||||||
|
}
|
||||||
|
}
|
||||||
50
src/Chamilo/CoreBundle/Admin/UsergroupRelUser.php
Normal file
50
src/Chamilo/CoreBundle/Admin/UsergroupRelUser.php
Normal file
@@ -0,0 +1,50 @@
|
|||||||
|
<?php
|
||||||
|
/* For licensing terms, see /license.txt */
|
||||||
|
|
||||||
|
namespace Chamilo\CoreBundle\Admin;
|
||||||
|
|
||||||
|
use Sonata\AdminBundle\Admin\AbstractAdmin;
|
||||||
|
use Sonata\AdminBundle\Datagrid\DatagridMapper;
|
||||||
|
use Sonata\AdminBundle\Datagrid\ListMapper;
|
||||||
|
use Sonata\AdminBundle\Form\FormMapper;
|
||||||
|
use Sonata\AdminBundle\Show\ShowMapper;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Class UsergroupRelUser.
|
||||||
|
*
|
||||||
|
* @package Chamilo\CoreBundle\Admin
|
||||||
|
*/
|
||||||
|
class UsergroupRelUser extends AbstractAdmin
|
||||||
|
{
|
||||||
|
protected function configureFormFields(FormMapper $formMapper)
|
||||||
|
{
|
||||||
|
$formMapper
|
||||||
|
->add('user')
|
||||||
|
->add('usergroup')
|
||||||
|
;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected function configureShowField(ShowMapper $showMapper)
|
||||||
|
{
|
||||||
|
$showMapper
|
||||||
|
->add('user')
|
||||||
|
->add('usergroup')
|
||||||
|
;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected function configureDatagridFilters(DatagridMapper $datagridMapper)
|
||||||
|
{
|
||||||
|
$datagridMapper
|
||||||
|
->add('user')
|
||||||
|
->add('usergroup')
|
||||||
|
;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected function configureListFields(ListMapper $listMapper)
|
||||||
|
{
|
||||||
|
$listMapper
|
||||||
|
->addIdentifier('user')
|
||||||
|
->addIdentifier('usergroup')
|
||||||
|
;
|
||||||
|
}
|
||||||
|
}
|
||||||
28
src/Chamilo/CoreBundle/ChamiloCoreBundle.php
Normal file
28
src/Chamilo/CoreBundle/ChamiloCoreBundle.php
Normal file
@@ -0,0 +1,28 @@
|
|||||||
|
<?php
|
||||||
|
/* For licensing terms, see /license.txt */
|
||||||
|
|
||||||
|
namespace Chamilo\CoreBundle;
|
||||||
|
|
||||||
|
use Chamilo\CoreBundle\DependencyInjection\Compiler\DoctrineEntityListenerPass;
|
||||||
|
use Symfony\Component\DependencyInjection\ContainerBuilder;
|
||||||
|
use Symfony\Component\HttpKernel\Bundle\Bundle;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Class ChamiloCoreBundle.
|
||||||
|
*
|
||||||
|
* @package Chamilo\CoreBundle
|
||||||
|
*/
|
||||||
|
class ChamiloCoreBundle extends Bundle
|
||||||
|
{
|
||||||
|
public function boot()
|
||||||
|
{
|
||||||
|
// Add legacy calls.
|
||||||
|
}
|
||||||
|
|
||||||
|
public function build(ContainerBuilder $container)
|
||||||
|
{
|
||||||
|
parent::build($container);
|
||||||
|
//$container->addCompilerPass(new EntityListenerPass());
|
||||||
|
//$container->addCompilerPass(new DoctrineEntityListenerPass());
|
||||||
|
}
|
||||||
|
}
|
||||||
296
src/Chamilo/CoreBundle/Component/Editor/CkEditor/CkEditor.php
Normal file
296
src/Chamilo/CoreBundle/Component/Editor/CkEditor/CkEditor.php
Normal file
@@ -0,0 +1,296 @@
|
|||||||
|
<?php
|
||||||
|
/* For licensing terms, see /license.txt */
|
||||||
|
|
||||||
|
namespace Chamilo\CoreBundle\Component\Editor\CkEditor;
|
||||||
|
|
||||||
|
use Chamilo\CoreBundle\Component\Editor\Editor;
|
||||||
|
use Chamilo\CoreBundle\Component\Utils\ChamiloApi;
|
||||||
|
|
||||||
|
//use Symfony\Component\Routing\Generator\UrlGenerator;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Class CkEditor.
|
||||||
|
*
|
||||||
|
* @package Chamilo\CoreBundle\Component\Editor\CkEditor
|
||||||
|
*/
|
||||||
|
class CkEditor extends Editor
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
|
public function getEditorTemplate()
|
||||||
|
{
|
||||||
|
return 'javascript/editor/ckeditor/elfinder.tpl';
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set js to be include in the template.
|
||||||
|
*/
|
||||||
|
public function setJavascriptToInclude()
|
||||||
|
{
|
||||||
|
//$jsFolder = api_get_path(WEB_LIBRARY_JS_PATH);
|
||||||
|
//$this->template->addResource($jsFolder.'ckeditor/ckeditor.js', 'js');
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Return the HTML code required to run editor.
|
||||||
|
*
|
||||||
|
* @param string $value
|
||||||
|
*
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
|
public function createHtml($value)
|
||||||
|
{
|
||||||
|
$html = '<textarea id="'.$this->getTextareaId().'" name="'.$this->getName().'" class="ckeditor">
|
||||||
|
'.$value.'
|
||||||
|
</textarea>';
|
||||||
|
$html .= $this->editorReplace();
|
||||||
|
|
||||||
|
return $html;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Return the HTML code required to run editor.
|
||||||
|
*
|
||||||
|
* @param string $value
|
||||||
|
*
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
|
public function createHtmlStyle($value)
|
||||||
|
{
|
||||||
|
$style = '';
|
||||||
|
|
||||||
|
$value = trim($value);
|
||||||
|
|
||||||
|
$defaultValues = [0 => ''];
|
||||||
|
$defaultValues[1] = '<html><head><title></title></head><body></body></html>';
|
||||||
|
$defaultValues[2] = '<!DOCTYPE html>'.$defaultValues[1];
|
||||||
|
$defaultValues[3] = htmlentities($defaultValues[1]);
|
||||||
|
$defaultValues[4] = htmlentities($defaultValues[2]);
|
||||||
|
|
||||||
|
if (in_array($value, $defaultValues)) {
|
||||||
|
$style = api_get_css_asset('bootstrap/dist/css/bootstrap.min.css');
|
||||||
|
$style .= api_get_css_asset('fontawesome/css/font-awesome.min.css');
|
||||||
|
$style .= api_get_css(ChamiloApi::getEditorDocStylePath());
|
||||||
|
$style .= api_get_css_asset('ckeditor/plugins/codesnippet/lib/highlight/styles/default.css');
|
||||||
|
$style .= api_get_asset('ckeditor/plugins/codesnippet/lib/highlight/highlight.pack.js');
|
||||||
|
$style .= '<script>hljs.initHighlightingOnLoad();</script>';
|
||||||
|
}
|
||||||
|
|
||||||
|
$html = '<textarea id="'.$this->getTextareaId().'" name="'.$this->getName().'" class="ckeditor">
|
||||||
|
'.$style.$value.'
|
||||||
|
</textarea>';
|
||||||
|
$html .= $this->editorReplace();
|
||||||
|
|
||||||
|
return $html;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
|
public function editorReplace()
|
||||||
|
{
|
||||||
|
$toolbar = new Toolbar\Basic(
|
||||||
|
$this->toolbarSet,
|
||||||
|
$this->config,
|
||||||
|
'CkEditor'
|
||||||
|
);
|
||||||
|
$toolbar->setLanguage($this->getLocale());
|
||||||
|
$config = $toolbar->getConfig();
|
||||||
|
$javascript = $this->toJavascript($config);
|
||||||
|
|
||||||
|
$html = "<script>
|
||||||
|
CKEDITOR.replace('".$this->getTextareaId()."',
|
||||||
|
$javascript
|
||||||
|
);
|
||||||
|
</script>";
|
||||||
|
|
||||||
|
return $html;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param array $templates
|
||||||
|
*
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
|
public function formatTemplates($templates)
|
||||||
|
{
|
||||||
|
if (empty($templates)) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
/** @var \Chamilo\CoreBundle\Entity\SystemTemplate $template */
|
||||||
|
$templateList = [];
|
||||||
|
$cssTheme = api_get_path(WEB_CSS_PATH).'themes/'.api_get_visual_theme().'/';
|
||||||
|
$search = ['{CSS_THEME}', '{IMG_DIR}', '{REL_PATH}', '{COURSE_DIR}', '{CSS}'];
|
||||||
|
$replace = [
|
||||||
|
$cssTheme,
|
||||||
|
api_get_path(REL_CODE_PATH).'img/',
|
||||||
|
api_get_path(REL_PATH),
|
||||||
|
api_get_path(REL_DEFAULT_COURSE_DOCUMENT_PATH),
|
||||||
|
'',
|
||||||
|
];
|
||||||
|
|
||||||
|
foreach ($templates as $template) {
|
||||||
|
$image = $template->getImage();
|
||||||
|
$image = !empty($image) ? $image : 'empty.gif';
|
||||||
|
|
||||||
|
/*$image = $this->urlGenerator->generate(
|
||||||
|
'get_document_template_action',
|
||||||
|
array('file' => $image),
|
||||||
|
UrlGenerator::ABSOLUTE_URL
|
||||||
|
);*/
|
||||||
|
|
||||||
|
$content = str_replace($search, $replace, $template->getContent());
|
||||||
|
|
||||||
|
$templateList[] = [
|
||||||
|
'title' => $this->translator->trans($template->getTitle()),
|
||||||
|
'description' => $this->translator->trans($template->getComment()),
|
||||||
|
'image' => $image,
|
||||||
|
'html' => $content,
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
return json_encode($templateList);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the templates in JSON format.
|
||||||
|
*
|
||||||
|
* @return string|
|
||||||
|
*/
|
||||||
|
public function simpleFormatTemplates()
|
||||||
|
{
|
||||||
|
$templates = $this->getEmptyTemplate();
|
||||||
|
// The templates are visible for all users in the course
|
||||||
|
if (api_is_allowed_to_edit(false, true) || api_is_allowed_in_course()) {
|
||||||
|
$platformTemplates = $this->getPlatformTemplates();
|
||||||
|
$templates = array_merge($templates, $platformTemplates);
|
||||||
|
}
|
||||||
|
|
||||||
|
$personalTemplates = $this->getPersonalTemplates();
|
||||||
|
$templates = array_merge($templates, $personalTemplates);
|
||||||
|
|
||||||
|
return json_encode($templates);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the empty template.
|
||||||
|
*
|
||||||
|
* @return array
|
||||||
|
*/
|
||||||
|
private function getEmptyTemplate()
|
||||||
|
{
|
||||||
|
return [[
|
||||||
|
'title' => get_lang('EmptyTemplate'),
|
||||||
|
'description' => null,
|
||||||
|
'image' => api_get_path(WEB_HOME_PATH).'default_platform_document/template_thumb/empty.gif',
|
||||||
|
'html' => '
|
||||||
|
<!DOCYTPE html>
|
||||||
|
<html>
|
||||||
|
<head>
|
||||||
|
<meta charset="'.api_get_system_encoding().'" />
|
||||||
|
</head>
|
||||||
|
<body dir="'.api_get_text_direction().'">
|
||||||
|
<p>
|
||||||
|
<br/>
|
||||||
|
</p>
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
|
</html>
|
||||||
|
',
|
||||||
|
]];
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the platform templates.
|
||||||
|
*
|
||||||
|
* @return array
|
||||||
|
*/
|
||||||
|
private function getPlatformTemplates()
|
||||||
|
{
|
||||||
|
if (true === api_get_configuration_value('template_activate_language_filter')) {
|
||||||
|
global $language_interface;
|
||||||
|
|
||||||
|
$courseInfo = api_get_course_info();
|
||||||
|
if (isset($courseInfo['language'])) {
|
||||||
|
$language = $courseInfo['language'];
|
||||||
|
} else {
|
||||||
|
$language = $language_interface;
|
||||||
|
}
|
||||||
|
|
||||||
|
$entityManager = \Database::getManager();
|
||||||
|
$systemTemplates = $entityManager->getRepository('ChamiloCoreBundle:SystemTemplate')->findBy([
|
||||||
|
'language' => $language,
|
||||||
|
]);
|
||||||
|
} else {
|
||||||
|
$entityManager = \Database::getManager();
|
||||||
|
$systemTemplates = $entityManager->getRepository('ChamiloCoreBundle:SystemTemplate')->findAll();
|
||||||
|
}
|
||||||
|
|
||||||
|
$cssTheme = api_get_path(WEB_CSS_PATH).'themes/'.api_get_visual_theme().'/';
|
||||||
|
$search = ['{CSS_THEME}', '{IMG_DIR}', '{REL_PATH}', '{COURSE_DIR}', '{CSS}'];
|
||||||
|
$replace = [
|
||||||
|
$cssTheme,
|
||||||
|
api_get_path(REL_CODE_PATH).'img/',
|
||||||
|
api_get_path(REL_PATH),
|
||||||
|
api_get_path(REL_DEFAULT_COURSE_DOCUMENT_PATH),
|
||||||
|
'',
|
||||||
|
];
|
||||||
|
|
||||||
|
$templateList = [];
|
||||||
|
foreach ($systemTemplates as $template) {
|
||||||
|
$image = $template->getImage();
|
||||||
|
$image = !empty($image) ? $image : 'empty.gif';
|
||||||
|
$image = api_get_path(WEB_HOME_PATH).'default_platform_document/template_thumb/'.$image;
|
||||||
|
$templateContent = $template->getContent();
|
||||||
|
$content = str_replace($search, $replace, $templateContent);
|
||||||
|
$templateList[] = [
|
||||||
|
'title' => get_lang($template->getTitle()),
|
||||||
|
'description' => get_lang($template->getComment()),
|
||||||
|
'image' => $image,
|
||||||
|
'html' => $content,
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
return $templateList;
|
||||||
|
}
|
||||||
|
|
||||||
|
private function getPersonalTemplates($userId = 0)
|
||||||
|
{
|
||||||
|
if (empty($userId)) {
|
||||||
|
$userId = api_get_user_id();
|
||||||
|
}
|
||||||
|
|
||||||
|
$entityManager = \Database::getManager();
|
||||||
|
$templatesRepo = $entityManager->getRepository('ChamiloCoreBundle:Templates');
|
||||||
|
$user = api_get_user_entity($userId);
|
||||||
|
$course = $entityManager->find('ChamiloCoreBundle:Course', api_get_course_int_id());
|
||||||
|
if (!$user || !$course) {
|
||||||
|
return [];
|
||||||
|
}
|
||||||
|
|
||||||
|
$courseTemplates = $templatesRepo->getCourseTemplates($course, $user);
|
||||||
|
$templateList = [];
|
||||||
|
foreach ($courseTemplates as $templateData) {
|
||||||
|
$template = $templateData[0];
|
||||||
|
$courseDirectory = $course->getDirectory();
|
||||||
|
$templateItem = [];
|
||||||
|
$templateItem['title'] = $template->getTitle();
|
||||||
|
$templateItem['description'] = $template->getDescription();
|
||||||
|
$templateItem['image'] = api_get_path(WEB_HOME_PATH).
|
||||||
|
'default_platform_document/template_thumb/noimage.gif';
|
||||||
|
$templateItem['html'] = file_get_contents(api_get_path(SYS_COURSE_PATH)
|
||||||
|
.$courseDirectory.'/document'.$templateData['path']);
|
||||||
|
|
||||||
|
$image = $template->getImage();
|
||||||
|
if (!empty($image)) {
|
||||||
|
$templateItem['image'] = api_get_path(WEB_COURSE_PATH)
|
||||||
|
.$courseDirectory.'/upload/template_thumbnails/'.$template->getImage();
|
||||||
|
}
|
||||||
|
|
||||||
|
$templateList[] = $templateItem;
|
||||||
|
}
|
||||||
|
|
||||||
|
return $templateList;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,140 @@
|
|||||||
|
<?php
|
||||||
|
/* For licensing terms, see /license.txt */
|
||||||
|
|
||||||
|
namespace Chamilo\CoreBundle\Component\Editor\CkEditor\Toolbar;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* AgendaStudent toolbar configuration.
|
||||||
|
*
|
||||||
|
* @package Chamilo\CoreBundle\Component\Editor\CkEditor\Toolbar *
|
||||||
|
*/
|
||||||
|
class AgendaStudent extends Basic
|
||||||
|
{
|
||||||
|
public $plugins = [];
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the toolbar config.
|
||||||
|
*
|
||||||
|
* @return array
|
||||||
|
*/
|
||||||
|
public function getConfig()
|
||||||
|
{
|
||||||
|
if (api_get_setting('more_buttons_maximized_mode') != 'true') {
|
||||||
|
$config['toolbar'] = $this->getNormalToolbar();
|
||||||
|
} else {
|
||||||
|
$config['toolbar_minToolbar'] = $this->getMinimizedToolbar();
|
||||||
|
|
||||||
|
$config['toolbar_maxToolbar'] = $this->getMaximizedToolbar();
|
||||||
|
}
|
||||||
|
|
||||||
|
return $config;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the toolbar configuration when CKEditor is maximized.
|
||||||
|
*
|
||||||
|
* @return array
|
||||||
|
*/
|
||||||
|
protected function getMaximizedToolbar()
|
||||||
|
{
|
||||||
|
return [
|
||||||
|
['Save', 'NewPage', 'Templates', '-', 'Preview', 'Print'],
|
||||||
|
['Cut', 'Copy', 'Paste', 'PasteText', 'PasteFromWord', 'inserthtml'],
|
||||||
|
['Undo', 'Redo', '-', 'SelectAll', 'Find', '-', 'RemoveFormat'],
|
||||||
|
['Link', 'Unlink', 'Anchor', 'Glossary'],
|
||||||
|
[
|
||||||
|
'Image',
|
||||||
|
'Mapping',
|
||||||
|
'Video',
|
||||||
|
'Flash',
|
||||||
|
'Youtube',
|
||||||
|
'Oembed',
|
||||||
|
'Audio',
|
||||||
|
'leaflet',
|
||||||
|
'Smiley',
|
||||||
|
'SpecialChar',
|
||||||
|
'Asciimath',
|
||||||
|
'Asciisvg',
|
||||||
|
],
|
||||||
|
'/',
|
||||||
|
['Table', '-', 'CreateDiv'],
|
||||||
|
[
|
||||||
|
'BulletedList',
|
||||||
|
'NumberedList',
|
||||||
|
'HorizontalRule',
|
||||||
|
'-',
|
||||||
|
'Outdent',
|
||||||
|
'Indent',
|
||||||
|
'Blockquote',
|
||||||
|
],
|
||||||
|
['JustifyLeft', 'JustifyCenter', 'JustifyRight', 'JustifyBlock'],
|
||||||
|
[
|
||||||
|
'Bold',
|
||||||
|
'Italic',
|
||||||
|
'Underline',
|
||||||
|
'Strike',
|
||||||
|
'-',
|
||||||
|
'Subscript',
|
||||||
|
'Superscript',
|
||||||
|
'-',
|
||||||
|
'TextColor',
|
||||||
|
'BGColor',
|
||||||
|
],
|
||||||
|
[api_get_setting('allow_spellcheck') == 'true' ? 'Scayt' : ''],
|
||||||
|
['Styles', 'Format', 'Font', 'FontSize'],
|
||||||
|
['PageBreak', 'ShowBlocks'],
|
||||||
|
['Toolbarswitch'],
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the default toolbar configuration when the setting more_buttons_maximized_mode is false.
|
||||||
|
*
|
||||||
|
* @return array
|
||||||
|
*/
|
||||||
|
protected function getNormalToolbar()
|
||||||
|
{
|
||||||
|
return [
|
||||||
|
['Save', 'Maximize', 'PasteFromWord', '-', 'Undo', 'Redo'],
|
||||||
|
['Link', 'Unlink', 'Anchor', 'inserthtml'],
|
||||||
|
['Image', 'Video', 'Flash', 'Oembed', 'Youtube', 'Audio'],
|
||||||
|
['Table', 'SpecialChar'],
|
||||||
|
'/',
|
||||||
|
['Format', 'Font', 'FontSize'],
|
||||||
|
['Bold', 'Italic', 'Underline'],
|
||||||
|
[
|
||||||
|
'JustifyLeft',
|
||||||
|
'JustifyCenter',
|
||||||
|
'JustifyRight',
|
||||||
|
'-',
|
||||||
|
'NumberedList',
|
||||||
|
'BulletedList',
|
||||||
|
'-',
|
||||||
|
'Outdent',
|
||||||
|
'Indent',
|
||||||
|
'-',
|
||||||
|
'TextColor',
|
||||||
|
'BGColor',
|
||||||
|
],
|
||||||
|
['ShowBlocks'],
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the toolbar configuration when CKEditor is minimized.
|
||||||
|
*
|
||||||
|
* @return array
|
||||||
|
*/
|
||||||
|
protected function getMinimizedToolbar()
|
||||||
|
{
|
||||||
|
return [
|
||||||
|
['Save', 'NewPage', 'Templates', '-', 'PasteFromWord', 'inserthtml'],
|
||||||
|
['Undo', 'Redo'],
|
||||||
|
['Link', 'Image', 'Video', 'Flash', 'Youtube', 'Audio', 'Table', 'Asciimath', 'Asciisvg'],
|
||||||
|
['BulletedList', 'NumberedList', 'HorizontalRule'],
|
||||||
|
['JustifyLeft', 'JustifyCenter', 'JustifyRight'],
|
||||||
|
['Format', 'Font', 'Bold', 'Italic', 'Underline', 'TextColor', 'BGColor'],
|
||||||
|
['Toolbarswitch'],
|
||||||
|
];
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,80 @@
|
|||||||
|
<?php
|
||||||
|
/* For licensing terms, see /license.txt */
|
||||||
|
|
||||||
|
namespace Chamilo\CoreBundle\Component\Editor\CkEditor\Toolbar;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Announcements toolbar configuration.
|
||||||
|
*
|
||||||
|
* @package Chamilo\CoreBundle\Component\Editor\CkEditor\Toolbar *
|
||||||
|
*/
|
||||||
|
class Announcements extends Basic
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Get the toolbar config.
|
||||||
|
*
|
||||||
|
* @return array
|
||||||
|
*/
|
||||||
|
public function getConfig()
|
||||||
|
{
|
||||||
|
if (api_get_setting('more_buttons_maximized_mode') != 'true') {
|
||||||
|
$config['toolbar'] = $this->getNormalToolbar();
|
||||||
|
} else {
|
||||||
|
$config['toolbar_minToolbar'] = $this->getMinimizedToolbar();
|
||||||
|
}
|
||||||
|
|
||||||
|
return $config;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the default toolbar configuration when the setting more_buttons_maximized_mode is false.
|
||||||
|
*
|
||||||
|
* @return array
|
||||||
|
*/
|
||||||
|
protected function getNormalToolbar()
|
||||||
|
{
|
||||||
|
return [
|
||||||
|
['Save', 'Maximize', 'PasteFromWord', '-', 'Undo', 'Redo'],
|
||||||
|
['Link', 'Unlink', 'Anchor', 'inserthtml'],
|
||||||
|
['Image', 'Video', 'Flash', 'Oembed', 'Youtube', 'VimeoEmbed', 'Audio'],
|
||||||
|
['Table', 'SpecialChar'],
|
||||||
|
[
|
||||||
|
'NumberedList',
|
||||||
|
'BulletedList',
|
||||||
|
'-',
|
||||||
|
'Outdent',
|
||||||
|
'Indent',
|
||||||
|
'-',
|
||||||
|
'TextColor',
|
||||||
|
'BGColor',
|
||||||
|
'Source',
|
||||||
|
],
|
||||||
|
'/',
|
||||||
|
['Styles', 'Format', 'Font', 'FontSize'],
|
||||||
|
['Bold', 'Italic', 'Underline'],
|
||||||
|
[
|
||||||
|
'JustifyLeft',
|
||||||
|
'JustifyCenter',
|
||||||
|
'JustifyRight',
|
||||||
|
],
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the toolbar configuration when CKEditor is minimized.
|
||||||
|
*
|
||||||
|
* @return array
|
||||||
|
*/
|
||||||
|
protected function getMinimizedToolbar()
|
||||||
|
{
|
||||||
|
return [
|
||||||
|
$this->getNewPageBlock(),
|
||||||
|
['Undo', 'Redo'],
|
||||||
|
['Link', 'Image', 'Video', 'Flash', 'Audio', 'Table', 'Asciimath', 'Asciisvg'],
|
||||||
|
['BulletedList', 'NumberedList', 'HorizontalRule'],
|
||||||
|
['JustifyLeft', 'JustifyCenter', 'JustifyRight', 'JustifyBlock'],
|
||||||
|
['Styles', 'Format', 'Font', 'FontSize', 'Bold', 'Italic', 'Underline', 'TextColor', 'BGColor', 'Source'],
|
||||||
|
['Toolbarswitch'],
|
||||||
|
];
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,67 @@
|
|||||||
|
<?php
|
||||||
|
/* For licensing terms, see /license.txt */
|
||||||
|
|
||||||
|
namespace Chamilo\CoreBundle\Component\Editor\CkEditor\Toolbar;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* AssessmentsIntroduction toolbar configuration.
|
||||||
|
*
|
||||||
|
* @package Chamilo\CoreBundle\Component\Editor\CkEditor\Toolbar
|
||||||
|
*/
|
||||||
|
class AssessmentsIntroduction extends Basic
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Get the toolbar config.
|
||||||
|
*
|
||||||
|
* @return array
|
||||||
|
*/
|
||||||
|
public function getConfig()
|
||||||
|
{
|
||||||
|
if (api_get_setting('more_buttons_maximized_mode') != 'true') {
|
||||||
|
$config['toolbar'] = $this->getNormalToolbar();
|
||||||
|
} else {
|
||||||
|
$config['toolbar_minToolbar'] = $this->getMinimizedToolbar();
|
||||||
|
}
|
||||||
|
|
||||||
|
return $config;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the default toolbar configuration when the setting more_buttons_maximized_mode is false.
|
||||||
|
*
|
||||||
|
* @return array
|
||||||
|
*/
|
||||||
|
protected function getNormalToolbar()
|
||||||
|
{
|
||||||
|
return [
|
||||||
|
['Save', 'Maximize', '-', 'PasteFromWord', '-', 'Undo', 'Redo'],
|
||||||
|
['Link', 'Unlink', 'Anchor'],
|
||||||
|
['Image', 'Video', 'Flash', 'Oembed', 'Youtube', 'VimeoEmbed', 'Audio'],
|
||||||
|
['Table', 'SpecialChar'],
|
||||||
|
['NumberedList', 'BulletedList', '-', 'Outdent', 'Indent', '-', 'TextColor', 'BGColor'],
|
||||||
|
'/',
|
||||||
|
['Styles', 'Format', 'Font', 'FontSize'],
|
||||||
|
['Bold', 'Italic', 'Underline'],
|
||||||
|
['Subscript', 'Superscript', '-', 'JustifyLeft', 'JustifyCenter', 'JustifyRight', 'JustifyBlock'],
|
||||||
|
['Source'],
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the toolbar configuration when CKEditor is minimized.
|
||||||
|
*
|
||||||
|
* @return array
|
||||||
|
*/
|
||||||
|
protected function getMinimizedToolbar()
|
||||||
|
{
|
||||||
|
return [
|
||||||
|
$this->getNewPageBlock(),
|
||||||
|
['Undo', 'Redo'],
|
||||||
|
['Link', 'Image', 'Video', 'Flash', 'Audio', 'Table', 'Asciimath', 'Asciisvg'],
|
||||||
|
['BulletedList', 'NumberedList', 'HorizontalRule'],
|
||||||
|
['JustifyLeft', 'JustifyCenter', 'JustifyRight', 'JustifyBlock'],
|
||||||
|
['Format', 'Font', 'FontSize', 'Bold', 'Italic', 'Underline', 'TextColor', 'BGColor'],
|
||||||
|
['Toolbarswitch'],
|
||||||
|
];
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,332 @@
|
|||||||
|
<?php
|
||||||
|
/* For licensing terms, see /license.txt */
|
||||||
|
|
||||||
|
namespace Chamilo\CoreBundle\Component\Editor\CkEditor\Toolbar;
|
||||||
|
|
||||||
|
use Chamilo\CoreBundle\Component\Editor\Toolbar;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Class Basic.
|
||||||
|
*
|
||||||
|
* @package Chamilo\CoreBundle\Component\Editor\CkEditor\Toolbar
|
||||||
|
*/
|
||||||
|
class Basic extends Toolbar
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Default plugins that will be use in all toolbars
|
||||||
|
* In order to add a new plugin you have to load it in default/layout/head.tpl.
|
||||||
|
*
|
||||||
|
* @var array
|
||||||
|
*/
|
||||||
|
public $defaultPlugins = [
|
||||||
|
'adobeair',
|
||||||
|
'ajax',
|
||||||
|
'audio',
|
||||||
|
'image2_chamilo', // Replace for 'image' if you want to user the Mapping plugin.
|
||||||
|
'bidi',
|
||||||
|
'colorbutton',
|
||||||
|
'colordialog',
|
||||||
|
'dialogui',
|
||||||
|
'dialogadvtab',
|
||||||
|
'div',
|
||||||
|
//if you activate this plugin the html, head tags will not be saved
|
||||||
|
//'divarea',
|
||||||
|
'docprops',
|
||||||
|
'find',
|
||||||
|
'flash',
|
||||||
|
'font',
|
||||||
|
'iframe',
|
||||||
|
'iframedialog',
|
||||||
|
'indentblock',
|
||||||
|
'justify',
|
||||||
|
'language',
|
||||||
|
'lineutils',
|
||||||
|
'liststyle',
|
||||||
|
'newpage',
|
||||||
|
'oembed',
|
||||||
|
'pagebreak',
|
||||||
|
'preview',
|
||||||
|
'print',
|
||||||
|
'save',
|
||||||
|
'selectall',
|
||||||
|
'sharedspace',
|
||||||
|
'showblocks',
|
||||||
|
'smiley',
|
||||||
|
'sourcedialog',
|
||||||
|
'stylesheetparser',
|
||||||
|
'tableresize',
|
||||||
|
'templates',
|
||||||
|
'uicolor',
|
||||||
|
'video',
|
||||||
|
'widget',
|
||||||
|
'wikilink',
|
||||||
|
'wordcount',
|
||||||
|
'inserthtml',
|
||||||
|
'xml',
|
||||||
|
'qmarkersrolls',
|
||||||
|
'codesnippet',
|
||||||
|
];
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Plugins this toolbar.
|
||||||
|
*
|
||||||
|
* @var array
|
||||||
|
*/
|
||||||
|
public $plugins = [];
|
||||||
|
|
||||||
|
/**
|
||||||
|
* {@inheritdoc}
|
||||||
|
*/
|
||||||
|
public function __construct(
|
||||||
|
$toolbar = null,
|
||||||
|
$config = [],
|
||||||
|
$prefix = null
|
||||||
|
) {
|
||||||
|
$isAllowedToEdit = api_is_allowed_to_edit();
|
||||||
|
$isPlatformAdmin = api_is_platform_admin();
|
||||||
|
|
||||||
|
// Adding plugins depending of platform conditions
|
||||||
|
$plugins = [];
|
||||||
|
|
||||||
|
if (api_get_setting('show_glossary_in_documents') == 'ismanual') {
|
||||||
|
$plugins[] = 'glossary';
|
||||||
|
}
|
||||||
|
|
||||||
|
if (api_get_setting('youtube_for_students') == 'true') {
|
||||||
|
$plugins[] = 'youtube';
|
||||||
|
} else {
|
||||||
|
if ($isAllowedToEdit || $isPlatformAdmin) {
|
||||||
|
$plugins[] = 'youtube';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (api_get_setting('enabled_googlemaps') == 'true') {
|
||||||
|
$plugins[] = 'leaflet';
|
||||||
|
}
|
||||||
|
|
||||||
|
if (api_get_setting('math_asciimathML') == 'true') {
|
||||||
|
$plugins[] = 'asciimath';
|
||||||
|
}
|
||||||
|
|
||||||
|
if (api_get_setting('enabled_mathjax') == 'true') {
|
||||||
|
$plugins[] = 'mathjax';
|
||||||
|
$config['mathJaxLib'] = api_get_path(WEB_PUBLIC_PATH).'assets/MathJax/MathJax.js?config=TeX-MML-AM_HTMLorMML';
|
||||||
|
}
|
||||||
|
|
||||||
|
if (api_get_setting('enabled_asciisvg') == 'true') {
|
||||||
|
$plugins[] = 'asciisvg';
|
||||||
|
}
|
||||||
|
|
||||||
|
if (api_get_setting('enabled_wiris') == 'true') {
|
||||||
|
// New version of wiris needs this plugins before it's loaded
|
||||||
|
$plugins[] = 'widgetselection';
|
||||||
|
$plugins[] = 'panelbutton';
|
||||||
|
|
||||||
|
// Commercial plugin
|
||||||
|
$plugins[] = 'ckeditor_wiris';
|
||||||
|
}
|
||||||
|
|
||||||
|
// Mapping plugin requires Image plugin. But Image2 plugin is activated by default
|
||||||
|
if (api_get_setting('enabled_imgmap') == 'true') {
|
||||||
|
$plugins[] = 'mapping';
|
||||||
|
}
|
||||||
|
|
||||||
|
/*if (api_get_setting('block_copy_paste_for_students') == 'true') {
|
||||||
|
// Missing
|
||||||
|
}*/
|
||||||
|
|
||||||
|
if (api_get_setting('more_buttons_maximized_mode') == 'true') {
|
||||||
|
$plugins[] = 'toolbarswitch';
|
||||||
|
}
|
||||||
|
|
||||||
|
if (api_get_setting('allow_spellcheck') == 'true') {
|
||||||
|
$plugins[] = 'scayt';
|
||||||
|
}
|
||||||
|
|
||||||
|
if (api_get_configuration_sub_value('ckeditor_vimeo_embed/config') && ($isAllowedToEdit || $isPlatformAdmin)) {
|
||||||
|
$plugins[] = 'ckeditor_vimeo_embed';
|
||||||
|
}
|
||||||
|
|
||||||
|
if (api_get_configuration_value('ck_editor_block_image_copy_paste')) {
|
||||||
|
$plugins[] = 'blockimagepaste';
|
||||||
|
}
|
||||||
|
|
||||||
|
// it should be disabled first the option ck_editor_block_image_copy_paste to allow copy and drag in editor content
|
||||||
|
if (api_get_configuration_value('enable_uploadimage_editor')) {
|
||||||
|
$plugins[] = 'uploadimage';
|
||||||
|
}
|
||||||
|
|
||||||
|
$this->defaultPlugins = array_unique(array_merge($this->defaultPlugins, $plugins));
|
||||||
|
|
||||||
|
$editorSettings = api_get_configuration_value('editor_settings');
|
||||||
|
if (!empty($editorSettings) && isset($editorSettings['config']) && !empty($editorSettings['config'])) {
|
||||||
|
$config = array_merge($config, $editorSettings['config']);
|
||||||
|
}
|
||||||
|
|
||||||
|
parent::__construct($toolbar, $config, $prefix);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the toolbar config.
|
||||||
|
*
|
||||||
|
* @return array
|
||||||
|
*/
|
||||||
|
public function getConfig()
|
||||||
|
{
|
||||||
|
$config = [];
|
||||||
|
if (api_get_setting('more_buttons_maximized_mode') === 'true') {
|
||||||
|
$config['toolbar_minToolbar'] = $this->getMinimizedToolbar();
|
||||||
|
$config['toolbar_maxToolbar'] = $this->getMaximizedToolbar();
|
||||||
|
}
|
||||||
|
|
||||||
|
$config['customConfig'] = api_get_path(WEB_LIBRARY_JS_PATH).'ckeditor/config_js.php?'.api_get_cidreq();
|
||||||
|
$config['flash_flvPlayer'] = api_get_path(WEB_LIBRARY_JS_PATH).'ckeditor/plugins/flash/swf/player.swf';
|
||||||
|
|
||||||
|
if (api_get_configuration_value('enable_uploadimage_editor')) {
|
||||||
|
$config['imageUploadUrl'] = api_get_path(WEB_AJAX_PATH).'document.ajax.php?'.api_get_cidreq().'&a=ck_uploadimage';
|
||||||
|
}
|
||||||
|
/*filebrowserFlashBrowseUrl
|
||||||
|
filebrowserFlashUploadUrl
|
||||||
|
filebrowserImageBrowseLinkUrl
|
||||||
|
filebrowserImageBrowseUrl
|
||||||
|
filebrowserImageUploadUrl
|
||||||
|
filebrowserUploadUrl*/
|
||||||
|
|
||||||
|
$config['extraPlugins'] = $this->getPluginsToString();
|
||||||
|
|
||||||
|
//$config['oembed_maxWidth'] = '560';
|
||||||
|
//$config['oembed_maxHeight'] = '315';
|
||||||
|
|
||||||
|
/*$config['wordcount'] = array(
|
||||||
|
// Whether or not you want to show the Word Count
|
||||||
|
'showWordCount' => true,
|
||||||
|
// Whether or not you want to show the Char Count
|
||||||
|
'showCharCount' => true,
|
||||||
|
// Option to limit the characters in the Editor
|
||||||
|
'charLimit' => 'unlimited',
|
||||||
|
// Option to limit the words in the Editor
|
||||||
|
'wordLimit' => 'unlimited'
|
||||||
|
);*/
|
||||||
|
|
||||||
|
$config['skin'] = 'bootstrapck,'.api_get_path(WEB_LIBRARY_JS_PATH).'ckeditor/skins/bootstrapck/';
|
||||||
|
$config['skin'] = 'moono-lisa';
|
||||||
|
|
||||||
|
$config['image2_chamilo_alignClasses'] = [
|
||||||
|
'pull-left',
|
||||||
|
'text-center',
|
||||||
|
'pull-right',
|
||||||
|
'img-va-baseline',
|
||||||
|
'img-va-top',
|
||||||
|
'img-va-bottom',
|
||||||
|
'img-va-middle',
|
||||||
|
'img-va-super',
|
||||||
|
'img-va-sub',
|
||||||
|
'img-va-text-top',
|
||||||
|
'img-va-text-bottom',
|
||||||
|
];
|
||||||
|
$config['startupOutlineBlocks'] = api_get_configuration_value('ckeditor_startup_outline_blocks') === true;
|
||||||
|
|
||||||
|
if (isset($this->config)) {
|
||||||
|
$this->config = array_merge($config, $this->config);
|
||||||
|
} else {
|
||||||
|
$this->config = $config;
|
||||||
|
}
|
||||||
|
|
||||||
|
//$config['width'] = '100';
|
||||||
|
//$config['height'] = '200';
|
||||||
|
return $this->config;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return array
|
||||||
|
*/
|
||||||
|
public function getNewPageBlock()
|
||||||
|
{
|
||||||
|
return ['NewPage', 'Templates', '-', 'PasteFromWord', 'inserthtml'];
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the default toolbar configuration when the setting more_buttons_maximized_mode is false.
|
||||||
|
*
|
||||||
|
* @return array
|
||||||
|
*/
|
||||||
|
protected function getNormalToolbar()
|
||||||
|
{
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the toolbar configuration when CKEditor is minimized.
|
||||||
|
*
|
||||||
|
* @return array
|
||||||
|
*/
|
||||||
|
protected function getMinimizedToolbar()
|
||||||
|
{
|
||||||
|
return [
|
||||||
|
$this->getNewPageBlock(),
|
||||||
|
['Undo', 'Redo'],
|
||||||
|
[
|
||||||
|
'Link',
|
||||||
|
'Image',
|
||||||
|
'Video',
|
||||||
|
'Oembed',
|
||||||
|
'Flash',
|
||||||
|
'Youtube',
|
||||||
|
'VimeoEmbed',
|
||||||
|
'Audio',
|
||||||
|
'Table',
|
||||||
|
'Asciimath',
|
||||||
|
'Asciisvg',
|
||||||
|
],
|
||||||
|
['BulletedList', 'NumberedList', 'HorizontalRule'],
|
||||||
|
['JustifyLeft', 'JustifyCenter', 'JustifyRight', 'JustifyBlock'],
|
||||||
|
['Styles', 'Format', 'Font', 'FontSize', 'Bold', 'Italic', 'Underline', 'TextColor', 'BGColor'],
|
||||||
|
api_get_setting('enabled_wiris') == 'true'
|
||||||
|
? ['ckeditor_wiris_formulaEditor', 'ckeditor_wiris_formulaEditorChemistry']
|
||||||
|
: [''],
|
||||||
|
['Toolbarswitch', 'Source'],
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the toolbar configuration when CKEditor is maximized.
|
||||||
|
*
|
||||||
|
* @return array
|
||||||
|
*/
|
||||||
|
protected function getMaximizedToolbar()
|
||||||
|
{
|
||||||
|
return [
|
||||||
|
$this->getNewPageBlock(),
|
||||||
|
['Cut', 'Copy', 'Paste', 'PasteText', 'PasteFromWord', 'inserthtml'],
|
||||||
|
['Undo', 'Redo', '-', 'SelectAll', 'Find', '-', 'RemoveFormat'],
|
||||||
|
['Link', 'Unlink', 'Anchor', 'Glossary'],
|
||||||
|
[
|
||||||
|
'Image',
|
||||||
|
'Mapping',
|
||||||
|
'Video',
|
||||||
|
'Oembed',
|
||||||
|
'Flash',
|
||||||
|
'Youtube',
|
||||||
|
'VimeoEmbed',
|
||||||
|
'Audio',
|
||||||
|
'leaflet',
|
||||||
|
'Smiley',
|
||||||
|
'SpecialChar',
|
||||||
|
'Asciimath',
|
||||||
|
'Asciisvg',
|
||||||
|
],
|
||||||
|
'/',
|
||||||
|
['Table', '-', 'CreateDiv'],
|
||||||
|
['BulletedList', 'NumberedList', 'HorizontalRule', '-', 'Outdent', 'Indent', 'Blockquote'],
|
||||||
|
['JustifyLeft', 'JustifyCenter', 'JustifyRight', 'JustifyBlock'],
|
||||||
|
['Bold', 'Italic', 'Underline', 'Strike', '-', 'Subscript', 'Superscript', '-', 'TextColor', 'BGColor'],
|
||||||
|
[api_get_setting('allow_spellcheck') == 'true' ? 'Scayt' : ''],
|
||||||
|
['Styles', 'Format', 'Font', 'FontSize'],
|
||||||
|
['PageBreak', 'ShowBlocks'],
|
||||||
|
api_get_setting('enabled_wiris') == 'true'
|
||||||
|
? ['ckeditor_wiris_formulaEditor', 'ckeditor_wiris_formulaEditorChemistry']
|
||||||
|
: [''],
|
||||||
|
['Toolbarswitch', 'Source'],
|
||||||
|
];
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,102 @@
|
|||||||
|
<?php
|
||||||
|
/* For licensing terms, see /license.txt */
|
||||||
|
|
||||||
|
namespace Chamilo\CoreBundle\Component\Editor\CkEditor\Toolbar;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Careers toolbar configuration.
|
||||||
|
*
|
||||||
|
* @package Chamilo\CoreBundle\Component\Editor\CkEditor\Toolbar
|
||||||
|
*/
|
||||||
|
class Careers extends Basic
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Get the toolbar config.
|
||||||
|
*
|
||||||
|
* @return array
|
||||||
|
*/
|
||||||
|
public function getConfig()
|
||||||
|
{
|
||||||
|
if (api_get_setting('more_buttons_maximized_mode') != 'true') {
|
||||||
|
$config['toolbar'] = $this->getNormalToolbar();
|
||||||
|
} else {
|
||||||
|
$config['toolbar_minToolbar'] = $this->getMinimizedToolbar();
|
||||||
|
$config['toolbar_maxToolbar'] = $this->getMaximizedToolbar();
|
||||||
|
}
|
||||||
|
|
||||||
|
return $config;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the toolbar configuration when CKEditor is maximized.
|
||||||
|
*
|
||||||
|
* @return array
|
||||||
|
*/
|
||||||
|
protected function getMaximizedToolbar()
|
||||||
|
{
|
||||||
|
return [
|
||||||
|
['Save', 'NewPage', 'Templates', '-', 'Preview', 'Print'],
|
||||||
|
['Cut', 'Copy', 'Paste', 'PasteText', 'PasteFromWord'],
|
||||||
|
['Undo', 'Redo', '-', 'SelectAll', 'Find', '-', 'RemoveFormat'],
|
||||||
|
['Link', 'Unlink', 'Anchor', 'Glossary'],
|
||||||
|
[
|
||||||
|
'Image',
|
||||||
|
'Mapping',
|
||||||
|
'Video',
|
||||||
|
'Oembed',
|
||||||
|
'Youtube',
|
||||||
|
'VimeoEmbed',
|
||||||
|
'Flash',
|
||||||
|
'Audio',
|
||||||
|
'leaflet',
|
||||||
|
'Smiley',
|
||||||
|
'SpecialChar',
|
||||||
|
],
|
||||||
|
'/',
|
||||||
|
['Table', '-', 'CreateDiv'],
|
||||||
|
['BulletedList', 'NumberedList', 'HorizontalRule', '-', 'Outdent', 'Indent', 'Blockquote'],
|
||||||
|
['JustifyLeft', 'JustifyCenter', 'JustifyRight', 'JustifyBlock'],
|
||||||
|
['Bold', 'Italic', 'Underline', 'Strike', '-', 'Subscript', 'Superscript', '-', 'TextColor', 'BGColor'],
|
||||||
|
[api_get_setting('allow_spellcheck') == 'true' ? 'Scayt' : ''],
|
||||||
|
['Styles', 'Format', 'Font', 'FontSize'],
|
||||||
|
['PageBreak', 'ShowBlocks', 'Source'],
|
||||||
|
['Toolbarswitch'],
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the default toolbar configuration when the setting more_buttons_maximized_mode is false.
|
||||||
|
*
|
||||||
|
* @return array
|
||||||
|
*/
|
||||||
|
protected function getNormalToolbar()
|
||||||
|
{
|
||||||
|
return [
|
||||||
|
['Save', 'NewPage', 'Templates', '-', 'PasteText'],
|
||||||
|
['Undo', 'Redo'],
|
||||||
|
['Link', 'Image', 'Video', 'Flash', 'Audio', 'Table'],
|
||||||
|
['BulletedList', 'NumberedList', 'HorizontalRule'],
|
||||||
|
['JustifyLeft', 'JustifyCenter', 'JustifyRight', 'JustifyBlock'],
|
||||||
|
['Format', 'Font', 'FontSize', 'Bold', 'Italic', 'Underline', 'TextColor', 'BGColor', 'Source'],
|
||||||
|
['Maximize'],
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the toolbar configuration when CKEditor is minimized.
|
||||||
|
*
|
||||||
|
* @return array
|
||||||
|
*/
|
||||||
|
protected function getMinimizedToolbar()
|
||||||
|
{
|
||||||
|
return [
|
||||||
|
$this->getNewPageBlock(),
|
||||||
|
['Undo', 'Redo'],
|
||||||
|
['Link', 'Image', 'Video', 'Flash', 'Youtube', 'VimeoEmbed', 'Audio', 'Table'],
|
||||||
|
['BulletedList', 'NumberedList', 'HorizontalRule'],
|
||||||
|
['JustifyLeft', 'JustifyCenter', 'JustifyRight', 'JustifyBlock'],
|
||||||
|
['Format', 'Font', 'FontSize', 'Bold', 'Italic', 'Underline', 'TextColor', 'BGColor', 'Source'],
|
||||||
|
['Toolbarswitch', 'ShowBlocks'],
|
||||||
|
];
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,190 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
/* For licensing terms, see /license.txt */
|
||||||
|
|
||||||
|
namespace Chamilo\CoreBundle\Component\Editor\CkEditor\Toolbar;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Documents toolbar configuration.
|
||||||
|
*/
|
||||||
|
class Documents extends Basic
|
||||||
|
{
|
||||||
|
public $plugins = [];
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the toolbar config.
|
||||||
|
*
|
||||||
|
* @return array
|
||||||
|
*/
|
||||||
|
public function getConfig()
|
||||||
|
{
|
||||||
|
$config = [];
|
||||||
|
|
||||||
|
if (api_get_setting('more_buttons_maximized_mode') !== 'true') {
|
||||||
|
$config['toolbar'] = $this->getNormalToolbar();
|
||||||
|
} else {
|
||||||
|
$config['toolbar_minToolbar'] = $this->getMinimizedToolbar();
|
||||||
|
$config['toolbar_maxToolbar'] = $this->getMaximizedToolbar();
|
||||||
|
}
|
||||||
|
|
||||||
|
$config['extraPlugins'] = $this->getPluginsToString();
|
||||||
|
$config['fullPage'] = true;
|
||||||
|
|
||||||
|
return $config;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return array
|
||||||
|
*/
|
||||||
|
public function getConditionalPlugins()
|
||||||
|
{
|
||||||
|
$plugins = [];
|
||||||
|
|
||||||
|
if (api_get_setting('show_glossary_in_documents') === 'ismanual') {
|
||||||
|
$plugins[] = 'glossary';
|
||||||
|
}
|
||||||
|
|
||||||
|
return $plugins;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the default toolbar configuration when the setting more_buttons_maximized_mode is false.
|
||||||
|
*
|
||||||
|
* @return array
|
||||||
|
*/
|
||||||
|
protected function getNormalToolbar()
|
||||||
|
{
|
||||||
|
return [
|
||||||
|
['Maximize', 'PasteFromWord', '-', 'Undo', 'Redo'],
|
||||||
|
['Link', 'Unlink', 'Anchor', 'inserthtml', 'Glossary'],
|
||||||
|
[
|
||||||
|
'Image',
|
||||||
|
'Video',
|
||||||
|
'Flash',
|
||||||
|
'Oembed',
|
||||||
|
'Youtube',
|
||||||
|
'VimeoEmbed',
|
||||||
|
'Audio',
|
||||||
|
'Asciimath',
|
||||||
|
'Asciisvg',
|
||||||
|
'CodeSnippet',
|
||||||
|
],
|
||||||
|
['Table', 'SpecialChar'],
|
||||||
|
[
|
||||||
|
'Outdent',
|
||||||
|
'Indent',
|
||||||
|
'-',
|
||||||
|
'TextColor',
|
||||||
|
'BGColor',
|
||||||
|
'-',
|
||||||
|
'NumberedList',
|
||||||
|
'BulletedList',
|
||||||
|
'-',
|
||||||
|
api_get_configuration_value('translate_html') ? 'Language' : '',
|
||||||
|
api_get_setting('allow_spellcheck') === 'true' ? 'Scayt' : '',
|
||||||
|
],
|
||||||
|
'/',
|
||||||
|
['Styles', 'Format', 'Font', 'FontSize'],
|
||||||
|
['Bold', 'Italic', 'Underline'],
|
||||||
|
['JustifyLeft', 'JustifyCenter', 'JustifyRight', 'JustifyBlock'],
|
||||||
|
api_get_setting('enabled_wiris') === 'true' ? ['ckeditor_wiris_formulaEditor', 'ckeditor_wiris_formulaEditorChemistry'] : [''],
|
||||||
|
['Source'],
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return array
|
||||||
|
*/
|
||||||
|
protected function getMaximizedToolbar()
|
||||||
|
{
|
||||||
|
return [
|
||||||
|
array_merge(['Save'], $this->getNewPageBlock()),
|
||||||
|
['Cut', 'Copy', 'Paste', 'PasteText', 'PasteFromWord', 'inserthtml'],
|
||||||
|
['Undo', 'Redo', '-', 'SelectAll', 'Find', '-', 'RemoveFormat'],
|
||||||
|
['Link', 'Unlink', 'Anchor', 'Glossary'],
|
||||||
|
[
|
||||||
|
'Image',
|
||||||
|
'Mapping',
|
||||||
|
'Video',
|
||||||
|
'Oembed',
|
||||||
|
'Flash',
|
||||||
|
'Youtube',
|
||||||
|
'VimeoEmbed',
|
||||||
|
'Audio',
|
||||||
|
'leaflet',
|
||||||
|
'Smiley',
|
||||||
|
'SpecialChar',
|
||||||
|
'Asciimath',
|
||||||
|
'Asciisvg',
|
||||||
|
'CodeSnippet',
|
||||||
|
],
|
||||||
|
'/',
|
||||||
|
['Table', '-', 'CreateDiv'],
|
||||||
|
['BulletedList', 'NumberedList', 'HorizontalRule', '-', 'Outdent', 'Indent', 'Blockquote'],
|
||||||
|
['JustifyLeft', 'JustifyCenter', 'JustifyRight', 'JustifyBlock'],
|
||||||
|
[
|
||||||
|
'Bold',
|
||||||
|
'Italic',
|
||||||
|
'Underline',
|
||||||
|
'Strike',
|
||||||
|
'-',
|
||||||
|
'Subscript',
|
||||||
|
'Superscript',
|
||||||
|
'-',
|
||||||
|
'TextColor',
|
||||||
|
'BGColor',
|
||||||
|
api_get_configuration_value('translate_html') ? 'Language' : '',
|
||||||
|
],
|
||||||
|
[api_get_setting('allow_spellcheck') === 'true' ? 'Scayt' : ''],
|
||||||
|
['Styles', 'Format', 'Font', 'FontSize'],
|
||||||
|
['PageBreak', 'ShowBlocks'],
|
||||||
|
api_get_setting('enabled_wiris') === 'true' ? ['ckeditor_wiris_formulaEditor', 'ckeditor_wiris_formulaEditorChemistry'] : [''],
|
||||||
|
['Toolbarswitch', 'Source'],
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the toolbar configuration when CKEditor is minimized.
|
||||||
|
*
|
||||||
|
* @return array
|
||||||
|
*/
|
||||||
|
protected function getMinimizedToolbar()
|
||||||
|
{
|
||||||
|
return [
|
||||||
|
array_merge(['Save'], $this->getNewPageBlock()),
|
||||||
|
['Undo', 'Redo'],
|
||||||
|
[
|
||||||
|
'Link',
|
||||||
|
'Image',
|
||||||
|
'Video',
|
||||||
|
'Oembed',
|
||||||
|
'Flash',
|
||||||
|
'Youtube',
|
||||||
|
'VimeoEmbed',
|
||||||
|
'Audio',
|
||||||
|
'Table',
|
||||||
|
'Asciimath',
|
||||||
|
'Asciisvg',
|
||||||
|
'CodeSnippet',
|
||||||
|
],
|
||||||
|
['BulletedList', 'NumberedList', 'HorizontalRule'],
|
||||||
|
['JustifyLeft', 'JustifyCenter', 'JustifyRight'],
|
||||||
|
['Styles',
|
||||||
|
'Format',
|
||||||
|
'Font',
|
||||||
|
'FontSize',
|
||||||
|
'Bold',
|
||||||
|
'Italic',
|
||||||
|
'Underline',
|
||||||
|
'TextColor',
|
||||||
|
'BGColor',
|
||||||
|
],
|
||||||
|
[
|
||||||
|
api_get_configuration_value('translate_html') ? 'Language' : '',
|
||||||
|
'ShowBlocks',
|
||||||
|
],
|
||||||
|
api_get_setting('enabled_wiris') === 'true' ? ['ckeditor_wiris_formulaEditor', 'ckeditor_wiris_formulaEditorChemistry'] : [''],
|
||||||
|
['Toolbarswitch', 'Source'],
|
||||||
|
];
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,168 @@
|
|||||||
|
<?php
|
||||||
|
/* For licensing terms, see /license.txt */
|
||||||
|
|
||||||
|
namespace Chamilo\CoreBundle\Component\Editor\CkEditor\Toolbar;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* DocumentsStudent toolbar configuration.
|
||||||
|
*
|
||||||
|
* @package Chamilo\CoreBundle\Component\Editor\CkEditor\Toolbar *
|
||||||
|
*/
|
||||||
|
class DocumentsStudent extends Basic
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Get the toolbar config.
|
||||||
|
*
|
||||||
|
* @return array
|
||||||
|
*/
|
||||||
|
public function getConfig()
|
||||||
|
{
|
||||||
|
if (api_get_setting('more_buttons_maximized_mode') != 'true') {
|
||||||
|
$config['toolbar'] = $this->getNormalToolbar();
|
||||||
|
} else {
|
||||||
|
$config['toolbar_minToolbar'] = $this->getMinimizedToolbar();
|
||||||
|
$config['toolbar_maxToolbar'] = $this->getMaximizedToolbar();
|
||||||
|
}
|
||||||
|
|
||||||
|
$config['extraPlugins'] = $this->getPluginsToString();
|
||||||
|
$config['fullPage'] = true;
|
||||||
|
|
||||||
|
return $config;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the toolbar configuration when CKEditor is maximized.
|
||||||
|
*
|
||||||
|
* @return array
|
||||||
|
*/
|
||||||
|
protected function getMaximizedToolbar()
|
||||||
|
{
|
||||||
|
return [
|
||||||
|
['NewPage', 'Templates', '-', 'Preview', 'Print'],
|
||||||
|
['Cut', 'Copy', 'Paste', 'PasteText', 'PasteFromWord'],
|
||||||
|
['Undo', 'Redo', '-', 'SelectAll', 'Find', '-', 'RemoveFormat'],
|
||||||
|
['Link', 'Unlink', 'Anchor', 'Glossary'],
|
||||||
|
[
|
||||||
|
'Image',
|
||||||
|
'Mapping',
|
||||||
|
'Video',
|
||||||
|
'Oembed',
|
||||||
|
'Youtube',
|
||||||
|
'VimeoEmbed',
|
||||||
|
'Flash',
|
||||||
|
'Audio',
|
||||||
|
'leaflet',
|
||||||
|
'Smiley',
|
||||||
|
'SpecialChar',
|
||||||
|
'Asciimath',
|
||||||
|
'Asciisvg',
|
||||||
|
],
|
||||||
|
'/',
|
||||||
|
['Table', '-', 'CreateDiv'],
|
||||||
|
[
|
||||||
|
'BulletedList',
|
||||||
|
'NumberedList',
|
||||||
|
'HorizontalRule',
|
||||||
|
'-',
|
||||||
|
'Outdent',
|
||||||
|
'Indent',
|
||||||
|
'Blockquote',
|
||||||
|
],
|
||||||
|
['JustifyLeft', 'JustifyCenter', 'JustifyRight', 'JustifyBlock'],
|
||||||
|
[
|
||||||
|
'Bold',
|
||||||
|
'Italic',
|
||||||
|
'Underline',
|
||||||
|
'Strike',
|
||||||
|
'-',
|
||||||
|
'Subscript',
|
||||||
|
'Superscript',
|
||||||
|
'-',
|
||||||
|
'TextColor',
|
||||||
|
'BGColor',
|
||||||
|
],
|
||||||
|
[api_get_setting('allow_spellcheck') == 'true' ? 'Scayt' : ''],
|
||||||
|
['Styles', 'Format', 'Font', 'FontSize'],
|
||||||
|
['PageBreak', 'ShowBlocks'],
|
||||||
|
api_get_setting('enabled_wiris') == 'true' ? ['ckeditor_wiris_formulaEditor', 'ckeditor_wiris_formulaEditorChemistry'] : [''],
|
||||||
|
['Toolbarswitch'],
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the default toolbar configuration when the setting more_buttons_maximized_mode is false.
|
||||||
|
*
|
||||||
|
* @return array
|
||||||
|
*/
|
||||||
|
protected function getNormalToolbar()
|
||||||
|
{
|
||||||
|
return [
|
||||||
|
['Save', 'Maximize', 'PasteFromWord', '-', 'Undo', 'Redo'],
|
||||||
|
['Link', 'Unlink', 'Anchor'],
|
||||||
|
[
|
||||||
|
'Image',
|
||||||
|
'Video',
|
||||||
|
'Flash',
|
||||||
|
'Oembed',
|
||||||
|
'Youtube',
|
||||||
|
'VimeoEmbed',
|
||||||
|
'Audio',
|
||||||
|
'Asciimath',
|
||||||
|
],
|
||||||
|
['Table', 'SpecialChar'],
|
||||||
|
[
|
||||||
|
'Outdent',
|
||||||
|
'Indent',
|
||||||
|
'-',
|
||||||
|
'TextColor',
|
||||||
|
'BGColor',
|
||||||
|
'-',
|
||||||
|
'OrderedList',
|
||||||
|
'UnorderedList',
|
||||||
|
],
|
||||||
|
'/',
|
||||||
|
['Styles', 'Format', 'Font', 'FontSize'],
|
||||||
|
['Bold', 'Italic', 'Underline'],
|
||||||
|
['JustifyLeft', 'JustifyCenter', 'JustifyRight'],
|
||||||
|
api_get_setting('enabled_wiris') == 'true' ? ['ckeditor_wiris_formulaEditor', 'ckeditor_wiris_formulaEditorChemistry'] : [''],
|
||||||
|
['ShowBlocks'],
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the toolbar configuration when CKEditor is minimized.
|
||||||
|
*
|
||||||
|
* @return array
|
||||||
|
*/
|
||||||
|
protected function getMinimizedToolbar()
|
||||||
|
{
|
||||||
|
return [
|
||||||
|
$this->getNewPageBlock(),
|
||||||
|
['Undo', 'Redo'],
|
||||||
|
[
|
||||||
|
'Link',
|
||||||
|
'Image',
|
||||||
|
'Video',
|
||||||
|
'Flash',
|
||||||
|
'Audio',
|
||||||
|
'Table',
|
||||||
|
'Asciimath',
|
||||||
|
'Asciisvg',
|
||||||
|
],
|
||||||
|
['BulletedList', 'NumberedList', 'HorizontalRule'],
|
||||||
|
['JustifyLeft', 'JustifyCenter', 'JustifyRight'],
|
||||||
|
[
|
||||||
|
'Format',
|
||||||
|
'Font',
|
||||||
|
'FontSize',
|
||||||
|
'Bold',
|
||||||
|
'Italic',
|
||||||
|
'Underline',
|
||||||
|
'TextColor',
|
||||||
|
'BGColor',
|
||||||
|
],
|
||||||
|
api_get_setting('enabled_wiris') == 'true' ? ['ckeditor_wiris_formulaEditor', 'ckeditor_wiris_formulaEditorChemistry'] : [''],
|
||||||
|
['Toolbarswitch'],
|
||||||
|
];
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,97 @@
|
|||||||
|
<?php
|
||||||
|
/* For licensing terms, see /license.txt */
|
||||||
|
|
||||||
|
namespace Chamilo\CoreBundle\Component\Editor\CkEditor\Toolbar;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* FAQ toolbar configuration.
|
||||||
|
*
|
||||||
|
* @package Chamilo\CoreBundle\Component\Editor\CkEditor\Toolbar
|
||||||
|
*/
|
||||||
|
class FAQ extends Basic
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Get the toolbar config.
|
||||||
|
*
|
||||||
|
* @return array
|
||||||
|
*/
|
||||||
|
public function getConfig()
|
||||||
|
{
|
||||||
|
if (api_get_setting('more_buttons_maximized_mode') != 'true') {
|
||||||
|
$config['toolbar'] = $this->getNormalToolbar();
|
||||||
|
} else {
|
||||||
|
$config['toolbar_minToolbar'] = $this->getMinimizedToolbar();
|
||||||
|
|
||||||
|
$config['toolbar_maxToolbar'] = $this->getMaximizedToolbar();
|
||||||
|
}
|
||||||
|
|
||||||
|
return $config;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the toolbar configuration when CKEditor is maximized.
|
||||||
|
*
|
||||||
|
* @return array
|
||||||
|
*/
|
||||||
|
protected function getMaximizedToolbar()
|
||||||
|
{
|
||||||
|
return [
|
||||||
|
['NewPage', 'Templates', '-', 'Preview', 'Print'],
|
||||||
|
['Cut', 'Copy', 'Paste', 'PasteText', 'PasteFromWord'],
|
||||||
|
['Undo', 'Redo', '-', 'SelectAll', 'Find', '-', 'RemoveFormat'],
|
||||||
|
['Link', 'Unlink', 'Anchor', 'Glossary'],
|
||||||
|
[
|
||||||
|
'Image',
|
||||||
|
'Mapping',
|
||||||
|
'Video',
|
||||||
|
'Oembed',
|
||||||
|
'Youtube',
|
||||||
|
'VimeoEmbed',
|
||||||
|
'Flash',
|
||||||
|
'Audio',
|
||||||
|
'leaflet',
|
||||||
|
'Smiley',
|
||||||
|
'SpecialChar',
|
||||||
|
],
|
||||||
|
'/',
|
||||||
|
['Table', '-', 'CreateDiv'],
|
||||||
|
['BulletedList', 'NumberedList', 'HorizontalRule', '-', 'Outdent', 'Indent', 'Blockquote'],
|
||||||
|
['JustifyLeft', 'JustifyCenter', 'JustifyRight', 'JustifyBlock'],
|
||||||
|
['Bold', 'Italic', 'Underline', 'Strike', '-', 'Subscript', 'Superscript', '-', 'TextColor', 'BGColor'],
|
||||||
|
[api_get_setting('allow_spellcheck') == 'true' ? 'Scayt' : ''],
|
||||||
|
['Styles', 'Format', 'Font', 'FontSize'],
|
||||||
|
['PageBreak', 'ShowBlocks', 'Source'],
|
||||||
|
['Toolbarswitch'],
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the default toolbar configuration when the setting more_buttons_maximized_mode is false.
|
||||||
|
*
|
||||||
|
* @return array
|
||||||
|
*/
|
||||||
|
protected function getNormalToolbar()
|
||||||
|
{
|
||||||
|
return [
|
||||||
|
['Save', 'Preview', 'Source'],
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the toolbar configuration when CKEditor is minimized.
|
||||||
|
*
|
||||||
|
* @return array
|
||||||
|
*/
|
||||||
|
protected function getMinimizedToolbar()
|
||||||
|
{
|
||||||
|
return [
|
||||||
|
$this->getNewPageBlock(),
|
||||||
|
['Undo', 'Redo'],
|
||||||
|
['Link', 'Image', 'Video', 'Flash', 'Audio', 'Table', 'Asciimath', 'Asciisvg'],
|
||||||
|
['BulletedList', 'NumberedList', 'HorizontalRule'],
|
||||||
|
['JustifyLeft', 'JustifyCenter', 'JustifyRight'],
|
||||||
|
['Format', 'Font', 'Bold', 'Italic', 'Underline', 'TextColor', 'BGColor'],
|
||||||
|
['Toolbarswitch'],
|
||||||
|
];
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,95 @@
|
|||||||
|
<?php
|
||||||
|
/* For licensing terms, see /license.txt */
|
||||||
|
|
||||||
|
namespace Chamilo\CoreBundle\Component\Editor\CkEditor\Toolbar;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Forum toolbar configuration.
|
||||||
|
*
|
||||||
|
* @package Chamilo\CoreBundle\Component\Editor\CkEditor\Toolbar *
|
||||||
|
*/
|
||||||
|
class Forum extends Basic
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Get the toolbar config.
|
||||||
|
*
|
||||||
|
* @return array
|
||||||
|
*/
|
||||||
|
public function getConfig()
|
||||||
|
{
|
||||||
|
if (api_get_setting('more_buttons_maximized_mode') != 'true') {
|
||||||
|
$config['toolbar'] = $this->getNormalToolbar();
|
||||||
|
} else {
|
||||||
|
$config['toolbar_minToolbar'] = $this->getMinimizedToolbar();
|
||||||
|
}
|
||||||
|
|
||||||
|
return $config;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the default toolbar configuration when the setting more_buttons_maximized_mode is false.
|
||||||
|
*
|
||||||
|
* @return array
|
||||||
|
*/
|
||||||
|
protected function getNormalToolbar()
|
||||||
|
{
|
||||||
|
return [
|
||||||
|
['Save', 'Maximize', 'PasteFromWord', '-', 'Undo', 'Redo'],
|
||||||
|
['Link', 'Unlink', 'Anchor'],
|
||||||
|
['Image', 'Video', 'Flash', 'Oembed', 'Youtube', 'VimeoEmbed', 'Audio'],
|
||||||
|
['Table', 'SpecialChar'],
|
||||||
|
[
|
||||||
|
'NumberedList',
|
||||||
|
'BulletedList',
|
||||||
|
'-',
|
||||||
|
'Outdent',
|
||||||
|
'Indent',
|
||||||
|
'-',
|
||||||
|
'TextColor',
|
||||||
|
'BGColor',
|
||||||
|
'Source',
|
||||||
|
],
|
||||||
|
'/',
|
||||||
|
['Styles', 'Format', 'Font', 'FontSize'],
|
||||||
|
['Bold', 'Italic', 'Underline'],
|
||||||
|
[
|
||||||
|
'JustifyLeft',
|
||||||
|
'JustifyCenter',
|
||||||
|
'JustifyRight',
|
||||||
|
'JustifyBlock',
|
||||||
|
],
|
||||||
|
api_get_setting('enabled_wiris') === 'true' ? ['ckeditor_wiris_formulaEditor', 'ckeditor_wiris_formulaEditorChemistry'] : [''],
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the toolbar configuration when CKEditor is minimized.
|
||||||
|
*
|
||||||
|
* @return array
|
||||||
|
*/
|
||||||
|
protected function getMinimizedToolbar()
|
||||||
|
{
|
||||||
|
return [
|
||||||
|
$this->getNewPageBlock(),
|
||||||
|
['Undo', 'Redo'],
|
||||||
|
[
|
||||||
|
'Link',
|
||||||
|
'Image',
|
||||||
|
'Video',
|
||||||
|
'Oembed',
|
||||||
|
'Flash',
|
||||||
|
'Youtube',
|
||||||
|
'VimeoEmbed',
|
||||||
|
'Audio',
|
||||||
|
'Table',
|
||||||
|
'Asciimath',
|
||||||
|
'Asciisvg',
|
||||||
|
],
|
||||||
|
['BulletedList', 'NumberedList', 'HorizontalRule'],
|
||||||
|
['JustifyLeft', 'JustifyCenter', 'JustifyRight'],
|
||||||
|
['Format', 'Font', 'FontSize', 'Bold', 'Italic', 'Underline', 'TextColor', 'BGColor', 'Source'],
|
||||||
|
api_get_setting('enabled_wiris') === 'true' ? ['ckeditor_wiris_formulaEditor', 'ckeditor_wiris_formulaEditorChemistry'] : [''],
|
||||||
|
['Toolbarswitch'],
|
||||||
|
];
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,110 @@
|
|||||||
|
<?php
|
||||||
|
/* For licensing terms, see /license.txt */
|
||||||
|
|
||||||
|
namespace Chamilo\CoreBundle\Component\Editor\CkEditor\Toolbar;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* ForumStudent toolbar configuration.
|
||||||
|
*
|
||||||
|
* @package Chamilo\CoreBundle\Component\Editor\CkEditor\Toolbar *
|
||||||
|
*/
|
||||||
|
class ForumStudent extends Basic
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Get the toolbar config.
|
||||||
|
*
|
||||||
|
* @return array
|
||||||
|
*/
|
||||||
|
public function getConfig()
|
||||||
|
{
|
||||||
|
if (api_get_setting('more_buttons_maximized_mode') != 'true') {
|
||||||
|
$config['toolbar'] = $this->getNormalToolbar();
|
||||||
|
} else {
|
||||||
|
$config['toolbar_minToolbar'] = $this->getMinimizedToolbar();
|
||||||
|
|
||||||
|
$config['toolbar_maxToolbar'] = $this->getMaximizedToolbar();
|
||||||
|
}
|
||||||
|
|
||||||
|
return $config;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the toolbar configuration when CKEditor is maximized.
|
||||||
|
*
|
||||||
|
* @return array
|
||||||
|
*/
|
||||||
|
protected function getMaximizedToolbar()
|
||||||
|
{
|
||||||
|
return [
|
||||||
|
['Save', 'NewPage', 'Templates', '-', 'Preview', 'Print'],
|
||||||
|
['Cut', 'Copy', 'Paste', 'PasteText', 'PasteFromWord'],
|
||||||
|
['Undo', 'Redo', '-', 'SelectAll', 'Find', '-', 'RemoveFormat'],
|
||||||
|
['Link', 'Unlink', 'Anchor', 'Glossary'],
|
||||||
|
[
|
||||||
|
'Image',
|
||||||
|
'Mapping',
|
||||||
|
'Video',
|
||||||
|
'Flash',
|
||||||
|
'Youtube',
|
||||||
|
'Oembed',
|
||||||
|
'Audio',
|
||||||
|
'leaflet',
|
||||||
|
'Smiley',
|
||||||
|
'SpecialChar',
|
||||||
|
'Asciimath',
|
||||||
|
'Asciisvg',
|
||||||
|
],
|
||||||
|
'/',
|
||||||
|
['Table', '-', 'CreateDiv'],
|
||||||
|
['BulletedList', 'NumberedList', 'HorizontalRule', '-', 'Outdent', 'Indent', 'Blockquote'],
|
||||||
|
['JustifyLeft', 'JustifyCenter', 'JustifyRight', 'JustifyBlock'],
|
||||||
|
['Bold', 'Italic', 'Underline', 'Strike', '-', 'Subscript', 'Superscript', '-', 'TextColor', 'BGColor'],
|
||||||
|
[api_get_setting('allow_spellcheck') == 'true' ? 'Scayt' : ''],
|
||||||
|
['Styles', 'Format', 'Font', 'FontSize'],
|
||||||
|
['PageBreak', 'ShowBlocks'],
|
||||||
|
api_get_setting('enabled_wiris') === 'true' ? ['ckeditor_wiris_formulaEditor', 'ckeditor_wiris_formulaEditorChemistry'] : [''],
|
||||||
|
['Toolbarswitch'],
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the default toolbar configuration when the setting more_buttons_maximized_mode is false.
|
||||||
|
*
|
||||||
|
* @return array
|
||||||
|
*/
|
||||||
|
protected function getNormalToolbar()
|
||||||
|
{
|
||||||
|
return [
|
||||||
|
['Save', 'Maximize', 'PasteFromWord', '-', 'Undo', 'Redo'],
|
||||||
|
['Link', 'Unlink', 'Anchor'],
|
||||||
|
['Image', 'Video', 'Flash', 'Oembed', 'Youtube', 'Audio'],
|
||||||
|
['Table', 'SpecialChar'],
|
||||||
|
['NumberedList', 'BulletedList', '-', 'Outdent', 'Indent', '-', 'TextColor', 'BGColor'],
|
||||||
|
'/',
|
||||||
|
['Styles', 'Format', 'Font', 'FontSize'],
|
||||||
|
['Bold', 'Italic', 'Underline'],
|
||||||
|
['JustifyLeft', 'JustifyCenter', 'JustifyRight'],
|
||||||
|
api_get_setting('enabled_wiris') === 'true' ? ['ckeditor_wiris_formulaEditor', 'ckeditor_wiris_formulaEditorChemistry'] : [''],
|
||||||
|
['ShowBlocks'],
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the toolbar configuration when CKEditor is minimized.
|
||||||
|
*
|
||||||
|
* @return array
|
||||||
|
*/
|
||||||
|
protected function getMinimizedToolbar()
|
||||||
|
{
|
||||||
|
return [
|
||||||
|
$this->getNewPageBlock(),
|
||||||
|
['Undo', 'Redo'],
|
||||||
|
['Link', 'Image', 'Video', 'Oembed', 'Flash', 'Youtube', 'Audio', 'Table', 'Asciimath', 'Asciisvg'],
|
||||||
|
['BulletedList', 'NumberedList', 'HorizontalRule'],
|
||||||
|
['JustifyLeft', 'JustifyCenter', 'JustifyRight'],
|
||||||
|
['Format', 'Font', 'FontSize', 'Bold', 'Italic', 'Underline', 'TextColor', 'BGColor'],
|
||||||
|
api_get_setting('enabled_wiris') === 'true' ? ['ckeditor_wiris_formulaEditor', 'ckeditor_wiris_formulaEditorChemistry'] : [''],
|
||||||
|
['Toolbarswitch'],
|
||||||
|
];
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,66 @@
|
|||||||
|
<?php
|
||||||
|
/* For licensing terms, see /license.txt */
|
||||||
|
|
||||||
|
namespace Chamilo\CoreBundle\Component\Editor\CkEditor\Toolbar;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Glossary toolbar configuration.
|
||||||
|
*
|
||||||
|
* @package Chamilo\CoreBundle\Component\Editor\CkEditor\Toolbar
|
||||||
|
*/
|
||||||
|
class Glossary extends Basic
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Get the toolbar config.
|
||||||
|
*
|
||||||
|
* @return array
|
||||||
|
*/
|
||||||
|
public function getConfig()
|
||||||
|
{
|
||||||
|
if (api_get_setting('more_buttons_maximized_mode') != 'true') {
|
||||||
|
$config['toolbar'] = $this->getNormalToolbar();
|
||||||
|
} else {
|
||||||
|
$config['toolbar_minToolbar'] = $this->getMinimizedToolbar();
|
||||||
|
}
|
||||||
|
|
||||||
|
return $config;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the default toolbar configuration when the setting more_buttons_maximized_mode is false.
|
||||||
|
*
|
||||||
|
* @return array
|
||||||
|
*/
|
||||||
|
protected function getNormalToolbar()
|
||||||
|
{
|
||||||
|
return [
|
||||||
|
['Save', 'Maximize', 'PasteFromWord', '-', 'Undo', 'Redo'],
|
||||||
|
['Link', 'Unlink', 'Anchor'],
|
||||||
|
['Image'],
|
||||||
|
['Table', 'SpecialChar'],
|
||||||
|
['NumberedList', 'BulletedList', '-', 'Outdent', 'Indent', '-', 'TextColor', 'BGColor', '-', 'Source'],
|
||||||
|
'/',
|
||||||
|
['Styles', 'Format', 'Font', 'FontSize'],
|
||||||
|
['Bold', 'Italic', 'Underline'],
|
||||||
|
['JustifyLeft', 'JustifyCenter', 'JustifyRight', 'JustifyBlock'],
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the toolbar configuration when CKEditor is minimized.
|
||||||
|
*
|
||||||
|
* @return array
|
||||||
|
*/
|
||||||
|
protected function getMinimizedToolbar()
|
||||||
|
{
|
||||||
|
return [
|
||||||
|
$this->getNewPageBlock(),
|
||||||
|
['Undo', 'Redo'],
|
||||||
|
['Link', 'Image', 'Video', 'Flash', 'Audio', 'Table', 'Asciimath', 'Asciisvg'],
|
||||||
|
['BulletedList', 'NumberedList', 'HorizontalRule'],
|
||||||
|
['JustifyLeft', 'JustifyCenter', 'JustifyRight'],
|
||||||
|
['Format', 'Font', 'Bold', 'Italic', 'Underline', 'TextColor', 'BGColor', 'Source'],
|
||||||
|
['Toolbarswitch'],
|
||||||
|
];
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,188 @@
|
|||||||
|
<?php
|
||||||
|
/* For licensing terms, see /license.txt */
|
||||||
|
|
||||||
|
namespace Chamilo\CoreBundle\Component\Editor\CkEditor\Toolbar;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Documents toolbar configuration.
|
||||||
|
*
|
||||||
|
* @package Chamilo\CoreBundle\Component\Editor\CkEditor\Toolbar
|
||||||
|
*/
|
||||||
|
class IntroductionSection extends Basic
|
||||||
|
{
|
||||||
|
public $plugins = [];
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the toolbar config.
|
||||||
|
*
|
||||||
|
* @return array
|
||||||
|
*/
|
||||||
|
public function getConfig()
|
||||||
|
{
|
||||||
|
$config = [];
|
||||||
|
|
||||||
|
if (api_get_setting('more_buttons_maximized_mode') !== 'true') {
|
||||||
|
$config['toolbar'] = $this->getNormalToolbar();
|
||||||
|
} else {
|
||||||
|
$config['toolbar_minToolbar'] = $this->getMinimizedToolbar();
|
||||||
|
$config['toolbar_maxToolbar'] = $this->getMaximizedToolbar();
|
||||||
|
}
|
||||||
|
|
||||||
|
$config['extraPlugins'] = $this->getPluginsToString();
|
||||||
|
$config['fullPage'] = false;
|
||||||
|
|
||||||
|
return $config;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return array
|
||||||
|
*/
|
||||||
|
public function getConditionalPlugins()
|
||||||
|
{
|
||||||
|
$plugins = [];
|
||||||
|
|
||||||
|
if (api_get_setting('show_glossary_in_documents') === 'ismanual') {
|
||||||
|
$plugins[] = 'glossary';
|
||||||
|
}
|
||||||
|
|
||||||
|
return $plugins;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the default toolbar configuration when the setting more_buttons_maximized_mode is false.
|
||||||
|
*
|
||||||
|
* @return array
|
||||||
|
*/
|
||||||
|
protected function getNormalToolbar()
|
||||||
|
{
|
||||||
|
return [
|
||||||
|
['Maximize', 'PasteFromWord', '-', 'Undo', 'Redo'],
|
||||||
|
['Link', 'Unlink', 'Anchor', 'inserthtml', 'Glossary'],
|
||||||
|
[
|
||||||
|
'Image',
|
||||||
|
'Video',
|
||||||
|
'Flash',
|
||||||
|
'Oembed',
|
||||||
|
'Youtube',
|
||||||
|
'VimeoEmbed',
|
||||||
|
'Audio',
|
||||||
|
'Asciimath',
|
||||||
|
'Asciisvg',
|
||||||
|
],
|
||||||
|
['Table', 'SpecialChar'],
|
||||||
|
[
|
||||||
|
'Outdent',
|
||||||
|
'Indent',
|
||||||
|
'-',
|
||||||
|
'TextColor',
|
||||||
|
'BGColor',
|
||||||
|
'-',
|
||||||
|
'NumberedList',
|
||||||
|
'BulletedList',
|
||||||
|
'-',
|
||||||
|
api_get_configuration_value('translate_html') ? 'Language' : '',
|
||||||
|
api_get_setting('allow_spellcheck') === 'true' ? 'Scayt' : '',
|
||||||
|
],
|
||||||
|
'/',
|
||||||
|
['Styles', 'Format', 'Font', 'FontSize'],
|
||||||
|
['Bold', 'Italic', 'Underline'],
|
||||||
|
['JustifyLeft', 'JustifyCenter', 'JustifyRight'],
|
||||||
|
api_get_setting('enabled_wiris') === 'true' ? ['ckeditor_wiris_formulaEditor', 'ckeditor_wiris_formulaEditorChemistry'] : [''],
|
||||||
|
['Source'],
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the toolbar configuration when CKEditor is minimized.
|
||||||
|
*
|
||||||
|
* @return array
|
||||||
|
*/
|
||||||
|
protected function getMinimizedToolbar()
|
||||||
|
{
|
||||||
|
return [
|
||||||
|
$this->getNewPageBlock(),
|
||||||
|
['Undo', 'Redo'],
|
||||||
|
[
|
||||||
|
'Link',
|
||||||
|
'Image',
|
||||||
|
'Video',
|
||||||
|
'Flash',
|
||||||
|
'Youtube',
|
||||||
|
'VimeoEmbed',
|
||||||
|
'Audio',
|
||||||
|
'Table',
|
||||||
|
'Asciimath',
|
||||||
|
'Asciisvg',
|
||||||
|
],
|
||||||
|
['BulletedList', 'NumberedList', 'HorizontalRule'],
|
||||||
|
['JustifyLeft', 'JustifyCenter', 'JustifyBlock'],
|
||||||
|
[
|
||||||
|
'Styles',
|
||||||
|
'Format',
|
||||||
|
'Font',
|
||||||
|
'FontSize',
|
||||||
|
'Bold',
|
||||||
|
'Italic',
|
||||||
|
'Underline',
|
||||||
|
'TextColor',
|
||||||
|
'BGColor',
|
||||||
|
api_get_configuration_value('translate_html') ? 'Language' : '',
|
||||||
|
],
|
||||||
|
[
|
||||||
|
'ShowBlocks',
|
||||||
|
],
|
||||||
|
api_get_setting('enabled_wiris') === 'true' ? ['ckeditor_wiris_formulaEditor', 'ckeditor_wiris_formulaEditorChemistry'] : [''],
|
||||||
|
['Toolbarswitch', 'Source'],
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return array
|
||||||
|
*/
|
||||||
|
protected function getMaximizedToolbar()
|
||||||
|
{
|
||||||
|
return [
|
||||||
|
$this->getNewPageBlock(),
|
||||||
|
['Cut', 'Copy', 'Paste', 'PasteText', 'PasteFromWord', 'inserthtml'],
|
||||||
|
['Undo', 'Redo', '-', 'SelectAll', 'Find', '-', 'RemoveFormat'],
|
||||||
|
['Link', 'Unlink', 'Anchor', 'Glossary'],
|
||||||
|
[
|
||||||
|
'Image',
|
||||||
|
'Mapping',
|
||||||
|
'Video',
|
||||||
|
'Oembed',
|
||||||
|
'Flash',
|
||||||
|
'Youtube',
|
||||||
|
'VimeoEmbed',
|
||||||
|
'Audio',
|
||||||
|
'leaflet',
|
||||||
|
'Smiley',
|
||||||
|
'SpecialChar',
|
||||||
|
'Asciimath',
|
||||||
|
'Asciisvg',
|
||||||
|
],
|
||||||
|
'/',
|
||||||
|
['Table', '-', 'CreateDiv'],
|
||||||
|
['BulletedList', 'NumberedList', 'HorizontalRule', '-', 'Outdent', 'Indent', 'Blockquote'],
|
||||||
|
['JustifyLeft', 'JustifyCenter', 'JustifyRight', 'JustifyBlock'],
|
||||||
|
[
|
||||||
|
'Bold',
|
||||||
|
'Italic',
|
||||||
|
'Underline',
|
||||||
|
'Strike',
|
||||||
|
'-',
|
||||||
|
'Subscript',
|
||||||
|
'Superscript',
|
||||||
|
'-',
|
||||||
|
'TextColor',
|
||||||
|
'BGColor',
|
||||||
|
api_get_configuration_value('translate_html') ? 'Language' : '',
|
||||||
|
],
|
||||||
|
[api_get_setting('allow_spellcheck') == 'true' ? 'Scayt' : ''],
|
||||||
|
['Styles', 'Format', 'Font', 'FontSize'],
|
||||||
|
['PageBreak', 'ShowBlocks'],
|
||||||
|
api_get_setting('enabled_wiris') == 'true' ? ['ckeditor_wiris_formulaEditor', 'ckeditor_wiris_formulaEditorChemistry'] : [''],
|
||||||
|
['Toolbarswitch', 'Source'],
|
||||||
|
];
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,67 @@
|
|||||||
|
<?php
|
||||||
|
/* For licensing terms, see /license.txt */
|
||||||
|
|
||||||
|
namespace Chamilo\CoreBundle\Component\Editor\CkEditor\Toolbar;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* LearningPathAuthor toolbar configuration.
|
||||||
|
*
|
||||||
|
* @package Chamilo\CoreBundle\Component\Editor\CkEditor\Toolbar
|
||||||
|
*/
|
||||||
|
class LearningPathAuthor extends Basic
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Get the toolbar config.
|
||||||
|
*
|
||||||
|
* @return array
|
||||||
|
*/
|
||||||
|
public function getConfig()
|
||||||
|
{
|
||||||
|
if (api_get_setting('more_buttons_maximized_mode') != 'true') {
|
||||||
|
$config['toolbar'] = $this->getNormalToolbar();
|
||||||
|
} else {
|
||||||
|
$config['toolbar_minToolbar'] = $this->getMinimizedToolbar();
|
||||||
|
$config['toolbar_maxToolbar'] = $this->getMaximizedToolbar();
|
||||||
|
}
|
||||||
|
|
||||||
|
$config['fullPage'] = false;
|
||||||
|
|
||||||
|
return $config;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the toolbar configuration when CKEditor is maximized.
|
||||||
|
*
|
||||||
|
* @return array
|
||||||
|
*/
|
||||||
|
protected function getMaximizedToolbar()
|
||||||
|
{
|
||||||
|
return [
|
||||||
|
['PageBreak', 'ShowBlocks', 'Source'],
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the default toolbar configuration when the setting more_buttons_maximized_mode is false.
|
||||||
|
*
|
||||||
|
* @return array
|
||||||
|
*/
|
||||||
|
protected function getNormalToolbar()
|
||||||
|
{
|
||||||
|
return [
|
||||||
|
['Link', 'Unlink', 'Bold', 'Italic', 'TextColor', 'BGColor', 'Source'],
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the toolbar configuration when CKEditor is minimized.
|
||||||
|
*
|
||||||
|
* @return array
|
||||||
|
*/
|
||||||
|
protected function getMinimizedToolbar()
|
||||||
|
{
|
||||||
|
return [
|
||||||
|
['Link', 'Unlink', 'Bold', 'Italic', 'TextColor', 'BGColor', 'Source'],
|
||||||
|
];
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,135 @@
|
|||||||
|
<?php
|
||||||
|
/* For licensing terms, see /license.txt */
|
||||||
|
|
||||||
|
namespace Chamilo\CoreBundle\Component\Editor\CkEditor\Toolbar;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* LearningPathDocuments toolbar configuration.
|
||||||
|
*
|
||||||
|
* @package Chamilo\CoreBundle\Component\Editor\CkEditor\Toolbar
|
||||||
|
*/
|
||||||
|
class LearningPathDocuments extends Basic
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Get the toolbar config.
|
||||||
|
*
|
||||||
|
* @return array
|
||||||
|
*/
|
||||||
|
public function getConfig()
|
||||||
|
{
|
||||||
|
if (api_get_setting('more_buttons_maximized_mode') !== 'true') {
|
||||||
|
$config['toolbar'] = $this->getNormalToolbar();
|
||||||
|
} else {
|
||||||
|
$config['toolbar_minToolbar'] = $this->getMinimizedToolbar();
|
||||||
|
$config['toolbar_maxToolbar'] = $this->getMaximizedToolbar();
|
||||||
|
}
|
||||||
|
|
||||||
|
$config['fullPage'] = true;
|
||||||
|
|
||||||
|
return $config;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the toolbar configuration when CKEditor is maximized.
|
||||||
|
*
|
||||||
|
* @return array
|
||||||
|
*/
|
||||||
|
protected function getMaximizedToolbar()
|
||||||
|
{
|
||||||
|
return [
|
||||||
|
['Save', 'NewPage', 'Templates', '-', 'Preview', 'Print'],
|
||||||
|
['Cut', 'Copy', 'Paste', 'PasteText', 'PasteFromWord'],
|
||||||
|
['Undo', 'Redo', '-', 'SelectAll', 'Find', '-', 'RemoveFormat'],
|
||||||
|
['Link', 'Unlink', 'Anchor', 'Glossary'],
|
||||||
|
[
|
||||||
|
'Image',
|
||||||
|
'Mapping',
|
||||||
|
'Video',
|
||||||
|
'Oembed',
|
||||||
|
'Youtube',
|
||||||
|
'VimeoEmbed',
|
||||||
|
'Flash',
|
||||||
|
'Audio',
|
||||||
|
'leaflet',
|
||||||
|
'Smiley',
|
||||||
|
'SpecialChar',
|
||||||
|
'Asciimath',
|
||||||
|
'Asciisvg',
|
||||||
|
'CodeSnippet',
|
||||||
|
],
|
||||||
|
'/',
|
||||||
|
['Table', '-', 'CreateDiv'],
|
||||||
|
['BulletedList', 'NumberedList', 'HorizontalRule', '-', 'Outdent', 'Indent', 'Blockquote'],
|
||||||
|
['JustifyLeft', 'JustifyCenter', 'JustifyRight', 'JustifyBlock'],
|
||||||
|
['Bold', 'Italic', 'Underline', 'Strike', '-', 'Subscript', 'Superscript', '-', 'TextColor', 'BGColor'],
|
||||||
|
[api_get_setting('allow_spellcheck') === 'true' ? 'Scayt' : ''],
|
||||||
|
['Styles', 'Format', 'Font', 'FontSize'],
|
||||||
|
api_get_setting('enabled_wiris') === 'true' ? ['ckeditor_wiris_formulaEditor', 'ckeditor_wiris_formulaEditorChemistry'] : [''],
|
||||||
|
['PageBreak', 'ShowBlocks', 'Source'],
|
||||||
|
['Toolbarswitch'],
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the default toolbar configuration when the setting more_buttons_maximized_mode is false.
|
||||||
|
*
|
||||||
|
* @return array
|
||||||
|
*/
|
||||||
|
protected function getNormalToolbar()
|
||||||
|
{
|
||||||
|
return [
|
||||||
|
['Save', 'PasteFromWord', '-', 'Undo', 'Redo'],
|
||||||
|
['Link', 'Unlink', 'Anchor', 'Glossary'],
|
||||||
|
[
|
||||||
|
'Image',
|
||||||
|
'Video',
|
||||||
|
'Flash',
|
||||||
|
'Oembed',
|
||||||
|
'Youtube',
|
||||||
|
'VimeoEmbed',
|
||||||
|
'Audio',
|
||||||
|
'Asciimath',
|
||||||
|
'Asciisvg',
|
||||||
|
'Table',
|
||||||
|
'SpecialChar',
|
||||||
|
'CodeSnippet',
|
||||||
|
],
|
||||||
|
[
|
||||||
|
'Outdent',
|
||||||
|
'Indent',
|
||||||
|
'TextColor',
|
||||||
|
'BGColor',
|
||||||
|
'-',
|
||||||
|
'NumberedList',
|
||||||
|
'BulletedList',
|
||||||
|
'JustifyLeft',
|
||||||
|
'JustifyCenter',
|
||||||
|
'JustifyRight',
|
||||||
|
],
|
||||||
|
'/',
|
||||||
|
['Styles', 'Format', 'Font', 'FontSize'],
|
||||||
|
['Bold', 'Italic', 'Underline', '-', 'Source'],
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the toolbar configuration when CKEditor is minimized.
|
||||||
|
*
|
||||||
|
* @return array
|
||||||
|
*/
|
||||||
|
protected function getMinimizedToolbar()
|
||||||
|
{
|
||||||
|
return [
|
||||||
|
array_merge(['Save'], $this->getNewPageBlock()),
|
||||||
|
['Undo', 'Redo'],
|
||||||
|
['Link', 'Image', 'Video', 'Youtube', 'VimeoEmbed', 'Flash', 'Audio', 'Table', 'Asciimath', 'Asciisvg'],
|
||||||
|
['CodeSnippet'],
|
||||||
|
['BulletedList', 'NumberedList', 'HorizontalRule'],
|
||||||
|
['JustifyLeft', 'JustifyCenter', 'JustifyRight', 'JustifyBlock'],
|
||||||
|
['Toolbarswitch'],
|
||||||
|
['Styles', 'Format', 'Font', 'FontSize', 'Bold', 'Italic', 'Underline', 'TextColor', 'BGColor'],
|
||||||
|
api_get_setting('enabled_wiris') === 'true' ? ['ckeditor_wiris_formulaEditor', 'ckeditor_wiris_formulaEditorChemistry'] : [''],
|
||||||
|
['ShowBlocks', 'Source'],
|
||||||
|
];
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,111 @@
|
|||||||
|
<?php
|
||||||
|
/* For licensing terms, see /license.txt */
|
||||||
|
|
||||||
|
namespace Chamilo\CoreBundle\Component\Editor\CkEditor\Toolbar;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Messages toolbar configuration.
|
||||||
|
*
|
||||||
|
* @package Chamilo\CoreBundle\Component\Editor\CkEditor\Toolbar
|
||||||
|
*/
|
||||||
|
class Messages extends Basic
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Get the toolbar config.
|
||||||
|
*
|
||||||
|
* @return array
|
||||||
|
*/
|
||||||
|
public function getConfig()
|
||||||
|
{
|
||||||
|
$config = [];
|
||||||
|
|
||||||
|
if (api_get_setting('more_buttons_maximized_mode') != 'true') {
|
||||||
|
$config['toolbar'] = $this->getNormalToolbar();
|
||||||
|
} else {
|
||||||
|
$config['toolbar_minToolbar'] = $this->getMinimizedToolbar();
|
||||||
|
$config['toolbar_maxToolbar'] = $this->getMaximizedToolbar();
|
||||||
|
}
|
||||||
|
|
||||||
|
return $config;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the toolbar configuration when CKEditor is maximized.
|
||||||
|
*
|
||||||
|
* @return array
|
||||||
|
*/
|
||||||
|
protected function getMaximizedToolbar()
|
||||||
|
{
|
||||||
|
return [
|
||||||
|
['NewPage', 'Templates', '-', 'Preview', 'Print'],
|
||||||
|
['Cut', 'Copy', 'Paste', 'PasteText', 'PasteFromWord'],
|
||||||
|
['Undo', 'Redo', '-', 'SelectAll', 'Find', '-', 'RemoveFormat'],
|
||||||
|
['Link', 'Unlink', 'Anchor', 'Glossary'],
|
||||||
|
[
|
||||||
|
'Image',
|
||||||
|
'Mapping',
|
||||||
|
'Video',
|
||||||
|
'Oembed',
|
||||||
|
'Youtube',
|
||||||
|
'VimeoEmbed',
|
||||||
|
'Flash',
|
||||||
|
'Audio',
|
||||||
|
'leaflet',
|
||||||
|
'Smiley',
|
||||||
|
'SpecialChar',
|
||||||
|
'Inserthtml',
|
||||||
|
'Asciimath',
|
||||||
|
'Asciisvg',
|
||||||
|
],
|
||||||
|
'/',
|
||||||
|
['Table', '-', 'CreateDiv'],
|
||||||
|
['BulletedList', 'NumberedList', 'HorizontalRule', '-', 'Outdent', 'Indent', 'Blockquote'],
|
||||||
|
['JustifyLeft', 'JustifyCenter', 'JustifyRight', 'JustifyBlock'],
|
||||||
|
['Bold', 'Italic', 'Underline', 'Strike', '-', 'Subscript', 'Superscript', '-', 'TextColor', 'BGColor'],
|
||||||
|
[api_get_setting('allow_spellcheck') == 'true' ? 'Scayt' : ''],
|
||||||
|
['Styles', 'Format', 'Font', 'FontSize'],
|
||||||
|
api_get_setting('enabled_wiris') === 'true' ? ['ckeditor_wiris_formulaEditor', 'ckeditor_wiris_formulaEditorChemistry'] : [''],
|
||||||
|
['PageBreak', 'ShowBlocks', 'Source'],
|
||||||
|
['Toolbarswitch'],
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the default toolbar configuration when the setting more_buttons_maximized_mode is false.
|
||||||
|
*
|
||||||
|
* @return array
|
||||||
|
*/
|
||||||
|
protected function getNormalToolbar()
|
||||||
|
{
|
||||||
|
return [
|
||||||
|
['Link', 'Unlink'],
|
||||||
|
['Image', 'Video', 'Flash', 'Oembed', 'Youtube', 'VimeoEmbed', 'Audio'],
|
||||||
|
['Table', 'Smiley'],
|
||||||
|
['TextColor', 'BGColor'],
|
||||||
|
['Source'],
|
||||||
|
'/',
|
||||||
|
['Font', 'FontSize'],
|
||||||
|
['Bold', 'Italic', 'Underline'],
|
||||||
|
['JustifyLeft', 'JustifyCenter', 'JustifyRight', '-', 'NumberedList', 'BulletedList'],
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the toolbar configuration when CKEditor is minimized.
|
||||||
|
*
|
||||||
|
* @return array
|
||||||
|
*/
|
||||||
|
protected function getMinimizedToolbar()
|
||||||
|
{
|
||||||
|
return [
|
||||||
|
$this->getNewPageBlock(),
|
||||||
|
['Undo', 'Redo'],
|
||||||
|
['Link', 'Image', 'Video', 'Flash', 'Audio', 'Table', 'Asciimath', 'Asciisvg'],
|
||||||
|
['BulletedList', 'NumberedList', 'HorizontalRule'],
|
||||||
|
['JustifyLeft', 'JustifyCenter', 'JustifyRight'],
|
||||||
|
['Styles', 'Format', 'Font', 'Bold', 'Italic', 'Underline', 'TextColor', 'BGColor'],
|
||||||
|
api_get_setting('enabled_wiris') === 'true' ? ['ckeditor_wiris_formulaEditor', 'ckeditor_wiris_formulaEditorChemistry'] : [''],
|
||||||
|
['Toolbarswitch'],
|
||||||
|
];
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,42 @@
|
|||||||
|
<?php
|
||||||
|
/* For licensing terms, see /license.txt */
|
||||||
|
|
||||||
|
namespace Chamilo\CoreBundle\Component\Editor\CkEditor\Toolbar;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* CKEditor Minimal toolbar.
|
||||||
|
*
|
||||||
|
* @package Chamilo\CoreBundle\Component\Editor\CkEditor\Toolbar *
|
||||||
|
*/
|
||||||
|
class Minimal extends Basic
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* @return mixed
|
||||||
|
*/
|
||||||
|
public function getConfig()
|
||||||
|
{
|
||||||
|
$config['toolbar'] = [
|
||||||
|
[
|
||||||
|
'name' => 'clipboard',
|
||||||
|
'groups' => ['clipboard', 'undo'],
|
||||||
|
'items' => ['Cut', 'Copy', 'Paste', '-', 'Undo', 'Redo'],
|
||||||
|
],
|
||||||
|
[
|
||||||
|
'name' => 'basicstyles',
|
||||||
|
'groups' => ['basicstyles', 'cleanup'],
|
||||||
|
'items' => ['Bold', 'Italic', 'Underline', 'Strike', 'TextColor'],
|
||||||
|
],
|
||||||
|
[
|
||||||
|
'name' => 'paragraph',
|
||||||
|
'groups' => ['list', 'indent', 'blocks', 'align', 'bidi'],
|
||||||
|
'items' => ['NumberedList', 'BulletedList', '-', 'Outdent', 'Indent'],
|
||||||
|
],
|
||||||
|
[
|
||||||
|
'name' => 'links',
|
||||||
|
'items' => ['Link', 'Unlink', 'Anchor', 'Source'],
|
||||||
|
],
|
||||||
|
];
|
||||||
|
|
||||||
|
return $config;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,107 @@
|
|||||||
|
<?php
|
||||||
|
/* For licensing terms, see /license.txt */
|
||||||
|
|
||||||
|
namespace Chamilo\CoreBundle\Component\Editor\CkEditor\Toolbar;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* NotebookStudent toolbar configuration.
|
||||||
|
*
|
||||||
|
* @package Chamilo\CoreBundle\Component\Editor\CkEditor\Toolbar
|
||||||
|
*/
|
||||||
|
class NotebookStudent extends Basic
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Get the toolbar config.
|
||||||
|
*
|
||||||
|
* @return array
|
||||||
|
*/
|
||||||
|
public function getConfig()
|
||||||
|
{
|
||||||
|
if (api_get_setting('more_buttons_maximized_mode') != 'true') {
|
||||||
|
$config['toolbar'] = $this->getNormalToolbar();
|
||||||
|
} else {
|
||||||
|
$config['toolbar_minToolbar'] = $this->getMinimizedToolbar();
|
||||||
|
$config['toolbar_maxToolbar'] = $this->getMaximizedToolbar();
|
||||||
|
}
|
||||||
|
|
||||||
|
return $config;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the toolbar configuration when CKEditor is maximized.
|
||||||
|
*
|
||||||
|
* @return array
|
||||||
|
*/
|
||||||
|
protected function getMaximizedToolbar()
|
||||||
|
{
|
||||||
|
return [
|
||||||
|
['Save', 'NewPage', 'Templates', '-', 'Preview', 'Print'],
|
||||||
|
['Cut', 'Copy', 'Paste', 'PasteText', 'PasteFromWord'],
|
||||||
|
['Undo', 'Redo', '-', 'SelectAll', 'Find', '-', 'RemoveFormat'],
|
||||||
|
['Link', 'Unlink', 'Anchor', 'Glossary'],
|
||||||
|
[
|
||||||
|
'Image',
|
||||||
|
'Mapping',
|
||||||
|
'Video',
|
||||||
|
'Oembed',
|
||||||
|
'Youtube',
|
||||||
|
'VimeoEmbed',
|
||||||
|
'Flash',
|
||||||
|
'Audio',
|
||||||
|
'leaflet',
|
||||||
|
'Smiley',
|
||||||
|
'SpecialChar',
|
||||||
|
'Asciimath',
|
||||||
|
'Asciisvg',
|
||||||
|
],
|
||||||
|
'/',
|
||||||
|
['Table', '-', 'CreateDiv'],
|
||||||
|
['BulletedList', 'NumberedList', 'HorizontalRule', '-', 'Outdent', 'Indent', 'Blockquote'],
|
||||||
|
['JustifyLeft', 'JustifyCenter', 'JustifyRight', 'JustifyBlock'],
|
||||||
|
['Bold', 'Italic', 'Underline', 'Strike', '-', 'Subscript', 'Superscript', '-', 'TextColor', 'BGColor'],
|
||||||
|
[api_get_setting('allow_spellcheck') == 'true' ? 'Scayt' : ''],
|
||||||
|
['Styles', 'Format', 'Font', 'FontSize'],
|
||||||
|
['PageBreak', 'ShowBlocks'],
|
||||||
|
['Toolbarswitch'],
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the default toolbar configuration when the setting more_buttons_maximized_mode is false.
|
||||||
|
*
|
||||||
|
* @return array
|
||||||
|
*/
|
||||||
|
protected function getNormalToolbar()
|
||||||
|
{
|
||||||
|
return [
|
||||||
|
['Save', 'Maximize', 'PasteFromWord', '-', 'Undo', 'Redo'],
|
||||||
|
['Link', 'Unlink', 'Anchor'],
|
||||||
|
['Image', 'Video', 'Flash', 'Oembed', 'Youtube', 'VimeoEmbed', 'Audio'],
|
||||||
|
['Table', 'SpecialChar'],
|
||||||
|
['NumberedList', 'BulletedList', '-', 'Outdent', 'Indent', '-', 'TextColor', 'BGColor'],
|
||||||
|
'/',
|
||||||
|
['Styles', 'Format', 'Font', 'FontSize'],
|
||||||
|
['Bold', 'Italic', 'Underline'],
|
||||||
|
['JustifyLeft', 'JustifyCenter', 'JustifyRight'],
|
||||||
|
['ShowBlocks'],
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the toolbar configuration when CKEditor is minimized.
|
||||||
|
*
|
||||||
|
* @return array
|
||||||
|
*/
|
||||||
|
protected function getMinimizedToolbar()
|
||||||
|
{
|
||||||
|
return [
|
||||||
|
$this->getNewPageBlock(),
|
||||||
|
['Undo', 'Redo'],
|
||||||
|
['Link', 'Image', 'Video', 'Flash', 'Audio', 'Table', 'Asciimath', 'Asciisvg'],
|
||||||
|
['BulletedList', 'NumberedList', 'HorizontalRule'],
|
||||||
|
['JustifyLeft', 'JustifyCenter', 'JustifyRight', 'JustifyBlock'],
|
||||||
|
['Format', 'Font', 'FontSize', 'Bold', 'Italic', 'Underline', 'TextColor', 'BGColor'],
|
||||||
|
['Toolbarswitch'],
|
||||||
|
];
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,107 @@
|
|||||||
|
<?php
|
||||||
|
/* For licensing terms, see /license.txt */
|
||||||
|
|
||||||
|
namespace Chamilo\CoreBundle\Component\Editor\CkEditor\Toolbar;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* PortalNews toolbar configuration.
|
||||||
|
*
|
||||||
|
* @package Chamilo\CoreBundle\Component\Editor\CkEditor\Toolbar
|
||||||
|
*/
|
||||||
|
class PortalNews extends Basic
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Get the toolbar config.
|
||||||
|
*
|
||||||
|
* @return array
|
||||||
|
*/
|
||||||
|
public function getConfig()
|
||||||
|
{
|
||||||
|
if (api_get_setting('more_buttons_maximized_mode') != 'true') {
|
||||||
|
$config['toolbar'] = $this->getNormalToolbar();
|
||||||
|
} else {
|
||||||
|
$config['toolbar_minToolbar'] = $this->getMinimizedToolbar();
|
||||||
|
$config['toolbar_maxToolbar'] = $this->getMaximizedToolbar();
|
||||||
|
}
|
||||||
|
|
||||||
|
return $config;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the toolbar configuration when CKEditor is maximized.
|
||||||
|
*
|
||||||
|
* @return array
|
||||||
|
*/
|
||||||
|
protected function getMaximizedToolbar()
|
||||||
|
{
|
||||||
|
return [
|
||||||
|
['NewPage', 'Templates', '-', 'Preview', 'Print'],
|
||||||
|
['Cut', 'Copy', 'Paste', 'PasteText', 'PasteFromWord'],
|
||||||
|
['Undo', 'Redo', '-', 'SelectAll', 'Find', '-', 'RemoveFormat'],
|
||||||
|
['Link', 'Unlink', 'Anchor', 'Glossary'],
|
||||||
|
[
|
||||||
|
'Image',
|
||||||
|
'Mapping',
|
||||||
|
'Video',
|
||||||
|
'Oembed',
|
||||||
|
'Youtube',
|
||||||
|
'VimeoEmbed',
|
||||||
|
'Flash',
|
||||||
|
'Audio',
|
||||||
|
'leaflet',
|
||||||
|
'Smiley',
|
||||||
|
'SpecialChar',
|
||||||
|
'Inserthtml',
|
||||||
|
'Asciimath',
|
||||||
|
'Asciisvg',
|
||||||
|
],
|
||||||
|
'/',
|
||||||
|
['Table', '-', 'CreateDiv'],
|
||||||
|
['BulletedList', 'NumberedList', 'HorizontalRule', '-', 'Outdent', 'Indent', 'Blockquote'],
|
||||||
|
['JustifyLeft', 'JustifyCenter', 'JustifyRight', 'JustifyBlock'],
|
||||||
|
['Bold', 'Italic', 'Underline', 'Strike', '-', 'Subscript', 'Superscript', '-', 'TextColor', 'BGColor'],
|
||||||
|
[api_get_setting('allow_spellcheck') == 'true' ? 'Scayt' : ''],
|
||||||
|
['Styles', 'Format', 'Font', 'FontSize'],
|
||||||
|
['PageBreak', 'ShowBlocks', 'Source'],
|
||||||
|
['Toolbarswitch'],
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the default toolbar configuration when the setting more_buttons_maximized_mode is false.
|
||||||
|
*
|
||||||
|
* @return array
|
||||||
|
*/
|
||||||
|
protected function getNormalToolbar()
|
||||||
|
{
|
||||||
|
return [
|
||||||
|
['Save', 'Maximize', 'PasteFromWord', '-', 'Undo', 'Redo'],
|
||||||
|
['Link', 'Unlink', 'Anchor'],
|
||||||
|
['Image', 'Video', 'Flash', 'Oembed', 'Youtube', 'VimeoEmbed', 'Audio'],
|
||||||
|
['Table', 'SpecialChar'],
|
||||||
|
['NumberedList', 'BulletedList', '-', 'Outdent', 'Indent', '-', 'TextColor', 'BGColor', '-', 'Source'],
|
||||||
|
'/',
|
||||||
|
['Styles', 'Format', 'Font', 'FontSize'],
|
||||||
|
['Bold', 'Italic', 'Underline'],
|
||||||
|
['JustifyLeft', 'JustifyCenter', 'JustifyRight'],
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the toolbar configuration when CKEditor is minimized.
|
||||||
|
*
|
||||||
|
* @return array
|
||||||
|
*/
|
||||||
|
protected function getMinimizedToolbar()
|
||||||
|
{
|
||||||
|
return [
|
||||||
|
$this->getNewPageBlock(),
|
||||||
|
['Undo', 'Redo'],
|
||||||
|
['Link', 'Image', 'Video', 'Flash', 'Audio', 'Table', 'Asciimath', 'Asciisvg'],
|
||||||
|
['BulletedList', 'NumberedList', 'HorizontalRule'],
|
||||||
|
['JustifyLeft', 'JustifyCenter', 'JustifyRight', 'JustifyBlock'],
|
||||||
|
['Styles', 'Format', 'Font', 'FontSize', 'Bold', 'Italic', 'Underline', 'TextColor', 'BGColor', 'Source'],
|
||||||
|
['Toolbarswitch'],
|
||||||
|
];
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,104 @@
|
|||||||
|
<?php
|
||||||
|
/* For licensing terms, see /license.txt */
|
||||||
|
|
||||||
|
namespace Chamilo\CoreBundle\Component\Editor\CkEditor\Toolbar;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Profile toolbar configuration.
|
||||||
|
*
|
||||||
|
* @package Chamilo\CoreBundle\Component\Editor\CkEditor\Toolbar
|
||||||
|
*/
|
||||||
|
class Profile extends Basic
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Get the toolbar config.
|
||||||
|
*
|
||||||
|
* @return array
|
||||||
|
*/
|
||||||
|
public function getConfig()
|
||||||
|
{
|
||||||
|
if (api_get_setting('more_buttons_maximized_mode') != 'true') {
|
||||||
|
$config['toolbar'] = $this->getNormalToolbar();
|
||||||
|
} else {
|
||||||
|
$config['toolbar_minToolbar'] = $this->getMinimizedToolbar();
|
||||||
|
$config['toolbar_maxToolbar'] = $this->getMaximizedToolbar();
|
||||||
|
}
|
||||||
|
|
||||||
|
return $config;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the toolbar configuration when CKEditor is maximized.
|
||||||
|
*
|
||||||
|
* @return array
|
||||||
|
*/
|
||||||
|
protected function getMaximizedToolbar()
|
||||||
|
{
|
||||||
|
return [
|
||||||
|
['NewPage', 'Templates', '-', 'Preview', 'Print'],
|
||||||
|
['Cut', 'Copy', 'Paste', 'PasteText', 'PasteFromWord'],
|
||||||
|
['Undo', 'Redo', '-', 'SelectAll', 'Find', '-', 'RemoveFormat'],
|
||||||
|
['Link', 'Unlink', 'Anchor', 'Glossary'],
|
||||||
|
[
|
||||||
|
'Image',
|
||||||
|
'Mapping',
|
||||||
|
'Video',
|
||||||
|
'Oembed',
|
||||||
|
'Youtube',
|
||||||
|
'VimeoEmbed',
|
||||||
|
'Flash',
|
||||||
|
'Audio',
|
||||||
|
'leaflet',
|
||||||
|
'Smiley',
|
||||||
|
'SpecialChar',
|
||||||
|
],
|
||||||
|
'/',
|
||||||
|
['Table', '-', 'CreateDiv'],
|
||||||
|
['BulletedList', 'NumberedList', 'HorizontalRule', '-', 'Outdent', 'Indent', 'Blockquote'],
|
||||||
|
['JustifyLeft', 'JustifyCenter', 'JustifyRight', 'JustifyBlock'],
|
||||||
|
['Bold', 'Italic', 'Underline', 'Strike', '-', 'Subscript', 'Superscript', '-', 'TextColor', 'BGColor'],
|
||||||
|
[api_get_setting('allow_spellcheck') == 'true' ? 'Scayt' : ''],
|
||||||
|
['Styles', 'Format', 'Font', 'FontSize'],
|
||||||
|
['PageBreak', 'ShowBlocks', 'Source'],
|
||||||
|
['Toolbarswitch'],
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the default toolbar configuration when the setting more_buttons_maximized_mode is false.
|
||||||
|
*
|
||||||
|
* @return array
|
||||||
|
*/
|
||||||
|
protected function getNormalToolbar()
|
||||||
|
{
|
||||||
|
return [
|
||||||
|
['Maximize', '-', 'PasteFromWord', '-', 'Undo', 'Redo'],
|
||||||
|
['Link', 'Unlink', 'Anchor'],
|
||||||
|
['Image', 'Video', 'Flash', 'Oembed', 'Youtube', 'VimeoEmbed', 'Audio'],
|
||||||
|
['Table', 'Smiley'],
|
||||||
|
'/',
|
||||||
|
['Font', 'FontSize'],
|
||||||
|
['Bold', 'Italic', 'Underline'],
|
||||||
|
['JustifyLeft', 'JustifyCenter', 'JustifyRight', '-', 'NumberedList', 'BulletedList', '-', 'TextColor', 'BGColor'],
|
||||||
|
['Source'],
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the toolbar configuration when CKEditor is minimized.
|
||||||
|
*
|
||||||
|
* @return array
|
||||||
|
*/
|
||||||
|
protected function getMinimizedToolbar()
|
||||||
|
{
|
||||||
|
return [
|
||||||
|
$this->getNewPageBlock(),
|
||||||
|
['Undo', 'Redo'],
|
||||||
|
['Link', 'Image', 'Video', 'Flash', 'Audio', 'Table', 'Asciimath'],
|
||||||
|
['BulletedList', 'NumberedList', 'HorizontalRule'],
|
||||||
|
['JustifyLeft', 'JustifyCenter', 'JustifyRight'],
|
||||||
|
['Format', 'Font', 'Bold', 'Italic', 'Underline', 'TextColor', 'BGColor'],
|
||||||
|
['Toolbarswitch'],
|
||||||
|
];
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,104 @@
|
|||||||
|
<?php
|
||||||
|
/* For licensing terms, see /license.txt */
|
||||||
|
|
||||||
|
namespace Chamilo\CoreBundle\Component\Editor\CkEditor\Toolbar;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Project toolbar configuration.
|
||||||
|
*
|
||||||
|
* @package Chamilo\CoreBundle\Component\Editor\CkEditor\Toolbar
|
||||||
|
*/
|
||||||
|
class Project extends Basic
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Get the toolbar config.
|
||||||
|
*
|
||||||
|
* @return array
|
||||||
|
*/
|
||||||
|
public function getConfig()
|
||||||
|
{
|
||||||
|
if (api_get_setting('more_buttons_maximized_mode') != 'true') {
|
||||||
|
$config['toolbar'] = $this->getNormalToolbar();
|
||||||
|
} else {
|
||||||
|
$config['toolbar_minToolbar'] = $this->getMinimizedToolbar();
|
||||||
|
$config['toolbar_maxToolbar'] = $this->getMaximizedToolbar();
|
||||||
|
}
|
||||||
|
|
||||||
|
return $config;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the toolbar configuration when CKEditor is maximized.
|
||||||
|
*
|
||||||
|
* @return array
|
||||||
|
*/
|
||||||
|
protected function getMaximizedToolbar()
|
||||||
|
{
|
||||||
|
return [
|
||||||
|
['Save', 'NewPage', 'Templates', '-', 'Preview', 'Print'],
|
||||||
|
['Cut', 'Copy', 'Paste', 'PasteText', 'PasteFromWord'],
|
||||||
|
['Undo', 'Redo', '-', 'SelectAll', 'Find', '-', 'RemoveFormat'],
|
||||||
|
['Link', 'Unlink', 'Anchor', 'Glossary'],
|
||||||
|
[
|
||||||
|
'Image',
|
||||||
|
'Mapping',
|
||||||
|
'Video',
|
||||||
|
'Oembed',
|
||||||
|
'Youtube',
|
||||||
|
'VimeoEmbed',
|
||||||
|
'Flash',
|
||||||
|
'Audio',
|
||||||
|
'leaflet',
|
||||||
|
'Smiley',
|
||||||
|
'SpecialChar',
|
||||||
|
'Asciimath',
|
||||||
|
],
|
||||||
|
'/',
|
||||||
|
['Table', '-', 'CreateDiv'],
|
||||||
|
['BulletedList', 'NumberedList', 'HorizontalRule', '-', 'Outdent', 'Indent', 'Blockquote'],
|
||||||
|
['JustifyLeft', 'JustifyCenter', 'JustifyRight', 'JustifyBlock'],
|
||||||
|
['Bold', 'Italic', 'Underline', 'Strike', '-', 'Subscript', 'Superscript', '-', 'TextColor', 'BGColor'],
|
||||||
|
[api_get_setting('allow_spellcheck') == 'true' ? 'Scayt' : ''],
|
||||||
|
['Styles', 'Format', 'Font', 'FontSize'],
|
||||||
|
['PageBreak', 'ShowBlocks', 'Source'],
|
||||||
|
['Toolbarswitch'],
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the default toolbar configuration when the setting more_buttons_maximized_mode is false.
|
||||||
|
*
|
||||||
|
* @return array
|
||||||
|
*/
|
||||||
|
protected function getNormalToolbar()
|
||||||
|
{
|
||||||
|
return [
|
||||||
|
['Maximize', '-', 'PasteFromWord', '-', 'Undo', 'Redo'],
|
||||||
|
['Link', 'Unlink', 'Anchor'],
|
||||||
|
['Image', 'Video', 'Flash', 'Oembed', 'Youtube', 'VimeoEmbed', 'Audio'],
|
||||||
|
['Table', 'leaflet'],
|
||||||
|
['Font', 'FontSize'],
|
||||||
|
['Bold', 'Italic', 'Underline'],
|
||||||
|
['JustifyLeft', 'JustifyCenter', 'JustifyRight', '-', 'NumberedList', 'BulletedList', '-', 'TextColor', 'BGColor'],
|
||||||
|
['Source'],
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the toolbar configuration when CKEditor is minimized.
|
||||||
|
*
|
||||||
|
* @return array
|
||||||
|
*/
|
||||||
|
protected function getMinimizedToolbar()
|
||||||
|
{
|
||||||
|
return [
|
||||||
|
$this->getNewPageBlock(),
|
||||||
|
['Undo', 'Redo'],
|
||||||
|
['Link', 'Image', 'Video', 'Flash', 'Audio', 'Table', 'Asciimath'],
|
||||||
|
['BulletedList', 'NumberedList', 'HorizontalRule'],
|
||||||
|
['JustifyLeft', 'JustifyCenter', 'JustifyRight'],
|
||||||
|
['Format', 'Font', 'FontSize', 'Bold', 'Italic', 'TextColor', 'BGColor', 'Source'],
|
||||||
|
['Toolbarswitch'],
|
||||||
|
];
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,103 @@
|
|||||||
|
<?php
|
||||||
|
/* For licensing terms, see /license.txt */
|
||||||
|
|
||||||
|
namespace Chamilo\CoreBundle\Component\Editor\CkEditor\Toolbar;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* ProjectComment toolbar configuration.
|
||||||
|
*
|
||||||
|
* @package Chamilo\CoreBundle\Component\Editor\CkEditor\Toolbar
|
||||||
|
*/
|
||||||
|
class ProjectComment extends Basic
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Get the toolbar config.
|
||||||
|
*
|
||||||
|
* @return array
|
||||||
|
*/
|
||||||
|
public function getConfig()
|
||||||
|
{
|
||||||
|
if (api_get_setting('more_buttons_maximized_mode') != 'true') {
|
||||||
|
$config['toolbar'] = $this->getNormalToolbar();
|
||||||
|
} else {
|
||||||
|
$config['toolbar_minToolbar'] = $this->getMinimizedToolbar();
|
||||||
|
$config['toolbar_maxToolbar'] = $this->getMaximizedToolbar();
|
||||||
|
}
|
||||||
|
|
||||||
|
return $config;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the toolbar configuration when CKEditor is maximized.
|
||||||
|
*
|
||||||
|
* @return array
|
||||||
|
*/
|
||||||
|
protected function getMaximizedToolbar()
|
||||||
|
{
|
||||||
|
return [
|
||||||
|
['Save', 'NewPage', 'Templates', '-', 'Preview', 'Print'],
|
||||||
|
['Cut', 'Copy', 'Paste', 'PasteText', 'PasteFromWord'],
|
||||||
|
['Undo', 'Redo', '-', 'SelectAll', 'Find', '-', 'RemoveFormat'],
|
||||||
|
['Link', 'Unlink', 'Anchor', 'Glossary'],
|
||||||
|
[
|
||||||
|
'Image',
|
||||||
|
'Mapping',
|
||||||
|
'Video',
|
||||||
|
'Oembed',
|
||||||
|
'Youtube',
|
||||||
|
'VimeoEmbed',
|
||||||
|
'Flash',
|
||||||
|
'Audio',
|
||||||
|
'leaflet',
|
||||||
|
'Smiley',
|
||||||
|
'SpecialChar',
|
||||||
|
'Asciimath',
|
||||||
|
],
|
||||||
|
'/',
|
||||||
|
['Table', '-', 'CreateDiv'],
|
||||||
|
['BulletedList', 'NumberedList', 'HorizontalRule', '-', 'Outdent', 'Indent', 'Blockquote'],
|
||||||
|
['JustifyLeft', 'JustifyCenter', 'JustifyRight', 'JustifyBlock'],
|
||||||
|
['Bold', 'Italic', 'Underline', 'Strike', '-', 'Subscript', 'Superscript', '-', 'TextColor', 'BGColor'],
|
||||||
|
[api_get_setting('allow_spellcheck') == 'true' ? 'Scayt' : ''],
|
||||||
|
['Styles', 'Format', 'Font', 'FontSize'],
|
||||||
|
['PageBreak', 'ShowBlocks', 'Source'],
|
||||||
|
['Toolbarswitch'],
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the default toolbar configuration when the setting more_buttons_maximized_mode is false.
|
||||||
|
*
|
||||||
|
* @return array
|
||||||
|
*/
|
||||||
|
protected function getNormalToolbar()
|
||||||
|
{
|
||||||
|
return [
|
||||||
|
['Maximize', '-', 'PasteFromWord', '-', 'Undo', 'Redo'],
|
||||||
|
['Link', 'Unlink'],
|
||||||
|
['Image', 'Video', 'Flash', 'Oembed', 'Youtube', 'VimeoEmbed', 'Audio'],
|
||||||
|
['Table', 'leaflet'],
|
||||||
|
['Bold', 'Italic', 'Underline'],
|
||||||
|
['JustifyLeft', 'JustifyCenter', 'JustifyRight', '-', 'NumberedList', 'BulletedList', '-', 'TextColor', 'BGColor'],
|
||||||
|
['Source'],
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the toolbar configuration when CKEditor is minimized.
|
||||||
|
*
|
||||||
|
* @return array
|
||||||
|
*/
|
||||||
|
protected function getMinimizedToolbar()
|
||||||
|
{
|
||||||
|
return [
|
||||||
|
$this->getNewPageBlock(),
|
||||||
|
['Undo', 'Redo'],
|
||||||
|
['Link', 'Image', 'Video', 'Flash', 'Audio', 'Table', 'Asciimath'],
|
||||||
|
['BulletedList', 'NumberedList', 'HorizontalRule'],
|
||||||
|
['JustifyLeft', 'JustifyCenter', 'JustifyRight'],
|
||||||
|
['Format', 'Font', 'FontSize', 'Bold', 'Italic', 'TextColor'],
|
||||||
|
['Toolbarswitch'],
|
||||||
|
];
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,102 @@
|
|||||||
|
<?php
|
||||||
|
/* For licensing terms, see /license.txt */
|
||||||
|
|
||||||
|
namespace Chamilo\CoreBundle\Component\Editor\CkEditor\Toolbar;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* ProjectCommentStudent toolbar configuration.
|
||||||
|
*
|
||||||
|
* @package Chamilo\CoreBundle\Component\Editor\CkEditor\Toolbar
|
||||||
|
*/
|
||||||
|
class ProjectCommentStudent extends Basic
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Get the toolbar config.
|
||||||
|
*
|
||||||
|
* @return array
|
||||||
|
*/
|
||||||
|
public function getConfig()
|
||||||
|
{
|
||||||
|
if (api_get_setting('more_buttons_maximized_mode') != 'true') {
|
||||||
|
$config['toolbar'] = $this->getNormalToolbar();
|
||||||
|
} else {
|
||||||
|
$config['toolbar_minToolbar'] = $this->getMinimizedToolbar();
|
||||||
|
$config['toolbar_maxToolbar'] = $this->getMaximizedToolbar();
|
||||||
|
}
|
||||||
|
|
||||||
|
return $config;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the toolbar configuration when CKEditor is maximized.
|
||||||
|
*
|
||||||
|
* @return array
|
||||||
|
*/
|
||||||
|
protected function getMaximizedToolbar()
|
||||||
|
{
|
||||||
|
return [
|
||||||
|
['Save', 'NewPage', 'Templates', '-', 'Preview', 'Print'],
|
||||||
|
['Cut', 'Copy', 'Paste', 'PasteText', 'PasteFromWord'],
|
||||||
|
['Undo', 'Redo', '-', 'SelectAll', 'Find', '-', 'RemoveFormat'],
|
||||||
|
['Link', 'Unlink', 'Anchor', 'Glossary'],
|
||||||
|
[
|
||||||
|
'Image',
|
||||||
|
'Mapping',
|
||||||
|
'Video',
|
||||||
|
'Oembed',
|
||||||
|
'Youtube',
|
||||||
|
'Flash',
|
||||||
|
'Audio',
|
||||||
|
'leaflet',
|
||||||
|
'Smiley',
|
||||||
|
'SpecialChar',
|
||||||
|
'Asciimath',
|
||||||
|
],
|
||||||
|
'/',
|
||||||
|
['Table', '-', 'CreateDiv'],
|
||||||
|
['BulletedList', 'NumberedList', 'HorizontalRule', '-', 'Outdent', 'Indent', 'Blockquote'],
|
||||||
|
['JustifyLeft', 'JustifyCenter', 'JustifyRight', 'JustifyBlock'],
|
||||||
|
['Bold', 'Italic', 'Underline', 'Strike', '-', 'Subscript', 'Superscript', '-', 'TextColor', 'BGColor'],
|
||||||
|
[api_get_setting('allow_spellcheck') == 'true' ? 'Scayt' : ''],
|
||||||
|
['Styles', 'Format', 'Font', 'FontSize'],
|
||||||
|
['PageBreak', 'ShowBlocks'],
|
||||||
|
['Toolbarswitch'],
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the default toolbar configuration when the setting more_buttons_maximized_mode is false.
|
||||||
|
*
|
||||||
|
* @return array
|
||||||
|
*/
|
||||||
|
protected function getNormalToolbar()
|
||||||
|
{
|
||||||
|
return [
|
||||||
|
['Maximize', '-', 'PasteFromWord', '-', 'Undo', 'Redo'],
|
||||||
|
['Link', 'Unlink'],
|
||||||
|
['Image', 'Video', 'Flash', 'Oembed', 'Youtube', 'Audio'],
|
||||||
|
['Table', 'leaflet'],
|
||||||
|
['Bold', 'Italic', 'Underline'],
|
||||||
|
['JustifyLeft', 'JustifyCenter', 'JustifyRight', '-', 'NumberedList', 'BulletedList', '-', 'TextColor', 'BGColor'],
|
||||||
|
['ShowBlocks'],
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the toolbar configuration when CKEditor is minimized.
|
||||||
|
*
|
||||||
|
* @return array
|
||||||
|
*/
|
||||||
|
protected function getMinimizedToolbar()
|
||||||
|
{
|
||||||
|
return [
|
||||||
|
$this->getNewPageBlock(),
|
||||||
|
['Undo', 'Redo'],
|
||||||
|
['Link', 'Image', 'Video', 'Flash', 'Audio', 'Table', 'Asciimath'],
|
||||||
|
['BulletedList', 'NumberedList', 'HorizontalRule'],
|
||||||
|
['JustifyLeft', 'JustifyCenter', 'JustifyBlock'],
|
||||||
|
['Format', 'Font', 'FontSize', 'Bold', 'Italic', 'TextColor'],
|
||||||
|
['Toolbarswitch'],
|
||||||
|
];
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,103 @@
|
|||||||
|
<?php
|
||||||
|
/* For licensing terms, see /license.txt */
|
||||||
|
|
||||||
|
namespace Chamilo\CoreBundle\Component\Editor\CkEditor\Toolbar;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* ProjectStudent toolbar configuration.
|
||||||
|
*
|
||||||
|
* @package Chamilo\CoreBundle\Component\Editor\CkEditor\Toolbar
|
||||||
|
*/
|
||||||
|
class ProjectStudent extends Basic
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Get the toolbar config.
|
||||||
|
*
|
||||||
|
* @return array
|
||||||
|
*/
|
||||||
|
public function getConfig()
|
||||||
|
{
|
||||||
|
if (api_get_setting('more_buttons_maximized_mode') != 'true') {
|
||||||
|
$config['toolbar'] = $this->getNormalToolbar();
|
||||||
|
} else {
|
||||||
|
$config['toolbar_minToolbar'] = $this->getMinimizedToolbar();
|
||||||
|
$config['toolbar_maxToolbar'] = $this->getMaximizedToolbar();
|
||||||
|
}
|
||||||
|
|
||||||
|
return $config;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the toolbar configuration when CKEditor is maximized.
|
||||||
|
*
|
||||||
|
* @return array
|
||||||
|
*/
|
||||||
|
protected function getMaximizedToolbar()
|
||||||
|
{
|
||||||
|
return [
|
||||||
|
['Save', 'NewPage', 'Templates', '-', 'Preview', 'Print'],
|
||||||
|
['Cut', 'Copy', 'Paste', 'PasteText', 'PasteFromWord'],
|
||||||
|
['Undo', 'Redo', '-', 'SelectAll', 'Find', '-', 'RemoveFormat'],
|
||||||
|
['Link', 'Unlink', 'Anchor', 'Glossary'],
|
||||||
|
[
|
||||||
|
'Image',
|
||||||
|
'Mapping',
|
||||||
|
'Video',
|
||||||
|
'Oembed',
|
||||||
|
'Youtube',
|
||||||
|
'Flash',
|
||||||
|
'Audio',
|
||||||
|
'leaflet',
|
||||||
|
'Smiley',
|
||||||
|
'SpecialChar',
|
||||||
|
'Asciimath',
|
||||||
|
],
|
||||||
|
'/',
|
||||||
|
['Table', '-', 'CreateDiv'],
|
||||||
|
['BulletedList', 'NumberedList', 'HorizontalRule', '-', 'Outdent', 'Indent', 'Blockquote'],
|
||||||
|
['JustifyLeft', 'JustifyCenter', 'JustifyRight', 'JustifyBlock'],
|
||||||
|
['Bold', 'Italic', 'Underline', 'Strike', '-', 'Subscript', 'Superscript', '-', 'TextColor', 'BGColor'],
|
||||||
|
[api_get_setting('allow_spellcheck') == 'true' ? 'Scayt' : ''],
|
||||||
|
['Styles', 'Format', 'Font', 'FontSize'],
|
||||||
|
['PageBreak', 'ShowBlocks'],
|
||||||
|
['Toolbarswitch'],
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the default toolbar configuration when the setting more_buttons_maximized_mode is false.
|
||||||
|
*
|
||||||
|
* @return array
|
||||||
|
*/
|
||||||
|
protected function getNormalToolbar()
|
||||||
|
{
|
||||||
|
return [
|
||||||
|
['Maximize', '-', 'PasteFromWord', '-', 'Undo', 'Redo'],
|
||||||
|
['Link', 'Unlink', 'Anchor'],
|
||||||
|
['Image', 'Video', 'Flash', 'Oembed', 'Youtube', 'Audio'],
|
||||||
|
['Table', 'leaflet'],
|
||||||
|
['Font', 'FontSize'],
|
||||||
|
['Bold', 'Italic', 'Underline'],
|
||||||
|
['JustifyLeft', 'JustifyCenter', 'JustifyRight', '-', 'NumberedList', 'BulletedList', '-', 'TextColor', 'BGColor'],
|
||||||
|
['Source'],
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the toolbar configuration when CKEditor is minimized.
|
||||||
|
*
|
||||||
|
* @return array
|
||||||
|
*/
|
||||||
|
protected function getMinimizedToolbar()
|
||||||
|
{
|
||||||
|
return [
|
||||||
|
$this->getNewPageBlock(),
|
||||||
|
['Undo', 'Redo'],
|
||||||
|
['Link', 'Image', 'Video', 'Flash', 'Audio', 'Table', 'Asciimath'],
|
||||||
|
['BulletedList', 'NumberedList', 'HorizontalRule'],
|
||||||
|
['JustifyLeft', 'JustifyCenter', 'JustifyRight'],
|
||||||
|
['Format', 'Font', 'FontSize', 'Bold', 'Italic', 'TextColor'],
|
||||||
|
['Toolbarswitch'],
|
||||||
|
];
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,61 @@
|
|||||||
|
<?php
|
||||||
|
/* For licensing terms, see /license.txt */
|
||||||
|
|
||||||
|
namespace Chamilo\CoreBundle\Component\Editor\CkEditor\Toolbar;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Register toolbar configuration.
|
||||||
|
*
|
||||||
|
* @package Chamilo\CoreBundle\Component\Editor\CkEditor\Toolbar *
|
||||||
|
*/
|
||||||
|
class Register extends Basic
|
||||||
|
{
|
||||||
|
public $plugins = [];
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the toolbar config.
|
||||||
|
*
|
||||||
|
* @return array
|
||||||
|
*/
|
||||||
|
public function getConfig()
|
||||||
|
{
|
||||||
|
if (api_get_setting('more_buttons_maximized_mode') != 'true') {
|
||||||
|
$config['toolbar'] = $this->getNormalToolbar();
|
||||||
|
} else {
|
||||||
|
$config['toolbar_minToolbar'] = $this->getMinimizedToolbar();
|
||||||
|
$config['toolbar_maxToolbar'] = $this->getMinimizedToolbar();
|
||||||
|
}
|
||||||
|
|
||||||
|
return $config;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the default toolbar configuration when the setting more_buttons_maximized_mode is false.
|
||||||
|
*
|
||||||
|
* @return array
|
||||||
|
*/
|
||||||
|
protected function getNormalToolbar()
|
||||||
|
{
|
||||||
|
return [
|
||||||
|
['Maximize', '-', 'PasteFromWord', '-', 'Undo', 'Redo'],
|
||||||
|
['Font', 'FontSize'],
|
||||||
|
['Bold', 'Italic', 'Underline'],
|
||||||
|
['JustifyLeft', 'JustifyCenter', 'JustifyRight', '-', 'NumberedList', 'BulletedList', '-', 'TextColor', 'BGColor'],
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the toolbar configuration when CKEditor is minimized.
|
||||||
|
*
|
||||||
|
* @return array
|
||||||
|
*/
|
||||||
|
protected function getMinimizedToolbar()
|
||||||
|
{
|
||||||
|
return [
|
||||||
|
['Toolbarswitch', 'PasteFromWord', '-', 'Undo', 'Redo'],
|
||||||
|
['Font', 'FontSize'],
|
||||||
|
['Bold', 'Italic', 'Underline'],
|
||||||
|
['JustifyLeft', 'JustifyCenter', 'JustifyRight', '-', 'NumberedList', 'BulletedList', '-', 'TextColor', 'BGColor'],
|
||||||
|
];
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,127 @@
|
|||||||
|
<?php
|
||||||
|
/* For licensing terms, see /license.txt */
|
||||||
|
|
||||||
|
namespace Chamilo\CoreBundle\Component\Editor\CkEditor\Toolbar;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Survey toolbar configuration.
|
||||||
|
*
|
||||||
|
* @package Chamilo\CoreBundle\Component\Editor\CkEditor\Toolbar
|
||||||
|
*/
|
||||||
|
class Survey extends Basic
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Get the toolbar config.
|
||||||
|
*
|
||||||
|
* @return array
|
||||||
|
*/
|
||||||
|
public function getConfig()
|
||||||
|
{
|
||||||
|
if (api_get_setting('more_buttons_maximized_mode') != 'true') {
|
||||||
|
$config['toolbar'] = $this->getNormalToolbar();
|
||||||
|
} else {
|
||||||
|
$config['toolbar_minToolbar'] = $this->getMinimizedToolbar();
|
||||||
|
$config['toolbar_maxToolbar'] = $this->getMaximizedToolbar();
|
||||||
|
}
|
||||||
|
|
||||||
|
return $config;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the toolbar configuration when CKEditor is maximized.
|
||||||
|
*
|
||||||
|
* @return array
|
||||||
|
*/
|
||||||
|
protected function getMaximizedToolbar()
|
||||||
|
{
|
||||||
|
return [
|
||||||
|
['NewPage', 'Templates', '-', 'Preview', 'Print'],
|
||||||
|
['Cut', 'Copy', 'Paste', 'PasteText', 'PasteFromWord'],
|
||||||
|
['Undo', 'Redo', '-', 'SelectAll', 'Find', '-', 'RemoveFormat'],
|
||||||
|
['Link', 'Unlink', 'Anchor', 'Glossary'],
|
||||||
|
[
|
||||||
|
'Image',
|
||||||
|
'Mapping',
|
||||||
|
'Video',
|
||||||
|
'Oembed',
|
||||||
|
'Youtube',
|
||||||
|
'VimeoEmbed',
|
||||||
|
'Flash',
|
||||||
|
'Audio',
|
||||||
|
'leaflet',
|
||||||
|
'Smiley',
|
||||||
|
'SpecialChar',
|
||||||
|
'Asciimath',
|
||||||
|
'Asciisvg',
|
||||||
|
],
|
||||||
|
'/',
|
||||||
|
['Table', '-', 'CreateDiv'],
|
||||||
|
['BulletedList', 'NumberedList', 'HorizontalRule', '-', 'Outdent', 'Indent', 'Blockquote'],
|
||||||
|
['JustifyLeft', 'JustifyCenter', 'JustifyRight', 'JustifyBlock'],
|
||||||
|
[
|
||||||
|
'Bold',
|
||||||
|
'Italic',
|
||||||
|
'Underline',
|
||||||
|
'Strike',
|
||||||
|
'-',
|
||||||
|
'Subscript',
|
||||||
|
'Superscript',
|
||||||
|
'-',
|
||||||
|
'TextColor',
|
||||||
|
'BGColor',
|
||||||
|
api_get_configuration_value('translate_html') ? 'Language' : '',
|
||||||
|
],
|
||||||
|
[api_get_setting('allow_spellcheck') == 'true' ? 'Scayt' : ''],
|
||||||
|
['Styles', 'Format', 'Font', 'FontSize'],
|
||||||
|
['PageBreak', 'ShowBlocks', 'Source'],
|
||||||
|
['Toolbarswitch'],
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the default toolbar configuration when the setting more_buttons_maximized_mode is false.
|
||||||
|
*
|
||||||
|
* @return array
|
||||||
|
*/
|
||||||
|
protected function getNormalToolbar()
|
||||||
|
{
|
||||||
|
return [
|
||||||
|
['Maximize'],
|
||||||
|
['Link', 'Unlink'],
|
||||||
|
['Image'],
|
||||||
|
['Table'],
|
||||||
|
['FontSize'],
|
||||||
|
['Bold', 'Italic'],
|
||||||
|
['NumberedList', 'BulletedList', '-', 'TextColor'],
|
||||||
|
['Source'],
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the toolbar configuration when CKEditor is minimized.
|
||||||
|
*
|
||||||
|
* @return array
|
||||||
|
*/
|
||||||
|
protected function getMinimizedToolbar()
|
||||||
|
{
|
||||||
|
return [
|
||||||
|
$this->getNewPageBlock(),
|
||||||
|
['Undo', 'Redo'],
|
||||||
|
['Link', 'Image', 'Video', 'Flash', 'Audio', 'Table', 'Asciimath', 'Asciisvg'],
|
||||||
|
['BulletedList', 'NumberedList', 'HorizontalRule'],
|
||||||
|
['JustifyLeft', 'JustifyCenter', 'JustifyRight'],
|
||||||
|
[
|
||||||
|
'Format',
|
||||||
|
'FontSize',
|
||||||
|
'Bold',
|
||||||
|
'Italic',
|
||||||
|
'Underline',
|
||||||
|
'TextColor',
|
||||||
|
'BGColor',
|
||||||
|
api_get_configuration_value('translate_html') ? 'Language' : '',
|
||||||
|
'Source',
|
||||||
|
],
|
||||||
|
['Toolbarswitch'],
|
||||||
|
];
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,127 @@
|
|||||||
|
<?php
|
||||||
|
/* For licensing terms, see /license.txt */
|
||||||
|
|
||||||
|
namespace Chamilo\CoreBundle\Component\Editor\CkEditor\Toolbar;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Class SurveyQuestion.
|
||||||
|
*
|
||||||
|
* @package Chamilo\CoreBundle\Component\Editor\CkEditor\Toolbar
|
||||||
|
*/
|
||||||
|
class SurveyQuestion extends Basic
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Get the toolbar config.
|
||||||
|
*
|
||||||
|
* @return array
|
||||||
|
*/
|
||||||
|
public function getConfig()
|
||||||
|
{
|
||||||
|
if (api_get_setting('more_buttons_maximized_mode') != 'true') {
|
||||||
|
$config['toolbar'] = $this->getNormalToolbar();
|
||||||
|
} else {
|
||||||
|
$config['toolbar_minToolbar'] = $this->getMinimizedToolbar();
|
||||||
|
$config['toolbar_maxToolbar'] = $this->getMaximizedToolbar();
|
||||||
|
}
|
||||||
|
|
||||||
|
return $config;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the toolbar configuration when CKEditor is maximized.
|
||||||
|
*
|
||||||
|
* @return array
|
||||||
|
*/
|
||||||
|
protected function getMaximizedToolbar()
|
||||||
|
{
|
||||||
|
return [
|
||||||
|
$this->getNewPageBlock(),
|
||||||
|
['Cut', 'Copy', 'Paste', 'PasteText', 'PasteFromWord', 'inserthtml'],
|
||||||
|
['Undo', 'Redo', '-', 'SelectAll', 'Find', '-', 'RemoveFormat'],
|
||||||
|
['Link', 'Unlink', 'Anchor', 'Glossary'],
|
||||||
|
[
|
||||||
|
'Image',
|
||||||
|
'Mapping',
|
||||||
|
'Video',
|
||||||
|
'Oembed',
|
||||||
|
'Flash',
|
||||||
|
'Youtube',
|
||||||
|
'VimeoEmbed',
|
||||||
|
'Audio',
|
||||||
|
'leaflet',
|
||||||
|
'Smiley',
|
||||||
|
'SpecialChar',
|
||||||
|
'Asciimath',
|
||||||
|
'Asciisvg',
|
||||||
|
],
|
||||||
|
'/',
|
||||||
|
['Table', '-', 'CreateDiv'],
|
||||||
|
['BulletedList', 'NumberedList', 'HorizontalRule', '-', 'Outdent', 'Indent', 'Blockquote'],
|
||||||
|
['JustifyLeft', 'JustifyCenter', 'JustifyRight', 'JustifyBlock'],
|
||||||
|
[
|
||||||
|
'Bold',
|
||||||
|
'Italic',
|
||||||
|
'Underline',
|
||||||
|
'Strike',
|
||||||
|
'-',
|
||||||
|
'Subscript',
|
||||||
|
'Superscript',
|
||||||
|
'-',
|
||||||
|
'TextColor',
|
||||||
|
'BGColor',
|
||||||
|
api_get_configuration_value('translate_html') ? 'Language' : '',
|
||||||
|
],
|
||||||
|
[api_get_setting('allow_spellcheck') == 'true' ? 'Scayt' : ''],
|
||||||
|
['Styles', 'Format', 'Font', 'FontSize'],
|
||||||
|
['PageBreak', 'ShowBlocks'],
|
||||||
|
api_get_setting('enabled_wiris') == 'true'
|
||||||
|
? ['ckeditor_wiris_formulaEditor', 'ckeditor_wiris_formulaEditorChemistry']
|
||||||
|
: [''],
|
||||||
|
['Toolbarswitch', 'Source'],
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the toolbar configuration when CKEditor is minimized.
|
||||||
|
*
|
||||||
|
* @return array
|
||||||
|
*/
|
||||||
|
protected function getMinimizedToolbar()
|
||||||
|
{
|
||||||
|
return [
|
||||||
|
$this->getNewPageBlock(),
|
||||||
|
['Undo', 'Redo'],
|
||||||
|
[
|
||||||
|
'Link',
|
||||||
|
'Image',
|
||||||
|
'Video',
|
||||||
|
'Oembed',
|
||||||
|
'Flash',
|
||||||
|
'Youtube',
|
||||||
|
'VimeoEmbed',
|
||||||
|
'Audio',
|
||||||
|
'Table',
|
||||||
|
'Asciimath',
|
||||||
|
'Asciisvg',
|
||||||
|
],
|
||||||
|
['BulletedList', 'NumberedList', 'HorizontalRule'],
|
||||||
|
['JustifyLeft', 'JustifyCenter', 'JustifyRight', 'JustifyBlock'],
|
||||||
|
[
|
||||||
|
'Styles',
|
||||||
|
'Format',
|
||||||
|
'Font',
|
||||||
|
'FontSize',
|
||||||
|
'Bold',
|
||||||
|
'Italic',
|
||||||
|
'Underline',
|
||||||
|
'TextColor',
|
||||||
|
'BGColor',
|
||||||
|
api_get_configuration_value('translate_html') ? 'Language' : '',
|
||||||
|
],
|
||||||
|
api_get_setting('enabled_wiris') == 'true'
|
||||||
|
? ['ckeditor_wiris_formulaEditor', 'ckeditor_wiris_formulaEditorChemistry']
|
||||||
|
: [''],
|
||||||
|
['Toolbarswitch', 'Source'],
|
||||||
|
];
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,43 @@
|
|||||||
|
<?php
|
||||||
|
/* For licensing terms, see /license.txt */
|
||||||
|
|
||||||
|
namespace Chamilo\CoreBundle\Component\Editor\CkEditor\Toolbar;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* TermsAndConditions toolbar configuration.
|
||||||
|
*
|
||||||
|
* @package Chamilo\CoreBundle\Component\Editor\CkEditor\Toolbar *
|
||||||
|
*/
|
||||||
|
class TermsAndConditions extends Basic
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Get the toolbar config.
|
||||||
|
*
|
||||||
|
* @return array
|
||||||
|
*/
|
||||||
|
public function getConfig()
|
||||||
|
{
|
||||||
|
if (api_get_setting('more_buttons_maximized_mode') != 'true') {
|
||||||
|
$config['toolbar'] = $this->getNormalToolbar();
|
||||||
|
} else {
|
||||||
|
$config['toolbar_minToolbar'] = $this->getNormalToolbar();
|
||||||
|
$config['toolbar_maxToolbar'] = $this->getNormalToolbar();
|
||||||
|
}
|
||||||
|
|
||||||
|
return $config;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the default toolbar configuration when the setting more_buttons_maximized_mode is false.
|
||||||
|
*
|
||||||
|
* @return array
|
||||||
|
*/
|
||||||
|
protected function getNormalToolbar()
|
||||||
|
{
|
||||||
|
return [
|
||||||
|
['Styles', 'Format', 'Font', 'FontSize'],
|
||||||
|
['Bold', 'Italic', 'Underline'],
|
||||||
|
['JustifyLeft', 'JustifyCenter', 'JustifyRight'],
|
||||||
|
];
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,127 @@
|
|||||||
|
<?php
|
||||||
|
/* For licensing terms, see /license.txt */
|
||||||
|
|
||||||
|
namespace Chamilo\CoreBundle\Component\Editor\CkEditor\Toolbar;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* TestAnswerFeedback toolbar configuration.
|
||||||
|
*
|
||||||
|
* @package Chamilo\CoreBundle\Component\Editor\CkEditor\Toolbar
|
||||||
|
*/
|
||||||
|
class TestAnswerFeedback extends Basic
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Get the toolbar config.
|
||||||
|
*
|
||||||
|
* @return array
|
||||||
|
*/
|
||||||
|
public function getConfig()
|
||||||
|
{
|
||||||
|
$config['toolbarGroups'] = [
|
||||||
|
['name' => 'document'],
|
||||||
|
[
|
||||||
|
'name' => 'clipboard',
|
||||||
|
'groups' => ['clipboard', 'undo'],
|
||||||
|
],
|
||||||
|
[
|
||||||
|
'name' => 'basicstyles',
|
||||||
|
'groups' => ['basicstyles', 'cleanup'],
|
||||||
|
],
|
||||||
|
[
|
||||||
|
'name' => 'paragraph',
|
||||||
|
'groups' => ['list', 'indent', 'blocks', 'align'],
|
||||||
|
],
|
||||||
|
['name' => 'links'],
|
||||||
|
['name' => 'insert'],
|
||||||
|
'/',
|
||||||
|
['name' => 'styles'],
|
||||||
|
['name' => 'colors'],
|
||||||
|
['name' => 'mode'],
|
||||||
|
];
|
||||||
|
|
||||||
|
$config['toolbarCanCollapse'] = true;
|
||||||
|
$config['toolbarStartupExpanded'] = false;
|
||||||
|
//$config['width'] = '100';
|
||||||
|
//$config['height'] = '200';
|
||||||
|
|
||||||
|
if (api_get_setting('more_buttons_maximized_mode') != 'true') {
|
||||||
|
$config['toolbar'] = $this->getNormalToolbar();
|
||||||
|
} else {
|
||||||
|
$config['toolbar_minToolbar'] = $this->getMinimizedToolbar();
|
||||||
|
|
||||||
|
$config['toolbar_maxToolbar'] = $this->getMaximizedToolbar();
|
||||||
|
}
|
||||||
|
|
||||||
|
return $config;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the toolbar configuration when CKEditor is maximized.
|
||||||
|
*
|
||||||
|
* @return array
|
||||||
|
*/
|
||||||
|
protected function getMaximizedToolbar()
|
||||||
|
{
|
||||||
|
return [
|
||||||
|
['NewPage', 'Templates', '-', 'Preview', 'Print'],
|
||||||
|
['Cut', 'Copy', 'Paste', 'PasteText', 'PasteFromWord'],
|
||||||
|
['Undo', 'Redo', '-', 'SelectAll', 'Find', '-', 'RemoveFormat'],
|
||||||
|
['Link', 'Unlink', 'Anchor', 'Glossary'],
|
||||||
|
[
|
||||||
|
'Image',
|
||||||
|
'Mapping',
|
||||||
|
'Video',
|
||||||
|
'Oembed',
|
||||||
|
'Youtube',
|
||||||
|
'VimeoEmbed',
|
||||||
|
'Flash',
|
||||||
|
'Audio',
|
||||||
|
'leaflet',
|
||||||
|
'Smiley',
|
||||||
|
'SpecialChar',
|
||||||
|
],
|
||||||
|
'/',
|
||||||
|
['Table', '-', 'CreateDiv'],
|
||||||
|
['BulletedList', 'NumberedList', 'HorizontalRule', '-', 'Outdent', 'Indent', 'Blockquote'],
|
||||||
|
['JustifyLeft', 'JustifyCenter', 'JustifyRight', 'JustifyBlock'],
|
||||||
|
['Bold', 'Italic', 'Underline', 'Strike', '-', 'Subscript', 'Superscript', '-', 'TextColor', 'BGColor'],
|
||||||
|
[api_get_setting('allow_spellcheck') == 'true' ? 'Scayt' : ''],
|
||||||
|
['Styles', 'Format', 'Font', 'FontSize'],
|
||||||
|
api_get_setting('enabled_wiris') === 'true' ? ['ckeditor_wiris_formulaEditor', 'ckeditor_wiris_formulaEditorChemistry'] : [''],
|
||||||
|
['PageBreak', 'ShowBlocks', 'Source'],
|
||||||
|
['Toolbarswitch'],
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the default toolbar configuration when the setting more_buttons_maximized_mode is false.
|
||||||
|
*
|
||||||
|
* @return array
|
||||||
|
*/
|
||||||
|
protected function getNormalToolbar()
|
||||||
|
{
|
||||||
|
return [
|
||||||
|
['Link', 'Unlink', 'Bold', 'Italic', 'TextColor', 'BGColor'],
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the toolbar configuration when CKEditor is minimized.
|
||||||
|
*
|
||||||
|
* @return array
|
||||||
|
*/
|
||||||
|
protected function getMinimizedToolbar()
|
||||||
|
{
|
||||||
|
return [
|
||||||
|
$this->getNewPageBlock(),
|
||||||
|
['Undo', 'Redo'],
|
||||||
|
['Link', 'Image', 'Video', 'Flash', 'Audio', 'Table'],
|
||||||
|
['BulletedList', 'NumberedList', 'HorizontalRule'],
|
||||||
|
['JustifyLeft', 'JustifyCenter', 'JustifyRight', 'JustifyBlock'],
|
||||||
|
['Asciimath', 'Asciisvg'],
|
||||||
|
['Format', 'Font', 'FontSize', 'Bold', 'Italic', 'Underline', 'TextColor', 'BGColor', 'Source'],
|
||||||
|
api_get_setting('enabled_wiris') === 'true' ? ['ckeditor_wiris_formulaEditor', 'ckeditor_wiris_formulaEditorChemistry'] : [''],
|
||||||
|
['Toolbarswitch'],
|
||||||
|
];
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,125 @@
|
|||||||
|
<?php
|
||||||
|
/* For licensing terms, see /license.txt */
|
||||||
|
|
||||||
|
namespace Chamilo\CoreBundle\Component\Editor\CkEditor\Toolbar;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* TestFreeAnswer toolbar configuration.
|
||||||
|
*
|
||||||
|
* @package Chamilo\CoreBundle\Component\Editor\CkEditor\Toolbar
|
||||||
|
*/
|
||||||
|
class TestFreeAnswer extends Basic
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Get the toolbar config.
|
||||||
|
*
|
||||||
|
* @return array
|
||||||
|
*/
|
||||||
|
public function getConfig()
|
||||||
|
{
|
||||||
|
if (api_get_setting('more_buttons_maximized_mode') != 'true') {
|
||||||
|
$config['toolbar'] = $this->getNormalToolbar();
|
||||||
|
} else {
|
||||||
|
$config['toolbar_minToolbar'] = $this->getMinimizedToolbar();
|
||||||
|
$config['toolbar_maxToolbar'] = $this->getMaximizedToolbar();
|
||||||
|
}
|
||||||
|
|
||||||
|
$config['fullPage'] = false;
|
||||||
|
|
||||||
|
$config['extraPlugins'] = 'wordcount';
|
||||||
|
|
||||||
|
$config['wordcount'] = [
|
||||||
|
// Whether or not you want to show the Word Count
|
||||||
|
'showWordCount' => true,
|
||||||
|
// Whether or not you want to show the Char Count
|
||||||
|
'showCharCount' => true,
|
||||||
|
// Option to limit the characters in the Editor
|
||||||
|
'charLimit' => 'unlimited',
|
||||||
|
// Option to limit the words in the Editor
|
||||||
|
'wordLimit' => 'unlimited',
|
||||||
|
];
|
||||||
|
|
||||||
|
//$config['height'] = '200';
|
||||||
|
|
||||||
|
return $config;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the toolbar configuration when CKEditor is maximized.
|
||||||
|
*
|
||||||
|
* @return array
|
||||||
|
*/
|
||||||
|
protected function getMaximizedToolbar()
|
||||||
|
{
|
||||||
|
return [
|
||||||
|
['NewPage', 'Templates', '-', 'Preview', 'Print'],
|
||||||
|
['Cut', 'Copy', 'Paste', 'PasteText', 'PasteFromWord'],
|
||||||
|
['Undo', 'Redo', '-', 'SelectAll', 'Find', '-', 'RemoveFormat'],
|
||||||
|
['Link', 'Unlink', 'Anchor', 'Glossary'],
|
||||||
|
[
|
||||||
|
'Image',
|
||||||
|
'Mapping',
|
||||||
|
'Video',
|
||||||
|
'Oembed',
|
||||||
|
'Youtube',
|
||||||
|
'VimeoEmbed',
|
||||||
|
'Flash',
|
||||||
|
'Audio',
|
||||||
|
'leaflet',
|
||||||
|
'Smiley',
|
||||||
|
'SpecialChar',
|
||||||
|
],
|
||||||
|
['Asciimath', 'Asciisvg'],
|
||||||
|
'/',
|
||||||
|
['Table', '-', 'CreateDiv'],
|
||||||
|
['BulletedList', 'NumberedList', 'HorizontalRule', '-', 'Outdent', 'Indent', 'Blockquote'],
|
||||||
|
['JustifyLeft', 'JustifyCenter', 'JustifyRight', 'JustifyBlock'],
|
||||||
|
['Bold', 'Italic', 'Underline', 'Strike', '-', 'Subscript', 'Superscript', '-', 'TextColor', 'BGColor'],
|
||||||
|
[api_get_setting('allow_spellcheck') == 'true' ? 'Scayt' : ''],
|
||||||
|
['Styles', 'Format', 'Font', 'FontSize'],
|
||||||
|
['PageBreak', 'ShowBlocks'],
|
||||||
|
['Toolbarswitch'],
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the default toolbar configuration when the setting more_buttons_maximized_mode is false.
|
||||||
|
*
|
||||||
|
* @return array
|
||||||
|
*/
|
||||||
|
protected function getNormalToolbar()
|
||||||
|
{
|
||||||
|
return [
|
||||||
|
[
|
||||||
|
'Maximize',
|
||||||
|
'Bold',
|
||||||
|
'Image',
|
||||||
|
'Link',
|
||||||
|
'PasteFromWord',
|
||||||
|
'Audio',
|
||||||
|
'Table',
|
||||||
|
'Subscript',
|
||||||
|
'Superscript',
|
||||||
|
'ShowBlocks',
|
||||||
|
],
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the toolbar configuration when CKEditor is minimized.
|
||||||
|
*
|
||||||
|
* @return array
|
||||||
|
*/
|
||||||
|
protected function getMinimizedToolbar()
|
||||||
|
{
|
||||||
|
return [
|
||||||
|
$this->getNewPageBlock(),
|
||||||
|
['Undo', 'Redo'],
|
||||||
|
['Link', 'Image', 'Video', 'Flash', 'Audio', 'Table', 'Asciimath', 'Asciisvg'],
|
||||||
|
['BulletedList', 'NumberedList', 'HorizontalRule'],
|
||||||
|
['JustifyLeft', 'JustifyCenter', 'JustifyRight'],
|
||||||
|
['Format', 'Font', 'FontSize', 'Bold', 'Italic', 'Underline', 'TextColor', 'BGColor'],
|
||||||
|
['Toolbarswitch'],
|
||||||
|
];
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,54 @@
|
|||||||
|
<?php
|
||||||
|
/* For licensing terms, see /license.txt */
|
||||||
|
|
||||||
|
namespace Chamilo\CoreBundle\Component\Editor\CkEditor\Toolbar;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* TestFreeAnswerStrict toolbar configuration.
|
||||||
|
*
|
||||||
|
* @package Chamilo\CoreBundle\Component\Editor\CkEditor\Toolbar
|
||||||
|
*/
|
||||||
|
class TestFreeAnswerStrict extends Basic
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Get the toolbar config.
|
||||||
|
*
|
||||||
|
* @return array
|
||||||
|
*/
|
||||||
|
public function getConfig()
|
||||||
|
{
|
||||||
|
if (api_get_setting('more_buttons_maximized_mode') != 'true') {
|
||||||
|
$config['toolbar'] = $this->getNormalToolbar();
|
||||||
|
} else {
|
||||||
|
$config['toolbar_minToolbar'] = $this->getNormalToolbar();
|
||||||
|
$config['toolbar_maxToolbar'] = $this->getNormalToolbar();
|
||||||
|
}
|
||||||
|
|
||||||
|
$config['fullPage'] = false;
|
||||||
|
$config['extraPlugins'] = 'wordcount';
|
||||||
|
$config['wordcount'] = [
|
||||||
|
// Whether or not you want to show the Word Count
|
||||||
|
'showWordCount' => true,
|
||||||
|
// Whether or not you want to show the Char Count
|
||||||
|
'showCharCount' => true,
|
||||||
|
// Option to limit the characters in the Editor
|
||||||
|
'charLimit' => 'unlimited',
|
||||||
|
// Option to limit the words in the Editor
|
||||||
|
'wordLimit' => 'unlimited',
|
||||||
|
];
|
||||||
|
|
||||||
|
$config['removePlugins'] = 'elementspath';
|
||||||
|
//$config['height'] = '200';
|
||||||
|
return $config;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the default toolbar configuration when the setting more_buttons_maximized_mode is false.
|
||||||
|
*
|
||||||
|
* @return array
|
||||||
|
*/
|
||||||
|
protected function getNormalToolbar()
|
||||||
|
{
|
||||||
|
return [];
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,139 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
/* For licensing terms, see /license.txt */
|
||||||
|
|
||||||
|
namespace Chamilo\CoreBundle\Component\Editor\CkEditor\Toolbar;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* TestFreeAnswer toolbar configuration.
|
||||||
|
*/
|
||||||
|
class TestMatching extends Basic
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Get the toolbar config.
|
||||||
|
*
|
||||||
|
* @return array
|
||||||
|
*/
|
||||||
|
public function getConfig()
|
||||||
|
{
|
||||||
|
if (api_get_setting('more_buttons_maximized_mode') !== 'true') {
|
||||||
|
$config['toolbar'] = $this->getNormalToolbar();
|
||||||
|
} else {
|
||||||
|
$config['toolbar_minToolbar'] = $this->getMinimizedToolbar();
|
||||||
|
$config['toolbar_maxToolbar'] = $this->getMaximizedToolbar();
|
||||||
|
}
|
||||||
|
|
||||||
|
$config['fullPage'] = false;
|
||||||
|
$config['extraPlugins'] = $this->getPluginsToString();
|
||||||
|
$config['wordcount'] = [
|
||||||
|
// Whether or not you want to show the Word Count
|
||||||
|
'showWordCount' => true,
|
||||||
|
// Whether or not you want to show the Char Count
|
||||||
|
'showCharCount' => true,
|
||||||
|
// Option to limit the characters in the Editor
|
||||||
|
'charLimit' => 'unlimited',
|
||||||
|
// Option to limit the words in the Editor
|
||||||
|
'wordLimit' => 'unlimited',
|
||||||
|
];
|
||||||
|
|
||||||
|
return $config;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the toolbar configuration when CKEditor is maximized.
|
||||||
|
*
|
||||||
|
* @return array
|
||||||
|
*/
|
||||||
|
protected function getMaximizedToolbar()
|
||||||
|
{
|
||||||
|
return [
|
||||||
|
['NewPage', 'Templates', '-', 'Preview', 'Print'],
|
||||||
|
['Cut', 'Copy', 'Paste', 'PasteText', 'PasteFromWord', 'inserthtml'],
|
||||||
|
['Undo', 'Redo', '-', 'SelectAll', 'Find', '-', 'RemoveFormat'],
|
||||||
|
['Link', 'Unlink', 'Anchor', 'Glossary'],
|
||||||
|
[
|
||||||
|
'Image',
|
||||||
|
'Mapping',
|
||||||
|
'Video',
|
||||||
|
'Oembed',
|
||||||
|
'Youtube',
|
||||||
|
'VimeoEmbed',
|
||||||
|
'Flash',
|
||||||
|
'Audio',
|
||||||
|
'leaflet',
|
||||||
|
'Smiley',
|
||||||
|
'SpecialChar',
|
||||||
|
],
|
||||||
|
['Asciimath', 'Asciisvg'],
|
||||||
|
'/',
|
||||||
|
['Table', '-', 'CreateDiv'],
|
||||||
|
['BulletedList', 'NumberedList', 'HorizontalRule', '-', 'Outdent', 'Indent', 'Blockquote'],
|
||||||
|
['JustifyLeft', 'JustifyCenter', 'JustifyRight', 'JustifyBlock'],
|
||||||
|
['Bold', 'Italic', 'Underline', 'Strike', '-', 'Subscript', 'Superscript', '-', 'TextColor', 'BGColor'],
|
||||||
|
[api_get_setting('allow_spellcheck') === 'true' ? 'Scayt' : ''],
|
||||||
|
['Styles', 'Format', 'Font', 'FontSize'],
|
||||||
|
['PageBreak', 'ShowBlocks'],
|
||||||
|
api_get_setting('enabled_wiris') === 'true' ? ['ckeditor_wiris_formulaEditor', 'ckeditor_wiris_formulaEditorChemistry'] : [''],
|
||||||
|
['Toolbarswitch'],
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the default toolbar configuration when the setting more_buttons_maximized_mode is false.
|
||||||
|
*
|
||||||
|
* @return array
|
||||||
|
*/
|
||||||
|
protected function getNormalToolbar()
|
||||||
|
{
|
||||||
|
return [
|
||||||
|
[
|
||||||
|
'Maximize',
|
||||||
|
'Bold',
|
||||||
|
'Image',
|
||||||
|
'Video',
|
||||||
|
'Flash',
|
||||||
|
'Oembed',
|
||||||
|
'Youtube',
|
||||||
|
'VimeoEmbed',
|
||||||
|
'Audio',
|
||||||
|
'Link',
|
||||||
|
'PasteFromWord',
|
||||||
|
'inserthtml',
|
||||||
|
'Table',
|
||||||
|
'Subscript',
|
||||||
|
'Superscript',
|
||||||
|
'ShowBlocks',
|
||||||
|
],
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the toolbar configuration when CKEditor is minimized.
|
||||||
|
*
|
||||||
|
* @return array
|
||||||
|
*/
|
||||||
|
protected function getMinimizedToolbar()
|
||||||
|
{
|
||||||
|
return [
|
||||||
|
['PasteFromWord', 'inserthtml'],
|
||||||
|
['Undo', 'Redo'],
|
||||||
|
[
|
||||||
|
'Link',
|
||||||
|
'Image',
|
||||||
|
'Video',
|
||||||
|
'Flash',
|
||||||
|
'Oembed',
|
||||||
|
'Youtube',
|
||||||
|
'VimeoEmbed',
|
||||||
|
'Audio',
|
||||||
|
'Table',
|
||||||
|
'Asciimath',
|
||||||
|
],
|
||||||
|
['BulletedList', 'NumberedList', 'HorizontalRule'],
|
||||||
|
['JustifyLeft', 'JustifyCenter', 'JustifyRight'],
|
||||||
|
['Format', 'Font', 'FontSize', 'Bold', 'Italic', 'Underline', 'TextColor', 'BGColor'],
|
||||||
|
api_get_setting('enabled_wiris') === 'true' ? ['ckeditor_wiris_formulaEditor', 'ckeditor_wiris_formulaEditorChemistry'] : [''],
|
||||||
|
['Source', 'Toolbarswitch'],
|
||||||
|
];
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,79 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
/* For licensing terms, see /license.txt */
|
||||||
|
|
||||||
|
namespace Chamilo\CoreBundle\Component\Editor\CkEditor\Toolbar;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* TestProposedAnswer toolbar configuration.
|
||||||
|
*/
|
||||||
|
class TestProposedAnswer extends Basic
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Get the toolbar config.
|
||||||
|
*
|
||||||
|
* @return array
|
||||||
|
*/
|
||||||
|
public function getConfig()
|
||||||
|
{
|
||||||
|
$config['toolbarCanCollapse'] = true;
|
||||||
|
$config['toolbarStartupExpanded'] = false;
|
||||||
|
if (api_get_setting('more_buttons_maximized_mode') !== 'true') {
|
||||||
|
$config['toolbar'] = $this->getNormalToolbar();
|
||||||
|
} else {
|
||||||
|
$config['toolbar_minToolbar'] = $this->getMinimizedToolbar();
|
||||||
|
$config['toolbar_maxToolbar'] = $this->getMaximizedToolbar();
|
||||||
|
}
|
||||||
|
|
||||||
|
return $config;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the toolbar configuration when CKEditor is maximized.
|
||||||
|
*
|
||||||
|
* @return array
|
||||||
|
*/
|
||||||
|
protected function getMaximizedToolbar()
|
||||||
|
{
|
||||||
|
return $this->getNormalToolbar();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the default toolbar configuration when the setting more_buttons_maximized_mode is false.
|
||||||
|
*
|
||||||
|
* @return array
|
||||||
|
*/
|
||||||
|
protected function getNormalToolbar()
|
||||||
|
{
|
||||||
|
return [
|
||||||
|
['Bold', 'Subscript', 'Superscript'],
|
||||||
|
[
|
||||||
|
'Link',
|
||||||
|
'Image',
|
||||||
|
'Video',
|
||||||
|
//'Flash',
|
||||||
|
'Oembed',
|
||||||
|
//'Youtube',
|
||||||
|
'VimeoEmbed',
|
||||||
|
'Audio',
|
||||||
|
'Table',
|
||||||
|
'PasteFromWord',
|
||||||
|
'inserthtml',
|
||||||
|
api_get_setting('enabled_mathjax') === 'true' ? 'Mathjax' : '',
|
||||||
|
],
|
||||||
|
['Asciimath', 'Asciisvg'],
|
||||||
|
api_get_setting('enabled_wiris') === 'true' ? ['ckeditor_wiris_formulaEditor', 'ckeditor_wiris_formulaEditorChemistry'] : [''],
|
||||||
|
['Maximize', 'Source'],
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the toolbar configuration when CKEditor is minimized.
|
||||||
|
*
|
||||||
|
* @return array
|
||||||
|
*/
|
||||||
|
protected function getMinimizedToolbar()
|
||||||
|
{
|
||||||
|
return $this->getNormalToolbar();
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,187 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
/* For licensing terms, see /license.txt */
|
||||||
|
|
||||||
|
namespace Chamilo\CoreBundle\Component\Editor\CkEditor\Toolbar;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* TestQuestionDescription toolbar configuration.
|
||||||
|
*/
|
||||||
|
class TestQuestionDescription extends Basic
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Get the toolbar config.
|
||||||
|
*
|
||||||
|
* @return array
|
||||||
|
*/
|
||||||
|
public function getConfig()
|
||||||
|
{
|
||||||
|
$config['toolbarGroups'] = [
|
||||||
|
['name' => 'document', 'groups' => ['document', 'doctools']],
|
||||||
|
['name' => 'clipboard', 'groups' => ['clipboard', 'undo']],
|
||||||
|
['name' => 'editing', 'groups' => ['clipboard', 'undo']],
|
||||||
|
'/',
|
||||||
|
['name' => 'basicstyles', 'groups' => ['basicstyles', 'cleanup']],
|
||||||
|
['name' => 'paragraph', 'groups' => ['list', 'indent', 'blocks', 'align']],
|
||||||
|
['name' => 'links'],
|
||||||
|
['name' => 'insert'],
|
||||||
|
'/',
|
||||||
|
['name' => 'styles'],
|
||||||
|
['name' => 'colors'],
|
||||||
|
['name' => 'tools'],
|
||||||
|
['name' => 'others'],
|
||||||
|
['name' => 'mode'],
|
||||||
|
];
|
||||||
|
|
||||||
|
$config['extraPlugins'] = $this->getPluginsToString();
|
||||||
|
if (api_get_setting('more_buttons_maximized_mode') !== 'true') {
|
||||||
|
$config['toolbar'] = $this->getNormalToolbar();
|
||||||
|
} else {
|
||||||
|
$config['toolbar_minToolbar'] = $this->getMinimizedToolbar();
|
||||||
|
$config['toolbar_maxToolbar'] = $this->getMaximizedToolbar();
|
||||||
|
}
|
||||||
|
|
||||||
|
return $config;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return array
|
||||||
|
*/
|
||||||
|
public function getConditionalPlugins()
|
||||||
|
{
|
||||||
|
$plugins = [];
|
||||||
|
if (api_get_setting('show_glossary_in_documents') === 'ismanual') {
|
||||||
|
$plugins[] = 'glossary';
|
||||||
|
}
|
||||||
|
|
||||||
|
return $plugins;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the toolbar configuration when CKEditor is maximized.
|
||||||
|
*
|
||||||
|
* @return array
|
||||||
|
*/
|
||||||
|
protected function getMaximizedToolbar()
|
||||||
|
{
|
||||||
|
return [
|
||||||
|
['NewPage', 'Templates', '-', 'Preview', 'Print'],
|
||||||
|
['Cut', 'Copy', 'Paste', 'PasteText', 'PasteFromWord'],
|
||||||
|
['Undo', 'Redo', '-', 'SelectAll', 'Find', '-', 'RemoveFormat'],
|
||||||
|
['Link', 'Unlink', 'Anchor', 'Glossary'],
|
||||||
|
[
|
||||||
|
'Image',
|
||||||
|
'Mapping',
|
||||||
|
'Video',
|
||||||
|
'Flash',
|
||||||
|
'Youtube',
|
||||||
|
'VimeoEmbed',
|
||||||
|
'Oembed',
|
||||||
|
'Audio',
|
||||||
|
'leaflet',
|
||||||
|
'Smiley',
|
||||||
|
'SpecialChar',
|
||||||
|
'Asciimath',
|
||||||
|
'Asciisvg',
|
||||||
|
],
|
||||||
|
'/',
|
||||||
|
['Table', '-', 'CreateDiv'],
|
||||||
|
['BulletedList', 'NumberedList', 'HorizontalRule', '-', 'Outdent', 'Indent', 'Blockquote'],
|
||||||
|
['JustifyLeft', 'JustifyCenter', 'JustifyRight', 'JustifyBlock'],
|
||||||
|
[
|
||||||
|
'Bold',
|
||||||
|
'Italic',
|
||||||
|
'Underline',
|
||||||
|
'Strike',
|
||||||
|
'-',
|
||||||
|
'Subscript',
|
||||||
|
'Superscript',
|
||||||
|
'-',
|
||||||
|
'TextColor',
|
||||||
|
'BGColor',
|
||||||
|
api_get_configuration_value('translate_html') ? 'Language' : '',
|
||||||
|
],
|
||||||
|
[api_get_setting('allow_spellcheck') == 'true' ? 'Scayt' : ''],
|
||||||
|
['Styles', 'Format', 'Font', 'FontSize'],
|
||||||
|
['PageBreak', 'ShowBlocks'],
|
||||||
|
api_get_setting('enabled_wiris') === 'true' ? ['ckeditor_wiris_formulaEditor', 'ckeditor_wiris_formulaEditorChemistry'] : [''],
|
||||||
|
['Toolbarswitch', 'Source'],
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the default toolbar configuration when the setting more_buttons_maximized_mode is false.
|
||||||
|
*
|
||||||
|
* @return array
|
||||||
|
*/
|
||||||
|
protected function getNormalToolbar()
|
||||||
|
{
|
||||||
|
return [
|
||||||
|
['Maximize', '-', 'PasteFromWord', '-', 'Undo', 'Redo'],
|
||||||
|
['Link', 'Unlink'],
|
||||||
|
['Image', 'Video', 'Flash', 'Oembed', 'Youtube', 'VimeoEmbed', 'Audio'],
|
||||||
|
['Table', 'SpecialChar'],
|
||||||
|
[
|
||||||
|
'NumberedList',
|
||||||
|
'BulletedList',
|
||||||
|
'-',
|
||||||
|
'Outdent',
|
||||||
|
'Indent',
|
||||||
|
'-',
|
||||||
|
'TextColor',
|
||||||
|
'BGColor',
|
||||||
|
'-',
|
||||||
|
api_get_configuration_value('translate_html') ? 'Language' : '',
|
||||||
|
],
|
||||||
|
'/',
|
||||||
|
['Styles', 'Format', 'Font', 'FontSize'],
|
||||||
|
['Bold', 'Italic', 'Underline'],
|
||||||
|
['JustifyLeft', 'JustifyCenter', 'JustifyRight'],
|
||||||
|
api_get_setting('enabled_wiris') === 'true' ? ['ckeditor_wiris_formulaEditor', 'ckeditor_wiris_formulaEditorChemistry'] : [''],
|
||||||
|
['Source'],
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the toolbar configuration when CKEditor is minimized.
|
||||||
|
*
|
||||||
|
* @return array
|
||||||
|
*/
|
||||||
|
protected function getMinimizedToolbar()
|
||||||
|
{
|
||||||
|
return [
|
||||||
|
$this->getNewPageBlock(),
|
||||||
|
['Undo', 'Redo'],
|
||||||
|
[
|
||||||
|
'Link',
|
||||||
|
'Unlink',
|
||||||
|
'Image',
|
||||||
|
'Video',
|
||||||
|
'Flash',
|
||||||
|
'Oembed',
|
||||||
|
'Youtube',
|
||||||
|
'VimeoEmbed',
|
||||||
|
'Audio',
|
||||||
|
'Table',
|
||||||
|
'Asciimath',
|
||||||
|
'Asciisvg',
|
||||||
|
],
|
||||||
|
['BulletedList', 'NumberedList', 'HorizontalRule'],
|
||||||
|
['JustifyLeft', 'JustifyCenter', 'JustifyRight', 'JustifyBlock'],
|
||||||
|
[
|
||||||
|
'Styles',
|
||||||
|
'Format',
|
||||||
|
'Font',
|
||||||
|
'FontSize',
|
||||||
|
'Bold',
|
||||||
|
'Italic',
|
||||||
|
'Underline',
|
||||||
|
'TextColor',
|
||||||
|
'BGColor',
|
||||||
|
api_get_configuration_value('translate_html') ? 'Language' : '',
|
||||||
|
],
|
||||||
|
api_get_setting('enabled_wiris') === 'true' ? ['ckeditor_wiris_formulaEditor', 'ckeditor_wiris_formulaEditorChemistry'] : [''],
|
||||||
|
['Toolbarswitch', 'Source'],
|
||||||
|
];
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,44 @@
|
|||||||
|
<?php
|
||||||
|
/* For licensing terms, see /license.txt */
|
||||||
|
|
||||||
|
namespace Chamilo\CoreBundle\Component\Editor\CkEditor\Toolbar;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Toolbar used to allow titles to have an HTML format.
|
||||||
|
*
|
||||||
|
* @package Chamilo\CoreBundle\Component\Editor\CkEditor\Toolbar
|
||||||
|
*/
|
||||||
|
class TitleAsHtml extends Basic
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* @return mixed
|
||||||
|
*/
|
||||||
|
public function getConfig()
|
||||||
|
{
|
||||||
|
$config['toolbar'] = [
|
||||||
|
[
|
||||||
|
'name' => 'clipboard',
|
||||||
|
'groups' => ['clipboard', 'undo'],
|
||||||
|
'items' => ['Cut', 'Copy', 'Paste', '-', 'Undo', 'Redo'],
|
||||||
|
],
|
||||||
|
[
|
||||||
|
'name' => 'basicstyles',
|
||||||
|
'groups' => ['basicstyles', 'cleanup'],
|
||||||
|
'items' => ['Bold', 'Italic', 'Underline', 'Strike', 'TextColor', 'BGColor'],
|
||||||
|
],
|
||||||
|
// [
|
||||||
|
// 'name' => 'paragraph',
|
||||||
|
// 'groups' => ['list', 'indent', 'blocks', 'align', 'bidi'],
|
||||||
|
// 'items' => ['NumberedList', 'BulletedList', '-', 'Outdent', 'Indent'],
|
||||||
|
// ],
|
||||||
|
[
|
||||||
|
'name' => 'links',
|
||||||
|
'items' => ['Link', 'Unlink', 'Source'],
|
||||||
|
],
|
||||||
|
];
|
||||||
|
|
||||||
|
$config['height'] = '100';
|
||||||
|
|
||||||
|
return $config;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,13 @@
|
|||||||
|
<?php
|
||||||
|
/* For licensing terms, see /license.txt */
|
||||||
|
|
||||||
|
namespace Chamilo\CoreBundle\Component\Editor\CkEditor\Toolbar;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Class ToolbarStartExpanded.
|
||||||
|
*
|
||||||
|
* @package Chamilo\CoreBundle\Component\Editor\CkEditor\Toolbar
|
||||||
|
*/
|
||||||
|
class ToolbarStartExpanded extends Basic
|
||||||
|
{
|
||||||
|
}
|
||||||
@@ -0,0 +1,39 @@
|
|||||||
|
<?php
|
||||||
|
/* For licensing terms, see /license.txt */
|
||||||
|
|
||||||
|
namespace Chamilo\CoreBundle\Component\Editor\CkEditor\Toolbar;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* UniqueAnswerImage toolbar configuration.
|
||||||
|
*
|
||||||
|
* @package Chamilo\CoreBundle\Component\Editor\CkEditor\Toolbar
|
||||||
|
*/
|
||||||
|
class UniqueAnswerImage extends Basic
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Get the toolbar config.
|
||||||
|
*
|
||||||
|
* @return array
|
||||||
|
*/
|
||||||
|
public function getConfig()
|
||||||
|
{
|
||||||
|
$config['toolbarGroups'] = [
|
||||||
|
'/',
|
||||||
|
['name' => 'basicstyles', 'groups' => ['basicstyles', 'cleanup']],
|
||||||
|
['name' => 'paragraph', 'groups' => ['list', 'indent', 'blocks', 'align']],
|
||||||
|
['name' => 'links'],
|
||||||
|
['name' => 'insert'],
|
||||||
|
'/',
|
||||||
|
['name' => 'styles'],
|
||||||
|
['name' => 'colors'],
|
||||||
|
['name' => 'tools'],
|
||||||
|
['name' => 'others'],
|
||||||
|
['name' => 'mode'],
|
||||||
|
];
|
||||||
|
|
||||||
|
$config['fullPage'] = true;
|
||||||
|
//$config['height'] = '200';
|
||||||
|
|
||||||
|
return $config;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,107 @@
|
|||||||
|
<?php
|
||||||
|
/* For licensing terms, see /license.txt */
|
||||||
|
|
||||||
|
namespace Chamilo\CoreBundle\Component\Editor\CkEditor\Toolbar;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Wiki toolbar configuration.
|
||||||
|
*
|
||||||
|
* @package Chamilo\CoreBundle\Component\Editor\CkEditor\Toolbar
|
||||||
|
*/
|
||||||
|
class Wiki extends Basic
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Get the toolbar config.
|
||||||
|
*
|
||||||
|
* @return array
|
||||||
|
*/
|
||||||
|
public function getConfig()
|
||||||
|
{
|
||||||
|
if (api_get_setting('more_buttons_maximized_mode') != 'true') {
|
||||||
|
$config['toolbar'] = $this->getNormalToolbar();
|
||||||
|
} else {
|
||||||
|
$config['toolbar_minToolbar'] = $this->getMinimizedToolbar();
|
||||||
|
}
|
||||||
|
|
||||||
|
$config['forcePasteAsPlainText'] = false;
|
||||||
|
|
||||||
|
if (api_get_setting('force_wiki_paste_as_plain_text') == 'true') {
|
||||||
|
$config['forcePasteAsPlainText'] = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
return $config;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the default toolbar configuration when the setting more_buttons_maximized_mode is false.
|
||||||
|
*
|
||||||
|
* @return array
|
||||||
|
*/
|
||||||
|
protected function getNormalToolbar()
|
||||||
|
{
|
||||||
|
return [
|
||||||
|
[
|
||||||
|
'Maximize',
|
||||||
|
'Save',
|
||||||
|
'NewPage',
|
||||||
|
'Templates',
|
||||||
|
'PageBreak',
|
||||||
|
'Preview',
|
||||||
|
'-',
|
||||||
|
'PasteText',
|
||||||
|
'-',
|
||||||
|
'Undo',
|
||||||
|
'Redo',
|
||||||
|
'-',
|
||||||
|
'SelectAll',
|
||||||
|
'-',
|
||||||
|
'Find',
|
||||||
|
],
|
||||||
|
['Wikilink', 'Link', 'Unlink', 'Anchor'],
|
||||||
|
['Image', 'Video', 'Flash', 'Oembed', 'Youtube', 'VimeoEmbed', 'Audio', 'Asciimath'],
|
||||||
|
['Table', 'HorizontalRule', 'Smiley', 'SpecialChar', 'leaflet'],
|
||||||
|
['Format', 'Font', 'FontSize'],
|
||||||
|
['Bold', 'Italic', 'Underline'],
|
||||||
|
[
|
||||||
|
'Subscript',
|
||||||
|
'Superscript',
|
||||||
|
'-',
|
||||||
|
'JustifyLeft',
|
||||||
|
'JustifyCenter',
|
||||||
|
'JustifyRight',
|
||||||
|
'JustifyFull',
|
||||||
|
'-',
|
||||||
|
'NumberedList',
|
||||||
|
'BulletedList',
|
||||||
|
'-',
|
||||||
|
'Outdent',
|
||||||
|
'Indent',
|
||||||
|
'-',
|
||||||
|
'TextColor',
|
||||||
|
'BGColor',
|
||||||
|
api_get_setting('allow_spellcheck') == 'true' ? 'Scayt' : '',
|
||||||
|
],
|
||||||
|
api_get_setting('enabled_wiris') == 'true' ? ['ckeditor_wiris_formulaEditor', 'ckeditor_wiris_formulaEditorChemistry'] : [''],
|
||||||
|
['Source'],
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the toolbar configuration when CKEditor is minimized.
|
||||||
|
*
|
||||||
|
* @return array
|
||||||
|
*/
|
||||||
|
protected function getMinimizedToolbar()
|
||||||
|
{
|
||||||
|
return [
|
||||||
|
$this->getNewPageBlock(),
|
||||||
|
['Undo', 'Redo'],
|
||||||
|
['Wikilink', 'Link', 'Image', 'Video', 'Flash', 'Audio', 'Table', 'Asciimath', 'Asciisvg'],
|
||||||
|
['BulletedList', 'NumberedList', 'HorizontalRule'],
|
||||||
|
['JustifyLeft', 'JustifyCenter', 'JustifyRight', 'JustifyBlock'],
|
||||||
|
['Styles', 'Format', 'Font', 'FontSize', 'Bold', 'Italic', 'Underline', 'TextColor', 'BGColor', 'Source'],
|
||||||
|
api_get_setting('enabled_wiris') == 'true' ? ['ckeditor_wiris_formulaEditor', 'ckeditor_wiris_formulaEditorChemistry'] : [''],
|
||||||
|
['Toolbarswitch'],
|
||||||
|
];
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,144 @@
|
|||||||
|
<?php
|
||||||
|
/* For licensing terms, see /license.txt */
|
||||||
|
|
||||||
|
namespace Chamilo\CoreBundle\Component\Editor\CkEditor\Toolbar;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* WikiStudent toolbar configuration.
|
||||||
|
*
|
||||||
|
* @package Chamilo\CoreBundle\Component\Editor\CkEditor\Toolbar
|
||||||
|
*/
|
||||||
|
class WikiStudent extends Basic
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Get the toolbar config.
|
||||||
|
*
|
||||||
|
* @return array
|
||||||
|
*/
|
||||||
|
public function getConfig()
|
||||||
|
{
|
||||||
|
if (api_get_setting('more_buttons_maximized_mode') != 'true') {
|
||||||
|
$config['toolbar'] = $this->getNormalToolbar();
|
||||||
|
} else {
|
||||||
|
$config['toolbar_minToolbar'] = $this->getMinimizedToolbar();
|
||||||
|
$config['toolbar_maxToolbar'] = $this->getMaximizedToolbar();
|
||||||
|
}
|
||||||
|
|
||||||
|
$config['forcePasteAsPlainText'] = false;
|
||||||
|
|
||||||
|
if (api_get_setting('force_wiki_paste_as_plain_text') == 'true') {
|
||||||
|
$config['forcePasteAsPlainText'] = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
return $config;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the toolbar configuration when CKEditor is maximized.
|
||||||
|
*
|
||||||
|
* @return array
|
||||||
|
*/
|
||||||
|
protected function getMaximizedToolbar()
|
||||||
|
{
|
||||||
|
return [
|
||||||
|
['Save', 'NewPage', 'Templates', '-', 'Preview', 'Print'],
|
||||||
|
['Cut', 'Copy', 'Paste', 'PasteText', 'PasteFromWord'],
|
||||||
|
['Undo', 'Redo', '-', 'SelectAll', 'Find', '-', 'RemoveFormat'],
|
||||||
|
['Wikilink', 'Link', 'Unlink', 'Anchor', 'Glossary'],
|
||||||
|
[
|
||||||
|
'Image',
|
||||||
|
'Mapping',
|
||||||
|
'Video',
|
||||||
|
'Oembed',
|
||||||
|
'Youtube',
|
||||||
|
'Flash',
|
||||||
|
'Audio',
|
||||||
|
'leaflet',
|
||||||
|
'Smiley',
|
||||||
|
'SpecialChar',
|
||||||
|
'Asciimath',
|
||||||
|
'Asciisvg',
|
||||||
|
],
|
||||||
|
'/',
|
||||||
|
['Table', '-', 'CreateDiv'],
|
||||||
|
['BulletedList', 'NumberedList', 'HorizontalRule', '-', 'Outdent', 'Indent', 'Blockquote'],
|
||||||
|
['JustifyLeft', 'JustifyCenter', 'JustifyRight', 'JustifyBlock'],
|
||||||
|
['Bold', 'Italic', 'Underline', 'Strike', '-', 'Subscript', 'Superscript', '-', 'TextColor', 'BGColor'],
|
||||||
|
[api_get_setting('allow_spellcheck') == 'true' ? 'Scayt' : ''],
|
||||||
|
['Styles', 'Format', 'Font', 'FontSize'],
|
||||||
|
['PageBreak', 'ShowBlocks'],
|
||||||
|
api_get_setting('enabled_wiris') == 'true' ? ['ckeditor_wiris_formulaEditor', 'ckeditor_wiris_formulaEditorChemistry'] : [''],
|
||||||
|
['Toolbarswitch'],
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the default toolbar configuration when the setting more_buttons_maximized_mode is false.
|
||||||
|
*
|
||||||
|
* @return array
|
||||||
|
*/
|
||||||
|
protected function getNormalToolbar()
|
||||||
|
{
|
||||||
|
return [
|
||||||
|
[
|
||||||
|
'Maximize',
|
||||||
|
'Save',
|
||||||
|
'NewPage',
|
||||||
|
'PageBreak',
|
||||||
|
'Preview',
|
||||||
|
'-',
|
||||||
|
'PasteText',
|
||||||
|
'-',
|
||||||
|
'Undo',
|
||||||
|
'Redo',
|
||||||
|
'-',
|
||||||
|
'SelectAll',
|
||||||
|
'-',
|
||||||
|
'Find',
|
||||||
|
],
|
||||||
|
['Wikilink', 'Link', 'Unlink', 'Anchor'],
|
||||||
|
['Image', 'Video', 'Flash', 'Oembed', 'Youtube', 'Audio', 'Asciimath'],
|
||||||
|
['Table', 'HorizontalRule', 'Smiley', 'SpecialChar', 'leaflet'],
|
||||||
|
['Styles', 'Format', 'Font', 'FontSize'],
|
||||||
|
['Bold', 'Italic', 'Underline'],
|
||||||
|
[
|
||||||
|
'Subscript',
|
||||||
|
'Superscript',
|
||||||
|
'-',
|
||||||
|
'JustifyLeft',
|
||||||
|
'JustifyCenter',
|
||||||
|
'JustifyRight',
|
||||||
|
'-',
|
||||||
|
'NumberedList',
|
||||||
|
'BulletedList',
|
||||||
|
'-',
|
||||||
|
'Outdent',
|
||||||
|
'Indent',
|
||||||
|
'-',
|
||||||
|
'TextColor',
|
||||||
|
'BGColor',
|
||||||
|
],
|
||||||
|
api_get_setting('enabled_wiris') == 'true' ? ['ckeditor_wiris_formulaEditor', 'ckeditor_wiris_formulaEditorChemistry'] : [''],
|
||||||
|
['ShowBlocks'],
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the toolbar configuration when CKEditor is minimized.
|
||||||
|
*
|
||||||
|
* @return array
|
||||||
|
*/
|
||||||
|
protected function getMinimizedToolbar()
|
||||||
|
{
|
||||||
|
return [
|
||||||
|
$this->getNewPageBlock(),
|
||||||
|
['Undo', 'Redo'],
|
||||||
|
['Wikilink', 'Link', 'Image', 'Video', 'Flash', 'Audio', 'Table', 'Asciimath', 'Asciisvg'],
|
||||||
|
['BulletedList', 'NumberedList', 'HorizontalRule'],
|
||||||
|
['JustifyLeft', 'JustifyCenter', 'JustifyRight'],
|
||||||
|
['Format', 'Font', 'FontSize', 'Bold', 'Italic', 'Underline', 'TextColor', 'BGColor'],
|
||||||
|
api_get_setting('enabled_wiris') == 'true' ? ['ckeditor_wiris_formulaEditor', 'ckeditor_wiris_formulaEditorChemistry'] : [''],
|
||||||
|
['Toolbarswitch'],
|
||||||
|
];
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,105 @@
|
|||||||
|
<?php
|
||||||
|
/* For licensing terms, see /license.txt */
|
||||||
|
|
||||||
|
namespace Chamilo\CoreBundle\Component\Editor\CkEditor\Toolbar;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* WikiTask toolbar configuration.
|
||||||
|
*
|
||||||
|
* @package Chamilo\CoreBundle\Component\Editor\CkEditor\Toolbar
|
||||||
|
*/
|
||||||
|
class WikiTask extends Basic
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Get the toolbar config.
|
||||||
|
*
|
||||||
|
* @return array
|
||||||
|
*/
|
||||||
|
public function getConfig()
|
||||||
|
{
|
||||||
|
if (api_get_setting('more_buttons_maximized_mode') != 'true') {
|
||||||
|
$config['toolbar'] = $this->getNormalToolbar();
|
||||||
|
} else {
|
||||||
|
$config['toolbar_minToolbar'] = $this->getMinimizedToolbar();
|
||||||
|
$config['toolbar_maxToolbar'] = $this->getMaximizedToolbar();
|
||||||
|
}
|
||||||
|
|
||||||
|
return $config;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the toolbar configuration when CKEditor is maximized.
|
||||||
|
*
|
||||||
|
* @return array
|
||||||
|
*/
|
||||||
|
protected function getMaximizedToolbar()
|
||||||
|
{
|
||||||
|
return [
|
||||||
|
['NewPage', 'Templates', '-', 'Preview', 'Print'],
|
||||||
|
['Cut', 'Copy', 'Paste', 'PasteText', 'PasteFromWord'],
|
||||||
|
['Undo', 'Redo', '-', 'SelectAll', 'Find', '-', 'RemoveFormat'],
|
||||||
|
['Wikilink', 'Link', 'Unlink', 'Anchor', 'Glossary'],
|
||||||
|
[
|
||||||
|
'Image',
|
||||||
|
'Mapping',
|
||||||
|
'Video',
|
||||||
|
'Oembed',
|
||||||
|
'Youtube',
|
||||||
|
'VimeoEmbed',
|
||||||
|
'Flash',
|
||||||
|
'Audio',
|
||||||
|
'leaflet',
|
||||||
|
'Smiley',
|
||||||
|
'SpecialChar',
|
||||||
|
],
|
||||||
|
'/',
|
||||||
|
['Table', '-', 'CreateDiv'],
|
||||||
|
['BulletedList', 'NumberedList', 'HorizontalRule', '-', 'Outdent', 'Indent', 'Blockquote'],
|
||||||
|
['JustifyLeft', 'JustifyCenter', 'JustifyRight', 'JustifyBlock'],
|
||||||
|
['Bold', 'Italic', 'Underline', 'Strike', '-', 'Subscript', 'Superscript', '-', 'TextColor', 'BGColor'],
|
||||||
|
[api_get_setting('allow_spellcheck') == 'true' ? 'Scayt' : ''],
|
||||||
|
['Styles', 'Format', 'Font', 'FontSize'],
|
||||||
|
['PageBreak', 'ShowBlocks', 'Source'],
|
||||||
|
api_get_setting('enabled_wiris') == 'true' ? ['ckeditor_wiris_formulaEditor', 'ckeditor_wiris_formulaEditorChemistry'] : [''],
|
||||||
|
['Toolbarswitch'],
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the default toolbar configuration when the setting more_buttons_maximized_mode is false.
|
||||||
|
*
|
||||||
|
* @return array
|
||||||
|
*/
|
||||||
|
protected function getNormalToolbar()
|
||||||
|
{
|
||||||
|
return [
|
||||||
|
['Maximize', '-', 'PasteFromWord', '-', 'Undo', 'Redo'],
|
||||||
|
['Link', 'Unlink'],
|
||||||
|
['Image', 'Video', 'Flash', 'Oembed', 'Youtube', 'VimeoEmbed', 'Audio'],
|
||||||
|
['Table'],
|
||||||
|
['Bold', 'Italic', 'Underline'],
|
||||||
|
['JustifyLeft', 'JustifyCenter', 'JustifyRight', '-', 'NumberedList', 'BulletedList', '-', 'TextColor', 'BGColor'],
|
||||||
|
api_get_setting('enabled_wiris') == 'true' ? ['ckeditor_wiris_formulaEditor', 'ckeditor_wiris_formulaEditorChemistry'] : [''],
|
||||||
|
['Source'],
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the toolbar configuration when CKEditor is minimized.
|
||||||
|
*
|
||||||
|
* @return array
|
||||||
|
*/
|
||||||
|
protected function getMinimizedToolbar()
|
||||||
|
{
|
||||||
|
return [
|
||||||
|
$this->getNewPageBlock(),
|
||||||
|
['Undo', 'Redo'],
|
||||||
|
['Link', 'Image', 'Video', 'Flash', 'Audio', 'Table'],
|
||||||
|
['BulletedList', 'NumberedList', 'HorizontalRule'],
|
||||||
|
['JustifyLeft', 'JustifyCenter', 'JustifyRight'],
|
||||||
|
['Styles', 'Format', 'Font', 'FontSize', 'Bold', 'Italic', 'Underline', 'TextColor', 'BGColor'],
|
||||||
|
api_get_setting('enabled_wiris') == 'true' ? ['ckeditor_wiris_formulaEditor', 'ckeditor_wiris_formulaEditorChemistry'] : [''],
|
||||||
|
['Toolbarswitch'],
|
||||||
|
];
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,110 @@
|
|||||||
|
<?php
|
||||||
|
/* For licensing terms, see /license.txt */
|
||||||
|
|
||||||
|
namespace Chamilo\CoreBundle\Component\Editor\CkEditor\Toolbar;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Work toolbar configuration.
|
||||||
|
*
|
||||||
|
* @package Chamilo\CoreBundle\Component\Editor\CkEditor\Toolbar *
|
||||||
|
*/
|
||||||
|
class Work extends Basic
|
||||||
|
{
|
||||||
|
public $plugins = [];
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the toolbar config.
|
||||||
|
*
|
||||||
|
* @return array
|
||||||
|
*/
|
||||||
|
public function getConfig()
|
||||||
|
{
|
||||||
|
if (api_get_setting('more_buttons_maximized_mode') != 'true') {
|
||||||
|
$config['toolbar'] = $this->getNormalToolbar();
|
||||||
|
} else {
|
||||||
|
$config['toolbar_minToolbar'] = $this->getMinimizedToolbar();
|
||||||
|
|
||||||
|
$config['toolbar_maxToolbar'] = $this->getMaximizedToolbar();
|
||||||
|
}
|
||||||
|
|
||||||
|
return $config;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the toolbar configuration when CKEditor is maximized.
|
||||||
|
*
|
||||||
|
* @return array
|
||||||
|
*/
|
||||||
|
protected function getMaximizedToolbar()
|
||||||
|
{
|
||||||
|
return [
|
||||||
|
['Save', 'NewPage', 'Templates', '-', 'Preview', 'Print'],
|
||||||
|
['Cut', 'Copy', 'Paste', 'PasteText', 'PasteFromWord'],
|
||||||
|
['Undo', 'Redo', '-', 'SelectAll', 'Find', '-', 'RemoveFormat'],
|
||||||
|
['Link', 'Unlink', 'Anchor', 'Glossary'],
|
||||||
|
[
|
||||||
|
'Image',
|
||||||
|
'Mapping',
|
||||||
|
'Video',
|
||||||
|
'Oembed',
|
||||||
|
'Youtube',
|
||||||
|
'VimeoEmbed',
|
||||||
|
'Flash',
|
||||||
|
'Audio',
|
||||||
|
'leaflet',
|
||||||
|
'Smiley',
|
||||||
|
'SpecialChar',
|
||||||
|
'Asciimath',
|
||||||
|
],
|
||||||
|
'/',
|
||||||
|
['Table', '-', 'CreateDiv'],
|
||||||
|
['BulletedList', 'NumberedList', 'HorizontalRule', '-', 'Outdent', 'Indent', 'Blockquote'],
|
||||||
|
['JustifyLeft', 'JustifyCenter', 'JustifyRight', 'JustifyBlock'],
|
||||||
|
['Bold', 'Italic', 'Underline', 'Strike', '-', 'Subscript', 'Superscript', '-', 'TextColor', 'BGColor'],
|
||||||
|
[api_get_setting('allow_spellcheck') == 'true' ? 'Scayt' : ''],
|
||||||
|
['Styles', 'Format', 'Font', 'FontSize'],
|
||||||
|
['PageBreak', 'ShowBlocks', 'Source'],
|
||||||
|
api_get_setting('enabled_wiris') === 'true' ? ['ckeditor_wiris_formulaEditor', 'ckeditor_wiris_formulaEditorChemistry'] : [''],
|
||||||
|
['Toolbarswitch'],
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the default toolbar configuration when the setting more_buttons_maximized_mode is false.
|
||||||
|
*
|
||||||
|
* @return array
|
||||||
|
*/
|
||||||
|
protected function getNormalToolbar()
|
||||||
|
{
|
||||||
|
return [
|
||||||
|
['Maxmize', '-', 'PasteFromWord', '-', 'Undo', 'Redo'],
|
||||||
|
['Link', 'Unlink', 'Anchor'],
|
||||||
|
['Image', 'Video', 'Flash', 'Oembed', 'Youtube', 'VimeoEmbed', 'Audio'],
|
||||||
|
['Table', 'Smiley'],
|
||||||
|
'/',
|
||||||
|
['Font', 'FontSize'],
|
||||||
|
['Bold', 'Italic', 'Underline'],
|
||||||
|
['JustifyLeft', 'JustifyCenter', 'JustifyRight', '-', 'NumberedList', 'BulletedList', '-', 'TextColor', 'BGColor'],
|
||||||
|
api_get_setting('enabled_wiris') === 'true' ? ['ckeditor_wiris_formulaEditor', 'ckeditor_wiris_formulaEditorChemistry'] : [''],
|
||||||
|
['Source'],
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the toolbar configuration when CKEditor is minimized.
|
||||||
|
*
|
||||||
|
* @return array
|
||||||
|
*/
|
||||||
|
protected function getMinimizedToolbar()
|
||||||
|
{
|
||||||
|
return [
|
||||||
|
$this->getNewPageBlock(),
|
||||||
|
['Undo', 'Redo'],
|
||||||
|
['Link', 'Image', 'Video', 'Flash', 'Youtube', 'VimeoEmbed', 'Audio', 'Table', 'Asciimath'],
|
||||||
|
['JustifyLeft', 'JustifyCenter', 'JustifyRight'],
|
||||||
|
['Format', 'Font', 'FontSize', 'Bold', 'Italic', 'TextColor', 'BGColor'],
|
||||||
|
api_get_setting('enabled_wiris') === 'true' ? ['ckeditor_wiris_formulaEditor', 'ckeditor_wiris_formulaEditorChemistry'] : [''],
|
||||||
|
['Toolbarswitch'],
|
||||||
|
];
|
||||||
|
}
|
||||||
|
}
|
||||||
402
src/Chamilo/CoreBundle/Component/Editor/Connector.php
Normal file
402
src/Chamilo/CoreBundle/Component/Editor/Connector.php
Normal file
@@ -0,0 +1,402 @@
|
|||||||
|
<?php
|
||||||
|
/* For licensing terms, see /license.txt */
|
||||||
|
|
||||||
|
namespace Chamilo\CoreBundle\Component\Editor;
|
||||||
|
|
||||||
|
use Chamilo\CoreBundle\Component\Editor\Driver\Driver;
|
||||||
|
use Symfony\Component\Routing\Router;
|
||||||
|
use Symfony\Component\Translation\Translator;
|
||||||
|
|
||||||
|
//use Symfony\Component\Security\Core\SecurityContext;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Class elFinder Connector - editor + Chamilo repository.
|
||||||
|
*
|
||||||
|
* @package Chamilo\CoreBundle\Component\Editor
|
||||||
|
*/
|
||||||
|
class Connector
|
||||||
|
{
|
||||||
|
/** @var array */
|
||||||
|
public $course;
|
||||||
|
|
||||||
|
/** @var array */
|
||||||
|
public $user;
|
||||||
|
|
||||||
|
/** @var Translator */
|
||||||
|
public $translator;
|
||||||
|
|
||||||
|
/** @var Router */
|
||||||
|
public $urlGenerator;
|
||||||
|
/** @var SecurityContext */
|
||||||
|
public $security;
|
||||||
|
|
||||||
|
public $paths;
|
||||||
|
|
||||||
|
public $entityManager;
|
||||||
|
|
||||||
|
public $drivers = [];
|
||||||
|
public $driverList = [];
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Connector constructor.
|
||||||
|
*/
|
||||||
|
public function __construct()
|
||||||
|
{
|
||||||
|
$this->paths = [
|
||||||
|
'root_sys' => api_get_path(SYS_PATH),
|
||||||
|
'sys_root' => api_get_path(SYS_PATH), // just an alias
|
||||||
|
'sys_course_path' => api_get_path(SYS_COURSE_PATH),
|
||||||
|
// 'sys_config_path' => $app['path.config'],
|
||||||
|
'path.temp' => api_get_path(SYS_ARCHIVE_PATH),
|
||||||
|
//'sys_log_path' => $app['path.logs']
|
||||||
|
];
|
||||||
|
/*$this->entityManager = $entityManager;
|
||||||
|
$this->paths = $paths;
|
||||||
|
$this->urlGenerator = $urlGenerator;
|
||||||
|
$this->translator = $translator;
|
||||||
|
$this->security = $security;*/
|
||||||
|
$this->user = api_get_user_info();
|
||||||
|
$this->course = api_get_course_info();
|
||||||
|
$this->driverList = $this->getDefaultDriverList();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return array
|
||||||
|
*/
|
||||||
|
public function getDriverList()
|
||||||
|
{
|
||||||
|
return $this->driverList;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Available driver list.
|
||||||
|
*
|
||||||
|
* @param array
|
||||||
|
*/
|
||||||
|
public function setDriverList($list)
|
||||||
|
{
|
||||||
|
$this->driverList = $list;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param Driver $driver
|
||||||
|
*/
|
||||||
|
public function addDriver($driver)
|
||||||
|
{
|
||||||
|
if (!empty($driver)) {
|
||||||
|
$this->drivers[$driver->getName()] = $driver;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return array
|
||||||
|
*/
|
||||||
|
public function getDrivers()
|
||||||
|
{
|
||||||
|
return $this->drivers;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param string $driverName
|
||||||
|
*
|
||||||
|
* @return Driver $driver
|
||||||
|
*/
|
||||||
|
public function getDriver($driverName)
|
||||||
|
{
|
||||||
|
if (isset($this->drivers[$driverName])) {
|
||||||
|
return $this->drivers[$driverName];
|
||||||
|
}
|
||||||
|
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param bool $processDefaultValues
|
||||||
|
*
|
||||||
|
* @return array
|
||||||
|
*/
|
||||||
|
public function getRoots($processDefaultValues = true)
|
||||||
|
{
|
||||||
|
$roots = [];
|
||||||
|
$drivers = $this->getDrivers();
|
||||||
|
/** @var Driver $driver */
|
||||||
|
foreach ($drivers as $driver) {
|
||||||
|
if ($processDefaultValues) {
|
||||||
|
$plugin = [
|
||||||
|
'chamilo' => [
|
||||||
|
'driverName' => $driver->getName(),
|
||||||
|
'connector' => $this,
|
||||||
|
],
|
||||||
|
];
|
||||||
|
$configuration = $driver->getConfiguration();
|
||||||
|
$driver->setup();
|
||||||
|
$configuration['plugin'] = $plugin;
|
||||||
|
$root = $this->updateWithDefaultValues($configuration);
|
||||||
|
}
|
||||||
|
$roots[] = $root;
|
||||||
|
}
|
||||||
|
|
||||||
|
return $roots;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Merges the default driver settings.
|
||||||
|
*
|
||||||
|
* @param array $driver
|
||||||
|
*
|
||||||
|
* @return array
|
||||||
|
*/
|
||||||
|
public function updateWithDefaultValues($driver)
|
||||||
|
{
|
||||||
|
if (empty($driver) || !isset($driver['driver'])) {
|
||||||
|
return [];
|
||||||
|
}
|
||||||
|
|
||||||
|
$defaultDriver = $this->getDefaultDriverSettings();
|
||||||
|
|
||||||
|
if (isset($driver['attributes'])) {
|
||||||
|
$attributes = array_merge($defaultDriver['attributes'], $driver['attributes']);
|
||||||
|
} else {
|
||||||
|
$attributes = $defaultDriver['attributes'];
|
||||||
|
}
|
||||||
|
|
||||||
|
$driverUpdated = array_merge($defaultDriver, $driver);
|
||||||
|
$driverUpdated['driver'] = 'Chamilo\CoreBundle\Component\Editor\Driver\\'.$driver['driver'];
|
||||||
|
$driverUpdated['attributes'] = $attributes;
|
||||||
|
|
||||||
|
return $driverUpdated;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get default driver settings.
|
||||||
|
*
|
||||||
|
* @return array
|
||||||
|
*/
|
||||||
|
public function getDefaultDriverSettings()
|
||||||
|
{
|
||||||
|
// for more options: https://github.com/Studio-42/elFinder/wiki/Connector-configuration-options
|
||||||
|
return [
|
||||||
|
'uploadOverwrite' => false, // Replace files on upload or give them new name if the same file was uploaded
|
||||||
|
//'acceptedName' =>
|
||||||
|
'uploadAllow' => [
|
||||||
|
'image',
|
||||||
|
'audio',
|
||||||
|
'video',
|
||||||
|
'text/html',
|
||||||
|
'text/csv',
|
||||||
|
'application/pdf',
|
||||||
|
'application/postscript',
|
||||||
|
'application/vnd.ms-word',
|
||||||
|
'application/vnd.ms-excel',
|
||||||
|
'application/vnd.ms-powerpoint',
|
||||||
|
'application/pdf',
|
||||||
|
'application/xml',
|
||||||
|
'application/vnd.oasis.opendocument.text',
|
||||||
|
'application/x-shockwave-flash',
|
||||||
|
'application/vnd.adobe.flash.movie',
|
||||||
|
], // allow files
|
||||||
|
//'uploadDeny' => array('text/x-php'),
|
||||||
|
'uploadOrder' => ['allow'], // only executes allow
|
||||||
|
'disabled' => [
|
||||||
|
'duplicate',
|
||||||
|
'rename',
|
||||||
|
'mkdir',
|
||||||
|
'mkfile',
|
||||||
|
'copy',
|
||||||
|
'cut',
|
||||||
|
'paste',
|
||||||
|
'edit',
|
||||||
|
'extract',
|
||||||
|
'archive',
|
||||||
|
'help',
|
||||||
|
'resize',
|
||||||
|
],
|
||||||
|
'attributes' => [
|
||||||
|
// Hiding dangerous files
|
||||||
|
[
|
||||||
|
'pattern' => '/\.(php|py|pl|sh|xml)$/i',
|
||||||
|
'read' => false,
|
||||||
|
'write' => false,
|
||||||
|
'hidden' => true,
|
||||||
|
'locked' => false,
|
||||||
|
],
|
||||||
|
// Hiding _DELETED_ files
|
||||||
|
[
|
||||||
|
'pattern' => '/_DELETED_/',
|
||||||
|
'read' => false,
|
||||||
|
'write' => false,
|
||||||
|
'hidden' => true,
|
||||||
|
'locked' => false,
|
||||||
|
],
|
||||||
|
// Hiding thumbnails
|
||||||
|
[
|
||||||
|
'pattern' => '/.tmb/',
|
||||||
|
'read' => false,
|
||||||
|
'write' => false,
|
||||||
|
'hidden' => true,
|
||||||
|
'locked' => false,
|
||||||
|
],
|
||||||
|
[
|
||||||
|
'pattern' => '/.thumbs/',
|
||||||
|
'read' => false,
|
||||||
|
'write' => false,
|
||||||
|
'hidden' => true,
|
||||||
|
'locked' => false,
|
||||||
|
],
|
||||||
|
[
|
||||||
|
'pattern' => '/.quarantine/',
|
||||||
|
'read' => false,
|
||||||
|
'write' => false,
|
||||||
|
'hidden' => true,
|
||||||
|
'locked' => false,
|
||||||
|
],
|
||||||
|
],
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return array
|
||||||
|
*/
|
||||||
|
public function getOperations()
|
||||||
|
{
|
||||||
|
//https://github.com/Studio-42/elFinder/wiki/Connector-configuration-options-2.1
|
||||||
|
$opts = [
|
||||||
|
//'debug' => true,
|
||||||
|
'bind' => [
|
||||||
|
'upload rm mkdir' => [$this, 'manageCommands'],
|
||||||
|
],
|
||||||
|
'sessionCloseEarlier' => false,
|
||||||
|
];
|
||||||
|
|
||||||
|
$this->setDrivers();
|
||||||
|
$opts['roots'] = $this->getRoots();
|
||||||
|
|
||||||
|
return $opts;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set drivers from list.
|
||||||
|
*/
|
||||||
|
public function setDrivers()
|
||||||
|
{
|
||||||
|
foreach ($this->getDriverList() as $driverName) {
|
||||||
|
$this->setDriver($driverName);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets a driver.
|
||||||
|
*
|
||||||
|
* @param string $driverName
|
||||||
|
*/
|
||||||
|
public function setDriver($driverName)
|
||||||
|
{
|
||||||
|
$driverClass = $this->getDriverClass($driverName);
|
||||||
|
|
||||||
|
/** @var Driver $driver */
|
||||||
|
$driver = new $driverClass();
|
||||||
|
$driver->setName($driverName);
|
||||||
|
$driver->setConnector($this);
|
||||||
|
$this->addDriver($driver);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Simple function to demonstrate how to control file access using "accessControl" callback.
|
||||||
|
* This method will disable accessing files/folders starting from '.' (dot).
|
||||||
|
*
|
||||||
|
* @param string $attr attribute name (read|write|locked|hidden)
|
||||||
|
* @param string $path file path relative to volume root directory started with directory separator
|
||||||
|
* @param string $data
|
||||||
|
* @param string $volume
|
||||||
|
*
|
||||||
|
* @return bool|null
|
||||||
|
*/
|
||||||
|
public function access($attr, $path, $data, $volume)
|
||||||
|
{
|
||||||
|
return strpos(basename($path), '.') === 0 // if file/folder begins with '.' (dot)
|
||||||
|
? !($attr == 'read' || $attr == 'write') // set read+write to false, other (locked+hidden) set to true
|
||||||
|
: null; // else elFinder decide it itself
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param string $cmd
|
||||||
|
* @param array $result
|
||||||
|
* @param array $args
|
||||||
|
* @param Finder $elFinder
|
||||||
|
*/
|
||||||
|
public function manageCommands($cmd, $result, $args, $elFinder)
|
||||||
|
{
|
||||||
|
$cmd = ucfirst($cmd);
|
||||||
|
$cmd = 'after'.$cmd;
|
||||||
|
/*
|
||||||
|
if (isset($args['target'])) {
|
||||||
|
$driverName = $elFinder->getVolumeDriverNameByTarget($args['target']);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (isset($args['targets'])) {
|
||||||
|
foreach ($args['targets'] as $target) {
|
||||||
|
$driverName = $elFinder->getVolumeDriverNameByTarget($target);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
*/
|
||||||
|
if (empty($driverName)) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!empty($result['error'])) {
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!empty($result['warning'])) {
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!empty($result['removed'])) {
|
||||||
|
foreach ($result['removed'] as $file) {
|
||||||
|
/** @var Driver $driver */
|
||||||
|
// $driver = $this->getDriver($driverName);
|
||||||
|
// $driver->$cmd($file, $args, $elFinder);
|
||||||
|
// removed file contain additional field "realpath"
|
||||||
|
//$log .= "\tREMOVED: ".$file['realpath']."\n";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!empty($result['added'])) {
|
||||||
|
foreach ($result['added'] as $file) {
|
||||||
|
// $driver = $this->getDriver($driverName);
|
||||||
|
// $driver->$cmd($file, $args, $elFinder);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!empty($result['changed'])) {
|
||||||
|
foreach ($result['changed'] as $file) {
|
||||||
|
//$log .= "\tCHANGED: ".$elfinder->realpath($file['hash'])."\n";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Available driver list.
|
||||||
|
*
|
||||||
|
* @return array
|
||||||
|
*/
|
||||||
|
private function getDefaultDriverList()
|
||||||
|
{
|
||||||
|
return [
|
||||||
|
'CourseDriver',
|
||||||
|
'CourseUserDriver',
|
||||||
|
'DropBoxDriver',
|
||||||
|
'HomeDriver',
|
||||||
|
'PersonalDriver',
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param string $driver
|
||||||
|
*
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
|
private function getDriverClass($driver)
|
||||||
|
{
|
||||||
|
return 'Chamilo\CoreBundle\Component\Editor\Driver\\'.$driver;
|
||||||
|
}
|
||||||
|
}
|
||||||
482
src/Chamilo/CoreBundle/Component/Editor/Driver/CourseDriver.php
Normal file
482
src/Chamilo/CoreBundle/Component/Editor/Driver/CourseDriver.php
Normal file
@@ -0,0 +1,482 @@
|
|||||||
|
<?php
|
||||||
|
/* For licensing terms, see /license.txt */
|
||||||
|
|
||||||
|
namespace Chamilo\CoreBundle\Component\Editor\Driver;
|
||||||
|
|
||||||
|
use CourseHome;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Class CourseDriver.
|
||||||
|
*
|
||||||
|
* @package Chamilo\CoreBundle\Component\Editor\Driver
|
||||||
|
*/
|
||||||
|
class CourseDriver extends Driver implements DriverInterface
|
||||||
|
{
|
||||||
|
public $name = 'CourseDriver';
|
||||||
|
public $visibleFiles = [];
|
||||||
|
private $coursePath;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Setups the folder.
|
||||||
|
*/
|
||||||
|
public function setup()
|
||||||
|
{
|
||||||
|
$userId = api_get_user_id();
|
||||||
|
$userInfo = api_get_user_info();
|
||||||
|
$sessionId = api_get_session_id();
|
||||||
|
$courseInfo = $this->connector->course;
|
||||||
|
|
||||||
|
if (!empty($courseInfo)) {
|
||||||
|
$coursePath = api_get_path(SYS_COURSE_PATH);
|
||||||
|
$courseDir = $courseInfo['directory'].'/document';
|
||||||
|
$baseDir = $coursePath.$courseDir;
|
||||||
|
$this->coursePath = $baseDir;
|
||||||
|
|
||||||
|
// Creates shared folder
|
||||||
|
if (!file_exists($baseDir.'/shared_folder')) {
|
||||||
|
$title = get_lang('UserFolders');
|
||||||
|
$folderName = '/shared_folder';
|
||||||
|
//$groupId = 0;
|
||||||
|
$visibility = 0;
|
||||||
|
create_unexisting_directory(
|
||||||
|
$courseInfo,
|
||||||
|
$userId,
|
||||||
|
$sessionId,
|
||||||
|
0,
|
||||||
|
null,
|
||||||
|
$baseDir,
|
||||||
|
$folderName,
|
||||||
|
$title,
|
||||||
|
$visibility
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Creates user-course folder
|
||||||
|
if (!file_exists($baseDir.'/shared_folder/sf_user_'.$userId)) {
|
||||||
|
$title = $userInfo['complete_name'];
|
||||||
|
$folderName = '/shared_folder/sf_user_'.$userId;
|
||||||
|
$visibility = 1;
|
||||||
|
create_unexisting_directory(
|
||||||
|
$courseInfo,
|
||||||
|
$userId,
|
||||||
|
$sessionId,
|
||||||
|
0,
|
||||||
|
null,
|
||||||
|
$baseDir,
|
||||||
|
$folderName,
|
||||||
|
$title,
|
||||||
|
$visibility
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* {@inheritdoc}
|
||||||
|
*/
|
||||||
|
public function getConfiguration()
|
||||||
|
{
|
||||||
|
if ($this->allow()) {
|
||||||
|
//$translator = $this->connector->translator;
|
||||||
|
//$code = $this->connector->course->getCode();
|
||||||
|
$courseCode = $this->connector->course['code'];
|
||||||
|
$alias = $courseCode.' '.get_lang('Documents');
|
||||||
|
$userId = api_get_user_id();
|
||||||
|
$config = [
|
||||||
|
'driver' => 'CourseDriver',
|
||||||
|
'path' => $this->getCourseDocumentSysPath(),
|
||||||
|
'URL' => $this->getCourseDocumentRelativeWebPath(),
|
||||||
|
'accessControl' => [$this, 'access'],
|
||||||
|
'alias' => $alias,
|
||||||
|
'attributes' => [
|
||||||
|
// Hide shared_folder
|
||||||
|
[
|
||||||
|
'pattern' => '/shared_folder/',
|
||||||
|
'read' => false,
|
||||||
|
'write' => false,
|
||||||
|
'hidden' => true,
|
||||||
|
'locked' => false,
|
||||||
|
],
|
||||||
|
[
|
||||||
|
'pattern' => '/^\/index.html$/',
|
||||||
|
'read' => false,
|
||||||
|
'write' => false,
|
||||||
|
'hidden' => true,
|
||||||
|
'locked' => false,
|
||||||
|
],
|
||||||
|
],
|
||||||
|
];
|
||||||
|
|
||||||
|
// admin/teachers can create dirs from ckeditor
|
||||||
|
if ($this->allowToEdit()) {
|
||||||
|
$config['attributes'][] = [
|
||||||
|
'pattern' => '/^\/learning_path$/', // block delete learning_path
|
||||||
|
'read' => true,
|
||||||
|
'write' => false,
|
||||||
|
'hidden' => false,
|
||||||
|
'locked' => true,
|
||||||
|
];
|
||||||
|
$config['attributes'][] = [
|
||||||
|
'pattern' => '/learning_path\/(.*)/', // allow edit/delete inside learning_path
|
||||||
|
'read' => true,
|
||||||
|
'write' => true,
|
||||||
|
'hidden' => false,
|
||||||
|
'locked' => false,
|
||||||
|
];
|
||||||
|
|
||||||
|
$defaultDisabled = $this->connector->getDefaultDriverSettings()['disabled'];
|
||||||
|
$defaultDisabled = array_flip($defaultDisabled);
|
||||||
|
unset($defaultDisabled['mkdir']);
|
||||||
|
$defaultDisabled = array_flip($defaultDisabled);
|
||||||
|
$config['disabled'] = $defaultDisabled;
|
||||||
|
} else {
|
||||||
|
$protectedFolders = \DocumentManager::getProtectedFolderFromStudent();
|
||||||
|
foreach ($protectedFolders as $folder) {
|
||||||
|
$config['attributes'][] = [
|
||||||
|
'pattern' => $folder.'/',
|
||||||
|
'read' => false,
|
||||||
|
'write' => false,
|
||||||
|
'hidden' => true,
|
||||||
|
'locked' => false,
|
||||||
|
];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$foldersToHide = \DocumentManager::get_all_document_folders(
|
||||||
|
$this->connector->course,
|
||||||
|
null,
|
||||||
|
false,
|
||||||
|
true
|
||||||
|
);
|
||||||
|
|
||||||
|
// Teachers can see all files and folders see #1425
|
||||||
|
if ($this->allowToEdit()) {
|
||||||
|
$foldersToHide = [];
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!empty($foldersToHide)) {
|
||||||
|
foreach ($foldersToHide as $folder) {
|
||||||
|
$config['attributes'][] = [
|
||||||
|
'pattern' => '!'.$folder.'!',
|
||||||
|
'read' => false,
|
||||||
|
'write' => false,
|
||||||
|
'hidden' => true,
|
||||||
|
'locked' => false,
|
||||||
|
];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Hide all groups folders
|
||||||
|
$config['attributes'][] = [
|
||||||
|
'pattern' => '!_groupdocs_!',
|
||||||
|
'read' => false,
|
||||||
|
'write' => false,
|
||||||
|
'hidden' => true,
|
||||||
|
'locked' => false,
|
||||||
|
];
|
||||||
|
|
||||||
|
// Allow only the groups I have access
|
||||||
|
$allGroups = \GroupManager::getAllGroupPerUserSubscription($userId);
|
||||||
|
if (!empty($allGroups)) {
|
||||||
|
foreach ($allGroups as $groupInfo) {
|
||||||
|
$groupId = $groupInfo['iid'];
|
||||||
|
if (\GroupManager::user_has_access(
|
||||||
|
$userId,
|
||||||
|
$groupId,
|
||||||
|
\GroupManager::GROUP_TOOL_DOCUMENTS
|
||||||
|
)) {
|
||||||
|
$config['attributes'][] = [
|
||||||
|
'pattern' => '!'.$groupInfo['secret_directory'].'!',
|
||||||
|
'read' => true,
|
||||||
|
'write' => false,
|
||||||
|
'hidden' => false,
|
||||||
|
'locked' => false,
|
||||||
|
];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return $config;
|
||||||
|
}
|
||||||
|
|
||||||
|
return [];
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This is the absolute document course path like
|
||||||
|
* /var/www/portal/data/courses/XXX/document/.
|
||||||
|
*
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
|
public function getCourseDocumentSysPath()
|
||||||
|
{
|
||||||
|
$url = '';
|
||||||
|
if ($this->allow()) {
|
||||||
|
$directory = $this->getCourseDirectory();
|
||||||
|
$coursePath = $this->connector->paths['sys_course_path'];
|
||||||
|
$url = $coursePath.$directory.'/document/';
|
||||||
|
}
|
||||||
|
|
||||||
|
return $url;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
|
public function getCourseDocumentRelativeWebPath()
|
||||||
|
{
|
||||||
|
$url = null;
|
||||||
|
if ($this->allow()) {
|
||||||
|
$directory = $this->getCourseDirectory();
|
||||||
|
$url = api_get_path(REL_COURSE_PATH).$directory.'/document/';
|
||||||
|
}
|
||||||
|
|
||||||
|
return $url;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
|
public function getCourseDocumentWebPath()
|
||||||
|
{
|
||||||
|
$url = null;
|
||||||
|
if ($this->allow()) {
|
||||||
|
$directory = $this->getCourseDirectory();
|
||||||
|
$url = api_get_path(WEB_COURSE_PATH).$directory.'/document/';
|
||||||
|
}
|
||||||
|
|
||||||
|
return $url;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
|
public function getCourseDirectory()
|
||||||
|
{
|
||||||
|
return $this->connector->course['directory'];
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* {@inheritdoc}
|
||||||
|
*/
|
||||||
|
public function upload($fp, $dst, $name, $tmpname, $hashes = [])
|
||||||
|
{
|
||||||
|
// Needed to load course information in elfinder
|
||||||
|
$this->setConnectorFromPlugin();
|
||||||
|
|
||||||
|
if ($this->allowToEdit()) {
|
||||||
|
// upload file by elfinder.
|
||||||
|
$size = filesize($tmpname);
|
||||||
|
|
||||||
|
// check the max filesize.
|
||||||
|
$maxFileSize = getIniMaxFileSizeInBytes();
|
||||||
|
if ($maxFileSize > 0 && $size > $maxFileSize) {
|
||||||
|
$errorUploadMessage = get_lang('FileSizeIsTooBig').' '.get_lang('MaxFileSize').' : '.getIniMaxFileSizeInBytes(true);
|
||||||
|
$this->addError($errorUploadMessage);
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
$maxSpace = \DocumentManager::get_course_quota($this->connector->course['code']);
|
||||||
|
// Check if there is enough space to save the file.
|
||||||
|
if (!\DocumentManager::enough_space($size, $maxSpace)) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
$result = parent::upload($fp, $dst, $name, $tmpname);
|
||||||
|
$name = $result['name'];
|
||||||
|
$filtered = \URLify::filter($result['name'], 80, '', true);
|
||||||
|
|
||||||
|
if (strcmp($name, $filtered) != 0) {
|
||||||
|
$result = $this->customRename($result['hash'], $filtered);
|
||||||
|
}
|
||||||
|
|
||||||
|
$realPath = $this->realpath($result['hash']);
|
||||||
|
if (!empty($realPath)) {
|
||||||
|
// Getting file info
|
||||||
|
//$info = $elFinder->exec('file', array('target' => $file['hash']));
|
||||||
|
/** @var elFinderVolumeLocalFileSystem $volume */
|
||||||
|
//$volume = $info['volume'];
|
||||||
|
//$root = $volume->root();
|
||||||
|
//var/www/chamilogits/data/courses/NEWONE/document
|
||||||
|
$realPathRoot = $this->getCourseDocumentSysPath();
|
||||||
|
|
||||||
|
// Removing course path
|
||||||
|
$realPath = str_replace($realPathRoot, '/', $realPath);
|
||||||
|
add_document(
|
||||||
|
$this->connector->course,
|
||||||
|
$realPath,
|
||||||
|
'file',
|
||||||
|
(int) $result['size'],
|
||||||
|
$result['name']
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
return $result;
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* {@inheritdoc}
|
||||||
|
*/
|
||||||
|
public function rm($hash)
|
||||||
|
{
|
||||||
|
// elfinder does not delete the file
|
||||||
|
//parent::rm($hash);
|
||||||
|
$this->setConnectorFromPlugin();
|
||||||
|
|
||||||
|
if ($this->allowToEdit()) {
|
||||||
|
$path = $this->decode($hash);
|
||||||
|
$stat = $this->stat($path);
|
||||||
|
$stat['realpath'] = $path;
|
||||||
|
$this->removed[] = $stat;
|
||||||
|
|
||||||
|
$realFilePath = $path;
|
||||||
|
$coursePath = $this->getCourseDocumentSysPath();
|
||||||
|
$filePath = str_replace($coursePath, '/', $realFilePath);
|
||||||
|
|
||||||
|
\DocumentManager::delete_document(
|
||||||
|
$this->connector->course,
|
||||||
|
$filePath,
|
||||||
|
$coursePath
|
||||||
|
);
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return bool
|
||||||
|
*/
|
||||||
|
public function allow()
|
||||||
|
{
|
||||||
|
//if ($this->connector->security->isGranted('ROLE_ADMIN')) {
|
||||||
|
if (api_is_anonymous()) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
$isAllowedToEdit = api_is_allowed_to_edit();
|
||||||
|
|
||||||
|
$block = api_get_configuration_value('block_editor_file_manager_for_students');
|
||||||
|
if ($block && !$isAllowedToEdit) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (isset($this->connector->course) && !empty($this->connector->course)) {
|
||||||
|
$isDocumentsToolVisible = CourseHome::getToolVisibility(
|
||||||
|
TOOL_DOCUMENT,
|
||||||
|
api_get_course_int_id(),
|
||||||
|
api_get_session_id()
|
||||||
|
);
|
||||||
|
|
||||||
|
if (!$isDocumentsToolVisible && !$isAllowedToEdit) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Allow to upload/delete folder or files.
|
||||||
|
*
|
||||||
|
* @return bool
|
||||||
|
*/
|
||||||
|
public function allowToEdit()
|
||||||
|
{
|
||||||
|
$allow = $this->allow();
|
||||||
|
|
||||||
|
return $allow && api_is_allowed_to_edit(null, true);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* {@inheritdoc}
|
||||||
|
*/
|
||||||
|
public function mkdir($path, $name)
|
||||||
|
{
|
||||||
|
// Needed to load course information in elfinder
|
||||||
|
$this->setConnectorFromPlugin();
|
||||||
|
|
||||||
|
if ($this->allowToEdit() === false) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
$name = api_replace_dangerous_char($name);
|
||||||
|
$result = parent::mkdir($path, $name);
|
||||||
|
|
||||||
|
if ($result && isset($result['hash'])) {
|
||||||
|
$_course = $this->connector->course;
|
||||||
|
$realPathRoot = $this->getCourseDocumentSysPath();
|
||||||
|
$realPath = $this->realpath($result['hash']);
|
||||||
|
|
||||||
|
// Removing course path
|
||||||
|
$newPath = str_replace($realPathRoot, '/', $realPath);
|
||||||
|
$documentId = add_document(
|
||||||
|
$_course,
|
||||||
|
$newPath,
|
||||||
|
'folder',
|
||||||
|
0,
|
||||||
|
$name,
|
||||||
|
null,
|
||||||
|
0,
|
||||||
|
true,
|
||||||
|
api_get_group_id(),
|
||||||
|
api_get_session_id(),
|
||||||
|
api_get_user_id()
|
||||||
|
);
|
||||||
|
|
||||||
|
if (empty($documentId)) {
|
||||||
|
$this->rm($result['hash']);
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
return $result;
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param string $attr
|
||||||
|
* @param string $path
|
||||||
|
* @param $data
|
||||||
|
* @param CourseDriver $volume
|
||||||
|
*/
|
||||||
|
/*public function access($attr, $path, $data, $volume)
|
||||||
|
{
|
||||||
|
error_log($path);
|
||||||
|
return true;
|
||||||
|
if ($path == $this->coursePath) {
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
$allowToEdit = $this->allowToEdit();
|
||||||
|
if ($allowToEdit) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
$path = str_replace($this->coursePath, '', $path);
|
||||||
|
$documentId = \DocumentManager::get_document_id($this->connector->course, $path);
|
||||||
|
|
||||||
|
if ($documentId) {
|
||||||
|
|
||||||
|
$result = \DocumentManager::is_visible_by_id(
|
||||||
|
$documentId,
|
||||||
|
$this->connector->course,
|
||||||
|
api_get_session_id(),
|
||||||
|
api_get_user_id()
|
||||||
|
);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}*/
|
||||||
|
}
|
||||||
@@ -0,0 +1,37 @@
|
|||||||
|
<?php
|
||||||
|
/* For licensing terms, see /license.txt */
|
||||||
|
|
||||||
|
namespace Chamilo\CoreBundle\Component\Editor\Driver;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Class CourseUserDriver.
|
||||||
|
*
|
||||||
|
* @package Chamilo\CoreBundle\Component\Editor\Driver
|
||||||
|
*/
|
||||||
|
class CourseUserDriver extends CourseDriver
|
||||||
|
{
|
||||||
|
public $name = 'CourseUserDriver';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* {@inheritdoc}
|
||||||
|
*/
|
||||||
|
public function getConfiguration()
|
||||||
|
{
|
||||||
|
if (!empty($this->connector->course)) {
|
||||||
|
$userId = api_get_user_id();
|
||||||
|
$path = 'shared_folder/sf_user_'.$userId;
|
||||||
|
$alias = $this->connector->course['code'].' '.get_lang('CourseUserDocument');
|
||||||
|
|
||||||
|
if (!empty($userId)) {
|
||||||
|
return [
|
||||||
|
'driver' => 'CourseUserDriver',
|
||||||
|
'alias' => $alias,
|
||||||
|
'path' => $this->getCourseDocumentSysPath().$path,
|
||||||
|
//'alias' => $courseInfo['code'].' personal documents',
|
||||||
|
'URL' => $this->getCourseDocumentRelativeWebPath().$path,
|
||||||
|
'accessControl' => 'access',
|
||||||
|
];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
110
src/Chamilo/CoreBundle/Component/Editor/Driver/Driver.php
Normal file
110
src/Chamilo/CoreBundle/Component/Editor/Driver/Driver.php
Normal file
@@ -0,0 +1,110 @@
|
|||||||
|
<?php
|
||||||
|
/* For licensing terms, see /license.txt */
|
||||||
|
|
||||||
|
namespace Chamilo\CoreBundle\Component\Editor\Driver;
|
||||||
|
|
||||||
|
use Chamilo\CoreBundle\Component\Editor\Connector;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Class Driver.
|
||||||
|
*
|
||||||
|
* @package Chamilo\CoreBundle\Component\Editor\Driver
|
||||||
|
*/
|
||||||
|
class Driver extends \elFinderVolumeLocalFileSystem
|
||||||
|
{
|
||||||
|
/** @var string */
|
||||||
|
public $name;
|
||||||
|
|
||||||
|
/** @var Connector */
|
||||||
|
public $connector;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets driver name.
|
||||||
|
*
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
|
public function getName()
|
||||||
|
{
|
||||||
|
return $this->name;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets driver name.
|
||||||
|
*
|
||||||
|
* @param string $name
|
||||||
|
*/
|
||||||
|
public function setName($name)
|
||||||
|
{
|
||||||
|
$this->name = $name;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set connector.
|
||||||
|
*/
|
||||||
|
public function setConnector(Connector $connector)
|
||||||
|
{
|
||||||
|
$this->connector = $connector;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return array
|
||||||
|
*/
|
||||||
|
public function getAppPluginOptions()
|
||||||
|
{
|
||||||
|
return $this->getOptionsPlugin('chamilo');
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return Connector
|
||||||
|
*/
|
||||||
|
public function setConnectorFromPlugin()
|
||||||
|
{
|
||||||
|
$options = $this->getAppPluginOptions();
|
||||||
|
$this->setConnector($options['connector']);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This is a copy of rename function only to be used when uploading a file
|
||||||
|
* {@inheritdoc}
|
||||||
|
*/
|
||||||
|
public function customRename($hash, $name)
|
||||||
|
{
|
||||||
|
if (!$this->nameAccepted($name)) {
|
||||||
|
return $this->setError(\elFinder::ERROR_INVALID_NAME, $name);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!($file = $this->file($hash))) {
|
||||||
|
return $this->setError(\elFinder::ERROR_FILE_NOT_FOUND);
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($name == $file['name']) {
|
||||||
|
return $file;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!empty($file['locked'])) {
|
||||||
|
return $this->setError(\elFinder::ERROR_LOCKED, $file['name']);
|
||||||
|
}
|
||||||
|
|
||||||
|
$path = $this->decode($hash);
|
||||||
|
$dir = $this->dirnameCE($path);
|
||||||
|
$stat = $this->stat($this->joinPathCE($dir, $name));
|
||||||
|
|
||||||
|
if ($stat) {
|
||||||
|
return $this->setError(\elFinder::ERROR_EXISTS, $name);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!$this->allowCreate($dir, $name, ($file['mime'] === 'directory'))) {
|
||||||
|
return $this->setError(\elFinder::ERROR_PERM_DENIED);
|
||||||
|
}
|
||||||
|
|
||||||
|
$this->rmTmb($file); // remove old name tmbs, we cannot do this after dir move
|
||||||
|
|
||||||
|
if ($path = $this->convEncOut($this->_move($this->convEncIn($path), $this->convEncIn($dir), $this->convEncIn($name)))) {
|
||||||
|
$this->clearcache();
|
||||||
|
|
||||||
|
return $this->stat($path);
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,52 @@
|
|||||||
|
<?php
|
||||||
|
/* For licensing terms, see /license.txt */
|
||||||
|
|
||||||
|
namespace Chamilo\CoreBundle\Component\Editor\Driver;
|
||||||
|
|
||||||
|
use Chamilo\CoreBundle\Component\Editor\Connector;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Class DriverInterface.
|
||||||
|
*
|
||||||
|
* @package Chamilo\CoreBundle\Component\Editor\Driver
|
||||||
|
*/
|
||||||
|
interface DriverInterface
|
||||||
|
{
|
||||||
|
public function setup();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets driver name.
|
||||||
|
*
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
|
public function getName();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets driver name.
|
||||||
|
*
|
||||||
|
* @param string $name
|
||||||
|
*/
|
||||||
|
public function setName($name);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set connector.
|
||||||
|
*/
|
||||||
|
public function setConnector(Connector $connector);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return array
|
||||||
|
*/
|
||||||
|
public function getAppPluginOptions();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return Connector
|
||||||
|
*/
|
||||||
|
public function setConnectorFromPlugin();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return bool
|
||||||
|
*/
|
||||||
|
public function allow();
|
||||||
|
|
||||||
|
public function getConfiguration();
|
||||||
|
}
|
||||||
717
src/Chamilo/CoreBundle/Component/Editor/Driver/DropBoxDriver.php
Normal file
717
src/Chamilo/CoreBundle/Component/Editor/Driver/DropBoxDriver.php
Normal file
@@ -0,0 +1,717 @@
|
|||||||
|
<?php
|
||||||
|
/* For licensing terms, see /license.txt */
|
||||||
|
|
||||||
|
namespace Chamilo\CoreBundle\Component\Editor\Driver;
|
||||||
|
|
||||||
|
use Chamilo\CoreBundle\Component\Editor\Connector;
|
||||||
|
use Chamilo\CoreBundle\Entity\CDropboxFile;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Class DropBoxDriver.
|
||||||
|
*
|
||||||
|
* @todo finish implementation
|
||||||
|
*
|
||||||
|
* @package Chamilo\CoreBundle\Component\Editor\Driver
|
||||||
|
*/
|
||||||
|
class DropBoxDriver extends \elFinderVolumeMySQL implements DriverInterface
|
||||||
|
{
|
||||||
|
/** @var string */
|
||||||
|
public $name = 'DropBoxDriver';
|
||||||
|
|
||||||
|
/** @var Connector */
|
||||||
|
public $connector;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* DropBoxDriver constructor.
|
||||||
|
*/
|
||||||
|
public function __construct()
|
||||||
|
{
|
||||||
|
parent::__construct();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets driver name.
|
||||||
|
*
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
|
public function getName()
|
||||||
|
{
|
||||||
|
return $this->name;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets driver name.
|
||||||
|
*
|
||||||
|
* @param string
|
||||||
|
*/
|
||||||
|
public function setName($name)
|
||||||
|
{
|
||||||
|
$this->name = $name;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set connector.
|
||||||
|
*/
|
||||||
|
public function setConnector(Connector $connector)
|
||||||
|
{
|
||||||
|
$this->connector = $connector;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return array
|
||||||
|
*/
|
||||||
|
public function getAppPluginOptions()
|
||||||
|
{
|
||||||
|
return $this->getOptionsPlugin('chamilo');
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return Connector
|
||||||
|
*/
|
||||||
|
public function setConnectorFromPlugin()
|
||||||
|
{
|
||||||
|
$options = $this->getAppPluginOptions();
|
||||||
|
$this->setConnector($options['connector']);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* {@inheritdoc}
|
||||||
|
*/
|
||||||
|
public function getConfiguration()
|
||||||
|
{
|
||||||
|
if ($this->connector->security->isGranted('IS_AUTHENTICATED_FULLY')) {
|
||||||
|
/** @var \Chamilo\CoreBundle\Entity\Repository\UserRepository $repository */
|
||||||
|
/*$repository = $this->connector->entityManager->getRepository('Chamilo\UserBundle\Entity\User');
|
||||||
|
$courses = $repository->getCourses($this->connector->user);*/
|
||||||
|
|
||||||
|
//if (!empty($courses)) {
|
||||||
|
$userId = $this->connector->user->getUserId();
|
||||||
|
if (!empty($userId)) {
|
||||||
|
return [
|
||||||
|
'driver' => 'DropBoxDriver',
|
||||||
|
'path' => '1',
|
||||||
|
'alias' => 'dropbox',
|
||||||
|
'tmpPath' => $this->connector->paths['path.temp'],
|
||||||
|
//'alias' => $courseInfo['code'].' personal documents',
|
||||||
|
//'URL' => $this->getCourseDocumentRelativeWebPath().$path,
|
||||||
|
'accessControl' => 'access',
|
||||||
|
];
|
||||||
|
}
|
||||||
|
//}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Close connection.
|
||||||
|
*
|
||||||
|
* @author Dmitry (dio) Levashov
|
||||||
|
*/
|
||||||
|
public function umount()
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected function init()
|
||||||
|
{
|
||||||
|
$this->updateCache($this->options['path'], $this->_stat($this->options['path']));
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set tmp path.
|
||||||
|
*
|
||||||
|
* @author Dmitry (dio) Levashov
|
||||||
|
*/
|
||||||
|
protected function configure()
|
||||||
|
{
|
||||||
|
parent::configure();
|
||||||
|
|
||||||
|
if (($tmp = $this->options['tmpPath'])) {
|
||||||
|
if (!file_exists($tmp)) {
|
||||||
|
if (@mkdir($tmp)) {
|
||||||
|
@chmod($tmp, $this->options['tmbPathMode']);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$this->tmpPath = is_dir($tmp) && is_writable($tmp) ? $tmp : false;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!$this->tmpPath && $this->tmbPath && $this->tmbPathWritable) {
|
||||||
|
$this->tmpPath = $this->tmbPath;
|
||||||
|
}
|
||||||
|
|
||||||
|
$this->mimeDetect = 'internal';
|
||||||
|
}
|
||||||
|
|
||||||
|
/* FS API */
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Cache dir contents.
|
||||||
|
*
|
||||||
|
* @param string $path dir path
|
||||||
|
*
|
||||||
|
* @author Dmitry Levashov
|
||||||
|
*/
|
||||||
|
protected function cacheDir($path)
|
||||||
|
{
|
||||||
|
$this->setConnectorFromPlugin();
|
||||||
|
$posts = $this->connector->user->getDropBoxReceivedFiles();
|
||||||
|
$this->dirsCache[$path] = [];
|
||||||
|
|
||||||
|
if (!empty($posts)) {
|
||||||
|
foreach ($posts as $post) {
|
||||||
|
/** @var CDropboxFile $file */
|
||||||
|
$file = $post->getFile();
|
||||||
|
|
||||||
|
$data = $this->transformFileInStat($file);
|
||||||
|
$id = $data['id'];
|
||||||
|
if (($stat = $this->updateCache($id, $data)) && empty($stat['hidden'])) {
|
||||||
|
$this->dirsCache[$path][] = $id;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return $this->dirsCache[$path];
|
||||||
|
}
|
||||||
|
|
||||||
|
return $this->dirsCache[$path];
|
||||||
|
}
|
||||||
|
|
||||||
|
/* file stat */
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Return stat for given path.
|
||||||
|
* Stat contains following fields:
|
||||||
|
* - (int) size file size in b. required
|
||||||
|
* - (int) ts file modification time in unix time. required
|
||||||
|
* - (string) mime mimetype. required for folders, others - optionally
|
||||||
|
* - (bool) read read permissions. required
|
||||||
|
* - (bool) write write permissions. required
|
||||||
|
* - (bool) locked is object locked. optionally
|
||||||
|
* - (bool) hidden is object hidden. optionally
|
||||||
|
* - (string) alias for symlinks - link target path relative to root path. optionally
|
||||||
|
* - (string) target for symlinks - link target path. optionally.
|
||||||
|
*
|
||||||
|
* If file does not exists - returns empty array or false.
|
||||||
|
*
|
||||||
|
* @param string $path file path
|
||||||
|
*
|
||||||
|
* @return array|false
|
||||||
|
*
|
||||||
|
* @author Dmitry (dio) Levashov
|
||||||
|
*/
|
||||||
|
protected function _stat($path)
|
||||||
|
{
|
||||||
|
$this->setConnectorFromPlugin();
|
||||||
|
|
||||||
|
$userId = $this->connector->user->getUserId();
|
||||||
|
$criteria = [];
|
||||||
|
$criteria['uploaderId'] = $userId;
|
||||||
|
|
||||||
|
if ($path != 1) {
|
||||||
|
$criteria['filename'] = $path;
|
||||||
|
$criteria = ['filename' => $path];
|
||||||
|
} else {
|
||||||
|
return $this->returnDirectory();
|
||||||
|
}
|
||||||
|
|
||||||
|
$file = $this->connector->entityManager->getRepository('Chamilo\CoreBundle\Entity\CDropboxFile')->findOneBy($criteria);
|
||||||
|
|
||||||
|
if ($file) {
|
||||||
|
$stat = $this->transformFileInStat($file);
|
||||||
|
|
||||||
|
return $stat;
|
||||||
|
}
|
||||||
|
|
||||||
|
return [];
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Return array of parents paths (ids).
|
||||||
|
*
|
||||||
|
* @param int $path file path (id)
|
||||||
|
*
|
||||||
|
* @return array
|
||||||
|
*
|
||||||
|
* @author Dmitry (dio) Levashov
|
||||||
|
*/
|
||||||
|
protected function getParents($path)
|
||||||
|
{
|
||||||
|
$parents = [];
|
||||||
|
while ($path) {
|
||||||
|
if ($file = $this->stat($path)) {
|
||||||
|
array_unshift($parents, $path);
|
||||||
|
$path = isset($file['phash']) ? $this->decode($file['phash']) : false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (count($parents)) {
|
||||||
|
array_pop($parents);
|
||||||
|
}
|
||||||
|
|
||||||
|
return $parents;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Return correct file path for LOAD_FILE method.
|
||||||
|
*
|
||||||
|
* @param string $path file path (id)
|
||||||
|
*
|
||||||
|
* @return string
|
||||||
|
*
|
||||||
|
* @author Troex Nevelin
|
||||||
|
*/
|
||||||
|
protected function loadFilePath($path)
|
||||||
|
{
|
||||||
|
$realPath = realpath($path);
|
||||||
|
if (DIRECTORY_SEPARATOR == '\\') { // windows
|
||||||
|
$realPath = str_replace('\\', '\\\\', $realPath);
|
||||||
|
}
|
||||||
|
|
||||||
|
return $this->db->real_escape_string($realPath);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Recursive files search.
|
||||||
|
*
|
||||||
|
* @param string $path dir path
|
||||||
|
* @param string $q search string
|
||||||
|
* @param array $mimes
|
||||||
|
*
|
||||||
|
* @return array
|
||||||
|
*
|
||||||
|
* @author Dmitry (dio) Levashov
|
||||||
|
*/
|
||||||
|
protected function doSearch($path, $q, $mimes)
|
||||||
|
{
|
||||||
|
return [];
|
||||||
|
}
|
||||||
|
|
||||||
|
/* paths/urls */
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Return parent directory path.
|
||||||
|
*
|
||||||
|
* @param string $path file path
|
||||||
|
*
|
||||||
|
* @return string
|
||||||
|
*
|
||||||
|
* @author Dmitry (dio) Levashov
|
||||||
|
*/
|
||||||
|
protected function _dirname($path)
|
||||||
|
{
|
||||||
|
return ($stat = $this->stat($path)) ? ($stat['phash'] ? $this->decode($stat['phash']) : $this->root) : false;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Return file name.
|
||||||
|
*
|
||||||
|
* @param string $path file path
|
||||||
|
*
|
||||||
|
* @return string
|
||||||
|
*
|
||||||
|
* @author Dmitry (dio) Levashov
|
||||||
|
*/
|
||||||
|
protected function _basename($path)
|
||||||
|
{
|
||||||
|
return ($stat = $this->stat($path)) ? $stat['name'] : false;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Return normalized path, this works the same as os.path.normpath() in Python.
|
||||||
|
*
|
||||||
|
* @param string $path path
|
||||||
|
*
|
||||||
|
* @return string
|
||||||
|
*
|
||||||
|
* @author Troex Nevelin
|
||||||
|
*/
|
||||||
|
protected function _normpath($path)
|
||||||
|
{
|
||||||
|
return $path;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Return file path related to root dir.
|
||||||
|
*
|
||||||
|
* @param string $path file path
|
||||||
|
*
|
||||||
|
* @return string
|
||||||
|
*
|
||||||
|
* @author Dmitry (dio) Levashov
|
||||||
|
*/
|
||||||
|
protected function _relpath($path)
|
||||||
|
{
|
||||||
|
return $path;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Convert path related to root dir into real path.
|
||||||
|
*
|
||||||
|
* @param string $path file path
|
||||||
|
*
|
||||||
|
* @return string
|
||||||
|
*
|
||||||
|
* @author Dmitry (dio) Levashov
|
||||||
|
*/
|
||||||
|
protected function _abspath($path)
|
||||||
|
{
|
||||||
|
return $path;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Return fake path started from root dir.
|
||||||
|
*
|
||||||
|
* @param string $path file path
|
||||||
|
*
|
||||||
|
* @return string
|
||||||
|
*
|
||||||
|
* @author Dmitry (dio) Levashov
|
||||||
|
*/
|
||||||
|
protected function _path($path)
|
||||||
|
{
|
||||||
|
if (($file = $this->stat($path)) == false) {
|
||||||
|
return '';
|
||||||
|
}
|
||||||
|
|
||||||
|
$parentsIds = $this->getParents($path);
|
||||||
|
$path = '';
|
||||||
|
foreach ($parentsIds as $id) {
|
||||||
|
$dir = $this->stat($id);
|
||||||
|
$path .= $dir['name'].$this->separator;
|
||||||
|
}
|
||||||
|
|
||||||
|
return $path.$file['name'];
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Return true if $path is children of $parent.
|
||||||
|
*
|
||||||
|
* @param string $path path to check
|
||||||
|
* @param string $parent parent path
|
||||||
|
*
|
||||||
|
* @return bool
|
||||||
|
*
|
||||||
|
* @author Dmitry (dio) Levashov
|
||||||
|
*/
|
||||||
|
protected function _inpath($path, $parent)
|
||||||
|
{
|
||||||
|
return $path == $parent
|
||||||
|
? true
|
||||||
|
: in_array($parent, $this->getParents($path));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Return true if path is dir and has at least one childs directory.
|
||||||
|
*
|
||||||
|
* @param string $path dir path
|
||||||
|
*
|
||||||
|
* @return bool
|
||||||
|
*
|
||||||
|
* @author Dmitry (dio) Levashov
|
||||||
|
*/
|
||||||
|
protected function _subdirs($path)
|
||||||
|
{
|
||||||
|
return ($stat = $this->stat($path)) && isset($stat['dirs']) ? $stat['dirs'] : false;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Return object width and height
|
||||||
|
* Usualy used for images, but can be realize for video etc...
|
||||||
|
*
|
||||||
|
* @param string $path file path
|
||||||
|
* @param string $mime file mime type
|
||||||
|
*
|
||||||
|
* @return string
|
||||||
|
*
|
||||||
|
* @author Dmitry (dio) Levashov
|
||||||
|
*/
|
||||||
|
protected function _dimensions($path, $mime)
|
||||||
|
{
|
||||||
|
return ($stat = $this->stat($path)) && isset($stat['width']) && isset($stat['height']) ? $stat['width'].'x'.$stat['height'] : '';
|
||||||
|
}
|
||||||
|
|
||||||
|
/* file/dir content */
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Return files list in directory.
|
||||||
|
*
|
||||||
|
* @param string $path dir path
|
||||||
|
*
|
||||||
|
* @return array
|
||||||
|
*
|
||||||
|
* @author Dmitry (dio) Levashov
|
||||||
|
*/
|
||||||
|
protected function _scandir($path)
|
||||||
|
{
|
||||||
|
return isset($this->dirsCache[$path])
|
||||||
|
? $this->dirsCache[$path]
|
||||||
|
: $this->cacheDir($path);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Open file and return file pointer.
|
||||||
|
*
|
||||||
|
* @param string $path file path
|
||||||
|
* @param string $mode open file mode (ignored in this driver)
|
||||||
|
*
|
||||||
|
* @return resource|false
|
||||||
|
*
|
||||||
|
* @author Dmitry (dio) Levashov
|
||||||
|
*/
|
||||||
|
protected function _fopen($path, $mode = 'rb')
|
||||||
|
{
|
||||||
|
$fp = $this->tmbPath
|
||||||
|
? @fopen($this->tmpname($path), 'w+')
|
||||||
|
: @tmpfile();
|
||||||
|
|
||||||
|
if ($fp) {
|
||||||
|
if (($res = $this->query('SELECT content FROM '.$this->tbf.' WHERE id="'.$path.'"'))
|
||||||
|
&& ($r = $res->fetch_assoc())) {
|
||||||
|
fwrite($fp, $r['content']);
|
||||||
|
rewind($fp);
|
||||||
|
|
||||||
|
return $fp;
|
||||||
|
} else {
|
||||||
|
$this->_fclose($fp, $path);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Close opened file.
|
||||||
|
*
|
||||||
|
* @param resource $fp file pointer
|
||||||
|
*
|
||||||
|
* @return bool
|
||||||
|
*
|
||||||
|
* @author Dmitry (dio) Levashov
|
||||||
|
*/
|
||||||
|
protected function _fclose($fp, $path = '')
|
||||||
|
{
|
||||||
|
@fclose($fp);
|
||||||
|
if ($path) {
|
||||||
|
@unlink($this->tmpname($path));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* file/dir manipulations */
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Create dir and return created dir path or false on failed.
|
||||||
|
*
|
||||||
|
* @param string $path parent dir path
|
||||||
|
* @param string $name new directory name
|
||||||
|
*
|
||||||
|
* @return string|bool
|
||||||
|
*
|
||||||
|
* @author Dmitry (dio) Levashov
|
||||||
|
*/
|
||||||
|
protected function _mkdir($path, $name)
|
||||||
|
{
|
||||||
|
return $this->make($path, $name, 'directory') ? $this->_joinPath($path, $name) : false;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* {@inheritdoc}
|
||||||
|
*/
|
||||||
|
protected function _mkfile($path, $name)
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* {@inheritdoc}
|
||||||
|
*/
|
||||||
|
protected function _symlink($target, $path, $name)
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* {@inheritdoc}
|
||||||
|
*/
|
||||||
|
protected function _copy($source, $targetDir, $name)
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* {@inheritdoc}
|
||||||
|
*/
|
||||||
|
protected function _move($source, $targetDir, $name)
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Remove file.
|
||||||
|
*
|
||||||
|
* @param string $path file path
|
||||||
|
*
|
||||||
|
* @return bool
|
||||||
|
*
|
||||||
|
* @author Dmitry (dio) Levashov
|
||||||
|
*/
|
||||||
|
protected function _unlink($path)
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
|
||||||
|
return $this->query(sprintf('DELETE FROM %s WHERE id=%d AND mime!="directory" LIMIT 1', $this->tbf, $path)) && $this->db->affected_rows;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Remove dir.
|
||||||
|
*
|
||||||
|
* @param string $path dir path
|
||||||
|
*
|
||||||
|
* @return bool
|
||||||
|
*
|
||||||
|
* @author Dmitry (dio) Levashov
|
||||||
|
*/
|
||||||
|
protected function _rmdir($path)
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
|
||||||
|
return $this->query(sprintf('DELETE FROM %s WHERE id=%d AND mime="directory" LIMIT 1', $this->tbf, $path)) && $this->db->affected_rows;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* undocumented function.
|
||||||
|
*
|
||||||
|
* @author Dmitry Levashov
|
||||||
|
*/
|
||||||
|
protected function _setContent($path, $fp)
|
||||||
|
{
|
||||||
|
rewind($fp);
|
||||||
|
$fstat = fstat($fp);
|
||||||
|
$size = $fstat['size'];
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* {@inheritdoc}
|
||||||
|
*/
|
||||||
|
protected function _save($fp, $dir, $name, $stat)
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* {@inheritdoc}
|
||||||
|
*/
|
||||||
|
protected function _getContents($path)
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
//return ($res = $this->query(sprintf('SELECT content FROM %s WHERE id=%d', $this->tbf, $path))) && ($r = $res->fetch_assoc()) ? $r['content'] : false;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Write a string to a file.
|
||||||
|
*
|
||||||
|
* @param string $path file path
|
||||||
|
* @param string $content new file content
|
||||||
|
*
|
||||||
|
* @return bool
|
||||||
|
*
|
||||||
|
* @author Dmitry (dio) Levashov
|
||||||
|
*/
|
||||||
|
protected function _filePutContents($path, $content)
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
//return $this->query(sprintf('UPDATE %s SET content="%s", size=%d, mtime=%d WHERE id=%d LIMIT 1', $this->tbf, $this->db->real_escape_string($content), strlen($content), time(), $path));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* {@inheritdoc}
|
||||||
|
*/
|
||||||
|
protected function _checkArchivers()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* {@inheritdoc}
|
||||||
|
*/
|
||||||
|
protected function _unpack($path, $arc)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* {@inheritdoc}
|
||||||
|
*/
|
||||||
|
protected function _findSymlinks($path)
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* {@inheritdoc}
|
||||||
|
*/
|
||||||
|
protected function _extract($path, $arc)
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* {@inheritdoc}
|
||||||
|
*/
|
||||||
|
protected function _archive($dir, $files, $name, $arc)
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return array
|
||||||
|
*/
|
||||||
|
private function returnDirectory()
|
||||||
|
{
|
||||||
|
return [
|
||||||
|
//'id' => $file->getId().$file->getCId(),
|
||||||
|
'name' => 'Dropbox',
|
||||||
|
//'ts' => $file->getUploadDate(),
|
||||||
|
'mime' => 'directory',
|
||||||
|
'read' => true,
|
||||||
|
'write' => true,
|
||||||
|
'locked' => false,
|
||||||
|
'hidden' => false,
|
||||||
|
'dirs' => 0,
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return array
|
||||||
|
*/
|
||||||
|
private function transformFileInStat(CDropboxFile $file)
|
||||||
|
{
|
||||||
|
$stat = [
|
||||||
|
'id' => $file->getId().$file->getCId(),
|
||||||
|
'name' => $file->getFilename(),
|
||||||
|
'ts' => $file->getUploadDate(),
|
||||||
|
'mime' => 'directory',
|
||||||
|
'read' => true,
|
||||||
|
'write' => false,
|
||||||
|
'locked' => false,
|
||||||
|
'hidden' => false,
|
||||||
|
'width' => 100,
|
||||||
|
'height' => 100,
|
||||||
|
'dirs' => 0,
|
||||||
|
];
|
||||||
|
|
||||||
|
return $stat;
|
||||||
|
|
||||||
|
/*
|
||||||
|
if ($stat['parent_id']) {
|
||||||
|
$stat['phash'] = $this->encode($stat['parent_id']);
|
||||||
|
}
|
||||||
|
if ($stat['mime'] == 'directory') {
|
||||||
|
unset($stat['width']);
|
||||||
|
unset($stat['height']);
|
||||||
|
} else {
|
||||||
|
unset($stat['dirs']);
|
||||||
|
}
|
||||||
|
unset($stat['id']);
|
||||||
|
unset($stat['parent_id']);
|
||||||
|
*/
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,74 @@
|
|||||||
|
<?php
|
||||||
|
/* For licensing terms, see /license.txt */
|
||||||
|
|
||||||
|
namespace Chamilo\CoreBundle\Component\Editor\Driver;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Class HomeDriver.
|
||||||
|
*
|
||||||
|
* @package Chamilo\CoreBundle\Component\Editor\Driver
|
||||||
|
*/
|
||||||
|
class HomeDriver extends Driver implements DriverInterface
|
||||||
|
{
|
||||||
|
public $name = 'HomeDriver';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* {@inheritdoc}
|
||||||
|
*/
|
||||||
|
public function setup()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* {@inheritdoc}
|
||||||
|
*/
|
||||||
|
public function getConfiguration()
|
||||||
|
{
|
||||||
|
if ($this->allow()) {
|
||||||
|
$home = api_get_path(SYS_HOME_PATH);
|
||||||
|
|
||||||
|
return [
|
||||||
|
'driver' => 'HomeDriver',
|
||||||
|
'alias' => get_lang('Portal'),
|
||||||
|
'path' => $home,
|
||||||
|
'URL' => api_get_path(WEB_PATH).'home',
|
||||||
|
'accessControl' => [$this, 'access'],
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
return [];
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* {@inheritdoc}
|
||||||
|
*/
|
||||||
|
public function upload($fp, $dst, $name, $tmpname)
|
||||||
|
{
|
||||||
|
$this->setConnectorFromPlugin();
|
||||||
|
|
||||||
|
if ($this->allow()) {
|
||||||
|
return parent::upload($fp, $dst, $name, $tmpname);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* {@inheritdoc}
|
||||||
|
*/
|
||||||
|
public function rm($hash)
|
||||||
|
{
|
||||||
|
$this->setConnectorFromPlugin();
|
||||||
|
|
||||||
|
if ($this->allow()) {
|
||||||
|
return parent::rm($hash);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return bool
|
||||||
|
*/
|
||||||
|
public function allow()
|
||||||
|
{
|
||||||
|
//if ($this->connector->security->isGranted('ROLE_ADMIN')) {
|
||||||
|
return api_is_platform_admin();
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,147 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
/* For licensing terms, see /license.txt */
|
||||||
|
|
||||||
|
namespace Chamilo\CoreBundle\Component\Editor\Driver;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Class PersonalDriver.
|
||||||
|
*
|
||||||
|
* @todo add more checks in upload/rm
|
||||||
|
*/
|
||||||
|
class PersonalDriver extends Driver implements DriverInterface
|
||||||
|
{
|
||||||
|
public $name = 'PersonalDriver';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* {@inheritdoc}
|
||||||
|
*/
|
||||||
|
public function setup()
|
||||||
|
{
|
||||||
|
$userId = api_get_user_id();
|
||||||
|
$dir = \UserManager::getUserPathById($userId, 'system');
|
||||||
|
if (!empty($dir)) {
|
||||||
|
if (!is_dir($dir)) {
|
||||||
|
mkdir($dir);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!is_dir($dir.'my_files')) {
|
||||||
|
mkdir($dir.'my_files');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* {@inheritdoc}
|
||||||
|
*/
|
||||||
|
public function getConfiguration()
|
||||||
|
{
|
||||||
|
if ($this->allow()) {
|
||||||
|
$userId = api_get_user_id();
|
||||||
|
|
||||||
|
if (!empty($userId)) {
|
||||||
|
// Adding user personal files
|
||||||
|
$dir = \UserManager::getUserPathById($userId, 'system');
|
||||||
|
$dirWeb = \UserManager::getUserPathById($userId, 'web');
|
||||||
|
|
||||||
|
$mimeType = [
|
||||||
|
'application',
|
||||||
|
'text/html',
|
||||||
|
'text/javascript',
|
||||||
|
'text/ecmascript',
|
||||||
|
'image/svg+xml',
|
||||||
|
'image/svg',
|
||||||
|
];
|
||||||
|
|
||||||
|
$driver = [
|
||||||
|
'driver' => 'PersonalDriver',
|
||||||
|
'alias' => get_lang('MyFiles'),
|
||||||
|
'path' => $dir.'my_files',
|
||||||
|
'URL' => $dirWeb.'my_files',
|
||||||
|
'accessControl' => [$this, 'access'],
|
||||||
|
'uploadDeny' => $mimeType,
|
||||||
|
'disabled' => [
|
||||||
|
'duplicate',
|
||||||
|
//'rename',
|
||||||
|
//'mkdir',
|
||||||
|
'mkfile',
|
||||||
|
'copy',
|
||||||
|
'cut',
|
||||||
|
'paste',
|
||||||
|
'edit',
|
||||||
|
'extract',
|
||||||
|
'archive',
|
||||||
|
'help',
|
||||||
|
'resize',
|
||||||
|
],
|
||||||
|
];
|
||||||
|
|
||||||
|
if (api_get_configuration_value('social_myfiles_office_files_upload_allowed')) {
|
||||||
|
//Allow all office suite documents to be uploaded in the "My files" section of the social network
|
||||||
|
$driver['uploadOrder'] = ['deny', 'allow'];
|
||||||
|
$driver['uploadAllow'] = [
|
||||||
|
'application/pdf',
|
||||||
|
'application/msword',
|
||||||
|
'application/vnd.ms-excel',
|
||||||
|
'application/vnd.ms-excel.addin.macroEnabled.12',
|
||||||
|
'application/vnd.ms-excel.sheet.binary.macroEnabled.12',
|
||||||
|
'application/vnd.ms-excel.sheet.macroEnabled.12',
|
||||||
|
'application/vnd.ms-excel.template.macroEnabled.12',
|
||||||
|
'application/vnd.ms-powerpoint',
|
||||||
|
'application/vnd.ms-powerpoint.addin.macroEnabled.12',
|
||||||
|
'application/vnd.ms-powerpoint.presentation.macroEnabled.12',
|
||||||
|
'application/vnd.ms-powerpoint.slide.macroenabled.12',
|
||||||
|
'application/vnd.ms-powerpoint.slideshow.macroEnabled.12',
|
||||||
|
'application/vnd.ms-powerpoint.template.macroEnabled.12',
|
||||||
|
'application/vnd.ms-word.document.macroEnabled.12',
|
||||||
|
'application/vnd.ms-word.template.macroEnabled.12',
|
||||||
|
'application/vnd.openxmlformats-officedocument.presentationml.presentation',
|
||||||
|
'application/vnd.openxmlformats-officedocument.presentationml.slide',
|
||||||
|
'application/vnd.openxmlformats-officedocument.presentationml.slideshow',
|
||||||
|
'application/vnd.openxmlformats-officedocument.presentationml.template',
|
||||||
|
'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet',
|
||||||
|
'application/vnd.openxmlformats-officedocument.spreadsheetml.template',
|
||||||
|
'application/vnd.openxmlformats-officedocument.wordprocessingml.document',
|
||||||
|
'application/vnd.openxmlformats-officedocument.wordprocessingml.template',
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
return $driver;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return [];
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* {@inheritdoc}
|
||||||
|
*/
|
||||||
|
public function upload($fp, $dst, $name, $tmpname, $hashes = [])
|
||||||
|
{
|
||||||
|
$this->setConnectorFromPlugin();
|
||||||
|
if ($this->allow()) {
|
||||||
|
return parent::upload($fp, $dst, $name, $tmpname);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* {@inheritdoc}
|
||||||
|
*/
|
||||||
|
public function rm($hash)
|
||||||
|
{
|
||||||
|
$this->setConnectorFromPlugin();
|
||||||
|
|
||||||
|
if ($this->allow()) {
|
||||||
|
return parent::rm($hash);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return bool
|
||||||
|
*/
|
||||||
|
public function allow()
|
||||||
|
{
|
||||||
|
//if ($this->connector->security->isGranted('IS_AUTHENTICATED_FULLY')) {
|
||||||
|
return !api_is_anonymous();
|
||||||
|
}
|
||||||
|
}
|
||||||
274
src/Chamilo/CoreBundle/Component/Editor/Editor.php
Normal file
274
src/Chamilo/CoreBundle/Component/Editor/Editor.php
Normal file
@@ -0,0 +1,274 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
/* For licensing terms, see /license.txt */
|
||||||
|
|
||||||
|
namespace Chamilo\CoreBundle\Component\Editor;
|
||||||
|
|
||||||
|
use Symfony\Component\Routing\RouterInterface;
|
||||||
|
use Symfony\Component\Translation\Translator;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Class Editor.
|
||||||
|
*/
|
||||||
|
class Editor
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* @var string
|
||||||
|
*/
|
||||||
|
public $textareaId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Name of the instance.
|
||||||
|
*
|
||||||
|
* @var string
|
||||||
|
*/
|
||||||
|
public $name;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Name of the toolbar to load.
|
||||||
|
*
|
||||||
|
* @var string
|
||||||
|
*/
|
||||||
|
public $toolbarSet;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Initial value.
|
||||||
|
*
|
||||||
|
* @var string
|
||||||
|
*/
|
||||||
|
public $value;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var array
|
||||||
|
*/
|
||||||
|
public $config;
|
||||||
|
|
||||||
|
/** @var Translator */
|
||||||
|
public $translator;
|
||||||
|
|
||||||
|
/** @var RouterInterface */
|
||||||
|
public $urlGenerator;
|
||||||
|
|
||||||
|
/** @var \Template */
|
||||||
|
public $template;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Constructor.
|
||||||
|
*/
|
||||||
|
public function __construct()
|
||||||
|
{
|
||||||
|
$this->toolbarSet = 'Basic';
|
||||||
|
$this->value = '';
|
||||||
|
$this->config = [];
|
||||||
|
$this->setConfigAttribute('width', '100%');
|
||||||
|
$this->setConfigAttribute('height', '200');
|
||||||
|
$this->setConfigAttribute('fullPage', false);
|
||||||
|
/*$this->translator = $translator;
|
||||||
|
$this->urlGenerator = $urlGenerator;*/
|
||||||
|
//$this->course = $course;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
|
public function getName()
|
||||||
|
{
|
||||||
|
return $this->name;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param string $name
|
||||||
|
*/
|
||||||
|
public function setName($name)
|
||||||
|
{
|
||||||
|
$this->name = $name;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
|
public function getTextareaId()
|
||||||
|
{
|
||||||
|
return $this->textareaId;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param string $textareaId
|
||||||
|
*
|
||||||
|
* @return Editor
|
||||||
|
*/
|
||||||
|
public function setTextareaId($textareaId)
|
||||||
|
{
|
||||||
|
$this->textareaId = $textareaId;
|
||||||
|
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Return the HTML code required to run editor.
|
||||||
|
*
|
||||||
|
* @param string $value
|
||||||
|
*
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
|
public function createHtml($value)
|
||||||
|
{
|
||||||
|
$html = '<textarea id="'.$this->getTextareaId().'" name="'.$this->getName().'">'.$value.'</textarea>';
|
||||||
|
|
||||||
|
return $html;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
|
public function editorReplace()
|
||||||
|
{
|
||||||
|
$toolbar = new Toolbar($this->toolbarSet, $this->config);
|
||||||
|
$toolbar->setLanguage($this->getLocale());
|
||||||
|
$config = $toolbar->getConfig();
|
||||||
|
$javascript = $this->toJavascript($config);
|
||||||
|
|
||||||
|
$html = "<script>
|
||||||
|
CKEDITOR.replace('".$this->getTextareaId()."',
|
||||||
|
$javascript
|
||||||
|
);
|
||||||
|
|
||||||
|
</script>";
|
||||||
|
|
||||||
|
return $html;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param string $key
|
||||||
|
* @param mixed $value
|
||||||
|
*/
|
||||||
|
public function setConfigAttribute($key, $value)
|
||||||
|
{
|
||||||
|
$this->config[$key] = $value;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param string $key
|
||||||
|
*
|
||||||
|
* @return mixed
|
||||||
|
*/
|
||||||
|
public function getConfigAttribute($key)
|
||||||
|
{
|
||||||
|
return isset($this->config[$key]) ? $this->config[$key] : null;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param array $config
|
||||||
|
*/
|
||||||
|
public function processConfig($config)
|
||||||
|
{
|
||||||
|
if (is_array($config)) {
|
||||||
|
foreach ($config as $key => $value) {
|
||||||
|
switch ($key) {
|
||||||
|
case 'ToolbarSet':
|
||||||
|
$this->toolbarSet = $value;
|
||||||
|
break;
|
||||||
|
case 'Config':
|
||||||
|
$this->processConfig($value);
|
||||||
|
break;
|
||||||
|
case 'width':
|
||||||
|
case 'Width':
|
||||||
|
$this->setConfigAttribute('width', $value);
|
||||||
|
break;
|
||||||
|
case 'height':
|
||||||
|
case 'Height':
|
||||||
|
$this->setConfigAttribute('height', $value);
|
||||||
|
break;
|
||||||
|
case 'FullPage':
|
||||||
|
case 'fullPage':
|
||||||
|
$this->setConfigAttribute('fullPage', $value);
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
$this->setConfigAttribute($key, $value);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getEditorTemplate()
|
||||||
|
{
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
|
public function getEditorStandAloneTemplate()
|
||||||
|
{
|
||||||
|
return 'javascript/editor/elfinder_standalone.tpl';
|
||||||
|
}
|
||||||
|
|
||||||
|
public function formatTemplates($templates)
|
||||||
|
{
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
|
public function getLocale()
|
||||||
|
{
|
||||||
|
return api_get_language_isocode();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Converts a PHP variable into its Javascript equivalent.
|
||||||
|
* The code of this method has been "borrowed" from the function drupal_to_js() within the Drupal CMS.
|
||||||
|
*
|
||||||
|
* @param mixed $var The variable to be converted into Javascript syntax
|
||||||
|
*
|
||||||
|
* @return string Returns a string
|
||||||
|
* Note: This function is similar to json_encode(),
|
||||||
|
* in addition it produces HTML-safe strings, i.e. with <, > and & escaped.
|
||||||
|
*
|
||||||
|
* @see http://drupal.org/
|
||||||
|
*/
|
||||||
|
protected function toJavascript($var)
|
||||||
|
{
|
||||||
|
switch (gettype($var)) {
|
||||||
|
case 'boolean':
|
||||||
|
return $var ? 'true' : 'false'; // Lowercase necessary!
|
||||||
|
case 'integer':
|
||||||
|
case 'double':
|
||||||
|
return (string) $var;
|
||||||
|
case 'resource':
|
||||||
|
case 'string':
|
||||||
|
return '"'.str_replace(
|
||||||
|
["\r", "\n", "<", ">", "&"],
|
||||||
|
['\r', '\n', '\x3c', '\x3e', '\x26'],
|
||||||
|
addslashes($var)
|
||||||
|
).'"';
|
||||||
|
break;
|
||||||
|
case 'array':
|
||||||
|
// Arrays in JSON can't be associative. If the array is empty or if it
|
||||||
|
// has sequential whole number keys starting with 0, it's not associative
|
||||||
|
// so we can go ahead and convert it as an array.
|
||||||
|
if (empty($var) || array_keys($var) === range(0, sizeof($var) - 1)) {
|
||||||
|
$output = [];
|
||||||
|
foreach ($var as $v) {
|
||||||
|
$output[] = $this->toJavascript($v);
|
||||||
|
}
|
||||||
|
|
||||||
|
return '[ '.implode(', ', $output).' ]';
|
||||||
|
}
|
||||||
|
//no break
|
||||||
|
case 'object':
|
||||||
|
// Otherwise, fall through to convert the array as an object.
|
||||||
|
$output = [];
|
||||||
|
foreach ($var as $k => $v) {
|
||||||
|
$output[] = $this->toJavascript(strval($k)).': '.$this->toJavascript($v);
|
||||||
|
}
|
||||||
|
|
||||||
|
return '{ '.implode(', ', $output).' }';
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
return 'null';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
286
src/Chamilo/CoreBundle/Component/Editor/Finder.php
Normal file
286
src/Chamilo/CoreBundle/Component/Editor/Finder.php
Normal file
@@ -0,0 +1,286 @@
|
|||||||
|
<?php
|
||||||
|
/* For licensing terms, see /license.txt */
|
||||||
|
|
||||||
|
namespace Chamilo\CoreBundle\Component\Editor;
|
||||||
|
|
||||||
|
use elFinder;
|
||||||
|
use elFinderSession;
|
||||||
|
use elFinderSessionInterface;
|
||||||
|
use Exception;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Based in \elFinder this class only has a small change that allows use
|
||||||
|
* drivers with out adding elFinderVolume as class name.
|
||||||
|
*
|
||||||
|
* Class Finder
|
||||||
|
*
|
||||||
|
* This class just modifies this line:
|
||||||
|
* $class = 'elFinderVolume'.(isset($o['driver']) ? $o['driver'] : '');
|
||||||
|
* in order to use normal classes and not a custom 'elFinderVolume' class.
|
||||||
|
*
|
||||||
|
* @package Chamilo\CoreBundle\Component\Editor
|
||||||
|
*/
|
||||||
|
class Finder extends \elFinder
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Constructor.
|
||||||
|
*
|
||||||
|
* @param array $opts elFinder and roots configurations
|
||||||
|
*
|
||||||
|
* @author Dmitry (dio) Levashov
|
||||||
|
*/
|
||||||
|
public function __construct($opts)
|
||||||
|
{
|
||||||
|
// set default_charset
|
||||||
|
if (version_compare(PHP_VERSION, '5.6', '>=')) {
|
||||||
|
if (($_val = ini_get('iconv.internal_encoding')) && strtoupper($_val) !== 'UTF-8') {
|
||||||
|
ini_set('iconv.internal_encoding', '');
|
||||||
|
}
|
||||||
|
if (($_val = ini_get('mbstring.internal_encoding')) && strtoupper($_val) !== 'UTF-8') {
|
||||||
|
ini_set('mbstring.internal_encoding', '');
|
||||||
|
}
|
||||||
|
if (($_val = ini_get('internal_encoding')) && strtoupper($_val) !== 'UTF-8') {
|
||||||
|
ini_set('internal_encoding', '');
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if (function_exists('iconv_set_encoding') && strtoupper(iconv_get_encoding('internal_encoding')) !== 'UTF-8') {
|
||||||
|
iconv_set_encoding('internal_encoding', 'UTF-8');
|
||||||
|
}
|
||||||
|
if (function_exists('mb_internal_encoding') && strtoupper(mb_internal_encoding()) !== 'UTF-8') {
|
||||||
|
mb_internal_encoding('UTF-8');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
ini_set('default_charset', 'UTF-8');
|
||||||
|
// define accept constant of server commands path
|
||||||
|
!defined('ELFINDER_TAR_PATH') && define('ELFINDER_TAR_PATH', 'tar');
|
||||||
|
!defined('ELFINDER_GZIP_PATH') && define('ELFINDER_GZIP_PATH', 'gzip');
|
||||||
|
!defined('ELFINDER_BZIP2_PATH') && define('ELFINDER_BZIP2_PATH', 'bzip2');
|
||||||
|
!defined('ELFINDER_XZ_PATH') && define('ELFINDER_XZ_PATH', 'xz');
|
||||||
|
!defined('ELFINDER_ZIP_PATH') && define('ELFINDER_ZIP_PATH', 'zip');
|
||||||
|
!defined('ELFINDER_UNZIP_PATH') && define('ELFINDER_UNZIP_PATH', 'unzip');
|
||||||
|
!defined('ELFINDER_RAR_PATH') && define('ELFINDER_RAR_PATH', 'rar');
|
||||||
|
!defined('ELFINDER_UNRAR_PATH') && define('ELFINDER_UNRAR_PATH', 'unrar');
|
||||||
|
!defined('ELFINDER_7Z_PATH') && define('ELFINDER_7Z_PATH', (substr(PHP_OS, 0, 3) === 'WIN') ? '7z' : '7za');
|
||||||
|
!defined('ELFINDER_CONVERT_PATH') && define('ELFINDER_CONVERT_PATH', 'convert');
|
||||||
|
!defined('ELFINDER_IDENTIFY_PATH') && define('ELFINDER_IDENTIFY_PATH', 'identify');
|
||||||
|
!defined('ELFINDER_EXIFTRAN_PATH') && define('ELFINDER_EXIFTRAN_PATH', 'exiftran');
|
||||||
|
!defined('ELFINDER_JPEGTRAN_PATH') && define('ELFINDER_JPEGTRAN_PATH', 'jpegtran');
|
||||||
|
!defined('ELFINDER_FFMPEG_PATH') && define('ELFINDER_FFMPEG_PATH', 'ffmpeg');
|
||||||
|
|
||||||
|
!defined('ELFINDER_DISABLE_ZIPEDITOR') && define('ELFINDER_DISABLE_ZIPEDITOR', false);
|
||||||
|
|
||||||
|
// enable(true)/disable(false) handling postscript on ImageMagick
|
||||||
|
// Should be `false` as long as there is a Ghostscript vulnerability
|
||||||
|
// see https://artifex.com/news/ghostscript-security-resolved/
|
||||||
|
!defined('ELFINDER_IMAGEMAGICK_PS') && define('ELFINDER_IMAGEMAGICK_PS', false);
|
||||||
|
|
||||||
|
// for backward compat
|
||||||
|
$this->version = (string) self::$ApiVersion;
|
||||||
|
|
||||||
|
// set error handler of WARNING, NOTICE
|
||||||
|
$errLevel = E_WARNING | E_NOTICE | E_USER_WARNING | E_USER_NOTICE | E_STRICT | E_RECOVERABLE_ERROR;
|
||||||
|
if (defined('E_DEPRECATED')) {
|
||||||
|
$errLevel |= E_DEPRECATED | E_USER_DEPRECATED;
|
||||||
|
}
|
||||||
|
set_error_handler('elFinder::phpErrorHandler', $errLevel);
|
||||||
|
|
||||||
|
// convert PATH_INFO to GET query
|
||||||
|
if (!empty($_SERVER['PATH_INFO'])) {
|
||||||
|
$_ps = explode('/', trim($_SERVER['PATH_INFO'], '/'));
|
||||||
|
if (!isset($_GET['cmd'])) {
|
||||||
|
$_cmd = $_ps[0];
|
||||||
|
if (isset($this->commands[$_cmd])) {
|
||||||
|
$_GET['cmd'] = $_cmd;
|
||||||
|
$_i = 1;
|
||||||
|
foreach (array_keys($this->commands[$_cmd]) as $_k) {
|
||||||
|
if (isset($_ps[$_i])) {
|
||||||
|
if (!isset($_GET[$_k])) {
|
||||||
|
$_GET[$_k] = $_ps[$_i];
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// set elFinder instance
|
||||||
|
elFinder::$instance = $this;
|
||||||
|
|
||||||
|
// setup debug mode
|
||||||
|
$this->debug = (isset($opts['debug']) && $opts['debug'] ? true : false);
|
||||||
|
if ($this->debug) {
|
||||||
|
error_reporting(defined('ELFINDER_DEBUG_ERRORLEVEL') ? ELFINDER_DEBUG_ERRORLEVEL : -1);
|
||||||
|
ini_set('diaplay_errors', '1');
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!interface_exists('elFinderSessionInterface')) {
|
||||||
|
include_once __DIR__.'/elFinderSessionInterface.php';
|
||||||
|
}
|
||||||
|
|
||||||
|
// session handler
|
||||||
|
if (!empty($opts['session']) && $opts['session'] instanceof elFinderSessionInterface) {
|
||||||
|
$this->session = $opts['session'];
|
||||||
|
} else {
|
||||||
|
$sessionOpts = [
|
||||||
|
'base64encode' => !empty($opts['base64encodeSessionData']),
|
||||||
|
'keys' => [
|
||||||
|
'default' => !empty($opts['sessionCacheKey']) ? $opts['sessionCacheKey'] : 'elFinderCaches',
|
||||||
|
'netvolume' => !empty($opts['netVolumesSessionKey']) ? $opts['netVolumesSessionKey'] : 'elFinderNetVolumes',
|
||||||
|
],
|
||||||
|
];
|
||||||
|
if (!class_exists('elFinderSession')) {
|
||||||
|
include_once __DIR__.'/elFinderSession.php';
|
||||||
|
}
|
||||||
|
$this->session = new elFinderSession($sessionOpts);
|
||||||
|
}
|
||||||
|
// try session start | restart
|
||||||
|
$this->session->start();
|
||||||
|
|
||||||
|
$sessionUseCmds = [];
|
||||||
|
if (isset($opts['sessionUseCmds']) && is_array($opts['sessionUseCmds'])) {
|
||||||
|
$sessionUseCmds = $opts['sessionUseCmds'];
|
||||||
|
}
|
||||||
|
|
||||||
|
// set self::$volumesCnt by HTTP header "X-elFinder-VolumesCntStart"
|
||||||
|
if (isset($_SERVER['HTTP_X_ELFINDER_VOLUMESCNTSTART']) && ($volumesCntStart = intval($_SERVER['HTTP_X_ELFINDER_VOLUMESCNTSTART']))) {
|
||||||
|
self::$volumesCnt = $volumesCntStart;
|
||||||
|
}
|
||||||
|
|
||||||
|
$this->time = $this->utime();
|
||||||
|
$this->sessionCloseEarlier = isset($opts['sessionCloseEarlier']) ? (bool) $opts['sessionCloseEarlier'] : true;
|
||||||
|
$this->sessionUseCmds = array_flip($sessionUseCmds);
|
||||||
|
$this->timeout = (isset($opts['timeout']) ? $opts['timeout'] : 0);
|
||||||
|
$this->uploadTempPath = (isset($opts['uploadTempPath']) ? $opts['uploadTempPath'] : '');
|
||||||
|
$this->callbackWindowURL = (isset($opts['callbackWindowURL']) ? $opts['callbackWindowURL'] : '');
|
||||||
|
$this->maxTargets = (isset($opts['maxTargets']) ? intval($opts['maxTargets']) : $this->maxTargets);
|
||||||
|
elFinder::$commonTempPath = (isset($opts['commonTempPath']) ? $opts['commonTempPath'] : './.tmp');
|
||||||
|
if (!is_writable(elFinder::$commonTempPath)) {
|
||||||
|
elFinder::$commonTempPath = sys_get_temp_dir();
|
||||||
|
if (!is_writable(elFinder::$commonTempPath)) {
|
||||||
|
elFinder::$commonTempPath = '';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
$this->maxArcFilesSize = isset($opts['maxArcFilesSize']) ? intval($opts['maxArcFilesSize']) : 0;
|
||||||
|
$this->optionsNetVolumes = (isset($opts['optionsNetVolumes']) && is_array($opts['optionsNetVolumes'])) ? $opts['optionsNetVolumes'] : [];
|
||||||
|
if (isset($opts['itemLockExpire'])) {
|
||||||
|
$this->itemLockExpire = intval($opts['itemLockExpire']);
|
||||||
|
}
|
||||||
|
|
||||||
|
// deprecated settings
|
||||||
|
$this->netVolumesSessionKey = !empty($opts['netVolumesSessionKey']) ? $opts['netVolumesSessionKey'] : 'elFinderNetVolumes';
|
||||||
|
self::$sessionCacheKey = !empty($opts['sessionCacheKey']) ? $opts['sessionCacheKey'] : 'elFinderCaches';
|
||||||
|
|
||||||
|
// check session cache
|
||||||
|
$_optsMD5 = md5(json_encode($opts['roots']));
|
||||||
|
if ($this->session->get('_optsMD5') !== $_optsMD5) {
|
||||||
|
$this->session->set('_optsMD5', $_optsMD5);
|
||||||
|
}
|
||||||
|
|
||||||
|
// setlocale and global locale regists to elFinder::locale
|
||||||
|
self::$locale = !empty($opts['locale']) ? $opts['locale'] : 'en_US.UTF-8';
|
||||||
|
if (false === setlocale(LC_ALL, self::$locale)) {
|
||||||
|
self::$locale = setlocale(LC_ALL, '');
|
||||||
|
}
|
||||||
|
|
||||||
|
// set defaultMimefile
|
||||||
|
elFinder::$defaultMimefile = (isset($opts['defaultMimefile']) ? $opts['defaultMimefile'] : '');
|
||||||
|
|
||||||
|
// bind events listeners
|
||||||
|
if (!empty($opts['bind']) && is_array($opts['bind'])) {
|
||||||
|
$_req = $_SERVER["REQUEST_METHOD"] == 'POST' ? $_POST : $_GET;
|
||||||
|
$_reqCmd = isset($_req['cmd']) ? $_req['cmd'] : '';
|
||||||
|
foreach ($opts['bind'] as $cmd => $handlers) {
|
||||||
|
$doRegist = (strpos($cmd, '*') !== false);
|
||||||
|
if (!$doRegist) {
|
||||||
|
$doRegist = ($_reqCmd && in_array($_reqCmd, array_map('self::getCmdOfBind', explode(' ', $cmd))));
|
||||||
|
}
|
||||||
|
if ($doRegist) {
|
||||||
|
// for backward compatibility
|
||||||
|
if (!is_array($handlers)) {
|
||||||
|
$handlers = [$handlers];
|
||||||
|
} else {
|
||||||
|
if (count($handlers) === 2 && is_object($handlers[0])) {
|
||||||
|
$handlers = [$handlers];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
foreach ($handlers as $handler) {
|
||||||
|
if ($handler) {
|
||||||
|
if (is_string($handler) && strpos($handler, '.')) {
|
||||||
|
list($_domain, $_name, $_method) = array_pad(explode('.', $handler), 3, '');
|
||||||
|
if (strcasecmp($_domain, 'plugin') === 0) {
|
||||||
|
if ($plugin = $this->getPluginInstance($_name, isset($opts['plugin'][$_name]) ? $opts['plugin'][$_name] : [])
|
||||||
|
and method_exists($plugin, $_method)) {
|
||||||
|
$this->bind($cmd, [$plugin, $_method]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
$this->bind($cmd, $handler);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!isset($opts['roots']) || !is_array($opts['roots'])) {
|
||||||
|
$opts['roots'] = [];
|
||||||
|
}
|
||||||
|
|
||||||
|
// check for net volumes stored in session
|
||||||
|
$netVolumes = $this->getNetVolumes();
|
||||||
|
foreach ($netVolumes as $key => $root) {
|
||||||
|
if (!isset($root['id'])) {
|
||||||
|
// given fixed unique id
|
||||||
|
if (!$root['id'] = $this->getNetVolumeUniqueId($netVolumes)) {
|
||||||
|
$this->mountErrors[] = 'Netmount Driver "'.$root['driver'].'" : Could\'t given volume id.';
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
$opts['roots'][$key] = $root;
|
||||||
|
}
|
||||||
|
|
||||||
|
// "mount" volumes
|
||||||
|
foreach ($opts['roots'] as $i => $o) {
|
||||||
|
//$class = 'elFinderVolume'.(isset($o['driver']) ? $o['driver'] : '');
|
||||||
|
// Chamilo change
|
||||||
|
$class = (isset($o['driver']) ? $o['driver'] : '');
|
||||||
|
|
||||||
|
if (class_exists($class)) {
|
||||||
|
$volume = new $class();
|
||||||
|
|
||||||
|
try {
|
||||||
|
if ($this->maxArcFilesSize && (empty($o['maxArcFilesSize']) || $this->maxArcFilesSize < $o['maxArcFilesSize'])) {
|
||||||
|
$o['maxArcFilesSize'] = $this->maxArcFilesSize;
|
||||||
|
}
|
||||||
|
// pass session handler
|
||||||
|
$volume->setSession($this->session);
|
||||||
|
if ($volume->mount($o)) {
|
||||||
|
// unique volume id (ends on "_") - used as prefix to files hash
|
||||||
|
$id = $volume->id();
|
||||||
|
|
||||||
|
$this->volumes[$id] = $volume;
|
||||||
|
if ((!$this->default || $volume->root() !== $volume->defaultPath()) && $volume->isReadable()) {
|
||||||
|
$this->default = $this->volumes[$id];
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
$this->removeNetVolume($i, $volume);
|
||||||
|
$this->mountErrors[] = 'Driver "'.$class.'" : '.implode(' ', $volume->error());
|
||||||
|
}
|
||||||
|
} catch (Exception $e) {
|
||||||
|
$this->removeNetVolume($i, $volume);
|
||||||
|
$this->mountErrors[] = 'Driver "'.$class.'" : '.$e->getMessage();
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
$this->mountErrors[] = 'Driver "'.$class.'" does not exist';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// if at least one readable volume - ii desu >_<
|
||||||
|
$this->loaded = !empty($this->default);
|
||||||
|
|
||||||
|
// restore error handler for now
|
||||||
|
restore_error_handler();
|
||||||
|
}
|
||||||
|
}
|
||||||
82
src/Chamilo/CoreBundle/Component/Editor/TinyMce/TinyMce.php
Normal file
82
src/Chamilo/CoreBundle/Component/Editor/TinyMce/TinyMce.php
Normal file
@@ -0,0 +1,82 @@
|
|||||||
|
<?php
|
||||||
|
/* For licensing terms, see /license.txt */
|
||||||
|
|
||||||
|
namespace Chamilo\CoreBundle\Component\Editor\TinyMce;
|
||||||
|
|
||||||
|
use Chamilo\CoreBundle\Component\Editor\Editor;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Class TinyMce.
|
||||||
|
*
|
||||||
|
* @package Chamilo\CoreBundle\Component\Editor\TinyMce
|
||||||
|
*/
|
||||||
|
class TinyMce extends Editor
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Set js to be include in the template.
|
||||||
|
*/
|
||||||
|
public function setJavascriptToInclude()
|
||||||
|
{
|
||||||
|
$jsFolder = api_get_path(WEB_LIBRARY_JS_PATH);
|
||||||
|
$this->template->addResource($jsFolder.'tinymce/tinymce.min.js', 'js');
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
|
public function getEditorTemplate()
|
||||||
|
{
|
||||||
|
return 'javascript/editor/tinymce/elfinder.tpl';
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Return the HTML code required to run editor.
|
||||||
|
*
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
|
public function createHtml()
|
||||||
|
{
|
||||||
|
$html = '<textarea id="'.$this->name.'" name="'.$this->name.'" class="ckeditor" >'.$this->value.'</textarea>';
|
||||||
|
$html .= $this->editorReplace();
|
||||||
|
|
||||||
|
return $html;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
|
public function editorReplace()
|
||||||
|
{
|
||||||
|
$toolbar = new Toolbar\Basic($this->urlGenerator, $this->toolbarSet, $this->config, 'TinyMce');
|
||||||
|
$toolbar->setLanguage($this->getLocale());
|
||||||
|
$config = $toolbar->getConfig();
|
||||||
|
$config['selector'] = "#".$this->name;
|
||||||
|
$javascript = $this->toJavascript($config);
|
||||||
|
$javascript = str_replace('"elFinderBrowser"', "elFinderBrowser", $javascript);
|
||||||
|
|
||||||
|
$html = "<script>
|
||||||
|
function elFinderBrowser (field_name, url, type, win) {
|
||||||
|
tinymce.activeEditor.windowManager.open({
|
||||||
|
file: '".$this->urlGenerator->generate('filemanager')."',
|
||||||
|
title: 'elFinder 2.0',
|
||||||
|
width: 900,
|
||||||
|
height: 450,
|
||||||
|
resizable: 'yes'
|
||||||
|
}, {
|
||||||
|
setUrl: function (url) {
|
||||||
|
win.document.getElementById(field_name).value = url;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
$(document).ready(function() {
|
||||||
|
tinymce.init(
|
||||||
|
$javascript
|
||||||
|
);
|
||||||
|
});
|
||||||
|
</script>";
|
||||||
|
|
||||||
|
return $html;
|
||||||
|
}
|
||||||
|
}
|
||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user