Adding bundles and setting up symfony2

ofaj
jmontoya 10 years ago
parent 944ca558ea
commit c3e8aab460
  1. 136
      app/AppKernel.php
  2. 764
      app/SymfonyRequirements.php
  3. 13
      app/autoload.php
  4. 3336
      app/bootstrap.php.cache
  5. 142
      app/check.php
  6. 27
      app/console
  7. 21
      src/Chamilo/ClassificationBundle/ChamiloClassificationBundle.php
  8. 40
      src/Chamilo/ClassificationBundle/Document/Category.php
  9. 40
      src/Chamilo/ClassificationBundle/Document/Tag.php
  10. 40
      src/Chamilo/ClassificationBundle/Entity/Category.php
  11. 40
      src/Chamilo/ClassificationBundle/Entity/Collection.php
  12. 42
      src/Chamilo/ClassificationBundle/Entity/Context.php
  13. 40
      src/Chamilo/ClassificationBundle/Entity/Tag.php
  14. 12
      src/Chamilo/ClassificationBundle/Resources/config/doctrine/Category.mongodb.xml
  15. 24
      src/Chamilo/ClassificationBundle/Resources/config/doctrine/Category.orm.xml
  16. 24
      src/Chamilo/ClassificationBundle/Resources/config/doctrine/Collection.orm.xml
  17. 24
      src/Chamilo/ClassificationBundle/Resources/config/doctrine/Context.orm.xml
  18. 12
      src/Chamilo/ClassificationBundle/Resources/config/doctrine/Tag.mongodb.xml
  19. 24
      src/Chamilo/ClassificationBundle/Resources/config/doctrine/Tag.orm.xml
  20. 17
      src/Chamilo/ClassificationBundle/Resources/config/serializer/Document.Category.xml
  21. 17
      src/Chamilo/ClassificationBundle/Resources/config/serializer/Document.Tag.xml
  22. 17
      src/Chamilo/ClassificationBundle/Resources/config/serializer/Entity.Category.xml
  23. 17
      src/Chamilo/ClassificationBundle/Resources/config/serializer/Entity.Collection.xml
  24. 17
      src/Chamilo/ClassificationBundle/Resources/config/serializer/Entity.Context.xml
  25. 17
      src/Chamilo/ClassificationBundle/Resources/config/serializer/Entity.Tag.xml
  26. 67
      src/Chamilo/CoreBundle/Admin/AccessUrlAdmin.php
  27. 61
      src/Chamilo/CoreBundle/Admin/AccessUrlRelCourseAdmin.php
  28. 43
      src/Chamilo/CoreBundle/Admin/BranchAdmin.php
  29. 51
      src/Chamilo/CoreBundle/Admin/CareerAdmin.php
  30. 51
      src/Chamilo/CoreBundle/Admin/PromotionAdmin.php
  31. 112
      src/Chamilo/CoreBundle/Admin/SessionAdmin.php
  32. 63
      src/Chamilo/CoreBundle/Admin/SessionCategoryAdmin.php
  33. 62
      src/Chamilo/CoreBundle/Admin/SessionRelCourseAdmin.php
  34. 70
      src/Chamilo/CoreBundle/Admin/SessionRelUserAdmin.php
  35. 63
      src/Chamilo/CoreBundle/Admin/SettingsCurrentAdmin.php
  36. 65
      src/Chamilo/CoreBundle/Admin/ToolAdmin.php
  37. 60
      src/Chamilo/CoreBundle/Admin/ToolResourceRightsAdmin.php
  38. 87
      src/Chamilo/CoreBundle/Admin/UserGroupAdmin.php
  39. 63
      src/Chamilo/CoreBundle/Admin/UsergroupRelUser.php
  40. 27
      src/Chamilo/CoreBundle/ChamiloCoreBundle.php
  41. 40
      src/Chamilo/CoreBundle/DependencyInjection/ChamiloCoreExtension.php
  42. 27
      src/Chamilo/CoreBundle/DependencyInjection/Compiler/DoctrineEntityListenerPass.php
  43. 22
      src/Chamilo/CoreBundle/Entity/Manager/AccessUrlManager.php
  44. 161
      src/Chamilo/CoreBundle/Entity/Manager/SessionManager.php
  45. 143
      src/Chamilo/CoreBundle/Resources/config/admin.yml
  46. 113
      src/Chamilo/CoreBundle/Resources/config/routing.yml
  47. 230
      src/Chamilo/CoreBundle/Resources/config/services.yml
  48. 43
      src/Chamilo/CoreBundle/Twig/Extension/ChamiloExtension.php
  49. 32
      src/Chamilo/MediaBundle/ChamiloMediaBundle.php
  50. 40
      src/Chamilo/MediaBundle/Document/Gallery.php
  51. 40
      src/Chamilo/MediaBundle/Document/Media.php
  52. 40
      src/Chamilo/MediaBundle/Entity/Gallery.php
  53. 40
      src/Chamilo/MediaBundle/Entity/GalleryHasMedia.php
  54. 39
      src/Chamilo/MediaBundle/Entity/Media.php
  55. 40
      src/Chamilo/MediaBundle/PHPCR/Gallery.php
  56. 40
      src/Chamilo/MediaBundle/PHPCR/GalleryHasMedia.php
  57. 27
      src/Chamilo/MediaBundle/PHPCR/GalleryHasMediaRepository.php
  58. 27
      src/Chamilo/MediaBundle/PHPCR/GalleryRepository.php
  59. 40
      src/Chamilo/MediaBundle/PHPCR/Media.php
  60. 27
      src/Chamilo/MediaBundle/PHPCR/MediaRepository.php
  61. 18
      src/Chamilo/MediaBundle/Resources/config/doctrine/Gallery.mongodb.xml
  62. 24
      src/Chamilo/MediaBundle/Resources/config/doctrine/Gallery.orm.xml
  63. 25
      src/Chamilo/MediaBundle/Resources/config/doctrine/Gallery.phpcr.xml
  64. 24
      src/Chamilo/MediaBundle/Resources/config/doctrine/GalleryHasMedia.orm.xml
  65. 28
      src/Chamilo/MediaBundle/Resources/config/doctrine/GalleryHasMedia.phpcr.xml
  66. 18
      src/Chamilo/MediaBundle/Resources/config/doctrine/Media.mongodb.xml
  67. 24
      src/Chamilo/MediaBundle/Resources/config/doctrine/Media.orm.xml
  68. 25
      src/Chamilo/MediaBundle/Resources/config/doctrine/Media.phpcr.xml
  69. 17
      src/Chamilo/MediaBundle/Resources/config/serializer/Document.Gallery.xml
  70. 17
      src/Chamilo/MediaBundle/Resources/config/serializer/Document.GalleryHasMedia.xml
  71. 17
      src/Chamilo/MediaBundle/Resources/config/serializer/Document.Media.xml
  72. 17
      src/Chamilo/MediaBundle/Resources/config/serializer/Entity.Gallery.xml
  73. 17
      src/Chamilo/MediaBundle/Resources/config/serializer/Entity.GalleryHasMedia.xml
  74. 17
      src/Chamilo/MediaBundle/Resources/config/serializer/Entity.Media.xml
  75. 21
      src/Chamilo/PageBundle/ChamiloPageBundle.php
  76. 40
      src/Chamilo/PageBundle/Entity/Block.php
  77. 40
      src/Chamilo/PageBundle/Entity/Page.php
  78. 40
      src/Chamilo/PageBundle/Entity/Site.php
  79. 40
      src/Chamilo/PageBundle/Entity/Snapshot.php
  80. 24
      src/Chamilo/PageBundle/Resources/config/doctrine/Block.orm.xml
  81. 24
      src/Chamilo/PageBundle/Resources/config/doctrine/Page.orm.xml
  82. 24
      src/Chamilo/PageBundle/Resources/config/doctrine/Site.orm.xml
  83. 24
      src/Chamilo/PageBundle/Resources/config/doctrine/Snapshot.orm.xml
  84. 11
      src/Chamilo/PageBundle/Resources/config/serializer/Entity.Block.xml
  85. 11
      src/Chamilo/PageBundle/Resources/config/serializer/Entity.Page.xml
  86. 11
      src/Chamilo/PageBundle/Resources/config/serializer/Entity.Site.xml
  87. 11
      src/Chamilo/PageBundle/Resources/config/serializer/Entity.Snapshot.xml
  88. 21
      src/Chamilo/PageBundle/Resources/views/Block/breadcrumb.html.twig
  89. 20
      src/Chamilo/PageBundle/Resources/views/Security/login.html.twig
  90. 38
      src/Chamilo/PageBundle/Resources/views/demo_2columns_layout.html.twig
  91. 26
      src/Chamilo/PageBundle/Resources/views/demo_layout.html.twig
  92. 24
      src/Chamilo/UserBundle/Admin/GroupAdmin.php
  93. 194
      src/Chamilo/UserBundle/Admin/UserAdmin.php
  94. 67
      src/Chamilo/UserBundle/Admin/UserField.php
  95. 60
      src/Chamilo/UserBundle/Admin/UserFieldValuesAdmin.php
  96. 21
      src/Chamilo/UserBundle/ChamiloUserBundle.php
  97. 26
      src/Chamilo/UserBundle/DependencyInjection/ChamiloUserExtension.php
  98. 24
      src/Chamilo/UserBundle/Repository/GroupRepository.php
  99. 354
      src/Chamilo/UserBundle/Repository/UserRepository.php
  100. 15
      src/Chamilo/UserBundle/Resources/config/admin.yml
  101. Some files were not shown because too many files have changed in this diff Show More

