Browse Source

Adding files needed to boot the app.

Julio Montoya 10 years ago
parent
commit
6af9760bfa
58 changed files with 2362 additions and 1092 deletions
  1. 14 0
      .gitignore
  2. 112 9
      app/AppKernel.php
  3. 82 126
      app/bootstrap.php.cache
  4. 82 13
      composer.json
  5. 38 0
      src/ChamiloLMS/CoreBundle/Admin/BranchAdmin.php
  6. 48 0
      src/ChamiloLMS/CoreBundle/Admin/CourseAdmin.php
  7. 64 0
      src/ChamiloLMS/CoreBundle/Admin/SessionAdmin.php
  8. 1 1
      src/ChamiloLMS/CoreBundle/Component/DataFilesystem/DataFilesystem.php
  9. 1 1
      src/ChamiloLMS/CoreBundle/Component/Editor/Connector.php
  10. 1 1
      src/ChamiloLMS/CoreBundle/Component/Editor/Driver/DropBoxDriver.php
  11. 4 4
      src/ChamiloLMS/CoreBundle/Controller/Admin/Administrator/JuryController.php
  12. 1 1
      src/ChamiloLMS/CoreBundle/Controller/Admin/Administrator/QuestionScoreController.php
  13. 1 1
      src/ChamiloLMS/CoreBundle/Controller/Admin/Administrator/QuestionScoreNameController.php
  14. 0 47
      src/ChamiloLMS/CoreBundle/Controller/Admin/Administrator/RoleController.php
  15. 2 2
      src/ChamiloLMS/CoreBundle/Controller/Admin/Director/BranchDirectorController.php
  16. 1 1
      src/ChamiloLMS/CoreBundle/Controller/Admin/JuryMember/JuryMemberController.php
  17. 1 1
      src/ChamiloLMS/CoreBundle/Controller/Admin/JuryPresident/JuryPresidentController.php
  18. 1 1
      src/ChamiloLMS/CoreBundle/Controller/App/SessionPath/SessionPathController.php
  19. 2 2
      src/ChamiloLMS/CoreBundle/Controller/BranchAdminController.php
  20. 13 0
      src/ChamiloLMS/CoreBundle/Controller/CourseAdminController.php
  21. 2 39
      src/ChamiloLMS/CoreBundle/Controller/FrontController.php
  22. 1 1
      src/ChamiloLMS/CoreBundle/Controller/IndexController.php
  23. 13 0
      src/ChamiloLMS/CoreBundle/Controller/SessionAdminController.php
  24. 1 1
      src/ChamiloLMS/CoreBundle/Controller/Tool/Curriculum/CurriculumCategoryController.php
  25. 1 1
      src/ChamiloLMS/CoreBundle/Controller/Tool/Curriculum/CurriculumItemController.php
  26. 2 2
      src/ChamiloLMS/CoreBundle/Controller/Tool/Curriculum/CurriculumUserController.php
  27. 1 1
      src/ChamiloLMS/CoreBundle/Controller/Tool/Introduction/IntroductionController.php
  28. 1249 0
      src/ChamiloLMS/CoreBundle/DataFixtures/ORM/LoadPageData.php
  29. 120 0
      src/ChamiloLMS/CoreBundle/DataFixtures/ORM/LoadUserData.php
  30. 3 3
      src/ChamiloLMS/CoreBundle/DependencyInjection/ChamiloLMSCoreExtension.php
  31. 22 0
      src/ChamiloLMS/CoreBundle/Resources/config/admin.yml
  32. 2 3
      src/ChamiloLMS/CoreBundle/Resources/config/routing.yml
  33. 70 15
      src/ChamiloLMS/CoreBundle/Resources/config/services.yml
  34. 247 0
      src/ChamiloLMS/CoreBundle/Resources/public/css/demo.css
  35. 0 8
      src/ChamiloLMS/CoreBundle/Resources/views/12.html.twig
  36. 0 83
      src/ChamiloLMS/CoreBundle/Resources/views/3-9.html.twig
  37. 2 2
      src/ChamiloLMS/CoreBundle/Resources/views/Admin/index.html.twig
  38. 3 10
      src/ChamiloLMS/CoreBundle/Resources/views/Index/index.html.twig
  39. 6 11
      src/ChamiloLMS/CoreBundle/Resources/views/Index/userportal.html.twig
  40. 2 2
      src/ChamiloLMS/CoreBundle/Resources/views/Legacy/index.html.twig
  41. 0 10
      src/ChamiloLMS/CoreBundle/Resources/views/Security/login.html.twig
  42. 0 36
      src/ChamiloLMS/CoreBundle/Resources/views/Security/only_login.html.twig
  43. 2 2
      src/ChamiloLMS/CoreBundle/Resources/views/Tool/CourseHome/index.html.twig
  44. 0 316
      src/ChamiloLMS/CoreBundle/Resources/views/base.html.twig
  45. 2 2
      src/ChamiloLMS/CoreBundle/Resources/views/default/layout/footer.tpl
  46. 7 7
      src/ChamiloLMS/CoreBundle/Resources/views/default/layout/sidebar.tpl
  47. 102 0
      src/ChamiloLMS/CoreBundle/Resources/views/main_layout.html.twig
  48. 0 2
      src/ChamiloLMS/CoreBundle/Resources/views/page.html.twig
  49. 12 0
      src/ChamiloLMS/CourseBundle/Entity/CourseManager.php
  50. 0 6
      user_portal.php
  51. 11 6
      web/app.php
  52. 9 7
      web/app_dev.php
  53. 0 0
      web/apple-touch-icon.png
  54. 0 0
      web/favicon.ico
  55. 1 2
      web/legacy.php
  56. 0 0
      web/robots.txt
  57. 0 185
      whoisonline.php
  58. 0 118
      whoisonlinesession.php

+ 14 - 0
.gitignore

@@ -43,3 +43,17 @@ tests/doctrine_console/Proxies
 
 # OS stuff
 .DS_Store
+
+# Symfony
+
+behat.yml
+app/cache/*
+app/logs/*
+app/*.cache
+web/bundles
+web/uploads
+web/sitemap*.xml
+app/config/parameters*.yml
+vendor
+build
+composer.lock

+ 112 - 9
app/AppKernel.php

@@ -5,34 +5,137 @@ use Symfony\Component\Config\Loader\LoaderInterface;
 
 class AppKernel extends Kernel
 {
+    /**
+     * {@inheritdoc}
+     */
     public function registerBundles()
     {
         $bundles = array(
+            // Symfony standard edition
             new Symfony\Bundle\FrameworkBundle\FrameworkBundle(),
             new Symfony\Bundle\SecurityBundle\SecurityBundle(),
             new Symfony\Bundle\TwigBundle\TwigBundle(),
             new Symfony\Bundle\MonologBundle\MonologBundle(),
             new Symfony\Bundle\SwiftmailerBundle\SwiftmailerBundle(),
+            new Sensio\Bundle\FrameworkExtraBundle\SensioFrameworkExtraBundle(),
+            new JMS\AopBundle\JMSAopBundle(),
+            new JMS\SecurityExtraBundle\JMSSecurityExtraBundle(),
             new Symfony\Bundle\AsseticBundle\AsseticBundle(),
+
+            // Doctrine
             new Doctrine\Bundle\DoctrineBundle\DoctrineBundle(),
-            new Sensio\Bundle\FrameworkExtraBundle\SensioFrameworkExtraBundle(),
+            new Doctrine\Bundle\MigrationsBundle\DoctrineMigrationsBundle(),
 
-            new ChamiloLMS\CoreBundle\ChamiloLMSCoreBundle(),
+            // KNP bundles
+            new Knp\Bundle\MenuBundle\KnpMenuBundle(),
+            new Knp\Bundle\MarkdownBundle\KnpMarkdownBundle(),
+            new Knp\Bundle\PaginatorBundle\KnpPaginatorBundle(),
 
-            new Braincrafted\Bundle\BootstrapBundle\BraincraftedBootstrapBundle(),
+            // User
+            new FOS\UserBundle\FOSUserBundle(),
+            new Sonata\UserBundle\SonataUserBundle('FOSUserBundle'),
+            new Application\Sonata\UserBundle\ApplicationSonataUserBundle(),
 
-            new Knp\Bundle\MenuBundle\KnpMenuBundle(),
-            // Vendor specifics bundles
-            new Sonata\CoreBundle\SonataCoreBundle(),
-            new Sonata\BlockBundle\SonataBlockBundle(),
+            // Page
+            new Sonata\PageBundle\SonataPageBundle(),
+            new Application\Sonata\PageBundle\ApplicationSonataPageBundle(),
+
+            // NEWS
+            new Sonata\NewsBundle\SonataNewsBundle(),
+            new Application\Sonata\NewsBundle\ApplicationSonataNewsBundle(),
+
+            // MEDIA
             new Sonata\MediaBundle\SonataMediaBundle(),
+            new Application\Sonata\MediaBundle\ApplicationSonataMediaBundle(),
+            // new Liip\ImagineBundle\LiipImagineBundle(),
+            //new Presta\CMSMediaBundle\PrestaCMSMediaBundle(),
+
+            new Ivory\CKEditorBundle\IvoryCKEditorBundle(),
+
+            new Sonata\AdminBundle\SonataAdminBundle(),
+            new Sonata\DoctrineORMAdminBundle\SonataDoctrineORMAdminBundle(),
+
+            // Disable this if you don't want the audit on entities
+            new SimpleThings\EntityAudit\SimpleThingsEntityAuditBundle(),
+
+            // API
+            new FOS\RestBundle\FOSRestBundle(),
+            new Nelmio\ApiDocBundle\NelmioApiDocBundle(),
+
+            // E-COMMERCE
+            /*new Sonata\BasketBundle\SonataBasketBundle(),
+            new Application\Sonata\BasketBundle\ApplicationSonataBasketBundle(),
+            new Sonata\CustomerBundle\SonataCustomerBundle(),
+            new Application\Sonata\CustomerBundle\ApplicationSonataCustomerBundle(),
+            new Sonata\DeliveryBundle\SonataDeliveryBundle(),
+            new Application\Sonata\DeliveryBundle\ApplicationSonataDeliveryBundle(),
+            new Sonata\InvoiceBundle\SonataInvoiceBundle(),
+            new Application\Sonata\InvoiceBundle\ApplicationSonataInvoiceBundle(),
+            new Sonata\OrderBundle\SonataOrderBundle(),
+            new Application\Sonata\OrderBundle\ApplicationSonataOrderBundle(),
+            new Sonata\PaymentBundle\SonataPaymentBundle(),
+            new Application\Sonata\PaymentBundle\ApplicationSonataPaymentBundle(),
+            new Sonata\ProductBundle\SonataProductBundle(),
+            new Application\Sonata\ProductBundle\ApplicationSonataProductBundle(),
+            new Sonata\PriceBundle\SonataPriceBundle(),
+
+            */
+            new JMS\SerializerBundle\JMSSerializerBundle($this),
+            new FOS\CommentBundle\FOSCommentBundle(),
+            new Sonata\CommentBundle\SonataCommentBundle(),
+            new Application\Sonata\CommentBundle\ApplicationSonataCommentBundle(),
+
+            // SONATA CORE & HELPER BUNDLES
             new Sonata\EasyExtendsBundle\SonataEasyExtendsBundle(),
+            new Sonata\CoreBundle\SonataCoreBundle(),
+            new Sonata\IntlBundle\SonataIntlBundle(),
+            new Sonata\FormatterBundle\SonataFormatterBundle(),
+            new Sonata\CacheBundle\SonataCacheBundle(),
+            new Sonata\BlockBundle\SonataBlockBundle(),
+            new Sonata\SeoBundle\SonataSeoBundle(),
+            new Sonata\ClassificationBundle\SonataClassificationBundle(),
+            new Application\Sonata\ClassificationBundle\ApplicationSonataClassificationBundle(),
+            new Sonata\NotificationBundle\SonataNotificationBundle(),
+            new Application\Sonata\NotificationBundle\ApplicationSonataNotificationBundle(),
+            new Application\Sonata\SeoBundle\ApplicationSonataSeoBundle(),
+            new Sonata\DatagridBundle\SonataDatagridBundle(),
+
+            // Search Integration
+            //new FOS\ElasticaBundle\FOSElasticaBundle(),
+
+            // CMF Integration
+            new Symfony\Cmf\Bundle\RoutingBundle\CmfRoutingBundle(),
+
+            // DEMO and QA - Can be deleted
+            //new Sonata\Bundle\DemoBundle\SonataDemoBundle(),
+            //new Sonata\Bundle\QABundle\SonataQABundle(),
+
+            // Disable this if you don't want the timeline in the admin
+            new Spy\TimelineBundle\SpyTimelineBundle(),
+            new Sonata\TimelineBundle\SonataTimelineBundle(),
+            new Application\Sonata\TimelineBundle\ApplicationSonataTimelineBundle(), // easy extends integration
+
+            new Mopa\Bundle\BootstrapBundle\MopaBootstrapBundle(),
+            new Application\Sonata\AdminBundle\ApplicationSonataAdminBundle(),
+            new FOS\AdvancedEncoderBundle\FOSAdvancedEncoderBundle(),
+
+            //new HWI\Bundle\OAuthBundle\HWIOAuthBundle(),
+            new Avanzu\AdminThemeBundle\AvanzuAdminThemeBundle(),
+            new FOS\MessageBundle\FOSMessageBundle(),
+
+            // Chamilo
+            new ChamiloLMS\CoreBundle\ChamiloLMSCoreBundle(),
+            new ChamiloLMS\CourseBundle\ChamiloLMSCourseBundle(),
+            new Stof\DoctrineExtensionsBundle\StofDoctrineExtensionsBundle()
         );
 
         if (in_array($this->getEnvironment(), array('dev', 'test'))) {
             $bundles[] = new Symfony\Bundle\WebProfilerBundle\WebProfilerBundle();
             $bundles[] = new Sensio\Bundle\DistributionBundle\SensioDistributionBundle();
             $bundles[] = new Sensio\Bundle\GeneratorBundle\SensioGeneratorBundle();
+            $bundles[] = new Bazinga\Bundle\FakerBundle\BazingaFakerBundle();
+            $bundles[] = new Doctrine\Bundle\FixturesBundle\DoctrineFixturesBundle();
+            $bundles[] = new Elao\WebProfilerExtraBundle\WebProfilerExtraBundle();
         }
 
         return $bundles;
@@ -43,7 +146,7 @@ class AppKernel extends Kernel
         $loader->load(__DIR__.'/config/config_'.$this->getEnvironment().'.yml');
     }
 
-    public function getLogDir()
+    /*public function getLogDir()
     {
         return $this->rootDir.'/../logs/'.$this->environment.'/logs/';
     }
@@ -51,7 +154,7 @@ class AppKernel extends Kernel
     public function getCacheDir()
     {
         return $this->rootDir.'/../data/temp/'.$this->environment.'/cache/';
-    }
+    }*/
 
     // Custom paths
 

+ 82 - 126
app/bootstrap.php.cache

@@ -95,7 +95,7 @@ public function getInt($key, $default = 0, $deep = false)
 {
 return (int) $this->get($key, $default, $deep);
 }
-public function filter($key, $default = null, $deep = false, $filter = FILTER_DEFAULT, $options = array())
+public function filter($key, $default = null, $deep = false, $filter=FILTER_DEFAULT, $options=array())
 {
 $value = $this->get($key, $default, $deep);
 if (!is_array($options) && $options) {
@@ -120,10 +120,12 @@ namespace Symfony\Component\HttpFoundation
 {
 class HeaderBag implements \IteratorAggregate, \Countable
 {
-protected $headers = array();
-protected $cacheControl = array();
+protected $headers;
+protected $cacheControl;
 public function __construct(array $headers = array())
 {
+$this->cacheControl = array();
+$this->headers = array();
 foreach ($headers as $key => $values) {
 $this->set($key, $values);
 }
@@ -416,7 +418,6 @@ public $headers;
 protected $content;
 protected $languages;
 protected $charsets;
-protected $encodings;
 protected $acceptableContentTypes;
 protected $pathInfo;
 protected $requestUri;
@@ -428,7 +429,6 @@ protected $session;
 protected $locale;
 protected $defaultLocale ='en';
 protected static $formats;
-protected static $requestFactory;
 public function __construct(array $query = array(), array $request = array(), array $attributes = array(), array $cookies = array(), array $files = array(), array $server = array(), $content = null)
 {
 $this->initialize($query, $request, $attributes, $cookies, $files, $server, $content);
@@ -445,7 +445,6 @@ $this->headers = new HeaderBag($this->server->getHeaders());
 $this->content = $content;
 $this->languages = null;
 $this->charsets = null;
-$this->encodings = null;
 $this->acceptableContentTypes = null;
 $this->pathInfo = null;
 $this->requestUri = null;
@@ -456,7 +455,7 @@ $this->format = null;
 }
 public static function createFromGlobals()
 {
-$request = self::createRequestFromFactory($_GET, $_POST, array(), $_COOKIE, $_FILES, $_SERVER);
+$request = new static($_GET, $_POST, array(), $_COOKIE, $_FILES, $_SERVER);
 if (0 === strpos($request->headers->get('CONTENT_TYPE'),'application/x-www-form-urlencoded')
 && in_array(strtoupper($request->server->get('REQUEST_METHOD','GET')), array('PUT','DELETE','PATCH'))
 ) {
@@ -529,11 +528,7 @@ $queryString = http_build_query($query,'','&');
 }
 $server['REQUEST_URI'] = $components['path'].(''!== $queryString ?'?'.$queryString :'');
 $server['QUERY_STRING'] = $queryString;
-return self::createRequestFromFactory($query, $request, array(), $cookies, $files, $server, $content);
-}
-public static function setFactory($callable)
-{
-self::$requestFactory = $callable;
+return new static($query, $request, array(), $cookies, $files, $server, $content);
 }
 public function duplicate(array $query = null, array $request = null, array $attributes = null, array $cookies = null, array $files = null, array $server = null)
 {
@@ -559,7 +554,6 @@ $dup->headers = new HeaderBag($dup->server->getHeaders());
 }
 $dup->languages = null;
 $dup->charsets = null;
-$dup->encodings = null;
 $dup->acceptableContentTypes = null;
 $dup->pathInfo = null;
 $dup->requestUri = null;
@@ -838,7 +832,7 @@ $host = $this->server->get('SERVER_ADDR','');
 }
 $host = strtolower(preg_replace('/:\d+$/','', trim($host)));
 if ($host && !preg_match('/^\[?(?:[a-zA-Z0-9-:\]_]+\.?)+$/', $host)) {
-throw new \UnexpectedValueException(sprintf('Invalid Host "%s"', $host));
+throw new \UnexpectedValueException('Invalid Host "'.$host.'"');
 }
 if (count(self::$trustedHostPatterns) > 0) {
 if (in_array($host, self::$trustedHosts)) {
@@ -850,7 +844,7 @@ self::$trustedHosts[] = $host;
 return $host;
 }
 }
-throw new \UnexpectedValueException(sprintf('Untrusted Host "%s"', $host));
+throw new \UnexpectedValueException('Untrusted Host "'.$host.'"');
 }
 return $host;
 }
@@ -1022,13 +1016,6 @@ return $this->charsets;
 }
 return $this->charsets = array_keys(AcceptHeader::fromString($this->headers->get('Accept-Charset'))->all());
 }
-public function getEncodings()
-{
-if (null !== $this->encodings) {
-return $this->encodings;
-}
-return $this->encodings = array_keys(AcceptHeader::fromString($this->headers->get('Accept-Encoding'))->all());
-}
 public function getAcceptableContentTypes()
 {
 if (null !== $this->acceptableContentTypes) {
@@ -1173,65 +1160,12 @@ return $match[0];
 }
 return false;
 }
