Remove unused code, add support for symfony 5

pull/3262/head
Julio Montoya 6 years ago
parent 50f5c546ec
commit 17de9b3800
  1. 81
      composer.json
  2. 12
      config/bootstrap.php
  3. 35
      config/bundles.php
  4. 3
      config/packages/dev/debug.yaml
  5. 7
      config/packages/dev/jms_serializer.yaml
  6. 10
      config/packages/dev/php_translation.yaml
  7. 35
      config/packages/prod/doctrine.yaml
  8. 6
      config/packages/prod/jms_serializer.yaml
  9. 5
      config/packages/prod/monolog.yaml
  10. 7
      config/packages/test/framework.yaml
  11. 7
      config/packages/test/monolog.yaml
  12. 1
      config/packages/test/web_profiler.yaml
  13. 136
      config/routes.yaml
  14. 52
      config/services.yaml
  15. 14
      src/AdminBundle/ChamiloAdminBundle.php
  16. 44
      src/AdminBundle/Resources/views/layout.html.twig
  17. 373
      src/AdminBundle/Resources/views/standard_layout.html.twig
  18. 14
      src/ClassificationBundle/ChamiloClassificationBundle.php
  19. 40
      src/ClassificationBundle/Document/Category.php
  20. 40
      src/ClassificationBundle/Document/Tag.php
  21. 26
      src/ClassificationBundle/Entity/Category.php
  22. 26
      src/ClassificationBundle/Entity/Collection.php
  23. 28
      src/ClassificationBundle/Entity/Context.php
  24. 26
      src/ClassificationBundle/Entity/Tag.php
  25. 27
      src/ClassificationBundle/Resources/config/doctrine/Category.orm.xml
  26. 32
      src/ClassificationBundle/Resources/config/doctrine/Collection.orm.xml
  27. 27
      src/ClassificationBundle/Resources/config/doctrine/Context.orm.xml
  28. 32
      src/ClassificationBundle/Resources/config/doctrine/Tag.orm.xml
  29. 17
      src/ClassificationBundle/Resources/config/serializer/Document.Category.xml
  30. 17
      src/ClassificationBundle/Resources/config/serializer/Document.Tag.xml
  31. 17
      src/ClassificationBundle/Resources/config/serializer/Entity.Category.xml
  32. 17
      src/ClassificationBundle/Resources/config/serializer/Entity.Collection.xml
  33. 17
      src/ClassificationBundle/Resources/config/serializer/Entity.Context.xml
  34. 17
      src/ClassificationBundle/Resources/config/serializer/Entity.Tag.xml
  35. 44
      src/ContactBundle/Admin/CategoryAdmin.php
  36. 14
      src/ContactBundle/ChamiloContactBundle.php
  37. 88
      src/ContactBundle/Controller/ContactController.php
  38. 24
      src/ContactBundle/DependencyInjection/ChamiloContactExtension.php
  39. 120
      src/ContactBundle/Entity/Category.php
  40. 70
      src/ContactBundle/Entity/CategoryTranslation.php
  41. 9
      src/ContactBundle/Entity/Contact.php
  42. 72
      src/ContactBundle/Form/Type/ContactType.php
  43. 9
      src/ContactBundle/Resources/config/admin.yml
  44. 3
      src/ContactBundle/Resources/config/routing.yml
  45. 29
      src/ContactBundle/Resources/translations/messages.de.po
  46. 1
      src/ContactBundle/Resources/translations/messages.en.po
  47. 26
      src/ContactBundle/Resources/translations/messages.es.po
  48. 29
      src/ContactBundle/Resources/translations/messages.fr.po
  49. 11
      src/ContactBundle/Resources/views/contact.html.twig
  50. 13
      src/ContactBundle/Resources/views/index.html.twig
  51. 65
      src/FaqBundle/Admin/CategoryAdmin.php
  52. 71
      src/FaqBundle/Admin/QuestionAdmin.php
  53. 16
      src/FaqBundle/ChamiloFaqBundle.php
  54. 188
      src/FaqBundle/Controller/FaqController.php
  55. 25
      src/FaqBundle/DependencyInjection/ChamiloFaqExtension.php
  56. 179
      src/FaqBundle/Entity/Category.php
  57. 117
      src/FaqBundle/Entity/CategoryTranslation.php
  58. 209
      src/FaqBundle/Entity/Question.php
  59. 131
      src/FaqBundle/Entity/QuestionTranslation.php
  60. 76
      src/FaqBundle/Repository/CategoryRepository.php
  61. 53
      src/FaqBundle/Repository/QuestionRepository.php
  62. 18
      src/FaqBundle/Resources/config/admin.yml
  63. 12
      src/FaqBundle/Resources/config/routing.yml
  64. 3
      src/FaqBundle/Resources/config/services.yml
  65. 80
      src/FaqBundle/Resources/views/Faq/index.html.twig
  66. 10
      src/FaqBundle/Resources/views/Faq/index_without_collapse.html.twig
  67. 9
      src/FaqBundle/Resources/views/Faq/preview_category_partial.html.twig
  68. 11
      src/FaqBundle/Resources/views/Faq/preview_question_partial.html.twig
  69. 19
      src/Kernel.php
  70. 19
      src/MediaBundle/ChamiloMediaBundle.php
  71. 35
      src/MediaBundle/Entity/Gallery.php
  72. 28
      src/MediaBundle/Entity/GalleryHasMedia.php
  73. 30
      src/MediaBundle/Entity/GalleryItem.php
  74. 28
      src/MediaBundle/Entity/Media.php
  75. 24
      src/MediaBundle/Resources/config/doctrine/Gallery.orm.xml
  76. 24
      src/MediaBundle/Resources/config/doctrine/GalleryHasMedia.orm.xml
  77. 24
      src/MediaBundle/Resources/config/doctrine/Media.orm.xml
  78. 17
      src/MediaBundle/Resources/config/serializer/Entity.Gallery.xml
  79. 17
      src/MediaBundle/Resources/config/serializer/Entity.GalleryItem.xml
  80. 17
      src/MediaBundle/Resources/config/serializer/Entity.Media.xml
  81. 62
      src/MediaBundle/Resources/views/Block/block_gallery.html.twig
  82. 14
      src/NotificationBundle/ChamiloNotificationBundle.php
  83. 28
      src/NotificationBundle/Entity/Message.php
  84. 24
      src/NotificationBundle/Resources/config/doctrine/Message.orm.xml
  85. 17
      src/NotificationBundle/Resources/config/serializer/Entity.Message.xml
  86. 14
      src/PageBundle/ChamiloPageBundle.php
  87. 352
      src/PageBundle/Controller/PageController.php
  88. 28
      src/PageBundle/Entity/Block.php
  89. 28
      src/PageBundle/Entity/Page.php
  90. 28
      src/PageBundle/Entity/Site.php
  91. 28
      src/PageBundle/Entity/Snapshot.php
  92. 24
      src/PageBundle/Resources/config/doctrine/Block.orm.xml
  93. 24
      src/PageBundle/Resources/config/doctrine/Page.orm.xml
  94. 24
      src/PageBundle/Resources/config/doctrine/Site.orm.xml
  95. 24
      src/PageBundle/Resources/config/doctrine/Snapshot.orm.xml
  96. 3
      src/PageBundle/Resources/config/routing.yml
  97. 11
      src/PageBundle/Resources/config/serializer/Entity.Block.xml
  98. 11
      src/PageBundle/Resources/config/serializer/Entity.Page.xml
  99. 11
      src/PageBundle/Resources/config/serializer/Entity.Site.xml
  100. 11
      src/PageBundle/Resources/config/serializer/Entity.Snapshot.xml
  101. Some files were not shown because too many files have changed in this diff Show More