@ -1,13 +1,147 @@
<?php
/* For licensing terms, see /license.txt */
use Symfony\Component\HttpKernel\Kernel;
use Symfony\Component\Config\Loader\LoaderInterface;
/**
* Class AppKernel
*/
class AppKernel
class AppKernel extends Kernel
{
protected $rootDir;
public function registerBundles()
{
$bundles = array(
new Symfony\Bundle\FrameworkBundle\FrameworkBundle(),
new Symfony\Bundle\SecurityBundle\SecurityBundle(),
new Symfony\Bundle\TwigBundle\TwigBundle(),
new Symfony\Bundle\MonologBundle\MonologBundle(),
new Symfony\Bundle\SwiftmailerBundle\SwiftmailerBundle(),
new Symfony\Bundle\AsseticBundle\AsseticBundle(),
new Sensio\Bundle\FrameworkExtraBundle\SensioFrameworkExtraBundle(),
new Doctrine\Bundle\DoctrineBundle\DoctrineBundle(),
new Doctrine\Bundle\MigrationsBundle\DoctrineMigrationsBundle(),
//new Doctrine\Bundle\PHPCRBundle\DoctrinePHPCRBundle(),
new Doctrine\Bundle\DoctrineCacheBundle\DoctrineCacheBundle(),
new FOS\RestBundle\FOSRestBundle(),
new JMS\SerializerBundle\JMSSerializerBundle($this),
// KNP HELPER BUNDLES
new Knp\Bundle\MenuBundle\KnpMenuBundle(),
new Knp\Bundle\MarkdownBundle\KnpMarkdownBundle(),
// Data grid
//new APY\DataGridBundle\APYDataGridBundle(),
// Sonata
new Sonata\EasyExtendsBundle\SonataEasyExtendsBundle(),
new Sonata\CoreBundle\SonataCoreBundle(),
new Sonata\IntlBundle\SonataIntlBundle(),
new Sonata\FormatterBundle\SonataFormatterBundle(),
new Sonata\CacheBundle\SonataCacheBundle(),
new Sonata\BlockBundle\SonataBlockBundle(),
new Sonata\SeoBundle\SonataSeoBundle(),
new Sonata\ClassificationBundle\SonataClassificationBundle(),
new Sonata\NotificationBundle\SonataNotificationBundle(),
new Sonata\DatagridBundle\SonataDatagridBundle(),
new Sonata\MediaBundle\SonataMediaBundle(),
//new Sonata\TranslationBundle\SonataTranslationBundle(),
new Sonata\PageBundle\SonataPageBundle(),
new Spy\TimelineBundle\SpyTimelineBundle(),
new Sonata\TimelineBundle\SonataTimelineBundle(),
//new SimpleThings\EntityAudit\SimpleThingsEntityAuditBundle(),
new Sonata\AdminBundle\SonataAdminBundle(),
new Sonata\DoctrineORMAdminBundle\SonataDoctrineORMAdminBundle(),
// CMF Integration
new Symfony\Cmf\Bundle\RoutingBundle\CmfRoutingBundle(),
//new Symfony\Cmf\Bundle\SearchBundle\CmfSearchBundle(),
//new Symfony\Cmf\Bundle\BlogBundle\CmfBlogBundle(),
//new Sonata\DoctrinePHPCRAdminBundle\SonataDoctrinePHPCRAdminBundle(),
// Oauth
//new HWI\Bundle\OAuthBundle\HWIOAuthBundle(),
//new Gregwar\CaptchaBundle\GregwarCaptchaBundle(),
//new Mopa\Bundle\BootstrapBundle\MopaBootstrapBundle(),
//new Liip\ThemeBundle\LiipThemeBundle(),
new Ivory\CKEditorBundle\IvoryCKEditorBundle(),
new FM\ElfinderBundle\FMElfinderBundle(),
new FOS\JsRoutingBundle\FOSJsRoutingBundle(),
// User
new FOS\UserBundle\FOSUserBundle(),
new Sonata\UserBundle\SonataUserBundle('FOSUserBundle'),
new Chamilo\UserBundle\ChamiloUserBundle(),
/*
// Sylius
/*new Sylius\Bundle\SettingsBundle\SyliusSettingsBundle(),
//new Sylius\Bundle\AttributeBundle\SyliusAttributeBundle(),
new Sylius\Bundle\ResourceBundle\SyliusResourceBundle(),
new Sylius\Bundle\FlowBundle\SyliusFlowBundle(),
new WhiteOctober\PagerfantaBundle\WhiteOctoberPagerfantaBundle(),
new Bazinga\Bundle\HateoasBundle\BazingaHateoasBundle(),*/
// 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(),*/
// Based in Sonata
new Chamilo\ClassificationBundle\ChamiloClassificationBundle(),
new Chamilo\MediaBundle\ChamiloMediaBundle(),
new Chamilo\PageBundle\ChamiloPageBundle(),
/*
// Chamilo course tool
//new Chamilo\NotebookBundle\ChamiloNotebookBundle(),
// Data
//new Oneup\FlysystemBundle\OneupFlysystemBundle(), */
// Extra
new Stof\DoctrineExtensionsBundle\StofDoctrineExtensionsBundle(),
/*
//new JMS\TranslationBundle\JMSTranslationBundle(),
//new JMS\DiExtraBundle\JMSDiExtraBundle($this),
//new JMS\AopBundle\JMSAopBundle(),
/*new Bazinga\Bundle\FakerBundle\BazingaFakerBundle(),
//new Chamilo\CmsBundle\ChamiloCmsBundle(),
new Lunetics\LocaleBundle\LuneticsLocaleBundle(), */
);
if (in_array($this->getEnvironment(), array('dev', 'test'))) {
//$bundles[] = new Jjanvier\Bundle\CrowdinBundle\JjanvierCrowdinBundle();
$bundles[] = new Symfony\Bundle\DebugBundle\DebugBundle();
$bundles[] = new Symfony\Bundle\WebProfilerBundle\WebProfilerBundle();
$bundles[] = new Sensio\Bundle\DistributionBundle\SensioDistributionBundle();
$bundles[] = new Sensio\Bundle\GeneratorBundle\SensioGeneratorBundle();
//$bundles[] = new Sp\BowerBundle\SpBowerBundle();
}
return $bundles;
}
/**
* @param LoaderInterface $loader
*/
public function registerContainerConfiguration(LoaderInterface $loader)
{
$loader->load($this->getRootDir().'/config/config_'.$this->getEnvironment().'.yml');
}
/**
* @return string
*/

@ -0,0 +1,764 @@
<?php
/*
* This file is part of the Symfony package.
*
* (c) Fabien Potencier <fabien@symfony.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
/*
* Users of PHP 5.2 should be able to run the requirements checks.
* This is why the file and all classes must be compatible with PHP 5.2+
* (e.g. not using namespaces and closures).
*
* ************** CAUTION **************
*
* DO NOT EDIT THIS FILE as it will be overridden by Composer as part of
* the installation/update process. The original file resides in the
* SensioDistributionBundle.
*
* ************** CAUTION **************
*/
/**
* Represents a single PHP requirement, e.g. an installed extension.
* It can be a mandatory requirement or an optional recommendation.
* There is a special subclass, named PhpIniRequirement, to check a php.ini configuration.
*
* @author Tobias Schultze <http://tobion.de>
*/
class Requirement
{
private $fulfilled;
private $testMessage;
private $helpText;
private $helpHtml;
private $optional;
/**
* Constructor that initializes the requirement.
*
* @param bool $fulfilled Whether the requirement is fulfilled
* @param string $testMessage The message for testing the requirement
* @param string $helpHtml The help text formatted in HTML for resolving the problem
* @param string|null $helpText The help text (when null, it will be inferred from $helpHtml, i.e. stripped from HTML tags)
* @param bool $optional Whether this is only an optional recommendation not a mandatory requirement
*/
public function __construct($fulfilled, $testMessage, $helpHtml, $helpText = null, $optional = false)
{
$this->fulfilled = (bool) $fulfilled;
$this->testMessage = (string) $testMessage;
$this->helpHtml = (string) $helpHtml;
$this->helpText = null === $helpText ? strip_tags($this->helpHtml) : (string) $helpText;
$this->optional = (bool) $optional;
}
/**
* Returns whether the requirement is fulfilled.
*
* @return bool true if fulfilled, otherwise false
*/
public function isFulfilled()
{
return $this->fulfilled;
}
/**
* Returns the message for testing the requirement.
*
* @return string The test message
*/
public function getTestMessage()
{
return $this->testMessage;
}
/**
* Returns the help text for resolving the problem.
*
* @return string The help text
*/
public function getHelpText()
{
return $this->helpText;
}
/**
* Returns the help text formatted in HTML.
*
* @return string The HTML help
*/
public function getHelpHtml()
{
return $this->helpHtml;
}
/**
* Returns whether this is only an optional recommendation and not a mandatory requirement.
*
* @return bool true if optional, false if mandatory
*/
public function isOptional()
{
return $this->optional;
}
}
/**
* Represents a PHP requirement in form of a php.ini configuration.
*
* @author Tobias Schultze <http://tobion.de>
*/
class PhpIniRequirement extends Requirement
{
/**
* Constructor that initializes the requirement.
*
* @param string $cfgName The configuration name used for ini_get()
* @param bool|callback $evaluation Either a boolean indicating whether the configuration should evaluate to true or false,
* or a callback function receiving the configuration value as parameter to determine the fulfillment of the requirement
* @param bool $approveCfgAbsence If true the Requirement will be fulfilled even if the configuration option does not exist, i.e. ini_get() returns false.
* This is helpful for abandoned configs in later PHP versions or configs of an optional extension, like Suhosin.
* Example: You require a config to be true but PHP later removes this config and defaults it to true internally.
* @param string|null $testMessage The message for testing the requirement (when null and $evaluation is a boolean a default message is derived)
* @param string|null $helpHtml The help text formatted in HTML for resolving the problem (when null and $evaluation is a boolean a default help is derived)
* @param string|null $helpText The help text (when null, it will be inferred from $helpHtml, i.e. stripped from HTML tags)
* @param bool $optional Whether this is only an optional recommendation not a mandatory requirement
*/
public function __construct($cfgName, $evaluation, $approveCfgAbsence = false, $testMessage = null, $helpHtml = null, $helpText = null, $optional = false)
{
$cfgValue = ini_get($cfgName);
if (is_callable($evaluation)) {
if (null === $testMessage || null === $helpHtml) {
throw new InvalidArgumentException('You must provide the parameters testMessage and helpHtml for a callback evaluation.');
}
$fulfilled = call_user_func($evaluation, $cfgValue);
} else {
if (null === $testMessage) {
$testMessage = sprintf('%s %s be %s in php.ini',
$cfgName,
$optional ? 'should' : 'must',
$evaluation ? 'enabled' : 'disabled'
);
}
if (null === $helpHtml) {
$helpHtml = sprintf('Set <strong>%s</strong> to <strong>%s</strong> in php.ini<a href="#phpini">*</a>.',
$cfgName,
$evaluation ? 'on' : 'off'
);
}
$fulfilled = $evaluation == $cfgValue;
}
parent::__construct($fulfilled || ($approveCfgAbsence && false === $cfgValue), $testMessage, $helpHtml, $helpText, $optional);
}
}
/**
* A RequirementCollection represents a set of Requirement instances.
*
* @author Tobias Schultze <http://tobion.de>
*/
class RequirementCollection implements IteratorAggregate
{
private $requirements = array();
/**
* Gets the current RequirementCollection as an Iterator.
*
* @return Traversable A Traversable interface
*/
public function getIterator()
{
return new ArrayIterator($this->requirements);
}
/**
* Adds a Requirement.
*
* @param Requirement $requirement A Requirement instance
*/
public function add(Requirement $requirement)
{
$this->requirements[] = $requirement;
}
/**
* Adds a mandatory requirement.
*
* @param bool $fulfilled Whether the requirement is fulfilled
* @param string $testMessage The message for testing the requirement
* @param string $helpHtml The help text formatted in HTML for resolving the problem
* @param string|null $helpText The help text (when null, it will be inferred from $helpHtml, i.e. stripped from HTML tags)
*/
public function addRequirement($fulfilled, $testMessage, $helpHtml, $helpText = null)
{
$this->add(new Requirement($fulfilled, $testMessage, $helpHtml, $helpText, false));
}
/**
* Adds an optional recommendation.
*
* @param bool $fulfilled Whether the recommendation is fulfilled
* @param string $testMessage The message for testing the recommendation
* @param string $helpHtml The help text formatted in HTML for resolving the problem
* @param string|null $helpText The help text (when null, it will be inferred from $helpHtml, i.e. stripped from HTML tags)
*/
public function addRecommendation($fulfilled, $testMessage, $helpHtml, $helpText = null)
{
$this->add(new Requirement($fulfilled, $testMessage, $helpHtml, $helpText, true));
}
/**
* Adds a mandatory requirement in form of a php.ini configuration.
*
* @param string $cfgName The configuration name used for ini_get()
* @param bool|callback $evaluation Either a boolean indicating whether the configuration should evaluate to true or false,
* or a callback function receiving the configuration value as parameter to determine the fulfillment of the requirement
* @param bool $approveCfgAbsence If true the Requirement will be fulfilled even if the configuration option does not exist, i.e. ini_get() returns false.
* This is helpful for abandoned configs in later PHP versions or configs of an optional extension, like Suhosin.
* Example: You require a config to be true but PHP later removes this config and defaults it to true internally.
* @param string $testMessage The message for testing the requirement (when null and $evaluation is a boolean a default message is derived)
* @param string $helpHtml The help text formatted in HTML for resolving the problem (when null and $evaluation is a boolean a default help is derived)
* @param string|null $helpText The help text (when null, it will be inferred from $helpHtml, i.e. stripped from HTML tags)
*/
public function addPhpIniRequirement($cfgName, $evaluation, $approveCfgAbsence = false, $testMessage = null, $helpHtml = null, $helpText = null)
{
$this->add(new PhpIniRequirement($cfgName, $evaluation, $approveCfgAbsence, $testMessage, $helpHtml, $helpText, false));
}
/**
* Adds an optional recommendation in form of a php.ini configuration.
*
* @param string $cfgName The configuration name used for ini_get()
* @param bool|callback $evaluation Either a boolean indicating whether the configuration should evaluate to true or false,
* or a callback function receiving the configuration value as parameter to determine the fulfillment of the requirement
* @param bool $approveCfgAbsence If true the Requirement will be fulfilled even if the configuration option does not exist, i.e. ini_get() returns false.
* This is helpful for abandoned configs in later PHP versions or configs of an optional extension, like Suhosin.
* Example: You require a config to be true but PHP later removes this config and defaults it to true internally.
* @param string $testMessage The message for testing the requirement (when null and $evaluation is a boolean a default message is derived)
* @param string $helpHtml The help text formatted in HTML for resolving the problem (when null and $evaluation is a boolean a default help is derived)
* @param string|null $helpText The help text (when null, it will be inferred from $helpHtml, i.e. stripped from HTML tags)
*/
public function addPhpIniRecommendation($cfgName, $evaluation, $approveCfgAbsence = false, $testMessage = null, $helpHtml = null, $helpText = null)
{
$this->add(new PhpIniRequirement($cfgName, $evaluation, $approveCfgAbsence, $testMessage, $helpHtml, $helpText, true));
}
/**
* Adds a requirement collection to the current set of requirements.
*
* @param RequirementCollection $collection A RequirementCollection instance
*/
public function addCollection(RequirementCollection $collection)
{
$this->requirements = array_merge($this->requirements, $collection->all());
}
/**
* Returns both requirements and recommendations.
*
* @return array Array of Requirement instances
*/
public function all()
{
return $this->requirements;
}
/**
* Returns all mandatory requirements.
*
* @return array Array of Requirement instances
*/
public function getRequirements()
{
$array = array();
foreach ($this->requirements as $req) {
if (!$req->isOptional()) {
$array[] = $req;
}
}
return $array;
}
/**
* Returns the mandatory requirements that were not met.
*
* @return array Array of Requirement instances
*/
public function getFailedRequirements()
{
$array = array();
foreach ($this->requirements as $req) {
if (!$req->isFulfilled() && !$req->isOptional()) {
$array[] = $req;
}
}
return $array;
}
/**
* Returns all optional recommendations.
*
* @return array Array of Requirement instances
*/
public function getRecommendations()
{
$array = array();
foreach ($this->requirements as $req) {
if ($req->isOptional()) {
$array[] = $req;
}
}
return $array;
}
/**
* Returns the recommendations that were not met.
*
* @return array Array of Requirement instances
*/
public function getFailedRecommendations()
{
$array = array();
foreach ($this->requirements as $req) {
if (!$req->isFulfilled() && $req->isOptional()) {
$array[] = $req;
}
}
return $array;
}
/**
* Returns whether a php.ini configuration is not correct.
*
* @return bool php.ini configuration problem?
*/
public function hasPhpIniConfigIssue()
{
foreach ($this->requirements as $req) {
if (!$req->isFulfilled() && $req instanceof PhpIniRequirement) {
return true;
}
}
return false;
}
/**
* Returns the PHP configuration file (php.ini) path.
*
* @return string|false php.ini file path
*/
public function getPhpIniConfigPath()
{
return get_cfg_var('cfg_file_path');
}
}
/**
* This class specifies all requirements and optional recommendations that
* are necessary to run the Symfony Standard Edition.
*
* @author Tobias Schultze <http://tobion.de>
* @author Fabien Potencier <fabien@symfony.com>
*/
class SymfonyRequirements extends RequirementCollection
{
const REQUIRED_PHP_VERSION = '5.3.3';
/**
* Constructor that initializes the requirements.
*/
public function __construct()
{
/* mandatory requirements follow */
$installedPhpVersion = phpversion();
$this->addRequirement(
version_compare($installedPhpVersion, self::REQUIRED_PHP_VERSION, '>='),
sprintf('PHP version must be at least %s (%s installed)', self::REQUIRED_PHP_VERSION, $installedPhpVersion),
sprintf('You are running PHP version "<strong>%s</strong>", but Symfony needs at least PHP "<strong>%s</strong>" to run.
Before using Symfony, upgrade your PHP installation, preferably to the latest version.',
$installedPhpVersion, self::REQUIRED_PHP_VERSION),
sprintf('Install PHP %s or newer (installed version is %s)', self::REQUIRED_PHP_VERSION, $installedPhpVersion)
);
$this->addRequirement(
version_compare($installedPhpVersion, '5.3.16', '!='),
'PHP version must not be 5.3.16 as Symfony won\'t work properly with it',
'Install PHP 5.3.17 or newer (or downgrade to an earlier PHP version)'
);
$this->addRequirement(
is_dir(__DIR__.'/../vendor/composer'),
'Vendor libraries must be installed',
'Vendor libraries are missing. Install composer following instructions from <a href="http://getcomposer.org/">http://getcomposer.org/</a>. '.
'Then run "<strong>php composer.phar install</strong>" to install them.'
);
$cacheDir = is_dir(__DIR__.'/../var/cache') ? __DIR__.'/../var/cache' : __DIR__.'/cache';
$this->addRequirement(
is_writable($cacheDir),
'app/cache/ or var/cache/ directory must be writable',
'Change the permissions of either "<strong>app/cache/</strong>" or "<strong>var/cache/</strong>" directory so that the web server can write into it.'
);
$logsDir = is_dir(__DIR__.'/../var/logs') ? __DIR__.'/../var/logs' : __DIR__.'/logs';
$this->addRequirement(
is_writable($logsDir),
'app/logs/ or var/logs/ directory must be writable',
'Change the permissions of either "<strong>app/logs/</strong>" or "<strong>var/logs/</strong>" directory so that the web server can write into it.'
);
$this->addPhpIniRequirement(
'date.timezone', true, false,
'date.timezone setting must be set',
'Set the "<strong>date.timezone</strong>" setting in php.ini<a href="#phpini">*</a> (like Europe/Paris).'
);
if (version_compare($installedPhpVersion, self::REQUIRED_PHP_VERSION, '>=')) {
$timezones = array();
foreach (DateTimeZone::listAbbreviations() as $abbreviations) {
foreach ($abbreviations as $abbreviation) {
$timezones[$abbreviation['timezone_id']] = true;
}
}
$this->addRequirement(
isset($timezones[@date_default_timezone_get()]),
sprintf('Configured default timezone "%s" must be supported by your installation of PHP', @date_default_timezone_get()),
'Your default timezone is not supported by PHP. Check for typos in your <strong>php.ini</strong> file and have a look at the list of deprecated timezones at <a href="http://php.net/manual/en/timezones.others.php">http://php.net/manual/en/timezones.others.php</a>.'
);
}
$this->addRequirement(
function_exists('iconv'),
'iconv() must be available',
'Install and enable the <strong>iconv</strong> extension.'
);
$this->addRequirement(
function_exists('json_encode'),
'json_encode() must be available',
'Install and enable the <strong>JSON</strong> extension.'
);
$this->addRequirement(
function_exists('session_start'),
'session_start() must be available',
'Install and enable the <strong>session</strong> extension.'
);
$this->addRequirement(
function_exists('ctype_alpha'),
'ctype_alpha() must be available',
'Install and enable the <strong>ctype</strong> extension.'
);
$this->addRequirement(
function_exists('token_get_all'),
'token_get_all() must be available',
'Install and enable the <strong>Tokenizer</strong> extension.'
);
$this->addRequirement(
function_exists('simplexml_import_dom'),
'simplexml_import_dom() must be available',
'Install and enable the <strong>SimpleXML</strong> extension.'
);
if (function_exists('apc_store') && ini_get('apc.enabled')) {
if (version_compare($installedPhpVersion, '5.4.0', '>=')) {
$this->addRequirement(
version_compare(phpversion('apc'), '3.1.13', '>='),
'APC version must be at least 3.1.13 when using PHP 5.4',
'Upgrade your <strong>APC</strong> extension (3.1.13+).'
);
} else {
$this->addRequirement(
version_compare(phpversion('apc'), '3.0.17', '>='),
'APC version must be at least 3.0.17',
'Upgrade your <strong>APC</strong> extension (3.0.17+).'
);
}
}
$this->addPhpIniRequirement('detect_unicode', false);
if (extension_loaded('suhosin')) {
$this->addPhpIniRequirement(
'suhosin.executor.include.whitelist',
create_function('$cfgValue', 'return false !== stripos($cfgValue, "phar");'),
false,
'suhosin.executor.include.whitelist must be configured correctly in php.ini',
'Add "<strong>phar</strong>" to <strong>suhosin.executor.include.whitelist</strong> in php.ini<a href="#phpini">*</a>.'
);
}
if (extension_loaded('xdebug')) {
$this->addPhpIniRequirement(
'xdebug.show_exception_trace', false, true
);
$this->addPhpIniRequirement(
'xdebug.scream', false, true
);
$this->addPhpIniRecommendation(
'xdebug.max_nesting_level',
create_function('$cfgValue', 'return $cfgValue > 100;'),
true,
'xdebug.max_nesting_level should be above 100 in php.ini',
'Set "<strong>xdebug.max_nesting_level</strong>" to e.g. "<strong>250</strong>" in php.ini<a href="#phpini">*</a> to stop Xdebug\'s infinite recursion protection erroneously throwing a fatal error in your project.'
);
}
$pcreVersion = defined('PCRE_VERSION') ? (float) PCRE_VERSION : null;
$this->addRequirement(
null !== $pcreVersion,
'PCRE extension must be available',
'Install the <strong>PCRE</strong> extension (version 8.0+).'
);
if (extension_loaded('mbstring')) {
$this->addPhpIniRequirement(
'mbstring.func_overload',
create_function('$cfgValue', 'return (int) $cfgValue === 0;'),
true,
'string functions should not be overloaded',
'Set "<strong>mbstring.func_overload</strong>" to <strong>0</strong> in php.ini<a href="#phpini">*</a> to disable function overloading by the mbstring extension.'
);
}
/* optional recommendations follow */
if (file_exists(__DIR__.'/../vendor/composer')) {
require_once __DIR__.'/../vendor/autoload.php';
try {
$r = new ReflectionClass('Sensio\Bundle\DistributionBundle\SensioDistributionBundle');
$contents = file_get_contents(dirname($r->getFileName()).'/Resources/skeleton/app/SymfonyRequirements.php');
} catch (ReflectionException $e) {
$contents = '';
}
$this->addRecommendation(
file_get_contents(__FILE__) === $contents,
'Requirements file should be up-to-date',
'Your requirements file is outdated. Run composer install and re-check your configuration.'
);
}
$this->addRecommendation(
version_compare($installedPhpVersion, '5.3.4', '>='),
'You should use at least PHP 5.3.4 due to PHP bug #52083 in earlier versions',
'Your project might malfunction randomly due to PHP bug #52083 ("Notice: Trying to get property of non-object"). Install PHP 5.3.4 or newer.'
);
$this->addRecommendation(
version_compare($installedPhpVersion, '5.3.8', '>='),
'When using annotations you should have at least PHP 5.3.8 due to PHP bug #55156',
'Install PHP 5.3.8 or newer if your project uses annotations.'
);
$this->addRecommendation(
version_compare($installedPhpVersion, '5.4.0', '!='),
'You should not use PHP 5.4.0 due to the PHP bug #61453',
'Your project might not work properly due to the PHP bug #61453 ("Cannot dump definitions which have method calls"). Install PHP 5.4.1 or newer.'
);
$this->addRecommendation(
version_compare($installedPhpVersion, '5.4.11', '>='),
'When using the logout handler from the Symfony Security Component, you should have at least PHP 5.4.11 due to PHP bug #63379 (as a workaround, you can also set invalidate_session to false in the security logout handler configuration)',
'Install PHP 5.4.11 or newer if your project uses the logout handler from the Symfony Security Component.'
);
$this->addRecommendation(
(version_compare($installedPhpVersion, '5.3.18', '>=') && version_compare($installedPhpVersion, '5.4.0', '<'))
||
version_compare($installedPhpVersion, '5.4.8', '>='),
'You should use PHP 5.3.18+ or PHP 5.4.8+ to always get nice error messages for fatal errors in the development environment due to PHP bug #61767/#60909',
'Install PHP 5.3.18+ or PHP 5.4.8+ if you want nice error messages for all fatal errors in the development environment.'
);
if (null !== $pcreVersion) {
$this->addRecommendation(
$pcreVersion >= 8.0,
sprintf('PCRE extension should be at least version 8.0 (%s installed)', $pcreVersion),
'<strong>PCRE 8.0+</strong> is preconfigured in PHP since 5.3.2 but you are using an outdated version of it. Symfony probably works anyway but it is recommended to upgrade your PCRE extension.'
);
}
$this->addRecommendation(
class_exists('DomDocument'),
'PHP-DOM and PHP-XML modules should be installed',
'Install and enable the <strong>PHP-DOM</strong> and the <strong>PHP-XML</strong> modules.'
);
$this->addRecommendation(
function_exists('mb_strlen'),
'mb_strlen() should be available',
'Install and enable the <strong>mbstring</strong> extension.'
);
$this->addRecommendation(
function_exists('iconv'),
'iconv() should be available',
'Install and enable the <strong>iconv</strong> extension.'
);
$this->addRecommendation(
function_exists('utf8_decode'),
'utf8_decode() should be available',
'Install and enable the <strong>XML</strong> extension.'
);
$this->addRecommendation(
function_exists('filter_var'),
'filter_var() should be available',
'Install and enable the <strong>filter</strong> extension.'
);
if (!defined('PHP_WINDOWS_VERSION_BUILD')) {
$this->addRecommendation(
function_exists('posix_isatty'),
'posix_isatty() should be available',
'Install and enable the <strong>php_posix</strong> extension (used to colorize the CLI output).'
);
}
$this->addRecommendation(
extension_loaded('intl'),
'intl extension should be available',
'Install and enable the <strong>intl</strong> extension (used for validators).'
);
if (extension_loaded('intl')) {
// in some WAMP server installations, new Collator() returns null
$this->addRecommendation(
null !== new Collator('fr_FR'),
'intl extension should be correctly configured',
'The intl extension does not behave properly. This problem is typical on PHP 5.3.X x64 WIN builds.'
);
// check for compatible ICU versions (only done when you have the intl extension)
if (defined('INTL_ICU_VERSION')) {
$version = INTL_ICU_VERSION;
} else {
$reflector = new ReflectionExtension('intl');
ob_start();
$reflector->info();
$output = strip_tags(ob_get_clean());
preg_match('/^ICU version +(?:=> )?(.*)$/m', $output, $matches);
$version = $matches[1];
}
$this->addRecommendation(
version_compare($version, '4.0', '>='),
'intl ICU version should be at least 4+',
'Upgrade your <strong>intl</strong> extension with a newer ICU version (4+).'
);
$this->addPhpIniRecommendation(
'intl.error_level',
create_function('$cfgValue', 'return (int) $cfgValue === 0;'),
true,
'intl.error_level should be 0 in php.ini',
'Set "<strong>intl.error_level</strong>" to "<strong>0</strong>" in php.ini<a href="#phpini">*</a> to inhibit the messages when an error occurs in ICU functions.'
);
}
$accelerator =
(extension_loaded('eaccelerator') && ini_get('eaccelerator.enable'))
||
(extension_loaded('apc') && ini_get('apc.enabled'))
||
(extension_loaded('Zend Optimizer+') && ini_get('zend_optimizerplus.enable'))
||
(extension_loaded('Zend OPcache') && ini_get('opcache.enable'))
||
(extension_loaded('xcache') && ini_get('xcache.cacher'))
||
(extension_loaded('wincache') && ini_get('wincache.ocenabled'))
;
$this->addRecommendation(
$accelerator,
'a PHP accelerator should be installed',
'Install and/or enable a <strong>PHP accelerator</strong> (highly recommended).'
);
if (strtoupper(substr(PHP_OS, 0, 3)) === 'WIN') {
$this->addRecommendation(
$this->getRealpathCacheSize() > 1000,
'realpath_cache_size should be above 1024 in php.ini',
'Set "<strong>realpath_cache_size</strong>" to e.g. "<strong>1024</strong>" in php.ini<a href="#phpini">*</a> to improve performance on windows.'
);
}
$this->addPhpIniRecommendation('short_open_tag', false);
$this->addPhpIniRecommendation('magic_quotes_gpc', false, true);
$this->addPhpIniRecommendation('register_globals', false, true);
$this->addPhpIniRecommendation('session.auto_start', false);
$this->addRecommendation(
class_exists('PDO'),
'PDO should be installed',
'Install <strong>PDO</strong> (mandatory for Doctrine).'
);
if (class_exists('PDO')) {
$drivers = PDO::getAvailableDrivers();
$this->addRecommendation(
count($drivers) > 0,
sprintf('PDO should have some drivers installed (currently available: %s)', count($drivers) ? implode(', ', $drivers) : 'none'),
'Install <strong>PDO drivers</strong> (mandatory for Doctrine).'
);
}
}
/**
* Loads realpath_cache_size from php.ini and converts it to int.
*
* (e.g. 16k is converted to 16384 int)
*
* @return int
*/
protected function getRealpathCacheSize()
{
$size = ini_get('realpath_cache_size');
$size = trim($size);
$unit = strtolower(substr($size, -1, 1));
switch ($unit) {
case 'g':
return $size * 1024 * 1024 * 1024;
case 'm':
return $size * 1024 * 1024;
case 'k':
return $size * 1024;
default:
return (int) $size;
}
}
}

@ -0,0 +1,13 @@
<?php
use Doctrine\Common\Annotations\AnnotationRegistry;
use Composer\Autoload\ClassLoader;
/**
* @var ClassLoader $loader
*/
$loader = require __DIR__.'/../vendor/autoload.php';
AnnotationRegistry::registerLoader(array($loader, 'loadClass'));
return $loader;

File diff suppressed because it is too large Load Diff

@ -0,0 +1,142 @@
<?php
require_once dirname(__FILE__).'/SymfonyRequirements.php';
$lineSize = 70;
$symfonyRequirements = new SymfonyRequirements();
$iniPath = $symfonyRequirements->getPhpIniConfigPath();
echo_title('Symfony Requirements Checker');
echo '> PHP is using the following php.ini file:'.PHP_EOL;
if ($iniPath) {
echo_style('green', ' '.$iniPath);
} else {
echo_style('warning', ' WARNING: No configuration file (php.ini) used by PHP!');
}
echo PHP_EOL.PHP_EOL;
echo '> Checking Symfony requirements:'.PHP_EOL.' ';
$messages = array();
foreach ($symfonyRequirements->getRequirements() as $req) {
/** @var $req Requirement */
if ($helpText = get_error_message($req, $lineSize)) {
echo_style('red', 'E');
$messages['error'][] = $helpText;
} else {
echo_style('green', '.');
}
}
$checkPassed = empty($messages['error']);
foreach ($symfonyRequirements->getRecommendations() as $req) {
if ($helpText = get_error_message($req, $lineSize)) {
echo_style('yellow', 'W');
$messages['warning'][] = $helpText;
} else {
echo_style('green', '.');
}
}
if ($checkPassed) {
echo_block('success', 'OK', 'Your system is ready to run Symfony projects');
} else {
echo_block('error', 'ERROR', 'Your system is not ready to run Symfony projects');
echo_title('Fix the following mandatory requirements', 'red');
foreach ($messages['error'] as $helpText) {
echo ' * '.$helpText.PHP_EOL;
}
}
if (!empty($messages['warning'])) {
echo_title('Optional recommendations to improve your setup', 'yellow');
foreach ($messages['warning'] as $helpText) {
echo ' * '.$helpText.PHP_EOL;
}
}
echo PHP_EOL;
echo_style('title', 'Note');
echo ' The command console could use a different php.ini file'.PHP_EOL;
echo_style('title', '~~~~');
echo ' than the one used with your web server. To be on the'.PHP_EOL;
echo ' safe side, please check the requirements from your web'.PHP_EOL;
echo ' server using the ';
echo_style('yellow', 'web/config.php');
echo ' script.'.PHP_EOL;
echo PHP_EOL;
exit($checkPassed ? 0 : 1);
function get_error_message(Requirement $requirement, $lineSize)
{
if ($requirement->isFulfilled()) {
return;
}
$errorMessage = wordwrap($requirement->getTestMessage(), $lineSize - 3, PHP_EOL.' ').PHP_EOL;
$errorMessage .= ' > '.wordwrap($requirement->getHelpText(), $lineSize - 5, PHP_EOL.' > ').PHP_EOL;
return $errorMessage;
}
function echo_title($title, $style = null)
{
$style = $style ?: 'title';
echo PHP_EOL;
echo_style($style, $title.PHP_EOL);
echo_style($style, str_repeat('~', strlen($title)).PHP_EOL);
echo PHP_EOL;
}
function echo_style($style, $message)
{
// ANSI color codes
$styles = array(
'reset' => "\033[0m",
'red' => "\033[31m",
'green' => "\033[32m",
'yellow' => "\033[33m",
'error' => "\033[37;41m",
'success' => "\033[37;42m",
'title' => "\033[34m",
);
$supports = has_color_support();
echo($supports ? $styles[$style] : '').$message.($supports ? $styles['reset'] : '');
}
function echo_block($style, $title, $message)
{
$message = ' '.trim($message).' ';
$width = strlen($message);
echo PHP_EOL.PHP_EOL;
echo_style($style, str_repeat(' ', $width).PHP_EOL);
echo_style($style, str_pad(' ['.$title.']', $width, ' ', STR_PAD_RIGHT).PHP_EOL);
echo_style($style, str_pad($message, $width, ' ', STR_PAD_RIGHT).PHP_EOL);
echo_style($style, str_repeat(' ', $width).PHP_EOL);
}
function has_color_support()
{
static $support;
if (null === $support) {
if (DIRECTORY_SEPARATOR == '\\') {
$support = false !== getenv('ANSICON') || 'ON' === getenv('ConEmuANSI');
} else {
$support = function_exists('posix_isatty') && @posix_isatty(STDOUT);
}
}
return $support;
}

@ -0,0 +1,27 @@
#!/usr/bin/env php
<?php
// if you don't want to setup permissions the proper way, just uncomment the following PHP line
// read http://symfony.com/doc/current/book/installation.html#configuration-and-setup for more information
//umask(0000);
set_time_limit(0);
require_once __DIR__.'/bootstrap.php.cache';
require_once __DIR__.'/AppKernel.php';
use Symfony\Bundle\FrameworkBundle\Console\Application;
use Symfony\Component\Console\Input\ArgvInput;
use Symfony\Component\Debug\Debug;
$input = new ArgvInput();
$env = $input->getParameterOption(array('--env', '-e'), getenv('SYMFONY_ENV') ?: 'dev');
$debug = getenv('SYMFONY_DEBUG') !== '0' && !$input->hasParameterOption(array('--no-debug', '')) && $env !== 'prod';
if ($debug) {
Debug::enable();
}
$kernel = new AppKernel($env, $debug);
$application = new Application($kernel);
$application->run($input);

@ -0,0 +1,21 @@
<?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';
}
}

