Adding changes to make symfony2 run with chamilo in parallel

ofaj
jmontoya 9 years ago
parent 742b52a940
commit 9653c80edc
  1. 1
      .gitignore
  2. 12
      app/AppKernel.php
  3. 174
      app/config/assetic.yml
  4. 6
      app/config/config.yml
  5. 13
      app/config/routing.yml
  6. 2
      app/config/routing_admin.yml
  7. 10
      app/config/sonata/sonata_admin.yml
  8. 2
      main/inc/local.inc.php
  9. 104
      src/Chamilo/CoreBundle/Resources/config/routing.yml
  10. 6
      src/Chamilo/CoreBundle/Resources/views/Admin/admin_topnav.html.twig
  11. 69
      src/Chamilo/CoreBundle/Resources/views/Admin/index.html.twig
  12. 19
      src/Chamilo/CoreBundle/Resources/views/Admin/switcher_links.html.twig
  13. 61
      src/Chamilo/CourseBundle/Admin/CGroupInfoAdmin.php
  14. 201
      src/Chamilo/CourseBundle/Admin/CourseAdmin.php
  15. 63
      src/Chamilo/CourseBundle/Admin/CourseCategoryAdmin.php
  16. 77
      src/Chamilo/CourseBundle/Admin/CourseRelUserAdmin.php
  17. 66
      src/Chamilo/CourseBundle/Admin/CourseRequestAdmin.php
  18. 45
      src/Chamilo/CourseBundle/ChamiloCourseBundle.php
  19. 50
      src/Chamilo/CourseBundle/DependencyInjection/ChamiloCourseExtension.php
  20. 39
      src/Chamilo/CourseBundle/DependencyInjection/Compiler/RegisterSchemasPass.php
  21. 36
      src/Chamilo/CourseBundle/DependencyInjection/Compiler/ToolCompilerClass.php
  22. 63
      src/Chamilo/CourseBundle/DependencyInjection/Configuration.php
  23. 56
      src/Chamilo/CourseBundle/Resources/config/admin.yml
  24. 3
      src/Chamilo/UserBundle/Entity/User.php
  25. 2
      web/app_dev.php

1
.gitignore vendored

@ -10,6 +10,7 @@ app/cache/*
/app/config/events.conf.php
/app/config/mail.conf.php
/app/config/portfolio.conf.php
/app/config/profile.conf.php
/app/config/configuration.php
# Courses

@ -92,12 +92,12 @@ class AppKernel extends Kernel
// Chamilo
//new Chamilo\InstallerBundle\ChamiloInstallerBundle(),
new Chamilo\CoreBundle\ChamiloCoreBundle(),
/*new Chamilo\CourseBundle\ChamiloCourseBundle(),
new Chamilo\SettingsBundle\ChamiloSettingsBundle(),
new Chamilo\ThemeBundle\ChamiloThemeBundle(),
new Chamilo\NotificationBundle\ChamiloNotificationBundle(),
new Chamilo\AdminBundle\ChamiloAdminBundle(),
new Chamilo\TimelineBundle\ChamiloTimelineBundle(),*/
new Chamilo\CourseBundle\ChamiloCourseBundle(),
/* new Chamilo\SettingsBundle\ChamiloSettingsBundle(),
new Chamilo\ThemeBundle\ChamiloThemeBundle(),
new Chamilo\NotificationBundle\ChamiloNotificationBundle(),
new Chamilo\AdminBundle\ChamiloAdminBundle(),
new Chamilo\TimelineBundle\ChamiloTimelineBundle(),*/
// Based in Sonata
new Chamilo\ClassificationBundle\ChamiloClassificationBundle(),

