parent
742b52a940
commit
9653c80edc
@ -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]] |
Loading…
Reference in new issue