@ -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 integer $id
*/
protected $id;
/**
* Get id
*
* @return integer $id
*/
public function getId()
{
return $this->id;
}
}

@ -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 integer $id
*/
protected $id;
/**
* Get id
*
* @return integer $id
*/
public function getId()
{
return $this->id;
}
}

@ -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 integer $id
*/
protected $id;
/**
* Get id
*
* @return integer $id
*/
public function getId()
{
return $this->id;
}
}

@ -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 integer $id
*/
protected $id;
/**
* Get id
*
* @return integer $id
*/
public function getId()
{
return $this->id;
}
}

@ -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.
*
* @link 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 $id
*/
protected $id;
/**
* Get id
*
* @return int $id
*/
public function getId()
{
return $this->id;
}
}

@ -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 integer $id
*/
protected $id;
/**
* Get id
*
* @return integer $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>

@ -0,0 +1,67 @@
<?php
/* For licensing terms, see /license.txt */
namespace Chamilo\CoreBundle\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 AccessUrlAdmin
* @package Chamilo\CoreBundle\Admin
*/
class AccessUrlAdmin extends Admin
{
/**
* @param FormMapper $formMapper
*/
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')
;
}
/**
* @param DatagridMapper $datagridMapper
*/
protected function configureDatagridFilters(DatagridMapper $datagridMapper)
{
$datagridMapper
->add('url')
;
}
/**
* @param ListMapper $listMapper
*/
protected function configureListFields(ListMapper $listMapper)
{
$listMapper
->addIdentifier('url')
;
}
/**
* @param $course
* @return mixed|void
*/
public function preUpdate($course)
{
//$course->setUsers($course->getUsers());
}
}