@ -11,93 +11,93 @@ assetic:
yui_css: { jar: "%kernel.root_dir%/../bin/yuicompressor.jar" }
assets:
chamilo_bootstrap_css:
inputs:
- bundles/chamilocore/components/bootstrap/dist/css/bootstrap.min.css
filters:
- cssrewrite
chamilo_font_awesome_css:
inputs:
- bundles/chamilocore/components/fontawesome/css/font-awesome.min.css
filters:
- cssrewrite
chamilo_ionicons_css:
inputs:
- bundles/chamilocore/components/ionicons/css/ionicons.css
filters:
- cssrewrite
chamilo_css:
inputs:
- @chamilo_bootstrap_css
- @chamilo_font_awesome_css
- @chamilo_ionicons_css
- bundles/chamilocore/components/fullcalendar/dist/fullcalendar.min.css
- bundles/chamilocore/components/chosen-bower/chosen.css
- bundles/chamilocore/components/jquery-ui/themes/cupertino/jquery-ui.min.css
- bundles/chamilocore/components/bootflat/css/bootflat.css
- bundles/chamilocore/components/jqgrid/css/ui.jqgrid.css
- bundles/chamilocore/components/select2/dist/css/select2.css
- bundles/chamilocore/js/tag/style.css
- bundles/chamilocore/components/jquery-file-upload/css/jquery.fileupload.css
- bundles/chamilocore/components/jquery-file-upload/css/jquery.fileupload-ui.css
- bundles/chamilocore/components/bootstrap-language/languages.css
- bundles/chamilocore/css/grid.css
# - bundles/chamilocore/components/select2/select2-bootstrap.css
# - bundles/chamilocore/components/adminlte/css/jvectormap/*
# - bundles/chamilocore/components/adminlte/css/morris/*
# - bundles/chamilocore/components/adminlte/css/bootstrap-wysihtml5/bootstrap3-wysihtml5.css
# - bundles/chamilocore/components/adminlte/css/bootstrap-slider/slider.css
# - bundles/chamilocore/components/adminlte/css/colorpicker/bootstrap-colorpicker.css
# - bundles/chamilocore/components/adminlte/css/datatables/dataTables.bootstrap.css
# - bundles/chamilocore/components/adminlte/css/daterangepicker/daterangepicker-bs3.css
# - bundles/chamilocore/components/adminlte/css/iCheck/all.css
# - bundles/chamilocore/components/adminlte/css/ionslider/ion.rangeSlider.css
# - bundles/chamilocore/components/adminlte/css/timepicker/bootstrap-timepicker.css
- bundles/chamilocore/components/bootstrap-daterangepicker/daterangepicker-bs3.css
- bundles/chamilocore/components/eonasdan-bootstrap-datetimepicker/build/css/bootstrap-datetimepicker.css
- bundles/chamilocore/components/adminlte/dist/css/skins/_all-skins.min.css
- bundles/chamilocore/components/adminlte/dist/css/AdminLTE.css
filters:
- cssrewrite
output: js/chamilo.css
chamilo_js:
inputs:
- bundles/chamilocore/components/jquery/dist/jquery.js
- bundles/chamilocore/components/jquery-ui/jquery-ui.min.js
# - @bootstrap_js
- bundles/chamilocore/components/bootstrap/dist/js/bootstrap.min.js
- bundles/chamilocore/components/chosen-bower/chosen.jquery.js
# - @moment_js
- bundles/chamilocore/components/moment/moment.js
- bundles/chamilocore/components/fullcalendar/dist/fullcalendar.min.js
- bundles/chamilocore/components/jqgrid/js/jquery.jqGrid.js
- bundles/chamilocore/components/select2/dist/js/select2.js
- bundles/chamilocore/components/eonasdan-bootstrap-datetimepicker/build/js/bootstrap-datetimepicker.min.js
- bundles/chamilocore/components/jquery.scrollbar/jquery.scrollbar.js
- bundles/chamilocore/components/mediaelement/build/mediaelement-and-player.js
- bundles/chamilocore/js/upload.js
- bundles/chamilocore/js/pear/qfamsHandler.js
- bundles/chamilocore/components/image-map-resizer/js/imageMapResizer.js
- bundles/chamilocore/components/blueimp-load-image/js/load-image.all.min.js
- bundles/chamilocore/components/blueimp-canvas-to-blob/js/canvas-to-blob.min.js
- bundles/chamilocore/js/tag/jquery.fcbkcomplete.js
- bundles/chamilocore/components/jquery-file-upload/js/jquery.iframe-transport.js
- bundles/chamilocore/components/jquery-file-upload/js/jquery.fileupload.js
- bundles/chamilocore/components/jquery-file-upload/js/jquery.fileupload-process.js
- bundles/chamilocore/components/jquery-file-upload/js/jquery.fileupload-image.js
- bundles/chamilocore/components/jquery-file-upload/js/jquery.fileupload-audio.js
- bundles/chamilocore/components/jquery-file-upload/js/jquery.fileupload-video.js
- bundles/chamilocore/components/jquery-file-upload/js/jquery.fileupload-validate.js
- bundles/chamilocore/components/bootstrap-daterangepicker/daterangepicker.js
- bundles/chamilocore/components/adminlte/dist/js/app.js
output: js/chamilo.js
# chamilo_bootstrap_css:
# inputs:
# - bundles/chamilocore/components/bootstrap/dist/css/bootstrap.min.css
# filters:
# - cssrewrite
# chamilo_font_awesome_css:
# inputs:
# - bundles/chamilocore/components/fontawesome/css/font-awesome.min.css
# filters:
# - cssrewrite
# chamilo_ionicons_css:
# inputs:
# - bundles/chamilocore/components/ionicons/css/ionicons.css
# filters:
# - cssrewrite
#
# chamilo_css:
# inputs:
# - @chamilo_bootstrap_css
# - @chamilo_font_awesome_css
# - @chamilo_ionicons_css
# - bundles/chamilocore/components/fullcalendar/dist/fullcalendar.min.css
# - bundles/chamilocore/components/chosen-bower/chosen.css
# - bundles/chamilocore/components/jquery-ui/themes/cupertino/jquery-ui.min.css
# - bundles/chamilocore/components/bootflat/css/bootflat.css
# - bundles/chamilocore/components/jqgrid/css/ui.jqgrid.css
# - bundles/chamilocore/components/select2/dist/css/select2.css
# - bundles/chamilocore/js/tag/style.css
# - bundles/chamilocore/components/jquery-file-upload/css/jquery.fileupload.css
# - bundles/chamilocore/components/jquery-file-upload/css/jquery.fileupload-ui.css
# - bundles/chamilocore/components/bootstrap-language/languages.css
# - bundles/chamilocore/css/grid.css
#
## - bundles/chamilocore/components/select2/select2-bootstrap.css
## - bundles/chamilocore/components/adminlte/css/jvectormap/*
## - bundles/chamilocore/components/adminlte/css/morris/*
## - bundles/chamilocore/components/adminlte/css/bootstrap-wysihtml5/bootstrap3-wysihtml5.css
## - bundles/chamilocore/components/adminlte/css/bootstrap-slider/slider.css
## - bundles/chamilocore/components/adminlte/css/colorpicker/bootstrap-colorpicker.css
## - bundles/chamilocore/components/adminlte/css/datatables/dataTables.bootstrap.css
## - bundles/chamilocore/components/adminlte/css/daterangepicker/daterangepicker-bs3.css
## - bundles/chamilocore/components/adminlte/css/iCheck/all.css
## - bundles/chamilocore/components/adminlte/css/ionslider/ion.rangeSlider.css
## - bundles/chamilocore/components/adminlte/css/timepicker/bootstrap-timepicker.css
# - bundles/chamilocore/components/bootstrap-daterangepicker/daterangepicker-bs3.css
# - bundles/chamilocore/components/eonasdan-bootstrap-datetimepicker/build/css/bootstrap-datetimepicker.css
# - bundles/chamilocore/components/adminlte/dist/css/skins/_all-skins.min.css
# - bundles/chamilocore/components/adminlte/dist/css/AdminLTE.css
# filters:
# - cssrewrite
# output: js/chamilo.css
#
# chamilo_js:
# inputs:
# - bundles/chamilocore/components/jquery/dist/jquery.js
# - bundles/chamilocore/components/jquery-ui/jquery-ui.min.js
## - @bootstrap_js
# - bundles/chamilocore/components/bootstrap/dist/js/bootstrap.min.js
# - bundles/chamilocore/components/chosen-bower/chosen.jquery.js
## - @moment_js
# - bundles/chamilocore/components/moment/moment.js
# - bundles/chamilocore/components/fullcalendar/dist/fullcalendar.min.js
# - bundles/chamilocore/components/jqgrid/js/jquery.jqGrid.js
# - bundles/chamilocore/components/select2/dist/js/select2.js
# - bundles/chamilocore/components/eonasdan-bootstrap-datetimepicker/build/js/bootstrap-datetimepicker.min.js
# - bundles/chamilocore/components/jquery.scrollbar/jquery.scrollbar.js
# - bundles/chamilocore/components/mediaelement/build/mediaelement-and-player.js
# - bundles/chamilocore/js/upload.js
# - bundles/chamilocore/js/pear/qfamsHandler.js
# - bundles/chamilocore/components/image-map-resizer/js/imageMapResizer.js
#
# - bundles/chamilocore/components/blueimp-load-image/js/load-image.all.min.js
# - bundles/chamilocore/components/blueimp-canvas-to-blob/js/canvas-to-blob.min.js
#
# - bundles/chamilocore/js/tag/jquery.fcbkcomplete.js
#
# - bundles/chamilocore/components/jquery-file-upload/js/jquery.iframe-transport.js
# - bundles/chamilocore/components/jquery-file-upload/js/jquery.fileupload.js
# - bundles/chamilocore/components/jquery-file-upload/js/jquery.fileupload-process.js
# - bundles/chamilocore/components/jquery-file-upload/js/jquery.fileupload-image.js
# - bundles/chamilocore/components/jquery-file-upload/js/jquery.fileupload-audio.js
# - bundles/chamilocore/components/jquery-file-upload/js/jquery.fileupload-video.js
# - bundles/chamilocore/components/jquery-file-upload/js/jquery.fileupload-validate.js
# - bundles/chamilocore/components/bootstrap-daterangepicker/daterangepicker.js
# - bundles/chamilocore/components/adminlte/dist/js/app.js
#
# output: js/chamilo.js
# see https://sonata-project.org/blog/2012/5/15/assetic-package-configuration

