AppKernel.php 7.7 KB

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