@ -0,0 +1,61 @@
<?php
/* For licensing terms, see /license.txt */
namespace Chamilo\CoreBundle\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 CourseAdmin
* @package Chamilo\CoreBundle\Admin
*/
class AccessUrlRelCourseAdmin 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('url')
->end()
;
}
/**
* @param DatagridMapper $datagridMapper
*/
protected function configureDatagridFilters(DatagridMapper $datagridMapper)
{
$datagridMapper
->add('url')
;
}
/**
* @param ListMapper $listMapper
*/
protected function configureListFields(ListMapper $listMapper)
{
$listMapper
->addIdentifier('url')
;
}
}

@ -0,0 +1,43 @@
<?php
/* For licensing terms, see /license.txt */
namespace Chamilo\CoreBundle\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 BranchAdmin
* @package Chamilo\CoreBundle\Admin
*/
class BranchAdmin extends Admin
{
// 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')
;
}
}

@ -0,0 +1,51 @@
<?php
/* For licensing terms, see /license.txt */
namespace Chamilo\CoreBundle\Admin;
use Chamilo\CoreBundle\Entity\Career;
use Sonata\AdminBundle\Admin\Admin;
use Sonata\AdminBundle\Form\FormMapper;
use Sonata\AdminBundle\Datagrid\DatagridMapper;
use Sonata\AdminBundle\Datagrid\ListMapper;
/**
* Class CareerAdmin
* @package Chamilo\CoreBundle\Admin
*/
class CareerAdmin extends Admin
{
/**
* @param FormMapper $formMapper
*/
protected function configureFormFields(FormMapper $formMapper)
{
$formMapper
->add('name')
->add('description', 'ckeditor')
->add('status', 'choice', array('choices' => Career::getStatusList()))
;
}
/**
* @param DatagridMapper $datagridMapper
*/
protected function configureDatagridFilters(DatagridMapper $datagridMapper)
{
$datagridMapper
->add('name')
;
}
/**
* @param ListMapper $listMapper
*/
protected function configureListFields(ListMapper $listMapper)
{
$listMapper
->addIdentifier('id')
->addIdentifier('name')
;
}
}

@ -0,0 +1,51 @@
<?php
/* For licensing terms, see /license.txt */
namespace Chamilo\CoreBundle\Admin;
use Chamilo\CoreBundle\Entity\Promotion;
use Sonata\AdminBundle\Admin\Admin;
use Sonata\AdminBundle\Form\FormMapper;
use Sonata\AdminBundle\Datagrid\DatagridMapper;
use Sonata\AdminBundle\Datagrid\ListMapper;
/**
* Class PromotionAdmin
* @package Chamilo\CoreBundle\Admin
*/
class PromotionAdmin extends Admin
{
/**
* @param FormMapper $formMapper
*/
protected function configureFormFields(FormMapper $formMapper)
{
$formMapper
->add('name')
->add('description', 'ckeditor')
->add('status', 'choice', array('choices' => Promotion::getStatusList()))
->add('career')
;
}
/**
* @param DatagridMapper $datagridMapper
*/
protected function configureDatagridFilters(DatagridMapper $datagridMapper)
{
$datagridMapper
->add('name')
;
}
/**
* @param ListMapper $listMapper
*/
protected function configureListFields(ListMapper $listMapper)
{
$listMapper
->addIdentifier('id')
->addIdentifier('name')
;
}
}

@ -0,0 +1,112 @@
<?php
/* For licensing terms, see /license.txt */
namespace Chamilo\CoreBundle\Admin;
use Chamilo\CoreBundle\Entity\Session;
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 SessionAdmin
* @package Chamilo\CoreBundle\Admin
*/
class SessionAdmin extends Admin
{
/**
* @param FormMapper $formMapper
*/
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',
array('choices' => Session::getStatusList())
)
->add('courses', 'sonata_type_collection', array(
'cascade_validation' => true,
), array(
'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'
)
)*/
;
}
/**
* @param ShowMapper $showMapper
*/
protected function configureShowField(ShowMapper $showMapper)
{
$showMapper
->add('id', 'text', array('label' => 'Session'))
->add('name')
->add('display_start_date', 'sonata_type_date_picker')
;
}
/**
* @param DatagridMapper $datagridMapper
*/
protected function configureDatagridFilters(DatagridMapper $datagridMapper)
{
$datagridMapper
->add('name')
->add(
'visibility',
null,
array(),
'choice',
array('choices' => Session::getStatusList())
)
//->add('display_start_date', 'sonata_type_date_picker')
;
}
/**
* @param ListMapper $listMapper
*/
protected function configureListFields(ListMapper $listMapper)
{
$listMapper
->addIdentifier('name')
->add('generalCoach')
->add('visibility', 'choice', array(
'choices' => Session::getStatusList()
))
;
}
/**
* Very important in order to save the related entities!
* @param \Chamilo\CoreBundle\Entity\Session $session
* @return mixed|void
*/
public function preUpdate($session)
{
$session->setCourses($session->getCourses());
}
}

@ -0,0 +1,63 @@
<?php
/* For licensing terms, see /license.txt */
namespace Chamilo\CoreBundle\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 CourseRequestAdmin
* @package Chamilo\CoreBundle\Admin
*/
class SessionCategoryAdmin extends Admin
{
/**
* @param FormMapper $formMapper
*/
protected function configureFormFields(FormMapper $formMapper)
{
$formMapper
->add('name')
->add('url')
->add('dateStart', 'sonata_type_datetime_picker')
->add('dateEnd', 'sonata_type_datetime_picker')
;
}
/**
* @param ShowMapper $showMapper
*/
protected function configureShowField(ShowMapper $showMapper)
{
$showMapper
->add('id')
->add('name')
;
}
/**
* @param DatagridMapper $datagridMapper
*/
protected function configureDatagridFilters(DatagridMapper $datagridMapper)
{
$datagridMapper
->add('name')
;
}
/**
* @param ListMapper $listMapper
*/
protected function configureListFields(ListMapper $listMapper)
{
$listMapper
->addIdentifier('name')
;
}
}

@ -0,0 +1,62 @@
<?php
namespace Chamilo\CoreBundle\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;
use Knp\Menu\ItemInterface as MenuItemInterface;
/**
* Class SessionRelCourseAdmin
* @package Chamilo\CoreBundle\Admin
*/
class SessionRelCourseAdmin extends Admin
{
/**
* @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')
;
}
}

@ -0,0 +1,70 @@
<?php
/* For licensing terms, see /license.txt */
namespace Chamilo\CoreBundle\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 SessionAdmin
* @package Chamilo\CoreBundle\Admin
*/
class SessionRelUserAdmin extends Admin
{
/**
* @param FormMapper $formMapper
*/
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'
))*/
}
/**
* @param ShowMapper $showMapper
*/
protected function configureShowField(ShowMapper $showMapper)
{
$showMapper
->add('session')
->add('user')
;
}
/**
* @param DatagridMapper $datagridMapper
*/
protected function configureDatagridFilters(DatagridMapper $datagridMapper)
{
$datagridMapper
->add('session')
->add('user')
//->add('display_start_date', 'sonata_type_date_picker')
;
}
/**
* @param ListMapper $listMapper
*/
protected function configureListFields(ListMapper $listMapper)
{
$listMapper
->addIdentifier('session')
->addIdentifier('user')
;
}
}

@ -0,0 +1,63 @@
<?php
/* For licensing terms, see /license.txt */
namespace Chamilo\CoreBundle\Admin;
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 Knp\Menu\ItemInterface as MenuItemInterface;
/**
* Class SettingsCurrentAdmin
* @package Chamilo\CoreBundle\Admin
*/
class SettingsCurrentAdmin extends Admin
{
/**
* @param FormMapper $formMapper
*/
protected function configureFormFields(FormMapper $formMapper)
{
$formMapper
->add('title')
->add('variable')
->add('subkey')
->add('type')
->add('category')
->add('selectedValue')
->add('comment', 'ckeditor')
->add('accessUrl')
;
}
/**
* @param DatagridMapper $datagridMapper
*/
protected function configureDatagridFilters(DatagridMapper $datagridMapper)
{
$datagridMapper
->add('title')
->add('variable')
->add('category')
->add('accessUrl')
;
}
/**
* @param ListMapper $listMapper
*/
protected function configureListFields(ListMapper $listMapper)
{
$listMapper
->addIdentifier('variable')
->add('selected_value')
->add('category')
;
}
}

@ -0,0 +1,65 @@
<?php
/* For licensing terms, see /license.txt */
namespace Chamilo\CoreBundle\Admin;
use Sonata\AdminBundle\Admin\Admin;
use Sonata\AdminBundle\Form\FormMapper;
use Sonata\AdminBundle\Datagrid\DatagridMapper;
use Sonata\AdminBundle\Datagrid\ListMapper;
/**
* Class ToolAdmin
* @package Chamilo\CoreBundle\Admin
*/
class ToolAdmin extends Admin
{
/**
* @inheritdoc
*/
protected function configureFormFields(FormMapper $formMapper)
{
$formMapper
->add('name')
->add('description', 'ckeditor')
->add('toolResourceRights', '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.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')
;
}
}

@ -0,0 +1,60 @@
<?php
/* For licensing terms, see /license.txt */
namespace Chamilo\CoreBundle\Admin;
use Chamilo\CoreBundle\Entity\ToolResourceRights;
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 ToolResourceRightsAdmin
* @package Chamilo\CoreBundle\Admin
*/
class ToolResourceRightsAdmin extends Admin
{
/**
* @inheritdoc
*/
protected function configureFormFields(FormMapper $formMapper)
{
$formMapper
->add('tool')
->add(
'role',
'choice',
array('choices' => ToolResourceRights::getDefaultRoles())
)
->add(
'mask',
'choice',
array('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')
;
}
}

@ -0,0 +1,87 @@
<?php
/* For licensing terms, see /license.txt */
namespace Chamilo\CoreBundle\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 UserGroupAdmin
* @package Chamilo\CoreBundle\Admin
*/
class UserGroupAdmin extends Admin
{
/**
* @param FormMapper $formMapper
*/
protected function configureFormFields(FormMapper $formMapper)
{
$formMapper
->add('name')
->add('description', 'ckeditor')
->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.user_group_rel_user'
)
)
;
}
/**
* Very important in order to save the related entities!
* @param \Chamilo\CoreBundle\Entity\Course $userGroup
* @return mixed|void
*/
public function preUpdate($userGroup)
{
//$userGroup->setUsers($userGroup->getUsers());
}
/**
* @param ShowMapper $showMapper
*/
protected function configureShowField(ShowMapper $showMapper)
{
$showMapper
->add('id', 'text', array('label' => 'Usergroup'))
->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('id')
->addIdentifier('name')
;
}
}