-private static function createRequestFromFactory(array $query = array(), array $request = array(), array $attributes = array(), array $cookies = array(), array $files = array(), array $server = array(), $content = null)
-{
-if (self::$requestFactory) {
-$request = call_user_func(self::$requestFactory, $query, $request, $attributes, $cookies, $files, $server, $content);
-if (!$request instanceof Request) {
-throw new \LogicException('The Request factory must return an instance of Symfony\Component\HttpFoundation\Request.');
-}
-return $request;
-}
-return new static($query, $request, $attributes, $cookies, $files, $server, $content);
-}
 }
 }
 namespace Symfony\Component\HttpFoundation
 {
 class Response
 {
-const HTTP_CONTINUE = 100;
-const HTTP_SWITCHING_PROTOCOLS = 101;
-const HTTP_PROCESSING = 102; const HTTP_OK = 200;
-const HTTP_CREATED = 201;
-const HTTP_ACCEPTED = 202;
-const HTTP_NON_AUTHORITATIVE_INFORMATION = 203;
-const HTTP_NO_CONTENT = 204;
-const HTTP_RESET_CONTENT = 205;
-const HTTP_PARTIAL_CONTENT = 206;
-const HTTP_MULTI_STATUS = 207; const HTTP_ALREADY_REPORTED = 208; const HTTP_IM_USED = 226; const HTTP_MULTIPLE_CHOICES = 300;
-const HTTP_MOVED_PERMANENTLY = 301;
-const HTTP_FOUND = 302;
-const HTTP_SEE_OTHER = 303;
-const HTTP_NOT_MODIFIED = 304;
-const HTTP_USE_PROXY = 305;
-const HTTP_RESERVED = 306;
-const HTTP_TEMPORARY_REDIRECT = 307;
-const HTTP_PERMANENTLY_REDIRECT = 308; const HTTP_BAD_REQUEST = 400;
-const HTTP_UNAUTHORIZED = 401;
-const HTTP_PAYMENT_REQUIRED = 402;
-const HTTP_FORBIDDEN = 403;
-const HTTP_NOT_FOUND = 404;
-const HTTP_METHOD_NOT_ALLOWED = 405;
-const HTTP_NOT_ACCEPTABLE = 406;
-const HTTP_PROXY_AUTHENTICATION_REQUIRED = 407;
-const HTTP_REQUEST_TIMEOUT = 408;
-const HTTP_CONFLICT = 409;
-const HTTP_GONE = 410;
-const HTTP_LENGTH_REQUIRED = 411;
-const HTTP_PRECONDITION_FAILED = 412;
-const HTTP_REQUEST_ENTITY_TOO_LARGE = 413;
-const HTTP_REQUEST_URI_TOO_LONG = 414;
-const HTTP_UNSUPPORTED_MEDIA_TYPE = 415;
-const HTTP_REQUESTED_RANGE_NOT_SATISFIABLE = 416;
-const HTTP_EXPECTATION_FAILED = 417;
-const HTTP_I_AM_A_TEAPOT = 418; const HTTP_UNPROCESSABLE_ENTITY = 422; const HTTP_LOCKED = 423; const HTTP_FAILED_DEPENDENCY = 424; const HTTP_RESERVED_FOR_WEBDAV_ADVANCED_COLLECTIONS_EXPIRED_PROPOSAL = 425; const HTTP_UPGRADE_REQUIRED = 426; const HTTP_PRECONDITION_REQUIRED = 428; const HTTP_TOO_MANY_REQUESTS = 429; const HTTP_REQUEST_HEADER_FIELDS_TOO_LARGE = 431; const HTTP_INTERNAL_SERVER_ERROR = 500;
-const HTTP_NOT_IMPLEMENTED = 501;
-const HTTP_BAD_GATEWAY = 502;
-const HTTP_SERVICE_UNAVAILABLE = 503;
-const HTTP_GATEWAY_TIMEOUT = 504;
-const HTTP_VERSION_NOT_SUPPORTED = 505;
-const HTTP_VARIANT_ALSO_NEGOTIATES_EXPERIMENTAL = 506; const HTTP_INSUFFICIENT_STORAGE = 507; const HTTP_LOOP_DETECTED = 508; const HTTP_NOT_EXTENDED = 510; const HTTP_NETWORK_AUTHENTICATION_REQUIRED = 511;
 public $headers;
 protected $content;
 protected $version;
@@ -1349,10 +1283,10 @@ public function sendHeaders()
 if (headers_sent()) {
 return $this;
 }
-header(sprintf('HTTP/%s %s %s', $this->version, $this->statusCode, $this->statusText), true, $this->statusCode);
+header(sprintf('HTTP/%s %s %s', $this->version, $this->statusCode, $this->statusText));
 foreach ($this->headers->allPreserveCase() as $name => $values) {
 foreach ($values as $value) {
-header($name.': '.$value, false, $this->statusCode);
+header($name.': '.$value, false);
 }
 }
 foreach ($this->headers->getCookies() as $cookie) {
@@ -1924,17 +1858,23 @@ use Symfony\Component\DependencyInjection\ParameterBag\FrozenParameterBag;
 class Container implements IntrospectableContainerInterface
 {
 protected $parameterBag;
-protected $services = array();
-protected $methodMap = array();
-protected $aliases = array();
-protected $scopes = array();
-protected $scopeChildren = array();
-protected $scopedServices = array();
-protected $scopeStacks = array();
+protected $services;
+protected $methodMap;
+protected $aliases;
+protected $scopes;
+protected $scopeChildren;
+protected $scopedServices;
+protected $scopeStacks;
 protected $loading = array();
 public function __construct(ParameterBagInterface $parameterBag = null)
 {
-$this->parameterBag = $parameterBag ?: new ParameterBag();
+$this->parameterBag = null === $parameterBag ? new ParameterBag() : $parameterBag;
+$this->services = array();
+$this->aliases = array();
+$this->scopes = array();
+$this->scopeChildren = array();
+$this->scopedServices = array();
+$this->scopeStacks = array();
 $this->set('service_container', $this);
 }
 public function compile()
@@ -2219,30 +2159,33 @@ use Symfony\Component\Config\Loader\LoaderResolver;
 use Symfony\Component\Config\Loader\DelegatingLoader;
 use Symfony\Component\Config\ConfigCache;
 use Symfony\Component\ClassLoader\ClassCollectionLoader;
+use Symfony\Component\Filesystem\Filesystem;
 abstract class Kernel implements KernelInterface, TerminableInterface
 {
-protected $bundles = array();
+protected $bundles;
 protected $bundleMap;
 protected $container;
 protected $rootDir;
 protected $environment;
 protected $debug;
-protected $booted = false;
+protected $booted;
 protected $name;
 protected $startTime;
 protected $loadClassCache;
-const VERSION ='2.4.4';
-const VERSION_ID ='20404';
+const VERSION ='2.3.15';
+const VERSION_ID ='20315';
 const MAJOR_VERSION ='2';
-const MINOR_VERSION ='4';
-const RELEASE_VERSION ='4';
+const MINOR_VERSION ='3';
+const RELEASE_VERSION ='15';
 const EXTRA_VERSION ='';
 public function __construct($environment, $debug)
 {
 $this->environment = $environment;
 $this->debug = (bool) $debug;
+$this->booted = false;
 $this->rootDir = $this->getRootDir();
 $this->name = $this->getName();
+$this->bundles = array();
 if ($this->debug) {
 $this->startTime = microtime(true);
 }
@@ -2577,8 +2520,33 @@ $content = $dumper->dump(array('class'=> $class,'base_class'=> $baseClass));
 if (!$this->debug) {
 $content = static::stripComments($content);
 }
+$content = $this->removeAbsolutePathsFromContainer($content);
 $cache->write($content, $container->getResources());
 }
+private function removeAbsolutePathsFromContainer($content)
+{
+if (!class_exists('Symfony\Component\Filesystem\Filesystem')) {
+return $content;
+}
+$rootDir = $this->getRootDir();
+$previous = $rootDir;
+while (!file_exists($rootDir.'/composer.json')) {
+if ($previous === $rootDir = realpath($rootDir.'/..')) {
+return $content;
+}
+$previous = $rootDir;
+}
+$rootDir = rtrim($rootDir,'/');
+$cacheDir = $this->getCacheDir();
+$filesystem = new Filesystem();
+return preg_replace_callback("{'([^']*)(".preg_quote($rootDir)."[^']*)'}", function ($match) use ($filesystem, $cacheDir) {
+$prefix = isset($match[1]) && $match[1] ? "'$match[1]'.__DIR__" :"__DIR__";
+if ('.'=== $relativePath = rtrim($filesystem->makePathRelative($match[2], $cacheDir),'/')) {
+return $prefix;
+}
+return $prefix.".'/".$relativePath."'";
+}, $content);
+}
 protected function getContainerLoader(ContainerInterface $container)
 {
 $locator = new FileLocator($this);
@@ -2723,8 +2691,8 @@ use Symfony\Component\DependencyInjection\Extension\ExtensionInterface;
 abstract class Bundle extends ContainerAware implements BundleInterface
 {
 protected $name;
+protected $reflected;
 protected $extension;
-protected $path;
 public function boot()
 {
 }
@@ -2758,16 +2726,17 @@ return $this->extension;
 }
 public function getNamespace()
 {
-$class = get_class($this);
-return substr($class, 0, strrpos($class,'\\'));
+if (null === $this->reflected) {
+$this->reflected = new \ReflectionObject($this);
+}
+return $this->reflected->getNamespaceName();
 }
 public function getPath()
 {
-if (null === $this->path) {
-$reflected = new \ReflectionObject($this);
-$this->path = dirname($reflected->getFileName());
+if (null === $this->reflected) {
+$this->reflected = new \ReflectionObject($this);
 }
-return $this->path;
+return dirname($this->reflected->getFileName());
 }
 public function getParent()
 {
@@ -2794,14 +2763,7 @@ $ns = $prefix;
 if ($relativePath = $file->getRelativePath()) {
 $ns .='\\'.strtr($relativePath,'/','\\');
 }
-$class = $ns.'\\'.$file->getBasename('.php');
-if ($this->container) {
-$alias ='console.command.'.strtolower(str_replace('\\','_', $class));
-if ($this->container->has($alias)) {
-continue;
-}
-}
-$r = new \ReflectionClass($class);
+$r = new \ReflectionClass($ns.'\\'.$file->getBasename('.php'));
 if ($r->isSubclassOf('Symfony\\Component\\Console\\Command\\Command') && !$r->isAbstract() && !$r->getConstructor()->getNumberOfRequiredParameters()) {
 $application->add($r->newInstance());
 }
@@ -2812,6 +2774,7 @@ $application->add($r->newInstance());
 namespace Symfony\Component\Config
 {
 use Symfony\Component\Config\Resource\ResourceInterface;
+use Symfony\Component\Filesystem\Exception\IOException;
 use Symfony\Component\Filesystem\Filesystem;
 class ConfigCache
 {
@@ -2849,13 +2812,20 @@ return true;
 }
 public function write($content, array $metadata = null)
 {
-$mode = 0666 & ~umask();
+$mode = 0666;
+$umask = umask();
 $filesystem = new Filesystem();
 $filesystem->dumpFile($this->file, $content, null);
-@chmod($this->file, $mode);
+try {
+$filesystem->chmod($this->file, $mode, $umask);
+} catch (IOException $e) {
+}
 if (null !== $metadata && true === $this->debug) {
 $filesystem->dumpFile($this->getMetaFile(), serialize($metadata), null);
-@chmod($this->getMetaFile(), $mode);
+try {
+$filesystem->chmod($this->getMetaFile(), $mode, $umask);
+} catch (IOException $e) {
+}
 }
 }
 private function getMetaFile()
@@ -2871,25 +2841,21 @@ use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
 use Symfony\Component\HttpKernel\Exception\HttpExceptionInterface;
 use Symfony\Component\HttpKernel\Event\FilterControllerEvent;
 use Symfony\Component\HttpKernel\Event\FilterResponseEvent;
-use Symfony\Component\HttpKernel\Event\FinishRequestEvent;
 use Symfony\Component\HttpKernel\Event\GetResponseEvent;
 use Symfony\Component\HttpKernel\Event\GetResponseForControllerResultEvent;
 use Symfony\Component\HttpKernel\Event\GetResponseForExceptionEvent;
 use Symfony\Component\HttpKernel\Event\PostResponseEvent;
 use Symfony\Component\HttpFoundation\Request;
-use Symfony\Component\HttpFoundation\RequestStack;
 use Symfony\Component\HttpFoundation\Response;
 use Symfony\Component\EventDispatcher\EventDispatcherInterface;
 class HttpKernel implements HttpKernelInterface, TerminableInterface
 {
 protected $dispatcher;
 protected $resolver;
-protected $requestStack;
-public function __construct(EventDispatcherInterface $dispatcher, ControllerResolverInterface $resolver, RequestStack $requestStack = null)
+public function __construct(EventDispatcherInterface $dispatcher, ControllerResolverInterface $resolver)
 {
 $this->dispatcher = $dispatcher;
 $this->resolver = $resolver;
-$this->requestStack = $requestStack ?: new RequestStack();
 }
 public function handle(Request $request, $type = HttpKernelInterface::MASTER_REQUEST, $catch = true)
 {
@@ -2897,7 +2863,6 @@ try {
 return $this->handleRaw($request, $type);
 } catch (\Exception $e) {
 if (false === $catch) {
-$this->finishRequest($request, $type);
 throw $e;
 }
 return $this->handleException($e, $request, $type);
@@ -2909,7 +2874,6 @@ $this->dispatcher->dispatch(KernelEvents::TERMINATE, new PostResponseEvent($this
 }
 private function handleRaw(Request $request, $type = self::MASTER_REQUEST)
 {
-$this->requestStack->push($request);
 $event = new GetResponseEvent($this, $request, $type);
 $this->dispatcher->dispatch(KernelEvents::REQUEST, $event);
 if ($event->hasResponse()) {
@@ -2943,21 +2907,14 @@ private function filterResponse(Response $response, Request $request, $type)
 {
 $event = new FilterResponseEvent($this, $request, $type, $response);
 $this->dispatcher->dispatch(KernelEvents::RESPONSE, $event);
-$this->finishRequest($request, $type);
 return $event->getResponse();
 }
-private function finishRequest(Request $request, $type)
-{
-$this->dispatcher->dispatch(KernelEvents::FINISH_REQUEST, new FinishRequestEvent($this, $request, $type));
-$this->requestStack->pop();
-}
 private function handleException(\Exception $e, $request, $type)
 {
 $event = new GetResponseForExceptionEvent($this, $request, $type, $e);
 $this->dispatcher->dispatch(KernelEvents::EXCEPTION, $event);
 $e = $event->getException();
 if (!$event->hasResponse()) {
-$this->finishRequest($request, $type);
 throw $e;
 }
 $response = $event->getResponse();
@@ -3009,7 +2966,6 @@ return (string) $var;
 namespace Symfony\Component\HttpKernel\DependencyInjection
 {
 use Symfony\Component\HttpFoundation\Request;
-use Symfony\Component\HttpFoundation\RequestStack;
 use Symfony\Component\HttpKernel\HttpKernelInterface;
 use Symfony\Component\HttpKernel\HttpKernel;
 use Symfony\Component\HttpKernel\Controller\ControllerResolverInterface;
@@ -3019,9 +2975,9 @@ use Symfony\Component\DependencyInjection\Scope;
 class ContainerAwareHttpKernel extends HttpKernel
 {
 protected $container;
-public function __construct(EventDispatcherInterface $dispatcher, ContainerInterface $container, ControllerResolverInterface $controllerResolver, RequestStack $requestStack = null)
+public function __construct(EventDispatcherInterface $dispatcher, ContainerInterface $container, ControllerResolverInterface $controllerResolver)
 {
-parent::__construct($dispatcher, $controllerResolver, $requestStack);
+parent::__construct($dispatcher, $controllerResolver);
 $this->container = $container;
 if (!$container->hasScope('request')) {
 $container->addScope(new Scope('request'));

+ 82 - 13
composer.json

@@ -7,6 +7,7 @@
         "forum": "http://www.chamilo.org/forum",
         "irc": "irc://irc.freenode.org/chamilo"
     },
+
     "autoload": {
         "psr-0": {
             "": "src/"
@@ -25,6 +26,8 @@
             "main/survey"
         ]
     },
+
+    "minimum-stability": "stable",
     "repositories": [
         {
             "type": "package",
@@ -38,38 +41,101 @@
             }
         }
     ],
+
     "require": {
         "php": ">=5.3.3",
-        "symfony/symfony": "~2.4",
-        "doctrine/orm": "~2.2,>=2.2.3",
-        "doctrine/doctrine-bundle": "~1.2",
+
+        "twig/twig": "~1.12",
         "twig/extensions": "~1.0",
+
+        "symfony/symfony": "~2.3.7",
+
         "symfony/assetic-bundle": "~2.3",
         "symfony/swiftmailer-bundle": "~2.3",
-        "symfony/monolog-bundle": "~2.4",
+        "symfony/monolog-bundle": "~2.3",
+
         "sensio/distribution-bundle": "~2.3",
-        "sensio/framework-extra-bundle": "~3.0",
+        "sensio/framework-extra-bundle": "~2.3",
         "sensio/generator-bundle": "~2.3",
+
+        "jms/security-extra-bundle": "~1.5",
+        "jms/di-extra-bundle": "~1.4",
+        "jms/serializer-bundle": "~0.11",
+
+        "doctrine/orm": "~2.4",
+        "doctrine/doctrine-bundle": "~1.2",
+        "doctrine/doctrine-migrations-bundle": "dev-master",
+        "doctrine/migrations": "dev-master",
+        "doctrine/doctrine-fixtures-bundle": "~2.2",
+        "doctrine/data-fixtures": "1.0.*@dev",
+
+        "symfony-cmf/routing-bundle": "~1.1",
+
+        "knplabs/gaufrette": "0.1.4",
+        "knplabs/knp-menu-bundle": "1.1.x-dev",
+
+        "sonata-project/easy-extends-bundle": "~2.1@dev",
+        "sonata-project/seo-bundle": "~1@dev",
+        "sonata-project/doctrine-extensions": "~1@dev",
+        "sonata-project/intl-bundle": "~2.2@dev",
+        "sonata-project/admin-bundle": "~2.3@dev",
+        "sonata-project/doctrine-orm-admin-bundle": "~2.3@dev",
+        "sonata-project/notification-bundle": "~2.2@dev",
+        "sonata-project/block-bundle": "~2.2@dev",
+        "sonata-project/media-bundle": "~2.3@dev",
+        "sonata-project/user-bundle": "~2.2@dev",
+        "sonata-project/cache-bundle": "~2.1@dev",
+        "sonata-project/cache": "~1.0@dev",
+        "sonata-project/page-bundle": "dev-master",
+        "sonata-project/core-bundle": "~2.2@dev",
+        "sonata-project/formatter-bundle": "~2.3@dev",
+        "sonata-project/news-bundle": "~2.3@dev",
+        "sonata-project/datagrid-bundle": "~2.2@dev",
+        "sonata-project/exporter": "~1.3@dev",
+        "sonata-project/timeline-bundle": "~2.2@dev",
+        "sonata-project/classification-bundle": "~2.2@dev",
+        "sonata-project/ecommerce": "dev-develop",
+        "sonata-project/comment-bundle": "~2.2@dev",
+
+        "friendsofsymfony/comment-bundle": "dev-master",
+
+        "dflydev/markdown": "~1.0",
+        "simplethings/entity-audit-bundle": "~0.5",
+        "willdurand/faker-bundle": "~1.0",
+
+        "mopa/bootstrap-bundle": "v3.0.0-beta3",
+        "twbs/bootstrap": "v3.0.0",
+
+        "stof/doctrine-extensions-bundle": "~1.1",
+        "stephpy/TimelineBundle": "~2.0@dev",
+        "stephpy/timeline": "~1.0@dev",
+
         "incenteev/composer-parameter-handler": "~2.0",
-        "braincrafted/bootstrap-bundle": "~2.0",
+
         "gedmo/doctrine-extensions": "~2.3",
-        "twbs/bootstrap": "3.0.*",
         "jquery/jquery":  "1.10.*",
         "oyejorge/less.php": "~1.5",
-        "sonata-project/block-bundle": "~2.2",
-        "knplabs/knp-menu-bundle": "~1.1",
         "white-october/pagerfanta-bundle": "dev-master",
         "jbroadway/urlify": "1.0.0-stable",
-        "chamilo/chash": "dev-master",
-        "doctrine/migrations": "dev-master",
+
         "composer/composer": "1.0.*@dev",
-        "sonata-project/media-bundle": "~2.2"
+        "friendsofsymfony/advanced-encoder-bundle": "~1.0",
+        "hwi/oauth-bundle": "0.4.*@dev",
+        "friendsofsymfony/message-bundle": "~1.2",
+        "stof/doctrine-extensions-bundle": "~1.1@dev",
+        "avanzu/admin-theme-bundle": "dev-master"
+    },
+    "require-dev": {
+        "elao/web-profiler-extra-bundle" : "~2.3@dev",
+        "lexik/maintenance-bundle": "dev-master"
     },
+
     "scripts": {
         "post-install-cmd": [
             "Incenteev\\ParameterHandler\\ScriptHandler::buildParameters",
             "Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::buildBootstrap",
             "Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::clearCache",
+            "Mopa\\Bundle\\BootstrapBundle\\Composer\\ScriptHandler::postInstallSymlinkTwitterBootstrap",
             "Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::installAssets",
             "Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::installRequirementsFile"
         ],
@@ -77,18 +143,21 @@
             "Incenteev\\ParameterHandler\\ScriptHandler::buildParameters",
             "Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::buildBootstrap",
             "Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::clearCache",
+            "Mopa\\Bundle\\BootstrapBundle\\Composer\\ScriptHandler::postInstallSymlinkTwitterBootstrap",
             "Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::installAssets",
             "Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::installRequirementsFile"
         ]
     },
+
     "config": {
         "bin-dir": "bin"
     },
+
     "extra": {
         "symfony-app-dir": "app",
         "symfony-web-dir": "web",
         "incenteev-parameters": {
-            "file": "config/configuration.php"
+            "file": "app/config/parameters.yml"
         },
         "branch-alias": {
             "dev-master": "2.4-dev"

+ 38 - 0
src/ChamiloLMS/CoreBundle/Admin/BranchAdmin.php

@@ -0,0 +1,38 @@
+<?php
+
+namespace ChamiloLMS\CoreBundle\Admin;
+
+use Sonata\AdminBundle\Admin\Admin;
+use Sonata\AdminBundle\Form\FormMapper;
+use Sonata\AdminBundle\Datagrid\DatagridMapper;
+use Sonata\AdminBundle\Datagrid\ListMapper;
+use Sonata\AdminBundle\Show\ShowMapper;
+
+use Knp\Menu\ItemInterface as MenuItemInterface;
+
+class BranchAdmin extends Admin
+{
+    // Fields to be shown on create/edit forms
+    protected function configureFormFields(FormMapper $formMapper)
+    {
+        $formMapper
+            ->add('id')
+        ;
+    }
+
+    // Fields to be shown on filter forms
+    protected function configureDatagridFilters(DatagridMapper $datagridMapper)
+    {
+        $datagridMapper
+            ->add('id')
+        ;
+    }
+
+    // Fields to be shown on lists
+    protected function configureListFields(ListMapper $listMapper)
+    {
+        $listMapper
+            ->addIdentifier('id')
+        ;
+    }
+}

+ 48 - 0
src/ChamiloLMS/CoreBundle/Admin/CourseAdmin.php

@@ -0,0 +1,48 @@
+<?php
+
+namespace ChamiloLMS\CoreBundle\Admin;
+
+use Sonata\AdminBundle\Admin\Admin;
+use Sonata\AdminBundle\Form\FormMapper;
+use Sonata\AdminBundle\Datagrid\DatagridMapper;
+use Sonata\AdminBundle\Datagrid\ListMapper;
+use Sonata\AdminBundle\Show\ShowMapper;
+
+use Knp\Menu\ItemInterface as MenuItemInterface;
+
+/**
+ * Class CourseAdmin
+ * @package ChamiloLMS\CoreBundle\Admin
+ */
+class CourseAdmin extends Admin
+{
+    // Fields to be shown on create/edit forms
+    protected function configureFormFields(FormMapper $formMapper)
+    {
+        $formMapper
+            ->add('id', 'text', array('label' => 'Course'))
+            //->add('author', 'entity', array('class' => 'Acme\DemoBundle\Entity\User'))
+            ->add('code') //if no type is specified, SonataAdminBundle tries to guess it
+            ->add('title')
+        ;
+    }
+
+    // Fields to be shown on filter forms
+    protected function configureDatagridFilters(DatagridMapper $datagridMapper)
+    {
+        $datagridMapper
+            ->add('id')
+            ->add('code')
+        ;
+    }
+
+    // Fields to be shown on lists
+    protected function configureListFields(ListMapper $listMapper)
+    {
+        $listMapper
+            ->addIdentifier('id')
+            ->add('code')
+            ->add('title')
+        ;
+    }
+}

+ 64 - 0
src/ChamiloLMS/CoreBundle/Admin/SessionAdmin.php

@@ -0,0 +1,64 @@
+<?php
+
+namespace ChamiloLMS\CoreBundle\Admin;
+
+use Sonata\AdminBundle\Admin\Admin;
+use Sonata\AdminBundle\Form\FormMapper;
+use Sonata\AdminBundle\Datagrid\DatagridMapper;
+use Sonata\AdminBundle\Datagrid\ListMapper;
+use Sonata\AdminBundle\Show\ShowMapper;
+
+use Knp\Menu\ItemInterface as MenuItemInterface;
+
+/**
+ * Class SessionAdmin
+ * @package ChamiloLMS\CoreBundle\Admin
+ */
+class SessionAdmin extends Admin
+{
+    // Fields to be shown on create/edit forms
+    protected function configureFormFields(FormMapper $formMapper)
+    {
+        $formMapper
+            ->add('id', 'text', array('label' => 'Session'))
+            ->add('name') //if no type is specified, SonataAdminBundle tries to guess it
+            ->add('display_start_date', 'sonata_type_date_picker')
+            ->add('generalCoach')
+        ;
+
+        /*->add('student', 'sonata_type_model', array(),
+        array(
+            'admin_code' => 'application.subscriber.admin.student'
+        ))*/
+    }
+
+    protected function configureShowField(ShowMapper $showMapper)
+    {
+        $showMapper
+            ->add('id', 'text', array('label' => 'Session'))
+            ->add('name') //if no type is specified, SonataAdminBundle tries to guess it
+            ->add('display_start_date', 'sonata_type_date_picker')
+        ;
+    }
+
+
+    // Fields to be shown on filter forms
+    protected function configureDatagridFilters(DatagridMapper $datagridMapper)
+    {
+        $datagridMapper
+            ->add('id')
+            ->add('name')
+            //->add('display_start_date', 'sonata_type_date_picker')
+        ;
+    }
+
+    // Fields to be shown on lists
+    protected function configureListFields(ListMapper $listMapper)
+    {
+        $listMapper
+            ->addIdentifier('id')
+            ->add('name')
+            //->add('display_start_date', 'sonata_type_date_picker')
+        ;
+    }
+}

+ 1 - 1
src/ChamiloLMS/CoreBundle/Component/DataFilesystem/DataFilesystem.php

@@ -10,7 +10,7 @@ use Symfony\Component\Console;
 use Sunra\PhpSimple\HtmlDomParser;
 use ChamiloLMS\CoreBundle\Component\Editor\Connector;
 use ChamiloLMS\CoreBundle\Component\Editor\Driver\CourseDriver;
-use ChamiloLMS\CoreBundle\Entity\User;
+use Application\Sonata\UserBundle\Entity\User;
 use MediaAlchemyst\Alchemyst;
 use Unoconv\Unoconv;
 use Symfony\Component\Console\Output\OutputInterface;

+ 1 - 1
src/ChamiloLMS/CoreBundle/Component/Editor/Connector.php

@@ -4,7 +4,7 @@
 namespace ChamiloLMS\CoreBundle\Component\Editor;
 
 use Doctrine\ORM\EntityManager;
-use ChamiloLMS\CoreBundle\Entity\User;
+use Application\Sonata\UserBundle\Entity\User;
 use ChamiloLMS\CoreBundle\Entity\Course;
 
 use Symfony\Component\Translation\Translator;

+ 1 - 1
src/ChamiloLMS/CoreBundle/Component/Editor/Driver/DropBoxDriver.php

@@ -70,7 +70,7 @@ class DropBoxDriver extends \elFinderVolumeMySQL implements InterfaceDriver
         if ($this->connector->security->isGranted('IS_AUTHENTICATED_FULLY')) {
 
             /** @var \ChamiloLMS\CoreBundle\Entity\Repository\UserRepository $repository */
-            /*$repository = $this->connector->entityManager->getRepository('ChamiloLMS\CoreBundle\Entity\User');
+            /*$repository = $this->connector->entityManager->getRepository('ChamiloLMS\UserBundle\Entity\User');
             $courses = $repository->getCourses($this->connector->user);*/
 
             //if (!empty($courses)) {

+ 4 - 4
src/ChamiloLMS/CoreBundle/Controller/Admin/Administrator/JuryController.php

@@ -22,7 +22,7 @@ use Sensio\Bundle\FrameworkExtraBundle\Configuration\Method;
  * @package ChamiloLMS\CoreBundle\Controller\Admin\Administrator
  * @author Julio Montoya <gugli100@gmail.com>
  */
-class JuryController extends CrudController
+class JuryController
 {
     public function getClass()
     {
@@ -96,7 +96,7 @@ class JuryController extends CrudController
 
         $role = $request->get('role');
         /** @var \ChamiloLMS\CoreBundle\Entity\Repository\UserRepository $repo */
-        $repo = $this->getManager()->getRepository('ChamiloLMS\CoreBundle\Entity\User');
+        $repo = $this->getManager()->getRepository('Application\Sonata\UserBundle\Entity\User');
 
         if (empty($role)) {
             $entities = $repo->searchUserByKeyword($keyword);
@@ -106,7 +106,7 @@ class JuryController extends CrudController
 
         $data = array();
         if ($entities) {
-            /** @var \ChamiloLMS\CoreBundle\Entity\User $entity */
+            /** @var \ChamiloLMS\UserBundle\Entity\User $entity */
             foreach ($entities as $entity) {
                 $data[] = array(
                     'key' => (string) $entity->getUserId(),
@@ -136,7 +136,7 @@ class JuryController extends CrudController
 
                 $userIdList = $item->getUserId();
                 $userId = ($userIdList[0]);
-                $user = $this->getManager()->getRepository('ChamiloLMS\CoreBundle\Entity\User')->find($userId);
+                $user = $this->getManager()->getRepository('ChamiloLMS\UserBundle\Entity\User')->find($userId);
                 if (!$user) {
                     throw new \Exception('Unable to found User');
                 }

+ 1 - 1
src/ChamiloLMS/CoreBundle/Controller/Admin/Administrator/QuestionScoreController.php

@@ -15,7 +15,7 @@ use Sensio\Bundle\FrameworkExtraBundle\Configuration\Method;
  * @author Julio Montoya <gugli100@gmail.com>
  * @Route("/question_score")
  */
-class QuestionScoreController extends CrudController
+class QuestionScoreController
 {
     /**
      *

+ 1 - 1
src/ChamiloLMS/CoreBundle/Controller/Admin/Administrator/QuestionScoreNameController.php

@@ -14,7 +14,7 @@ use Sensio\Bundle\FrameworkExtraBundle\Configuration\Method;
  * @author Julio Montoya <gugli100@gmail.com>
  */
 
-class QuestionScoreNameController extends CrudController
+class QuestionScoreNameController
 {
     public function getClass()
     {

+ 0 - 47
src/ChamiloLMS/CoreBundle/Controller/Admin/Administrator/RoleController.php

@@ -1,47 +0,0 @@
-<?php
-/* For licensing terms, see /license.txt */
-
-namespace ChamiloLMS\CoreBundle\Controller\Admin\Administrator;
-
-use ChamiloLMS\CoreBundle\Controller\CrudController;
-use ChamiloLMS\CoreBundle\Entity;
-
-/**
- * Class RoleController
- * @package ChamiloLMS\CoreBundle\Controller\Admin\Administrator
- * @author Julio Montoya <gugli100@gmail.com>
- */
-class RoleController extends CrudController
-{
-    /**
-     * {@inheritdoc}
-     */
-    public function getClass()
-    {
-        return 'ChamiloLMS\CoreBundle\Entity\Role';
-    }
-
-    /**
-     * {@inheritdoc}
-     */
-    public function getType()
-    {
-        return 'ChamiloLMS\CoreBundle\Form\RoleType';
-    }
-
-    /**
-     * {@inheritdoc}
-     */
-    /*public function getControllerAlias()
-    {
-        return 'role.controller';
-    }*/
-
-    /**
-     * {@inheritdoc}
-     */
-    /*public function getTemplatePath()
-    {
-        return 'admin/administrator/role/';
-    }*/
-}

+ 2 - 2
src/ChamiloLMS/CoreBundle/Controller/Admin/Director/BranchDirectorController.php

@@ -9,8 +9,8 @@ use ChamiloLMS\CoreBundle\Form\JuryType;
 use ChamiloLMS\CoreBundle\Entity;
 use ChamiloLMS\CoreBundle\Entity\BranchSync;
 use ChamiloLMS\CoreBundle\Entity\Jury;
-use ChamiloLMS\CoreBundle\Entity\User;
 use ChamiloLMS\CoreBundle\Entity\JuryMembers;
+use ChamiloLMS\UserBundle\Entity\User;
 use Symfony\Component\HttpFoundation\Response;
 
 use Symfony\Component\Routing\Annotation\Route;
@@ -21,7 +21,7 @@ use Sensio\Bundle\FrameworkExtraBundle\Configuration\Method;
  * @package ChamiloLMS\CoreBundle\Controller
  * @author Julio Montoya <gugli100@gmail.com>
  */
-class BranchDirectorController extends CrudController
+class BranchDirectorController
 {
     public function getClass()
     {

+ 1 - 1
src/ChamiloLMS/CoreBundle/Controller/Admin/JuryMember/JuryMemberController.php

@@ -20,7 +20,7 @@ use Sensio\Bundle\FrameworkExtraBundle\Configuration\Method;
  * @package ChamiloLMS\CoreBundle\Controller
  * @author Julio Montoya <gugli100@gmail.com>
  */
-class JuryMemberController extends CrudController
+class JuryMemberController
 {
     public $maxCountOfMemberToVoteToConsiderEvaluated = 3;
 

+ 1 - 1
src/ChamiloLMS/CoreBundle/Controller/Admin/JuryPresident/JuryPresidentController.php

@@ -26,7 +26,7 @@ use Whoops\Example\Exception;
  * @package ChamiloLMS\CoreBundle\Controller
  * @author Julio Montoya <gugli100@gmail.com>
  */
-class JuryPresidentController extends CrudController
+class JuryPresidentController
 {
     public $maxCountOfMemberToVoteToConsiderEvaluated = 3;
 

+ 1 - 1
src/ChamiloLMS/CoreBundle/Controller/App/SessionPath/SessionPathController.php

@@ -17,7 +17,7 @@ use ChamiloLMS\CoreBundle\Form\SessionPathType;
  * @package ChamiloLMS.Controller
  * @author Julio Montoya <gugli100@gmail.com>
  */
-class SessionPathController extends CrudController
+class SessionPathController
 {
     public function getClass()
     {

+ 2 - 2
src/ChamiloLMS/CoreBundle/Controller/Admin/Administrator/BranchController.php → src/ChamiloLMS/CoreBundle/Controller/BranchAdminController.php

@@ -21,7 +21,7 @@ use Sensio\Bundle\FrameworkExtraBundle\Configuration\Method;
  * @package ChamiloLMS\CoreBundle\Controller\Admin\Administrator
  * @author Julio Montoya <gugli100@gmail.com>
  */
-class BranchController extends CrudController
+class BranchAdminController extends Controller
 {
     public function getClass()
     {
@@ -108,7 +108,7 @@ class BranchController extends CrudController
 
                 $userIdList = $item->getUserId();
                 $userId = ($userIdList[0]);
-                $user = $this->getManager()->getRepository('ChamiloLMS\CoreBundle\Entity\User')->find($userId);
+                $user = $this->getManager()->getRepository('Application\Sonata\UserBundle\Entity\User')->find($userId);
                 if (!$user) {
                     throw new \Exception('Unable to found User');
                 }

+ 13 - 0
src/ChamiloLMS/CoreBundle/Controller/CourseAdminController.php

@@ -0,0 +1,13 @@
+<?php
+
+namespace ChamiloLMS\CoreBundle\Controller;
+
+use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route;
+use Sensio\Bundle\FrameworkExtraBundle\Configuration\Method;
+use Symfony\Component\HttpFoundation\Response;
+use Sonata\AdminBundle\Controller\CRUDController as Controller;
+
+class CourseAdminController extends Controller
+{
+
+}

+ 2 - 39
src/ChamiloLMS/CoreBundle/Controller/FrontController.php

@@ -24,48 +24,11 @@ class FrontController extends Controller
      */
     public function showLoginAction()
     {
+        $csrfToken = $this->container->get('form.csrf_provider')->generateCsrfToken('authenticate');
         return $this->render(
             'ChamiloLMSCoreBundle:Security:only_login.html.twig',
-            array('error' => null)
+            array('error' => null, 'csrf_token' => $csrfToken)
         );
     }
 
-    public function showCourseSessionBlockAction()
-    {
-
-        return new Response('showCourseSessionBlock');
-    }
-
-    public function showCourseBlockAction()
-    {
-        return new Response('showCourseSessionBlock');
-    }
-
-    public function showTeacherBlockAction()
-    {
-        return new Response('showCourseSessionBlock');
-    }
-
-    public function showSessionBlockAction()
-    {
-        return new Response('showCourseSessionBlock');
-    }
-
-    public function showNoticeBlockAction()
-    {
-        return new Response('showCourseSessionBlock');
-    }
-    public function showHelpBlockAction()
-    {
-        return new Response('showCourseSessionBlock');
-    }
-
-    public function showNavigationBlockAction()
-    {
-        return new Response('showCourseSessionBlock');
-    }
-    public function showSkillsBlockAction()
-    {
-        return new Response('showCourseSessionBlock');
-    }
 }

+ 1 - 1
src/ChamiloLMS/CoreBundle/Controller/IndexController.php

@@ -414,7 +414,7 @@ class IndexController extends BaseController
      */
     public function userPortalAction($type = 'courses', $filter = 'current', $page = 1)
     {
-        api_block_anonymous_users();
+        //api_block_anonymous_users();
 
         // Abort request because the user is not allowed here - @todo use filters
         /*if ($this->app['allowed'] == false) {

+ 13 - 0
src/ChamiloLMS/CoreBundle/Controller/SessionAdminController.php

@@ -0,0 +1,13 @@
+<?php
+
+namespace ChamiloLMS\CoreBundle\Controller;
+
+use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route;
+use Sensio\Bundle\FrameworkExtraBundle\Configuration\Method;
+use Symfony\Component\HttpFoundation\Response;
+use Sonata\AdminBundle\Controller\CRUDController as Controller;
+
+class SessionAdminController extends Controller
+{
+
+}

+ 1 - 1
src/ChamiloLMS/CoreBundle/Controller/Tool/Curriculum/CurriculumCategoryController.php

@@ -17,7 +17,7 @@ use Sensio\Bundle\FrameworkExtraBundle\Configuration\Method;
  * @package ChamiloLMS\CoreBundle\Controller
  * @author Julio Montoya <gugli100@gmail.com>
  */
-class CurriculumCategoryController extends CrudController
+class CurriculumCategoryController
 {
     public function getClass()
     {

+ 1 - 1
src/ChamiloLMS/CoreBundle/Controller/Tool/Curriculum/CurriculumItemController.php

@@ -18,7 +18,7 @@ use Sensio\Bundle\FrameworkExtraBundle\Configuration\Method;
  * @package ChamiloLMS\CoreBundle\Controller
  * @author Julio Montoya <gugli100@gmail.com>
  */
-class CurriculumItemController extends CrudController
+class CurriculumItemController
 {
     public function getControllerAlias()
     {

+ 2 - 2
src/ChamiloLMS/CoreBundle/Controller/Tool/Curriculum/CurriculumUserController.php

@@ -21,7 +21,7 @@ use Sensio\Bundle\FrameworkExtraBundle\Configuration\Method;
  * @package ChamiloLMS\CoreBundle\Controller
  * @author Julio Montoya <gugli100@gmail.com>
  */
-class CurriculumUserController extends CrudController
+class CurriculumUserController
 {
     public function getControllerAlias()
     {
@@ -208,7 +208,7 @@ class CurriculumUserController extends CrudController
                 }
 
                 // @todo check this
-                $user = $this->get('orm.em')->getRepository('ChamiloLMS\CoreBundle\Entity\User')->find($user->getUserId());
+                $user = $this->get('orm.em')->getRepository('Application\Sonata\UserBundle\Entity\User')->find($user->getUserId());
 
                 $counter = 1;
                 $parsed = array();

+ 1 - 1
src/ChamiloLMS/CoreBundle/Controller/Tool/Introduction/IntroductionController.php

@@ -15,7 +15,7 @@ use Sensio\Bundle\FrameworkExtraBundle\Configuration\Method;
  * @author Julio Montoya <gugli100@gmail.com>
  * @Route("/introduction")
  */
-class IntroductionController extends CrudController
+class IntroductionController
 {
     public function getClass()
     {

+ 1249 - 0
src/ChamiloLMS/CoreBundle/DataFixtures/ORM/LoadPageData.php

@@ -0,0 +1,1249 @@
+<?php
+
+namespace ChamiloLMS\CoreBundle\DataFixtures\ORM;
+
+use Doctrine\Common\DataFixtures\FixtureInterface;
+use Doctrine\Common\DataFixtures\OrderedFixtureInterface;
+use Doctrine\Common\DataFixtures\AbstractFixture;
+use Doctrine\Common\Persistence\ObjectManager;
+
+use Sonata\PageBundle\Model\SiteInterface;
+use Sonata\PageBundle\Model\PageInterface;
+
+use Symfony\Cmf\Bundle\RoutingBundle\Tests\Unit\Doctrine\Orm\ContentRepositoryTest;
+use Symfony\Component\DependencyInjection\ContainerAwareInterface;
+use Symfony\Component\DependencyInjection\ContainerInterface;
+
+class LoadPageData extends AbstractFixture implements ContainerAwareInterface, OrderedFixtureInterface
+{
+    private $container;
+
+    public function getOrder()
+    {
+        return 2;
+    }
+
+    public function setContainer(ContainerInterface $container = null)
+    {
+        $this->container = $container;
+    }
+
+    public function load(ObjectManager $manager)
+    {
+        $site = $this->createSite();
+
+        $this->createGlobalPage($site);
+
+
+        // app/console sonata:page:update-core-routes --site=all
+        // app/console sonata:page:create-snapshots --site=all
+
+        //$this->createHomePage($site);
+
+        /*
+       $this->create404ErrorPage($site);
+       $this->create500ErrorPage($site);
+       $this->createBlogIndex($site);
+       $this->createGalleryIndex($site);
+       $this->createMediaPage($site);
+       $this->createProductPage($site);
+       $this->createBasketPage($site);
+       $this->createUserPage($site);
+       $this->createApiPage($site);
+       $this->createLegalNotesPage($site);
+       $this->createTermsPage($site);
+
+       // Create footer pages
+       $this->createWhoWeArePage($site);
+       $this->createClientTestimonialsPage($site);
+       $this->createPressPage($site);
+       $this->createFAQPage($site);
+       $this->createContactUsPage($site);
+       $this->createBundlesPage($site);
+
+       $this->createSubSite();*/
+    }
+
+    /**
+     * @return SiteInterface $site
+     */
+    public function createSite()
+    {
+        $site = $this->getSiteManager()->create();
+
+        $site->setHost('localhost');
+        $site->setEnabled(true);
+        $site->setName('localhost');
+        $site->setEnabledFrom(new \DateTime('now'));
+        $site->setEnabledTo(new \DateTime('+10 years'));
+        $site->setRelativePath("");
+        $site->setIsDefault(true);
+
+        $this->getSiteManager()->save($site);
+
+        return $site;
+    }
+
+    public function createSubSite()
+    {
+        $site = $this->getSiteManager()->create();
+
+        $site->setHost('localhost');
+        $site->setEnabled(true);
+        $site->setName('sub site');
+        $site->setEnabledFrom(new \DateTime('now'));
+        $site->setEnabledTo(new \DateTime('+10 years'));
+        $site->setRelativePath("/sub-site");
+        $site->setIsDefault(false);
+
+        $this->getSiteManager()->save($site);
+
+        return $site;
+    }
+
+    /**
+     * @param SiteInterface $site
+     */
+    public function createBlogIndex(SiteInterface $site)
+    {
+        $pageManager = $this->getPageManager();
+
+        $blogIndex = $pageManager->create();
+        $blogIndex->setSlug('blog');
+        $blogIndex->setUrl('/blog');
+        $blogIndex->setName('News');
+        $blogIndex->setTitle('News');
+        $blogIndex->setEnabled(true);
+        $blogIndex->setDecorate(1);
+        $blogIndex->setRequestMethod('GET|POST|HEAD|DELETE|PUT');
+        $blogIndex->setTemplateCode('default');
+        $blogIndex->setRouteName('sonata_news_home');
+        $blogIndex->setParent($this->getReference('page-homepage'));
+        $blogIndex->setSite($site);
+
+        $pageManager->save($blogIndex);
+    }
+
+    /**
+     * @param SiteInterface $site
+     */
+    public function createGalleryIndex(SiteInterface $site)
+    {
+        $pageManager = $this->getPageManager();
+        $blockManager = $this->getBlockManager();
+        $blockInteractor = $this->getBlockInteractor();
+
+        $galleryIndex = $pageManager->create();
+        $galleryIndex->setSlug('gallery');
+        $galleryIndex->setUrl('/media/gallery');
+        $galleryIndex->setName('Gallery');
+        $galleryIndex->setTitle('Gallery');
+        $galleryIndex->setEnabled(true);
+        $galleryIndex->setDecorate(1);
+        $galleryIndex->setRequestMethod('GET|POST|HEAD|DELETE|PUT');
+        $galleryIndex->setTemplateCode('default');
+        $galleryIndex->setRouteName('sonata_media_gallery_index');
+        $galleryIndex->setParent($this->getReference('page-homepage'));
+        $galleryIndex->setSite($site);
+
+        // CREATE A HEADER BLOCK
+        $galleryIndex->addBlocks($content = $blockInteractor->createNewContainer(array(
+            'enabled' => true,
+            'page' => $galleryIndex,
+            'code' => 'content_top',
+        )));
+
+        $content->setName('The content_top container');
+
+        // add the breadcrumb
+        $content->addChildren($breadcrumb = $blockManager->create());
+        $breadcrumb->setType('sonata.page.block.breadcrumb');
+        $breadcrumb->setPosition(0);
+        $breadcrumb->setEnabled(true);
+        $breadcrumb->setPage($galleryIndex);
+
+        // add a block text
+        $content->addChildren($text = $blockManager->create());
+        $text->setType('sonata.block.service.text');
+        $text->setSetting('content', <<<CONTENT
+
+<h1>Gallery List</h1>
+
+<p>
+    This current text is defined in a <code>text block</code> linked to a custom symfony action <code>GalleryController::indexAction</code>
+    the SonataPageBundle can encapsulate an action into a dedicated template. <br /><br />
+
+    If you are connected as an admin you can click on <code>Show Zone</code> to see the different editable areas. Once
+    areas are displayed, just double click on one to edit it.
+</p>
+
+CONTENT
+        );
+        $text->setPosition(1);
+        $text->setEnabled(true);
+        $text->setPage($galleryIndex);
+
+        $pageManager->save($galleryIndex);
+    }
+
+    /**
+     * @param SiteInterface $site
+     */
+    public function createTermsPage(SiteInterface $site)
+    {
+        $pageManager = $this->getPageManager();
+        $blockManager = $this->getBlockManager();
+        $blockInteractor = $this->getBlockInteractor();
+
+        $terms = $pageManager->create();
+        $terms->setSlug('shop-payment-terms-and-conditions');
+        $terms->setUrl('/shop/payment/terms-and-conditions');
+        $terms->setName('Terms and conditions');
+        $terms->setTitle('Terms and conditions');
+        $terms->setEnabled(true);
+        $terms->setDecorate(1);
+        $terms->setRequestMethod('GET|POST|HEAD|DELETE|PUT');
+        $terms->setTemplateCode('default');
+        $terms->setRouteName('sonata_payment_terms');
+        $terms->setParent($this->getReference('page-homepage'));
+        $terms->setSite($site);
+
+        // CREATE A HEADER BLOCK
+        $terms->addBlocks($content = $blockInteractor->createNewContainer(array(
+            'enabled' => true,
+            'page' => $terms,
+            'code' => 'content_top',
+        )));
+        $content->setName('The content_top container');
+
+        // add the breadcrumb
+        $content->addChildren($breadcrumb = $blockManager->create());
+        $breadcrumb->setType('sonata.page.block.breadcrumb');
+        $breadcrumb->setPosition(0);
+        $breadcrumb->setEnabled(true);
+        $breadcrumb->setPage($terms);
+
+        $pageManager->save($terms);
+    }
+
+    /**
+     * @param SiteInterface $site
+     */
+    public function createHomePage(SiteInterface $site)
+    {
+        $pageManager = $this->getPageManager();
+        $blockManager = $this->getBlockManager();
+        $blockInteractor = $this->getBlockInteractor();
+
+        $this->addReference('page-homepage', $homepage = $pageManager->create());
+        $homepage->setSlug('/');
+        $homepage->setUrl('/');
+        $homepage->setName('Home');
+        $homepage->setTitle('Homepage');
+        $homepage->setEnabled(true);
+        $homepage->setDecorate(0);
+        $homepage->setRequestMethod('GET|POST|HEAD|DELETE|PUT');
+        $homepage->setTemplateCode('2columns');
+        $homepage->setRouteName(PageInterface::PAGE_ROUTE_CMS_NAME);
+        $homepage->setSite($site);
+
+        $pageManager->save($homepage);
+
+        // CREATE A HEADER BLOCK
+        $homepage->addBlocks($contentTop = $blockInteractor->createNewContainer(array(
+            'enabled' => true,
+            'page' => $homepage,
+            'code' => 'content_top',
+        )));
+
+        $contentTop->setName('The container top container');
+
+        $blockManager->save($contentTop);
+
+        // add a block text
+        $contentTop->addChildren($text = $blockManager->create());
+        $text->setType('sonata.block.service.text');
+        $text->setSetting('content', <<<CONTENT
+<div class="col-md-3 welcome"><h2>Welcome</h2></div>
+<div class="col-md-9">
+    <p>
+        This page is a demo of the Sonata Sandbox available on <a href="https://github.com/sonata-project/sandbox">github</a>.
+        This demo try to be interactive so you will be able to found out the different features provided by the Sonata's Bundle.
+    </p>
+
+    <p>
+        First this page and all the other pages are served by the <code>SonataPageBundle</code>, a page is composed by different
+        blocks.
+    </p>
+</div>
+CONTENT
+        );
+        $text->setPosition(1);
+        $text->setEnabled(true);
+        $text->setPage($homepage);
+
+
+        $homepage->addBlocks($content = $blockInteractor->createNewContainer(array(
+            'enabled' => true,
+            'page' => $homepage,
+            'code' => 'content',
+        )));
+        $content->setName('The content container');
+        $blockManager->save($content);
+
+        // Add media gallery block
+        $content->addChildren($gallery = $blockManager->create());
+        $gallery->setType('sonata.media.block.gallery');
+        $gallery->setSetting('galleryId', $this->getReference('media-gallery')->getId());
+        $gallery->setSetting('context', 'default');
+        $gallery->setSetting('format', 'big');
+        $gallery->setPosition(1);
+        $gallery->setEnabled(true);
+        $gallery->setPage($homepage);
+
+        // Add recent products block
+        $content->addChildren($newProductsBlock = $blockManager->create());
+        $newProductsBlock->setType('sonata.product.block.recent_products');
+        $newProductsBlock->setSetting('number', 4);
+        $newProductsBlock->setSetting('title', 'New products');
+        $newProductsBlock->setPosition(2);
+        $newProductsBlock->setEnabled(true);
+        $newProductsBlock->setPage($homepage);
+
+        // Add homepage bottom container
+        $homepage->addBlocks($bottom = $blockInteractor->createNewContainer(array(
+            'enabled' => true,
+            'page'    => $homepage,
+            'code'    => 'content_bottom',
+        ), function ($container) {
+            $container->setSetting('layout', '{{ CONTENT }}');
+        }));
+        $bottom->setName('The bottom content container');
+
+        // Add homepage newsletter container
+        $bottom->addChildren($bottomNewsletter = $blockInteractor->createNewContainer(array(
+            'enabled' => true,
+            'page'    => $homepage,
+            'code'    => 'bottom_newsletter',
+        ), function ($container) {
+            $container->setSetting('layout', '<div class="block-newsletter col-sm-6 well">{{ CONTENT }}</div>');
+        }));
+        $bottomNewsletter->setName('The bottom newsetter container');
+        $bottomNewsletter->addChildren($newsletter = $blockManager->create());
+        $newsletter->setType('sonata.demo.block.newsletter');
+        $newsletter->setPosition(1);
+        $newsletter->setEnabled(true);
+        $newsletter->setPage($homepage);
+
+        // Add homepage embed tweet container
+        $bottom->addChildren($bottomEmbed = $blockInteractor->createNewContainer(array(
+            'enabled' => true,
+            'page'    => $homepage,
+            'code'    => 'bottom_embed',
+        ), function ($container) {
+            $container->setSetting('layout', '<div class="col-sm-6">{{ CONTENT }}</div>');
+        }));
+        $bottomEmbed->setName('The bottom embedded tweet container');
+        $bottomEmbed->addChildren($embedded = $blockManager->create());
+        $embedded->setType('sonata.seo.block.twitter.embed');
+        $embedded->setPosition(1);
+        $embedded->setEnabled(true);
+        $embedded->setSetting('tweet', "https://twitter.com/dunglas/statuses/438337742565826560");
+        $embedded->setSetting('lang', "en");
+        $embedded->setPage($homepage);
+
+        $pageManager->save($homepage);
+    }
+
+    /**
+     * @param SiteInterface $site
+     */
+    public function createProductPage(SiteInterface $site)
+    {
+        $pageManager = $this->getPageManager();
+
+        $category = $pageManager->create();
+
+        $category->setSlug('shop-category');
+        $category->setUrl('/shop/category');
+        $category->setName('Shop');
+        $category->setTitle('Shop');
+        $category->setEnabled(true);
+        $category->setDecorate(1);
+        $category->setRequestMethod('GET|POST|HEAD|DELETE|PUT');
+        $category->setTemplateCode('default');
+        $category->setRouteName('sonata_catalog_index');
+        $category->setSite($site);
+        $category->setParent($this->getReference('page-homepage'));
+
+        $pageManager->save($category);
+    }
+
+    /**
+     * @param SiteInterface $site
+     */
+    public function createBasketPage(SiteInterface $site)
+    {
+        $pageManager = $this->getPageManager();
+
+        $basket = $pageManager->create();
+
+        $basket->setSlug('shop-basket');
+        $basket->setUrl('/shop/basket');
+        $basket->setName('Basket');
+        $basket->setEnabled(true);
+        $basket->setDecorate(1);
+        $basket->setRequestMethod('GET|POST|HEAD|DELETE|PUT');
+        $basket->setTemplateCode('default');
+        $basket->setRouteName('sonata_basket_index');
+        $basket->setSite($site);
+        $basket->setParent($this->getReference('page-homepage'));
+
+        $pageManager->save($basket);
+    }
+
+    /**
+     * @param SiteInterface $site
+     */
+    public function createMediaPage(SiteInterface $site)
+    {
+        $pageManager = $this->getPageManager();
+        $blockManager = $this->getBlockManager();
+        $blockInteractor = $this->getBlockInteractor();
+
+        $this->addReference('page-media', $media = $pageManager->create());
+        $media->setSlug('/media');
+        $media->setUrl('/media');
+        $media->setName('Media & Seo');
+        $media->setTitle('Media & Seo');
+        $media->setEnabled(true);
+        $media->setDecorate(1);
+        $media->setRequestMethod('GET|POST|HEAD|DELETE|PUT');
+        $media->setTemplateCode('default');
+        $media->setRouteName('sonata_demo_media');
+        $media->setSite($site);
+        $media->setParent($this->getReference('page-homepage'));
+
+        // CREATE A HEADER BLOCK
+        $media->addBlocks($content = $blockInteractor->createNewContainer(array(
+            'enabled' => true,
+            'page' => $media,
+            'code' => 'content_top',
+        )));
+
+        $content->setName('The content_top container');
+
+        // add the breadcrumb
+        $content->addChildren($breadcrumb = $blockManager->create());
+        $breadcrumb->setType('sonata.page.block.breadcrumb');
+        $breadcrumb->setPosition(0);
+        $breadcrumb->setEnabled(true);
+        $breadcrumb->setPage($media);
+
+        $pageManager->save($media);
+    }
+
+    /**
+     * @param SiteInterface $site
+     */
+    public function createUserPage(SiteInterface $site)
+    {
+        $this->createTextContentPage($site, 'user', 'Admin', <<<CONTENT
+<div>
+
+    <h3>Available accounts</h3>
+    You can connect to the <a href="/admin/dashboard">admin section</a> by using two different accounts:<br>
+
+    <ul>
+        <li><em>Standard</em> user:
+            <ul>
+                <li> Login - <strong>johndoe</strong></li>
+                <li> Password - <strong>johndoe</strong></li>
+            </ul>
+        </li>
+        <li><em>Admin</em> user:
+            <ul>
+                <li> Login - <strong>admin</strong></li>
+                <li> Password - <strong>admin</strong></li>
+            </ul>
+        </li>
+        <li><em>Two-step Verification admin</em> user:
+            <ul>
+                <li> Login - <strong>secure</strong></li>
+                <li> Password - <strong>secure</strong></li>
+                <li> Key - <strong>4YU4QGYPB63HDN2C</strong></li>
+            </ul>
+        </li>
+    </ul>
+
+    <h3>Two-Step Verification</h3>
+    The <strong>secure</strong> account is a demo of the Two-Step Verification provided by
+    the <a href="http://sonata-project.org/bundles/user/2-0/doc/reference/two_step_validation.html">Sonata User Bundle</a>
+
+    <br />
+    <br />
+    <center>
+        <img src="/bundles/sonatademo/images/secure_qr_code.png" class="img-polaroid" />
+        <br />
+        <em>Take a shot of this QR Code with <a href="https://support.google.com/accounts/bin/answer.py?hl=en&answer=1066447">Google Authenticator</a></em>
+    </center>
+
+</div>
+
+CONTENT
+        );
+    }
+
+    /**
+     * @param SiteInterface $site
+     */
+    public function createApiPage(SiteInterface $site)
+    {
+        $this->createTextContentPage($site, 'api-landing', 'API', <<<CONTENT
+<div>
+
+    <h3>Available account</h3>
+    You can connect to the <a href="/api/doc">api documentation</a> by using the following account:<br>
+
+    <ul>
+        <li> Login - <strong>admin</strong></li>
+        <li> Password - <strong>admin</strong></li>
+    </ul>
+
+    <br />
+    <br />
+    <center>
+        <img src="/bundles/sonatademo/images/api.png" class="img-rounded" />
+    </center>
+
+</div>
+
+CONTENT
+        );
+    }
+
+    /**
+     * @param SiteInterface $site
+     */
+    public function createLegalNotesPage(SiteInterface $site)
+    {
+        $this->createTextContentPage($site, 'legal-notes', 'Legal notes', <<<CONTENT
+<p>The Sonata framework is built with many great open source libraries / tools.</p>
+<section>
+    <h3>Backend</h3>
+    <ul>
+        <li><a href="http://symfony.com" title="Symfony, PHP framework official website">Symfony 2</a>, the PHP framework for web projects (Code licensed under MIT),</li>
+        <li><a href="http://twig.sensiolabs.org" title="Twig, PHP template engine">Twig</a>, the PHP template engine (Code licensed under the new BSD license),</li>
+        <li><a href="http://www.doctrine-project.org" title="Doctrine, PHP ORM">Doctrine</a>, the PHP ORM.</li>
+    </ul>
+</section>
+<section>
+    <h3>Frontend</h3>
+    <ul>
+        <li><a href="http://jquery.com" title="jQuery javascript library">jQuery</a>, a cross-platform JavaScript library (Code licensed under MIT),</li>
+        <li><a href="http://getbootstrap.com" title="Bootstrap front-end framework">Bootstrap</a>, the front-end framework (Code licensed under MIT),</li>
+        <li><a href="http://glyphicons.com" title="GLYPHICONS icons">GLYPHICONS</a>, library included in the Bootstrap framework (same license as Bootstrap).</li>
+    </ul>
+</section>
+<section>
+    <h3>Other miscellaneous tools</h3>
+    <ul>
+        <li><a href="https://www.github.com" title="Github, code distribution tool">Github</a></li>
+        <li><a href="http://getcomposer.org" title="Composer, dependency management tool">Composer</a></li>
+        <li><a href="https://packagist.org" title="Packagist, PHP packages repository">Packagist</a></li>
+        <li><a href="https://travis-ci.org" title="Travis CI, continuous integration tool">Travis CI</a></li>
+        <li><a href="http://phpunit.de" title="PHPUnit, PHP unit testing library">PHPUnit</a></li>
+        <li><a href="http://behat.org" title="Behat, test driven development tool">Behat</a></li>
+    </ul>
+</section>
+CONTENT
+        );
+    }
+
+    /**
+     * Creates the "Who we are" content page (link available in footer)
+     *
+     * @param SiteInterface $site
+     *
+     * @return void
+     */
+    public function createWhoWeArePage(SiteInterface $site)
+    {
+        $this->createTextContentPage($site, 'who-we-are', 'Who we are', <<<CONTENT
+<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Ut quis sapien gravida, eleifend diam id, vehicula erat. Aenean ultrices facilisis tellus. Vivamus vitae molestie diam. Donec quis mi porttitor, lobortis ipsum quis, fermentum dui. Donec nec nibh nec risus porttitor pretium et et lorem. Nullam mauris sapien, rutrum sed neque et, convallis ullamcorper lacus. Nullam vehicula a lectus vel suscipit. Nam gravida faucibus fermentum.</p>
+<p>Pellentesque dapibus eu nisi quis adipiscing. Phasellus adipiscing turpis nunc, sed interdum ante porta eu. Ut tempus, purus posuere molestie cursus, quam nisi fermentum est, dictum gravida nulla turpis vel nunc. Maecenas eget sem quam. Nam condimentum mi id lectus venenatis, sit amet semper purus convallis. Nunc ullamcorper magna mi, non adipiscing velit semper quis. Duis vel justo libero. Suspendisse laoreet hendrerit augue cursus congue. Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia Curae;</p>
+<p>Nullam dignissim sapien vestibulum erat lobortis, sed imperdiet elit varius. Fusce nisi eros, feugiat commodo scelerisque a, lacinia et quam. In neque risus, dignissim non magna non, ultricies faucibus elit. Vivamus in facilisis enim, porttitor volutpat justo. Praesent placerat feugiat nibh et fermentum. Vivamus eu fermentum metus. Sed mattis volutpat quam a suscipit. Donec blandit sagittis est, ac tristique arcu venenatis sed. Fusce vel libero id lectus aliquet sollicitudin. Fusce ultrices porta est, non pellentesque lorem accumsan eget. Fusce id libero sit amet nulla venenatis dapibus. Maecenas fermentum tellus eu magna mollis gravida. Nam non nibh magna.</p>
+CONTENT
+        );
+    }
+
+    /**
+     * Creates the "Client testimonials" content page (link available in footer)
+     *
+     * @param SiteInterface $site
+     *
+     * @return void
+     */
+    public function createClientTestimonialsPage(SiteInterface $site)
+    {
+        $this->createTextContentPage($site, 'client-testimonials', 'Client testimonials', <<<CONTENT
+<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Ut quis sapien gravida, eleifend diam id, vehicula erat. Aenean ultrices facilisis tellus. Vivamus vitae molestie diam. Donec quis mi porttitor, lobortis ipsum quis, fermentum dui. Donec nec nibh nec risus porttitor pretium et et lorem. Nullam mauris sapien, rutrum sed neque et, convallis ullamcorper lacus. Nullam vehicula a lectus vel suscipit. Nam gravida faucibus fermentum.</p>
+<p>Pellentesque dapibus eu nisi quis adipiscing. Phasellus adipiscing turpis nunc, sed interdum ante porta eu. Ut tempus, purus posuere molestie cursus, quam nisi fermentum est, dictum gravida nulla turpis vel nunc. Maecenas eget sem quam. Nam condimentum mi id lectus venenatis, sit amet semper purus convallis. Nunc ullamcorper magna mi, non adipiscing velit semper quis. Duis vel justo libero. Suspendisse laoreet hendrerit augue cursus congue. Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia Curae;</p>
+<p>Nullam dignissim sapien vestibulum erat lobortis, sed imperdiet elit varius. Fusce nisi eros, feugiat commodo scelerisque a, lacinia et quam. In neque risus, dignissim non magna non, ultricies faucibus elit. Vivamus in facilisis enim, porttitor volutpat justo. Praesent placerat feugiat nibh et fermentum. Vivamus eu fermentum metus. Sed mattis volutpat quam a suscipit. Donec blandit sagittis est, ac tristique arcu venenatis sed. Fusce vel libero id lectus aliquet sollicitudin. Fusce ultrices porta est, non pellentesque lorem accumsan eget. Fusce id libero sit amet nulla venenatis dapibus. Maecenas fermentum tellus eu magna mollis gravida. Nam non nibh magna.</p>
+CONTENT
+        );
+    }
+
+    /**
+     * Creates the "Press" content page (link available in footer)
+     *
+     * @param SiteInterface $site
+     *
+     * @return void
+     */
+    public function createPressPage(SiteInterface $site)
+    {
+        $this->createTextContentPage($site, 'press', 'Press', <<<CONTENT
+<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Ut quis sapien gravida, eleifend diam id, vehicula erat. Aenean ultrices facilisis tellus. Vivamus vitae molestie diam. Donec quis mi porttitor, lobortis ipsum quis, fermentum dui. Donec nec nibh nec risus porttitor pretium et et lorem. Nullam mauris sapien, rutrum sed neque et, convallis ullamcorper lacus. Nullam vehicula a lectus vel suscipit. Nam gravida faucibus fermentum.</p>
+<p>Pellentesque dapibus eu nisi quis adipiscing. Phasellus adipiscing turpis nunc, sed interdum ante porta eu. Ut tempus, purus posuere molestie cursus, quam nisi fermentum est, dictum gravida nulla turpis vel nunc. Maecenas eget sem quam. Nam condimentum mi id lectus venenatis, sit amet semper purus convallis. Nunc ullamcorper magna mi, non adipiscing velit semper quis. Duis vel justo libero. Suspendisse laoreet hendrerit augue cursus congue. Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia Curae;</p>
+<p>Nullam dignissim sapien vestibulum erat lobortis, sed imperdiet elit varius. Fusce nisi eros, feugiat commodo scelerisque a, lacinia et quam. In neque risus, dignissim non magna non, ultricies faucibus elit. Vivamus in facilisis enim, porttitor volutpat justo. Praesent placerat feugiat nibh et fermentum. Vivamus eu fermentum metus. Sed mattis volutpat quam a suscipit. Donec blandit sagittis est, ac tristique arcu venenatis sed. Fusce vel libero id lectus aliquet sollicitudin. Fusce ultrices porta est, non pellentesque lorem accumsan eget. Fusce id libero sit amet nulla venenatis dapibus. Maecenas fermentum tellus eu magna mollis gravida. Nam non nibh magna.</p>
+CONTENT
+        );
+    }
+
+    /**
+     * Creates the "FAQ" content page (link available in footer)
+     *
+     * @param SiteInterface $site
+     *
+     * @return void
+     */
+    public function createFAQPage(SiteInterface $site)
+    {
+        $this->createTextContentPage($site, 'faq', 'FAQ', <<<CONTENT
+<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Ut quis sapien gravida, eleifend diam id, vehicula erat. Aenean ultrices facilisis tellus. Vivamus vitae molestie diam. Donec quis mi porttitor, lobortis ipsum quis, fermentum dui. Donec nec nibh nec risus porttitor pretium et et lorem. Nullam mauris sapien, rutrum sed neque et, convallis ullamcorper lacus. Nullam vehicula a lectus vel suscipit. Nam gravida faucibus fermentum.</p>
+<p>Pellentesque dapibus eu nisi quis adipiscing. Phasellus adipiscing turpis nunc, sed interdum ante porta eu. Ut tempus, purus posuere molestie cursus, quam nisi fermentum est, dictum gravida nulla turpis vel nunc. Maecenas eget sem quam. Nam condimentum mi id lectus venenatis, sit amet semper purus convallis. Nunc ullamcorper magna mi, non adipiscing velit semper quis. Duis vel justo libero. Suspendisse laoreet hendrerit augue cursus congue. Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia Curae;</p>
+<p>Nullam dignissim sapien vestibulum erat lobortis, sed imperdiet elit varius. Fusce nisi eros, feugiat commodo scelerisque a, lacinia et quam. In neque risus, dignissim non magna non, ultricies faucibus elit. Vivamus in facilisis enim, porttitor volutpat justo. Praesent placerat feugiat nibh et fermentum. Vivamus eu fermentum metus. Sed mattis volutpat quam a suscipit. Donec blandit sagittis est, ac tristique arcu venenatis sed. Fusce vel libero id lectus aliquet sollicitudin. Fusce ultrices porta est, non pellentesque lorem accumsan eget. Fusce id libero sit amet nulla venenatis dapibus. Maecenas fermentum tellus eu magna mollis gravida. Nam non nibh magna.</p>
+CONTENT
+        );
+    }
+
+    /**
+     * Creates the "Contact us" content page (link available in footer)
+     *
+     * @param SiteInterface $site
+     *
+     * @return void
+     */
+    public function createContactUsPage(SiteInterface $site)
+    {
+        $this->createTextContentPage($site, 'contact-us', 'Contact us', <<<CONTENT
+<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Ut quis sapien gravida, eleifend diam id, vehicula erat. Aenean ultrices facilisis tellus. Vivamus vitae molestie diam. Donec quis mi porttitor, lobortis ipsum quis, fermentum dui. Donec nec nibh nec risus porttitor pretium et et lorem. Nullam mauris sapien, rutrum sed neque et, convallis ullamcorper lacus. Nullam vehicula a lectus vel suscipit. Nam gravida faucibus fermentum.</p>
+<p>Pellentesque dapibus eu nisi quis adipiscing. Phasellus adipiscing turpis nunc, sed interdum ante porta eu. Ut tempus, purus posuere molestie cursus, quam nisi fermentum est, dictum gravida nulla turpis vel nunc. Maecenas eget sem quam. Nam condimentum mi id lectus venenatis, sit amet semper purus convallis. Nunc ullamcorper magna mi, non adipiscing velit semper quis. Duis vel justo libero. Suspendisse laoreet hendrerit augue cursus congue. Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia Curae;</p>
+<p>Nullam dignissim sapien vestibulum erat lobortis, sed imperdiet elit varius. Fusce nisi eros, feugiat commodo scelerisque a, lacinia et quam. In neque risus, dignissim non magna non, ultricies faucibus elit. Vivamus in facilisis enim, porttitor volutpat justo. Praesent placerat feugiat nibh et fermentum. Vivamus eu fermentum metus. Sed mattis volutpat quam a suscipit. Donec blandit sagittis est, ac tristique arcu venenatis sed. Fusce vel libero id lectus aliquet sollicitudin. Fusce ultrices porta est, non pellentesque lorem accumsan eget. Fusce id libero sit amet nulla venenatis dapibus. Maecenas fermentum tellus eu magna mollis gravida. Nam non nibh magna.</p>
+CONTENT
+        );
+    }
+
+    public function createBundlesPage(SiteInterface $site)
+    {
+        $this->createTextContentPage($site, 'bundles', 'Sonata Bundles', <<<CONTENT
+<div class="row">
+<div class="col-md-6">
+
+    <div class="panel panel-success">
+      <div class="panel-heading">
+        <h3 class="panel-title">Admin bundles</h3>
+      </div>
+      <div class="panel-body">
+        Lorem ipsum dolor sit amet, consectetur adipiscing elit. Ut quis sapien gravida, eleifend diam id, vehicula erat.
+      </div>
+      <ul class="list-group">
+        <li class="list-group-item">
+          <div class="media">
+            <a class="pull-left" href="#">
+              <img class="media-object" src="/bundles/sonatademo/images/sonata-logo.png">
+            </a>
+            <div class="media-body">
+              <h4 class="media-heading"><a href="http://sonata-project.org/bundles/admin">Admin</a></h4>
+              The missing Symfony2 Admin Generator.
+            </div>
+          </div>
+        </li>
+        <li class="list-group-item">
+          <div class="media">
+            <a class="pull-left" href="#">
+              <img class="media-object" src="/bundles/sonatademo/images/sonata-logo.png">
+            </a>
+            <div class="media-body">
+              <h4 class="media-heading"><a href="http://sonata-project.org/bundles/doctrine-orm-admin">Doctrine2 ORM Admin</a></h4>
+              Integrates the Doctrine2 ORM into the Admin Bundle.
+            </div>
+          </div>
+        </li>
+        <li class="list-group-item">
+          <div class="media">
+            <a class="pull-left" href="#">
+              <img class="media-object" src="/bundles/sonatademo/images/sonata-logo.png">
+            </a>
+            <div class="media-body">
+              <h4 class="media-heading"><a href="http://sonata-project.org/bundles/propel-admin">Propel Admin</a></h4>
+              Integrates the Propel into the Admin Bundle.
+            </div>
+          </div>
+        </li>
+      </ul>
+    </div>
+
+    <div class="panel panel-info">
+      <div class="panel-heading">
+        <h3 class="panel-title">Foundation bundles</h3>
+      </div>
+      <div class="panel-body">
+        Lorem ipsum dolor sit amet, consectetur adipiscing elit. Ut quis sapien gravida, eleifend diam id, vehicula erat.
+      </div>
+      <ul class="list-group">
+        <li class="list-group-item">
+          <div class="media">
+            <a class="pull-left" href="#">
+              <img class="media-object" src="/bundles/sonatademo/images/sonata-logo.png">
+            </a>
+            <div class="media-body">
+              <h4 class="media-heading"><a href="http://sonata-project.org/bundles/core">Core</a></h4>
+              Provides base classes used by Sonata's Bundles.
+            </div>
+          </div>
+        </li>
+        <li class="list-group-item">
+          <div class="media">
+            <a class="pull-left" href="#">
+              <img class="media-object" src="/bundles/sonatademo/images/sonata-logo.png">
+            </a>
+            <div class="media-body">
+              <h4 class="media-heading"><a href="http://sonata-project.org/bundles/notification">Notification</a></h4>
+              Message Queue Solution with Abstracted Backends.
+            </div>
+          </div>
+        </li>
+        <li class="list-group-item">
+          <div class="media">
+            <a class="pull-left" href="#">
+              <img class="media-object" src="/bundles/sonatademo/images/sonata-logo.png">
+            </a>
+            <div class="media-body">
+              <h4 class="media-heading"><a href="http://sonata-project.org/bundles/formatter">Formatter</a></h4>
+              Add text helpers.
+            </div>
+          </div>
+        </li>
+        <li class="list-group-item">
+          <div class="media">
+            <a class="pull-left" href="#">
+              <img class="media-object" src="/bundles/sonatademo/images/sonata-logo.png">
+            </a>
+            <div class="media-body">
+              <h4 class="media-heading"><a href="http://sonata-project.org/bundles/intl">Internationalization (i18n)</a></h4>
+              Integrate the PHP Intl extension into a Symfony2 Project.
+            </div>
+          </div>
+        </li>
+        <li class="list-group-item">
+          <div class="media">
+            <a class="pull-left" href="#">
+              <img class="media-object" src="/bundles/sonatademo/images/sonata-logo.png">
+            </a>
+            <div class="media-body">
+              <h4 class="media-heading"><a href="http://sonata-project.org/bundles/cache">Cache</a></h4>
+              Cache handlers&nbsp;: ESI, Memcached, APC and more…
+            </div>
+          </div>
+        </li>
+        <li class="list-group-item">
+          <div class="media">
+            <a class="pull-left" href="#">
+              <img class="media-object" src="/bundles/sonatademo/images/sonata-logo.png">
+            </a>
+            <div class="media-body">
+              <h4 class="media-heading"><a href="http://sonata-project.org/bundles/seo">SEO</a></h4>
+              Integrates a shareable object to handle all SEO requirements&nbsp;: title, meta, Open Graph and more…
+            </div>
+          </div>
+        </li>
+        <li class="list-group-item">
+          <div class="media">
+            <a class="pull-left" href="#">
+              <img class="media-object" src="/bundles/sonatademo/images/sonata-logo.png">
+            </a>
+            <div class="media-body">
+              <h4 class="media-heading"><a href="http://sonata-project.org/bundles/easy-extends">EasyExtends</a></h4>
+              EasyExtends is a tool for generating a valid bundle structure from a Vendor Bundle.
+            </div>
+          </div>
+        </li>
+      </ul>
+    </div>
+
+</div>
+<div class="col-md-6">
+
+    <div class="panel panel-warning">
+      <div class="panel-heading">
+        <h3 class="panel-title">E-commerce bundles</h3>
+      </div>
+      <div class="panel-body">
+        Lorem ipsum dolor sit amet, consectetur adipiscing elit. Ut quis sapien gravida, eleifend diam id, vehicula erat.
+      </div>
+      <ul class="list-group">
+        <li class="list-group-item">
+          <div class="media">
+            <a class="pull-left" href="#">
+              <img class="media-object" src="/bundles/sonatademo/images/sonata-logo.png">
+            </a>
+            <div class="media-body">
+              <h4 class="media-heading"><a href="http://sonata-project.org/bundles/ecommerce">Ecommerce</a></h4>
+              Implements base tools for integrated e-commerce features
+            </div>
+          </div>
+        </li>
+      </ul>
+    </div>
+
+    <div class="panel panel-danger">
+      <div class="panel-heading">
+        <h3 class="panel-title">Features bundles</h3>
+      </div>
+      <div class="panel-body">
+        Lorem ipsum dolor sit amet, consectetur adipiscing elit. Ut quis sapien gravida, eleifend diam id, vehicula erat.
+      </div>
+      <ul class="list-group">
+        <li class="list-group-item">
+          <div class="media">
+            <a class="pull-left" href="#">
+              <img class="media-object" src="/bundles/sonatademo/images/sonata-logo.png">
+            </a>
+            <div class="media-body">
+              <h4 class="media-heading"><a href="http://sonata-project.org/bundles/page">Page</a></h4>
+              A Symfony2 friendly CMS.
+            </div>
+          </div>
+        </li>
+        <li class="list-group-item">
+          <div class="media">
+            <a class="pull-left" href="#">
+              <img class="media-object" src="/bundles/sonatademo/images/sonata-logo.png">
+            </a>
+            <div class="media-body">
+              <h4 class="media-heading"><a href="http://sonata-project.org/bundles/media">Media</a></h4>
+              Media management bundle on steroid for Symfony2.
+            </div>
+          </div>
+        </li>
+        <li class="list-group-item">
+          <div class="media">
+            <a class="pull-left" href="#">
+              <img class="media-object" src="/bundles/sonatademo/images/sonata-logo.png">
+            </a>
+            <div class="media-body">
+              <h4 class="media-heading"><a href="http://sonata-project.org/bundles/news">News</a></h4>
+              A simple blog/news platform.
+            </div>
+          </div>
+        </li>
+        <li class="list-group-item">
+          <div class="media">
+            <a class="pull-left" href="#">
+              <img class="media-object" src="/bundles/sonatademo/images/sonata-logo.png">
+            </a>
+            <div class="media-body">
+              <h4 class="media-heading"><a href="http://sonata-project.org/bundles/user">User</a></h4>
+              FOS/User integration.
+            </div>
+          </div>
+        </li>
+        <li class="list-group-item">
+          <div class="media">
+            <a class="pull-left" href="#">
+              <img class="media-object" src="/bundles/sonatademo/images/sonata-logo.png">
+            </a>
+            <div class="media-body">
+              <h4 class="media-heading"><a href="http://sonata-project.org/bundles/block">Block</a></h4>
+              Handle rendering of block element. A block is a small unit with its own logic and templates. A block can be inserted anywhere in a current template.
+            </div>
+          </div>
+        </li>
+        <li class="list-group-item">
+          <div class="media">
+            <a class="pull-left" href="#">
+              <img class="media-object" src="/bundles/sonatademo/images/sonata-logo.png">
+            </a>
+            <div class="media-body">
+              <h4 class="media-heading"><a href="http://sonata-project.org/bundles/timeline">Timeline</a></h4>
+              Integrates SpyTimelineBundle into Sonata's bundles.
+            </div>
+          </div>
+        </li>
+      </ul>
+    </div>
+
+</div>
+</div>
+CONTENT
+        );
+    }
+
+    /**
+     * Creates simple content pages
+     *
+     * @param SiteInterface $site    A Site entity instance
+     * @param string        $url     A page URL
+     * @param string        $title   A page title
+     * @param string        $content A text content
+     *
+     * @return void
+     */
+    public function createTextContentPage(SiteInterface $site, $url, $title, $content)
+    {
+        $pageManager = $this->getPageManager();
+        $blockManager = $this->getBlockManager();
+        $blockInteractor = $this->getBlockInteractor();
+
+        $page = $pageManager->create();
+        $page->setSlug(sprintf('/%s', $url));
+        $page->setUrl(sprintf('/%s', $url));
+        $page->setName($title);
+        $page->setTitle($title);
+        $page->setEnabled(true);
+        $page->setDecorate(1);
+        $page->setRequestMethod('GET|POST|HEAD|DELETE|PUT');
+        $page->setTemplateCode('default');
+        $page->setRouteName('page_slug');
+        $page->setSite($site);
+        $page->setParent($this->getReference('page-homepage'));
+
+        $page->addBlocks($block = $blockInteractor->createNewContainer(array(
+            'enabled' => true,
+            'page'    => $page,
+            'code'    => 'content_top',
+        )));
+
+        // add the breadcrumb
+        $block->addChildren($breadcrumb = $blockManager->create());
+        $breadcrumb->setType('sonata.page.block.breadcrumb');
+        $breadcrumb->setPosition(0);
+        $breadcrumb->setEnabled(true);
+        $breadcrumb->setPage($page);
+
+        // Add text content block
+        $block->addChildren($text = $blockManager->create());
+        $text->setType('sonata.block.service.text');
+        $text->setSetting('content', sprintf('<h2>%s</h2><div>%s</div>', $title, $content));
+        $text->setPosition(1);
+        $text->setEnabled(true);
+        $text->setPage($page);
+
+        $pageManager->save($page);
+    }
+
+    public function create404ErrorPage(SiteInterface $site)
+    {
+        $pageManager = $this->getPageManager();
+        $blockManager = $this->getBlockManager();
+        $blockInteractor = $this->getBlockInteractor();
+
+        $page = $pageManager->create();
+        $page->setName('_page_internal_error_not_found');
+        $page->setTitle('Error 404');
+        $page->setEnabled(true);
+        $page->setDecorate(1);
+        $page->setRequestMethod('GET|POST|HEAD|DELETE|PUT');
+        $page->setTemplateCode('default');
+        $page->setRouteName('_page_internal_error_not_found');
+        $page->setSite($site);
+
+        $page->addBlocks($block = $blockInteractor->createNewContainer(array(
+            'enabled' => true,
+            'page'    => $page,
+            'code'    => 'content_top',
+        )));
+
+        // add the breadcrumb
+        $block->addChildren($breadcrumb = $blockManager->create());
+        $breadcrumb->setType('sonata.page.block.breadcrumb');
+        $breadcrumb->setPosition(0);
+        $breadcrumb->setEnabled(true);
+        $breadcrumb->setPage($page);
+
+        // Add text content block
+        $block->addChildren($text = $blockManager->create());
+        $text->setType('sonata.block.service.text');
+        $text->setSetting('content', '<h2>Error 404</h2><div>Page not found.</div>');
+        $text->setPosition(1);
+        $text->setEnabled(true);
+        $text->setPage($page);
+
+        $pageManager->save($page);
+    }
+
+    public function create500ErrorPage(SiteInterface $site)
+    {
+        $pageManager = $this->getPageManager();
+        $blockManager = $this->getBlockManager();
+        $blockInteractor = $this->getBlockInteractor();
+
+        $page = $pageManager->create();
+        $page->setName('_page_internal_error_fatal');
+        $page->setTitle('Error 500');
+        $page->setEnabled(true);
+        $page->setDecorate(1);
+        $page->setRequestMethod('GET|POST|HEAD|DELETE|PUT');
+        $page->setTemplateCode('default');
+        $page->setRouteName('_page_internal_error_fatal');
+        $page->setSite($site);
+
+        $page->addBlocks($block = $blockInteractor->createNewContainer(array(
+            'enabled' => true,
+            'page'    => $page,
+            'code'    => 'content_top',
+        )));
+
+        // add the breadcrumb
+        $block->addChildren($breadcrumb = $blockManager->create());
+        $breadcrumb->setType('sonata.page.block.breadcrumb');
+        $breadcrumb->setPosition(0);
+        $breadcrumb->setEnabled(true);
+        $breadcrumb->setPage($page);
+
+        // Add text content block
+        $block->addChildren($text = $blockManager->create());
+        $text->setType('sonata.block.service.text');
+        $text->setSetting('content', '<h2>Error 500</h2><div>Internal error.</div>');
+        $text->setPosition(1);
+        $text->setEnabled(true);
+        $text->setPage($page);
+
+        $pageManager->save($page);
+    }
+
+    /**
+     * @param SiteInterface $site
+     */
+    public function createGlobalPage(SiteInterface $site)
+    {
+        $pageManager = $this->getPageManager();
+        $blockManager = $this->getBlockManager();
+        $blockInteractor = $this->getBlockInteractor();
+
+        $global = $pageManager->create();
+        $global->setName('global');
+        $global->setRouteName('_page_internal_global');
+        $global->setSite($site);
+
+        $pageManager->save($global);
+
+        // CREATE A HEADER BLOCK
+        $global->addBlocks($header = $blockInteractor->createNewContainer(array(
+            'enabled' => true,
+            'page' => $global,
+            'code' => 'header',
+        )));
+
+        $header->setName('The header container');
+
+        $header->addChildren($text = $blockManager->create());
+
+        $text->setType('sonata.block.service.text');
+        $text->setSetting('content', '<h2><a href="/">Chamilo Demo</a></h2>');
+        $text->setPosition(1);
+        $text->setEnabled(true);
+        $text->setPage($global);
+
+        $global->addBlocks($headerTop = $blockInteractor->createNewContainer(array(
+            'enabled' => true,
+            'page' => $global,
+            'code' => 'header-top',
+        ), function ($container) {
+            $container->setSetting('layout', '<div class="pull-right">{{ CONTENT }}</div>');
+        }));
+
+        $headerTop->setPosition(1);
+
+        $header->addChildren($headerTop);
+
+        $headerTop->addChildren($account = $blockManager->create());
+
+        $account->setType('sonata.user.block.account');
+        $account->setPosition(1);
+        $account->setEnabled(true);
+        $account->setPage($global);
+
+        $global->addBlocks($headerMenu = $blockInteractor->createNewContainer(array(
+            'enabled' => true,
+            'page' => $global,
+            'code' => 'header-menu',
+        )));
+
+        $headerMenu->setPosition(2);
+
+        $header->addChildren($headerMenu);
+
+        $headerMenu->setName('The header menu container');
+        $headerMenu->setPosition(3);
+        $headerMenu->addChildren($menu = $blockManager->create());
+
+        $menu->setType('sonata.block.service.menu');
+        $menu->setSetting('menu_name', "ChamiloLMSCoreBundle:SimpleMenuBuilder:mainMenu");
+        $menu->setSetting('safe_labels', true);
+        $menu->setPosition(3);
+        $menu->setEnabled(true);
+        $menu->setPage($global);
+
+        $global->addBlocks($footer = $blockInteractor->createNewContainer(array(
+            'enabled' => true,
+            'page'    => $global,
+            'code'    => 'footer'
+        ), function ($container) {
+            $container->setSetting('layout', '<div class="row page-footer well">{{ CONTENT }}</div>');
+        }));
+
+        $footer->setName('The footer container');
+
+        // Footer : add 3 children block containers (left, center, right)
+        $footer->addChildren($footerLeft = $blockInteractor->createNewContainer(array(
+            'enabled' => true,
+            'page'    => $global,
+            'code'    => 'content'
+        ), function ($container) {
+            $container->setSetting('layout', '<div class="col-sm-3">{{ CONTENT }}</div>');
+        }));
+
+        $footer->addChildren($footerLinksLeft = $blockInteractor->createNewContainer(array(
+            'enabled' => true,
+            'page'    => $global,
+            'code'    => 'content',
+        ), function ($container) {
+            $container->setSetting('layout', '<div class="col-sm-2 col-sm-offset-3">{{ CONTENT }}</div>');
+        }));
+
+        $footer->addChildren($footerLinksCenter = $blockInteractor->createNewContainer(array(
+            'enabled' => true,
+            'page'    => $global,
+            'code'    => 'content'
+        ), function ($container) {
+            $container->setSetting('layout', '<div class="col-sm-2">{{ CONTENT }}</div>');
+        }));
+
+        $footer->addChildren($footerLinksRight = $blockInteractor->createNewContainer(array(
+            'enabled' => true,
+            'page'    => $global,
+            'code'    => 'content'
+        ), function ($container) {
+            $container->setSetting('layout', '<div class="col-sm-2">{{ CONTENT }}</div>');
+        }));
+
+        // Footer left: add a simple text block
+        $footerLeft->addChildren($text = $blockManager->create());
+
+        $text->setType('sonata.block.service.text');
+        $text->setSetting('content', '<h2>Sonata Demo</h2><p class="handcraft">HANDCRAFTED IN PARIS<br />WITH MIXED HERITAGE</p><p><a href="http://twitter.com/sonataproject" target="_blank">Follow Sonata on Twitter</a></p>');
+
+        $text->setPosition(1);
+        $text->setEnabled(true);
+        $text->setPage($global);
+
+        // Footer left links
+        $footerLinksLeft->addChildren($text = $blockManager->create());
+
+        $text->setType('sonata.block.service.text');
+        $text->setSetting('content', <<<CONTENT
+<h4>PRODUCT</h4>
+<ul class="links">
+    <li><a href="/bundles">Sonata</a></li>
+    <li><a href="/api-landing">API</a></li>
+    <li><a href="/faq">FAQ</a></li>
+</ul>
+CONTENT
+        );
+
+        $text->setPosition(1);
+        $text->setEnabled(true);
+        $text->setPage($global);
+
+        // Footer middle links
+        $footerLinksCenter->addChildren($text = $blockManager->create());
+
+        $text->setType('sonata.block.service.text');
+        $text->setSetting('content', <<<CONTENT
+<h4>ABOUT</h4>
+<ul class="links">
+    <li><a href="http://www.sonata-project.org/about" target="_blank">About Sonata</a></li>
+    <li><a href="/legal-notes">Legal notes</a></li>
+    <li><a href="/shop/payment/terms-and-conditions">Terms</a></li>
+</ul>
+CONTENT
+        );
+
+        $text->setPosition(1);
+        $text->setEnabled(true);
+        $text->setPage($global);
+
+        // Footer right links
+        $footerLinksRight->addChildren($text = $blockManager->create());
+
+        $text->setType('sonata.block.service.text');
+        $text->setSetting('content', <<<CONTENT
+<h4>COMMUNITY</h4>
+<ul class="links">
+    <li><a href="/blog">Blog</a></li>
+    <li><a href="http://www.github.com/sonata-project" target="_blank">Github</a></li>
+    <li><a href="/contact-us">Contact us</a></li>
+</ul>
+CONTENT
+        );
+
+        $text->setPosition(1);
+        $text->setEnabled(true);
+        $text->setPage($global);
+
+        $pageManager->save($global);
+    }
+
+    /**
+     * @return \Sonata\PageBundle\Model\SiteManagerInterface
+     */
+    public function getSiteManager()
+    {
+        return $this->container->get('sonata.page.manager.site');
+    }
+
+    /**
+     * @return \Sonata\PageBundle\Model\PageManagerInterface
+     */
+    public function getPageManager()
+    {
+        return $this->container->get('sonata.page.manager.page');
+    }
+
+    /**
+     * @return \Sonata\BlockBundle\Model\BlockManagerInterface
+     */
+    public function getBlockManager()
+    {
+        return $this->container->get('sonata.page.manager.block');
+    }
+
+    /**
+     * @return \Faker\Generator
+     */
+    public function getFaker()
+    {
+        return $this->container->get('faker.generator');
+    }
+
+    /**
+     * @return \Sonata\PageBundle\Entity\BlockInteractor
+     */
+    public function getBlockInteractor()
+    {
+        return $this->container->get('sonata.page.block_interactor');
+    }
+}

+ 120 - 0
src/ChamiloLMS/CoreBundle/DataFixtures/ORM/LoadUserData.php

@@ -0,0 +1,120 @@
+<?php
+
+namespace ChamiloLMS\CoreBundle\DataFixtures\ORM;
+
+use Doctrine\Common\DataFixtures\FixtureInterface;
+use Doctrine\Common\DataFixtures\OrderedFixtureInterface;
+use Doctrine\Common\DataFixtures\AbstractFixture;
+use Doctrine\Common\Persistence\ObjectManager;
+
+use Symfony\Component\DependencyInjection\ContainerAwareInterface;
+use Symfony\Component\DependencyInjection\ContainerInterface;
+
+class LoadUserData extends AbstractFixture implements ContainerAwareInterface, OrderedFixtureInterface
+{
+    private $container;
+
+    function getOrder()
+    {
+        return 1;
+    }
+
+    public function setContainer(ContainerInterface $container = null)
+    {
+        $this->container = $container;
+    }
+
+    /**
+     * @param ObjectManager $manager
+     */
+    public function load(ObjectManager $manager)
+    {
+        $manager = $this->getUserManager();
+        $groupManager = $this->getGroupManager();
+        $faker = $this->getFaker();
+
+        // Creating groups
+        $studentGroup = $groupManager->createGroup('students');
+        $studentGroup->addRole('ROLE_STUDENT');
+
+        $groupManager->updateGroup($studentGroup);
+
+        $teacherGroup = $groupManager->createGroup('teachers');
+        $teacherGroup->addRole('ROLE_TEACHER');
+        $groupManager->updateGroup($teacherGroup);
+
+        // Creating admin user.
+        $user = $manager->createUser();
+
+        $user->setUsername('admin');
+        $user->setUserId(1);
+        $user->setFirstname('Jane');
+        $user->setLastname('Doe');
+        $user->setEmail($faker->safeEmail);
+        $user->setPlainPassword('admin');
+        $user->setEnabled(true);
+        $user->setSuperAdmin(true);
+        $user->setLocked(false);
+
+        $manager->updateUser($user);
+
+        // Creating student user.
+
+        $user = $manager->createUser();
+        $user->setUserId(2);
+        $user->setFirstname('student');
+        $user->setLastname('student');
+        //$user->setPhone($faker->phoneNumber);
+        $user->setUsername('student');
+        $user->setEmail($faker->safeEmail);
+        $user->setPlainPassword('student');
+        $user->setEnabled(true);
+        $user->setLocked(false);
+
+        $user->addGroup($studentGroup);
+
+        $manager->updateUser($user);
+
+        // Creating random student users.
+        foreach (range(2, 100) as $id) {
+            $user = $manager->createUser();
+            $user->setUserId($id);
+            $user->setFirstname($faker->firstName);
+            $user->setLastname($faker->lastName);
+            //$user->setPhone($faker->phoneNumber);
+            $user->setUsername($faker->userName);
+            $user->setEmail($faker->safeEmail);
+            $user->setPlainPassword($faker->randomNumber());
+            $user->setEnabled(true);
+            $user->setLocked(false);
+
+            $user->addGroup($studentGroup);
+
+            $manager->updateUser($user);
+        }
+    }
+
+    /**
+     * @return \FOS\UserBundle\Model\UserManagerInterface
+     */
+    public function getUserManager()
+    {
+        return $this->container->get('fos_user.user_manager');
+    }
+
+    /**
+     * @return \FOS\UserBundle\Entity\GroupManager
+     */
+    public function getGroupManager()
+    {
+        return $this->container->get('fos_user.group_manager');
+    }
+
+    /**
+     * @return \Faker\Generator
+     */
+    public function getFaker()
+    {
+        return $this->container->get('faker.generator');
+    }
+}

+ 3 - 3
src/ChamiloLMS/CoreBundle/DependencyInjection/ChamiloLMSCoreExtension.php

@@ -3,17 +3,17 @@
 namespace ChamiloLMS\CoreBundle\DependencyInjection;
 
 use Symfony\Component\DependencyInjection\ContainerBuilder;
-use Symfony\Component\DependencyInjection\Loader\XmlFileLoader;
-use Symfony\Component\DependencyInjection\Loader\YamlFileLoader;
 use Symfony\Component\HttpKernel\DependencyInjection\Extension;
 use Symfony\Component\Config\FileLocator;
+use Symfony\Component\DependencyInjection\Loader;
 
 class ChamiloLMSCoreExtension extends Extension
 {
     public function load(array $configs, ContainerBuilder $container)
     {
-        $loader = new YamlFileLoader($container, new FileLocator(__DIR__.'/../Resources/config'));
+        $loader = new Loader\YamlFileLoader($container, new FileLocator(__DIR__.'/../Resources/config'));
         $loader->load('services.yml');
+        $loader->load('admin.yml');
     }
 
     public function getAlias()

+ 22 - 0
src/ChamiloLMS/CoreBundle/Resources/config/admin.yml

@@ -0,0 +1,22 @@
+services:
+    sonata.admin.course:
+        class: ChamiloLMS\CoreBundle\Admin\CourseAdmin
+        tags:
+            - { name: sonata.admin, manager_type: orm, group: "LMS", label: "Course" }
+        arguments:
+            - ~
+            - ChamiloLMS\CoreBundle\Entity\Course
+            - ~
+        calls:
+            - [ setTranslationDomain, [ChamiloLMSCoreBundle]]
+
+    sonata.admin.session:
+        class: ChamiloLMS\CoreBundle\Admin\SessionAdmin
+        tags:
+            - { name: sonata.admin, manager_type: orm, group: "LMS", label: "Session" }
+        arguments:
+            - ~
+            - ChamiloLMS\CoreBundle\Entity\Session
+            - ~
+        calls:
+            - [ setTranslationDomain, [ChamiloLMSCoreBundle]]

+ 2 - 3
src/ChamiloLMS/CoreBundle/Resources/config/routing.yml

@@ -15,11 +15,11 @@ main:
     requirements:
       name: .+
 
-courses:
+courses_code:
     path:     /courses/{code}
     defaults: { _controller: ChamiloLMSCoreBundle:Tool/CourseHome/CourseHome:index }
 
-courses:
+courses_code_index:
     path:     /courses/{code}/index.php
     defaults: { _controller: ChamiloLMSCoreBundle:Tool/CourseHome/CourseHome:index }
 
@@ -55,4 +55,3 @@ remove_trailing_slash:
     requirements:
         url: .*/$
         _method: GET
-

+ 70 - 15
src/ChamiloLMS/CoreBundle/Resources/config/services.yml

@@ -5,29 +5,84 @@ services:
             - { name: twig.extension }
 
     listener.request_response:
-      class: ChamiloLMS\CoreBundle\Listener\LegacyListener
-      arguments: [ @service_container]
-      tags:
-        - { name: kernel.event_listener, event: kernel.request, method: onKernelRequest }
-        - { name: kernel.event_listener, event: kernel.response, method: onKernelResponse }
-        - { name: kernel.event_listener, event: kernel.controller, method: onKernelController }
+        class: ChamiloLMS\CoreBundle\EventListener\LegacyListener
+        arguments: [@service_container]
+        tags:
+          - { name: kernel.event_listener, event: kernel.request, method: onKernelRequest }
+          - { name: kernel.event_listener, event: kernel.response, method: onKernelResponse }
+          - { name: kernel.event_listener, event: kernel.controller, method: onKernelController }
 
     listener.locale:
-        class: ChamiloLMS\CoreBundle\Listener\LocaleListener
+        class: ChamiloLMS\CoreBundle\EventListener\LocaleListener
         arguments: ["%kernel.default_locale%"]
         tags:
             - { name: kernel.event_subscriber }
 
+    listener.navbar_user_listener:
+        class: ChamiloLMS\CoreBundle\EventListener\ShowUserListener
+        arguments: [@service_container]
+        tags:
+            - { name: kernel.event_listener, event: theme.navbar_user, method: onShowUser }
+            - { name: kernel.event_listener, event: theme.sidebar_user, method: onShowUser }
+
+    listener.message_listener:
+        class: ChamiloLMS\CoreBundle\EventListener\MessageListener
+        arguments: [@service_container]
+        tags:
+            - { name: kernel.event_listener, event: theme.messages, method: onListMessages }
+
     listener.login_success_handler:
-      class: ChamiloLMS\CoreBundle\Listener\LoginSuccessHandler
-      arguments:  [@database_connection, @router, @security.context]
+        class: ChamiloLMS\CoreBundle\EventListener\LoginSuccessHandler
+        arguments:  [@database_connection, @router, @security.context]
 
     listener.logout_success_handler:
-        class: ChamiloLMS\CoreBundle\Listener\LogoutSuccessHandler
+        class: ChamiloLMS\CoreBundle\EventListener\LogoutSuccessHandler
         arguments:  [@database_connection, @router, @security.context]
 
-    sonata.block.service.course:
-      class: ChamiloLMS\CoreBundle\Block\CourseBlockService
-      arguments: ["sonata.block.service.course", @templating ]
-      tags:
-          - { name: sonata.block }
+    # ORMs
+    chamilolms.coursebundle.course:
+        class: ChamiloLMS\CourseBundle\Entity\CourseManager
+        arguments: [@doctrine]
+
+    # Course block
+    chamilolms.corebundle.block.course:
+        class: ChamiloLMS\CoreBundle\Block\CourseBlockService
+        arguments: ["course_block", @templating ]
+        tags:
+            - { name: sonata.block }
+
+    # Course block
+    chamilolms.corebundle.block.header:
+        class: ChamiloLMS\CoreBundle\Block\CourseBlockService
+        arguments: ["header", @templating ]
+        tags:
+            - { name: sonata.block }
+
+    # Menus
+
+    chamilolms.corebundle.menu.main_menu_builder:
+        class: ChamiloLMS\CoreBundle\Menu\MainMenuBuilder
+        arguments: [@knp_menu.factory, @router]
+
+    chamilolms.corebundle.menu.course_builder:
+        class: ChamiloLMS\CoreBundle\Menu\CourseMenuBuilder
+        arguments: [@knp_menu.factory, @chamilolms.coursebundle.course, @router]
+
+    # Blocks
+
+    chamilolms.corebundle.block.main_menu:
+        class: ChamiloLMS\CoreBundle\Block\MainMenuBlockService
+        arguments: ["chamilolms.corebundle.block.main_menu", @templating, @knp_menu.menu_provider, @chamilolms.corebundle.menu.main_menu_builder ]
+        tags:
+            - { name: sonata.block }
+
+    # Breadcrumb
+    chamilolms.corebundle.block.breadcrumb:
+        class: ChamiloLMS\CoreBundle\Block\DefaultBreadcrumbBlockService
+        arguments: ["default", "chamilolms.corebundle.block.breadcrumb", @templating, @knp_menu.menu_provider, @knp_menu.factory]
+        tags:
+            - { name: sonata.block }
+            - { name: sonata.breadcrumb }
+
+    chamilolms.userbundle.encoder:
+        class: Application\Sonata\UserBundle\Security\Encoder

+ 247 - 0
src/ChamiloLMS/CoreBundle/Resources/public/css/demo.css

@@ -0,0 +1,247 @@
+/*
+ * Helpers
+ */
+.number {
+    text-align: right !important;
+}
+.truncate {
+    white-space: nowrap;
+    overflow: hidden;
+    text-overflow: ellipsis;
+}
+
+/*
+ * Sonata Demo
+ */
+
+@media screen and (min-width: 1200px) {
+    .sonata-bc .container {
+        max-width: 970px;
+    }
+}
+
+.sonata-bc .page-header .nav {
+    clear: both;
+}
+
+.sonata-bc .block-newsletter {
+    text-align: center;
+    margin-top: 10px;
+}
+
+.sonata-bc .block-newsletter > div.col-sm-6 {
+    min-height: 155px;
+}
+
+.sonata-bc .block-newsletter input[type="email"] {
+    margin-bottom: 0px;
+}
+
+.sonata-bc .block-newsletter p {
+    font-size: 14px;
+    font-weight: bold;
+}
+
+.sonata-bc #newsletter-confirmation {
+    margin-top: 20px;
+}
+
+.sonata-bc .page-footer {
+    background-color: #dedede;
+    margin: 0px;
+}
+
+.sonata-bc .page-footer ul li {
+    list-style: none;
+    text-align: left;
+    line-height: 25px;
+}
+
+.sonata-bc .page-footer p.handcraft {
+    margin-top: 80px;
+}
+
+.sonata-bc .page-header .col-sm-4, .sonata-bc .welcome {
+    padding-left: 0px;
+}
+
+.sonata-bc .nivoGallery ul img {
+    max-height: none;
+}
+
+.sonata_breadcrumb .breadcrumb>li+li:before {
+    content: "\00BB";
+}
+
+form div.alert ~ .form-actions {
+    min-height: 54px;
+}
+
+form .form-actions {
+    min-height: 48px;
+}
+
+/*
+ * Basket
+ */
+table.basket thead tr {
+    background-color: #428bca;
+    color: #ffffff;
+}
+
+table.basket thead tr th {
+    text-align: center;
+}
+
+table.basket .unavailable .help-inline {
+    color: #b94a48;
+    font-weight: bold;
+    vertical-align: inherit;
+}
+
+.checkbox input[type="checkbox"] {
+    float: none;
+}
+
+.sonata-bc .demonstration-bar {
+    position: static;
+    width: 100%;
+    z-index: 999;
+    background-color: #000000;
+    color: #ffffff;
+    opacity: 0.8;
+    min-height: 30px;
+    padding-top: 5px;
+    text-align: center;
+    font-size: 1em;
+}
+
+.sonata-bc #add_basket_modal {
+    top: 15%;
+}
+
+/*
+ * Product catalog
+ */
+.sonata-product-navigation-bar {
+    margin-bottom: 30px;
+}
+.sonata-product-navigation-bar .pagination {
+    margin: 0 !important;
+}
+.no-products-available {
+    padding: 100px;
+    font-weight: bold;
+    text-align: center;
+}
+
+/*
+ * Product catalog menu
+ */
+div.col-sm-3 div.list-group a.lead.list-group-item:first-child {
+    margin-top: 0px;
+}
+
+div.col-sm-3 div.list-group a.lead.list-group-item {
+    margin-top: 20px;
+}
+
+div.col-sm-3 div.list-group a:not(.lead).list-group-item,
+div.col-sm-3 div.list-group div.menu_level_1,
+div.col-sm-3 div.list-group div.menu_level_2,
+div.col-sm-3 div.list-group div.menu_level_3,
+div.col-sm-3 div.list-group div.menu_level_4 {
+    width: 96%;
+    margin-left: 4%;
+}
+
+/*
+ * Product grid
+ */
+.product-grid {
+    padding: 10px 0px 10px 0px;
+}
+.product-grid .thumbnail {
+    margin-bottom: 20px;
+}
+.product-grid .product-thumbnail {
+    min-height: 100px;
+    max-height: 100px;
+    text-align: center;
+}
+.product-grid .col-sm-3 {
+    min-height: 175px;
+    padding-right: 15px;
+    padding-left: 15px;
+}
+.product-grid .col-sm-3 .panel .panel-body,
+.product-grid .col-sm-4 .panel .panel-body {
+    padding: 0px;
+}
+.product-grid .col-sm-3 .panel .panel-body img.img-responsive,
+.product-grid .col-sm-4 .panel .panel-body img.img-responsive {
+    margin-left: auto;
+    margin-right: auto;
+}
+
+/* Small resolution */
+@media(max-width:767px) {
+    .product-grid .col-sm-3 {
+        margin-top: 30px;
+        min-width: 250px;
+    }
+    .product-grid li:not(:last-child) {
+        margin-top: 0px;
+    }
+}
+
+/* Extra-small resolution */
+@media(max-width:475px) {
+    .product-grid li:not(:last-child) {
+        margin-top: 25px;
+    }
+
+    .product-grid li:first-child {
+        margin-top: 0px;
+    }
+}
+
+.product-grid .col-sm-3:first-line {
+    margin-top: 10px;
+}
+
+/*
+ * Product slider thumbnails
+ */
+
+div#slider-thumbs ul.list-inline {
+    width: 620px;
+}
+
+div#slider-thumbs ul li {
+    padding-left: 0px;
+    margin-bottom: 10px;
+}
+
+/*
+ * News
+ */
+h2.sonata-blog-post-title {
+    font-size: 22px;
+}
+
+.sonata-blog-post-abtract {
+    margin-top: 10px;
+}
+
+.sonata-blog-post-list hr {
+    margin: 20px 0px 5px 0px;
+}
+
+/*
+ * Comments
+ */
+
+.fos_comment_comment_show {
+    border-top: 1px solid #ccc;
+}

+ 0 - 8
src/ChamiloLMS/CoreBundle/Resources/views/12.html.twig

@@ -1,8 +0,0 @@
-<div class="container-fluid">
-    <div class="row">
-        <div class="col-sm-12">
-            {% block main_content %}
-            {% endblock %}
-        </div>
-    </div>
-</div>

+ 0 - 83
src/ChamiloLMS/CoreBundle/Resources/views/3-9.html.twig

@@ -1,83 +0,0 @@
-{% block topbar %}
-    <nav class="navbar navbar-default navbar-fixed-top" role="navigation">
-        <!-- Brand and toggle get grouped for better mobile display -->
-        <div class="navbar-header">
-            <button type="button" class="navbar-toggle"
-                    data-toggle="collapse" data-target=".navbar-ex1-collapse">
-                <span class="sr-only">Toggle navigation</span>
-                <span class="icon-bar"></span>
-                <span class="icon-bar"></span>
-                <span class="icon-bar"></span>
-            </button>
-            <a class="navbar-brand" href="#">Chamilo</a>
-        </div>
-
-        <!-- Collect the nav links, forms, and other content for toggling -->
-        <div class="collapse navbar-collapse navbar-ex1-collapse">
-            {{ knp_menu_render('ChamiloLMSCoreBundle:Builder:leftMenu', { 'style': 'navbar' }) }}
-            <form class="navbar-form navbar-left" role="search">
-                <div class="form-group">
-                    <input type="text" class="form-control" placeholder="Search">
-                </div>
-                <button type="submit" class="btn btn-default">Submit</button>
-            </form>
-            {{ knp_menu_render('ChamiloLMSCoreBundle:Builder:rightMenu', { 'style': 'navbar-right' }) }}
-        </div><!-- /.navbar-collapse -->
-    </nav>
-
-{% endblock %}
-<div class="container-fluid">
-    <div class="row">
-        <div class="col-sm-3 col-md-2 sidebar">
-            {% block sidebar %}
-                {{ sonata_block_render({ 'type': 'sonata.block.service.course'}) }}
-
-                {{ sonata_block_render({ 'type': 'sonata.block.service.text' }, {
-                'content': 'Empty block 2'
-                }) }}
-
-                {{ sonata_block_render({ 'type': 'sonata.block.service.menu' }, {
-                'menu_name': 'ChamiloLMSCoreBundle:Builder:profileMenu',
-                }) }}
-
-                {{ sonata_block_render({ 'type': 'sonata.block.service.menu' }, {
-                'menu_name': 'ChamiloLMSCoreBundle:Builder:courseMenu',
-                }) }}
-
-                {% include "@template_style/layout/sidebar.tpl" %}
-
-                {# course navigation links/shortcuts need to be activated by the admin #}
-                {% include "@template_style/layout/course_navigation.tpl" %}
-            {% endblock %}
-        </div>
-        <div class="col-sm-9 col-sm-offset-3 col-md-10 col-md-offset-2 main">
-            {% block main_content %}
-                {% if plugin_content_top %}
-                    <div id="plugin_content_top" class="col-lg-10 col-sm-11">
-                        {{ plugin_content_top}}
-                    </div>
-                {% endif %}
-
-                {% include "@template_style/layout/page_body.tpl" %}
-                {% block content %}
-                    {% autoescape false %}
-                        {% if content is not null %}
-                            {{ content }}
-                        {% endif %}
-                    {% endautoescape %}
-                {% endblock %}
-
-                {#  Plugin bottom  #}
-                {% if plugin_content_bottom %}
-                    <div id="plugin_content_bottom" class="col-md-12">
-                        {{ plugin_content_bottom }}
-                    </div>
-                {% endif %}
-                </section>
-
-                {# Footer #}
-                {% include "@template_style/layout/footer.tpl" %}
-            {% endblock %}
-        </div>
-    </div>
-</div>

+ 2 - 2
src/ChamiloLMS/CoreBundle/Resources/views/Admin/index.html.twig

@@ -1,7 +1,7 @@
-{% extends 'ChamiloLMSCoreBundle::page.html.twig' %}
+{% extends '::Themes/page.html.twig' %}
 
 {% block layout %}
-    {% embed 'ChamiloLMSCoreBundle::3-9.html.twig' %}
+    {% embed '::Layouts/3-9.html.twig' %}
         {% block content %}
             {% autoescape false %}
 

+ 3 - 10
src/ChamiloLMS/CoreBundle/Resources/views/Index/index.html.twig

@@ -1,12 +1,5 @@
-{% extends 'ChamiloLMSCoreBundle::page.html.twig' %}
 
-{% block layout %}
-    {% embed 'ChamiloLMSCoreBundle::3-9.html.twig' %}
-        {% block content %}
-            {{ parent() }}
-        {% endblock %}
-        {% block sidebar %}
-            {{ parent() }}
-        {% endblock %}
-    {% endembed %}
+{% block page_content %}
+    {{ content }}
 {% endblock %}
+

+ 6 - 11
src/ChamiloLMS/CoreBundle/Resources/views/Index/userportal.html.twig

@@ -1,12 +1,7 @@
-{% extends 'ChamiloLMSCoreBundle::page.html.twig' %}
-
-{% block layout %}
-    {% embed 'ChamiloLMSCoreBundle::3-9.html.twig' %}
-        {% block content %}
-            {{ parent() }}
-        {% endblock %}
-        {% block sidebar %}
-            {{ parent() }}
-        {% endblock %}
-    {% endembed %}
+{#{% extends "ChamiloLMSCoreBundle::main_layout.html.twig" %}#}
+{% block page_content %}
+    {{ content }}
 {% endblock %}
+
+
+

+ 2 - 2
src/ChamiloLMS/CoreBundle/Resources/views/Legacy/index.html.twig

@@ -1,7 +1,7 @@
-{% extends 'ChamiloLMSCoreBundle::page.html.twig' %}
+{% extends '::Themes/page.html.twig' %}
 
 {% block layout %}
-    {% embed 'ChamiloLMSCoreBundle::3-9.html.twig' %}
+    {% embed '::Layouts/3-9.html.twig' %}
         {% block content %}
             {{ parent() }}
         {% endblock %}

+ 0 - 10
src/ChamiloLMS/CoreBundle/Resources/views/Security/login.html.twig

@@ -1,10 +0,0 @@
-{% extends 'ChamiloLMSCoreBundle:Security:only_login.twig' %}
-
-{% block form %}
-    <form class="form-signin" action="{{ url('login_check') }}" method="post">
-        <h2 class="form-signin-heading">{{ 'SignIn' | trans }}</h2>
-        <input class="form-control virtualkey" type="text" name="_username" placeholder="{{ 'Username' | trans }}"/>
-        <input class="form-control virtualkey" type="password" name="_password" placeholder="{{ 'Password' | trans }}" />
-        <button class="btn btn-lg btn-primary btn-block" type="submit">{{ 'LoginEnter' | trans }}</button>
-    </form>
-{% endblock %}

+ 0 - 36
src/ChamiloLMS/CoreBundle/Resources/views/Security/only_login.html.twig

@@ -1,36 +0,0 @@
-{% if is_granted('IS_AUTHENTICATED_FULLY') == false %}
-    {% if ("use_virtual_keyboard" | get_setting) == 'true' %}
-        <link href="{{ asset('ChamiloLMS/js/keyboard/keyboard.css') }}" rel="stylesheet" media="screen">
-        <script src="{{ asset('ChamiloLMS/js/keyboard/jquery.keyboard.js') }}"></script>
-
-        <script>
-            $(function(){
-                $('.virtualkey').keyboard({
-                    layout:'custom',
-                    customLayout: {
-                        'default': [
-                            '1 2 3 4 5 6 7 8 9 0 {bksp}',
-                            'q w e r t y u i o p',
-                            'a s d f g h j k l',
-                            'z x c v b n m',
-                            '{cancel} {accept}'
-                        ]
-                    }
-                });
-            });
-        </script>
-    {% endif %}
-
-    {% if error %}
-        <div>{{ error.message }}</div>
-    {% endif %}
-
-    {% block form %}
-    <form class="form" action="{{ url('login_check') }}" method="post">
-        <input class=" virtualkey" type="text" name="_username" placeholder="{{ 'Username' | trans }}"/>
-        <input class=" virtualkey" type="password" name="_password" placeholder="{{ 'Password' | trans }}" />
-        <button class="btn btn-primary" type="submit">{{ 'LoginEnter' | trans }}</button>
-    </form>
-    {% endblock %}
-
-{% endif %}

+ 2 - 2
src/ChamiloLMS/CoreBundle/Resources/views/Tool/CourseHome/index.html.twig

@@ -1,7 +1,7 @@
-{% extends 'ChamiloLMSCoreBundle::page.html.twig' %}
+{% extends '::Themes/page.html.twig' %}
 
 {% block layout %}
-    {% embed 'ChamiloLMSCoreBundle::3-9.html.twig' %}
+    {% embed '::Layouts/3-9.html.twig' %}
         {% block content %}
             {% autoescape false %}
 

+ 0 - 316
src/ChamiloLMS/CoreBundle/Resources/views/base.html.twig

@@ -1,316 +0,0 @@
-<!DOCTYPE html>
-<!--[if lt IE 7]> <html lang="{{ app.request.locale }}" class="no-js lt-ie9 lt-ie8 lt-ie7"> <![endif]-->
-<!--[if IE 7]>    <html lang="{{ app.request.locale }}" class="no-js lt-ie9 lt-ie8"> <![endif]-->
-<!--[if IE 8]>    <html lang="{{ app.request.locale }}" class="no-js lt-ie9"> <![endif]-->
-<!--[if gt IE 8]><!--><html lang="{{ app.request.locale }}" class="no-js"> <!--<![endif]-->
-<head>
-    {% block head %}
-    <noscript>{{ "NoJavascript"|trans }}</noscript>
-    <meta charset="UTF-8" />
-    <link href="http://www.chamilo.org/documentation.php" rel="help" />
-    <link href="http://www.chamilo.org/team.php" rel="author" />
-    <link href="http://www.chamilo.org" rel="copyright" />
-    <link rel="shortcut icon" href="{{ asset('favicon.ico') }}" />
-    <link rel="shortcut icon" href="{{ asset('apple-touch-icon.png') }}" />
-    <meta name="apple-mobile-web-app-capable" content="yes" />
-    <meta name="Generator" content="{{ software_name }} {{ version }}" />
-    {#  Use the latest engine in ie8/ie9 or use google chrome engine if available  #}
-    {#  Improve usability in portal devices #}
-    <meta http-equiv="X-UA-Compatible" content="IE=edge">
-    <meta name="viewport" content="width=device-width, initial-scale=1.0">
-    <title>{% block title %}{% endblock %}</title>
-    {% block stylesheets %}{% endblock %}
-
-    <link href="{{ asset('css/bootstrap.css') }}" rel="stylesheet" media="screen">
-
-    <link href="{{ asset('ChamiloLMS/css/base.css') }}" rel="stylesheet" media="screen">
-    <link href="{{ asset('ChamiloLMS/css/themes/chamilo/default.css') }}" rel="stylesheet" media="screen">
-
-    <link href="{{ asset('ChamiloLMS/js/chosen/chosen.css') }}" rel="stylesheet" media="screen">
-    <script src="{{ asset('js/jquery.js') }}"></script>
-    <script src="{{ asset('js/bootstrap.js') }}"></script>
-    <script src="{{ asset('ChamiloLMS/js/jquery-ui/js/jquery-ui.custom.min.js') }}"></script>
-    <script src="{{ asset('ChamiloLMS/js/chosen/chosen.jquery.min.js') }}"></script>
-    {% block header_end %}{% endblock header_end %}
-    <script>
-    function setCheckbox(value, table_id) {
-        checkboxes = $("#"+table_id+" input:checkbox");
-        $.each(checkboxes, function(index, checkbox) {
-            checkbox.checked = value;
-            if (value) {
-                $(checkbox).parentsUntil("tr").parent().addClass("row_selected");
-            } else {
-                $(checkbox).parentsUntil("tr").parent().removeClass("row_selected");
-            }
-        });
-        return false;
-    }
-
-    function action_click(element, table_id) {
-        d = $("#"+table_id);
-        if (!confirm('{{ "ConfirmYourChoice"|trans }}')) {
-            return false;
-        } else {
-            var action =$(element).attr("data-action");
-            $('#'+table_id+' input[name="action"] ').attr("value", action);
-            d.submit();
-            return false;
-        }
-    }
-
-    /* Global chat variables */
-    {#
-    var ajax_url        = '{{ _p.web_ajax }}chat.ajax.php';
-    var online_button   = '{{ online_button |e('js') }}';
-    var offline_button  = '{{ offline_button |e('js') }}';
-        #}
-    var connect_lang    = '{{ "ChatConnected"|trans |e('js') }}';
-    var disconnect_lang = '{{ "ChatDisconnected"|trans |e('js') }}';
-
-    function get_url_params(q, attribute) {
-        var vars;
-        var hash;
-        if (q != undefined) {
-            q = q.split('&');
-            for(var i = 0; i < q.length; i++){
-                hash = q[i].split('=');
-                if (hash[0] == attribute) {
-                    return hash[1];
-                }
-            }
-        }
-    }
-
-    function check_brand() {
-        if ($('.subnav').length) {
-            if ($(window).width() >= 969) {
-                $('.subnav .brand').hide();
-            } else {
-                $('.subnav .brand').show();
-            }
-        }
-    }
-
-    $(window).resize(function() {
-        //check_brand();
-    });
-
-    $(document).scroll(function() {
-
-        // Top bar scroll effect
-        if ($('body').width() > 959) {
-            if ($('.subnav').length) {
-                if (!$('.subnav').attr('data-top')) {
-                    // If already fixed, then do nothing
-                    if ($('.subnav').hasClass('subnav-fixed')) return;
-                    // Remember top position
-                    var offset = $('.subnav').offset();
-                    $('.subnav').attr('data-top', offset.top);
-                }
-
-                if ($('.subnav').attr('data-top') - $('.subnav').outerHeight() <= $(this).scrollTop()) {
-                    $('.subnav').addClass('subnav-fixed');
-                } else {
-                    $('.subnav').removeClass('subnav-fixed');
-                }
-                //$('.subnav .brand').show();
-            }
-        } else {
-            //$('.subnav .brand').hide();
-        }
-
-        //Exercise warning fixed at the top
-        var fixed =  $("#exercise_clock_warning");
-        if (fixed.length) {
-            if (!fixed.attr('data-top')) {
-                // If already fixed, then do nothing
-                if (fixed.hasClass('subnav-fixed')) return;
-                // Remember top position
-                var offset = fixed.offset();
-                fixed.attr('data-top', offset.top);
-                fixed.css('width', '100%');
-            }
-
-            if (fixed.attr('data-top') - fixed.outerHeight() <= $(this).scrollTop()) {
-                fixed.addClass('subnav-fixed');
-                fixed.css('width', '100%');
-            } else {
-                fixed.removeClass('subnav-fixed');
-                fixed.css('width', '200px');
-            }
-        }
-
-        // Admin -> Settings toolbar.
-        if ($('body').width() > 959) {/*
-         if ($('.new_actions').length) {
-         if (!$('.new_actions').attr('data-top')) {
-         // If already fixed, then do nothing
-         if ($('.new_actions').hasClass('new_actions-fixed')) return;
-         // Remember top position
-         var offset = $('.new_actions').offset();
-
-         var more_top = 0;
-         if ($('.subnav').hasClass('new_actions-fixed')) {
-         more_top = 50;
-         }
-         $('.new_actions').attr('data-top', offset.top + more_top);
-         }
-
-         if ($('.new_actions').attr('data-top') - $('.new_actions').outerHeight() <= $(this).scrollTop()) {
-         $('.new_actions').addClass('new_actions-fixed');
-         } else {
-         $('.new_actions').removeClass('new_actions-fixed');
-         }
-         }*/
-        }
-
-        // Bottom actions.
-        if ($('.bottom_actions').length) {
-            if (!$('.bottom_actions').attr('data-top')) {
-                // If already fixed, then do nothing
-                if ($('.bottom_actions').hasClass('bottom_actions_fixed')) return;
-
-                // Remember top position
-                var offset = $('.bottom_actions').offset();
-                $('.bottom_actions').attr('data-top', offset.top);
-            }
-
-            if ($('.bottom_actions').attr('data-top') > $('body').outerHeight()) {
-                if ( ($('.bottom_actions').attr('data-top') - $('body').outerHeight() - $('.bottom_actions').outerHeight()) >= $(this).scrollTop()) {
-                    $('.bottom_actions').addClass('bottom_actions_fixed');
-                    $('.bottom_actions').css("width", "100%");
-                } else {
-                    $('.bottom_actions').css("width", "");
-                    $('.bottom_actions').removeClass('bottom_actions_fixed');
-                }
-            } else {
-                if ( ($('.bottom_actions').attr('data-top') -  $('.bottom_actions').outerHeight()) <= $(this).scrollTop()) {
-                    $('.bottom_actions').addClass('bottom_actions_fixed');
-                    $('.bottom_actions').css("width", "100%");
-                } else {
-                    $('.bottom_actions').removeClass('bottom_actions_fixed');
-                    $('.bottom_actions').css("width", "");
-                }
-            }
-        }
-    });
-
-    $(function() {
-        check_brand();
-        //Removes the yellow input in Chrome
-        if (navigator.userAgent.toLowerCase().indexOf("chrome") >= 0) {
-            $(window).load(function(){
-                $('input:-webkit-autofill').each(function(){
-                    var text = $(this).val();
-                    var name = $(this).attr('name');
-                    $(this).after(this.outerHTML).remove();
-                    //var has_string = $(name).find(":contains('[')");
-                    $('input[name=' + name + ']').val(text);
-                });
-            });
-        }
-
-        // Fixes buttons to the new btn class.
-        if (!$('#button').hasClass('btn')) {
-            $("button").addClass('btn');
-        }
-
-        // Dropdown effect.
-        $('.dropdown-toggle').dropdown();
-
-        // Responsive effect.
-        //$(".collapse").collapse();
-
-        $(".accordion_jquery").accordion({
-            autoHeight: false,
-            active: false, // all items closed by default
-            collapsible: true,
-            header: ".accordion-heading"
-        });
-
-        // Global popup
-        $('.ajax').on('click', function() {
-            var url     = this.href;
-            var dialog  = $("#dialog");
-            if ($("#dialog").length == 0) {
-                dialog  = $('<div id="dialog" style="display:none"></div>').appendTo('body');
-            }
-
-            width_value = 580;
-            height_value = 450;
-            resizable_value = true;
-
-            new_param = get_url_params(url, 'width');
-            if (new_param) {
-                width_value = new_param;
-            }
-
-            new_param = get_url_params(url, 'height')
-            if (new_param) {
-                height_value = new_param;
-            }
-
-            new_param = get_url_params(url, 'resizable');
-            if (new_param) {
-                resizable_value = new_param;
-            }
-
-            // load remote content
-            dialog.load(url,{}, function(responseText, textStatus, XMLHttpRequest) {
-                dialog.dialog({
-                    modal       : true,
-                    width       : width_value,
-                    height      : height_value,
-                    resizable   : resizable_value
-                });
-            });
-            //prevent the browser to follow the link
-            return false;
-        });
-
-        //old jquery.menu.js
-        $('#navigation a').stop().animate({
-            'marginLeft':'50px'
-        }, 1000);
-
-        $('#navigation > li').hover(
-            function () {
-                $('a',$(this)).stop().animate({
-                    'marginLeft':'1px'
-                },200);
-            },
-            function () {
-                $('a',$(this)).stop().animate({
-                    'marginLeft':'50px'
-                },200);
-            }
-        );
-
-        // Tiny mce
-        /*tinymce.init({
-         plugins: "media,image,elfinder",
-         selector: "textarea"
-         });*/
-
-
-        /*
-         $(".td_actions").hide();
-
-         $(".td_actions").parent('tr').mouseover(function() {
-         $(".td_actions").show();
-         });
-
-         $(".td_actions").parent('tr').mouseout(function() {
-         $(".td_actions").hide();
-         });*/
-    });
-    </script>
-    {% block extraHead %}
-    {% endblock %}
-{% endblock %}
-</head>
-
-<body class="{% block theme %}default{% endblock %}">
-{% block layout %}{% endblock %}
-</body>
-</html>

+ 2 - 2
src/ChamiloLMS/CoreBundle/Resources/views/default/layout/footer.tpl

@@ -269,9 +269,9 @@ $(document).ready( function() {
     /** Makes row highlighting possible */
 
     // Chosen select.
-    $(".chzn-select").chosen({
+    /*$(".chzn-select").chosen({
         disable_search_threshold: 10
-    });
+    });*/
 
     // Adv multi-select text inputs.
     $('.select_class_filter').each(function(){

+ 7 - 7
src/ChamiloLMS/CoreBundle/Resources/views/default/layout/sidebar.tpl

@@ -111,10 +111,10 @@
             {% endif %}
 
             {# if user is not login show the login form #}
-            {% render controller("ChamiloLMSCoreBundle:Front:showLogin") %}
+            {# render (controller('FOSUserBundle:Security:login')) #}
 
             {#  course_session_block #}
-            {% render controller("ChamiloLMSCoreBundle:Front:showCourseSessionBlock") %}
+            {# render controller("ChamiloLMSCoreBundle:Front:showCourseSessionBlock") %}
 
             {#  User picture  #}
             {# include "@template_style/index/user_image_block.tpl" #}
@@ -126,17 +126,17 @@
             {# include "@template_style/index/profile_social_block.tpl" #}
 
             {#  Course block - admin #}
-            {% render controller("ChamiloLMSCoreBundle:Front:showCourseBlock") %}
+            {# render controller("ChamiloLMSCoreBundle:Front:showCourseBlock") %}
 
             {#  Course block - teacher #}
-            {% render controller("ChamiloLMSCoreBundle:Front:showTeacherBlock") %}
+            {# render controller("ChamiloLMSCoreBundle:Front:showTeacherBlock") %}
 
             {#  Session block #}
-            {% render controller("ChamiloLMSCoreBundle:Front:showSessionBlock") %}
+            {# render controller("ChamiloLMSCoreBundle:Front:showSessionBlock") %}
 
-            {% render controller("ChamiloLMSCoreBundle:Front:showNoticeBlock") %}
+            {# render controller("ChamiloLMSCoreBundle:Front:showNoticeBlock") %}
 
-            {% render controller("ChamiloLMSCoreBundle:Front:showHelpBlock") %}
+            {# render controller("ChamiloLMSCoreBundle:Front:showHelpBlock") %}
 
             {% render controller("ChamiloLMSCoreBundle:Front:showNavigationBlock") %}
 

+ 102 - 0
src/ChamiloLMS/CoreBundle/Resources/views/main_layout.html.twig

@@ -0,0 +1,102 @@
+{% embed "AvanzuAdminThemeBundle:layout:base-layout.html.twig" %}
+
+{% block javascripts_head %}
+    {{ parent() }}
+
+    {% block sonata_page_javascripts %}
+        {% block page_javascripts %} {# Deprecated block #}
+            <!-- Le HTML5 shim, for IE6-8 support of HTML elements -->
+            <!--[if lt IE 9]>
+            <script src="http://html5shim.googlecode.com/svn/trunk/html5.js"></script>
+            <![endif]-->
+
+            {% for js in sonata_page.assets.javascripts %}
+                <script src="{{ asset(js) }}" type="text/javascript"></script>
+            {% endfor %}
+        {% endblock %}
+    {% endblock %}
+    {{ sonata_seo_title() }}
+    {{ sonata_seo_metadatas() }}
+{% endblock %}
+
+{% block stylesheets %}
+    {{ parent() }}
+    {% block sonata_page_stylesheets %}
+        {% block page_stylesheets %} {# Deprecated block #}
+            {% for stylesheet in sonata_page.assets.stylesheets %}
+                <link rel="stylesheet" href="{{ asset(stylesheet) }}" type="text/css" media="all"  />
+            {% endfor %}
+        {% endblock %}
+    {% endblock %}
+{% endblock %}
+
+{% block page_breadcrumb %}
+    {% block sonata_page_breadcrumb %}
+        {% if sonata_seo_context is not defined %}
+            {% set sonata_seo_context = 'homepage' %}
+        {% endif %}
+        {{ sonata_block_render_event('breadcrumb', { 'context': sonata_seo_context, 'current_uri': app.request.requestUri }) }}
+    {% endblock %}
+{% endblock %}
+
+{% block page_title %}
+    {% if page is defined %}
+        {{ page.name }}
+    {% else %}
+        {{ parent() }}
+    {% endif %}
+{% endblock %}
+
+{% block page_content %}
+    {% if page is defined %}
+        {% block sonata_page_container %}
+            <div class="row">
+                <div class="col-xs-12">
+                    {#{{ sonata_page_render_container('header', page) }}#}
+                    {{ sonata_page_render_container('header', page) }}
+                </div>
+
+                {% if page is defined %}
+                    <div class="col-xs-12">
+                        {% if page.name != 'global' %}
+                            {{ sonata_page_render_container('content_top', 'global') }}
+                        {% endif %}
+                        {{ sonata_page_render_container('content_top', page) }}
+                    </div>
+                {% endif %}
+
+                <div class="col-xs-12">
+                    {% if content is defined %}
+                        {{ content|raw }}
+                    {% else %}
+                        {% set content = block('content') %}
+                        {% if content|length > 0 %}
+                            {{ content|raw }}
+                        {% elseif page is defined %}
+                            {{ sonata_page_render_container('content', page) }}
+                        {% endif %}
+                    {% endif %}
+                </div>
+
+                {% if page is defined %}
+                    <div class="col-xs-12">
+                        {{ sonata_page_render_container('content_bottom', page) }}
+
+                        {% if page.name != 'global'%}
+                            {{ sonata_page_render_container('content_bottom', 'global') }}
+                        {% endif %}
+                    </div>
+                {% endif %}
+
+                <div class="col-xs-12">
+                    {{ sonata_page_render_container('footer', page) }}
+                    {#{{ sonata_page_render_container('footer', 'global') }}#}
+                </div>
+            </div>
+        {% endblock %}
+    {% endif %}
+
+{% endblock %}
+
+
+{% endembed %}

+ 0 - 2
src/ChamiloLMS/CoreBundle/Resources/views/page.html.twig

@@ -1,2 +0,0 @@
-{% extends 'ChamiloLMSCoreBundle::base.html.twig' %}
-{% block theme 'page' %}

+ 12 - 0
src/ChamiloLMS/CourseBundle/Entity/CourseManager.php

@@ -0,0 +1,12 @@
+<?php
+
+namespace ChamiloLMS\CourseBundle\Entity;
+
+use Sonata\Component\Product\PackageManagerInterface;
+use Sonata\CoreBundle\Model\BaseEntityManager;
+use Sonata\CoreBundle\Model\ManagerInterface;
+
+class CourseManager extends BaseEntityManager implements ManagerInterface
+{
+
+}

+ 0 - 6
user_portal.php

@@ -1,6 +0,0 @@
-<?php
-/* For licensing terms, see /license.txt */
-
-// Redirect calls to the new web/index.php
-header('Location: web/userportal');
-exit;

+ 11 - 6
web/app.php

@@ -1,7 +1,7 @@
 <?php
 
 use Symfony\Component\ClassLoader\ApcClassLoader;
-use Symfony\Component\HttpFoundation\Request;
+//use Symfony\Component\HttpFoundation\Request;
 
 $loader = require_once __DIR__.'/../app/bootstrap.php.cache';
 
@@ -16,17 +16,22 @@ $apcLoader->register(true);
 
 require_once __DIR__.'/../app/AppKernel.php';
 //require_once __DIR__.'/../app/AppCache.php';
-
-// Chamilo legacy code.
 require_once __DIR__.'/legacy.php';
 
-$kernel = new AppKernel('prod', true);
-$kernel->loadClassCache();
-//$kernel = new AppCache($kernel);
+// if you want to use the SonataPageBundle with multisite
+// using different relative paths, you must change the request
+// object to use the SiteRequest
+use Sonata\PageBundle\Request\SiteRequest as Request;
 
 // When using the HttpCache, you need to call the method in your front controller instead of relying on the configuration parameter
 //Request::enableHttpMethodParameterOverride();
 $request = Request::createFromGlobals();
+
+$kernel = new AppKernel('prod', false);
+$kernel->loadClassCache();
+//$kernel = new AppCache($kernel);
+
+
 $response = $kernel->handle($request);
 $response->send();
 $kernel->terminate($request, $response);

+ 9 - 7
web/app_dev.php

@@ -1,11 +1,10 @@
 <?php
 
-use Symfony\Component\HttpFoundation\Request;
-use Symfony\Component\Debug\Debug;
+//use Symfony\Component\HttpFoundation\Request;
 
 // If you don't want to setup permissions the proper way, just uncomment the following PHP line
 // read http://symfony.com/doc/current/book/installation.html#configuration-and-setup for more information
-//umask(0000);
+umask(0000);
 
 // This check prevents access to debug front controllers that are deployed by accident to production servers.
 // Feel free to remove this, extend it, or make something more sophisticated.
@@ -17,16 +16,19 @@ if (isset($_SERVER['HTTP_CLIENT_IP'])
     exit('You are not allowed to access this file. Check '.basename(__FILE__).' for more information.');
 }
 
-$loader = require_once __DIR__.'/../app/bootstrap.php.cache';
-Debug::enable();
+require_once __DIR__.'/../app/bootstrap.php.cache';
 
 require_once __DIR__.'/../app/AppKernel.php';
-
 require_once __DIR__.'/legacy.php';
 
+// if you want to use the SonataPageBundle with multisite
+// using different relative paths, you must change the request
+// object to use the SiteRequest
+use Sonata\PageBundle\Request\SiteRequest as Request;
+$request = Request::createFromGlobals();
+
 $kernel = new AppKernel('dev', true);
 $kernel->loadClassCache();
-$request = Request::createFromGlobals();
 $response = $kernel->handle($request);
 $response->send();
 $kernel->terminate($request, $response);

+ 0 - 0
apple-touch-icon.png → web/apple-touch-icon.png


+ 0 - 0
favicon.ico → web/favicon.ico


+ 1 - 2
web/legacy.php

@@ -2,8 +2,7 @@
 
 define('USERNAME_MAX_LENGTH', 40);
 
-
 require_once __DIR__.'/../main/inc/lib/api.lib.php';
 require_once __DIR__.'/../main/inc/lib/database.constants.inc.php';
 require_once __DIR__.'/../main/inc/lib/internationalization.lib.php';
-require_once __DIR__.'/../main/inc/lib/events.lib.inc.php';
+//require_once __DIR__.'/../main/inc/lib/events.lib.inc.php';

+ 0 - 0
robots.txt → web/robots.txt


+ 0 - 185
whoisonline.php

@@ -1,185 +0,0 @@
-<?php
-/* For licensing terms, see /license.txt */
-
-/**
- * Who is online list
- * @todo move this inside web/users/online
- */
-
-// language files that should be included
-$language_file = array('index', 'registration', 'messages', 'userInfo');
-
-if (!isset($_GET['cidReq'])) {
-    $cidReset = true;
-}
-
-// including necessary files
-require_once './main/inc/global.inc.php';
-
-if (isset($_GET['cidReq']) && strlen($_GET['cidReq']) > 0) {
-    api_protect_course_script(true);
-}
-
-$_SESSION['who_is_online_counter'] = 2;
-
-$htmlHeadXtra[] = api_get_js('jquery.endless-scroll.js');
-//social tab
-$this_section = SECTION_SOCIAL;
-// table definitions
-$track_user_table = Database::get_main_table(TABLE_MAIN_USER);
-$htmlHeadXtra[] = '<script>
-
-function show_image(image,width,height) {
-    width = parseInt(width) + 20;
-    height = parseInt(height) + 20;
-    window_x = window.open(image,\'windowX\',\'width=\'+ width + \', height=\'+ height + \'\');
-}
-
-$(document).ready(function (){
-	$("input#id_btn_send_invitation").bind("click", function(){
-		if (confirm("'.get_lang('SendMessageInvitation', '').'")) {
-			$("#form_register_friend").submit();
-		}
-	});
-});
-
-function display_hide () {
-		setTimeout("hide_display_message()",3000);
-}
-function hide_display_message () {
-	$("div#display_response_id").html("");
-	try {
-		$("#txt_subject_id").val("");
-		$("#txt_area_invite").val("");
-	}catch(e) {
-		$("#txt_area_invite").val("");
-	}
-}
-
-function show_icon_edit(element_html) {
-    ident="#edit_image";
-    $(ident).show();
-}
-
-function hide_icon_edit(element_html)  {
-    ident="#edit_image";
-    $(ident).hide();
-}
-
-$(document).ready(function() {
-
-    $("#link_load_more_items").live("click", function() {
-        page = $("#link_load_more_items").attr("data_link");
-        $.ajax({
-                beforeSend: function(objeto) {
-                    $("#display_response_id").html("'.addslashes(get_lang('Loading')).'");
-                },
-                type: "GET",
-                url: "main/inc/ajax/online.ajax.php?a=load_online_user",
-                data: "online_page_nr="+page,
-                success: function(data) {
-                    $("#display_response_id").html("");
-                    if (data != "end") {
-                        $("#link_load_more_items").remove();
-                        var last = $("#online_grid_container li:last");
-                        last.after(data);
-                    } else {
-                        $("#link_load_more_items").remove();
-                    }
-                }
-            });
-    });
-});
-</script>';
-
-
-if (isset($_GET['chatid']) && !empty($_GET['chatid'])) {
-    //send out call request
-    $time = time();
-    $time = date("Y-m-d H:i:s", $time);
-    $chatid = intval($_GET['chatid']);
-    if ($_GET['chatid'] == strval(intval($_GET['chatid']))) {
-        $sql = "UPDATE $track_user_table SET chatcall_user_id = '".Database::escape_string(
-            $_user['user_id']
-        )."', chatcall_date = '".Database::escape_string(
-            $time
-        )."', chatcall_text = '' where (user_id = ".(int)Database::escape_string($chatid).")";
-        $result = Database::query($sql);
-        //redirect caller to chat
-        header(
-            "Location: ".api_get_path(WEB_CODE_PATH)."chat/chat.php?".api_get_cidreq(
-            )."&origin=whoisonline&target=".Security::remove_XSS($chatid)
-        );
-        exit;
-    }
-}
-
-$social_right_content = null;
-
-// This if statement prevents users accessing the who's online feature when it has been disabled.
-if ((api_get_setting('showonline', 'world') == 'true' && !$_user['user_id']) || ((api_get_setting(
-    'showonline',
-    'users'
-) == 'true' || api_get_setting('showonline', 'course') == 'true') && $_user['user_id'])
-) {
-
-    if (isset($_GET['cidReq']) && strlen($_GET['cidReq']) > 0) {
-        $user_list = Online::who_is_online_in_this_course(
-            0,
-            9,
-            api_get_user_id(),
-            api_get_setting('time_limit_whosonline'),
-            $_GET['cidReq']
-        );
-    } else {
-        $user_list = Online::who_is_online(0, 9);
-    }
-
-    if (!isset($_GET['id'])) {
-        if (api_get_setting('allow_social_tool') == 'true') {
-            if (!api_is_anonymous()) {
-                //this include the social menu div
-                $social_left_content = SocialManager::show_social_menu('whoisonline');
-            }
-        }
-    }
-
-    if ($user_list) {
-        if (!isset($_GET['id'])) {
-            if (api_get_setting('allow_social_tool') == 'true') {
-                if (!api_is_anonymous()) {
-                    $query = isset($_GET['q']) ? $_GET['q'] : null;
-                    $social_right_content .= '<div class="span9">'.UserManager::get_search_form($query).'</div>';
-                }
-            }
-            $social_right_content .= SocialManager::display_user_list($user_list);
-        }
-    }
-
-    if (isset($_GET['id'])) {
-        if (api_get_setting('allow_social_tool') == 'true') {
-            header("Location: ".api_get_path(WEB_CODE_PATH)."social/profile.php?u=".intval($_GET['id']));
-            exit;
-        } else {
-            SocialManager::display_individual_user($_GET['id']);
-        }
-    }
-} else {
-    api_not_allowed();
-    exit;
-}
-
-$app['title'] = get_lang('UsersOnLineList');
-$tpl = $app['template'];
-
-if (api_get_setting('allow_social_tool') == 'true' && !api_is_anonymous()) {
-    $tpl->setHelp('Groups');
-    $tpl->assign('social_left_content', $social_left_content);
-    $tpl->assign('social_right_content', $social_right_content);
-    $social_layout = $tpl->get_template('layout/social_layout.tpl');
-    $tpl->display($social_layout);
-} else {
-    $tpl->assign('header', get_lang('UsersOnLineList'));
-    $tpl->assign('content', $social_right_content);
-    $tpl->display_one_col_template();
-}

+ 0 - 118
whoisonlinesession.php

@@ -1,118 +0,0 @@
-<?php
-/* For licensing terms, see /license.txt */
-/**
- * Shows who is online in a specific session
- * @todo move this inside web/users/online-in-course
- * @package chamilo.main
- */
-/**
- * Initialization
- */
-// name of the language file that needs to be included
-$language_file = array ('index', 'chat', 'tracking');
-
-require_once './main/inc/global.inc.php';
-
-api_block_anonymous_users();
-
-if (isset($_REQUEST['session_id'])) {
-    $session_id = intval($_REQUEST['session_id']);
-} else {
-    $session_id = api_get_session_id();
-}
-if (empty($session_id)) {
-    api_not_allowed(true);
-}
-
-Display::display_header(get_lang('UserOnlineListSession'));
-
-echo Display::page_header(get_lang('UserOnlineListSession'));
-
-?>
-<br /><br />
-<table class="data_table">
-	<tr>
-		<th>
-			<?php echo get_lang('Name'); ?>
-		</th>
-		<th>
-			<?php echo get_lang('InCourse'); ?>
-		</th>
-		<th>
-			<?php echo get_lang('Email'); ?>
-		</th>
-		<th>
-			<?php echo get_lang('Chat'); ?>
-		</th>
-	</tr>
-<?php
-	$session_is_coach = array();
-	if (isset($_user['user_id']) && $_user['user_id'] != '') {
-        $session_is_coach = SessionManager::get_sessions_coached_by_user(api_get_user_id());
-		$students_online = array();
-        $now = api_get_utc_datetime();
-
-        $time_limit     = api_get_setting('time_limit_whosonline');
-        $online_time 	= time() - $time_limit*60;
-        $current_date	= api_get_utc_datetime($online_time);
-
-        foreach ($session_is_coach as $session) {
-			$sql = "SELECT 	DISTINCT last_access.access_user_id,
-							last_access.access_date,
-							last_access.c_id,
-							last_access.access_session_id,
-							course.code,
-							".(api_is_western_name_order() ? "CONCAT(user.firstname,' ',user.lastname)" : "CONCAT(user.lastname,' ',user.firstname)")." as name,
-							user.email
-					FROM ".Database::get_main_table(TABLE_STATISTIC_TRACK_E_LASTACCESS)." AS last_access
-					INNER JOIN ".Database::get_main_table(TABLE_MAIN_USER)." AS user
-					    ON user.user_id = last_access.access_user_id
-					INNER JOIN ".Database::get_main_table(TABLE_MAIN_COURSE)." AS course
-					    ON course.id = last_access.c_id
-					WHERE access_session_id='".$session['id']."' AND access_date >= '$current_date'
-					GROUP BY access_user_id";
-
-			$result = Database::query($sql);
-
-			while($user_list = Database::fetch_array($result)) {
-				$students_online[$user_list['access_user_id']] = $user_list;
-			}
-		}
-
-		if (count($students_online) > 0) {
-			foreach ($students_online as $student_online) {
-				echo "<tr><td>";
-				echo $student_online['name'];
-				echo "</td><td align='center'>";
-				echo $student_online['code'];
-				echo "</td><td align='center'>";
-                if (api_get_setting('show_email_addresses') == 'true') {
-                    if (!empty($student_online['email'])) {
-                       echo $student_online['email'];
-                    } else {
-                       echo get_lang('NoEmail');
-                    }
-                }
-				echo "	</td>
-						<td align='center'>
-					 ";
-				echo '<a target="_blank" class="btn" href="main/chat/chat.php?cidReq='.$student_online['code'].'&id_session='.$student_online['access_session_id'].'">
-                    '.get_lang('Chat').'
-                        </a>';
-				echo "	</td>
-					</tr>
-					 ";
-			}
-		} else {
-			echo '	<tr>
-						<td colspan="4">
-							'.get_lang('NoOnlineStudents').'
-						</td>
-					</tr>
-				 ';
-		}
-	}
-?>
-</table>
-<?php
-Display::display_footer();