@ -11,7 +11,7 @@ imports:
- { resource: mopa/mopa_bootstrap.yml }
# FriendOfSymfony Bundles
#- { resource: fos/fos_comment.yml }r
#- { resource: fos/fos_comment.yml }
# - { resource: fos/fos_rest.yml }
- { resource: fos/fos_user.yml }
#- { resource: fos/fos_elastica.yml }
@ -173,8 +173,8 @@ swiftmailer:
spool: { type: memory }
doctrine_migrations:
dir_name: %kernel.root_dir%/../src/Chamilo/CoreBundle/Migrations/Schema/V2_0_0
namespace: Chamilo\CoreBundle\Migrations\Schema\V_2_0_0
dir_name: %kernel.root_dir%/../app/Migrations/V111
namespace: Application\Migrations\Schema\V111
table_name: version
name: Chamilo Migrations

@ -67,21 +67,18 @@ _admin:
elfinder:
resource: "@FMElfinderBundle/Resources/config/routing.yml"
chamilo_installer:
resource: "@ChamiloInstallerBundle/Resources/config/routing.yml"
#chamilo_installer:
# resource: "@ChamiloInstallerBundle/Resources/config/routing.yml"
# Always at the end
core_bundle:
resource: "@ChamiloCoreBundle/Resources/config/routing.yml"
liip_theme:
resource: "@LiipThemeBundle/Resources/config/routing.xml"
prefix: /theme
#liip_theme:
# resource: "@LiipThemeBundle/Resources/config/routing.xml"
# prefix: /theme
# app/config/routing.yml
fos_js_routing:
resource: "@FOSJsRoutingBundle/Resources/config/routing/routing.xml"
oro_distribution_bundle:
resource: "@OroDistributionBundle/Controller"
type: annotation