@ -0,0 +1,63 @@
<?php
/* For licensing terms, see /license.txt */
namespace Chamilo\CoreBundle\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 UsergroupRelUser
* @package Chamilo\CoreBundle\Admin
*/
class UsergroupRelUser extends Admin
{
/**
* @param FormMapper $formMapper
*/
protected function configureFormFields(FormMapper $formMapper)
{
$formMapper
->add('user')
->add('usergroup')
;
}
/**
* @param ShowMapper $showMapper
*/
protected function configureShowField(ShowMapper $showMapper)
{
$showMapper
->add('user')
->add('usergroup')
;
}
/**
* @param DatagridMapper $datagridMapper
*/
protected function configureDatagridFilters(DatagridMapper $datagridMapper)
{
$datagridMapper
->add('user')
->add('usergroup')
;
}
/**
* @param ListMapper $listMapper
*/
protected function configureListFields(ListMapper $listMapper)
{
$listMapper
->addIdentifier('user')
->addIdentifier('usergroup')
;
}
}

@ -0,0 +1,27 @@
<?php
/* For licensing terms, see /license.txt */
namespace Chamilo\CoreBundle;
use Chamilo\CoreBundle\DependencyInjection\Compiler\DoctrineEntityListenerPass;
use Symfony\Component\HttpKernel\Bundle\Bundle;
use Symfony\Component\DependencyInjection\ContainerBuilder;
/**
* 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());
}
}

@ -0,0 +1,40 @@
<?php
/* For licensing terms, see /license.txt */
namespace Chamilo\CoreBundle\DependencyInjection;
use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\HttpKernel\DependencyInjection\Extension;
use Symfony\Component\Config\FileLocator;
use Symfony\Component\DependencyInjection\Loader;
/**
* Class ChamiloCoreExtension
* @package Chamilo\CoreBundle\DependencyInjection
*/
class ChamiloCoreExtension extends Extension
{
/**
* @param array $configs
* @param ContainerBuilder $container
*/
public function load(array $configs, ContainerBuilder $container)
{
$loader = new Loader\YamlFileLoader(
$container,
new FileLocator(__DIR__ . '/../Resources/config')
);
$loader->load('services.yml');
$loader->load('admin.yml');
}
/**
* @return string
*/
public function getAlias()
{
return 'chamilo_core';
}
}

@ -0,0 +1,27 @@
<?php
/* For licensing terms, see /license.txt */
namespace Chamilo\CoreBundle\DependencyInjection\Compiler;
use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface;
use Symfony\Component\DependencyInjection\ContainerBuilder;
/**
* Class DoctrineEntityListenerPass
* @package Chamilo\CoreBundle\DependencyInjection\Compiler
*/
class DoctrineEntityListenerPass implements CompilerPassInterface
{
public function process(ContainerBuilder $container)
{
$definition = $container->getDefinition('chamilo.doctrine.entity_listener_resolver');
$services = $container->findTaggedServiceIds('doctrine.entity_listener');
foreach ($services as $service => $attributes) {
$definition->addMethodCall(
'addMapping',
array($container->getDefinition($service)->getClass(), $service)
);
}
}
}

@ -0,0 +1,22 @@
<?php
/* For licensing terms, see /license.txt */
namespace Chamilo\CoreBundle\Entity\Manager;
use Sonata\CoreBundle\Model\BaseEntityManager;
use Chamilo\CoreBundle\Entity\Course;
/**
* Class AccessUrlManager
* @package Chamilo\CoreBundle\Entity\Manager
*/
class AccessUrlManager extends BaseEntityManager
{
/**
* @return Course
*/
public function createUrl()
{
return $this->create();
}
}

@ -0,0 +1,161 @@
<?php
/* For licensing terms, see /license.txt */
namespace Chamilo\CoreBundle\Entity\Manager;
use Chamilo\CoreBundle\Entity\Repository\CourseRepository;
use Chamilo\CoreBundle\Entity\Session;
use Chamilo\CoreBundle\Entity\SessionRelUser;
use Sonata\CoreBundle\Model\BaseEntityManager;
use Chamilo\CoreBundle\Entity\Course;
use Chamilo\UserBundle\Entity\User;
use Sonata\DatagridBundle\Pager\Doctrine\pager;
use Sonata\DatagridBundle\ProxyQuery\Doctrine\ProxyQuery;
use Doctrine\Common\Collections\Criteria;
/**
* Class SessionManager
* @package Chamilo\CoreBundle\Entity\Manager
*/
class SessionManager extends BaseEntityManager
{
/**
* @return Session
*/
public function createSession()
{
return $this->create();
}
/**
* @param $name
* @return Session
*/
public function findOneByName($name)
{
return $this->getRepository()->findOneByName($name);
}
/**
* @param User $user
* @param Session $session
*/
public function addDrh(User $user, Session $session)
{
$session->addUserInSession(Session::COACH, $user);
}
/**
* @param User $user
* @param Session $session
* @return bool
*/
public function hasDrh(User $user, Session $session)
{
$subscription = new SessionRelUser();
$subscription->setUser($user);
$subscription->setSession($session);
$subscription->setRelationType(Session::DRH);
return $session->hasUser($subscription);
}
/**
* @param User $user
* @param Course $course
* @param Session $session
*/
public function addStudentInCourse(
User $user,
Course $course,
Session $session
) {
$this->addUserInCourse(Session::STUDENT, $user, $course, $session);
}
/**
* @param User $user
* @param Course $course
* @param Session $session
* @return bool
*/
public function hasStudentInCourse(
User $user,
Course $course,
Session $session
) {
return $session->hasUserInCourse($user, $course, Session::STUDENT);
}
/**
* @param User $user
* @param Course $course
* @param Session $session
*/
public function addCoachInCourse(
User $user,
Course $course,
Session $session
) {
$this->addUserInCourse(Session::COACH, $user, $course, $session);
}
/**
* @param User $user
* @param Course $course
* @param Session $session
* @return bool
*/
public function hasCoachInCourse(
User $user,
Course $course,
Session $session
) {
return $session->hasUserInCourse($user, $course, Session::COACH);
}
/**
* @param $status
* @param User $user
* @param Course $course
* @param Session $session
*/
private function addUserInCourse(
$status,
User $user,
Course $course,
Session $session
) {
if ($session->isActive() &&
$user->getIsActive() &&
$course->isActive()
) {
if ($session->hasCourse($course)) {
switch ($status) {
case Session::DRH:
if ($user->hasRole('ROLE_RRHH')) {
$session->addUserInSession(Session::DRH, $user);
}
break;
case Session::STUDENT:
$session->addUserInSession(Session::STUDENT, $user);
$session->addUserInCourse(
Session::STUDENT,
$user,
$course
);
break;
case Session::COACH:
if ($user->hasRole('ROLE_TEACHER')) {
$session->addUserInCourse(
Session::COACH,
$user,
$course
);
}
break;
}
}
}
}
}

@ -0,0 +1,143 @@
services:
sonata.admin.session:
class: Chamilo\CoreBundle\Admin\SessionAdmin
tags:
- { name: sonata.admin, manager_type: orm, audit: true, group: "LMS", label: "Session" }
arguments:
- ~
- Chamilo\CoreBundle\Entity\Session
- ~
calls:
- [ setTranslationDomain, [ChamiloCoreBundle]]
sonata.admin.session_category:
class: Chamilo\CoreBundle\Admin\SessionCategoryAdmin
tags:
- { name: sonata.admin, manager_type: orm, group: "LMS", label: "Session category" }
arguments:
- ~
- Chamilo\CoreBundle\Entity\SessionCategory
- ~
calls:
- [ setTranslationDomain, [ChamiloCoreBundle]]
sonata.admin.career:
class: Chamilo\CoreBundle\Admin\CareerAdmin
tags:
- { name: sonata.admin, manager_type: orm, group: "LMS", label: "Career" }
arguments:
- ~
- Chamilo\CoreBundle\Entity\Career
- ~
calls:
- [ setTranslationDomain, [ChamiloCoreBundle]]
sonata.admin.promotion:
class: Chamilo\CoreBundle\Admin\PromotionAdmin
tags:
- { name: sonata.admin, manager_type: orm, group: "LMS", label: "Promotion" }
arguments:
- ~
- Chamilo\CoreBundle\Entity\Promotion
- ~
calls:
- [ setTranslationDomain, [ChamiloCoreBundle]]
sonata.admin.session_rel_course:
class: Chamilo\CoreBundle\Admin\SessionRelCourseAdmin
tags:
- { name: sonata.admin, manager_type: orm, group: "LMS", label: "SessionRelCourseAdmin" }
arguments:
- ~
- Chamilo\CoreBundle\Entity\SessionRelCourse
- ~
calls:
- [ setTranslationDomain, [ChamiloCoreBundle]]
sonata.admin.session_rel_user:
class: Chamilo\CoreBundle\Admin\SessionRelUserAdmin
tags:
- { name: sonata.admin, manager_type: orm, group: "LMS", label: "SessionRelUserAdmin" }
arguments:
- ~
- Chamilo\CoreBundle\Entity\SessionRelUser
- ~
calls:
- [ setTranslationDomain, [ChamiloCoreBundle]]
sonata.admin.access_url:
class: Chamilo\CoreBundle\Admin\AccessUrlAdmin
tags:
- { name: sonata.admin, manager_type: orm, group: "LMS", label: "AccessUrlAdmin" }
arguments:
- ~
- Chamilo\CoreBundle\Entity\AccessUrl
- ~
calls:
- [ setTranslationDomain, [ChamiloCoreBundle]]
sonata.admin.access_url_rel_course:
class: Chamilo\CoreBundle\Admin\AccessUrlRelCourseAdmin
tags:
- { name: sonata.admin, manager_type: orm, group: "LMS", label: "AccessUrlRelCourseAdmin" }
arguments:
- ~
- Chamilo\CoreBundle\Entity\AccessUrlRelCourse
- ~
calls:
- [ setTranslationDomain, [ChamiloCoreBundle]]
sonata.admin.settings_current:
class: Chamilo\CoreBundle\Admin\SettingsCurrentAdmin
tags:
- { name: sonata.admin, manager_type: orm, group: "LMS", label: "Settings" }
arguments:
- ~
- Chamilo\CoreBundle\Entity\SettingsCurrent
- ~
calls:
- [ setTranslationDomain, [ChamiloCoreBundle]]
sonata.admin.user_group:
class: Chamilo\CoreBundle\Admin\UserGroupAdmin
tags:
- { name: sonata.admin, manager_type: orm, group: "LMS", label: "UserGroupAdmin" }
arguments:
- ~
- Chamilo\CoreBundle\Entity\UserGroup
- ~
calls:
- [ setTranslationDomain, [ChamiloCoreBundle]]
sonata.admin.user_group_rel_user:
class: Chamilo\CoreBundle\Admin\UsergroupRelUser
tags:
- { name: sonata.admin, manager_type: orm, group: "LMS", label: "UsergroupRelUser" }
arguments:
- ~
- Chamilo\CoreBundle\Entity\UsergroupRelUser
- ~
calls:
- [ setTranslationDomain, [ChamiloCoreBundle]]
sonata.admin.tool:
class: Chamilo\CoreBundle\Admin\ToolAdmin
tags:
- { name: sonata.admin, manager_type: orm, group: "LMS", label: "Tool" }
arguments:
- ~
- Chamilo\CoreBundle\Entity\Tool
- ~
calls:
- [ setTranslationDomain, [ChamiloCoreBundle]]
sonata.admin.tool_resource_rights:
class: Chamilo\CoreBundle\Admin\ToolResourceRightsAdmin
tags:
- { name: sonata.admin, manager_type: orm, group: "LMS", label: "ToolResourceRights" }
arguments:
- ~
- Chamilo\CoreBundle\Entity\ToolResourceRights
- ~
calls:
- [ setTranslationDomain, [ChamiloCoreBundle]]

@ -0,0 +1,113 @@
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: .+
# web url shortcuts for legacy templates
web.ajax:
path: main/inc/ajax/
web.main:
path: main/
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}
#chamilo_course_tool_intro_create:
# path: /courses/{course}/introduction/{tool}/create/
# methods: [GET, POST]
# defaults:
# _controller: ChamiloCourseBundle:Introduction/Introduction:create
# _sylius:
# template: ChamiloCourseBundle:CToolIntro:create2.html.twig
# form: Chamilo\CourseBundle\Form\Type\CToolIntroType
#
#
# requirements:
# tool: "[a-zA-Z_]+"
#chamilo_course_tool_intro_update:
# path: /courses/{course}/introduction/{tool}/update/
# methods: [GET]
# defaults:
# _controller: chamilo_course.controller.c_tool_intro:updateAction
#
#chamilo_course_tool_list:
# path: /courses/{course}/introduction
# methods: [GET]
# defaults:
# _controller: chamilo_course.controller.tool:indexAction
# Redirects /url/ to /url
remove_trailing_slash:
path: /{url}
defaults: { _controller: ChamiloCoreBundle:Redirecting:removeTrailingSlash }
requirements:
url: .*/$
_method: GET
## Course settings
#chamilo_course_settings:
# pattern: /courses/{course}/settings/{namespace}
# defaults:
# _controller: ChamiloCourseBundle:Settings:update
# template: ChamiloCourseBundle:Settings:default.html.twig
##
#chamilo_course_tool_index:
# pattern: /courses/{course}/tools
# methods: [GET, POST, HEAD, DELETE]
# defaults:
# _controller: chamilo_course.controller.tool:indexAction

