AppKernel.php 8.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232
  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. new Oro\Bundle\MigrationBundle\OroMigrationBundle(),
  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 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 Spy\TimelineBundle\SpyTimelineBundle(),
  49. new Sonata\TimelineBundle\SonataTimelineBundle(),
  50. new SimpleThings\EntityAudit\SimpleThingsEntityAuditBundle(),
  51. new Sonata\AdminBundle\SonataAdminBundle(),
  52. new Sonata\DoctrineORMAdminBundle\SonataDoctrineORMAdminBundle(),
  53. // CMF Integration
  54. new Symfony\Cmf\Bundle\RoutingBundle\CmfRoutingBundle(),
  55. /*new Symfony\Cmf\Bundle\RoutingBundle\CmfRoutingBundle(),
  56. new Symfony\Cmf\Bundle\RoutingAutoBundle\CmfRoutingAutoBundle(),
  57. new Symfony\Cmf\Bundle\TreeBrowserBundle\CmfTreeBrowserBundle(),
  58. new Symfony\Cmf\Bundle\CoreBundle\CmfCoreBundle(),
  59. new Symfony\Cmf\Bundle\MenuBundle\CmfMenuBundle(),*/
  60. //new Symfony\Cmf\Bundle\SearchBundle\CmfSearchBundle(),
  61. //new Symfony\Cmf\Bundle\BlogBundle\CmfBlogBundle(),
  62. //new Sonata\DoctrinePHPCRAdminBundle\SonataDoctrinePHPCRAdminBundle(),
  63. // Oauth
  64. //new HWI\Bundle\OAuthBundle\HWIOAuthBundle(),
  65. new Gregwar\CaptchaBundle\GregwarCaptchaBundle(),
  66. new Mopa\Bundle\BootstrapBundle\MopaBootstrapBundle(),
  67. new Liip\ThemeBundle\LiipThemeBundle(),
  68. new Ivory\CKEditorBundle\IvoryCKEditorBundle(),
  69. new FM\ElfinderBundle\FMElfinderBundle(),
  70. new FOS\JsRoutingBundle\FOSJsRoutingBundle(),
  71. new Knp\DoctrineBehaviors\Bundle\DoctrineBehaviorsBundle(),
  72. // User
  73. new FOS\UserBundle\FOSUserBundle(),
  74. new Sonata\UserBundle\SonataUserBundle('FOSUserBundle'),
  75. new Chamilo\UserBundle\ChamiloUserBundle(),
  76. // Sylius
  77. new Sylius\Bundle\SettingsBundle\SyliusSettingsBundle(),
  78. //new Sylius\Bundle\AttributeBundle\SyliusAttributeBundle(),
  79. new Sylius\Bundle\ResourceBundle\SyliusResourceBundle(),
  80. new Sylius\Bundle\FlowBundle\SyliusFlowBundle(),
  81. new WhiteOctober\PagerfantaBundle\WhiteOctoberPagerfantaBundle(),
  82. new Bazinga\Bundle\HateoasBundle\BazingaHateoasBundle(),
  83. // Chamilo
  84. new Chamilo\InstallerBundle\ChamiloInstallerBundle(),
  85. new Chamilo\CoreBundle\ChamiloCoreBundle(),
  86. new Chamilo\CourseBundle\ChamiloCourseBundle(),
  87. new Chamilo\SettingsBundle\ChamiloSettingsBundle(),
  88. new Chamilo\ThemeBundle\ChamiloThemeBundle(),
  89. new Chamilo\NotificationBundle\ChamiloNotificationBundle(),
  90. new Chamilo\AdminBundle\ChamiloAdminBundle(),
  91. new Chamilo\TimelineBundle\ChamiloTimelineBundle(),
  92. new Chamilo\ContactBundle\ChamiloContactBundle(),
  93. new Chamilo\SkillBundle\ChamiloSkillBundle(),
  94. new Chamilo\FaqBundle\ChamiloFaqBundle(),
  95. new Chamilo\TicketBundle\ChamiloTicketBundle(),
  96. // Based in Sonata
  97. new Chamilo\ClassificationBundle\ChamiloClassificationBundle(),
  98. new Chamilo\MediaBundle\ChamiloMediaBundle(),
  99. new Chamilo\PageBundle\ChamiloPageBundle(),
  100. // Chamilo course tool
  101. new Chamilo\NotebookBundle\ChamiloNotebookBundle(),
  102. // Data
  103. new Oneup\FlysystemBundle\OneupFlysystemBundle(),
  104. // Extra
  105. new Stof\DoctrineExtensionsBundle\StofDoctrineExtensionsBundle(),
  106. //new JMS\TranslationBundle\JMSTranslationBundle(),
  107. //new JMS\DiExtraBundle\JMSDiExtraBundle($this),
  108. //new JMS\AopBundle\JMSAopBundle(),
  109. new Bazinga\Bundle\FakerBundle\BazingaFakerBundle(),
  110. //new Chamilo\CmsBundle\ChamiloCmsBundle(),
  111. new Lunetics\LocaleBundle\LuneticsLocaleBundle(),
  112. );
  113. if (in_array($this->getEnvironment(), array('dev', 'test'))) {
  114. //$bundles[] = new Jjanvier\Bundle\CrowdinBundle\JjanvierCrowdinBundle();
  115. $bundles[] = new Symfony\Bundle\DebugBundle\DebugBundle();
  116. $bundles[] = new Symfony\Bundle\WebProfilerBundle\WebProfilerBundle();
  117. $bundles[] = new Sensio\Bundle\DistributionBundle\SensioDistributionBundle();
  118. $bundles[] = new Sensio\Bundle\GeneratorBundle\SensioGeneratorBundle();
  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->getAppDir().'courses/';
  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. * If Chamilo is installed in my.chamilo.net return ''
  172. * If Chamilo is installed in my.chamilo.net/chamilo return 'chamilo'
  173. * @return string
  174. */
  175. public function getUrlAppend()
  176. {
  177. return $this->getContainer()->getParameter('url_append');
  178. }
  179. /**
  180. * @return string
  181. */
  182. public function getConfigurationFile()
  183. {
  184. return $this->getRealRootDir().'app/config/configuration.php';
  185. }
  186. /**
  187. * Check if system is installed
  188. * @return bool
  189. */
  190. public function isInstalled()
  191. {
  192. return !empty($this->getContainer()->getParameter('installed'));
  193. }
  194. }