AppKernel.php 7.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218
  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\SkillBundle\ChamiloSkillBundle(),
  86. // new Chamilo\SettingsBundle\ChamiloSettingsBundle(),
  87. new Chamilo\ThemeBundle\ChamiloThemeBundle(),
  88. //new Chamilo\NotificationBundle\ChamiloNotificationBundle(),
  89. new Chamilo\AdminBundle\ChamiloAdminBundle(),
  90. new Chamilo\TimelineBundle\ChamiloTimelineBundle(),
  91. new Chamilo\ContactBundle\ChamiloContactBundle(),
  92. // Based in Sonata
  93. new Chamilo\ClassificationBundle\ChamiloClassificationBundle(),
  94. new Chamilo\MediaBundle\ChamiloMediaBundle(),
  95. new Chamilo\PageBundle\ChamiloPageBundle(),
  96. /*
  97. // Chamilo course tool
  98. //new Chamilo\NotebookBundle\ChamiloNotebookBundle(),
  99. // Data
  100. //new Oneup\FlysystemBundle\OneupFlysystemBundle(), */
  101. // Extra
  102. new Stof\DoctrineExtensionsBundle\StofDoctrineExtensionsBundle(),
  103. /*
  104. //new JMS\TranslationBundle\JMSTranslationBundle(),
  105. //new JMS\DiExtraBundle\JMSDiExtraBundle($this),
  106. //new JMS\AopBundle\JMSAopBundle(),
  107. /*new Bazinga\Bundle\FakerBundle\BazingaFakerBundle(),
  108. //new Chamilo\CmsBundle\ChamiloCmsBundle(),
  109. */
  110. new Lunetics\LocaleBundle\LuneticsLocaleBundle()
  111. );
  112. if (in_array($this->getEnvironment(), array('dev', 'test'))) {
  113. //$bundles[] = new Jjanvier\Bundle\CrowdinBundle\JjanvierCrowdinBundle();
  114. $bundles[] = new Symfony\Bundle\DebugBundle\DebugBundle();
  115. $bundles[] = new Symfony\Bundle\WebProfilerBundle\WebProfilerBundle();
  116. $bundles[] = new Sensio\Bundle\DistributionBundle\SensioDistributionBundle();
  117. $bundles[] = new Sensio\Bundle\GeneratorBundle\SensioGeneratorBundle();
  118. //$bundles[] = new Sp\BowerBundle\SpBowerBundle();
  119. }
  120. return $bundles;
  121. }
  122. /**
  123. * @param LoaderInterface $loader
  124. */
  125. public function registerContainerConfiguration(LoaderInterface $loader)
  126. {
  127. $loader->load($this->getRootDir().'/config/config_'.$this->getEnvironment().'.yml');
  128. }
  129. /**
  130. * @return string
  131. */
  132. public function getRootDir()
  133. {
  134. if (null === $this->rootDir) {
  135. $r = new \ReflectionObject($this);
  136. $this->rootDir = str_replace('\\', '/', dirname($r->getFileName()));
  137. }
  138. return $this->rootDir;
  139. }
  140. /**
  141. * Returns the real root path
  142. * @return string
  143. */
  144. public function getRealRootDir()
  145. {
  146. return realpath($this->getRootDir().'/../').'/';
  147. }
  148. /**
  149. * Returns the data path
  150. * @return string
  151. */
  152. public function getDataDir()
  153. {
  154. return $this->getRealRootDir().'data/';
  155. }
  156. /**
  157. * @return string
  158. */
  159. public function getAppDir()
  160. {
  161. return $this->getRealRootDir().'app/';
  162. }
  163. /**
  164. * @return string
  165. */
  166. public function getConfigDir()
  167. {
  168. return $this->getRealRootDir().'app/config/';
  169. }
  170. /**
  171. * @return string
  172. */
  173. public function getConfigurationFile()
  174. {
  175. return $this->getRealRootDir().'app/config/configuration.php';
  176. }
  177. /**
  178. * @param array $configuration
  179. */
  180. public function setApi(array $configuration)
  181. {
  182. new ChamiloApi($configuration);
  183. }
  184. }