AppKernel.php 7.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207
  1. <?php
  2. /* For licensing terms, see /license.txt */
  3. use Symfony\Component\HttpKernel\Kernel;
  4. use Symfony\Component\Config\Loader\LoaderInterface;
  5. /**
  6. * Class AppKernel
  7. */
  8. class AppKernel extends Kernel
  9. {
  10. protected $rootDir;
  11. public function registerBundles()
  12. {
  13. $bundles = array(
  14. new Symfony\Bundle\FrameworkBundle\FrameworkBundle(),
  15. new Symfony\Bundle\SecurityBundle\SecurityBundle(),
  16. new Symfony\Bundle\TwigBundle\TwigBundle(),
  17. new Symfony\Bundle\MonologBundle\MonologBundle(),
  18. new Symfony\Bundle\SwiftmailerBundle\SwiftmailerBundle(),
  19. new Symfony\Bundle\AsseticBundle\AsseticBundle(),
  20. new Sensio\Bundle\FrameworkExtraBundle\SensioFrameworkExtraBundle(),
  21. new Doctrine\Bundle\DoctrineBundle\DoctrineBundle(),
  22. new Doctrine\Bundle\MigrationsBundle\DoctrineMigrationsBundle(),
  23. //new Doctrine\Bundle\PHPCRBundle\DoctrinePHPCRBundle(),
  24. new Doctrine\Bundle\DoctrineCacheBundle\DoctrineCacheBundle(),
  25. new FOS\RestBundle\FOSRestBundle(),
  26. new JMS\SerializerBundle\JMSSerializerBundle($this),
  27. // KNP HELPER BUNDLES
  28. new Knp\Bundle\MenuBundle\KnpMenuBundle(),
  29. new Knp\Bundle\MarkdownBundle\KnpMarkdownBundle(),
  30. // Data grid
  31. //new APY\DataGridBundle\APYDataGridBundle(),
  32. new Chamilo\FaqBundle\ChamiloFaqBundle(),
  33. new Doctrine\Bundle\FixturesBundle\DoctrineFixturesBundle(),
  34. new A2lix\TranslationFormBundle\A2lixTranslationFormBundle(),
  35. // Sonata
  36. new Sonata\EasyExtendsBundle\SonataEasyExtendsBundle(),
  37. new Sonata\CoreBundle\SonataCoreBundle(),
  38. new Sonata\IntlBundle\SonataIntlBundle(),
  39. new Sonata\FormatterBundle\SonataFormatterBundle(),
  40. new Sonata\CacheBundle\SonataCacheBundle(),
  41. new Sonata\BlockBundle\SonataBlockBundle(),
  42. new Sonata\SeoBundle\SonataSeoBundle(),
  43. new Sonata\ClassificationBundle\SonataClassificationBundle(),
  44. new Sonata\NotificationBundle\SonataNotificationBundle(),
  45. new Sonata\DatagridBundle\SonataDatagridBundle(),
  46. new Sonata\MediaBundle\SonataMediaBundle(),
  47. new Sonata\PageBundle\SonataPageBundle(),
  48. new Theodo\Evolution\Bundle\SessionBundle\TheodoEvolutionSessionBundle(),
  49. new Spy\TimelineBundle\SpyTimelineBundle(),
  50. new Sonata\TimelineBundle\SonataTimelineBundle(),
  51. //new SimpleThings\EntityAudit\SimpleThingsEntityAuditBundle(),
  52. new Sonata\AdminBundle\SonataAdminBundle(),
  53. new Sonata\DoctrineORMAdminBundle\SonataDoctrineORMAdminBundle(),
  54. // CMF Integration
  55. new Symfony\Cmf\Bundle\RoutingBundle\CmfRoutingBundle(),
  56. //new Symfony\Cmf\Bundle\SearchBundle\CmfSearchBundle(),
  57. //new Symfony\Cmf\Bundle\BlogBundle\CmfBlogBundle(),
  58. //new Sonata\DoctrinePHPCRAdminBundle\SonataDoctrinePHPCRAdminBundle(),
  59. // Oauth
  60. //new HWI\Bundle\OAuthBundle\HWIOAuthBundle(),
  61. //new Gregwar\CaptchaBundle\GregwarCaptchaBundle(),
  62. new Mopa\Bundle\BootstrapBundle\MopaBootstrapBundle(),
  63. //new Liip\ThemeBundle\LiipThemeBundle(),
  64. new Ivory\CKEditorBundle\IvoryCKEditorBundle(),
  65. new FM\ElfinderBundle\FMElfinderBundle(),
  66. new FOS\JsRoutingBundle\FOSJsRoutingBundle(),
  67. new Knp\DoctrineBehaviors\Bundle\DoctrineBehaviorsBundle(),
  68. // User
  69. new FOS\UserBundle\FOSUserBundle(),
  70. new Sonata\UserBundle\SonataUserBundle('FOSUserBundle'),
  71. new Chamilo\UserBundle\ChamiloUserBundle(),
  72. /*
  73. // Sylius
  74. /*new Sylius\Bundle\SettingsBundle\SyliusSettingsBundle(),
  75. //new Sylius\Bundle\AttributeBundle\SyliusAttributeBundle(),
  76. new Sylius\Bundle\ResourceBundle\SyliusResourceBundle(),
  77. new Sylius\Bundle\FlowBundle\SyliusFlowBundle(),
  78. new WhiteOctober\PagerfantaBundle\WhiteOctoberPagerfantaBundle(),
  79. new Bazinga\Bundle\HateoasBundle\BazingaHateoasBundle(),*/
  80. // Chamilo
  81. //new Chamilo\InstallerBundle\ChamiloInstallerBundle(),
  82. new Chamilo\CoreBundle\ChamiloCoreBundle(),
  83. new Chamilo\CourseBundle\ChamiloCourseBundle(),
  84. // new Chamilo\SettingsBundle\ChamiloSettingsBundle(),
  85. new Chamilo\ThemeBundle\ChamiloThemeBundle(),
  86. //new Chamilo\NotificationBundle\ChamiloNotificationBundle(),
  87. new Chamilo\AdminBundle\ChamiloAdminBundle(),
  88. new Chamilo\TimelineBundle\ChamiloTimelineBundle(),
  89. new \Chamilo\ContactBundle\ChamiloContactBundle(),
  90. // Based in Sonata
  91. new Chamilo\ClassificationBundle\ChamiloClassificationBundle(),
  92. new Chamilo\MediaBundle\ChamiloMediaBundle(),
  93. new Chamilo\PageBundle\ChamiloPageBundle(),
  94. /*
  95. // Chamilo course tool
  96. //new Chamilo\NotebookBundle\ChamiloNotebookBundle(),
  97. // Data
  98. //new Oneup\FlysystemBundle\OneupFlysystemBundle(), */
  99. // Extra
  100. new Stof\DoctrineExtensionsBundle\StofDoctrineExtensionsBundle(),
  101. /*
  102. //new JMS\TranslationBundle\JMSTranslationBundle(),
  103. //new JMS\DiExtraBundle\JMSDiExtraBundle($this),
  104. //new JMS\AopBundle\JMSAopBundle(),
  105. /*new Bazinga\Bundle\FakerBundle\BazingaFakerBundle(),
  106. //new Chamilo\CmsBundle\ChamiloCmsBundle(),
  107. */
  108. new Lunetics\LocaleBundle\LuneticsLocaleBundle()
  109. );
  110. if (in_array($this->getEnvironment(), array('dev', 'test'))) {
  111. //$bundles[] = new Jjanvier\Bundle\CrowdinBundle\JjanvierCrowdinBundle();
  112. $bundles[] = new Symfony\Bundle\DebugBundle\DebugBundle();
  113. $bundles[] = new Symfony\Bundle\WebProfilerBundle\WebProfilerBundle();
  114. $bundles[] = new Sensio\Bundle\DistributionBundle\SensioDistributionBundle();
  115. $bundles[] = new Sensio\Bundle\GeneratorBundle\SensioGeneratorBundle();
  116. //$bundles[] = new Sp\BowerBundle\SpBowerBundle();
  117. }
  118. return $bundles;
  119. }
  120. /**
  121. * @param LoaderInterface $loader
  122. */
  123. public function registerContainerConfiguration(LoaderInterface $loader)
  124. {
  125. $loader->load($this->getRootDir().'/config/config_'.$this->getEnvironment().'.yml');
  126. }
  127. /**
  128. * @return string
  129. */
  130. public function getRootDir()
  131. {
  132. if (null === $this->rootDir) {
  133. $r = new \ReflectionObject($this);
  134. $this->rootDir = str_replace('\\', '/', dirname($r->getFileName()));
  135. }
  136. return $this->rootDir;
  137. }
  138. /**
  139. * Returns the real root path
  140. * @return string
  141. */
  142. public function getRealRootDir()
  143. {
  144. return realpath($this->getRootDir().'/../').'/';
  145. }
  146. /**
  147. * Returns the data path
  148. * @return string
  149. */
  150. public function getDataDir()
  151. {
  152. return $this->getRealRootDir().'data/';
  153. }
  154. /**
  155. * @return string
  156. */
  157. public function getAppDir()
  158. {
  159. return $this->getRealRootDir().'app/';
  160. }
  161. /**
  162. * @return string
  163. */
  164. public function getConfigDir()
  165. {
  166. return $this->getRealRootDir().'app/config/';
  167. }
  168. /**
  169. * @return string
  170. */
  171. public function getConfigurationFile()
  172. {
  173. return $this->getRealRootDir().'app/config/configuration.php';
  174. }
  175. }