@ -11,7 +11,7 @@ sonata_user_admin_security:
resource: '@SonataUserBundle/Resources/config/routing/admin_security.xml'
sonata_user_admin_resetting:
resource: '@SonataUserBundle/Resources/config/routing/admin_resetting.xml'
resource: '@SonataUserBundle/Resources/config/routing/sonata_resetting_1.xml'
prefix: /resetting
sonata_media_pixlr:

@ -6,7 +6,7 @@ sonata_admin:
security:
handler: sonata.admin.security.handler.role
title: Chamilo #%sonata_admin.title%
title_logo: bundles/chamilocore/css/themes/chamilo/images/header-logo.png #%sonata_admin.logo_title%
title_logo: css/themes/chamilo/images/header-logo.png #%sonata_admin.logo_title%
options:
html5_validate: false # does not use html5 validation
pager_links: 5 # pager max links to display
@ -26,7 +26,7 @@ sonata_admin:
list: SonataAdminBundle:CRUD:list.html.twig
show: SonataAdminBundle:CRUD:show.html.twig
edit: SonataAdminBundle:CRUD:edit.html.twig
user_block: ChamiloCoreBundle:Admin:admin_topnav.html.twig
# user_block: ChamiloCoreBundle:Admin:admin_topnav.html.twig
extensions:
# cmf_core.admin_extension.translatable:
@ -43,8 +43,8 @@ sonata_admin:
dashboard:
blocks:
- { position: left, type: sonata.admin.block.admin_list }
- { position: right, type: sonata.timeline.block.timeline, settings: { context: SONATA_ADMIN, max_per_page: 25, template: 'ChamiloTimelineBundle:Block:timeline.html.twig',}}
- { position: right, type: sonata.admin_doctrine_orm.block.audit}
# - { position: right, type: sonata.timeline.block.timeline, settings: { context: SONATA_ADMIN, max_per_page: 25, template: 'ChamiloTimelineBundle:Block:timeline.html.twig',}}
# - { position: right, type: sonata.admin_doctrine_orm.block.audit}
# - { position: center, type: sonata.block.service.text, settings: { content: "<h2>Welcome!</h2> You can customize this dashboard by editing the sonata_admin.yml file. The current dashboard presents the recent items from the NewsBundle and a timeline with the latest action"} }
#- { position: center, type: sonata.news.block.recent_posts, settings: { title: Recent Posts, number: 7, mode: admin }}
@ -105,7 +105,7 @@ sonata_admin:
#icon: '<i class="fa fa-play-circle"></i>'
label_catalogue: SonataAdminBundle
items:
- sonata.admin.course
# - sonata.admin.course
- sonata.admin.course_category
- sonata.admin.course_request
- sonata.admin.c_group_info