@ -0,0 +1,230 @@
parameters:
chamilo_core.entity.manager.course_manager.class: Chamilo\CoreBundle\Entity\Manager\CourseManager
chamilo_core.entity.course: Chamilo\CoreBundle\Entity\Course
chamilo_core.entity.manager.session_manager.class: Chamilo\CoreBundle\Entity\Manager\SessionManager
chamilo_core.entity.session: Chamilo\CoreBundle\Entity\Session
chamilo_core.entity.manager.access_url_manager.class: Chamilo\CoreBundle\Entity\Manager\AccessUrlManager
chamilo_core.entity.access_url: Chamilo\CoreBundle\Entity\AccessUrl
services:
# Managers
chamilo_core.entity.manager.course_manager:
class: %chamilo_core.entity.manager.course_manager.class%
arguments: [%chamilo_core.entity.course%, @doctrine]
chamilo_core.entity.manager.session_manager:
class: %chamilo_core.entity.manager.session_manager.class%
arguments: [%chamilo_core.entity.session%, @doctrine]
chamilo_core.manager.access_url:
class: %chamilo_core.entity.manager.access_url_manager.class%
arguments: [%chamilo_core.entity.access_url%, @doctrine]
# Chamilo Twig extension
twig.extension.chamilo_extension:
class: Chamilo\CoreBundle\Twig\Extension\ChamiloExtension
tags:
- { name: twig.extension }
# Security
# Chamilo custom password encoder
chamilo_user.security.encoder:
class: Chamilo\UserBundle\Security\Encoder
arguments: ['%password_encryption%']
#
# # Course voter checks if a user has permissions to do actions in a course
# chamilo_core.security.authorization.voter.course_voter:
# class: Chamilo\CoreBundle\Security\Authorization\Voter\CourseVoter
# arguments: [ @doctrine.orm.entity_manager, @chamilo_core.entity.manager.course_manager, @service_container]
# public: false
# tags:
# - { name: security.voter }
#
# # Session voter, checks if a user has permissions to do actions in a session
# chamilo_core.security.authorization.voter.session_voter:
# class: Chamilo\CoreBundle\Security\Authorization\Voter\SessionVoter
# arguments: [ @doctrine.orm.entity_manager, @chamilo_core.entity.manager.course_manager, @service_container]
# public: false
# tags:
# - { name: security.voter }
#
# # Resource node voter, checks if a user has permissions to do actions
# chamilo_core.security.authorization.voter.resource_node_voter:
# class: Chamilo\CoreBundle\Security\Authorization\Voter\ResourceNodeVoter
# public: false
# arguments: [ @service_container ]
# tags:
# - { name: security.voter }
# User image naming
# chamilo_core.naming.user_image:
# class: Chamilo\CoreBundle\Naming\UserImage
# Form types
# Custom yes/no type, use in the platform settings
chamilo_core.form.type.yes_no:
class: Chamilo\CoreBundle\Form\Type\YesNoType
tags:
- { name: form.type, alias: yes_no }
# # Extra field attribute services
# chamilo_user.form.type.attribute_value_type:
# class: Chamilo\UserBundle\Form\Type\AttributeValueType
# arguments: [Chamilo\CoreBundle\Entity\ExtraFieldValues, ["registration"], "user", @sylius.repository.subject_name_attribute_value]
# tags:
# - { name: form.type, alias: chamilo_user_extra_field_value }
##
#
# chamilo_user.form.type.attribute_type:
# class: Chamilo\UserBundle\Form\Type\AttributeType
# arguments: [Chamilo\CoreBundle\Entity\ExtraField, ["registration"], "user"]
## arguments: [%sylius.attribute.attribute_types%]
# tags:
# - { name: form.type, alias: chamilo_user_attribute_type }
#
# chamilo_user.form.type.attribute_choice_type:
# class: Chamilo\UserBundle\Form\Type\AttributeTypeChoiceType
# arguments: [%sylius.attribute.attribute_types%]
# tags:
# - { name: form.type, alias: chamilo_user_attribute_choice }
# html editor
chamilo_core.html_editor:
class: Chamilo\CoreBundle\Component\Editor\CkEditor\CkEditor
arguments: [@translator.default, @router]
# Listeners
# chamilo.doctrine.entity_listener_resolver:
# class: Chamilo\CoreBundle\Doctrine\EntityListenerResolver
# arguments: [ "@service_container" ]
# Check if users are online
# chamilo_core.listener.online:
# class: Chamilo\CoreBundle\EventListener\OnlineListener
# arguments: [@security.context, @doctrine.orm.entity_manager ]
# tags:
# - { name: kernel.event_listener, event: kernel.controller, method: onCoreController }
# When Course entity is loaded
# chamilo_core.listener.course:
# class: Chamilo\CoreBundle\Entity\Listener\CourseListener
# arguments: [ "@chamilo_course.tool_chain" ]
# tags:
# - { name: doctrine.orm.entity_listener }
# When Session entity is loaded
# chamilo_core.listener.session:
# class: Chamilo\CoreBundle\Entity\Listener\SessionListener
# tags:
# - { name: doctrine.orm.entity_listener }
#
# # Setting legacy variables
# chamilo_core.listener.legacy:
# class: Chamilo\CoreBundle\EventListener\LegacyListener
# arguments: [@service_container]
# tags:
# - { name: kernel.event_listener, event: kernel.request, method: onKernelRequest, priority: 100 }
# - { name: kernel.event_listener, event: kernel.response, method: onKernelResponse }
# - { name: kernel.event_listener, event: kernel.controller, method: onKernelController }
# Setting locale
# chamilo_core.listener.locale:
# class: Chamilo\CoreBundle\EventListener\LocaleListener
# arguments: ["%kernel.default_locale%", "@service_container"]
# tags:
# - { name: kernel.event_subscriber }
# Setting user and platform locale
# chamilo_core.listener.user_locale_listener:
# class: Chamilo\CoreBundle\EventListener\UserLocaleListener
# arguments: ["@session", "@chamilo.settings.manager"]
# tags:
# - { name: kernel.event_listener, event: security.interactive_login, method: onInteractiveLogin }
## - { name: kernel.event_listener, event: kernel.request, method: setLocaleForUnauthenticatedUser}
#
# # Settings listener
# chamilo_core.listener.settings:
# class: Chamilo\CoreBundle\EventListener\SettingListener
# arguments: [@service_container]
# tags:
# - { name: kernel.event_listener, event: sylius.settings.pre_save, method: onSettingPreSave }
#
# # Menu
# chamilo_core.listener.navbar_menu_listener:
# class: Chamilo\CoreBundle\EventListener\MenuListener
# arguments: [@service_container]
# tags:
# - { name: kernel.event_listener, event: theme.sidebar_setup_menu_knp, method: onSetupMenu }
# - { name: kernel.event_listener, event: theme.breadcrumb, method: onSetupMenu }
#
# # Show the user information in the topbar
# chamilo_core.listener.navbar_user_listener:
# class: Chamilo\CoreBundle\EventListener\ShowUserListener
# arguments: [@service_container]
# tags:
# - { name: kernel.event_listener, event: theme.navbar_user, method: onShowUser }
# - { name: kernel.event_listener, event: theme.sidebar_user, method: onShowUser }
#
# # Loads the message notifications in the top bar
# chamilo_core.listener.message_listener:
# class: Chamilo\CoreBundle\EventListener\MessageListener
# arguments: [@service_container]
# tags:
# - { name: kernel.event_listener, event: theme.messages, method: onListMessages }
#
# # Login listener - When user logs in
# chamilo_core.listener.login_success_handler:
# class: Chamilo\CoreBundle\EventListener\LoginSuccessHandler
# arguments: [@router, @security.authorization_checker]
#
# # Logout listener - When user logs out
# chamilo_core.listener.logout_success_handler:
# class: Chamilo\CoreBundle\EventListener\LogoutSuccessHandler
# arguments: [@router, @security.authorization_checker, @security.token_storage]
#
# # Menus
#
# # Side bar menu
# chamilo_core.menu.simple_menu:
# class: Chamilo\CoreBundle\Menu\SimpleMenuBuilder
# arguments: [@service_container]
#
# # Main nav bar
# chamilo_core.menu.nav_builder:
# class: Chamilo\CoreBundle\Menu\NavBuilder
# arguments: [@knp_menu.factory, @router]
# tags:
# - { name: mopa_bootstrap.menu, alias: chamilo_core.menu.nav }
#
# chamilo_core.menu.course_menu_builder:
# class: Chamilo\CoreBundle\Menu\CourseMenuBuilder
# arguments: [@knp_menu.factory, @chamilo_core.entity.manager.course_manager, @router]
#
# # Course block
# chamilo_core.block.course:
# class: Chamilo\CoreBundle\Block\CourseBlockService
# arguments: [chamilo_core.block.course, @templating]
# tags:
# - { name: sonata.block }
#
# # Skill block
# chamilo_core.block.skill:
# class: Chamilo\CoreBundle\Block\SkillBlockService
# arguments: [chamilo_core.block.skill, @templating ]
# tags:
# - { name: sonata.block }
#
# # Breadcrumb block
# chamilo_core.block.breadcrumb:
# class: Chamilo\CoreBundle\Block\BreadcrumbBlockService
# arguments: ["chamilo_core.block.breadcrumb", "breadcrumb", @templating, @knp_menu.menu_provider, @knp_menu.factory]
# tags:
# - { name: sonata.block }
# - { name: sonata.breadcrumb }

@ -0,0 +1,43 @@
<?php
/* For licensing terms, see /license.txt */
namespace Chamilo\CoreBundle\Twig\Extension;
/**
* Class ChamiloExtension
* @package Chamilo\CoreBundle\Twig\Extension
*/
class ChamiloExtension extends \Twig_Extension
{
/**
* @return array
*/
public function getFilters()
{
return array(
new \Twig_SimpleFilter('var_dump', 'var_dump'),
new \Twig_SimpleFilter('icon', 'Template::get_icon_path'),
new \Twig_SimpleFilter('api_get_local_time', 'api_get_local_time'),
);
}
/**
* {@inheritdoc}
*/
public function getFunctions()
{
return array(
);
}
/**
* Returns the name of the extension.
*
* @return string The extension name
*/
public function getName()
{
return 'chamilo_extension';
}
}

@ -0,0 +1,32 @@
<?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\MediaBundle;
use Symfony\Component\HttpKernel\Bundle\Bundle;
/**
* This file has been generated by the EasyExtends bundle ( http://sonata-project.org/easy-extends )
*
* References :
* bundles : http://symfony.com/doc/current/book/bundles.html
*
* @author <yourname> <youremail>
*/
class ChamiloMediaBundle extends Bundle
{
/**
* {@inheritdoc}
*/
public function getParent()
{
return 'SonataMediaBundle';
}
}

@ -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\MediaBundle\Document;
use Sonata\MediaBundle\Document\BaseGallery as BaseGallery;
/**
* 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 Gallery extends BaseGallery
{
/**
* @var integer $id
*/
protected $id;
/**
* Get id
*
* @return integer $id
*/
public function getId()
{
return $this->id;
}
}

@ -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\MediaBundle\Document;
use Sonata\MediaBundle\Document\BaseMedia as BaseMedia;
/**
* 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 Media extends BaseMedia
{
/**
* @var integer $id
*/
protected $id;
/**
* Get id
*
* @return integer $id
*/
public function getId()
{
return $this->id;
}
}

@ -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\MediaBundle\Entity;
use Sonata\MediaBundle\Entity\BaseGallery as BaseGallery;
/**
* 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 Gallery extends BaseGallery
{
/**
* @var integer $id
*/
protected $id;
/**
* Get id
*
* @return integer $id
*/
public function getId()
{
return $this->id;
}
}

@ -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\MediaBundle\Entity;
use Sonata\MediaBundle\Entity\BaseGalleryHasMedia as BaseGalleryHasMedia;
/**
* 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 GalleryHasMedia extends BaseGalleryHasMedia
{
/**
* @var integer $id
*/
protected $id;
/**
* Get id
*
* @return integer $id
*/
public function getId()
{
return $this->id;
}
}

@ -0,0 +1,39 @@
<?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\MediaBundle\Entity;
use Sonata\MediaBundle\Entity\BaseMedia as BaseMedia;
/**
*
* References :
* working with object : http://www.doctrine-project.org/projects/orm/2.0/docs/reference/working-with-objects/en
*
* @author <yourname> <youremail>
*/
class Media extends BaseMedia
{
/**
* @var integer $id
*/
protected $id;
/**
* Get id
*
* @return integer $id
*/
public function getId()
{
return $this->id;
}
}

@ -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\MediaBundle\PHPCR;
use Sonata\MediaBundle\PHPCR\BaseGallery as BaseGallery;
/**
* This file has been generated by the EasyExtends bundle ( http://sonata-project.org/bundles/easy-extends )
*
* References :
* working with object : http://docs.doctrine-project.org/projects/doctrine-phpcr-odm/en/latest/index.html
*
* @author <yourname> <youremail>
*/
class Gallery extends BaseGallery
{
/**
* @var integer $id
*/
protected $id;
/**
* Get id
*
* @return integer $id
*/
public function getId()
{
return $this->id;
}
}

@ -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\MediaBundle\PHPCR;
use Sonata\MediaBundle\PHPCR\BaseGalleryHasMedia as BaseGalleryHasMedia;
/**
* This file has been generated by the EasyExtends bundle ( http://sonata-project.org/bundles/easy-extends )
*
* References :
* working with object : http://docs.doctrine-project.org/projects/doctrine-phpcr-odm/en/latest/index.html
*
* @author <yourname> <youremail>
*/
class GalleryHasMedia extends BaseGalleryHasMedia
{
/**
* @var integer $id
*/
protected $id;
/**
* Get id
*
* @return integer $id
*/
public function getId()
{
return $this->id;
}
}

@ -0,0 +1,27 @@
<?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\MediaBundle\PHPCR;
use Sonata\MediaBundle\PHPCR\BaseGalleryHasMediaRepository;
/**
* This file has been generated by the EasyExtends bundle ( http://sonata-project.org/bundles/easy-extends )
*
* References :
* query builder : http://www.doctrine-project.org/docs/mongodb_odm/1.0/en/reference/query-builder-api.html
*
* @author <yourname> <youremail>
*/
class GalleryHasMediaRepository extends BaseGalleryHasMediaRepository
{
}

@ -0,0 +1,27 @@
<?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\MediaBundle\PHPCR;
use Sonata\MediaBundle\PHPCR\BaseGalleryRepository;
/**
* This file has been generated by the EasyExtends bundle ( http://sonata-project.org/bundles/easy-extends )
*
* References :
* query builder : http://www.doctrine-project.org/docs/mongodb_odm/1.0/en/reference/query-builder-api.html
*
* @author <yourname> <youremail>
*/
class GalleryRepository extends BaseGalleryRepository
{
}

@ -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\MediaBundle\PHPCR;
use Sonata\MediaBundle\PHPCR\BaseMedia as BaseMedia;
/**
* This file has been generated by the EasyExtends bundle ( http://sonata-project.org/bundles/easy-extends )
*
* References :
* working with object : http://docs.doctrine-project.org/projects/doctrine-phpcr-odm/en/latest/index.html
*
* @author <yourname> <youremail>
*/
class Media extends BaseMedia
{
/**
* @var integer $id
*/
protected $id;
/**
* Get id
*
* @return integer $id
*/
public function getId()
{
return $this->id;
}
}

@ -0,0 +1,27 @@
<?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\MediaBundle\PHPCR;
use Sonata\MediaBundle\PHPCR\BaseMediaRepository;
/**
* This file has been generated by the EasyExtends bundle ( http://sonata-project.org/bundles/easy-extends )
*
* References :
* query builder : http://www.doctrine-project.org/docs/mongodb_odm/1.0/en/reference/query-builder-api.html
*
* @author <yourname> <youremail>
*/
class MediaRepository extends BaseMediaRepository
{
}

@ -0,0 +1,18 @@
<?xml version="1.0" encoding="utf-8"?>
<doctrine-mongo-mapping
xmlns="http://doctrine-project.org/schemas/odm/doctrine-mongo-mapping"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://doctrine-project.org/schemas/odm/doctrine-mongo-mapping
http://doctrine-project.org/schemas/odm/doctrine-mongo-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
-->
<document name="Chamilo\MediaBundle\Document\Gallery">
<field 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\MediaBundle\Entity\Gallery"
table="media__gallery"
>
<id name="id" type="integer" column="id">
<generator strategy="AUTO"/>
</id>
</entity>
</doctrine-mapping>

