From c64031c534a3dc5080d3e8e3b157aeff0b44b9dd Mon Sep 17 00:00:00 2001 From: Alex Aragon Date: Mon, 15 May 2017 12:01:18 -0500 Subject: [PATCH] add layouts catalog in rainbow --- app/SymfonyRequirements.php | 84 ++- app/bootstrap.php.cache | 657 ++---------------- app/check.php | 1 - main/exercise/overview.php | 7 +- main/template/rainbow/auth/catalog_layout.php | 21 - .../template/rainbow/auth/categories_list.php | 32 - .../rainbow/auth/courses_categories.php | 428 ------------ main/template/rainbow/auth/courses_list.php | 280 -------- main/template/rainbow/auth/inscription.tpl | 11 +- main/template/rainbow/auth/layout.php | 20 - main/template/rainbow/auth/lost_password.tpl | 2 - main/template/rainbow/auth/readme.txt | 10 + .../template/rainbow/auth/session_catalog.tpl | 243 ++++--- main/template/rainbow/exercise/overview.tpl | 4 + 14 files changed, 283 insertions(+), 1517 deletions(-) delete mode 100644 main/template/rainbow/auth/catalog_layout.php delete mode 100755 main/template/rainbow/auth/categories_list.php delete mode 100755 main/template/rainbow/auth/courses_categories.php delete mode 100755 main/template/rainbow/auth/courses_list.php delete mode 100755 main/template/rainbow/auth/layout.php create mode 100644 main/template/rainbow/auth/readme.txt create mode 100644 main/template/rainbow/exercise/overview.tpl diff --git a/app/SymfonyRequirements.php b/app/SymfonyRequirements.php index 29dd4ce8e0..3b14a4022d 100644 --- a/app/SymfonyRequirements.php +++ b/app/SymfonyRequirements.php @@ -168,6 +168,9 @@ class PhpIniRequirement extends Requirement */ class RequirementCollection implements IteratorAggregate { + /** + * @var Requirement[] + */ private $requirements = array(); /** @@ -265,7 +268,7 @@ class RequirementCollection implements IteratorAggregate /** * Returns both requirements and recommendations. * - * @return array Array of Requirement instances + * @return Requirement[] */ public function all() { @@ -275,7 +278,7 @@ class RequirementCollection implements IteratorAggregate /** * Returns all mandatory requirements. * - * @return array Array of Requirement instances + * @return Requirement[] */ public function getRequirements() { @@ -292,7 +295,7 @@ class RequirementCollection implements IteratorAggregate /** * Returns the mandatory requirements that were not met. * - * @return array Array of Requirement instances + * @return Requirement[] */ public function getFailedRequirements() { @@ -309,7 +312,7 @@ class RequirementCollection implements IteratorAggregate /** * Returns all optional recommendations. * - * @return array Array of Requirement instances + * @return Requirement[] */ public function getRecommendations() { @@ -326,7 +329,7 @@ class RequirementCollection implements IteratorAggregate /** * Returns the recommendations that were not met. * - * @return array Array of Requirement instances + * @return Requirement[] */ public function getFailedRecommendations() { @@ -376,7 +379,8 @@ class RequirementCollection implements IteratorAggregate */ class SymfonyRequirements extends RequirementCollection { - const REQUIRED_PHP_VERSION = '5.3.3'; + const LEGACY_REQUIRED_PHP_VERSION = '5.3.3'; + const REQUIRED_PHP_VERSION = '5.5.9'; /** * Constructor that initializes the requirements. @@ -386,16 +390,26 @@ class SymfonyRequirements extends RequirementCollection /* mandatory requirements follow */ $installedPhpVersion = phpversion(); + $requiredPhpVersion = $this->getPhpRequiredVersion(); - $this->addRequirement( - version_compare($installedPhpVersion, self::REQUIRED_PHP_VERSION, '>='), - sprintf('PHP version must be at least %s (%s installed)', self::REQUIRED_PHP_VERSION, $installedPhpVersion), - sprintf('You are running PHP version "%s", but Symfony needs at least PHP "%s" to run. - Before using Symfony, upgrade your PHP installation, preferably to the latest version.', - $installedPhpVersion, self::REQUIRED_PHP_VERSION), - sprintf('Install PHP %s or newer (installed version is %s)', self::REQUIRED_PHP_VERSION, $installedPhpVersion) + $this->addRecommendation( + $requiredPhpVersion, + 'Vendors should be installed in order to check all requirements.', + 'Run the composer install command.', + 'Run the "composer install" command.' ); + if (false !== $requiredPhpVersion) { + $this->addRequirement( + version_compare($installedPhpVersion, $requiredPhpVersion, '>='), + sprintf('PHP version must be at least %s (%s installed)', $requiredPhpVersion, $installedPhpVersion), + sprintf('You are running PHP version "%s", but Symfony needs at least PHP "%s" to run. + Before using Symfony, upgrade your PHP installation, preferably to the latest version.', + $installedPhpVersion, $requiredPhpVersion), + sprintf('Install PHP %s or newer (installed version is %s)', $requiredPhpVersion, $installedPhpVersion) + ); + } + $this->addRequirement( version_compare($installedPhpVersion, '5.3.16', '!='), 'PHP version must not be 5.3.16 as Symfony won\'t work properly with it', @@ -433,7 +447,7 @@ class SymfonyRequirements extends RequirementCollection ); } - if (version_compare($installedPhpVersion, self::REQUIRED_PHP_VERSION, '>=')) { + if (false !== $requiredPhpVersion && version_compare($installedPhpVersion, $requiredPhpVersion, '>=')) { $timezones = array(); foreach (DateTimeZone::listAbbreviations() as $abbreviations) { foreach ($abbreviations as $abbreviation) { @@ -619,12 +633,6 @@ class SymfonyRequirements extends RequirementCollection 'Install and enable the mbstring extension.' ); - $this->addRecommendation( - function_exists('iconv'), - 'iconv() should be available', - 'Install and enable the iconv extension.' - ); - $this->addRecommendation( function_exists('utf8_decode'), 'utf8_decode() should be available', @@ -725,9 +733,9 @@ class SymfonyRequirements extends RequirementCollection if (strtoupper(substr(PHP_OS, 0, 3)) === 'WIN') { $this->addRecommendation( - $this->getRealpathCacheSize() > 1000, - 'realpath_cache_size should be above 1024 in php.ini', - 'Set "realpath_cache_size" to e.g. "1024" in php.ini* to improve performance on windows.' + $this->getRealpathCacheSize() >= 5 * 1024 * 1024, + 'realpath_cache_size should be at least 5M in php.ini', + 'Setting "realpath_cache_size" to e.g. "5242880" or "5M" in php.ini* may improve performance on Windows significantly in some cases.' ); } @@ -766,7 +774,11 @@ class SymfonyRequirements extends RequirementCollection { $size = ini_get('realpath_cache_size'); $size = trim($size); - $unit = strtolower(substr($size, -1, 1)); + $unit = ''; + if (!ctype_digit($size)) { + $unit = strtolower(substr($size, -1, 1)); + $size = (int) substr($size, 0, -1); + } switch ($unit) { case 'g': return $size * 1024 * 1024 * 1024; @@ -778,4 +790,28 @@ class SymfonyRequirements extends RequirementCollection return (int) $size; } } + + /** + * Defines PHP required version from Symfony version. + * + * @return string|false The PHP required version or false if it could not be guessed + */ + protected function getPhpRequiredVersion() + { + if (!file_exists($path = __DIR__.'/../composer.lock')) { + return false; + } + + $composerLock = json_decode(file_get_contents($path), true); + foreach ($composerLock['packages'] as $package) { + $name = $package['name']; + if ('symfony/symfony' !== $name && 'symfony/http-kernel' !== $name) { + continue; + } + + return (int) $package['version'][1] > 2 ? self::REQUIRED_PHP_VERSION : self::LEGACY_REQUIRED_PHP_VERSION; + } + + return false; + } } diff --git a/app/bootstrap.php.cache b/app/bootstrap.php.cache index ef72f58166..c968f55da0 100644 --- a/app/bootstrap.php.cache +++ b/app/bootstrap.php.cache @@ -64,7 +64,7 @@ $currentKey .= $char; } } if (null !== $currentKey) { -throw new \InvalidArgumentException(sprintf('Malformed path. Path must end with "]".')); +throw new \InvalidArgumentException('Malformed path. Path must end with "]".'); } return $value; } @@ -465,6 +465,13 @@ protected $locale; protected $defaultLocale ='en'; protected static $formats; protected static $requestFactory; +private $isForwardedValid = true; +private static $forwardedParams = array( +self::HEADER_CLIENT_IP =>'for', +self::HEADER_CLIENT_HOST =>'host', +self::HEADER_CLIENT_PROTO =>'proto', +self::HEADER_CLIENT_PORT =>'host', +); 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); @@ -760,32 +767,11 @@ $this->session = $session; } public function getClientIps() { -$clientIps = array(); $ip = $this->server->get('REMOTE_ADDR'); if (!$this->isFromTrustedProxy()) { return array($ip); } -$hasTrustedForwardedHeader = self::$trustedHeaders[self::HEADER_FORWARDED] && $this->headers->has(self::$trustedHeaders[self::HEADER_FORWARDED]); -$hasTrustedClientIpHeader = self::$trustedHeaders[self::HEADER_CLIENT_IP] && $this->headers->has(self::$trustedHeaders[self::HEADER_CLIENT_IP]); -if ($hasTrustedForwardedHeader) { -$forwardedHeader = $this->headers->get(self::$trustedHeaders[self::HEADER_FORWARDED]); -preg_match_all('{(for)=("?\[?)([a-z0-9\.:_\-/]*)}', $forwardedHeader, $matches); -$forwardedClientIps = $matches[3]; -$forwardedClientIps = $this->normalizeAndFilterClientIps($forwardedClientIps, $ip); -$clientIps = $forwardedClientIps; -} -if ($hasTrustedClientIpHeader) { -$xForwardedForClientIps = array_map('trim', explode(',', $this->headers->get(self::$trustedHeaders[self::HEADER_CLIENT_IP]))); -$xForwardedForClientIps = $this->normalizeAndFilterClientIps($xForwardedForClientIps, $ip); -$clientIps = $xForwardedForClientIps; -} -if ($hasTrustedForwardedHeader && $hasTrustedClientIpHeader && $forwardedClientIps !== $xForwardedForClientIps) { -throw new ConflictingHeadersException('The request has both a trusted Forwarded header and a trusted Client IP header, conflicting with each other with regards to the originating IP addresses of the request. This is the result of a misconfiguration. You should either configure your proxy only to send one of these headers, or configure Symfony to distrust one of them.'); -} -if (!$hasTrustedForwardedHeader && !$hasTrustedClientIpHeader) { -return $this->normalizeAndFilterClientIps(array(), $ip); -} -return $clientIps; +return $this->getTrustedValues(self::HEADER_CLIENT_IP, $ip) ?: array($ip); } public function getClientIp() { @@ -823,15 +809,13 @@ return $this->isSecure() ?'https':'http'; } public function getPort() { -if ($this->isFromTrustedProxy()) { -if (self::$trustedHeaders[self::HEADER_CLIENT_PORT] && $port = $this->headers->get(self::$trustedHeaders[self::HEADER_CLIENT_PORT])) { -return $port; -} -if (self::$trustedHeaders[self::HEADER_CLIENT_PROTO] &&'https'=== $this->headers->get(self::$trustedHeaders[self::HEADER_CLIENT_PROTO],'http')) { -return 443; -} +if ($this->isFromTrustedProxy() && $host = $this->getTrustedValues(self::HEADER_CLIENT_PORT)) { +$host = $host[0]; +} elseif ($this->isFromTrustedProxy() && $host = $this->getTrustedValues(self::HEADER_CLIENT_HOST)) { +$host = $host[0]; +} elseif (!$host = $this->headers->get('HOST')) { +return $this->server->get('SERVER_PORT'); } -if ($host = $this->headers->get('HOST')) { if ($host[0] ==='[') { $pos = strpos($host,':', strrpos($host,']')); } else { @@ -842,8 +826,6 @@ return (int) substr($host, $pos + 1); } return'https'=== $this->getScheme() ? 443 : 80; } -return $this->server->get('SERVER_PORT'); -} public function getUser() { return $this->headers->get('PHP_AUTH_USER'); @@ -924,17 +906,16 @@ return''=== $qs ? null : $qs; } public function isSecure() { -if ($this->isFromTrustedProxy() && self::$trustedHeaders[self::HEADER_CLIENT_PROTO] && $proto = $this->headers->get(self::$trustedHeaders[self::HEADER_CLIENT_PROTO])) { -return in_array(strtolower(current(explode(',', $proto))), array('https','on','ssl','1')); +if ($this->isFromTrustedProxy() && $proto = $this->getTrustedValues(self::HEADER_CLIENT_PROTO)) { +return in_array(strtolower($proto[0]), array('https','on','ssl','1'), true); } $https = $this->server->get('HTTPS'); return !empty($https) &&'off'!== strtolower($https); } public function getHost() { -if ($this->isFromTrustedProxy() && self::$trustedHeaders[self::HEADER_CLIENT_HOST] && $host = $this->headers->get(self::$trustedHeaders[self::HEADER_CLIENT_HOST])) { -$elements = explode(',', $host); -$host = $elements[count($elements) - 1]; +if ($this->isFromTrustedProxy() && $host = $this->getTrustedValues(self::HEADER_CLIENT_HOST)) { +$host = $host[0]; } elseif (!$host = $this->headers->get('HOST')) { if (!$host = $this->server->get('SERVER_NAME')) { $host = $this->server->get('SERVER_ADDR',''); @@ -1016,9 +997,9 @@ static::$formats[$format] = is_array($mimeTypes) ? $mimeTypes : array($mimeTypes public function getRequestFormat($default ='html') { if (null === $this->format) { -$this->format = $this->get('_format', $default); +$this->format = $this->get('_format'); } -return $this->format; +return null === $this->format ? $default : $this->format; } public function setRequestFormat($format) { @@ -1053,7 +1034,11 @@ return $this->getMethod() === strtoupper($method); } public function isMethodSafe() { -return in_array($this->getMethod(), array('GET','HEAD','OPTIONS','TRACE')); +return in_array($this->getMethod(), 0 < func_num_args() && !func_get_arg(0) ? array('GET','HEAD','OPTIONS','TRACE') : array('GET','HEAD')); +} +public function isMethodCacheable() +{ +return in_array($this->getMethod(), array('GET','HEAD')); } public function getContent($asResource = false) { @@ -1222,6 +1207,9 @@ $baseUrl ='/'.$seg.$baseUrl; } while ($last > $index && (false !== $pos = strpos($path, $baseUrl)) && 0 != $pos); } $requestUri = $this->getRequestUri(); +if ($requestUri !==''&& $requestUri[0] !=='/') { +$requestUri ='/'.$requestUri; +} if ($baseUrl && false !== $prefix = $this->getUrlencodedPrefix($requestUri, $baseUrl)) { return $prefix; } @@ -1264,9 +1252,12 @@ $baseUrl = $this->getBaseUrl(); if (null === ($requestUri = $this->getRequestUri())) { return'/'; } -if ($pos = strpos($requestUri,'?')) { +if (false !== $pos = strpos($requestUri,'?')) { $requestUri = substr($requestUri, 0, $pos); } +if ($requestUri !==''&& $requestUri[0] !=='/') { +$requestUri ='/'.$requestUri; +} $pathInfo = substr($requestUri, strlen($baseUrl)); if (null !== $baseUrl && (false === $pathInfo ||''=== $pathInfo)) { return'/'; @@ -1315,8 +1306,40 @@ private function isFromTrustedProxy() { return self::$trustedProxies && IpUtils::checkIp($this->server->get('REMOTE_ADDR'), self::$trustedProxies); } +private function getTrustedValues($type, $ip = null) +{ +$clientValues = array(); +$forwardedValues = array(); +if (self::$trustedHeaders[$type] && $this->headers->has(self::$trustedHeaders[$type])) { +foreach (explode(',', $this->headers->get(self::$trustedHeaders[$type])) as $v) { +$clientValues[] = (self::HEADER_CLIENT_PORT === $type ?'0.0.0.0:':'').trim($v); +} +} +if (self::$trustedHeaders[self::HEADER_FORWARDED] && $this->headers->has(self::$trustedHeaders[self::HEADER_FORWARDED])) { +$forwardedValues = $this->headers->get(self::$trustedHeaders[self::HEADER_FORWARDED]); +$forwardedValues = preg_match_all(sprintf('{(?:%s)=(?:"?\[?)([a-zA-Z0-9\.:_\-/]*+)}', self::$forwardedParams[$type]), $forwardedValues, $matches) ? $matches[1] : array(); +} +if (null !== $ip) { +$clientValues = $this->normalizeAndFilterClientIps($clientValues, $ip); +$forwardedValues = $this->normalizeAndFilterClientIps($forwardedValues, $ip); +} +if ($forwardedValues === $clientValues || !$clientValues) { +return $forwardedValues; +} +if (!$forwardedValues) { +return $clientValues; +} +if (!$this->isForwardedValid) { +return null !== $ip ? array('0.0.0.0', $ip) : array(); +} +$this->isForwardedValid = false; +throw new ConflictingHeadersException(sprintf('The request has both a trusted "%s" header and a trusted "%s" header, conflicting with each other. You should either configure your proxy to remove one of them, or configure your project to distrust the offending one.', self::$trustedHeaders[self::HEADER_FORWARDED], self::$trustedHeaders[$type])); +} private function normalizeAndFilterClientIps(array $clientIps, $ip) { +if (!$clientIps) { +return array(); +} $clientIps[] = $ip; $firstTrustedIp = null; foreach ($clientIps as $key => $clientIp) { if (preg_match('{((?:\d+\.){3}\d+)\:\d+}', $clientIp, $match)) { @@ -1337,553 +1360,3 @@ return $clientIps ? array_reverse($clientIps) : array($firstTrustedIp); } } } -namespace Symfony\Component\HttpKernel -{ -use Symfony\Component\HttpFoundation\Request; -use Symfony\Component\HttpFoundation\Response; -interface HttpKernelInterface -{ -const MASTER_REQUEST = 1; -const SUB_REQUEST = 2; -public function handle(Request $request, $type = self::MASTER_REQUEST, $catch = true); -} -} -namespace Symfony\Component\HttpKernel -{ -use Symfony\Component\DependencyInjection\ContainerInterface; -use Symfony\Component\HttpKernel\Bundle\BundleInterface; -use Symfony\Component\Config\Loader\LoaderInterface; -interface KernelInterface extends HttpKernelInterface, \Serializable -{ -public function registerBundles(); -public function registerContainerConfiguration(LoaderInterface $loader); -public function boot(); -public function shutdown(); -public function getBundles(); -public function isClassInActiveBundle($class); -public function getBundle($name, $first = true); -public function locateResource($name, $dir = null, $first = true); -public function getName(); -public function getEnvironment(); -public function isDebug(); -public function getRootDir(); -public function getContainer(); -public function getStartTime(); -public function getCacheDir(); -public function getLogDir(); -public function getCharset(); -} -} -namespace Symfony\Component\HttpKernel -{ -use Symfony\Component\HttpFoundation\Request; -use Symfony\Component\HttpFoundation\Response; -interface TerminableInterface -{ -public function terminate(Request $request, Response $response); -} -} -namespace Symfony\Component\HttpKernel -{ -use Symfony\Bridge\ProxyManager\LazyProxy\Instantiator\RuntimeInstantiator; -use Symfony\Bridge\ProxyManager\LazyProxy\PhpDumper\ProxyDumper; -use Symfony\Component\DependencyInjection\ContainerInterface; -use Symfony\Component\DependencyInjection\ContainerBuilder; -use Symfony\Component\DependencyInjection\Dumper\PhpDumper; -use Symfony\Component\DependencyInjection\ParameterBag\ParameterBag; -use Symfony\Component\DependencyInjection\Loader\XmlFileLoader; -use Symfony\Component\DependencyInjection\Loader\YamlFileLoader; -use Symfony\Component\DependencyInjection\Loader\IniFileLoader; -use Symfony\Component\DependencyInjection\Loader\PhpFileLoader; -use Symfony\Component\DependencyInjection\Loader\DirectoryLoader; -use Symfony\Component\DependencyInjection\Loader\ClosureLoader; -use Symfony\Component\HttpFoundation\Request; -use Symfony\Component\HttpFoundation\Response; -use Symfony\Component\HttpKernel\Bundle\BundleInterface; -use Symfony\Component\HttpKernel\Config\EnvParametersResource; -use Symfony\Component\HttpKernel\Config\FileLocator; -use Symfony\Component\HttpKernel\DependencyInjection\MergeExtensionConfigurationPass; -use Symfony\Component\HttpKernel\DependencyInjection\AddClassesToCachePass; -use Symfony\Component\Config\Loader\LoaderResolver; -use Symfony\Component\Config\Loader\DelegatingLoader; -use Symfony\Component\Config\ConfigCache; -use Symfony\Component\ClassLoader\ClassCollectionLoader; -abstract class Kernel implements KernelInterface, TerminableInterface -{ -protected $bundles = array(); -protected $bundleMap; -protected $container; -protected $rootDir; -protected $environment; -protected $debug; -protected $booted = false; -protected $name; -protected $startTime; -protected $loadClassCache; -const VERSION ='2.8.11'; -const VERSION_ID = 20811; -const MAJOR_VERSION = 2; -const MINOR_VERSION = 8; -const RELEASE_VERSION = 11; -const EXTRA_VERSION =''; -const END_OF_MAINTENANCE ='11/2018'; -const END_OF_LIFE ='11/2019'; -public function __construct($environment, $debug) -{ -$this->environment = $environment; -$this->debug = (bool) $debug; -$this->rootDir = $this->getRootDir(); -$this->name = $this->getName(); -if ($this->debug) { -$this->startTime = microtime(true); -} -$defClass = new \ReflectionMethod($this,'init'); -$defClass = $defClass->getDeclaringClass()->name; -if (__CLASS__ !== $defClass) { -@trigger_error(sprintf('Calling the %s::init() method is deprecated since version 2.3 and will be removed in 3.0. Move your logic to the constructor method instead.', $defClass), E_USER_DEPRECATED); -$this->init(); -} -} -public function init() -{ -@trigger_error('The '.__METHOD__.' method is deprecated since version 2.3 and will be removed in 3.0. Move your logic to the constructor method instead.', E_USER_DEPRECATED); -} -public function __clone() -{ -if ($this->debug) { -$this->startTime = microtime(true); -} -$this->booted = false; -$this->container = null; -} -public function boot() -{ -if (true === $this->booted) { -return; -} -if ($this->loadClassCache) { -$this->doLoadClassCache($this->loadClassCache[0], $this->loadClassCache[1]); -} -$this->initializeBundles(); -$this->initializeContainer(); -foreach ($this->getBundles() as $bundle) { -$bundle->setContainer($this->container); -$bundle->boot(); -} -$this->booted = true; -} -public function terminate(Request $request, Response $response) -{ -if (false === $this->booted) { -return; -} -if ($this->getHttpKernel() instanceof TerminableInterface) { -$this->getHttpKernel()->terminate($request, $response); -} -} -public function shutdown() -{ -if (false === $this->booted) { -return; -} -$this->booted = false; -foreach ($this->getBundles() as $bundle) { -$bundle->shutdown(); -$bundle->setContainer(null); -} -$this->container = null; -} -public function handle(Request $request, $type = HttpKernelInterface::MASTER_REQUEST, $catch = true) -{ -if (false === $this->booted) { -$this->boot(); -} -return $this->getHttpKernel()->handle($request, $type, $catch); -} -protected function getHttpKernel() -{ -return $this->container->get('http_kernel'); -} -public function getBundles() -{ -return $this->bundles; -} -public function isClassInActiveBundle($class) -{ -@trigger_error('The '.__METHOD__.' method is deprecated since version 2.6 and will be removed in version 3.0.', E_USER_DEPRECATED); -foreach ($this->getBundles() as $bundle) { -if (0 === strpos($class, $bundle->getNamespace())) { -return true; -} -} -return false; -} -public function getBundle($name, $first = true) -{ -if (!isset($this->bundleMap[$name])) { -throw new \InvalidArgumentException(sprintf('Bundle "%s" does not exist or it is not enabled. Maybe you forgot to add it in the registerBundles() method of your %s.php file?', $name, get_class($this))); -} -if (true === $first) { -return $this->bundleMap[$name][0]; -} -return $this->bundleMap[$name]; -} -public function locateResource($name, $dir = null, $first = true) -{ -if ('@'!== $name[0]) { -throw new \InvalidArgumentException(sprintf('A resource name must start with @ ("%s" given).', $name)); -} -if (false !== strpos($name,'..')) { -throw new \RuntimeException(sprintf('File name "%s" contains invalid characters (..).', $name)); -} -$bundleName = substr($name, 1); -$path =''; -if (false !== strpos($bundleName,'/')) { -list($bundleName, $path) = explode('/', $bundleName, 2); -} -$isResource = 0 === strpos($path,'Resources') && null !== $dir; -$overridePath = substr($path, 9); -$resourceBundle = null; -$bundles = $this->getBundle($bundleName, false); -$files = array(); -foreach ($bundles as $bundle) { -if ($isResource && file_exists($file = $dir.'/'.$bundle->getName().$overridePath)) { -if (null !== $resourceBundle) { -throw new \RuntimeException(sprintf('"%s" resource is hidden by a resource from the "%s" derived bundle. Create a "%s" file to override the bundle resource.', -$file, -$resourceBundle, -$dir.'/'.$bundles[0]->getName().$overridePath -)); -} -if ($first) { -return $file; -} -$files[] = $file; -} -if (file_exists($file = $bundle->getPath().'/'.$path)) { -if ($first && !$isResource) { -return $file; -} -$files[] = $file; -$resourceBundle = $bundle->getName(); -} -} -if (count($files) > 0) { -return $first && $isResource ? $files[0] : $files; -} -throw new \InvalidArgumentException(sprintf('Unable to find file "%s".', $name)); -} -public function getName() -{ -if (null === $this->name) { -$this->name = preg_replace('/[^a-zA-Z0-9_]+/','', basename($this->rootDir)); -} -return $this->name; -} -public function getEnvironment() -{ -return $this->environment; -} -public function isDebug() -{ -return $this->debug; -} -public function getRootDir() -{ -if (null === $this->rootDir) { -$r = new \ReflectionObject($this); -$this->rootDir = dirname($r->getFileName()); -} -return $this->rootDir; -} -public function getContainer() -{ -return $this->container; -} -public function loadClassCache($name ='classes', $extension ='.php') -{ -$this->loadClassCache = array($name, $extension); -} -public function setClassCache(array $classes) -{ -file_put_contents($this->getCacheDir().'/classes.map', sprintf('debug ? $this->startTime : -INF; -} -public function getCacheDir() -{ -return $this->rootDir.'/cache/'.$this->environment; -} -public function getLogDir() -{ -return $this->rootDir.'/logs'; -} -public function getCharset() -{ -return'UTF-8'; -} -protected function doLoadClassCache($name, $extension) -{ -if (!$this->booted && is_file($this->getCacheDir().'/classes.map')) { -ClassCollectionLoader::load(include($this->getCacheDir().'/classes.map'), $this->getCacheDir(), $name, $this->debug, false, $extension); -} -} -protected function initializeBundles() -{ -$this->bundles = array(); -$topMostBundles = array(); -$directChildren = array(); -foreach ($this->registerBundles() as $bundle) { -$name = $bundle->getName(); -if (isset($this->bundles[$name])) { -throw new \LogicException(sprintf('Trying to register two bundles with the same name "%s"', $name)); -} -$this->bundles[$name] = $bundle; -if ($parentName = $bundle->getParent()) { -if (isset($directChildren[$parentName])) { -throw new \LogicException(sprintf('Bundle "%s" is directly extended by two bundles "%s" and "%s".', $parentName, $name, $directChildren[$parentName])); -} -if ($parentName == $name) { -throw new \LogicException(sprintf('Bundle "%s" can not extend itself.', $name)); -} -$directChildren[$parentName] = $name; -} else { -$topMostBundles[$name] = $bundle; -} -} -if (!empty($directChildren) && count($diff = array_diff_key($directChildren, $this->bundles))) { -$diff = array_keys($diff); -throw new \LogicException(sprintf('Bundle "%s" extends bundle "%s", which is not registered.', $directChildren[$diff[0]], $diff[0])); -} -$this->bundleMap = array(); -foreach ($topMostBundles as $name => $bundle) { -$bundleMap = array($bundle); -$hierarchy = array($name); -while (isset($directChildren[$name])) { -$name = $directChildren[$name]; -array_unshift($bundleMap, $this->bundles[$name]); -$hierarchy[] = $name; -} -foreach ($hierarchy as $hierarchyBundle) { -$this->bundleMap[$hierarchyBundle] = $bundleMap; -array_pop($bundleMap); -} -} -} -protected function getContainerClass() -{ -return $this->name.ucfirst($this->environment).($this->debug ?'Debug':'').'ProjectContainer'; -} -protected function getContainerBaseClass() -{ -return'Container'; -} -protected function initializeContainer() -{ -$class = $this->getContainerClass(); -$cache = new ConfigCache($this->getCacheDir().'/'.$class.'.php', $this->debug); -$fresh = true; -if (!$cache->isFresh()) { -$container = $this->buildContainer(); -$container->compile(); -$this->dumpContainer($cache, $container, $class, $this->getContainerBaseClass()); -$fresh = false; -} -require_once $cache->getPath(); -$this->container = new $class(); -$this->container->set('kernel', $this); -if (!$fresh && $this->container->has('cache_warmer')) { -$this->container->get('cache_warmer')->warmUp($this->container->getParameter('kernel.cache_dir')); -} -} -protected function getKernelParameters() -{ -$bundles = array(); -foreach ($this->bundles as $name => $bundle) { -$bundles[$name] = get_class($bundle); -} -return array_merge( -array('kernel.root_dir'=> realpath($this->rootDir) ?: $this->rootDir,'kernel.environment'=> $this->environment,'kernel.debug'=> $this->debug,'kernel.name'=> $this->name,'kernel.cache_dir'=> realpath($this->getCacheDir()) ?: $this->getCacheDir(),'kernel.logs_dir'=> realpath($this->getLogDir()) ?: $this->getLogDir(),'kernel.bundles'=> $bundles,'kernel.charset'=> $this->getCharset(),'kernel.container_class'=> $this->getContainerClass(), -), -$this->getEnvParameters() -); -} -protected function getEnvParameters() -{ -$parameters = array(); -foreach ($_SERVER as $key => $value) { -if (0 === strpos($key,'SYMFONY__')) { -$parameters[strtolower(str_replace('__','.', substr($key, 9)))] = $value; -} -} -return $parameters; -} -protected function buildContainer() -{ -foreach (array('cache'=> $this->getCacheDir(),'logs'=> $this->getLogDir()) as $name => $dir) { -if (!is_dir($dir)) { -if (false === @mkdir($dir, 0777, true) && !is_dir($dir)) { -throw new \RuntimeException(sprintf("Unable to create the %s directory (%s)\n", $name, $dir)); -} -} elseif (!is_writable($dir)) { -throw new \RuntimeException(sprintf("Unable to write in the %s directory (%s)\n", $name, $dir)); -} -} -$container = $this->getContainerBuilder(); -$container->addObjectResource($this); -$this->prepareContainer($container); -if (null !== $cont = $this->registerContainerConfiguration($this->getContainerLoader($container))) { -$container->merge($cont); -} -$container->addCompilerPass(new AddClassesToCachePass($this)); -$container->addResource(new EnvParametersResource('SYMFONY__')); -return $container; -} -protected function prepareContainer(ContainerBuilder $container) -{ -$extensions = array(); -foreach ($this->bundles as $bundle) { -if ($extension = $bundle->getContainerExtension()) { -$container->registerExtension($extension); -$extensions[] = $extension->getAlias(); -} -if ($this->debug) { -$container->addObjectResource($bundle); -} -} -foreach ($this->bundles as $bundle) { -$bundle->build($container); -} -$container->getCompilerPassConfig()->setMergePass(new MergeExtensionConfigurationPass($extensions)); -} -protected function getContainerBuilder() -{ -$container = new ContainerBuilder(new ParameterBag($this->getKernelParameters())); -if (class_exists('ProxyManager\Configuration') && class_exists('Symfony\Bridge\ProxyManager\LazyProxy\Instantiator\RuntimeInstantiator')) { -$container->setProxyInstantiator(new RuntimeInstantiator()); -} -return $container; -} -protected function dumpContainer(ConfigCache $cache, ContainerBuilder $container, $class, $baseClass) -{ -$dumper = new PhpDumper($container); -if (class_exists('ProxyManager\Configuration') && class_exists('Symfony\Bridge\ProxyManager\LazyProxy\PhpDumper\ProxyDumper')) { -$dumper->setProxyDumper(new ProxyDumper(md5($cache->getPath()))); -} -$content = $dumper->dump(array('class'=> $class,'base_class'=> $baseClass,'file'=> $cache->getPath(),'debug'=> $this->debug)); -$cache->write($content, $container->getResources()); -} -protected function getContainerLoader(ContainerInterface $container) -{ -$locator = new FileLocator($this); -$resolver = new LoaderResolver(array( -new XmlFileLoader($container, $locator), -new YamlFileLoader($container, $locator), -new IniFileLoader($container, $locator), -new PhpFileLoader($container, $locator), -new DirectoryLoader($container, $locator), -new ClosureLoader($container), -)); -return new DelegatingLoader($resolver); -} -public static function stripComments($source) -{ -if (!function_exists('token_get_all')) { -return $source; -} -$rawChunk =''; -$output =''; -$tokens = token_get_all($source); -$ignoreSpace = false; -for ($i = 0; isset($tokens[$i]); ++$i) { -$token = $tokens[$i]; -if (!isset($token[1]) ||'b"'=== $token) { -$rawChunk .= $token; -} elseif (T_START_HEREDOC === $token[0]) { -$output .= $rawChunk.$token[1]; -do { -$token = $tokens[++$i]; -$output .= isset($token[1]) &&'b"'!== $token ? $token[1] : $token; -} while ($token[0] !== T_END_HEREDOC); -$rawChunk =''; -} elseif (T_WHITESPACE === $token[0]) { -if ($ignoreSpace) { -$ignoreSpace = false; -continue; -} -$rawChunk .= preg_replace(array('/\n{2,}/S'),"\n", $token[1]); -} elseif (in_array($token[0], array(T_COMMENT, T_DOC_COMMENT))) { -$ignoreSpace = true; -} else { -$rawChunk .= $token[1]; -if (T_OPEN_TAG === $token[0]) { -$ignoreSpace = true; -} -} -} -$output .= $rawChunk; -if (PHP_VERSION_ID >= 70000) { -unset($tokens, $rawChunk); -gc_mem_caches(); -} -return $output; -} -public function serialize() -{ -return serialize(array($this->environment, $this->debug)); -} -public function unserialize($data) -{ -list($environment, $debug) = unserialize($data); -$this->__construct($environment, $debug); -} -} -} -namespace Symfony\Component\ClassLoader -{ -class ApcClassLoader -{ -private $prefix; -protected $decorated; -public function __construct($prefix, $decorated) -{ -if (!function_exists('apcu_fetch')) { -throw new \RuntimeException('Unable to use ApcClassLoader as APC is not installed.'); -} -if (!method_exists($decorated,'findFile')) { -throw new \InvalidArgumentException('The class finder must implement a "findFile" method.'); -} -$this->prefix = $prefix; -$this->decorated = $decorated; -} -public function register($prepend = false) -{ -spl_autoload_register(array($this,'loadClass'), true, $prepend); -} -public function unregister() -{ -spl_autoload_unregister(array($this,'loadClass')); -} -public function loadClass($class) -{ -if ($file = $this->findFile($class)) { -require $file; -return true; -} -} -public function findFile($class) -{ -$file = apcu_fetch($this->prefix.$class, $success); -if (!$success) { -apcu_store($this->prefix.$class, $file = $this->decorated->findFile($class) ?: null); -} -return $file; -} -public function __call($method, $args) -{ -return call_user_func_array(array($this->decorated, $method), $args); -} -} -} diff --git a/app/check.php b/app/check.php index 680525f979..2cf2dcec2b 100644 --- a/app/check.php +++ b/app/check.php @@ -21,7 +21,6 @@ echo '> Checking Symfony requirements:'.PHP_EOL.' '; $messages = array(); foreach ($symfonyRequirements->getRequirements() as $req) { - /** @var $req Requirement */ if ($helpText = get_error_message($req, $lineSize)) { echo_style('red', 'E'); $messages['error'][] = $helpText; diff --git a/main/exercise/overview.php b/main/exercise/overview.php index 2b434e2407..679591be09 100755 --- a/main/exercise/overview.php +++ b/main/exercise/overview.php @@ -67,7 +67,8 @@ if ($origin != 'learnpath') { "; Display::display_reduced_header(); } - +$tpl = new Template('Overview'); +$list = array(); $html = ''; $message = ''; $html .= '
'; @@ -337,4 +338,8 @@ $html .= Display::tag( $html .= '
'; echo $html; +$tpl->assign('data',$list); +$layout = $tpl->get_template('exercise/overview.tpl'); +$tpl->display($layout); + Display::display_footer(); diff --git a/main/template/rainbow/auth/catalog_layout.php b/main/template/rainbow/auth/catalog_layout.php deleted file mode 100644 index 4b564cb660..0000000000 --- a/main/template/rainbow/auth/catalog_layout.php +++ /dev/null @@ -1,21 +0,0 @@ - - * @package chamilo.auth - */ - -if (api_get_setting('course_catalog_published') !== 'true') { - // Acces rights: anonymous users can't do anything usefull here. - api_block_anonymous_users(); -} - -// Header -Display::display_header(''); - -// Display -echo $content; - -// Footer -Display::display_footer(); diff --git a/main/template/rainbow/auth/categories_list.php b/main/template/rainbow/auth/categories_list.php deleted file mode 100755 index 79855a8f24..0000000000 --- a/main/template/rainbow/auth/categories_list.php +++ /dev/null @@ -1,32 +0,0 @@ - - Beeznest -* @package chamilo.auth -*/ - -// Acces rights: anonymous users can't do anything usefull here. -api_block_anonymous_users(); - -$stok = Security::get_token(); - -?> - -
- - - -
- -addHidden('sec_token', $stok); -$form->addText('title_course_category', get_lang('Name')); -$form->addButtonSave(get_lang('AddCategory'), 'create_course_category'); -$form->display(); diff --git a/main/template/rainbow/auth/courses_categories.php b/main/template/rainbow/auth/courses_categories.php deleted file mode 100755 index 2ca5f6c581..0000000000 --- a/main/template/rainbow/auth/courses_categories.php +++ /dev/null @@ -1,428 +0,0 @@ - - Beeznest - * @package chamilo.auth - */ - -if (isset($_REQUEST['action']) && Security::remove_XSS($_REQUEST['action']) !== 'subscribe') { - $stok = Security::get_token(); -} else { - $stok = $_SESSION['sec_token']; -} - -$showCourses = CoursesAndSessionsCatalog::showCourses(); -$showSessions = CoursesAndSessionsCatalog::showSessions(); -$pageCurrent = isset($pageCurrent) ? $pageCurrent : - isset($_GET['pageCurrent']) ? intval($_GET['pageCurrent']) : - 1; -$pageLength = isset($pageLength) ? $pageLength : - isset($_GET['pageLength']) ? intval($_GET['pageLength']) : - 10; -$pageTotal = intval(ceil(intval($countCoursesInCategory) / $pageLength)); -$cataloguePagination = $pageTotal > 1 ? - CourseCategory::getCatalogPagination($pageCurrent, $pageLength, $pageTotal) : - ''; -$search_term = isset($search_term) ? $search_term :null; - -if ($showSessions && isset($_POST['date'])) { - $date = $_POST['date']; -} else { - $date = date('Y-m-d'); -} - -$userInfo = api_get_user_info(); -$code = isset($code) ? $code : null; - -?> - - -
-
-
- -
- - -
- -
- -
-
-
- -
-
-
- '; - $form .= ''; - $form .= ''; - $form .= ''; - $form .= '
'; - $form .= '
'; - $form .= ''; - $form .= '
'; - $form .= ''; - echo $form; - ?> -
-
- -
-
- - - -
- -
- -
-
-".get_lang('SearchResultsFor')." ".Security::remove_XSS($_POST['search_term'])."
"; - } - $listCategory = CourseManager::getCategoriesList(); - - $ajax_url = api_get_path(WEB_AJAX_PATH).'course.ajax.php?a=add_course_vote'; - $user_id = api_get_user_id(); - - if (!empty($browse_courses_in_category)) { - foreach ($browse_courses_in_category as $course) { - $course_hidden = ($course['visibility'] == COURSE_VISIBILITY_HIDDEN); - - if ($course_hidden) { - continue; - } - - $user_registerd_in_course = CourseManager::is_user_subscribed_in_course($user_id, $course['code']); - $user_registerd_in_course_as_teacher = CourseManager::is_course_teacher($user_id, $course['code']); - $user_registerd_in_course_as_student = ($user_registerd_in_course && !$user_registerd_in_course_as_teacher); - $course_public = ($course['visibility'] == COURSE_VISIBILITY_OPEN_WORLD); - $course_open = ($course['visibility'] == COURSE_VISIBILITY_OPEN_PLATFORM); - $course_private = ($course['visibility'] == COURSE_VISIBILITY_REGISTERED); - $course_closed = ($course['visibility'] == COURSE_VISIBILITY_CLOSED); - - $course_subscribe_allowed = ($course['subscribe'] == 1); - $course_unsubscribe_allowed = ($course['unsubscribe'] == 1); - $count_connections = $course['count_connections']; - $creation_date = substr($course['creation_date'],0,10); - - $icon_title = null; - $html = null; - // display the course bloc - $html .= '
'; - - // display thumbnail - $html .= returnThumbnail($course, $listCategory[$course['category']]); - - // display course title and button bloc - $html .= '
'; - $html .= return_title($course); - // display button line - $html .= '
'; - $html .= '
'; - // if user registered as student - - $html .= return_description_button($course, $icon_title); - - if ($user_registerd_in_course_as_student) { - $html .= return_already_registered_label('student'); - - if (!$course_closed) { - if ($course_unsubscribe_allowed) { - $html .= return_unregister_button($course, $stok, $search_term, $code); - } - } - } elseif ($user_registerd_in_course_as_teacher) { - // if user registered as teacher - - - if ($course_unsubscribe_allowed) { - $html .= return_unregister_button($course, $stok, $search_term, $code); - } - $html .= return_already_registered_label('teacher'); - - } else { - // if user not registered in the course - if (!$course_closed) { - if (!$course_private) { - - if ($course_subscribe_allowed) { - $html .= return_register_button($course, $stok, $code, $search_term); - } - } - } - - } - $html .= '
'; - $html .= '
'; - $html .= '
'; - $html .= '
'; - $html .= '
'; - echo $html; - - } - } else { - if (!isset($_REQUEST['subscribe_user_with_password']) && - !isset($_REQUEST['subscribe_course']) - ) { - Display::display_warning_message(get_lang('ThereAreNoCoursesInThisCategory')); - } - } -} -?> -
-
-'; - $html .= ''.api_htmlentities($title).''; - if (!empty($categoryTitle)) { - $html .= ''. $categoryTitle.''; - $html .= '
'; - } - $teachers = CourseManager::getTeachersFromCourseByCode($course['code']); - $html .= '
'; - $html .= '
'; - $count = 0; - foreach ($teachers as $value) { - if ($count>2) { - break; - } - $name = $value['firstname'].' ' . $value['lastname']; - $html .= ' - '; - $html .= ''; - $count ++; - } - $html .= '
'; - - return $html; -} - - -/** - * Display the title of a course in course catalog - * @param $course - */ -function return_title($course) -{ - $html = ''; - $linkCourse = api_get_course_url($course['code']); - $title = cut($course['title'], 70); - $ajax_url = api_get_path(WEB_AJAX_PATH).'course.ajax.php?a=add_course_vote'; - $rating = Display::return_rating_system('star_'.$course['real_id'], $ajax_url.'&course_id='.$course['real_id'], $course['point_info']); - $html .= '

' . cut($title, 60) . '

'; - $html .= '
'. $rating . '
'; - - return $html; -} - -/** - * Display the description button of a course in the course catalog - * @param $course - * @param $icon_title - */ -function return_description_button($course, $icon_title) -{ - $title = $course['title']; - $html = ''; - if (api_get_setting('show_courses_descriptions_in_catalog') == 'true') { - $html = '' . - Display::returnFontAwesomeIcon('info-circle') . ''; - } - - return $html; -} - -/** - * Display the goto course button of a course in the course catalog - * @param $course - */ -function return_goto_button($course) -{ - $html = ' '. - Display::returnFontAwesomeIcon('share').''; - - return $html; -} - -/** - * Display the already registerd text in a course in the course catalog - * @param $in_status - */ -function return_already_registered_label($in_status) -{ - $icon = Display::return_icon('teacher.png', get_lang('Teacher'), null, ICON_SIZE_TINY); - if ($in_status == 'student') { - $icon = Display::return_icon('user.png', get_lang('Student'), null, ICON_SIZE_TINY); - } - $html = Display::tag( - 'button', - $icon, - array('id' => 'register', 'class' => 'btn btn-default btn-sm', 'title' => get_lang("AlreadyRegisteredToCourse")) - ); - - return $html; -} - -/** - * Display the register button of a course in the course catalog - * @param $course - * @param $stok - * @param $code - * @param $search_term - */ -function return_register_button($course, $stok, $code, $search_term) -{ - $html = ' ' . - Display::returnFontAwesomeIcon('sign-in') . ''; - return $html; -} - -/** - * Display the unregister button of a course in the course catalog - * @param $course - * @param $stok - * @param $search_term - * @param $code - */ -function return_unregister_button($course, $stok, $search_term, $code) -{ - $html = ' ' . - Display::returnFontAwesomeIcon('sign-out') . ''; - return $html; -} diff --git a/main/template/rainbow/auth/courses_list.php b/main/template/rainbow/auth/courses_list.php deleted file mode 100755 index 06c3f67228..0000000000 --- a/main/template/rainbow/auth/courses_list.php +++ /dev/null @@ -1,280 +0,0 @@ - - Beeznest -* @package chamilo.auth -*/ - -// Access rights: anonymous users can't do anything usefull here. -api_block_anonymous_users(); -$stok = Security::get_token(); -$courses_without_category = isset($courses_in_category[0]) ? $courses_in_category[0] : null; - -?> - - -
- - - -
- -'; - - if (isset($_GET['categoryid']) && $_GET['categoryid'] == $row['id']) { ?> - - -
- - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - "javascript: if (!confirm('".addslashes(api_htmlentities(get_lang("CourseCategoryAbout2bedeleted"), ENT_QUOTES, api_get_system_encoding()))."')) return false;"),22) ?> - -
'; - // Show the courses inside this category - echo ''; - - $number_of_courses = isset($courses_in_category[$row['id']]) ? count($courses_in_category[$row['id']]) : 0; - $key = 0; - if (!empty($courses_in_category[$row['id']])) { - foreach ($courses_in_category[$row['id']] as $course) { - ?> - - -
- -
- -
- - - -
- - - - -
- - -
- - - - - - - - - - - - - - - 0) { ?> - - - - - - - - - - - - - - - -
-
- - -
')) return false"> - - - -
-
- '; - } - } -} - -echo Display::page_subheader(get_lang('NoCourseCategory')); - -echo ''; -// COURSES WITHOUT CATEGORY -if (!empty($courses_without_category)) { - $number_of_courses = count($courses_without_category); - $key = 0; - - foreach ($courses_without_category as $course) { - echo ''; - ?> - - - - - -
- -
- -
- - - -
-
- - - - -

-
- - -
- - - - - - - - - - - - - - - - 0) { ?> - - - - - - - - -
-
- - - -
')) return false;"> - - - -
-
- -
diff --git a/main/template/rainbow/auth/inscription.tpl b/main/template/rainbow/auth/inscription.tpl index 92e6e5a3dc..78dc6e31ee 100644 --- a/main/template/rainbow/auth/inscription.tpl +++ b/main/template/rainbow/auth/inscription.tpl @@ -5,11 +5,10 @@ %} {% block content %} -
- {{ inscription_header }} - {{ inscription_content }} - {{ form }} - {{ text_after_registration }} -
+ +{{ inscription_header }} +{{ inscription_content }} +{{ form }} +{{ text_after_registration }} {% endblock %} diff --git a/main/template/rainbow/auth/layout.php b/main/template/rainbow/auth/layout.php deleted file mode 100755 index d703c0b705..0000000000 --- a/main/template/rainbow/auth/layout.php +++ /dev/null @@ -1,20 +0,0 @@ - - Beeznest -* @package chamilo.auth -*/ - -// Access rights: anonymous users can't do anything useful here. -api_block_anonymous_users(); - -// Header -Display::display_header(''); - -// Display -echo $content; - -// Footer -Display::display_footer(); diff --git a/main/template/rainbow/auth/lost_password.tpl b/main/template/rainbow/auth/lost_password.tpl index 8199816a74..b488299399 100644 --- a/main/template/rainbow/auth/lost_password.tpl +++ b/main/template/rainbow/auth/lost_password.tpl @@ -1,7 +1,5 @@ {% extends template ~ "/layout/layout_1_col.tpl" %} {% block content %} - {{ form }} - {% endblock %} diff --git a/main/template/rainbow/auth/readme.txt b/main/template/rainbow/auth/readme.txt new file mode 100644 index 0000000000..da52e70ae2 --- /dev/null +++ b/main/template/rainbow/auth/readme.txt @@ -0,0 +1,10 @@ +The following files were sent to the main/auth folder to improve the template option in this section + + +list files: + +-catalog_layout.php +-categories_list.php +-courses_categories.php +-courses-list.php +-layout.php \ No newline at end of file diff --git a/main/template/rainbow/auth/session_catalog.tpl b/main/template/rainbow/auth/session_catalog.tpl index 0945ee4e14..6b7748676d 100644 --- a/main/template/rainbow/auth/session_catalog.tpl +++ b/main/template/rainbow/auth/session_catalog.tpl @@ -1,4 +1,4 @@ -{% extends template ~ "/layout/main.tpl" %} +{% extends template ~ "/layout/page.tpl" %} {% block body %} - -
-
- {% if show_courses %} -
-
{{ 'Courses'|get_lang }}
- {% if not hidden_links %} -
+
+
+ +

{{ 'Sessions'|get_lang }}

+
+
+
+
-
- - -
- - - - -
+ +
+ + + +
- {% endif %} -
- {% endif %} - -
- {% if show_sessions %} -
{{ 'Sessions'|get_lang }}
- -
-
-
-
- -
-
- - - - -
-
-
-
-
-
-
-
- -
-
- - - - -
-
-
-
-
- {% endif %} +
+
+ +
+ + + + +
+
+
+
+ {% if show_courses %} + + {% endif %}
- -
-
+ +
+
- {% for session in sessions %} -
-
- - -
-

- - {{ session.name }} - -

-
    - {% if show_tutor %} -
  • - {{ session.coach_name }} + {% for item in sessions %} +
    +
    +
    + + + + {% if item.category != '' %} + {{ item.category }} +
    + {% endif %} +
    +
    + {% if item.edit_actions != '' %} + + + + {% endif %} + {% if item.is_subscribed %} + {{ already_subscribed_label }} + {% endif %} +
    +
    +
    +
    + + {% if show_tutor %} +
    +
    + + + +
    +
    + + {{ item.coach_name }} + +
    +

    {{ 'SessionGeneralCoach'|get_lang }}

    +
    +
    +
    + {% endif %} +
    +
      +
    • + + {{ item.nbr_courses ~ ' ' ~ 'Courses'|get_lang }}
    • - {% endif %} -
    • - {{ session.date }} -
    • - {% if session.tags %} -
    • - {{ session.tags|join(', ')}} +
    • + + {{ item.nbr_users ~ ' ' ~ 'NbUsers'|get_lang }}
    • - {% endif %} -
    - -
    - {% if not _u.logged %} -

    - {{ 'SeeCourseInformationAndRequirements'|get_lang }} -

    - {% else %} -

    - {{ 'SeeSequences'|get_lang }} -

    -

    - {% if session.is_subscribed %} - {{ already_subscribed_label }} - {% else %} - {{ session.subscribe_button }} +

+
+
+ {{ item.duration ? 'SessionDurationXDaysLeft'|get_lang|format(item.duration) : item.date }} +
+
+
+ {% if item.price %} + {{ item.price }} + {% endif %} +
+
+ {% if _u.logged %} +
+ {% if not item.sequences is empty %} + + + + {% endif %} + {% if item.is_subscribed == false %} + {{ item.subscribe_button }} {% endif %} -

- {% endif %} +
+ {% endif %} +
+
- {% if _u.logged %}