@ -331,8 +331,8 @@ if (!empty($_SESSION['_user']['user_id']) && !($login || $logout)) {
$uData['auth_source'] == CAS_AUTH_SOURCE
) {
$validPassword = false;
$user = $userManager->findUserByUsername($login);
if ($user) {
$validPassword = UserManager::isPasswordValid(
$password,

@ -1,38 +1,38 @@
index:
resource: '@ChamiloCoreBundle/Controller/IndexController.php'
type: annotation
userportal:
resource: '@ChamiloCoreBundle/Controller/UserPortalController.php'
type: annotation
prefix: /userportal
front:
resource: '@ChamiloCoreBundle/Controller/FrontController.php'
type: annotation
prefix: /front
user:
resource: '@ChamiloCoreBundle/Controller/User/UserController.php'
type: annotation
prefix: /user
course:
resource: '@ChamiloCoreBundle/Controller/CourseController.php'
type: annotation
prefix: /course
legacy_javascript:
resource: '@ChamiloCoreBundle/Controller/JavascriptLegacyController.php'
type: annotation
prefix: /js
#index:
# resource: '@ChamiloCoreBundle/Controller/IndexController.php'
# type: annotation
#
#userportal:
# resource: '@ChamiloCoreBundle/Controller/UserPortalController.php'
# type: annotation
# prefix: /userportal
#
#front:
# resource: '@ChamiloCoreBundle/Controller/FrontController.php'
# type: annotation
# prefix: /front
#
#user:
# resource: '@ChamiloCoreBundle/Controller/User/UserController.php'
# type: annotation
# prefix: /user
#
#course:
# resource: '@ChamiloCoreBundle/Controller/CourseController.php'
# type: annotation
# prefix: /course
#
#legacy_javascript:
# resource: '@ChamiloCoreBundle/Controller/JavascriptLegacyController.php'
# type: annotation
# prefix: /js
# Legacy routes
main:
path: /main/{name}
defaults: { _controller: ChamiloCoreBundle:Legacy:classic }
requirements:
name: .+
#main:
# path: /main/{name}
# defaults: { _controller: ChamiloCoreBundle:Legacy:classic }
# requirements:
# name: .+
# web url shortcuts for legacy templates
web.ajax:
@ -45,25 +45,25 @@ web.img:
path: bundles/chamilocore/img/
# Core controllers
core_admin:
resource: '@ChamiloCoreBundle/Controller/Admin'
type: annotation
prefix: /admin
course_url:
path: courses
core_tool:
resource: '@ChamiloCourseBundle/Controller'
type: annotation
prefix: /courses/{course}/
core_tool_document:
pattern: /courses/{course}/document/{file}
defaults:
_controller: ChamiloCoreBundle:Resource:getDocument
requirements:
file: .+ # allow "/" in {file}
#core_admin:
# resource: '@ChamiloCoreBundle/Controller/Admin'
# type: annotation
# prefix: /admin
#
#course_url:
# path: courses
#
#core_tool:
# resource: '@ChamiloCourseBundle/Controller'
# type: annotation
# prefix: /courses/{course}/
#
#core_tool_document:
# pattern: /courses/{course}/document/{file}
# defaults:
# _controller: ChamiloCoreBundle:Resource:getDocument
# requirements:
# file: .+ # allow "/" in {file}
#chamilo_course_tool_intro_create:
# path: /courses/{course}/introduction/{tool}/create/

@ -0,0 +1,6 @@
{% extends 'SonataAdminBundle:Core:user_block.html.twig' %}
{% block user_block %}
{{ locale_switcher(null, null, 'ChamiloCoreBundle:Admin:switcher_links.html.twig') }}
{{ parent() }}
{% endblock %}

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

@ -0,0 +1,19 @@
<div class="dropdown">
<button type="button" id="dropdownMenu1" data-toggle="dropdown"
aria-haspopup="true" aria-expanded="true">
<span class="lang-sm lang-lbl-full"
lang="{{ app.request.locale }}"></span> <span
class="caret"></span>
</button>
<ul class="dropdown-menu" aria-labelledby="dropdownMenu1">
{% for locale in locales %}
<li>
<a href="{{ locale.link }}"
title="{{ locale.locale_target_language }}">
<span class="lang-sm lang-lbl-full" lang="{{ locale.locale }}"></span>
{{ locale.locale_target_language }}
</a>
</li>
{% endfor %}
</ul>
</div>

@ -0,0 +1,61 @@
<?php
/* For licensing terms, see /license.txt */
namespace Chamilo\CourseBundle\Admin;
use Sonata\AdminBundle\Admin\Admin;
use Sonata\AdminBundle\Form\FormMapper;
use Sonata\AdminBundle\Datagrid\DatagridMapper;
use Sonata\AdminBundle\Datagrid\ListMapper;
use Sonata\AdminBundle\Show\ShowMapper;
/**
* Class CGroupInfoAdmin
* @package Chamilo\CourseBundle\Admin
*/
class CGroupInfoAdmin extends Admin
{
/**
* @param FormMapper $formMapper
*/
protected function configureFormFields(FormMapper $formMapper)
{
$formMapper
->add('name')
->add('description')
->add('course')
->add('status')
;
}
/**
* @param ShowMapper $showMapper
*/
protected function configureShowField(ShowMapper $showMapper)
{
$showMapper
->add('name')
;
}
/**
* @param DatagridMapper $datagridMapper
*/
protected function configureDatagridFilters(DatagridMapper $datagridMapper)
{
$datagridMapper
->add('name')
->add('status')
;
}
/**
* @param ListMapper $listMapper
*/
protected function configureListFields(ListMapper $listMapper)
{
$listMapper
->addIdentifier('name')
;
}
}

@ -0,0 +1,201 @@
<?php
/* For licensing terms, see /license.txt */
namespace Chamilo\CourseBundle\Admin;
use Chamilo\CoreBundle\Entity\Listener\CourseListener;
use Chamilo\CourseBundle\Entity\CTool;
use Chamilo\CoreBundle\Entity\Course;
use Sonata\AdminBundle\Admin\Admin;
use Sonata\AdminBundle\Form\FormMapper;
use Sonata\AdminBundle\Datagrid\DatagridMapper;
use Sonata\AdminBundle\Datagrid\ListMapper;
use Sonata\AdminBundle\Show\ShowMapper;
use Chamilo\CourseBundle\ToolChain;
/**
* Class CourseAdmin
* @package Chamilo\CoreBundle\Admin
*/
class CourseAdmin extends Admin
{
protected $toolChain;
/**
* Setting default values
* @inheritdoc
*/
public function getNewInstance()
{
$instance = parent::getNewInstance();
$instance->setVisibility('2');
$instance->setCourseLanguage($this->getTranslator()->getLocale());
return $instance;
}
/**
* @param FormMapper $formMapper
*/
protected function configureFormFields(FormMapper $formMapper)
{
$formMapper
->add('title')
->add('code', 'text', array(
//'read_only' => true,
))
->add('description', 'ckeditor')
->add('courseLanguage', 'language')
->add('departmentName')
->add(
'visibility',
'choice',
array(
'choices' => Course::getStatusList(),
'translation_domain' => 'ChamiloCoreBundle'
)
)
->add('departmentUrl', 'url', array('required' => false))
->add('urls', 'sonata_type_collection', array(
'cascade_validation' => true,
), array(
'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.access_url_rel_course'
)
)
->add('users', 'sonata_type_collection', array(
'cascade_validation' => true,
),
array(
'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.course_rel_user'
)
)
;
}
/**
* @param DatagridMapper $datagridMapper
*/
protected function configureDatagridFilters(DatagridMapper $datagridMapper)
{
$datagridMapper
->add('title')
->add('code')
->add(
'visibility',
null,
array(),
'choice',
array('choices' => Course::getStatusList())
)
;
}
/**
* @param ListMapper $listMapper
*/
protected function configureListFields(ListMapper $listMapper)
{
$listMapper
->addIdentifier('title')
->addIdentifier('code')
->add('courseLanguage')
->add('visibility', 'choice', array(
'choices' => Course::getStatusList()
))
;
}
/**
* Very important in order to save the related entities while updating.
* @param \Chamilo\CoreBundle\Entity\Course $course
* @return mixed|void
*/
public function preUpdate($course)
{
$course->setUsers($course->getUsers());
$course->setUrls($course->getUrls());
$this->updateTools($course);
}
/**
* Very important in order to save the related entities while creation.
* @param Course $course
* @return mixed|void
*/
public function prePersist($course)
{
$course->setUsers($course->getUsers());
$course->setUrls($course->getUrls());
$this->updateTools($course);
}
/***
* Generate tool inside the course
* @param Course $course
*/
public function updateTools($course)
{
$toolChain = $this->getToolChain();
$tools = $toolChain->getTools();
$currentTools = $course->getTools();
// @todo use
//$toolChain->addToolsInCourse($course);
$addedTools = array();
if (!empty($currentTools)) {
foreach ($currentTools as $tool) {
$addedTools[] = $tool->getName();
}
}
foreach ($tools as $tool) {
$toolName = $tool->getName();
if (!in_array($toolName, $addedTools)) {
$toolEntity = new CTool();
$toolEntity
->setCId($course->getId())
->setImage($tool->getImage())
->setName($tool->getName())
->setLink($tool->getLink())
->setTarget($tool->getTarget())
->setCategory($tool->getCategory())
;
$course->addTools($toolEntity);
}
}
}
/**
* @param ToolChain $chainTool
*/
public function setToolChain(ToolChain $chainTool)
{
$this->toolChain = $chainTool;
}
/**
* @return ToolChain
*/
public function getToolChain()
{
return $this->toolChain;
}
}

@ -0,0 +1,63 @@
<?php
/* For licensing terms, see /license.txt */
namespace Chamilo\CourseBundle\Admin;
use Sonata\AdminBundle\Admin\Admin;
use Sonata\AdminBundle\Form\FormMapper;
use Sonata\AdminBundle\Datagrid\DatagridMapper;
use Sonata\AdminBundle\Datagrid\ListMapper;
use Sonata\AdminBundle\Show\ShowMapper;
use Knp\Menu\ItemInterface as MenuItemInterface;
/**
* Class CourseCategoryAdmin
* @package Chamilo\CoreBundle\Admin
*/
class CourseCategoryAdmin extends Admin
{
/**
* @param FormMapper $formMapper
*/
protected function configureFormFields(FormMapper $formMapper)
{
$formMapper
->add('name')
->add('code')
->add('parent')
;
}
/**
* @param ShowMapper $showMapper
*/
protected function configureShowField(ShowMapper $showMapper)
{
$showMapper
->add('id')
->add('name')
;
}
/**
* @param DatagridMapper $datagridMapper
*/
protected function configureDatagridFilters(DatagridMapper $datagridMapper)
{
$datagridMapper
->add('id')
->add('name')
;
}
/**
* @param ListMapper $listMapper
*/
protected function configureListFields(ListMapper $listMapper)
{
$listMapper
->addIdentifier('name')
;
}
}

@ -0,0 +1,77 @@
<?php
/* For licensing terms, see /license.txt */
namespace Chamilo\CourseBundle\Admin;
use Sonata\AdminBundle\Admin\Admin;
use Sonata\AdminBundle\Form\FormMapper;
use Sonata\AdminBundle\Datagrid\DatagridMapper;
use Sonata\AdminBundle\Datagrid\ListMapper;
use Sonata\AdminBundle\Show\ShowMapper;
use Chamilo\CoreBundle\Entity\CourseRelUser;
/**
* Class CourseAdmin
* @package Chamilo\CoreBundle\Admin
*/
class CourseRelUserAdmin extends Admin
{
/**
* @param \Sonata\AdminBundle\Show\ShowMapper $showMapper
*
* @return void
*/
protected function configureShowField(ShowMapper $showMapper)
{
$showMapper
->add('id')
;
}
/**
* @param FormMapper $formMapper
*/
protected function configureFormFields(FormMapper $formMapper)
{
$formMapper
->add('user')
//->add('group', 'text')
->add('status', 'choice', array(
'choices' => CourseRelUser::getStatusList()
)
)
->add('relation_type', 'sonata_type_translatable_choice', array(
'choices' => CourseRelUser::getRelationTypeList()
)
)
->end()
;
}
/**
* @param DatagridMapper $datagridMapper
*/
protected function configureDatagridFilters(DatagridMapper $datagridMapper)
{
$datagridMapper
->add('course')
->add('user')
;
}
/**
* @param ListMapper $listMapper
*/
protected function configureListFields(ListMapper $listMapper)
{
$listMapper
->addIdentifier('user')
->addIdentifier('course')
//->addIdentifier('group')
->add('status', 'sonata_type_translatable_choice', array(
'choices' => CourseRelUser::getStatusList()
)
)
;
}
}

@ -0,0 +1,66 @@
<?php
/* For licensing terms, see /license.txt */
namespace Chamilo\CourseBundle\Admin;
use Sonata\AdminBundle\Admin\Admin;
use Sonata\AdminBundle\Form\FormMapper;
use Sonata\AdminBundle\Datagrid\DatagridMapper;
use Sonata\AdminBundle\Datagrid\ListMapper;
use Sonata\AdminBundle\Show\ShowMapper;
/**
* Class CourseRequestAdmin
* @package Chamilo\CoreBundle\Admin
*/
class CourseRequestAdmin extends Admin
{
/**
* @param FormMapper $formMapper
*/
protected function configureFormFields(FormMapper $formMapper)
{
$formMapper
->add('title')
->add('description', 'textarea', array('attr' => array('class'=> 'ckeditor')))
->add('code')
->add('user')
->add('status')
->add('info')
->add('directory')
->add('exemplaryContent', 'checkbox')
->add('courseLanguage', 'language')
;
}
/**
* @param ShowMapper $showMapper
*/
protected function configureShowField(ShowMapper $showMapper)
{
$showMapper
->add('id')
->add('title')
;
}
/**
* @param DatagridMapper $datagridMapper
*/
protected function configureDatagridFilters(DatagridMapper $datagridMapper)
{
$datagridMapper
->add('title')
;
}
/**
* @param ListMapper $listMapper
*/
protected function configureListFields(ListMapper $listMapper)
{
$listMapper
->addIdentifier('title')
;
}
}

@ -0,0 +1,45 @@
<?php
/* For licensing terms, see /license.txt */
namespace Chamilo\CourseBundle;
use Symfony\Component\HttpKernel\Bundle\Bundle;
use Symfony\Component\DependencyInjection\ContainerBuilder;
use Chamilo\CourseBundle\DependencyInjection\Compiler\ToolCompilerClass;
use Chamilo\CourseBundle\DependencyInjection\Compiler\RegisterSchemasPass;
/**
* Class ChamiloCourseBundle
* @package Chamilo\CourseBundle
*/
class ChamiloCourseBundle extends Bundle
{
/**
* {@inheritdoc}
*/
public static function getSupportedDrivers()
{
return array(
SyliusResourceBundle::DRIVER_DOCTRINE_ORM
);
}
/**
* {@inheritdoc}
*/
protected function getBundlePrefix()
{
return 'chamilo_course';
}
/**
* {@inheritDoc}
*/
public function build(ContainerBuilder $container)
{
parent::build($container);
$container->addCompilerPass(new ToolCompilerClass());
$container->addCompilerPass(new RegisterSchemasPass());
}
}

@ -0,0 +1,50 @@
<?php
/* For licensing terms, see /license.txt */
namespace Chamilo\CourseBundle\DependencyInjection;
use Sylius\Bundle\ResourceBundle\DependencyInjection\Extension\AbstractResourceExtension;
//use Sylius\Bundle\ResourceBundle\DependencyInjection\AbstractResourceExtension; old
use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\Config\FileLocator;
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 ChamiloCourseExtension extends Extension
{
// You can choose your application name, it will use to prefix the configuration keys in the container (the default value is sylius).
protected $applicationName = 'chamilo_course';
// You can define where yours service definitions are
protected $configDirectory = '/../Resources/config';
// You can define what service definitions you want to load
protected $configFiles = array(
'services.yml',
'forms.yml',
);
/**
* {@inheritDoc}
*/
public function load(array $config, ContainerBuilder $container)
{
$loader = new Loader\YamlFileLoader($container, new FileLocator(__DIR__.'/../Resources/config'));
//$loader->load('services.yml');
$loader->load('admin.yml');
//self::CONFIGURE_VALIDATORS
/*$this->configure(
$config,
new Configuration(),
$container,
self::CONFIGURE_LOADER | self::CONFIGURE_DATABASE | self::CONFIGURE_PARAMETERS | self::CONFIGURE_FORMS
);*/
}
}

@ -0,0 +1,39 @@
<?php
/* For licensing terms, see /license.txt */
namespace Chamilo\CourseBundle\DependencyInjection\Compiler;
use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface;
use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\DependencyInjection\Reference;
/**
* Register all the course settings schemas in the schema registry.
* Save the configuration names in parameter for the provider.
*
*/
class RegisterSchemasPass implements CompilerPassInterface
{
/**
* {@inheritdoc}
*/
public function process(ContainerBuilder $container)
{
if (!$container->hasDefinition('chamilo_course.settings.schema_registry')) {
return;
}
$schemaRegistry = $container->getDefinition('chamilo_course.settings.schema_registry');
foreach ($container->findTaggedServiceIds('chamilo_course.settings_schema') as $id => $attributes) {
if (!array_key_exists('namespace', $attributes[0])) {
throw new \InvalidArgumentException(sprintf('Service "%s" must define the "namespace" attribute on "chamilo_course.settings_schema" tags.', $id));
}
$namespace = $attributes[0]['namespace'];
$schemaRegistry->addMethodCall('registerSchema', array($namespace, new Reference($id)));
}
}
}

@ -0,0 +1,36 @@
<?php
/* For licensing terms, see /license.txt */
namespace Chamilo\CourseBundle\DependencyInjection\Compiler;
use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface;
use Symfony\Component\DependencyInjection\Reference;
/**
* Class ToolCompilerClass
* Loads the services with tag "chamilo_course.tool" in order to be added
* as a course tool (Documents, Notebook, etc)
* @package Chamilo\CourseBundle\DependencyInjection\Compiler
*/
class ToolCompilerClass implements CompilerPassInterface
{
public function process(ContainerBuilder $container)
{
if (!$container->hasDefinition('chamilo_course.tool_chain')) {
return;
}
$definition = $container->getDefinition(
'chamilo_course.tool_chain'
);
$taggedServices = $container->findTaggedServiceIds(
'chamilo_course.tool'
);
foreach ($taggedServices as $id => $attributes) {
$definition->addMethodCall('addTool', array(new Reference($id)));
}
}
}

@ -0,0 +1,63 @@
<?php
namespace Chamilo\CourseBundle\DependencyInjection;
use Symfony\Component\Config\Definition\Builder\ArrayNodeDefinition;
use Symfony\Component\Config\Definition\Builder\TreeBuilder;
use Symfony\Component\Config\Definition\ConfigurationInterface;
/**
* This is the class that validates and merges configuration from your app/config files
*
* To learn more see {@link http://symfony.com/doc/current/cookbook/bundles/extension.html#cookbook-bundles-extension-config-class}
*/
class Configuration implements ConfigurationInterface
{
/**
* {@inheritdoc}
*/
public function getConfigTreeBuilder()
{
$treeBuilder = new TreeBuilder();
$rootNode = $treeBuilder->root('chamilo_course');
$rootNode
->addDefaultsIfNotSet()
->children()
->scalarNode('driver')->defaultValue('doctrine/orm')->cannotBeEmpty()->end()
->end()
;
$this->addClassesSection($rootNode);
return $treeBuilder;
}
/**
* Adds `classes` section.
*
* @param ArrayNodeDefinition $node
*/
private function addClassesSection(ArrayNodeDefinition $node)
{
$node
->children()
->arrayNode('classes')
->addDefaultsIfNotSet()
->children()
->arrayNode('parameter')
->addDefaultsIfNotSet()
->children()
->scalarNode('model')->defaultValue('Sylius\Bundle\SettingsBundle\Model\Parameter')->cannotBeEmpty()->end()
->scalarNode('controller')->defaultValue('Sylius\Bundle\ResourceBundle\Controller\ResourceController')->end()
->scalarNode('repository')->cannotBeEmpty()->end()
->scalarNode('form')->defaultValue(
'MyApp\MyCustomBundle\Form\Type\MyformType'
)->end()
->end()
->end()
->end()
->end()
->end()
;
}
}

@ -0,0 +1,56 @@
services:
# sonata.admin.course:
# class: Chamilo\CourseBundle\Admin\CourseAdmin
# tags:
# - { name: sonata.admin, manager_type: orm, audit: true, group: "LMS", label: "Course" }
# arguments:
# - ~
# - Chamilo\CoreBundle\Entity\Course
# - ~
# calls:
# - [ setTranslationDomain, [ChamiloCoreBundle]]
# - [ setToolChain, [@chamilo_course.tool_chain]]
sonata.admin.course_rel_user:
class: Chamilo\CourseBundle\Admin\CourseRelUserAdmin
tags:
- { name: sonata.admin, manager_type: orm, group: "LMS", label: "CourseRelUser" }
arguments:
- ~
- Chamilo\CoreBundle\Entity\CourseRelUser
- ~
calls:
- [ setTranslationDomain, [ChamiloCoreBundle]]
sonata.admin.course_category:
class: Chamilo\CourseBundle\Admin\CourseCategoryAdmin
tags:
- { name: sonata.admin, manager_type: orm, group: "LMS", label: "CourseCategoryAdmin" }
arguments:
- ~
- Chamilo\CoreBundle\Entity\CourseCategory
- ~
calls:
- [ setTranslationDomain, [ChamiloCoreBundle]]
sonata.admin.course_request:
class: Chamilo\CourseBundle\Admin\CourseRequestAdmin
tags:
- { name: sonata.admin, manager_type: orm, group: "LMS", label: "CourseRequestAdmin" }
arguments:
- ~
- Chamilo\CoreBundle\Entity\CourseRequest
- ~
calls:
- [ setTranslationDomain, [ChamiloCoreBundle]]
sonata.admin.c_group_info:
class: Chamilo\CourseBundle\Admin\CGroupInfoAdmin
tags:
- { name: sonata.admin, manager_type: orm, audit: true, group: "LMS", label: "CGroupInfo" }
arguments:
- ~
- Chamilo\CourseBundle\Entity\CGroupInfo
- ~
calls:
- [ setTranslationDomain, [ChamiloCoreBundle]]

@ -3,7 +3,6 @@
namespace Chamilo\UserBundle\Entity;
//use Chamilo\CoreBundle\Entity\UserFieldValues;
use Chamilo\CoreBundle\Entity\ExtraFieldValues;
use Chamilo\CoreBundle\Entity\UsergroupRelUser;
use Doctrine\Common\Collections\ArrayCollection;
@ -41,7 +40,7 @@ use Symfony\Component\Validator\Mapping\ClassMetadata;
* @ORM\Entity(repositoryClass="Chamilo\UserBundle\Entity\Repository\UserRepository")
*
*/
class User extends BaseUser //implements ParticipantInterface, ThemeUser
class User// extends BaseUser //implements ParticipantInterface, ThemeUser
{
const COURSE_MANAGER = 1;
const TEACHER = 1;

@ -36,7 +36,7 @@ $response->send();
$kernel->terminate($request, $response);*/
require_once __DIR__.'/../app/AppKernel.php';
require_once __DIR__.'/legacy.php';
//require_once __DIR__.'/legacy.php';
$request = Sonata\PageBundle\Request\RequestFactory::createFromGlobals(
'host_with_path_by_locale'
);

Loading…
Cancel
Save