@ -0,0 +1,25 @@
<?xml version="1.0" encoding="utf-8"?>
<doctrine-phpcr-mapping
xmlns="http://doctrine-project.org/schemas/odm/doctrine-mongo-mapping"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://doctrine-project.org/schemas/odm/doctrine-mongo-mapping
http://doctrine-project.org/schemas/odm/doctrine-mongo-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
-->
<document name="Chamilo\MediaBundle\PHPCR\Gallery"
repository-class="Chamilo\MediaBundle\PHPCR\GalleryRepository">
<id name="id" type="id">
<generator strategy="repository"/>
</id>
</document>
</doctrine-phpcr-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\MediaBundle\Entity\GalleryHasMedia"
table="media__gallery_media"
>
<id name="id" type="integer" column="id">
<generator strategy="AUTO"/>
</id>
</entity>
</doctrine-mapping>

@ -0,0 +1,28 @@
<?xml version="1.0" encoding="utf-8"?>
<doctrine-phpcr-mapping
xmlns="http://doctrine-project.org/schemas/odm/doctrine-mongo-mapping"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://doctrine-project.org/schemas/odm/doctrine-mongo-mapping
http://doctrine-project.org/schemas/odm/doctrine-mongo-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
-->
<document name="Chamilo\MediaBundle\PHPCR\GalleryHasMedia"
repository-class="Chamilo\MediaBundle\PHPCR\GalleryHasMediaRepository">
<id name="id" type="id">
<generator strategy="repository"/>
</id>
<reference-many name="media"
target-document="Chamilo\MediaBundle\PHPCR\GalleryHasMedia"/>
</document>
</doctrine-phpcr-mapping>

@ -0,0 +1,18 @@
<?xml version="1.0" encoding="utf-8"?>
<doctrine-mongo-mapping
xmlns="http://doctrine-project.org/schemas/odm/doctrine-mongo-mapping"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://doctrine-project.org/schemas/odm/doctrine-mongo-mapping
http://doctrine-project.org/schemas/odm/doctrine-mongo-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
-->
<document name="Chamilo\MediaBundle\Document\Media">
<field 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\MediaBundle\Entity\Media"
table="media__media"
>
<id name="id" type="integer" column="id">
<generator strategy="AUTO"/>
</id>
</entity>
</doctrine-mapping>

@ -0,0 +1,25 @@
<?xml version="1.0" encoding="utf-8"?>
<doctrine-phpcr-mapping
xmlns="http://doctrine-project.org/schemas/odm/doctrine-mongo-mapping"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://doctrine-project.org/schemas/odm/doctrine-mongo-mapping
http://doctrine-project.org/schemas/odm/doctrine-mongo-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
-->
<document name="Chamilo\MediaBundle\PHPCR\Media"
repository-class="Chamilo\MediaBundle\PHPCR\MediaRepository">
<id name="id" type="id">
<generator strategy="repository"/>
</id>
</document>
</doctrine-phpcr-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\MediaBundle\Document\Gallery" exclusion-policy="all"
xml-root-name="_gallery">
<property xml-attribute-map="true" name="id" type="integer"
expose="true" since-version="1.0"
groups="sonata_api_read,sonata_api_write,sonata_search"/>
</class>
</serializer>

@ -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\MediaBundle\Document\GalleryHasMedia"
exclusion-policy="all" xml-root-name="_gallery_has_media">
<property xml-attribute-map="true" name="id" type="integer"
expose="true" since-version="1.0"
groups="sonata_api_read,sonata_api_write,sonata_search"/>
</class>
</serializer>

@ -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\MediaBundle\Document\Media" exclusion-policy="all"
xml-root-name="_media">
<property xml-attribute-map="true" name="id" type="integer"
expose="true" since-version="1.0"
groups="sonata_api_read,sonata_api_write,sonata_search"/>
</class>
</serializer>

@ -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\MediaBundle\Entity\Gallery" exclusion-policy="all"
xml-root-name="_gallery">
<property xml-attribute-map="true" name="id" type="integer"
expose="true" since-version="1.0"
groups="sonata_api_read,sonata_api_write,sonata_search"/>
</class>
</serializer>

@ -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\MediaBundle\Entity\GalleryHasMedia"
exclusion-policy="all" xml-root-name="_gallery_has_media">
<property xml-attribute-map="true" name="id" type="integer"
expose="true" since-version="1.0"
groups="sonata_api_read,sonata_api_write,sonata_search"/>
</class>
</serializer>

@ -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\MediaBundle\Entity\Media" exclusion-policy="all"
xml-root-name="_media">
<property xml-attribute-map="true" name="id" type="integer"
expose="true" since-version="1.0"
groups="sonata_api_read,sonata_api_write,sonata_search"/>
</class>
</serializer>

@ -0,0 +1,21 @@
<?php
/* For licensing terms, see /license.txt */
namespace Chamilo\PageBundle;
use Symfony\Component\HttpKernel\Bundle\Bundle;
/**
* Class ChamiloPageBundle
* @package Chamilo\PageBundle
*/
class ChamiloPageBundle extends Bundle
{
/**
* {@inheritdoc}
*/
public function getParent()
{
return 'SonataPageBundle';
}
}

@ -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\PageBundle\Entity;
use Sonata\PageBundle\Entity\BaseBlock as BaseBlock;
/**
* 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 Block extends BaseBlock
{
/**
* @var integer $id
*/
protected $id;
/**
* Get id
*
* @return integer $id
*/
public function getId()
{
return $this->id;
}
}

@ -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\PageBundle\Entity;
use Sonata\PageBundle\Entity\BasePage as BasePage;
/**
* 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 Page extends BasePage
{
/**
* @var integer $id
*/
protected $id;
/**
* Get id
*
* @return integer $id
*/
public function getId()
{
return $this->id;
}
}

@ -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\PageBundle\Entity;
use Sonata\PageBundle\Entity\BaseSite as BaseSite;
/**
* 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 Site extends BaseSite
{
/**
* @var integer $id
*/
protected $id;
/**
* Get id
*
* @return integer $id
*/
public function getId()
{
return $this->id;
}
}

@ -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\PageBundle\Entity;
use Sonata\PageBundle\Entity\BaseSnapshot as BaseSnapshot;
/**
* 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 Snapshot extends BaseSnapshot
{
/**
* @var integer $id
*/
protected $id;
/**
* Get id
*
* @return integer $id
*/
public function getId()
{
return $this->id;
}
}

@ -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\PageBundle\Entity\Block"
table="page__bloc"
repository-class="Doctrine\ORM\EntityRepository">
<id name="id" type="integer" column="id">
<generator strategy="AUTO"/>
</id>
</entity>
</doctrine-mapping>

@ -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\PageBundle\Entity\Page"
table="page__page"
>
<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\PageBundle\Entity\Site"
table="page__site"
>
<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\PageBundle\Entity\Snapshot"
table="page__snapshot"
>
<id name="id" type="integer" column="id">
<generator strategy="AUTO"/>
</id>
</entity>
</doctrine-mapping>

@ -0,0 +1,11 @@
<?xml version="1.0" encoding="UTF-8"?>
<serializer>
<class name="Chamilo\PageBundle\Entity\Block" exclusion-policy="all"
xml-root-name="block">
<property xml-attribute-map="true" name="id" type="integer"
expose="true" since-version="1.0"
groups="sonata_api_read,sonata_api_write,sonata_search"/>
</class>
</serializer>

@ -0,0 +1,11 @@
<?xml version="1.0" encoding="UTF-8"?>
<serializer>
<class name="Chamilo\PageBundle\Entity\Page" exclusion-policy="all"
xml-root-name="page">
<property xml-attribute-map="true" name="id" type="integer"
expose="true" since-version="1.0"
groups="sonata_api_read,sonata_api_write,sonata_search"/>
</class>
</serializer>

@ -0,0 +1,11 @@
<?xml version="1.0" encoding="UTF-8"?>
<serializer>
<class name="Chamilo\PageBundle\Entity\Site" exclusion-policy="all"
xml-root-name="site">
<property xml-attribute-map="true" name="id" type="integer"
expose="true" since-version="1.0"
groups="sonata_api_read,sonata_api_write,sonata_search"/>
</class>
</serializer>

@ -0,0 +1,11 @@
<?xml version="1.0" encoding="UTF-8"?>
<serializer>
<class name="Chamilo\PageBundle\Entity\Snapshot" exclusion-policy="all"
xml-root-name="snapshot">
<property xml-attribute-map="true" name="id" type="integer"
expose="true" since-version="1.0"
groups="sonata_api_read,sonata_api_write,sonata_search"/>
</class>
</serializer>