@ -11,6 +11,14 @@
"docs": "https://github.com/chamilo/docs", "docs": "https://github.com/chamilo/docs",
"issues": "https://github.com/chamilo/chamilo-lms/issues" "issues": "https://github.com/chamilo/chamilo-lms/issues"
}, },
"replace": {
"paragonie/random_compat": "2.*",
"symfony/polyfill-ctype": "*",
"symfony/polyfill-iconv": "*",
"symfony/polyfill-php56": "*",
"symfony/polyfill-php70": "*",
"symfony/polyfill-php71": "*"
},
"autoload": { "autoload": {
"psr-4": { "psr-4": {
"Chamilo\\": "src/" "Chamilo\\": "src/"
@ -42,6 +50,7 @@
"require": { "require": {
"a2lix/translation-form-bundle": "^3.0", "a2lix/translation-form-bundle": "^3.0",
"antishov/doctrine-extensions-bundle": "~1.4", "antishov/doctrine-extensions-bundle": "~1.4",
"api-platform/api-pack": "^1.2",
"apy/datagrid-bundle" : "dev-master", "apy/datagrid-bundle" : "dev-master",
"beberlei/doctrineextensions": "^1.2", "beberlei/doctrineextensions": "^1.2",
"brumann/polyfill-unserialize": "^1.0", "brumann/polyfill-unserialize": "^1.0",
@ -50,7 +59,7 @@
"cocur/slugify": "^4.0", "cocur/slugify": "^4.0",
"doctrine/data-fixtures": "~1.0", "doctrine/data-fixtures": "~1.0",
"doctrine/dbal": "~2.10", "doctrine/dbal": "~2.10",
"doctrine/doctrine-bundle": "~1.9", "doctrine/doctrine-bundle": "~2.0",
"doctrine/doctrine-fixtures-bundle": "^3.0", "doctrine/doctrine-fixtures-bundle": "^3.0",
"doctrine/doctrine-migrations-bundle": "~2.0", "doctrine/doctrine-migrations-bundle": "~2.0",
"doctrine/orm": "~2.7", "doctrine/orm": "~2.7",
@ -75,19 +84,18 @@
"ezyang/htmlpurifier": "~4.12", "ezyang/htmlpurifier": "~4.12",
"firebase/php-jwt": "^5.0", "firebase/php-jwt": "^5.0",
"friendsofsymfony/jsrouting-bundle": "~2.0", "friendsofsymfony/jsrouting-bundle": "~2.0",
"friendsofsymfony/rest-bundle": "^2.7", "friendsofsymfony/rest-bundle": "dev-master",
"graphp/algorithms": "~0.8", "graphp/algorithms": "~0.8",
"graphp/graphviz": "~0.2", "graphp/graphviz": "~0.2",
"gregwar/captcha-bundle": "^2.0", "gregwar/captcha-bundle": "^2.0",
"jbroadway/urlify": "~1.1", "jbroadway/urlify": "~1.1",
"jeroendesloovere/vcard": "~1.7", "jeroendesloovere/vcard": "~1.7",
"jimmiw/php-time-ago": "~3.0", "jimmiw/php-time-ago": "~3.0",
"jms/serializer-bundle": "^3.5",
"kigkonsult/icalcreator": "~2.29", "kigkonsult/icalcreator": "~2.29",
"knplabs/doctrine-behaviors": "~2.0", "knplabs/doctrine-behaviors": "~2.0",
"knplabs/gaufrette": "~0.9", "knplabs/gaufrette": "~0.9",
"knplabs/knp-components": "~2.0", "knplabs/knp-components": "~2.0",
"knplabs/knp-menu-bundle": "^2.0|~3.0", "knplabs/knp-menu-bundle": "~3.0",
"knpuniversity/oauth2-client-bundle": "~2.0", "knpuniversity/oauth2-client-bundle": "~2.0",
"laminas/laminas-config": "~3.2", "laminas/laminas-config": "~3.2",
"laminas/laminas-feed": "~2.10", "laminas/laminas-feed": "~2.10",
@ -102,6 +110,7 @@
"masterminds/html5": "^2.0", "masterminds/html5": "^2.0",
"michelf/php-markdown": "~1.8", "michelf/php-markdown": "~1.8",
"mpdf/mpdf": "~8.0", "mpdf/mpdf": "~8.0",
"nesbot/carbon": "^2.33",
"oneup/flysystem-bundle": "~3.0", "oneup/flysystem-bundle": "~3.0",
"oneup/uploader-bundle": "~3.0", "oneup/uploader-bundle": "~3.0",
"overblog/graphql-bundle": "~0.11", "overblog/graphql-bundle": "~0.11",
@ -116,61 +125,39 @@
"sabre/vobject": "~4.2", "sabre/vobject": "~4.2",
"sensio/framework-extra-bundle": "~5.0", "sensio/framework-extra-bundle": "~5.0",
"sensiolabs/security-checker": "~6.0", "sensiolabs/security-checker": "~6.0",
"simplethings/entity-audit-bundle": "^1.0",
"sonata-project/admin-bundle": "~3.0",
"sonata-project/block-bundle": "~3.0|~4.0",
"sonata-project/cache-bundle": "~2.0|~3.0",
"sonata-project/classification-bundle": "~3.0",
"sonata-project/core-bundle": "~3.0",
"sonata-project/datagrid-bundle": "^2.5|~3.0",
"sonata-project/doctrine-extensions": "~1.6",
"sonata-project/doctrine-orm-admin-bundle": "~3.0",
"sonata-project/easy-extends-bundle": "~2.5",
"sonata-project/exporter": "~2.0",
"sonata-project/formatter-bundle": "~4.0",
"sonata-project/intl-bundle": "~2.5",
"sonata-project/media-bundle": "~3.0",
"sonata-project/notification-bundle": "~3.0",
"sonata-project/page-bundle": "~3.0",
"sonata-project/seo-bundle": "~2.7",
"sonata-project/timeline-bundle" : "~3.0",
"sonata-project/user-bundle": "~4.0",
"stephpy/timeline-bundle": "~3.0",
"sunra/php-simple-html-dom-parser": "~1.5", "sunra/php-simple-html-dom-parser": "~1.5",
"symfony/apache-pack": "^1.0", "symfony/apache-pack": "^1.0",
"symfony/asset": "^4.0|^5.0", "symfony/asset": "^5.0",
"symfony/cache": "^4.0|^5.0",
"symfony/dotenv": "^5.0", "symfony/dotenv": "^5.0",
"symfony/expression-language": "^4.0|^5.0", "symfony/expression-language": "^5.0",
"symfony/flex": "^1.6", "symfony/flex": "^1.6",
"symfony/form": "^4.0|^5.0", "symfony/form": "^5.0",
"symfony/framework-bundle": "^4.0|^5.0", "symfony/http-kernel": "^5.0",
"symfony/http-kernel": "^4.0|^5.0", "symfony/intl": "^5.0",
"symfony/mailer": "^5.0", "symfony/mailer": "^5.0",
"symfony/monolog-bundle": "^3.1", "symfony/monolog-bundle": "^3.1",
"symfony/polyfill-apcu": "^1.9", "symfony/polyfill-apcu": "^1.9",
"symfony/requirements-checker": "^1.1", "symfony/requirements-checker": "^1.1",
"symfony/security-bundle": "^4.0|^5.0", "symfony/security-bundle": "^5.0",
"symfony/templating" : "^4.0|^5.0", "symfony/string": "5.0.*",
"symfony/translation": "^4.0|^5.0", "symfony/templating" : "^5.0",
"symfony/twig-bundle": "^4.0|^5.0", "symfony/translation": "^5.0",
"symfony/validator": "^4.0|^5.0", "symfony/twig-pack": "^1.0",
"symfony/validator": "^5.0",
"symfony/webpack-encore-bundle": "^1.7", "symfony/webpack-encore-bundle": "^1.7",
"symfony/yaml": "^5.0", "symfony/yaml": "^5.0",
"tgalopin/html-sanitizer-bundle": "^1.1", "tgalopin/html-sanitizer-bundle": "^1.1",
"twig/extensions": "^1.5", "twig/extensions": "^1.5",
"vich/uploader-bundle": "^1.13", "vich/uploader-bundle": "^1.13",
"webit/eval-math": "~1.0", "webit/eval-math": "~1.0"
"api-platform/api-pack": "^1.2",
"nesbot/carbon": "^2.33"
}, },
"config": { "config": {
"component-dir": "public/assets" "component-dir": "public/assets",
"sort-packages": true
}, },
"require-dev": { "require-dev": {
"behat/behat": "@stable", "behat/behat": "@stable",
"behat/mink": "dev-master", "behat/mink": "dev-master",
"behat/mink-extension": "@stable",
"behat/mink-goutte-driver": "@stable", "behat/mink-goutte-driver": "@stable",
"behat/mink-selenium2-driver": "@stable", "behat/mink-selenium2-driver": "@stable",
"php-translation/symfony-bundle": "^0.12", "php-translation/symfony-bundle": "^0.12",
@ -191,12 +178,12 @@
], ],
"auto-scripts": { "auto-scripts": {
"cache:clear": "symfony-cmd", "cache:clear": "symfony-cmd",
"assets:install %PUBLIC_DIR%": "symfony-cmd", "assets:install %PUBLIC_DIR%": "symfony-cmd"
"security-checker security:check": "script",
"requirements-checker": "script"
}, },
"install-ckeditor": { "install-ckeditor": {
"ckeditor:install %PUBLIC_DIR%/libs/ckeditor --clear=keep --tag=4.13.0 --exclude=samples --exclude=adapters ": "symfony-cmd" "ckeditor:install %PUBLIC_DIR%/libs/ckeditor --clear=keep --tag=4.13.0 --exclude=samples --exclude=adapters ": "symfony-cmd",
"security-checker security:check": "script",
"requirements-checker": "script"
}, },
"post-install-cmd": [ "post-install-cmd": [
"@auto-scripts", "@auto-scripts",
@ -211,5 +198,11 @@
"pre-update-cmd": [ "pre-update-cmd": [
], ],
"phpcs": "phpcs --standard=.php_cs.dist" "phpcs": "phpcs --standard=.php_cs.dist"
},
"extra": {
"symfony": {
"allow-contrib": false,
"require": "5.0.*"
}
} }
} }

@ -4,14 +4,14 @@ use Symfony\Component\Dotenv\Dotenv;
require dirname(__DIR__).'/vendor/autoload.php'; require dirname(__DIR__).'/vendor/autoload.php';
if (!class_exists(Dotenv::class)) {
throw new LogicException('Please run "composer require symfony/dotenv" to load the ".env" files configuring the application.');
}
// Load cached env vars if the .env.local.php file exists // Load cached env vars if the .env.local.php file exists
// Run "composer dump-env prod" to create it (requires symfony/flex >=1.2) // Run "composer dump-env prod" to create it (requires symfony/flex >=1.2)
if (is_array($env = @include dirname(__DIR__).'/.env.local.php') && ($_SERVER['APP_ENV'] ?? $_ENV['APP_ENV'] ?? $env['APP_ENV']) === $env['APP_ENV']) { // Run "composer dump-env prod" to create it (requires symfony/flex >=1.2)
foreach ($env as $k => $v) { if (is_array($env = @include dirname(__DIR__).'/.env.local.php') && (!isset($env['APP_ENV']) || ($_SERVER['APP_ENV'] ?? $_ENV['APP_ENV'] ?? $env['APP_ENV']) === $env['APP_ENV'])) {
$_ENV[$k] = $_ENV[$k] ?? (isset($_SERVER[$k]) && 0 !== strpos($k, 'HTTP_') ? $_SERVER[$k] : $v); (new Dotenv(false))->populate($env);
}
} elseif (!class_exists(Dotenv::class)) {
throw new RuntimeException('Please run "composer require symfony/dotenv" to load the ".env" files configuring the application.');
} else { } else {
// load all the .env files // load all the .env files
(new Dotenv(false))->loadEnv(dirname(__DIR__).'/.env'); (new Dotenv(false))->loadEnv(dirname(__DIR__).'/.env');

@ -8,60 +8,28 @@ return [
Sensio\Bundle\FrameworkExtraBundle\SensioFrameworkExtraBundle::class => ['all' => true], Sensio\Bundle\FrameworkExtraBundle\SensioFrameworkExtraBundle::class => ['all' => true],
Symfony\Bundle\MonologBundle\MonologBundle::class => ['all' => true], Symfony\Bundle\MonologBundle\MonologBundle::class => ['all' => true],
Symfony\Bundle\TwigBundle\TwigBundle::class => ['all' => true], Symfony\Bundle\TwigBundle\TwigBundle::class => ['all' => true],
Sonata\EasyExtendsBundle\SonataEasyExtendsBundle::class => ['all' => true],
Sonata\DatagridBundle\SonataDatagridBundle::class => ['all' => true],
Sonata\CoreBundle\SonataCoreBundle::class => ['all' => true],
Symfony\Bundle\SecurityBundle\SecurityBundle::class => ['all' => true], Symfony\Bundle\SecurityBundle\SecurityBundle::class => ['all' => true],
Sonata\BlockBundle\SonataBlockBundle::class => ['all' => true],
Knp\Bundle\MenuBundle\KnpMenuBundle::class => ['all' => true], Knp\Bundle\MenuBundle\KnpMenuBundle::class => ['all' => true],
Sonata\AdminBundle\SonataAdminBundle::class => ['all' => true],
FOS\UserBundle\FOSUserBundle::class => ['all' => true],
Sonata\UserBundle\SonataUserBundle::class => ['all' => true],
Symfony\Bundle\DebugBundle\DebugBundle::class => ['dev' => true, 'test' => true], Symfony\Bundle\DebugBundle\DebugBundle::class => ['dev' => true, 'test' => true],
Symfony\Bundle\WebProfilerBundle\WebProfilerBundle::class => ['dev' => true, 'test' => true], Symfony\Bundle\WebProfilerBundle\WebProfilerBundle::class => ['dev' => true, 'test' => true],
Symfony\Cmf\Bundle\RoutingBundle\CmfRoutingBundle::class => ['all' => true],
Sonata\SeoBundle\SonataSeoBundle::class => ['all' => true],
Sonata\NotificationBundle\SonataNotificationBundle::class => ['all' => true],
Sonata\PageBundle\SonataPageBundle::class => ['all' => true],
Sonata\DoctrineORMAdminBundle\SonataDoctrineORMAdminBundle::class => ['all' => true],
Sonata\ClassificationBundle\SonataClassificationBundle::class => ['all' => true],
Spy\TimelineBundle\SpyTimelineBundle::class => ['all' => true],
Sonata\IntlBundle\SonataIntlBundle::class => ['all' => true],
Sonata\TimelineBundle\SonataTimelineBundle::class => ['all' => true],
JMS\SerializerBundle\JMSSerializerBundle::class => ['all' => true],
Sonata\MediaBundle\SonataMediaBundle::class => ['all' => true],
FOS\JsRoutingBundle\FOSJsRoutingBundle::class => ['all' => true], FOS\JsRoutingBundle\FOSJsRoutingBundle::class => ['all' => true],
FOS\RestBundle\FOSRestBundle::class => ['all' => true], FOS\RestBundle\FOSRestBundle::class => ['all' => true],
Chamilo\CoreBundle\ChamiloCoreBundle::class => ['all' => true], Chamilo\CoreBundle\ChamiloCoreBundle::class => ['all' => true],
Chamilo\ThemeBundle\ChamiloThemeBundle::class => ['all' => true], Chamilo\ThemeBundle\ChamiloThemeBundle::class => ['all' => true],
Chamilo\SkillBundle\ChamiloSkillBundle::class => ['all' => true], Chamilo\SkillBundle\ChamiloSkillBundle::class => ['all' => true],
Chamilo\CourseBundle\ChamiloCourseBundle::class => ['all' => true], Chamilo\CourseBundle\ChamiloCourseBundle::class => ['all' => true],
Chamilo\AdminBundle\ChamiloAdminBundle::class => ['all' => true],
Chamilo\FaqBundle\ChamiloFaqBundle::class => ['all' => true],
Chamilo\ContactBundle\ChamiloContactBundle::class => ['all' => true],
Chamilo\TicketBundle\ChamiloTicketBundle::class => ['all' => true], Chamilo\TicketBundle\ChamiloTicketBundle::class => ['all' => true],
Chamilo\PageBundle\ChamiloPageBundle::class => ['all' => true],
Chamilo\UserBundle\ChamiloUserBundle::class => ['all' => true],
Chamilo\ClassificationBundle\ChamiloClassificationBundle::class => ['all' => true],
Chamilo\MediaBundle\ChamiloMediaBundle::class => ['all' => true],
Chamilo\NotificationBundle\ChamiloNotificationBundle::class => ['all' => true],
Chamilo\SettingsBundle\ChamiloSettingsBundle::class => ['all' => true], Chamilo\SettingsBundle\ChamiloSettingsBundle::class => ['all' => true],
Chamilo\TimelineBundle\ChamiloTimelineBundle::class => ['all' => true],
Chamilo\GraphQlBundle\ChamiloGraphQlBundle::class => ['all' => true], Chamilo\GraphQlBundle\ChamiloGraphQlBundle::class => ['all' => true],
Chamilo\LtiBundle\ChamiloLtiBundle::class => ['all' => true], Chamilo\LtiBundle\ChamiloLtiBundle::class => ['all' => true],
Sylius\Bundle\SettingsBundle\SyliusSettingsBundle::class => ['all' => true], Sylius\Bundle\SettingsBundle\SyliusSettingsBundle::class => ['all' => true],
Oneup\FlysystemBundle\OneupFlysystemBundle::class => ['all' => true], Oneup\FlysystemBundle\OneupFlysystemBundle::class => ['all' => true],
Sonata\CacheBundle\SonataCacheBundle::class => ['all' => true],
Knp\Bundle\MarkdownBundle\KnpMarkdownBundle::class => ['all' => true],
A2lix\AutoFormBundle\A2lixAutoFormBundle::class => ['all' => true], A2lix\AutoFormBundle\A2lixAutoFormBundle::class => ['all' => true],
A2lix\TranslationFormBundle\A2lixTranslationFormBundle::class => ['all' => true], A2lix\TranslationFormBundle\A2lixTranslationFormBundle::class => ['all' => true],
Oneup\UploaderBundle\OneupUploaderBundle::class => ['all' => true], Oneup\UploaderBundle\OneupUploaderBundle::class => ['all' => true],
APY\DataGridBundle\APYDataGridBundle::class => ['all' => true], APY\DataGridBundle\APYDataGridBundle::class => ['all' => true],
Overblog\GraphQLBundle\OverblogGraphQLBundle::class => ['all' => true], Overblog\GraphQLBundle\OverblogGraphQLBundle::class => ['all' => true],
Gregwar\CaptchaBundle\GregwarCaptchaBundle::class => ['all' => true], Gregwar\CaptchaBundle\GregwarCaptchaBundle::class => ['all' => true],
FOS\CKEditorBundle\FOSCKEditorBundle::class => ['all' => true],
Sonata\FormatterBundle\SonataFormatterBundle::class => ['all' => true],
SimpleThings\EntityAudit\SimpleThingsEntityAuditBundle::class => ['all' => true],
Symfony\WebpackEncoreBundle\WebpackEncoreBundle::class => ['all' => true], Symfony\WebpackEncoreBundle\WebpackEncoreBundle::class => ['all' => true],
Liip\ImagineBundle\LiipImagineBundle::class => ['all' => true], Liip\ImagineBundle\LiipImagineBundle::class => ['all' => true],
HtmlSanitizer\Bundle\HtmlSanitizerBundle::class => ['all' => true], HtmlSanitizer\Bundle\HtmlSanitizerBundle::class => ['all' => true],
@ -70,8 +38,7 @@ return [
KnpU\OAuth2ClientBundle\KnpUOAuth2ClientBundle::class => ['all' => true], KnpU\OAuth2ClientBundle\KnpUOAuth2ClientBundle::class => ['all' => true],
Translation\Bundle\TranslationBundle::class => ['all' => true], Translation\Bundle\TranslationBundle::class => ['all' => true],
Stof\DoctrineExtensionsBundle\StofDoctrineExtensionsBundle::class => ['all' => true], Stof\DoctrineExtensionsBundle\StofDoctrineExtensionsBundle::class => ['all' => true],
Twig\Extra\TwigExtraBundle\TwigExtraBundle::class => ['all' => true],
Doctrine\Bundle\DoctrineCacheBundle\DoctrineCacheBundle::class => ['all' => true],
Nelmio\CorsBundle\NelmioCorsBundle::class => ['all' => true], Nelmio\CorsBundle\NelmioCorsBundle::class => ['all' => true],
ApiPlatform\Core\Bridge\Symfony\Bundle\ApiPlatformBundle::class => ['all' => true], ApiPlatform\Core\Bridge\Symfony\Bundle\ApiPlatformBundle::class => ['all' => true],
Twig\Extra\TwigExtraBundle\TwigExtraBundle::class => ['all' => true],
]; ];

@ -1,5 +1,4 @@
debug: debug:
# Forwards VarDumper Data clones to a centralized server allowing to inspect dumps on CLI or in your browser. # Forwards VarDumper Data clones to a centralized server allowing to inspect dumps on CLI or in your browser.
# See the "server:dump" command to start a new server. # See the "server:dump" command to start a new server.
#dump_destination: "tcp://%env(VAR_DUMPER_SERVER)%" dump_destination: "tcp://%env(VAR_DUMPER_SERVER)%"
dump_destination: null

@ -1,7 +0,0 @@
jms_serializer:
visitors:
json_serialization:
options:
- JSON_PRETTY_PRINT
- JSON_UNESCAPED_SLASHES
- JSON_PRESERVE_ZERO_FRACTION

@ -1,5 +1,5 @@
translation: #translation:
symfony_profiler: # symfony_profiler:
enabled: true # enabled: true
webui: # webui:
enabled: true # enabled: true

@ -1,26 +1,27 @@
doctrine: doctrine:
orm: orm:
auto_generate_proxy_classes: false
metadata_cache_driver: metadata_cache_driver:
type: service type: pool
id: doctrine.system_cache_provider pool: doctrine.system_cache_pool
query_cache_driver: query_cache_driver:
type: service type: pool
id: doctrine.system_cache_provider pool: doctrine.system_cache_pool
result_cache_driver: result_cache_driver:
type: service type: pool
id: doctrine.result_cache_provider pool: doctrine.result_cache_pool
services: #services:
doctrine.result_cache_provider: # doctrine.result_cache_provider:
class: Symfony\Component\Cache\DoctrineProvider # class: Symfony\Component\Cache\DoctrineProvider
public: false # public: false
arguments: # arguments:
- '@doctrine.result_cache_pool' # - '@doctrine.result_cache_pool'
doctrine.system_cache_provider: # doctrine.system_cache_provider:
class: Symfony\Component\Cache\DoctrineProvider # class: Symfony\Component\Cache\DoctrineProvider
public: false # public: false
arguments: # arguments:
- '@doctrine.system_cache_pool' # - '@doctrine.system_cache_pool'
framework: framework:
cache: cache:

@ -1,6 +0,0 @@
#jms_serializer:
# visitors:
# json:
# options:
# - JSON_UNESCAPED_SLASHES
# - JSON_PRESERVE_ZERO_FRACTION

@ -4,9 +4,8 @@ monolog:
type: fingers_crossed type: fingers_crossed
action_level: error action_level: error
handler: nested handler: nested
excluded_404s: excluded_http_codes: [404, 405]
# regex: exclude all 404 errors from the logs buffer_size: 50 # How many messages should be saved? Prevent memory leaks
- ^/
nested: nested:
type: stream type: stream
path: "%kernel.logs_dir%/%kernel.environment%.log" path: "%kernel.logs_dir%/%kernel.environment%.log"

@ -1,5 +1,4 @@
framework: framework:
test: ~ test: true
# Uncomment this section if you're using sessions session:
#session: storage_id: session.storage.mock_file
# storage_id: session.storage.mock_file

@ -1,7 +1,12 @@
monolog: monolog:
handlers: handlers:
main: main:
type: fingers_crossed
action_level: error
handler: nested
excluded_http_codes: [404, 405]
channels: ["!event"]
nested:
type: stream type: stream
path: "%kernel.logs_dir%/%kernel.environment%.log" path: "%kernel.logs_dir%/%kernel.environment%.log"
level: debug level: debug
channels: ["!event"]

@ -1,5 +1,6 @@
web_profiler: web_profiler:
toolbar: false toolbar: false
intercept_redirects: false intercept_redirects: false
framework: framework:
profiler: {collect: false} profiler: {collect: false}

@ -1,20 +1,6 @@
logout: logout:
path: /logout path: /logout
_admin:
resource: routes/sonata_admin.yaml
prefix: /administration
sonata_admin_redirect:
path: /administration/dashboard
sonata_admin_my_dashboard:
path: /administration
controller: Symfony\Bundle\FrameworkBundle\Controller\RedirectController::redirectAction
defaults:
route: sonata_admin_dashboard
permanent: false
sonata_user_admin_security_logout: sonata_user_admin_security_logout:
path: /logout path: /logout
@ -22,95 +8,51 @@ oneup_uploader:
resource: . resource: .
type: uploader type: uploader
#resources: legacy_main:
# type: rest path: /main/{name}
# prefix: /api/{tool}/{type} defaults: {_controller: 'ChamiloCoreBundle:Legacy:classic'}
# resource: Chamilo\CoreBundle\Controller\ResourceApiController requirements:
name: .+
# Resources
#app_document:
# resource: |
# alias: app.document
# path: /resource/documents
# form: Chamilo\CoreBundle\Form\Type\DocumentType
# type: sylius.resource
#app_document_index: legacy_plugin:
# path: /courses/{course}/resource/documents/ path: /plugin/{name}
# methods: [GET, POST] defaults: {_controller: 'ChamiloCoreBundle:Legacy:plugin'}
# defaults: requirements:
# _controller: Chamilo\CoreBundle\Controller\ResourceController:indexAction name: .+
# _sylius:
# template: ChamiloCoreBundle:Document:show.html.twig
# Create a folder # web url shortcuts for legacy templates
#app_document_create: web.ajax:
# path: /courses/{course}/resource/documents/new path: main/inc/ajax/
# methods: [GET, POST]
# defaults:
# _controller: app.controller.document:createAction
# _sylius:
# template: ChamiloCoreBundle:Document:create.html.twig
# form: Chamilo\CoreBundle\Form\Type\DocumentType
# Create a document web.main:
#app_document_create_document: path: main/
# path: /courses/{course}/resource/documents/new_document
# methods: [GET, POST]
# defaults:
# _controller: app.controller.document:createDocumentAction
# _sylius:
# template: ChamiloCoreBundle:Document:create.html.twig
# form: Chamilo\CoreBundle\Form\Type\DocumentType
#
#app_document_show:
# path: /courses/{course}/resource/documents/{id}
# methods: [GET]
# defaults:
# _controller: app.controller.document:showAction
# _sylius:
# template: ChamiloCoreBundle:Document:show.html.twig
#
#app_document_update:
# path: /courses/{course}/resource/documents/{id}/edit
# methods: [GET, PUT, PATCH]
# defaults:
# _controller: app.controller.document:updateAction
# _sylius:
# template: ChamiloCoreBundle:Document:update.html.twig
# form: Chamilo\CoreBundle\Form\Type\DocumentType
#
#app_document_delete:
# path: /courses/{course}/resource/documents/{id}
# methods: [DELETE]
# defaults:
# _controller: app.controller.document:deleteAction
#admin_dashboard: # Core controllers
# pattern: /administration/ core_admin:
# defaults: resource: '@ChamiloCoreBundle/Controller/Admin'
# _controller: FrameworkBundle:Redirect:redirect type: annotation
# route: sonata_admin_dashboard prefix: /admin
# permanent: true # this for 301
#admin_without_locale: #resources:
# pattern: /administration # type: rest
# defaults: # prefix: /api/{tool}/{type}
# _controller: FrameworkBundle:Redirect:redirect # resource: Chamilo\CoreBundle\Controller\ResourceApiController
# route: sonata_admin_dashboard
# permanent: true # this for 301
#admin_dashboard_without_locale:
# pattern: /administration/dashboard
# defaults:
# _controller: FrameworkBundle:Redirect:redirect
# route: sonata_admin_dashboard
# permanent: true
#_api:
# resource: routing_api.yml
# prefix: /api
#liip_theme: #liip_theme:
# resource: "@LiipThemeBundle/Resources/config/routing.xml" # resource: "@LiipThemeBundle/Resources/config/routing.xml"
# prefix: /theme # prefix: /theme
# Redirects /url/ to /url always located at the end
#remove_trailing_slash:
# path: /{url}
# defaults: {_controller: 'ChamiloCoreBundle:Redirecting:removeTrailingSlash'}
# requirements:
# url: .*/$
# _method: GET
chamilo_graphql:
resource: "@ChamiloGraphQlBundle/Resources/config/routing.yaml"
chamilo_lti:
resource: "@ChamiloLtiBundle/Resources/config/routing.yml"

@ -1,7 +1,6 @@
# Put parameters here that don't need to change on each machine where the app is deployed # Put parameters here that don't need to change on each machine where the app is deployed
# https://symfony.com/doc/current/best_practices/configuration.html#application-related-configuration # https://symfony.com/doc/current/best_practices/configuration.html#application-related-configuration
parameters: parameters:
# container.dumper.inline_factories: true
app_env: '%env(APP_ENV)%' app_env: '%env(APP_ENV)%'
password_encryption: '%env(APP_ENCRYPT_METHOD)%' password_encryption: '%env(APP_ENCRYPT_METHOD)%'
secret: '%env(APP_SECRET)%' secret: '%env(APP_SECRET)%'
@ -11,10 +10,10 @@ parameters:
form: form:
resources: resources:
- 'GeneratorBundle::fields.html.twig' - 'GeneratorBundle::fields.html.twig'
container.build_id: ~
course_info_is_not_editable: false course_info_is_not_editable: false
sonata_media.cdn.host: '/var/upload/media/'
sonata_page.varnish.command: 'if [ ! -r "/etc/varnish/secret" ]; then echo "VALID ERROR :/"; else varnishadm -S /etc/varnish/secret -T 127.0.0.1:6082 {{ COMMAND }} "{{ EXPRESSION }}"; fi;' # sonata_media.cdn.host: '/var/upload/media/'
# sonata_page.varnish.command: 'if [ ! -r "/etc/varnish/secret" ]; then echo "VALID ERROR :/"; else varnishadm -S /etc/varnish/secret -T 127.0.0.1:6082 {{ COMMAND }} "{{ EXPRESSION }}"; fi;'
# router.request_context.base_url: '%env(APP_URL_APPEND)%' # router.request_context.base_url: '%env(APP_URL_APPEND)%'
# asset.request_context.base_path: '%env(APP_URL_APPEND)%' # asset.request_context.base_path: '%env(APP_URL_APPEND)%'
@ -45,8 +44,6 @@ services:
public: true # Allows optimizing the container by removing unused services; this also means public: true # Allows optimizing the container by removing unused services; this also means
# fetching services directly from the container via $container->get() won't work. # fetching services directly from the container via $container->get() won't work.
# The best practice is to be explicit about your dependencies anyway. # The best practice is to be explicit about your dependencies anyway.
bind:
$passwordEncrypt: '%password_encryption%'
Chamilo\CoreBundle\Component\Utils\Glide: Chamilo\CoreBundle\Component\Utils\Glide:
arguments: arguments:
@ -56,18 +53,13 @@ services:
# makes classes in src/ available to be used as services # makes classes in src/ available to be used as services
# this creates a service per class whose id is the fully-qualified class name # this creates a service per class whose id is the fully-qualified class name
Chamilo\PageBundle\:
resource: '../src/PageBundle/*'
exclude: '../src/PageBundle/{Entity,Migrations,Tests}'
public: true
Vich\UploaderBundle\Naming\SubdirDirectoryNamer: Vich\UploaderBundle\Naming\SubdirDirectoryNamer:
public: true public: true
Chamilo\CoreBundle\Controller\ResourceController: Chamilo\CoreBundle\Controller\ResourceController:
arguments: arguments:
- '@Chamilo\CoreBundle\Repository\ResourceFactory' - '@Chamilo\CoreBundle\Repository\ResourceFactory'
- '@Chamilo\CoreBundle\Block\BreadcrumbBlockService' # - '@Chamilo\CoreBundle\Block\BreadcrumbBlockService'
Symfony\Component\Mailer\Mailer: Symfony\Component\Mailer\Mailer:
public: true public: true
@ -83,32 +75,6 @@ services:
chamilo_core.hook_factory: chamilo_core.hook_factory:
class: 'Chamilo\CoreBundle\Hook\HookFactory' class: 'Chamilo\CoreBundle\Hook\HookFactory'
# makes classes in src/ available to be used as services
# this creates a service per class whose id is the fully-qualified class name
AdminBundle\:
resource: '../src/AdminBundle/*'
# you can exclude directories or files
# but if a service is unused, it's removed anyway
exclude: '../src/AdminBundle/{ChamiloAdminBundle.php,Entity,Repository,Tests}'
ClassificationBundle\:
resource: '../src/ClassificationBundle/*'
# you can exclude directories or files
# but if a service is unused, it's removed anyway
exclude: '../src/ClassificationBundle/{ChamiloClassificationBundle.php,Entity,Admin,Document,Repository,Tests}'
ContactBundle\:
resource: '../src/ContactBundle/*'
# you can exclude directories or files
# but if a service is unused, it's removed anyway
exclude: '../src/ContactBundle/{ChamiloContactBundle.php,Entity,Admin,Controller,DependencyInjection,Form,Repository,Tests}'
Chamilo\UserBundle\:
resource: '../src/UserBundle/*'
# you can exclude directories or files
# but if a service is unused, it's removed anyway
exclude: '../src/UserBundle/{Admin,ChamiloUserBundle.php,Security/FOSUBUserProvider.php,DependencyInjection,Form,EventListener,Entity,Repository}'
chamilo_lti_utils: chamilo_lti_utils:
class: Chamilo\LtiBundle\Util\Utils class: Chamilo\LtiBundle\Util\Utils
arguments: ['@chamilo.settings.manager'] arguments: ['@chamilo.settings.manager']
@ -122,13 +88,14 @@ services:
class: APY\DataGridBundle\Grid\GridRegistry class: APY\DataGridBundle\Grid\GridRegistry
public: true public: true
sylius_settings: sylius_settings:
driver: doctrine/orm driver: doctrine/orm
# Doctrine audit # Doctrine audit
sonata_doctrine_orm_admin: #sonata_doctrine_orm_admin:
audit: # audit:
force: false # Audits are set in the admin.yml files with audit:true # force: false # Audits are set in the admin.yml files with audit:true
# Grid default template # Grid default template
apy_data_grid: apy_data_grid:
@ -161,5 +128,4 @@ cocur_slugify:
imports: imports:
- {resource: ../src/CoreBundle/Resources/config/services.yml} - {resource: ../src/CoreBundle/Resources/config/services.yml}
- {resource: ../src/PageBundle/Resources/config/services.yml} # - {resource: ../src/PageBundle/Resources/config/services.yml}
# - {resource: ../vendor/knplabs/doctrine-behaviors/config/orm-services.yml}

@ -1,14 +0,0 @@
<?php
/* For licensing terms, see /license.txt */
namespace Chamilo\AdminBundle;
use Symfony\Component\HttpKernel\Bundle\Bundle;
/**
* Class ChamiloAdminBundle.
*/
class ChamiloAdminBundle extends Bundle
{
}

@ -1,44 +0,0 @@
{# See vendor/sonata-project/admin-bundle/Resources/views/standard_layout.html.twig#}
{% extends '@ChamiloAdmin/standard_layout.html.twig' %}
{#{% block stylesheets %}#}
{#{{ parent() }}#}
{#<link rel="stylesheet"#}
{#href="{{ asset('bundles/sonataformatter/markitup/skins/sonata/style.css') }}"#}
{#type="text/css" media="all"/>#}
{#<link rel="stylesheet"#}
{#href="{{ asset('bundles/sonataformatter/markitup/sets/markdown/style.css') }}"#}
{#type="text/css" media="all"/>#}
{#<link rel="stylesheet"#}
{#href="{{ asset('bundles/sonataformatter/markitup/sets/html/style.css') }}"#}
{#type="text/css" media="all"/>#}
{#<link rel="stylesheet"#}
{#href="{{ asset('bundles/sonataformatter/markitup/sets/textile/style.css') }}"#}
{#type="text/css" media="all"/>#}
{#<link rel="stylesheet"#}
{#href="{{ asset('bundles/sonatacore/vendor/eonasdan-bootstrap-datetimepicker/build/css/bootstrap-datetimepicker.min.css') }}"/>#}
{#{% endblock %}#}
{#{% block javascripts %}#}
{#{{ parent() }}#}
{#<script src="{{ asset('libs/ckeditor/ckeditor.js') }}"></script>#}
{#<script src="{{ asset('bundles/sonataformatter/vendor/markitup-markitup/markitup/jquery.markitup.js') }}"#}
{#type="text/javascript"></script>#}
{#<script src="{{ asset('bundles/sonataformatter/markitup/sets/markdown/set.js') }}"#}
{#type="text/javascript"></script>#}
{#<script src="{{ asset('bundles/sonataformatter/markitup/sets/html/set.js') }}"#}
{#type="text/javascript"></script>#}
{#<script src="{{ asset('bundles/sonataformatter/markitup/sets/textile/set.js') }}"#}
{#type="text/javascript"></script>#}
{#<script src="{{ asset('bundles/sonatacore/vendor/moment/min/moment.min.js') }}"#}
{#type="text/javascript"></script>#}
{#<script src="{{ asset('bundles/sonatacore/vendor/eonasdan-bootstrap-datetimepicker/build/js/bootstrap-datetimepicker.min.js') }}"#}
{#type="text/javascript"></script>#}
{#{% endblock %}#}
{#{% block footer %}#}
{#{% endblock %}#}

@ -1,373 +0,0 @@
{#
This file is part of the Sonata package.
(c) Thomas Rabaix <thomas.rabaix@sonata-project.org>
For the full copyright and license information, please view the LICENSE
file that was distributed with this source code.
#}
{%- set _preview = block('preview') is defined ? block('preview')|trim : null %}
{% set _form = block('form') is defined ? block('form')|trim : null %}
{% set _show = block('show') is defined ? block('show')|trim : null %}
{% set _list_table = block('list_table') is defined ? block('list_table')|trim : null %}
{% set _list_filters = block('list_filters') is defined ? block('list_filters')|trim : null %}
{% set _tab_menu = block('tab_menu') is defined ? block('tab_menu')|trim : null %}
{% set _content = block('content') is defined ? block('content')|trim : null %}
{% set _title = block('title') is defined ? block('title')|trim : null %}
{% set _breadcrumb = block('breadcrumb') is defined ? block('breadcrumb')|trim : null %}
{% set _actions = block('actions') is defined ? block('actions')|trim : null %}
{% set _navbar_title = block('navbar_title') is defined ? block('navbar_title')|trim : null %}
{% set _list_filters_actions = block('list_filters_actions') is defined ? block('list_filters_actions')|trim : null -%}
<!DOCTYPE html>
<html {% block html_attributes %}class="no-js"{% endblock %}>
<head>
{% block meta_tags %}
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta charset="UTF-8">
<meta content='width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no' name='viewport'>
{% endblock %}
<meta data-sonata-admin='{{ {
config: {
CONFIRM_EXIT: sonata_admin.adminPool.getOption('confirm_exit'),
USE_SELECT2: sonata_admin.adminPool.getOption('use_select2'),
USE_ICHECK: sonata_admin.adminPool.getOption('use_icheck'),
USE_STICKYFORMS: sonata_admin.adminPool.getOption('use_stickyforms'),
},
translations: {
CONFIRM_EXIT: 'confirm_exit'|trans({}, 'SonataAdminBundle'),
},
}|json_encode()|raw }}'
>
{% block stylesheets %}
{% for stylesheet in sonata_admin.adminPool.getOption('stylesheets', []) %}
<link rel="stylesheet" href="{{ asset(stylesheet) }}">
{% endfor %}
{% endblock %}
{% block javascripts %}
{% block sonata_javascript_config %}
{% endblock %}
{% block sonata_javascript_pool %}
{% for javascript in sonata_admin.adminPool.getOption('javascripts', []) %}
<script src="{{ asset(javascript) }}"></script>
{% endfor %}
{% endblock %}
{# localize moment #}
{% set localeForMoment = canonicalize_locale_for_moment() %}
{% if localeForMoment %}
<script src="{{ asset(
'bundles/sonatacore/vendor/moment/locale/' ~
localeForMoment ~
'.js'
) }}"></script>
{% endif %}
{# localize select2 #}
{% if sonata_admin.adminPool.getOption('use_select2') %}
{% set localeForSelect2 = canonicalize_locale_for_select2() %}
{% if localeForSelect2 %}
<script src="{{ asset('bundles/sonatacore/vendor/select2/select2_locale_' ~ localeForSelect2 ~ '.js') }}"></script>
{% endif %}
{% endif %}
{% endblock %}
<title>
{% block sonata_head_title %}
{{ 'Admin'|trans({}, 'SonataAdminBundle') }}
{% if _title is not empty %}
{{ _title|striptags|raw }}
{% else %}
{% if action is defined %}
-
{% for menu in breadcrumbs_builder.breadcrumbs(admin, action) %}
{% if not loop.first %}
{% if loop.index != 2 %}
&gt;
{% endif %}
{%- set translation_domain = menu.extra('translation_domain', 'messages') -%}
{%- set label = menu.label -%}
{%- if translation_domain is not same as(false) -%}
{%- set label = label|trans(menu.extra('translation_params', {}), translation_domain) -%}
{%- endif -%}
{{ label }}
{% endif %}
{% endfor %}
{% endif %}
{% endif %}
{% endblock %}
</title>
</head>
<body
{% block body_attributes -%}
class="sonata-bc skin-black fixed
{% if app.request.cookies.get('sonata_sidebar_hide') -%}
sidebar-collapse
{%- endif -%}"
{%- endblock -%}
>
<div class="wrapper">
{% block sonata_header %}
<header class="main-header">
{% block sonata_header_noscript_warning %}
<noscript>
<div class="noscript-warning">
{{ 'noscript_warning'|trans({}, 'SonataAdminBundle') }}
</div>
</noscript>
{% endblock %}
{% block logo %}
{% apply spaceless %}
<a class="logo" href="{{ path('sonata_admin_dashboard') }}">
{% if 'single_image' == sonata_admin.adminPool.getOption('title_mode') or 'both' == sonata_admin.adminPool.getOption('title_mode') %}
<img src="{{ asset(sonata_admin.adminPool.titlelogo) }}" alt="{{ sonata_admin.adminPool.title }}">
{% endif %}
{% if 'single_text' == sonata_admin.adminPool.getOption('title_mode') or 'both' == sonata_admin.adminPool.getOption('title_mode') %}
<span>{{ sonata_admin.adminPool.title }}</span>
{% endif %}
</a>
{% endapply %}
{% endblock %}
{% block sonata_nav %}
<nav class="navbar navbar-static-top" role="navigation">
<a href="#" class="sidebar-toggle" data-toggle="offcanvas"
role="button" title="{{ 'toggle_navigation'|trans({}, 'SonataAdminBundle') }}">
<span class="sr-only">{{ 'toggle_navigation'|trans({}, 'SonataAdminBundle') }}</span>
</a>
<div class="navbar-left">
{% block sonata_breadcrumb %}
<div class="hidden-xs">
{% if _breadcrumb is not empty or action is defined %}
<ol class="nav navbar-top-links breadcrumb">
{% if _breadcrumb is empty %}
{% if action is defined %}
{% for menu in breadcrumbs_builder.breadcrumbs(admin, action) %}
{%- set translation_domain = menu.extra('translation_domain', 'messages') -%}
{%- set label = menu.label -%}
{%- if translation_domain is not same as(false) -%}
{%- set label = label|trans(menu.extra('translation_params', {}), translation_domain) -%}
{%- endif -%}
{% if not loop.last %}
<li>
{% if menu.uri is not empty %}
<a href="{{ menu.uri }}">
{% if menu.extra('safe_label', true) %}
{{- label|raw -}}
{% else %}
{{- label -}}
{% endif %}
</a>
{% else %}
<span>{{ label }}</span>
{% endif %}
</li>
{% else %}
<li class="active"><span>{{ label }}</span></li>
{% endif %}
{% endfor %}
{% endif %}
{% else %}
{{ _breadcrumb|raw }}
{% endif %}
</ol>
{% endif %}
</div>
{% endblock sonata_breadcrumb %}
</div>
{% block sonata_top_nav_menu %}
{% if app.user and is_granted(sonata_admin.adminPool.getOption('role_admin')) %}
<div class="navbar-custom-menu">
<ul class="nav navbar-nav">
{% block sonata_top_nav_menu_add_block %}
<li class="dropdown">
<a class="dropdown-toggle" data-toggle="dropdown" href="#">
<i class="fa fa-plus-square fa-fw" aria-hidden="true"></i> <i class="fa fa-caret-down" aria-hidden="true"></i>
</a>
{% include get_global_template('add_block') %}
</li>
{% endblock %}
{% block sonata_top_nav_menu_user_block %}
<li class="dropdown user-menu">
<a class="dropdown-toggle" data-toggle="dropdown" href="#">
<i class="fa fa-user fa-fw" aria-hidden="true"></i> <i class="fa fa-caret-down" aria-hidden="true"></i>
</a>
<ul class="dropdown-menu dropdown-user">
{% include get_global_template('user_block') %}
</ul>
</li>
{% endblock %}
</ul>
</div>
{% endif %}
{% endblock %}
</nav>
{% endblock sonata_nav %}
</header>
{% endblock sonata_header %}
{% block sonata_wrapper %}
{% block sonata_left_side %}
<aside class="main-sidebar">
<section class="sidebar">
{% block sonata_side_nav %}
{% block sonata_sidebar_search %}
{% if sonata_admin.adminPool.getOption('search') %}
<form action="{{ path('sonata_admin_search') }}" method="GET" class="sidebar-form" role="search">
<div class="input-group custom-search-form">
<input type="text" name="q" value="{{ app.request.get('q') }}" class="form-control" placeholder="{{ 'search_placeholder'|trans({}, 'SonataAdminBundle') }}">
<span class="input-group-btn">
<button class="btn btn-flat" type="submit">
<i class="fa fa-search" aria-hidden="true"></i>
</button>
</span>
</div>
</form>
{% endif %}
{% endblock sonata_sidebar_search %}
{% block side_bar_before_nav %} {% endblock %}
{% block side_bar_nav %}
{{ knp_menu_render('sonata_admin_sidebar', {template: get_global_template('knp_menu_template')}) }}
{% endblock side_bar_nav %}
{% block side_bar_after_nav %}
<p class="text-center small" style="border-top: 1px solid #444444; padding-top: 10px">
{% block side_bar_after_nav_content %}
{% endblock %}
</p>
{% endblock %}
{% endblock sonata_side_nav %}
</section>
</aside>
{% endblock sonata_left_side %}
<div class="content-wrapper">
{% block sonata_page_content %}
<section class="content-header">
{% block sonata_page_content_header %}
{% block sonata_page_content_nav %}
{% if _navbar_title is not empty
or _tab_menu is not empty
or _actions is not empty
or _list_filters_actions is not empty
%}
<nav class="navbar navbar-default" role="navigation">
<div class="container-fluid">
{% block tab_menu_navbar_header %}
{% if _navbar_title is not empty %}
<div class="navbar-header">
<a class="navbar-brand" href="#">{{ _navbar_title|raw }}</a>
</div>
{% endif %}
{% endblock %}
<div class="navbar-collapse">
{% if _tab_menu is not empty %}
<div class="navbar-left">
{{ _tab_menu|raw }}
</div>
{% endif %}
{% if admin is defined and action is defined and action == 'list' and admin.listModes|length > 1 %}
<div class="nav navbar-right btn-group">
{% for mode, settings in admin.listModes %}
<a href="{{ admin.generateUrl('list', app.request.query.all|merge({_list_mode: mode})) }}" class="btn btn-default navbar-btn btn-sm{% if admin.getListMode() == mode %} active{% endif %}"><i class="{{ settings.class }}"></i></a>
{% endfor %}
</div>
{% endif %}
{% block sonata_admin_content_actions_wrappers %}
{% if _actions|replace({ '<li>': '', '</li>': '' })|trim is not empty %}
<ul class="nav navbar-nav navbar-right">
{% if _actions|split('</a>')|length > 2 %}
<li class="dropdown sonata-actions">
<a href="#" class="dropdown-toggle" data-toggle="dropdown">{{ 'link_actions'|trans({}, 'SonataAdminBundle') }} <b class="caret"></b></a>
<ul class="dropdown-menu" role="menu">
{{ _actions|raw }}
</ul>
</li>
{% else %}
{{ _actions|raw }}
{% endif %}
</ul>
{% endif %}
{% endblock sonata_admin_content_actions_wrappers %}
{% if _list_filters_actions is not empty %}
{{ _list_filters_actions|raw }}
{% endif %}
</div>
</div>
</nav>
{% endif %}
{% endblock sonata_page_content_nav %}
{% endblock sonata_page_content_header %}
</section>
<section class="content">
{% block sonata_admin_content %}
{% block notice %}
{% include '@SonataCore/FlashMessage/render.html.twig' %}
{% endblock notice %}
{% if _preview is not empty %}
<div class="sonata-ba-preview">{{ _preview|raw }}</div>
{% endif %}
{% if _content is not empty %}
<div class="sonata-ba-content">{{ _content|raw }}</div>
{% endif %}
{% if _show is not empty %}
<div class="sonata-ba-show">{{ _show|raw }}</div>
{% endif %}
{% if _form is not empty %}
<div class="sonata-ba-form">{{ _form|raw }}</div>
{% endif %}
{% if _list_filters is not empty %}
<div class="row">
{{ _list_filters|raw }}
</div>
{% endif %}
{% if _list_table is not empty %}
<div class="row">
{{ _list_table|raw }}
</div>
{% endif %}
{% endblock sonata_admin_content %}
</section>
{% endblock sonata_page_content %}
</div>
{% endblock sonata_wrapper %}
</div>
{% if sonata_admin.adminPool.getOption('use_bootlint') %}
{% block bootlint %}
{# Bootlint - https://github.com/twbs/bootlint#in-the-browser #}
<script type="text/javascript">
javascript:(function(){var s=document.createElement("script");s.onload=function(){bootlint.showLintReportForCurrentDocument([], {hasProblems: false, problemFree: false});};s.src="https://maxcdn.bootstrapcdn.com/bootlint/latest/bootlint.min.js";document.body.appendChild(s)})();
</script>
{% endblock %}
{% endif %}
</body>
</html>

@ -1,14 +0,0 @@
<?php
/* For licensing terms, see /license.txt */
namespace Chamilo\ClassificationBundle;
use Symfony\Component\HttpKernel\Bundle\Bundle;
/**
* Class ChamiloClassificationBundle.
*/
class ChamiloClassificationBundle extends Bundle
{
}

@ -1,40 +0,0 @@
<?php
/**
* This file is part of the <name> project.
*
* (c) <yourname> <youremail>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Chamilo\ClassificationBundle\Document;
use Sonata\ClassificationBundle\Document\BaseCategory as BaseCategory;
/**
* This file has been generated by the EasyExtends bundle ( http://sonata-project.org/bundles/easy-extends ).
*
* References :
* working with object : http://www.doctrine-project.org/docs/mongodb_odm/1.0/en/reference/working-with-objects.html
*
* @author <yourname> <youremail>
*/
class Category extends BaseCategory
{
/**
* @var int
*/
protected $id;
/**
* Get id.
*
* @return int
*/
public function getId()
{
return $this->id;
}
}

@ -1,40 +0,0 @@
<?php
/**
* This file is part of the <name> project.
*
* (c) <yourname> <youremail>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Chamilo\ClassificationBundle\Document;
use Sonata\ClassificationBundle\Document\BaseTag as BaseTag;
/**
* This file has been generated by the EasyExtends bundle ( http://sonata-project.org/bundles/easy-extends ).
*
* References :
* working with object : http://www.doctrine-project.org/docs/mongodb_odm/1.0/en/reference/working-with-objects.html
*
* @author <yourname> <youremail>
*/
class Tag extends BaseTag
{
/**
* @var int
*/
protected $id;
/**
* Get id.
*
* @return int
*/
public function getId()
{
return $this->id;
}
}

@ -1,26 +0,0 @@
<?php
/* For licensing terms, see /license.txt */
namespace Chamilo\ClassificationBundle\Entity;
use Sonata\ClassificationBundle\Entity\BaseCategory;
/**
* Class Category.
*/
class Category extends BaseCategory
{
/**
* @var int
*/
protected $id;
/**
* Get id.
*/
public function getId(): int
{
return $this->id;
}
}

@ -1,26 +0,0 @@
<?php
/* For licensing terms, see /license.txt */
namespace Chamilo\ClassificationBundle\Entity;
use Sonata\ClassificationBundle\Entity\BaseCollection;
/**
* Class Collection.
*/
class Collection extends BaseCollection
{
/**
* @var int
*/
protected $id;
/**
* Get id.
*/
public function getId(): int
{
return $this->id;
}
}

@ -1,28 +0,0 @@
<?php
/* For licensing terms, see /license.txt */
namespace Chamilo\ClassificationBundle\Entity;
use Sonata\ClassificationBundle\Entity\BaseContext;
/**
* Class Context.
*/
class Context extends BaseContext
{
/**
* @var int
*/
protected $id;
/**
* Get id.
*
* @return int
*/
public function getId()
{
return $this->id;
}
}

@ -1,26 +0,0 @@
<?php
/* For licensing terms, see /license.txt */
namespace Chamilo\ClassificationBundle\Entity;
use Sonata\ClassificationBundle\Entity\BaseTag;
/**
* Class Tag.
*/
class Tag extends BaseTag
{
/**
* @var int
*/
protected $id;
/**
* Get id.
*/
public function getId(): int
{
return $this->id;
}
}

@ -1,27 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<doctrine-mapping
xmlns="http://doctrine-project.org/schemas/orm/doctrine-mapping"
xsi="http://www.w3.org/2001/XMLSchema-instance"
schemaLocation="http://doctrine-project.org/schemas/orm/doctrine-mapping http://doctrine-project.org/schemas/orm/doctrine-mapping.xsd">
<!--
This file has been generated by the EasyExtends bundle ( http://sonata-project.org/easy-extends )
References :
xsd : https://github.com/doctrine/doctrine2/blob/master/doctrine-mapping.xsd
xml mapping : http://www.doctrine-project.org/projects/orm/2.0/docs/reference/xml-mapping/en
association mapping : http://www.doctrine-project.org/projects/orm/2.0/docs/reference/association-mapping/en
-->
<entity
name="Chamilo\ClassificationBundle\Entity\Category"
table="classification__category"
repository-class="Doctrine\ORM\EntityRepository">
<id name="id" type="integer" column="id">
<generator strategy="AUTO"/>
</id>
<options>
<option name="row_format">DYNAMIC</option>
</options>
</entity>
</doctrine-mapping>

@ -1,32 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<doctrine-mapping
xmlns="http://doctrine-project.org/schemas/orm/doctrine-mapping"
xsi="http://www.w3.org/2001/XMLSchema-instance"
schemaLocation="http://doctrine-project.org/schemas/orm/doctrine-mapping http://doctrine-project.org/schemas/orm/doctrine-mapping.xsd">
<!--
This file has been generated by the EasyExtends bundle ( http://sonata-project.org/easy-extends )
References :
xsd : https://github.com/doctrine/doctrine2/blob/master/doctrine-mapping.xsd
xml mapping : http://www.doctrine-project.org/projects/orm/2.0/docs/reference/xml-mapping/en
association mapping : http://www.doctrine-project.org/projects/orm/2.0/docs/reference/association-mapping/en
-->
<entity
name="Chamilo\ClassificationBundle\Entity\Collection"
table="classification__collection"
repository-class="Doctrine\ORM\EntityRepository">
<id name="id" type="integer" column="id">
<generator strategy="AUTO"/>
</id>
<attribute-overrides>
<attribute-override name="slug">
<field column="slug" length="190" unique="true" type="string" />
</attribute-override>
</attribute-overrides>
<options>
<option name="row_format">DYNAMIC</option>
</options>
</entity>
</doctrine-mapping>

@ -1,27 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<doctrine-mapping
xmlns="http://doctrine-project.org/schemas/orm/doctrine-mapping"
xsi="http://www.w3.org/2001/XMLSchema-instance"
schemaLocation="http://doctrine-project.org/schemas/orm/doctrine-mapping http://doctrine-project.org/schemas/orm/doctrine-mapping.xsd">
<!--
This file has been generated by the EasyExtends bundle ( https://sonata-project.org/easy-extends )
References :
xsd : https://github.com/doctrine/doctrine2/blob/master/doctrine-mapping.xsd
xml mapping : http://www.doctrine-project.org/projects/orm/2.0/docs/reference/xml-mapping/en
association mapping : http://www.doctrine-project.org/projects/orm/2.0/docs/reference/association-mapping/en
-->
<entity
name="Chamilo\ClassificationBundle\Entity\Context"
table="classification__context"
repository-class="Doctrine\ORM\EntityRepository">
<id name="id" type="string" column="id">
<generator strategy="NONE"/>
</id>
<options>
<option name="row_format">DYNAMIC</option>
</options>
</entity>
</doctrine-mapping>

@ -1,32 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<doctrine-mapping
xmlns="http://doctrine-project.org/schemas/orm/doctrine-mapping"
xsi="http://www.w3.org/2001/XMLSchema-instance"
schemaLocation="http://doctrine-project.org/schemas/orm/doctrine-mapping http://doctrine-project.org/schemas/orm/doctrine-mapping.xsd">
<!--
This file has been generated by the EasyExtends bundle ( http://sonata-project.org/easy-extends )
References :
xsd : https://github.com/doctrine/doctrine2/blob/master/doctrine-mapping.xsd
xml mapping : http://www.doctrine-project.org/projects/orm/2.0/docs/reference/xml-mapping/en
association mapping : http://www.doctrine-project.org/projects/orm/2.0/docs/reference/association-mapping/en
-->
<entity
name="Chamilo\ClassificationBundle\Entity\Tag"
table="classification__tag"
repository-class="Doctrine\ORM\EntityRepository">
<id name="id" type="integer" column="id">
<generator strategy="AUTO"/>
</id>
<attribute-overrides>
<attribute-override name="slug">
<field column="slug" length="190" unique="true" type="string" />
</attribute-override>
</attribute-overrides>
<options>
<option name="row_format">DYNAMIC</option>
</options>
</entity>
</doctrine-mapping>

@ -1,17 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<serializer>
<!--
This file has been generated by the EasyExtends bundle ( http://sonata-project.org/bundles/easy-extends )
@author <yourname> <youremail>
-->
<class name="Chamilo\ClassificationBundle\Document\Category"
exclusion-policy="all" xml-root-name="_category">
<property xml-attribute-map="true" name="id" type="integer"
expose="true" since-version="1.0"
groups="sonata_api_read,sonata_api_write,sonata_search"/>
</class>
</serializer>

@ -1,17 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<serializer>
<!--
This file has been generated by the EasyExtends bundle ( http://sonata-project.org/bundles/easy-extends )
@author <yourname> <youremail>
-->
<class name="Chamilo\ClassificationBundle\Document\Tag"
exclusion-policy="all" xml-root-name="_tag">
<property xml-attribute-map="true" name="id" type="integer"
expose="true" since-version="1.0"
groups="sonata_api_read,sonata_api_write,sonata_search"/>
</class>
</serializer>

@ -1,17 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<serializer>
<!--
This file has been generated by the EasyExtends bundle ( http://sonata-project.org/bundles/easy-extends )
@author <yourname> <youremail>
-->
<class name="Chamilo\ClassificationBundle\Entity\Category"
exclusion-policy="all" xml-root-name="_category">
<property xml-attribute-map="true" name="id" type="integer"
expose="true" since-version="1.0"
groups="sonata_api_read,sonata_api_write,sonata_search"/>
</class>
</serializer>

@ -1,17 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<serializer>
<!--
This file has been generated by the EasyExtends bundle ( http://sonata-project.org/bundles/easy-extends )
@author <yourname> <youremail>
-->
<class name="Chamilo\ClassificationBundle\Entity\Collection"
exclusion-policy="all" xml-root-name="_collection">
<property xml-attribute-map="true" name="id" type="integer"
expose="true" since-version="1.0"
groups="sonata_api_read,sonata_api_write,sonata_search"/>
</class>
</serializer>

@ -1,17 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<serializer>
<!--
This file has been generated by the EasyExtends bundle ( http://sonata-project.org/bundles/easy-extends )
@author <yourname> <youremail>
-->
<class name="Chamilo\ClassificationBundle\Entity\Context"
exclusion-policy="all" xml-root-name="_context">
<property xml-attribute-map="true" name="id" type="integer"
expose="true" since-version="1.0"
groups="sonata_api_read,sonata_api_write,sonata_search"/>
</class>
</serializer>

@ -1,17 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<serializer>
<!--
This file has been generated by the EasyExtends bundle ( http://sonata-project.org/bundles/easy-extends )
@author <yourname> <youremail>
-->
<class name="Chamilo\ClassificationBundle\Entity\Tag" exclusion-policy="all"
xml-root-name="_tag">
<property xml-attribute-map="true" name="id" type="integer"
expose="true" since-version="1.0"
groups="sonata_api_read,sonata_api_write,sonata_search"/>
</class>
</serializer>

@ -1,44 +0,0 @@
<?php
/* For licensing terms, see /license.txt */
namespace Chamilo\ContactBundle\Admin;
use A2lix\TranslationFormBundle\Form\Type\TranslationsType;
use Sonata\AdminBundle\Admin\AbstractAdmin;
use Sonata\AdminBundle\Datagrid\DatagridMapper;
use Sonata\AdminBundle\Datagrid\ListMapper;
use Sonata\AdminBundle\Form\FormMapper;
/**
* Class UserAdmin.
*/
class CategoryAdmin extends AbstractAdmin
{
protected function configureListFields(ListMapper $listMapper)
{
$listMapper
//->add('headline', null, array('identifier' => true))
//->add('name', null, array('identifier' => true))
->add('translations', null, ['identifier' => true])
->add('email', null, ['identifier' => true])
;
}
protected function configureFormFields(FormMapper $formMapper)
{
$formMapper
//->add('name')
->add('translations', TranslationsType::class, [])
->add('email')
;
}
protected function configureDatagridFilters(DatagridMapper $datagridMapper)
{
$datagridMapper
->add('translations', null, ['identifier' => true])
->add('email', null, ['identifier' => true])
;
}
}

@ -1,14 +0,0 @@
<?php
/* For licensing terms, see /license.txt */
namespace Chamilo\ContactBundle;
use Symfony\Component\HttpKernel\Bundle\Bundle;
/**
* Class ChamiloContactBundle.
*/
class ChamiloContactBundle extends Bundle
{
}

@ -1,88 +0,0 @@
<?php
/* For licensing terms, see /license.txt */
namespace Chamilo\ContactBundle\Controller;
use Chamilo\ContactBundle\Entity\Category;
use Chamilo\ContactBundle\Form\Type\ContactType;
use Chamilo\UserBundle\Entity\User;
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\Mailer\MailerInterface;
use Symfony\Component\Mime\Email;
use Symfony\Component\Routing\Annotation\Route;
/**
* Class ContactController.
*
* @Route("/")
*/
class ContactController extends AbstractController
{
/**
* @Route("/", name="contact")
*/
public function indexAction(Request $request, MailerInterface $mailer)
{
/** @var User $user */
$user = $this->getUser();
$data = [];
if ($user) {
$data = [
'firstname' => $user->getFirstname(),
'lastname' => $user->getFirstname(),
'email' => $user->getEmail(),
];
}
$form = $this->createForm(ContactType::class, $data);
if ($request->isMethod('POST')) {
$form->bind($request);
$em = $this->getDoctrine()->getManager();
$category = $form->get('category')->getData();
/** @var Category $category */
$category = $em->getRepository('ChamiloContactBundle:Category')->find($category);
if ($form->isValid()) {
$message = new Email();
$message->subject($form->get('subject')->getData())
->from($form->get('email')->getData())
->to($category->getEmail())
->setBody(
$this->renderView(
'@ChamiloContact/contact.html.twig',
[
'ip' => $request->getClientIp(),
'firstname' => $form->get('firstname')->getData(),
'lastname' => $form->get('lastname')->getData(),
'subject' => $form->get('subject')->getData(),
'email' => $form->get('email')->getData(),
'message' => $form->get('message')->getData(),
]
)
);
$mailer->send($message);
$this->addFlash(
'success',
$this->get('translator')->trans('Your email has been sent! Thanks!')
);
return $this->redirect($this->generateUrl('contact'));
}
}
return $this->render(
'@ChamiloContact/index.html.twig',
[
'form' => $form->createView(),
]
);
}
}

@ -1,24 +0,0 @@
<?php
/* For licensing terms, see /license.txt */
namespace Chamilo\ContactBundle\DependencyInjection;
use Symfony\Component\Config\FileLocator;
use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\DependencyInjection\Loader;
use Symfony\Component\HttpKernel\DependencyInjection\Extension;
/**
* This is the class that loads and manages your bundle configuration.
*
* To learn more see {@link http://symfony.com/doc/current/cookbook/bundles/extension.html}
*/
class ChamiloContactExtension extends Extension
{
public function load(array $configs, ContainerBuilder $container)
{
$loader = new Loader\YamlFileLoader($container, new FileLocator(__DIR__.'/../Resources/config'));
$loader->load('admin.yml');
}
}

@ -1,120 +0,0 @@
<?php
/* For licensing terms, see /license.txt */
namespace Chamilo\ContactBundle\Entity;
use Doctrine\ORM\Mapping as ORM;
use Knp\DoctrineBehaviors\Contract\Entity\TranslatableInterface;
use Knp\DoctrineBehaviors\Model\Translatable\TranslatableTrait;
/**
* Class Category.
*
* @ORM\Entity
* @ORM\Table(name="contact_category")
*/
class Category implements TranslatableInterface
{
use TranslatableTrait;
/**
* @var int
*
* @ORM\Column(name="id", type="integer")
* @ORM\Id
* @ORM\GeneratedValue()
*/
protected $id;
/**
* @var string
*
* @ORM\Column(name="name", type="string", nullable=false)
*/
protected $name;
/**
* @var string
*
* @ORM\Column(name="email", type="string")
*/
protected $email;
/**
* @param $method
* @param $arguments
*/
public function __call($method, $arguments)
{
return $this->proxyCurrentLocaleTranslation($method, $arguments);
}
/**
* @return string
*/
public function __toString()
{
return (string) $this->getName();
}
/**
* @return string
*/
public function getName()
{
return $this->name;
}
/**
* @param string $name
*
* @return Category
*/
public function setName($name)
{
$this->name = $name;
return $this;
}
/**
* @return string
*/
public function getEmail()
{
return $this->email;
}
/**
* @param string $email
*
* @return Category
*/
public function setEmail($email)
{
$this->email = $email;
return $this;
}
/**
* @return int
*/
public function getId()
{
return $this->id;
}
/**
* @param int $id
*
* @return Category
*/
public function setId($id)
{
$this->id = $id;
return $this;
}
}

@ -1,70 +0,0 @@
<?php
/* For licensing terms, see /license.txt */
namespace Chamilo\ContactBundle\Entity;
use Doctrine\ORM\Mapping as ORM;
use Knp\DoctrineBehaviors\Contract\Entity\TranslationInterface;
use Knp\DoctrineBehaviors\Model\Translatable\TranslationTrait;
/**
* Class CategoryTranslation.
*
* @ORM\Entity
* @ORM\Table(
* name="contact_category_translation",
* options={"row_format":"DYNAMIC"}
* )
*/
class CategoryTranslation implements TranslationInterface
{
use TranslationTrait;
/**
* @var int
*
* @ORM\Column(name="id", type="integer")
* @ORM\Id
* @ORM\GeneratedValue()
*/
protected $id;
/**
* @ORM\Column(type="string", length=255, nullable=false)
*/
protected $name;
/**
* @var string
*
* @ORM\Column(type="string", length=190, nullable=false)
*/
protected $locale;
/**
* @return string
*/
public function __toString()
{
return (string) $this->name;
}
/**
* @return string
*/
public function getName()
{
return $this->name;
}
/**
* @return CategoryTranslation
*/
public function setName($name)
{
$this->name = $name;
return $this;
}
}

@ -1,9 +0,0 @@
<?php
/* For licensing terms, see /license.txt */
namespace Chamilo\ContactBundle\Entity;
class Contact
{
}

@ -1,72 +0,0 @@
<?php
/* For licensing terms, see /license.txt */
namespace Chamilo\ContactBundle\Form\Type;
use Symfony\Bridge\Doctrine\Form\Type\EntityType;
use Symfony\Component\Form\AbstractType;
use Symfony\Component\Form\Extension\Core\Type\SubmitType;
use Symfony\Component\Form\Extension\Core\Type\TextareaType;
use Symfony\Component\Form\FormBuilderInterface;
use Symfony\Component\OptionsResolver\OptionsResolverInterface;
use Symfony\Component\Validator\Constraints\Collection;
use Symfony\Component\Validator\Constraints\Email;
use Symfony\Component\Validator\Constraints\Length;
use Symfony\Component\Validator\Constraints\NotBlank;
/**
* Class ContactType.
*/
class ContactType extends AbstractType
{
public function buildForm(FormBuilderInterface $builder, array $options)
{
$builder
->add(
'category',
EntityType::class,
['class' => 'Chamilo\ContactBundle\Entity\Category']
)
->add('firstname')
->add('lastname')
->add('email')
->add('subject')
->add('message', TextareaType::class)
->add('send', SubmitType::class, ['attr' => ['class' => 'btn btn-primary']])
;
}
public function setDefaultOptions(OptionsResolverInterface $resolver)
{
$collectionConstraint = new Collection([
'category' => [
new NotBlank(['message' => 'Category should not be blank.']),
],
'firstname' => [
new NotBlank(['message' => 'Firstname should not be blank.']),
new Length(['min' => 2]),
],
'lastname' => [
new NotBlank(['message' => 'Lastname should not be blank.']),
new Length(['min' => 2]),
],
'email' => [
new NotBlank(['message' => 'Email should not be blank.']),
new Email(['message' => 'Invalid email address.']),
],
'subject' => [
new NotBlank(['message' => 'Subject should not be blank.']),
new Length(['min' => 3]),
],
'message' => [
new NotBlank(['message' => 'Message should not be blank.']),
new Length(['min' => 5]),
],
]);
$resolver->setDefaults([
'constraints' => $collectionConstraint,
]);
}
}

@ -1,9 +0,0 @@
services:
sonata.admin.contact_category:
class: Chamilo\ContactBundle\Admin\CategoryAdmin
tags:
- {name: sonata.admin, manager_type: orm, group: "LMS", label: "Contact category"}
arguments:
- ~
- Chamilo\ContactBundle\Entity\Category
- ~

@ -1,3 +0,0 @@
contact:
resource: "@ChamiloContactBundle/Controller/ContactController.php"
type: annotation

@ -1,29 +0,0 @@
msgid "Category"
msgstr "Kategorie"
msgid "Firstname"
msgstr "Vorname"
msgid "Lastname"
msgstr "Nachname"
msgid "Email"
msgstr "E-mail"
msgid "Subject"
msgstr "Betreff"
msgid "Message"
msgstr "Nachricht"
msgid "Send"
msgstr "Senden"
msgid "You had a new message from %url%"
msgstr "Sie haben eine neue Nachricht erhalten von %url%"
msgid "Your email has been sent! Thanks!"
msgstr "Ihre Nachricht wurde versendet. Vielen Dank !"
msgid "Contact"
msgstr "Kontakt"

@ -1,26 +0,0 @@
msgid "Category"
msgstr "Categoría"
msgid "Firstname"
msgstr "Apellidos"
msgid "Lastname"
msgstr "Nombre"
msgid "Email"
msgstr "Correo electrónico"
msgid "Subject"
msgstr "Asunto"
msgid "Message"
msgstr "Mensaje"
msgid "Send"
msgstr "Enviar"
msgid "You had a new message from %url%"
msgstr "Ha recibido un nuevo mensaje de %url%"
msgid "Your email has been sent! Thanks!"
msgstr "Su mensaje ha sido enviado! Gracias!"

@ -1,29 +0,0 @@
msgid "Category"
msgstr "Catégorie"
msgid "Firstname"
msgstr "Prénom"
msgid "Lastname"
msgstr "Nom"
msgid "Email"
msgstr "E-mail"
msgid "Subject"
msgstr "Sujet"
msgid "Message"
msgstr "Message"
msgid "Send"
msgstr "Envoyer"
msgid "You had a new message from %url%"
msgstr "Un nouveau message vous a été envoyé depuis %url%"
msgid "Your email has been sent! Thanks!"
msgstr "Votre message a été envoyé. Merci !"
msgid "Contact"
msgstr "Contact"

@ -1,11 +0,0 @@
{{ 'You had a new message from %url%' | trans({'%url%': url(app.request.attributes.get('_route'))} ) }}
{{ 'Firstname' | trans }} : {{ firstname }}
{{ 'Lastname' | trans }} : {{ lastname }}
Email: {{ email }}
IP: {{ ip }}
{{ 'Subject' | trans }} : {{ subject }}
{{ 'Message' | trans }} :
{{ message|raw }}

@ -1,13 +0,0 @@
{% extends "@ChamiloTheme/Layout/base-layout.html.twig" %}
{% block chamilo_content %}
<section id="main_content">
<div class="page-header">
<h2>{{ 'Contact' | trans }}</h2>
</div>
{{ form_start(form) }}
{{ form_widget(form, {'attr': {'class': ''}}) }}
{{ form_end(form) }}
</section>
{% endblock %}

@ -1,65 +0,0 @@
<?php
/* For licensing terms, see /license.txt */
namespace Chamilo\FaqBundle\Admin;
use A2lix\TranslationFormBundle\Form\Type\TranslationsType;
use Sonata\AdminBundle\Admin\AbstractAdmin;
use Sonata\AdminBundle\Datagrid\DatagridMapper;
use Sonata\AdminBundle\Datagrid\ListMapper;
use Sonata\AdminBundle\Form\FormMapper;
/**
* Class QuestionAdmin.
*/
class CategoryAdmin extends AbstractAdmin
{
protected $datagridValues = [
'_page' => 1,
'_sort_by' => 'created_at',
'_sort_order' => 'Desc',
];
protected function configureDatagridFilters(DatagridMapper $datagridMapper)
{
$datagridMapper
//->add('headline')
//->add('body')
->add('rank')
->add('isActive')
;
}
protected function configureListFields(ListMapper $listMapper)
{
$listMapper
//->add('headline', null, array('identifier' => true))
->add('translations', null, ['identifier' => true])
->add('rank')
->add(
'_action',
'actions',
[
'actions' => [
//'show' => array(),
'preview' => ['template' => 'ChamiloFaqBundle:Faq:preview_category_partial.html.twig'],
'edit' => [],
'delete' => [],
],
]
)
;
}
protected function configureFormFields(FormMapper $formMapper)
{
$formMapper
->add('translations', TranslationsType::class, [])
->add('rank', null, ['required' => false])
// ->add('slug')
->add('isActive')
->end()
;
}
}

@ -1,71 +0,0 @@
<?php
/* For licensing terms, see /license.txt */
namespace Chamilo\FaqBundle\Admin;
use A2lix\TranslationFormBundle\Form\Type\TranslationsType;
use Sonata\AdminBundle\Admin\AbstractAdmin;
use Sonata\AdminBundle\Datagrid\DatagridMapper;
use Sonata\AdminBundle\Datagrid\ListMapper;
use Sonata\AdminBundle\Form\FormMapper;
/**
* Class QuestionAdmin.
*/
class QuestionAdmin extends AbstractAdmin
{
protected $datagridValues = [
'_page' => 1,
'_sort_by' => 'issueDate',
'_sort_order' => 'Desc',
];
protected function configureDatagridFilters(DatagridMapper $datagridMapper)
{
$datagridMapper
->add('id')
->add('isActive')
;
}
protected function configureListFields(ListMapper $listMapper)
{
$listMapper
->addIdentifier('id')
->add('translations', null, ['identifier' => true])
->add('Category')
->add('rank')
->add(
'_action',
'actions',
[
'actions' => [
//'show' => array(),
'preview' => ['template' => 'ChamiloFaqBundle:Faq:preview_question_partial.html.twig'],
'edit' => [],
'delete' => [],
],
]
);
}
protected function configureFormFields(FormMapper $formMapper)
{
$formMapper
->add('translations', TranslationsType::class, [])
->add(
'category',
null,
[
'expanded' => true,
'required' => true,
'attr' => ['class' => 'radio-list vertical'],
]
)
->add('rank', null, ['required' => false])
->add('onlyAuthUsers')
->add('isActive')
->end();
}
}

@ -1,16 +0,0 @@
<?php
/* For licensing terms, see /license.txt */
namespace Chamilo\FaqBundle;
use Symfony\Component\HttpKernel\Bundle\Bundle;
/**
* Class ChamiloFaqBundle.
*
* Based in GenjFaqBundle
*/
class ChamiloFaqBundle extends Bundle
{
}

@ -1,188 +0,0 @@
<?php
/* For licensing terms, see /license.txt */
namespace Chamilo\FaqBundle\Controller;
use Chamilo\FaqBundle\Entity\Category;
use Chamilo\FaqBundle\Entity\CategoryRepository;
use Chamilo\FaqBundle\Entity\Question;
use Chamilo\FaqBundle\Entity\QuestionRepository;
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
/**
* Class FaqController.
*/
class FaqController extends AbstractController
{
/**
* Default index. Shows one category/question at a time. If you want to just show everything at once, use the
* indexWithoutCollapse action instead.
*
* @param string $categorySlug
* @param string $questionSlug
*
* @throws \Symfony\Component\HttpKernel\Exception\NotFoundHttpException
*
* @return \Symfony\Component\HttpFoundation\Response
*/
public function indexAction($categorySlug, $questionSlug)
{
if (!$categorySlug || !$questionSlug) {
$redirect = $this->generateRedirectToDefaultSelection($categorySlug, $questionSlug);
if ($redirect) {
return $redirect;
}
}
// Otherwise get the selected category and/or question as usual
$questions = [];
$categories = $this->getCategoryRepository()->retrieveActive();
$selectedCategory = $this->getSelectedCategory($categorySlug);
$selectedQuestion = $this->getSelectedQuestion($questionSlug);
if ($selectedCategory) {
$questions = $selectedCategory->getQuestions();
}
// Throw 404 if there is no category in the database
if (!$categories) {
throw $this->createNotFoundException('You need at least 1 active faq category in the database');
}
return $this->render(
'@ChamiloFaq/Faq/index.html.twig',
[
'categories' => $categories,
'questions' => $questions,
'selectedCategory' => $selectedCategory,
'selectedQuestion' => $selectedQuestion,
]
);
}
/**
* Index without any collapsing. Will just show all categories and questions at once.
*
* @param string $categorySlug
*
* @throws \Symfony\Component\HttpKernel\Exception\NotFoundHttpException
*
* @return \Symfony\Component\HttpFoundation\Response
*/
public function indexWithoutCollapseAction($categorySlug)
{
if ($categorySlug) {
$categories = $this->getCategoryRepository()->retrieveActiveBySlug($categorySlug);
} else {
$categories = $this->getCategoryRepository()->retrieveActive();
}
if (!$categories) {
throw $this->createNotFoundException('Faq category not found');
}
return $this->render(
'@ChamiloFaq/Faq/index_without_collapse.html.twig',
[
'categories' => $categories,
'categorySlug' => $categorySlug,
]
);
}
/**
* Open first category or question if none was selected so far.
*
* @param string $categorySlug
* @param string $questionSlug
*
* @throws \Symfony\Component\HttpKernel\Exception\NotFoundHttpException
*
* @return \Symfony\Component\HttpFoundation\RedirectResponse
*/
protected function generateRedirectToDefaultSelection($categorySlug, $questionSlug)
{
$doRedirect = false;
//$config = $this->container->getParameter('faq');
$config = [];
$config['select_first_category_by_default'] = false;
$config['select_first_question_by_default'] = false;
if (!$categorySlug && $config['select_first_category_by_default']) {
$firstCategory = $this->getCategoryRepository()->retrieveFirst();
if ($firstCategory instanceof Category) {
$categorySlug = $firstCategory->getSlug();
$doRedirect = true;
} else {
throw $this->createNotFoundException('Tried to open the first faq category by default, but there was none.');
}
}
if (!$questionSlug && $config['select_first_question_by_default']) {
$firstQuestion = $this->getQuestionRepository()->retrieveFirstByCategorySlug($categorySlug);
if ($firstQuestion instanceof Question) {
$questionSlug = $firstQuestion->getSlug();
$doRedirect = true;
} else {
throw $this->createNotFoundException('Tried to open the first faq question by default, but there was none.');
}
}
if ($doRedirect) {
return $this->redirect(
$this->generateUrl('faq', ['categorySlug' => $categorySlug, 'questionSlug' => $questionSlug], true)
);
}
return false;
}
/**
* @param string $questionSlug
*
* @return Question
*/
protected function getSelectedQuestion($questionSlug = null)
{
$selectedQuestion = null;
if (null !== $questionSlug) {
$selectedQuestion = $this->getQuestionRepository()->getQuestionBySlug($questionSlug);
}
return $selectedQuestion;
}
/**
* @param string $categorySlug
*
* @return Category
*/
protected function getSelectedCategory($categorySlug = null)
{
$selectedCategory = null;
if (null !== $categorySlug) {
$selectedCategory = $this->getCategoryRepository()->getCategoryActiveBySlug($categorySlug);
}
return $selectedCategory;
}
/**
* @return QuestionRepository
*/
protected function getQuestionRepository()
{
return $this->container->get('faq.entity.question_repository');
}
/**
* @return CategoryRepository
*/
protected function getCategoryRepository()
{
return $this->container->get('faq.entity.category_repository');
}
}

@ -1,25 +0,0 @@
<?php
/* For licensing terms, see /license.txt */
namespace Chamilo\FaqBundle\DependencyInjection;
use Symfony\Component\Config\FileLocator;
use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\DependencyInjection\Loader;
use Symfony\Component\HttpKernel\DependencyInjection\Extension;
/**
* This is the class that loads and manages your bundle configuration.
*
* To learn more see {@link http://symfony.com/doc/current/cookbook/bundles/extension.html}
*/
class ChamiloFaqExtension extends Extension
{
public function load(array $configs, ContainerBuilder $container)
{
$loader = new Loader\YamlFileLoader($container, new FileLocator(__DIR__.'/../Resources/config'));
$loader->load('admin.yml');
$loader->load('services.yml');
}
}

@ -1,179 +0,0 @@
<?php
/* For licensing terms, see /license.txt */
namespace Chamilo\FaqBundle\Entity;
use Doctrine\ORM\Mapping as ORM;
use Gedmo\Mapping\Annotation as Gedmo;
use Gedmo\Timestampable\Traits\TimestampableEntity;
use Knp\DoctrineBehaviors\Contract\Entity\TranslatableInterface;
use Knp\DoctrineBehaviors\Model\Translatable\TranslatableTrait;
/**
* Class Category.
*
* @ORM\Entity(repositoryClass="Chamilo\FaqBundle\Repository\CategoryRepository")
* @ORM\Table(
* name="faq_category",
* indexes={@ORM\Index(name="is_active_idx", columns={"is_active"})}
* )
*/
class Category implements TranslatableInterface
{
use TimestampableEntity;
use TranslatableTrait;
/**
* @ORM\Column(type="integer")
* @ORM\Id
* @ORM\GeneratedValue(strategy="AUTO")
*/
protected $id;
/**
* @ORM\OneToMany(targetEntity="Question", mappedBy="category")
*/
protected $questions;
/**
* @Gedmo\SortablePosition
*
* @ORM\Column(name="`rank`", type="integer")
*/
protected $rank;
/**
* @ORM\Column(name="is_active", type="boolean")
*/
protected $isActive;
/**
* @param $method
* @param $arguments
*/
public function __call($method, $arguments)
{
return $this->proxyCurrentLocaleTranslation($method, $arguments);
}
/**
* Returns a string representation of this object.
*
* @return string
*/
public function __toString()
{
return (string) $this->getHeadline();
}
/**
* Get id.
*
* @return int
*/
public function getId()
{
return $this->id;
}
/**
* Get rank.
*
* @return string
*/
public function getRank()
{
return $this->rank;
}
/**
* Set rank.
*
* @param string $rank
*
* @return Question
*/
public function setRank($rank)
{
$this->rank = $rank;
return $this;
}
/**
* Set is_active.
*
* @param bool $isActive
*
* @return Category
*/
public function setIsActive($isActive)
{
$this->isActive = $isActive;
return $this;
}
/**
* Get isActive.
*
* @return bool
*/
public function getIsActive()
{
return $this->isActive;
}
/**
* Add question.
*
* @return Category
*/
public function addQuestion(Question $question)
{
$this->questions[] = $question;
return $this;
}
/**
* Remove question.
*/
public function removeQuestion(Question $question)
{
$this->questions->removeElement($question);
}
/**
* Get questions.
*
* @return \Doctrine\Common\Collections\Collection
*/
public function getQuestions()
{
return $this->questions;
}
/**
* Returns the route name for url generation.
*
* @return string
*/
public function getRouteName()
{
return 'faq';
}
/**
* Returns the route parameters for url generation.
*
* @return array
*/
public function getRouteParameters()
{
return [
'categorySlug' => $this->getSlug(),
];
}
}

@ -1,117 +0,0 @@
<?php
/* For licensing terms, see /license.txt */
namespace Chamilo\FaqBundle\Entity;
use Doctrine\ORM\Mapping as ORM;
use Gedmo\Mapping\Annotation as Gedmo;
use Knp\DoctrineBehaviors\Contract\Entity\TranslationInterface;
use Knp\DoctrineBehaviors\Model\Translatable\TranslationTrait;
/**
* Class CategoryTranslation.
*
* @ORM\Entity
* @ORM\Table(
* name="faq_category_translation",
* options={"row_format":"DYNAMIC"}
* )
* @ORM\AttributeOverrides({
* @ORM\AttributeOverride(name="locale",
* column=@ORM\Column(
* name="locale",
* type="string",
* length=190
* )
* )
* })
*/
class CategoryTranslation implements TranslationInterface
{
use TranslationTrait;
/**
* @ORM\Column(name="id", type="integer")
* @ORM\Id
* @ORM\GeneratedValue(strategy="AUTO")
*/
protected $id;
/**
* @ORM\Column(type="string", length=255, nullable=false)
*/
protected $headline;
/**
* @ORM\Column(type="text", nullable=true)
*/
protected $body;
/**
* @Gedmo\Slug(fields={"headline"}, updatable=false)
*
* @ORM\Column(type="string", length=50, nullable=false)
*/
protected $slug;
/**
* @var string
*
* @ORM\Column(type="string", length=190, nullable=false)
*/
protected $locale;
/**
* @return string
*/
public function __toString()
{
return (string) $this->headline;
}
public function getHeadline()
{
return $this->headline;
}
/**
* @return CategoryTranslation
*/
public function setHeadline($headline)
{
$this->headline = $headline;
return $this;
}
public function getBody()
{
return $this->body;
}
/**
* @return CategoryTranslation
*/
public function setBody($body)
{
$this->body = $body;
return $this;
}
public function getSlug()
{
return $this->slug;
}
/**
* @return CategoryTranslation
*/
public function setSlug($slug)
{
$this->slug = $slug;
return $this;
}
}

@ -1,209 +0,0 @@
<?php
/* For licensing terms, see /license.txt */
namespace Chamilo\FaqBundle\Entity;
use Doctrine\ORM\Mapping as ORM;
use Gedmo\Mapping\Annotation as Gedmo;
use Gedmo\Timestampable\Traits\TimestampableEntity;
use Knp\DoctrineBehaviors\Contract\Entity\TranslatableInterface;
use Knp\DoctrineBehaviors\Model\Translatable\TranslatableTrait;
/**
* Class Question.
*
* @ORM\Entity(repositoryClass="Chamilo\FaqBundle\Repository\QuestionRepository")
* @ORM\Table(name="faq_question")
*/
class Question implements TranslatableInterface
{
use TranslatableTrait;
use TimestampableEntity;
/**
* @ORM\Column(type="integer")
* @ORM\Id
* @ORM\GeneratedValue(strategy="AUTO")
*/
protected $id;
/**
* @ORM\ManyToOne(targetEntity="Category", inversedBy="questions")
* @ORM\OrderBy({"rank" = "asc"})
*/
protected $category;
/**
* @Gedmo\SortablePosition
*
* @ORM\Column(name="`rank`", type="integer")
*/
protected $rank;
/**
* @var bool
*
* @ORM\Column(name="only_auth_users", type="boolean", nullable=false)
*/
protected $onlyAuthUsers;
/**
* @ORM\Column(name="is_active", type="boolean")
*/
protected $isActive;
/**
* @param $method
* @param $arguments
*/
public function __call($method, $arguments)
{
return $this->proxyCurrentLocaleTranslation($method, $arguments);
}
/**
* Returns a string representation of this object.
*
* @return string
*/
public function __toString()
{
return (string) $this->getHeadline();
}
/**
* Get id.
*
* @return int
*/
public function getId()
{
return $this->id;
}
/**
* Get rank.
*
* @return string
*/
public function getRank()
{
return $this->rank;
}
/**
* Set rank.
*
* @param string $rank
*
* @return Question
*/
public function setRank($rank)
{
$this->rank = $rank;
return $this;
}
/**
* Set category.
*
* @param Category $category
*
* @return Question
*/
public function setCategory(Category $category = null)
{
$this->category = $category;
return $this;
}
/**
* Get category.
*
* @return Category
*/
public function getCategory()
{
return $this->category;
}
/**
* Returns the route name for url generation.
*
* @return string
*/
public function getRouteName()
{
return 'faq';
}
/**
* Returns the route parameters for url generation.
*
* @return array
*/
public function getRouteParameters()
{
return [
'categorySlug' => $this->getCategory()->getSlug(),
'questionSlug' => $this->getSlug(),
];
}
/**
* Returns a string representation of the entity build out of BundleName + EntityName + EntityId.
*
* @return string
*/
public function getEntityIdentifier()
{
return 'GenjFaqBundle:Question:'.$this->getId();
}
/**
* @return bool
*/
public function isOnlyAuthUsers()
{
return $this->onlyAuthUsers;
}
/**
* @param bool $onlyAuthUsers
*
* @return Question
*/
public function setOnlyAuthUsers($onlyAuthUsers)
{
$this->onlyAuthUsers = $onlyAuthUsers;
return $this;
}
/**
* Set is_active.
*
* @param bool $isActive
*
* @return Question
*/
public function setIsActive($isActive)
{
$this->isActive = $isActive;
return $this;
}
/**
* Get isActive.
*
* @return bool
*/
public function getIsActive()
{
return $this->isActive;
}
}

@ -1,131 +0,0 @@
<?php
/* For licensing terms, see /license.txt */
namespace Chamilo\FaqBundle\Entity;
use Doctrine\ORM\Mapping as ORM;
use Gedmo\Mapping\Annotation as Gedmo;
use Knp\DoctrineBehaviors\Contract\Entity\TranslationInterface;
use Knp\DoctrineBehaviors\Model\Translatable\TranslationTrait;
/**
* Class CategoryTranslation.
*
* @ORM\Entity
* @ORM\Table(
* name="faq_question_translation",
* options={"row_format":"DYNAMIC"}
* )
*
* @ORM\AttributeOverrides({
* @ORM\AttributeOverride(name="locale",
* column=@ORM\Column(
* name="locale",
* type="string",
* length=190
* )
* )
* })
*/
class QuestionTranslation implements TranslationInterface
{
use TranslationTrait;
/**
* @ORM\Column(name="id", type="integer")
* @ORM\Id
* @ORM\GeneratedValue(strategy="AUTO")
*/
protected $id;
/**
* @ORM\Column(type="string", length=255, nullable=false)
*/
protected $headline;
/**
* @ORM\Column(type="text", nullable=true)
*/
protected $body;
/**
* @Gedmo\Slug(fields={"headline"}, updatable=false)
* @ORM\Column(type="string", length=50, nullable=false)
*/
protected $slug;
/**
* @var string
* @ORM\Column(type="string", length=190, nullable=false)
*/
protected $locale;
/**
* @return string
*/
public function __toString()
{
return (string) $this->headline;
}
/**
* @return string
*/
public function getHeadline()
{
return $this->headline;
}
/**
* @param string $headline
*
* @return QuestionTranslation
*/
public function setHeadline($headline)
{
$this->headline = $headline;
return $this;
}
/**
* @return string
*/
public function getBody()
{
return $this->body;
}
/**
* @param string $body
*
* @return QuestionTranslation
*/
public function setBody($body)
{
$this->body = $body;
return $this;
}
/**
* @return string
*/
public function getSlug()
{
return $this->slug;
}
/**
* @param string $slug
*
* @return QuestionTranslation
*/
public function setSlug($slug)
{
$this->slug = $slug;
return $this;
}
}

@ -1,76 +0,0 @@
<?php
/* For licensing terms, see /license.txt */
namespace Chamilo\FaqBundle\Repository;
use Chamilo\FaqBundle\Entity\Category;
use Doctrine\ORM\EntityRepository;
/**
* Class CategoryRepository.
*/
class CategoryRepository extends EntityRepository
{
public function retrieveActive()
{
$query = $this->createQueryBuilder('c')
->where('c.isActive = :isActive')
->orderBy('c.rank', 'ASC')
->getQuery();
$query->setParameter('isActive', true);
return $query->execute();
}
/**
* @param string $slug
*/
public function retrieveActiveBySlug($slug)
{
$query = $this->createQueryBuilder('c')
->where('c.isActive = :isActive')
->andWhere('c.slug = :slug')
->orderBy('c.rank', 'ASC')
->getQuery();
$query->setParameter('isActive', true);
$query->setParameter('slug', $slug);
return $query->execute();
}
/**
* @param string $slug
*/
public function getCategoryActiveBySlug($slug)
{
$query = $this->createQueryBuilder('c')
->join('c.translations', 't')
->where('c.isActive = :isActive')
->andWhere('t.slug = :slug')
->getQuery();
$query->setParameter('isActive', true);
$query->setParameter('slug', $slug);
return $query->getOneOrNullResult();
}
/**
* @return Category|null
*/
public function retrieveFirst()
{
$query = $this->createQueryBuilder('c')
->where('c.isActive = :isActive')
->orderBy('c.rank', 'ASC')
->setMaxResults(1)
->getQuery();
$query->setParameter('isActive', true);
return $query->getOneOrNullResult();
}
}

@ -1,53 +0,0 @@
<?php
/* For licensing terms, see /license.txt */
namespace Chamilo\FaqBundle\Repository;
use Chamilo\FaqBundle\Entity\Question;
use Doctrine\ORM\EntityRepository;
/**
* Class QuestionRepository.
*/
class QuestionRepository extends EntityRepository
{
/**
* @param string $categorySlug
*
* @return Question|null
*/
public function retrieveFirstByCategorySlug($categorySlug)
{
$query = $this->createQueryBuilder('q')
->join('q.category', 'c')
->join('c.translations', 't')
->where('t.slug = :categorySlug')
->orderBy('q.rank', 'ASC')
->setMaxResults(1)
->getQuery();
$query->setParameter('categorySlug', $categorySlug);
return $query->getOneOrNullResult();
}
/**
* @param string $slug
*
* @return Question|null
*/
public function getQuestionBySlug($slug)
{
$query = $this->createQueryBuilder('q')
->join('q.translations', 't')
->where('t.slug = :slug')
->orderBy('q.rank', 'ASC')
->setMaxResults(1)
->getQuery();
$query->setParameter('slug', $slug);
return $query->getOneOrNullResult();
}
}

@ -1,18 +0,0 @@
services:
sonata.admin.faq_question:
class: Chamilo\FaqBundle\Admin\QuestionAdmin
tags:
- {name: sonata.admin, manager_type: orm, group: "Content", label: "Question"}
arguments:
- ~
- Chamilo\FaqBundle\Entity\Question
- ~
sonata.admin.faq_category:
class: Chamilo\FaqBundle\Admin\CategoryAdmin
tags:
- {name: sonata.admin, manager_type: orm, group: "Content", label: "Category"}
arguments:
- ~
- Chamilo\FaqBundle\Entity\Category
- ~

@ -1,12 +0,0 @@
faq_index:
path: /faq
defaults: {_controller: 'Chamilo\FaqBundle\Controller\FaqController::indexAction', categorySlug: null, questionSlug: null}
faq:
path: /faq/{categorySlug}/{questionSlug}
defaults: {_controller: 'Chamilo\FaqBundle\Controller\FaqController::indexAction', categorySlug: null, questionSlug: null}
# Shows the entire FAQ at once, without collapsing any categories or questions. Useful if your FAQ is not that big.
faq_without_collapse:
path: /faq-without-collapse/{categorySlug}
defaults: {_controller: 'Chamilo\FaqBundle\Controller\FaqController::indexWithoutCollapseAction', categorySlug: null}

@ -1,3 +0,0 @@
services:
_defaults:
autowire: true

@ -1,80 +0,0 @@
{% extends '@ChamiloTheme/Layout/layout_cms.html.twig' %}
{% block sonata_page_container %}
<script>
function backToTopGo() {
window.scroll(0, 0);
backToTopScroll();
}
$(function () {
var positionCurrent, positionNew = 0;
$(window).scroll(function () {
positionNew = $(this).scrollTop();
if (positionNew > positionCurrent) {
$('#barra').show('slow');
} else if (positionNew < positionCurrent) {
$('#barra').hide('slow');
}
positionCurrent = positionNew;
});
});
</script>
<a id="barra" class="btn btn-primary back_to_top_wrap" onclick="backToTopGo()">
<div class="back_to_top">
<i class="fa fa-arrow-up" aria-hidden="true"></i> Go up
</div>
</a>
<div class="page-faq">
<h1 class="title">FAQ</h1>
<div class="list-faq">
<ul>
{% for category in categories %}
<li class="active">
<h3 class="list-title">{{ category.getHeadline|e }}</h3>
</li>
<ul class="list-items-faq">
{% set list = [false] %}
{% if is_granted('IS_AUTHENTICATED_FULLY') %}
{% set list = [false, true] %}
{% endif %}
{% for question in category.questions if question.onlyAuthUsers in list %}
{% if question.isActive %}
<li>
<a href="#{{ question.id }}"><i class="fa fa-file-text-o" aria-hidden="true"></i>
{{ question.getHeadline|e }}
</a>
</li>
{% endif %}
{% endfor %}
</ul>
{% endfor %}
</ul>
</div>
<div class="block-faq">
{% for category in categories %}
{% set list = [false] %}
{% if is_granted('IS_AUTHENTICATED_FULLY') %}
{% set list = [false, true] %}
<h2 class="title"><i class="fa fa-question-circle" aria-hidden="true"></i> {{ category.getHeadline|e }}</h2>
{% endif %}
{% for question in category.questions if question.onlyAuthUsers in list %}
{% if question.isActive %}
<div class="panel panel-default">
<div class="panel-heading">
{{ question.getHeadline|e }} <a name="{{ question.id }}" id="{{ question.id }}"></a>
</div>
<div class="panel-body">
<p>{{ question.getBody }}</p>
</div>
</div>
{% endif %}
{% endfor %}
{% endfor %}
</div>
</div>
{% endblock %}

@ -1,10 +0,0 @@
<h1>FAQ</h1>
{% for category in categories %}
<h2>{{ category.headline|e }}</h2>
{% for question in category.questions %}
{{ question.isAuth |var_dump }}
<p><strong>{{ question.headline|e }}</strong></p>
<p>{{ question.body }}</p>
{% endfor %}
{% endfor %}

@ -1,9 +0,0 @@
<a target = "_blank"
href="{{ url('faq', {'categorySlug': object.getSlug}) }}"
class="btn btn-sm btn-default"
title="{{ 'Preview'|trans({}, 'SonataAdminBundle') }}"
>
<i class="fa fa-external-link"></i>
{{ 'Preview'|trans({}, 'SonataAdminBundle') }}
</a>

@ -1,11 +0,0 @@
{% if object.category %}
<a target = "_blank"
href="{{ url('faq', {'categorySlug': object.category.getSlug, 'questionSlug' : object.getSlug }) }}"
class="btn btn-sm btn-default"
title="{{ 'Preview'|trans({}, 'SonataAdminBundle') }}"
>
<i class="fa fa-external-link"></i>
{{ 'Preview'|trans({}, 'SonataAdminBundle') }}
</a>
{% endif %}

@ -12,23 +12,17 @@ use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\HttpKernel\Kernel as BaseKernel; use Symfony\Component\HttpKernel\Kernel as BaseKernel;
use Symfony\Component\Routing\RouteCollectionBuilder; use Symfony\Component\Routing\RouteCollectionBuilder;
/**
* Class Kernel.
*/
class Kernel extends BaseKernel class Kernel extends BaseKernel
{ {
use MicroKernelTrait; use MicroKernelTrait;
public const CONFIG_EXTS = '.{php,xml,yaml,yml}'; private const CONFIG_EXTS = '.{php,xml,yaml,yml}';
/** public function registerBundles(): iterable
* @return \Generator|\Symfony\Component\HttpKernel\Bundle\BundleInterface[]
*/
public function registerBundles()
{ {
$contents = require $this->getProjectDir().'/config/bundles.php'; $contents = require $this->getProjectDir().'/config/bundles.php';
foreach ($contents as $class => $envs) { foreach ($contents as $class => $envs) {
if (isset($envs['all']) || isset($envs[$this->environment])) { if ($envs[$this->environment] ?? $envs['all'] ?? false) {
yield new $class(); yield new $class();
} }
} }
@ -66,11 +60,12 @@ class Kernel extends BaseKernel
protected function configureContainer(ContainerBuilder $container, LoaderInterface $loader): void protected function configureContainer(ContainerBuilder $container, LoaderInterface $loader): void
{ {
$container->addResource(new FileResource($this->getProjectDir().'/config/bundles.php')); $container->addResource(new FileResource($this->getProjectDir().'/config/bundles.php'));
$container->setParameter('container.dumper.inline_class_loader', true); $container->setParameter('container.dumper.inline_class_loader', \PHP_VERSION_ID < 70400 || $this->debug);
$container->setParameter('container.dumper.inline_factories', true);
$confDir = $this->getProjectDir().'/config'; $confDir = $this->getProjectDir().'/config';
$loader->load($confDir.'/{packages}/*'.self::CONFIG_EXTS, 'glob'); $loader->load($confDir.'/{packages}/*'.self::CONFIG_EXTS, 'glob');
$loader->load($confDir.'/{packages}/'.$this->environment.'/**/*'.self::CONFIG_EXTS, 'glob'); $loader->load($confDir.'/{packages}/'.$this->environment.'/*'.self::CONFIG_EXTS, 'glob');
$loader->load($confDir.'/{services}'.self::CONFIG_EXTS, 'glob'); $loader->load($confDir.'/{services}'.self::CONFIG_EXTS, 'glob');
$loader->load($confDir.'/{services}_'.$this->environment.self::CONFIG_EXTS, 'glob'); $loader->load($confDir.'/{services}_'.$this->environment.self::CONFIG_EXTS, 'glob');
} }
@ -79,7 +74,7 @@ class Kernel extends BaseKernel
{ {
$confDir = $this->getProjectDir().'/config'; $confDir = $this->getProjectDir().'/config';
$routes->import($confDir.'/{routes}/'.$this->environment.'/**/*'.self::CONFIG_EXTS, '/', 'glob'); $routes->import($confDir.'/{routes}/'.$this->environment.'/*'.self::CONFIG_EXTS, '/', 'glob');
$routes->import($confDir.'/{routes}/*'.self::CONFIG_EXTS, '/', 'glob'); $routes->import($confDir.'/{routes}/*'.self::CONFIG_EXTS, '/', 'glob');
$routes->import($confDir.'/{routes}'.self::CONFIG_EXTS, '/', 'glob'); $routes->import($confDir.'/{routes}'.self::CONFIG_EXTS, '/', 'glob');
} }

@ -1,19 +0,0 @@
<?php
/* For licensing terms, see /license.txt */
namespace Chamilo\MediaBundle;
use Symfony\Component\HttpKernel\Bundle\Bundle;
/**
* This file has been generated by the EasyExtends bundle ( http://sonata-project.org/easy-extends ).
*
* References :
* bundles : http://symfony.com/doc/current/book/bundles.html
*
* @author <yourname> <youremail>
*/
class ChamiloMediaBundle extends Bundle
{
}

@ -1,35 +0,0 @@
<?php
/* For licensing terms, see /license.txt */
namespace Chamilo\MediaBundle\Entity;
use Sonata\MediaBundle\Entity\BaseGallery;
use Sonata\MediaBundle\Model\GalleryHasMediaInterface;
/**
* Class Gallery.
*/
class Gallery extends BaseGallery
{
/**
* @var int
*/
protected $id;
/**
* Get id.
*/
public function getId(): int
{
return $this->id;
}
public function addGalleryHasMedia(GalleryHasMediaInterface $galleryHasMedia)
{
}
public function removeGalleryHasMedia(GalleryHasMediaInterface $galleryHasMedia)
{
}
}

@ -1,28 +0,0 @@
<?php
/* For licensing terms, see /license.txt */
namespace Chamilo\MediaBundle\Entity;
use Sonata\MediaBundle\Entity\BaseGalleryHasMedia as BaseGalleryHasMedia;
/**
* Class GalleryHasMedia.
*/
class GalleryHasMedia extends BaseGalleryHasMedia
{
/**
* @var int
*/
protected $id;
/**
* Get id.
*
* @return int
*/
public function getId()
{
return $this->id;
}
}

@ -1,30 +0,0 @@
<?php
///* For licensing terms, see /license.txt */
//
//namespace Chamilo\MediaBundle\Entity;
//
//use Sonata\MediaBundle\Entity\BaseGalleryItem;
//
///**
// * Class GalleryItem.
// *
// * @package Chamilo\MediaBundle\Entity
// */
//class GalleryItem extends BaseGalleryItem
//{
// /**
// * @var int
// */
// protected $id;
//
// /**
// * Get id.
// *
// * @return int $id
// */
// public function getId()
// {
// return $this->id;
// }
//}

@ -1,28 +0,0 @@
<?php
/* For licensing terms, see /license.txt */
namespace Chamilo\MediaBundle\Entity;
use Sonata\MediaBundle\Entity\BaseMedia;
/**
* Class Media.
*/
class Media extends BaseMedia
{
/**
* @var int
*/
protected $id;
/**
* Get id.
*
* @return int
*/
public function getId()
{
return $this->id;
}
}

@ -1,24 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<doctrine-mapping
xmlns="http://doctrine-project.org/schemas/orm/doctrine-mapping"
xsi="http://www.w3.org/2001/XMLSchema-instance"
schemaLocation="http://doctrine-project.org/schemas/orm/doctrine-mapping http://doctrine-project.org/schemas/orm/doctrine-mapping.xsd">
<!--
This file has been generated by the EasyExtends bundle ( http://sonata-project.org/easy-extends )
References :
xsd : https://github.com/doctrine/doctrine2/blob/master/doctrine-mapping.xsd
xml mapping : http://www.doctrine-project.org/projects/orm/2.0/docs/reference/xml-mapping/en
association mapping : http://www.doctrine-project.org/projects/orm/2.0/docs/reference/association-mapping/en
-->
<entity
name="Chamilo\MediaBundle\Entity\Gallery"
table="media__gallery"
>
<id name="id" type="integer" column="id">
<generator strategy="AUTO"/>
</id>
</entity>
</doctrine-mapping>

@ -1,24 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<doctrine-mapping
xmlns="http://doctrine-project.org/schemas/orm/doctrine-mapping"
xsi="http://www.w3.org/2001/XMLSchema-instance"
schemaLocation="http://doctrine-project.org/schemas/orm/doctrine-mapping http://doctrine-project.org/schemas/orm/doctrine-mapping.xsd">
<!--
This file has been generated by the EasyExtends bundle ( http://sonata-project.org/easy-extends )
References :
xsd : https://github.com/doctrine/doctrine2/blob/master/doctrine-mapping.xsd
xml mapping : http://www.doctrine-project.org/projects/orm/2.0/docs/reference/xml-mapping/en
association mapping : http://www.doctrine-project.org/projects/orm/2.0/docs/reference/association-mapping/en
-->
<entity
name="Chamilo\MediaBundle\Entity\GalleryHasMedia"
table="media__gallery_media"
>
<id name="id" type="integer" column="id">
<generator strategy="AUTO"/>
</id>
</entity>
</doctrine-mapping>

@ -1,24 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<doctrine-mapping
xmlns="http://doctrine-project.org/schemas/orm/doctrine-mapping"
xsi="http://www.w3.org/2001/XMLSchema-instance"
schemaLocation="http://doctrine-project.org/schemas/orm/doctrine-mapping http://doctrine-project.org/schemas/orm/doctrine-mapping.xsd">
<!--
This file has been generated by the EasyExtends bundle ( http://sonata-project.org/easy-extends )
References :
xsd : https://github.com/doctrine/doctrine2/blob/master/doctrine-mapping.xsd
xml mapping : http://www.doctrine-project.org/projects/orm/2.0/docs/reference/xml-mapping/en
association mapping : http://www.doctrine-project.org/projects/orm/2.0/docs/reference/association-mapping/en
-->
<entity
name="Chamilo\MediaBundle\Entity\Media"
table="media__media"
>
<id name="id" type="integer" column="id">
<generator strategy="AUTO"/>
</id>
</entity>
</doctrine-mapping>

@ -1,17 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<serializer>
<!--
This file has been generated by the EasyExtends bundle ( http://sonata-project.org/bundles/easy-extends )
@author <yourname> <youremail>
-->
<class name="Chamilo\MediaBundle\Entity\Gallery" exclusion-policy="all"
xml-root-name="_gallery">
<property xml-attribute-map="true" name="id" type="integer"
expose="true" since-version="1.0"
groups="sonata_api_read,sonata_api_write,sonata_search"/>
</class>
</serializer>

@ -1,17 +0,0 @@
<!--<?xml version="1.0" encoding="UTF-8"?>-->
<!--<serializer>-->
<!--&lt;!&ndash;-->
<!--This file has been generated by the EasyExtends bundle ( http://sonata-project.org/bundles/easy-extends )-->
<!--@author <yourname> <youremail>-->
<!--&ndash;&gt;-->
<!--<class name="Chamilo\MediaBundle\Entity\GalleryItem"-->
<!--exclusion-policy="all" xml-root-name="_gallery_has_media">-->
<!--<property xml-attribute-map="true" name="id" type="integer"-->
<!--expose="true" since-version="1.0"-->
<!--groups="sonata_api_read,sonata_api_write,sonata_search"/>-->
<!--</class>-->
<!--</serializer>-->

@ -1,17 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<serializer>
<!--
This file has been generated by the EasyExtends bundle ( http://sonata-project.org/bundles/easy-extends )
@author <yourname> <youremail>
-->
<class name="Chamilo\MediaBundle\Entity\Media" exclusion-policy="all"
xml-root-name="_media">
<property xml-attribute-map="true" name="id" type="integer"
expose="true" since-version="1.0"
groups="sonata_api_read,sonata_api_write,sonata_search"/>
</class>
</serializer>

@ -1,62 +0,0 @@
{% extends '@SonataBlock/Block/block_base.html.twig' %}
{% block block %}
{% if settings.format %}
<div class="{{ settings.class }}">
{% if settings.title %}
<h3>
{% if settings.icon %}
<i class="{{ settings.icon }}" aria-hidden="true"></i>
{% endif %}
{% if settings.translation_domain %}
{{ settings.title|trans({}, settings.translation_domain) }}
{% else %}
{{ settings.title }}
{% endif %}
</h3>
{% endif %}
<div id="carousel-{{ block.id }}" class="carousel slide"
data-interval="{{ settings.pauseTime }}"
{% if settings.startPaused != 1 %}data-ride="carousel"{% endif %}
>
<!-- Indicators -->
<ol class="carousel-indicators">
{% for element in elements %}
{{ block('element_indicator') }}
{% endfor %}
</ol>
<!-- Wrapper for slides -->
<div class="carousel-inner">
{% for element in elements %}
{{ block('element_display') }}
{% endfor %}
</div>
<!-- Controls -->
<a class="left carousel-control" href="#carousel-{{ block.id }}" data-slide="prev">
<span class="glyphicon glyphicon-chevron-left"></span>
</a>
<a class="right carousel-control" href="#carousel-{{ block.id }}" data-slide="next">
<span class="glyphicon glyphicon-chevron-right"></span>
</a>
</div>
</div>
{% endif %}
{% endblock %}
{% block element_indicator %}
<li data-target="#carousel-{{ block.id }}" data-slide-to="{{ loop.index0 }}"{% if loop.first %} class="active"{% endif %}></li>
{% endblock element_indicator %}
{% block element_display %}
<div class="item{% if loop.first %} active{% endif %}">
{% media element.media, settings.format %}
<div class="carousel-caption">
<h4>{{ element.title }}</h4>
<p>{{ element.caption }}</p>
</div>
</div>
{% endblock element_display %}

@ -1,14 +0,0 @@
<?php
/* For licensing terms, see /license.txt */
namespace Chamilo\NotificationBundle;
use Symfony\Component\HttpKernel\Bundle\Bundle;
/**
* Bundle needed for sonata pages (CMS).
*/
class ChamiloNotificationBundle extends Bundle
{
}

@ -1,28 +0,0 @@
<?php
/* For licensing terms, see /license.txt */
namespace Chamilo\NotificationBundle\Entity;
use Sonata\NotificationBundle\Entity\BaseMessage;
/**
* Class Message.
*/
class Message extends BaseMessage
{
/**
* @var int
*/
protected $id;
/**
* Get id.
*
* @return int
*/
public function getId()
{
return $this->id;
}
}

@ -1,24 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<doctrine-mapping
xmlns="http://doctrine-project.org/schemas/orm/doctrine-mapping"
xsi="http://www.w3.org/2001/XMLSchema-instance"
schemaLocation="http://doctrine-project.org/schemas/orm/doctrine-mapping http://doctrine-project.org/schemas/orm/doctrine-mapping.xsd">
<!--
This file has been generated by the EasyExtends bundle ( http://sonata-project.org/easy-extends )
References :
xsd : https://github.com/doctrine/doctrine2/blob/master/doctrine-mapping.xsd
xml mapping : http://www.doctrine-project.org/projects/orm/2.0/docs/reference/xml-mapping/en
association mapping : http://www.doctrine-project.org/projects/orm/2.0/docs/reference/association-mapping/en
-->
<entity
name="Chamilo\NotificationBundle\Entity\Message"
table="notification__message"
repository-class="Doctrine\ORM\EntityRepository">
<id name="id" type="integer" column="id">
<generator strategy="AUTO"/>
</id>
</entity>
</doctrine-mapping>

@ -1,17 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<serializer>
<!--
This file has been generated by the EasyExtends bundle ( http://sonata-project.org/bundles/easy-extends )
@author <yourname> <youremail>
-->
<class name="Chamilo\NotificationBundle\Entity\Message"
exclusion-policy="all" xml-root-name="_message">
<property xml-attribute-map="true" name="id" type="integer"
expose="true" since-version="1.0"
groups="sonata_api_read,sonata_api_write,sonata_search"/>
</class>
</serializer>

@ -1,14 +0,0 @@
<?php
/* For licensing terms, see /license.txt */
namespace Chamilo\PageBundle;
use Symfony\Component\HttpKernel\Bundle\Bundle;
/**
* Class ChamiloPageBundle.
*/
class ChamiloPageBundle extends Bundle
{
}

@ -1,352 +0,0 @@
<?php
/* For licensing terms, see /license.txt */
namespace Chamilo\PageBundle\Controller;
use Chamilo\CoreBundle\Controller\BaseController;
use Chamilo\CoreBundle\Traits\ControllerTrait;
use Chamilo\PageBundle\Entity\Block;
use Chamilo\PageBundle\Entity\Page;
use Chamilo\PageBundle\Entity\Snapshot;
use FOS\CKEditorBundle\Form\Type\CKEditorType;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Security;
use Sonata\PageBundle\Entity\BlockInteractor;
use Sonata\PageBundle\Entity\BlockManager;
use Sonata\PageBundle\Entity\PageManager;
use Sonata\PageBundle\Entity\SiteManager;
use Sonata\PageBundle\Page\TemplateManager;
use Symfony\Component\Form\Extension\Core\Type\SubmitType;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\Routing\Annotation\Route;
/**
* Class PageController.
*/
class PageController extends BaseController
{
use ControllerTrait;
/**
* @Route("/cms/page/latest/{number}")
*
* @param int $number
*/
public function getLatestPages($number, PageManager $pageManager): Response
{
$site = $this->get('sonata.page.site.selector')->retrieve();
$criteria = ['enabled' => 1, 'site' => $site, 'decorate' => 1, 'routeName' => 'page_slug'];
$order = ['createdAt' => 'desc'];
// Get latest pages
$pages = $pageManager->findBy($criteria, $order, $number);
$pagesToShow = [];
/** @var Page $page */
foreach ($pages as $page) {
// Skip homepage
if ('/' === $page->getUrl()) {
continue;
}
$criteria = ['pageId' => $page];
/** @var Snapshot $snapshot */
// Check if page has a valid snapshot
$snapshot = $this->get('sonata.page.manager.snapshot')->findEnableSnapshot($criteria);
if ($snapshot) {
$pagesToShow[] = $page;
}
}
return $this->render(
'@ChamiloPage/latest.html.twig',
['pages' => $pagesToShow]
);
}
/**
* Creates a site if needed checking the host and locale.
* Creates a first root page.
* Creates a page if it doesn't exists.
* Updates the page if page exists.
*
* @param string $pageSlug
* @param bool $redirect
*
* @throws \Exception
*
* @return \Symfony\Component\HttpFoundation\RedirectResponse|Response
*/
public function createPage(
$pageSlug,
$redirect,
Request $request,
SiteManager $siteManager,
PageManager $pageManager,
TemplateManager $templateManager,
BlockInteractor $blockInteractor,
BlockManager $blockManager
) {
$host = $request->getHost();
$locale = $request->get('_locale');
$criteria = [
'locale' => $locale,
'host' => $host,
];
$site = $siteManager->findOneBy($criteria);
// If site doesn't exists or the site has a different locale from request, create new one.
if (!$site || ($site && ($locale !== $site->getLocale()))) {
// Create new site for this host and language
$site = $siteManager->create();
$site->setHost($host);
$site->setEnabled(true);
$site->setName($host.' in language '.$locale);
$site->setEnabledFrom(new \DateTime('now'));
$site->setEnabledTo(new \DateTime('+20 years'));
$site->setRelativePath('');
$site->setIsDefault(false);
$site->setLocale($locale);
$site = $siteManager->save($site);
// Create first root page
/** @var \Sonata\PageBundle\Model\Page $page */
$page = $pageManager->create();
$page->setSlug('homepage');
$page->setUrl('/');
$page->setName('homepage');
$page->setTitle('home');
$page->setEnabled(true);
$page->setDecorate(1);
$page->setRequestMethod('GET|POST|HEAD|DELETE|PUT');
$page->setTemplateCode('default');
$page->setRouteName('homepage');
//$page->setParent($this->getReference('page-homepage'));
$page->setSite($site);
$pageManager->save($page);
}
$em = $this->getDoctrine()->getManager();
$page = null;
$form = $this->createFormBuilder()
->add('content', CKEditorType::class)
->add('save', SubmitType::class, ['label' => 'Update'])
->getForm();
$blockToEdit = null;
if ($site) {
// Getting parent
$criteria = ['site' => $site, 'enabled' => true, 'parent' => null];
/** @var Page $page */
$parent = $pageManager->findOneBy($criteria);
// Check if a page exists for this site
$criteria = ['site' => $site, 'enabled' => true, 'parent' => $parent, 'slug' => $pageSlug];
/** @var Page $page */
$page = $pageManager->findOneBy($criteria);
if ($page) {
$blocks = $page->getBlocks();
/** @var Block $block */
foreach ($blocks as $block) {
if ('Main content' === $block->getName()) {
$code = $block->getSetting('code');
if ('content' === $code) {
$children = $block->getChildren();
/** @var Block $child */
foreach ($children as $child) {
if ('sonata.formatter.block.formatter' === $child->getType()) {
$blockToEdit = $child;
break 2;
}
}
}
}
}
} else {
$page = $pageManager->create();
$page->setSlug($pageSlug);
$page->setUrl('/'.$pageSlug);
$page->setName($pageSlug);
$page->setTitle($pageSlug);
$page->setEnabled(true);
$page->setDecorate(1);
$page->setRequestMethod('GET');
$page->setTemplateCode('default');
$page->setRouteName($pageSlug);
$page->setParent($parent);
$page->setSite($site);
$pageManager->save($page);
$template = $templateManager->get('default');
$templateContainers = $template->getContainers();
$containers = [];
foreach ($templateContainers as $id => $area) {
$containers[$id] = [
'area' => $area,
'block' => false,
];
}
// Create blocks for this page
$parentBlock = null;
foreach ($containers as $id => $area) {
if (false === $area['block'] && false === $templateContainers[$id]['shared']) {
$block = $blockInteractor->createNewContainer(
[
'page' => $page,
'name' => $templateContainers[$id]['name'],
'code' => $id,
]
);
if ('content' === $id && 'Main content' === $templateContainers[$id]['name']) {
$parentBlock = $block;
}
}
}
// Create block in main content
$myBlock = $blockManager->create();
$myBlock->setType('sonata.formatter.block.formatter');
$myBlock->setSetting('format', 'richhtml');
$myBlock->setSetting('content', '');
$myBlock->setSetting('rawContent', '');
$myBlock->setSetting('template', '@SonataFormatter/Block/block_formatter.html.twig');
$myBlock->setParent($parentBlock);
$page->addBlocks($myBlock);
$pageManager->save($page);
}
}
if ($blockToEdit) {
$form->setData(['content' => $blockToEdit->getSetting('content')]);
}
$form->handleRequest($request);
if ($form->isSubmitted() && $form->isValid() && $blockToEdit) {
$data = $form->getData();
$content = $data['content'];
/** @var Block $blockToEdit */
$blockToEdit->setSetting('rawContent', $content);
$blockToEdit->setSetting('content', $content);
$em->persist($blockToEdit);
$em->flush();
$this->addFlash('success', $this->trans('Updated'));
if (!empty($redirect)) {
return $this->redirect($redirect);
}
return $this->redirectToRoute('home');
}
return $this->render(
'@ChamiloTheme/Index/page_edit.html.twig',
[
'page' => $page,
'form' => $form->createView(),
'current_locale' => $locale,
]
);
}
/**
* The Chamilo index home page.
*
* @Route("/internal_page/edit/{slug}", methods={"GET", "POST"}, name="edit_page")
*
* @Security("has_role('ROLE_ADMIN')")
*
* @param string $slug
*/
public function editPageAction($slug, Request $request): Response
{
$defaultLocale = $request->getLocale();
$localeFromGet = $request->get('_locale');
if (!empty($localeFromGet)) {
$defaultLocale = $localeFromGet;
}
return $this->forward(
'Chamilo\PageBundle\Controller\PageController:createPage',
[
'pageSlug' => $slug,
'redirect' => $this->generateUrl('edit_page', ['slug' => $slug, '_locale' => $defaultLocale]),
'request' => $request,
]
);
}
/**
* @Route("/internal_page/{slug}")
*
* @param bool $showEditPageLink
*
* @return Response
*/
public function renderPageAction(
string $slug,
Request $request,
$showEditPageLink = true,
SiteManager $siteManager,
PageManager $pageManager
) {
$host = $request->getHost();
$criteria = [
'locale' => $request->getLocale(),
'host' => $host,
];
$site = $siteManager->findOneBy($criteria);
$page = null;
$contentText = null;
if ($site) {
// Parents only of homepage
$criteria = ['site' => $site, 'enabled' => true, 'slug' => $slug];
/** @var Page $page */
$page = $pageManager->findOneBy($criteria);
$blocks = $page->getBlocks();
foreach ($blocks as $block) {
if ('Main content' !== $block->getName()) {
continue;
}
$code = $block->getSetting('code');
if ('content' !== $code) {
continue;
}
$children = $block->getChildren();
/** @var Block $child */
foreach ($children as $child) {
if ('sonata.formatter.block.formatter' !== $child->getType()) {
continue;
}
$contentText = $child->getSetting('content');
break 2;
}
}
}
return $this->render(
'@ChamiloTheme/Index/page.html.twig',
[
'page' => $page,
'slug' => $slug,
'show_edit_page_link' => $showEditPageLink,
'content' => $contentText,
]
);
}
}

@ -1,28 +0,0 @@
<?php
/* For licensing terms, see /license.txt */
namespace Chamilo\PageBundle\Entity;
use Sonata\PageBundle\Entity\BaseBlock;
/**
* Class Block.
*/
class Block extends BaseBlock
{
/**
* @var int
*/
protected $id;
/**
* Get id.
*
* @return int
*/
public function getId()
{
return $this->id;
}
}

@ -1,28 +0,0 @@
<?php
/* For licensing terms, see /license.txt */
namespace Chamilo\PageBundle\Entity;
use Sonata\PageBundle\Entity\BasePage;
/**
* Class Page.
*/
class Page extends BasePage
{
/**
* @var int
*/
protected $id;
/**
* Get id.
*
* @return int
*/
public function getId()
{
return $this->id;
}
}

@ -1,28 +0,0 @@
<?php
/* For licensing terms, see /license.txt */
namespace Chamilo\PageBundle\Entity;
use Sonata\PageBundle\Entity\BaseSite;
/**
* Class Site.
*/
class Site extends BaseSite
{
/**
* @var int
*/
protected $id;
/**
* Get id.
*
* @return int
*/
public function getId()
{
return $this->id;
}
}

@ -1,28 +0,0 @@
<?php
/* For licensing terms, see /license.txt */
namespace Chamilo\PageBundle\Entity;
use Sonata\PageBundle\Entity\BaseSnapshot;
/**
* Class Snapshot.
*/
class Snapshot extends BaseSnapshot
{
/**
* @var int
*/
protected $id;
/**
* Get id.
*
* @return int
*/
public function getId()
{
return $this->id;
}
}

@ -1,24 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<doctrine-mapping
xmlns="http://doctrine-project.org/schemas/orm/doctrine-mapping"
xsi="http://www.w3.org/2001/XMLSchema-instance"
schemaLocation="http://doctrine-project.org/schemas/orm/doctrine-mapping http://doctrine-project.org/schemas/orm/doctrine-mapping.xsd">
<!--
This file has been generated by the EasyExtends bundle ( http://sonata-project.org/easy-extends )
References :
xsd : https://github.com/doctrine/doctrine2/blob/master/doctrine-mapping.xsd
xml mapping : http://www.doctrine-project.org/projects/orm/2.0/docs/reference/xml-mapping/en
association mapping : http://www.doctrine-project.org/projects/orm/2.0/docs/reference/association-mapping/en
-->
<entity
name="Chamilo\PageBundle\Entity\Block"
table="page__bloc"
repository-class="Doctrine\ORM\EntityRepository">
<id name="id" type="integer" column="id">
<generator strategy="AUTO"/>
</id>
</entity>
</doctrine-mapping>

@ -1,24 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<doctrine-mapping
xmlns="http://doctrine-project.org/schemas/orm/doctrine-mapping"
xsi="http://www.w3.org/2001/XMLSchema-instance"
schemaLocation="http://doctrine-project.org/schemas/orm/doctrine-mapping http://doctrine-project.org/schemas/orm/doctrine-mapping.xsd">
<!--
This file has been generated by the EasyExtends bundle ( http://sonata-project.org/easy-extends )
References :
xsd : https://github.com/doctrine/doctrine2/blob/master/doctrine-mapping.xsd
xml mapping : http://www.doctrine-project.org/projects/orm/2.0/docs/reference/xml-mapping/en
association mapping : http://www.doctrine-project.org/projects/orm/2.0/docs/reference/association-mapping/en
-->
<entity
name="Chamilo\PageBundle\Entity\Page"
table="page__page"
>
<id name="id" type="integer" column="id">
<generator strategy="AUTO"/>
</id>
</entity>
</doctrine-mapping>

@ -1,24 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<doctrine-mapping
xmlns="http://doctrine-project.org/schemas/orm/doctrine-mapping"
xsi="http://www.w3.org/2001/XMLSchema-instance"
schemaLocation="http://doctrine-project.org/schemas/orm/doctrine-mapping http://doctrine-project.org/schemas/orm/doctrine-mapping.xsd">
<!--
This file has been generated by the EasyExtends bundle ( http://sonata-project.org/easy-extends )
References :
xsd : https://github.com/doctrine/doctrine2/blob/master/doctrine-mapping.xsd
xml mapping : http://www.doctrine-project.org/projects/orm/2.0/docs/reference/xml-mapping/en
association mapping : http://www.doctrine-project.org/projects/orm/2.0/docs/reference/association-mapping/en
-->
<entity
name="Chamilo\PageBundle\Entity\Site"
table="page__site"
>
<id name="id" type="integer" column="id">
<generator strategy="AUTO"/>
</id>
</entity>
</doctrine-mapping>

@ -1,24 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<doctrine-mapping
xmlns="http://doctrine-project.org/schemas/orm/doctrine-mapping"
xsi="http://www.w3.org/2001/XMLSchema-instance"
schemaLocation="http://doctrine-project.org/schemas/orm/doctrine-mapping http://doctrine-project.org/schemas/orm/doctrine-mapping.xsd">
<!--
This file has been generated by the EasyExtends bundle ( http://sonata-project.org/easy-extends )
References :
xsd : https://github.com/doctrine/doctrine2/blob/master/doctrine-mapping.xsd
xml mapping : http://www.doctrine-project.org/projects/orm/2.0/docs/reference/xml-mapping/en
association mapping : http://www.doctrine-project.org/projects/orm/2.0/docs/reference/association-mapping/en
-->
<entity
name="Chamilo\PageBundle\Entity\Snapshot"
table="page__snapshot"
>
<id name="id" type="integer" column="id">
<generator strategy="AUTO"/>
</id>
</entity>
</doctrine-mapping>

@ -1,3 +0,0 @@
page:
resource: '@ChamiloPageBundle/Controller/PageController.php'
type: annotation

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

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

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

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

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

Loading…
Cancel
Save