@ -0,0 +1,21 @@
{#
This file is part of the Sonata package.
(c) Thomas Rabaix <thomas.rabaix@sonata-project.org>
For the full copyright and license information, please view the LICENSE
file that was distributed with this source code.
#}
{% extends 'knp_menu_ordered.html.twig' %}
{% block label %}{{ item.label|trans(item.getExtra('translation_params', {}), item.getExtra('translation_domain', 'SonataSeoBundle')) }}{% endblock %}
{% block list %}
{% spaceless %}
<div class="sonata_breadcrumb">
{{ parent() }}
</div>
{% endspaceless %}
{% endblock %}

@ -0,0 +1,20 @@
{#
This file is part of the Sonata package.
(c) Thomas Rabaix <thomas.rabaix@sonata-project.org>
For the full copyright and license information, please view the LICENSE
file that was distributed with this source code.
#}
{% extends "SonataUserBundle:Security:base_login.html.twig" %}
{% block fos_user_content %}
{% if app.request.session.get('sonata_basket_delivery_redirect') %}
{% include 'SonataBasketBundle:Basket:stepper.html.twig' with {step: 'identification'} %}
{% endif %}
{{ parent() }}
{% endblock fos_user_content %}

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

@ -0,0 +1,26 @@
{% extends 'SonataPageBundle::layout.html.twig' %}
{#{% extends '@ChamiloCore/layout_one_col.html.twig' %}#}
{% block sonata_page_body_tag %}
{{ parent() }}
{% include "SonataSeoBundle:Block:_facebook_sdk.html.twig" %}
{% include "SonataSeoBundle:Block:_twitter_sdk.html.twig" %}
{% include "SonataSeoBundle:Block:_pinterest_sdk.html.twig" %}
{% endblock %}
{% block sonata_page_javascripts %}
<script type="text/javascript">
var basket_update_confirmation_message = '{{ 'sonata_basket_update_confirmation'|trans({}, 'SonataDemoBundle')|escape('js') }}';
</script>
<script src="{{ asset('assetic/sonata_front_js.js') }}"
type="text/javascript"></script>
{% endblock %}
{% block sonata_page_container %}
{{ parent() }}
{% endblock %}
{% block sonata_page_breadcrumb %}{% endblock %}

@ -0,0 +1,24 @@
<?php
namespace Chamilo\UserBundle\Admin;
use Sonata\UserBundle\Admin\Model\GroupAdmin as BaseGroupAdmin;
use Sonata\AdminBundle\Admin\Admin;
use Sonata\AdminBundle\Datagrid\DatagridMapper;
use Sonata\AdminBundle\Datagrid\ListMapper;
use Sonata\AdminBundle\Form\FormMapper;
class GroupAdmin extends BaseGroupAdmin
{
/**
* {@inheritdoc}
*/
protected function configureListFields(ListMapper $listMapper)
{
$listMapper
->addIdentifier('name')
->add('code')
->add('roles')
;
}
}

@ -0,0 +1,194 @@
<?php
/* For licensing terms, see /license.txt */
namespace Chamilo\UserBundle\Admin;
use Sonata\UserBundle\Admin\Model\UserAdmin as BaseUserAdmin;
use Sonata\AdminBundle\Form\FormMapper;
use Sonata\AdminBundle\Datagrid\DatagridMapper;
/**
* Class UserAdmin
* @package Chamilo\UserBundle\Admin
*/
class UserAdmin extends BaseUserAdmin
{
/**
* {@inheritdoc}
*/
protected function configureFormFields(FormMapper $formMapper)
{
// define group zoning
$formMapper
->tab('User')
->with('Profile', array('class' => 'col-md-6'))->end()
->with('General', array('class' => 'col-md-6'))->end()
->with('Social', array('class' => 'col-md-6'))->end()
->end()
->tab('Security')
->with('Status', array('class' => 'col-md-4'))->end()
->with('Groups', array('class' => 'col-md-4'))->end()
->with('Keys', array('class' => 'col-md-4'))->end()
->with('Roles', array('class' => 'col-md-12'))->end()
->end()
->tab('ExtraFields')
->with('ExtraFields', array('class' => 'col-md-4'))->end()
->end();
$now = new \DateTime();
$formMapper
->tab('User')
->with('General')
->add('username')
->add('email')
->add(
'plainPassword',
'text',
array(
'required' => (!$this->getSubject() || is_null(
$this->getSubject()->getId()
)),
)
)
->end()
->with('Profile')
->add(
'dateOfBirth',
'sonata_type_date_picker',
array(
'years' => range(1900, $now->format('Y')),
'dp_min_date' => '1-1-1900',
'dp_max_date' => $now->format('c'),
'required' => false,
)
)
->add('firstname', null, array('required' => false))
->add('lastname', null, array('required' => false))
->add('website', 'url', array('required' => false))
->add('biography', 'text', array('required' => false))
->add(
'gender',
'sonata_user_gender',
array(
'required' => true,
'translation_domain' => $this->getTranslationDomain(),
)
)
->add('locale', 'locale', array('required' => false))
->add('timezone', 'timezone', array('required' => false))
->add('phone', null, array('required' => false))
->end()
->with('Social')
->add('facebookUid', null, array('required' => false))
->add('facebookName', null, array('required' => false))
->add('twitterUid', null, array('required' => false))
->add('twitterName', null, array('required' => false))
->add('gplusUid', null, array('required' => false))
->add('gplusName', null, array('required' => false))
->end()
->end();
if ($this->getSubject() && !$this->getSubject()->hasRole(
'ROLE_SUPER_ADMIN'
)
) {
$formMapper
->tab('Security')
->with('Status')
->add('locked', null, array('required' => false))
->add('expired', null, array('required' => false))
->add('enabled', null, array('required' => false))
->add('credentialsExpired', null, array('required' => false))
->end()
->with('Groups')
->add(
'groups',
'sonata_type_model',
array(
'required' => false,
'expanded' => true,
'multiple' => true,
)
)
->end()
->with('Roles')
->add(
'realRoles',
'sonata_security_roles',
array(
'label' => 'form.label_roles',
'expanded' => true,
'multiple' => true,
'required' => false,
)
)
->end()
->end();
}
$formMapper
->tab('Security')
->with('Keys')
->add('token', null, array('required' => false))
->add('twoStepVerificationCode', null, array('required' => false))
->end()
->end();
//
// $formMapper
// ->tab('ExtraFields')
// ->with('ExtraFields')
// ->add(
// 'extraFields',
// 'sonata_type_collection',
// array(
// 'cascade_validation' => true,
// /*'type_options' => array(
// // Prevents the "Delete" option from being displayed
// 'delete' => false,
// 'delete_options' => array(
// // You may otherwise choose to put the field but hide it
// 'type' => 'hidden',
// // In that case, you need to fill in the options as well
// 'type_options' => array(
// 'mapped' => false,
// 'required' => false,
// )
// )
// )*/
// ),
// array(
// 'allow_delete' => true,
// 'by_reference' => false,
// 'edit' => 'inline',
// 'inline' => 'table',
// 'admin_code' => 'sonata.admin.user_field_values'
// /* 'edit' => 'inline',
// 'inline' => 'table',
// 'sortable' => 'position',*/
// )
// )
// ->end()
// ->end();
}
/**
* @param DatagridMapper $datagridMapper
*/
protected function configureDatagridFilters(DatagridMapper $datagridMapper)
{
$datagridMapper
->add('username')
->add('firstname')
->add('lastname')
->add('email')
->add('officialCode')
->add('groups')
->add(
'active'
)//->add('registrationDate', 'sonata_type_filter_datetime', array('input_type' => 'timestamp'))
;
}
}

@ -0,0 +1,67 @@
<?php
namespace Chamilo\UserBundle\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 UserAdmin
* @package Chamilo\UserBundle\Admin
*/
class UserField extends Admin
{
/**
* @param FormMapper $formMapper
*/
protected function configureFormFields(FormMapper $formMapper)
{
$formMapper
->add('field_type', 'text')
->add('field_variable', 'text')
->add('field_display_text', 'text')
->add('field_default_value', 'text')
->add('field_order', 'text')
->add('field_visible', 'text')
->add('field_changeable', 'text')
->add('field_filter', 'text')
->add('field_loggeable', 'text')
->add('configuration');
}
/**
* @param ShowMapper $showMapper
*/
protected function configureShowField(ShowMapper $showMapper)
{
$showMapper
->add('id', 'text')
->add('field_type', 'text')
->add('field_variable', 'text');
}
/**
* @param DatagridMapper $datagridMapper
*/
protected function configureDatagridFilters(DatagridMapper $datagridMapper)
{
/*$datagridMapper
->add('field_type')
;*/
}
/**
* @param ListMapper $listMapper
*/
protected function configureListFields(ListMapper $listMapper)
{
$listMapper
->addIdentifier('id')
->add('field_variable', 'text')
->add('field_type', 'text');
}
}

@ -0,0 +1,60 @@
<?php
namespace Chamilo\UserBundle\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 UserAdmin
* @package Chamilo\UserBundle\Admin
*/
class UserFieldValuesAdmin extends Admin
{
/**
* @param FormMapper $formMapper
*/
protected function configureFormFields(FormMapper $formMapper)
{
$formMapper
->add('field')
->add('user')
->add('field_value', 'text')
->add('comment', 'textarea')
->add('author');
}
/**
* @param ShowMapper $showMapper
*/
protected function configureShowField(ShowMapper $showMapper)
{
$showMapper
->add('id', 'text');
}
/**
* @param DatagridMapper $datagridMapper
*/
protected function configureDatagridFilters(DatagridMapper $datagridMapper)
{
$datagridMapper
->add('id')
->add('field');
}
/**
* @param ListMapper $listMapper
*/
protected function configureListFields(ListMapper $listMapper)
{
$listMapper
->addIdentifier('id')
->addIdentifier('field')
->addIdentifier('user');
}
}

@ -0,0 +1,21 @@
<?php
/* For licensing terms, see /license.txt */
namespace Chamilo\UserBundle;
use Symfony\Component\HttpKernel\Bundle\Bundle;
/**
* Class ChamiloUserBundle
* @package Chamilo\UserBundle
*/
class ChamiloUserBundle extends Bundle
{
/**
* {@inheritdoc}
*/
public function getParent()
{
return 'SonataUserBundle';
}
}

@ -0,0 +1,26 @@
<?php
/* For licensing terms, see /license.txt */
namespace Chamilo\UserBundle\DependencyInjection;
use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\Config\FileLocator;
use Symfony\Component\HttpKernel\DependencyInjection\Extension;
use Symfony\Component\DependencyInjection\Loader;
/**
* 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 ChamiloUserExtension extends Extension
{
/**
* {@inheritDoc}
*/
public function load(array $configs, ContainerBuilder $container)
{
$loader = new Loader\YamlFileLoader($container, new FileLocator(__DIR__.'/../Resources/config'));
$loader->load('admin.yml');
}
}

@ -0,0 +1,24 @@
<?php
/* For licensing terms, see /license.txt */
namespace Chamilo\UserBundle\Repository;
use Doctrine\ORM\EntityRepository;
/**
* Class GroupRepository
* @package Entity\Repository
*/
class GroupRepository extends EntityRepository
{
/**
* @return mixed
*/
public function getAdmins()
{
$criteria = array('name' => 'admins');
$group = $this->findOneBy($criteria);
return $group->getUsers();
}
}

@ -0,0 +1,354 @@
<?php
/* For licensing terms, see /license.txt */
namespace Chamilo\UserBundle\Repository;
use Chamilo\CoreBundle\Entity\AccessUrl;
use Doctrine\ORM\EntityRepository;
use \Doctrine\Common\Collections\Criteria;
use \Chamilo\CoreBundle\Entity\Session;
use \Chamilo\CoreBundle\Entity\Course;
use \Doctrine\ORM\Query\Expr\Join;
use \Chamilo\CoreBundle\Entity\SessionRelCourseRelUser;
use \Chamilo\UserBundle\Entity\User;
//use Symfony\Component\Security\Core\Exception\UsernameNotFoundException;
//use Symfony\Component\Security\Core\Exception\UnsupportedUserException;
/**
* Class UserRepository
*
* All functions that query the database (selects)
* Functions should return query builders.
*
* @package Chamilo\UserBundle\Repository
*/
class UserRepository extends EntityRepository
{
/**
* @param string $keyword
*
* @return mixed
*/
public function searchUserByKeyword($keyword)
{
$qb = $this->createQueryBuilder('a');
// Selecting user info
$qb->select('DISTINCT b');
$qb->from('Chamilo\UserBundle\Entity\User', 'b');
// Selecting courses for users
//$qb->innerJoin('u.courses', 'c');
//@todo check app settings
$qb->add('orderBy', 'b.firstname ASC');
$qb->where('b.firstname LIKE :keyword OR b.lastname LIKE :keyword ');
$qb->setParameter('keyword', "%$keyword%");
$query = $qb->getQuery();
return $query->execute();
}
/**
* @param string $role
* @return array
*/
public function findByRole($role)
{
$em = $this->getEntityManager();
$qb = $em->createQueryBuilder();
$qb->select('u')
->from($this->_entityName, 'u')
->where('u.roles LIKE :roles')
->setParameter('roles', '%"'.$role.'"%');
return $qb->getQuery()->getResult();
}
/**
* Get course user relationship based in the course_rel_user table.
* @return array
*/
/*public function getCourses(User $user)
{
$queryBuilder = $this->createQueryBuilder('user');
// Selecting course info.
$queryBuilder->select('c');
// Loading User.
//$qb->from('Chamilo\UserBundle\Entity\User', 'u');
// Selecting course
$queryBuilder->innerJoin('Chamilo\CoreBundle\Entity\Course', 'c');
//@todo check app settings
//$qb->add('orderBy', 'u.lastname ASC');
$wherePart = $queryBuilder->expr()->andx();
// Get only users subscribed to this course
$wherePart->add($queryBuilder->expr()->eq('user.userId', $user->getUserId()));
$queryBuilder->where($wherePart);
$query = $queryBuilder->getQuery();
return $query->execute();
}
public function getTeachers()
{
$queryBuilder = $this->createQueryBuilder('u');
// Selecting course info.
$queryBuilder
->select('u')
->where('u.groups.id = :groupId')
->setParameter('groupId', 1);
$query = $queryBuilder->getQuery();
return $query->execute();
}*/
/*public function getUsers($group)
{
$queryBuilder = $this->createQueryBuilder('u');
// Selecting course info.
$queryBuilder
->select('u')
->where('u.groups = :groupId')
->setParameter('groupId', $group);
$query = $queryBuilder->getQuery();
return $query->execute();
}*/
/**
* Get a filtered list of user by status and (optionally) access url
* @todo not use status
*
* @param string $query The query to filter
* @param int $status The status
* @param int $accessUrlId The access URL ID
* @return array
*/
public function searchUsersByStatus($query, $status, $accessUrlId = null)
{
$accessUrlId = intval($accessUrlId);
$queryBuilder = $this->createQueryBuilder('u');
if ($accessUrlId > 0) {
$queryBuilder->innerJoin(
'ChamiloCoreBundle:AccessUrlRelUser',
'auru',
\Doctrine\ORM\Query\Expr\Join::WITH,
'u.id = auru.userId'
);
}
$queryBuilder->where('u.status = :status')
->andWhere('u.username LIKE :query OR u.firstname LIKE :query OR u.lastname LIKE :query')
->setParameter('status', $status)
->setParameter('query', "$query%");
if ($accessUrlId > 0) {
$queryBuilder->andWhere('auru.accessUrlId = :url')
->setParameter(':url', $accessUrlId);
}
return $queryBuilder->getQuery()->getResult();
}
/**
* Get the coaches for a course within a session
* @param Session $session The session
* @param Course $course The course
* @return \Doctrine\ORM\QueryBuilder
*/
public function getCoachesForSessionCourse(Session $session, Course $course)
{
$queryBuilder = $this->createQueryBuilder('u');
$queryBuilder->select('u')
->innerJoin(
'ChamiloCoreBundle:SessionRelCourseRelUser',
'scu',
Join::WITH,
'scu.user = u'
)
->where(
$queryBuilder->expr()->andX(
$queryBuilder->expr()->eq('scu.session', $session->getId()),
$queryBuilder->expr()->eq('scu.course', $course->getId()),
$queryBuilder->expr()->eq('scu.status', SessionRelCourseRelUser::STATUS_COURSE_COACH)
)
);
return $queryBuilder->getQuery()->getResult();
}
/**
* Get course user relationship based in the course_rel_user table.
* @return array
*/
/*public function getCourses(User $user)
{
$queryBuilder = $this->createQueryBuilder('user');
// Selecting course info.
$queryBuilder->select('c');
// Loading User.
//$qb->from('Chamilo\UserBundle\Entity\User', 'u');
// Selecting course
$queryBuilder->innerJoin('Chamilo\CoreBundle\Entity\Course', 'c');
//@todo check app settings
//$qb->add('orderBy', 'u.lastname ASC');
$wherePart = $queryBuilder->expr()->andx();
// Get only users subscribed to this course
$wherePart->add($queryBuilder->expr()->eq('user.userId', $user->getUserId()));
$queryBuilder->where($wherePart);
$query = $queryBuilder->getQuery();
return $query->execute();
}
public function getTeachers()
{
$queryBuilder = $this->createQueryBuilder('u');
// Selecting course info.
$queryBuilder
->select('u')
->where('u.groups.id = :groupId')
->setParameter('groupId', 1);
$query = $queryBuilder->getQuery();
return $query->execute();
}*/
/*public function getUsers($group)
{
$queryBuilder = $this->createQueryBuilder('u');
// Selecting course info.
$queryBuilder
->select('u')
->where('u.groups = :groupId')
->setParameter('groupId', $group);
$query = $queryBuilder->getQuery();
return $query->execute();
}*/
/**
* Get the sessions admins for a user
* @param \Chamilo\UserBundle\Entity\User $user The user
* @return array
*/
public function getSessionAdmins(User $user)
{
$queryBuilder = $this->createQueryBuilder('u');
$queryBuilder
->distinct()
->innerJoin(
'ChamiloCoreBundle:SessionRelUser',
'su',
Join::WITH,
$queryBuilder->expr()->eq('u', 'su.user')
)
->innerJoin(
'ChamiloCoreBundle:SessionRelCourseRelUser',
'scu',
Join::WITH,
$queryBuilder->expr()->eq('su.session', 'scu.session')
)
->where(
$queryBuilder->expr()->eq('scu.user', $user->getId())
)
->andWhere(
$queryBuilder->expr()->eq('su.relationType', SESSION_RELATION_TYPE_RRHH)
)
;
return $queryBuilder->getQuery()->getResult();
}
/**
* Get the student bosses for a user
* @param User $user The user
* @return array
*/
public function getStudentBosses(User $user)
{
$queryBuilder = $this->createQueryBuilder('u');
$queryBuilder
->distinct()
->innerJoin(
'ChamiloCoreBundle:UserRelUser',
'uu',
Join::WITH,
$queryBuilder->expr()->eq('u.id', 'uu.friendUserId')
)
->where(
$queryBuilder->expr()->eq('uu.relationType', USER_RELATION_TYPE_BOSS)
)
->andWhere(
$queryBuilder->expr()->eq('uu.userId', $user->getId())
);
return $queryBuilder->getQuery()->getResult();
}
/**
* Get number of users in URL
* @param AccessUrl $url
*
* @return int
*/
public function getCountUsersByUrl(AccessUrl $url)
{
return $this->createQueryBuilder('a')
->select('COUNT(a)')
->innerJoin('a.portals', 'u')
->where('u.portal = :u')
->setParameters(['u' => $url])
->getQuery()
->getSingleScalarResult();
}
/**
* Get number of users in URL
* @param AccessUrl $url
*
* @return int
*/
public function getCountTeachersByUrl(AccessUrl $url)
{
$qb = $this->createQueryBuilder('a');
return $qb
->select('COUNT(a)')
->innerJoin('a.portals', 'u')
->where('u.portal = :u and u.group = :g')
->andWhere($qb->expr()->in('a.roles', ['ROLE_TEACHER']))
->setParameters(['u' => $url, 'g' => $group])
->getQuery()
->getSingleScalarResult()
;
}
}

@ -0,0 +1,15 @@
parameters:
sonata.user.admin.groupname: sonata_user
sonata.user.admin.label_catalogue: ChamiloUserBundle
sonata.user.admin.groupicon: '<i class=''fa fa-users''></i>'
services:
sonata.user.admin.user:
class: Chamilo\UserBundle\Admin\UserAdmin
tags:
- { name: sonata.admin, manager_type: orm, audit:true, group: 'LMS', label: users, label_catalogue: '%sonata.user.admin.label_catalogue%', label_translator_strategy: sonata.admin.label.strategy.underscore, icon: '%sonata.user.admin.groupicon%' }
arguments: ['', Chamilo\UserBundle\Entity\User, '%sonata.user.admin.user.controller%']
calls:
- [setUserManager, ['@fos_user.user_manager']]
- [setTranslationDomain, ['%sonata.user.admin.user.translation_domain%']]

Some files were not shown because too many files have changed in this diff Show More

Loading…
Cancel
Save