add layouts catalog in rainbow

pull/3063/head
Alex Aragon 9 years ago committed by Nicolas Ducoulombier
parent 21a75280e3
commit c64031c534
  1. 84
      app/SymfonyRequirements.php
  2. 657
      app/bootstrap.php.cache
  3. 1
      app/check.php
  4. 7
      main/exercise/overview.php
  5. 21
      main/template/rainbow/auth/catalog_layout.php
  6. 32
      main/template/rainbow/auth/categories_list.php
  7. 428
      main/template/rainbow/auth/courses_categories.php
  8. 280
      main/template/rainbow/auth/courses_list.php
  9. 11
      main/template/rainbow/auth/inscription.tpl
  10. 20
      main/template/rainbow/auth/layout.php
  11. 2
      main/template/rainbow/auth/lost_password.tpl
  12. 10
      main/template/rainbow/auth/readme.txt
  13. 243
      main/template/rainbow/auth/session_catalog.tpl
  14. 4
      main/template/rainbow/exercise/overview.tpl

@ -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 "<strong>%s</strong>", but Symfony needs at least PHP "<strong>%s</strong>" 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 <code>composer install</code> 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 "<strong>%s</strong>", but Symfony needs at least PHP "<strong>%s</strong>" 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 <strong>mbstring</strong> extension.'
);
$this->addRecommendation(
function_exists('iconv'),
'iconv() should be available',
'Install and enable the <strong>iconv</strong> 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 "<strong>realpath_cache_size</strong>" to e.g. "<strong>1024</strong>" in php.ini<a href="#phpini">*</a> to improve performance on windows.'
$this->getRealpathCacheSize() >= 5 * 1024 * 1024,
'realpath_cache_size should be at least 5M in php.ini',
'Setting "<strong>realpath_cache_size</strong>" to e.g. "<strong>5242880</strong>" or "<strong>5M</strong>" in php.ini<a href="#phpini">*</a> 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;
}
}

@ -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('<?php return %s;', var_export($classes, true)));
}
public function getStartTime()
{
return $this->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);
}
}
}

@ -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;

@ -67,7 +67,8 @@ if ($origin != 'learnpath') {
";
Display::display_reduced_header();
}
$tpl = new Template('Overview');
$list = array();
$html = '';
$message = '';
$html .= '<div class="exercise">';
@ -337,4 +338,8 @@ $html .= Display::tag(
$html .= '</div>';
echo $html;
$tpl->assign('data',$list);
$layout = $tpl->get_template('exercise/overview.tpl');
$tpl->display($layout);
Display::display_footer();

@ -1,21 +0,0 @@
<?php
/* For licensing terms, see /license.txt */
/**
* Layout (principal view) used for structuring course/session catalog
* @author Angel Fernando Quiroz Campos <angel.quiroz@beeznest.com>
* @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();

@ -1,32 +0,0 @@
<?php
/* For licensing terms, see /license.txt */
/**
* View (MVC patter) for creating course category
* @author Christian Fasanando <christian1827@gmail.com> - Beeznest
* @package chamilo.auth
*/
// Acces rights: anonymous users can't do anything usefull here.
api_block_anonymous_users();
$stok = Security::get_token();
?>
<!-- Actions: The menu with the different options in cathe course management -->
<div id="actions" class="actions">
<a href="<?php echo api_get_self() ?>?action=sortmycourses">
<?php echo Display::return_icon('back.png', get_lang('Back'),'','32'); ?>
</a>
</div>
<?php
$form = new FormValidator(
'create_course_category',
'post',
api_get_self().'?createcoursecategory'
);
$form->addHidden('sec_token', $stok);
$form->addText('title_course_category', get_lang('Name'));
$form->addButtonSave(get_lang('AddCategory'), 'create_course_category');
$form->display();

@ -1,428 +0,0 @@
<?php
/* For licensing terms, see /license.txt */
/**
* View (MVC patter) for courses categories
* @author Christian Fasanando <christian1827@gmail.com> - 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;
?>
<script>
$(document).ready( function() {
$('.star-rating li a').on('click', function(event) {
var id = $(this).parents('ul').attr('id');
$('#vote_label2_' + id).html("<?php echo get_lang('Loading'); ?>");
$.ajax({
url: $(this).attr('data-link'),
success: function(data) {
$("#rating_wrapper_"+id).html(data);
if(data == 'added') {
//$('#vote_label2_' + id).html("{'Saved'|get_lang}");
}
if(data == 'updated') {
//$('#vote_label2_' + id).html("{'Saved'|get_lang}");
}
}
});
});
/*$('.courses-list-btn').toggle(function (e) {
e.preventDefault();
var $el = $(this);
var sessionId = getSessionId(this);
$el.children('img').remove();
$el.prepend('<?php echo Display::display_icon('nolines_minus.gif'); ?>');
$.ajax({
url: '<?php echo api_get_path(WEB_AJAX_PATH) . 'course.ajax.php' ?>',
type: 'GET',
dataType: 'json',
data: {
a: 'display_sessions_courses',
session: sessionId
},
success: function (response){
var $container = $el.prev('.course-list');
var $courseList = $('<ul>');
$.each(response, function (index, course) {
$courseList.append('<li><div><strong>' + course.name + '</strong><br>' + course.coachName + '</div></li>');
});
$container.append($courseList).show(250);
}
});
}, function (e) {
e.preventDefault();
var $el = $(this);
var $container = $el.prev('.course-list');
$container.hide(250).empty();
$el.children('img').remove();
$el.prepend('<?php echo Display::display_icon('nolines_plus.gif'); ?>');
});*/
var getSessionId = function (el) {
var parts = el.id.split('_');
return parseInt(parts[1], 10);
};
<?php if ($showSessions) { ?>
$('#date').datepicker({
dateFormat: 'yy-mm-dd'
});
<?php } ?>
});
</script>
<div class="row">
<div class="col-md-4">
<h5><?php echo get_lang('Search'); ?></h5>
<?php
if ($showCourses) {
if (!isset($_GET['hidden_links']) || intval($_GET['hidden_links']) != 1) { ?>
<form class="form-horizontal" method="post" action="<?php echo CourseCategory::getCourseCategoryUrl(1, $pageLength, 'ALL', 0, 'subscribe'); ?>">
<input type="hidden" name="sec_token" value="<?php echo $stok; ?>">
<input type="hidden" name="search_course" value="1" />
<div class="input-group">
<input class="form-control" type="text" name="search_term" value="<?php echo (empty($_POST['search_term']) ? '' : api_htmlentities(Security::remove_XSS($_POST['search_term']))); ?>" />
<div class="input-group-btn">
<button class="btn btn-default" type="submit">
<em class="fa fa-search"></em> <?php echo get_lang('Search'); ?>
</button>
</div>
</div>
</form>
<?php } ?>
</div>
<div class="col-md-4">
<h5><?php echo get_lang('CourseCategories'); ?></h5>
<?php
$webAction = api_get_path(WEB_CODE_PATH).'auth/courses.php';
$action = (!empty($_REQUEST['action'])?Security::remove_XSS($_REQUEST['action']):'display_courses');
$pageLength = (!empty($_REQUEST['pageLength'])?intval($_REQUEST['pageLength']):10);
$pageCurrent = (!empty($_REQUEST['pageCurrent'])?intval($_REQUEST['pageCurrent']):1);
$form = '<form action="'.$webAction.'" method="GET" class="form-horizontal">';
$form .= '<input type="hidden" name="action" value="' . $action . '">';
$form .= '<input type="hidden" name="pageCurrent" value="' . $pageCurrent . '">';
$form .= '<input type="hidden" name="pageLength" value="' . $pageLength . '">';
$form .= '<div class="form-group">';
$form .= '<div class="col-sm-12">';
$form .= '<select name="category_code" onchange="submit();" class="selectpicker show-tick form-control">';
$codeType = isset($_REQUEST['category_code']) ? Security::remove_XSS($_REQUEST['category_code']) : '';
foreach ($browse_course_categories[0] as $category) {
$categoryCode = $category['code'];
$countCourse = $category['count_courses'];
$form .= '<option '. ($categoryCode == $codeType? 'selected="selected" ':'') .' value="' . $category['code'] . '">' . $category['name'] . ' ( '. $countCourse .' ) </option>';
if (!empty($browse_course_categories[$categoryCode])) {
foreach ($browse_course_categories[$categoryCode] as $subCategory){
$subCategoryCode = $subCategory['code'];
$form .= '<option '. ($subCategoryCode == $codeType ? 'selected="selected" ':'') .' value="' . $subCategory['code'] . '"> ---' . $subCategory['name'] . ' ( '. $subCategory['count_courses'] .' ) </option>';
}
}
}
$form .= '</select>';
$form .= '</div>';
$form .= '</form>';
echo $form;
?>
</div>
</div>
<?php
if ($showSessions) { ?>
<div class="col-md-4">
<h5><?php echo get_lang('Sessions'); ?></h5>
<a class="btn btn-default btn-block" href="<?php echo CourseCategory::getCourseCategoryUrl(1, $pageLength, null, 0, 'display_sessions'); ?>">
<?php echo get_lang('SessionList'); ?>
</a>
</div>
<?php } ?>
</div>
<?php } ?>
<div class="grid-courses">
<div class="row">
<?php
if ($showCourses && $action != 'display_sessions') {
if (!empty($message)) {
Display::display_confirmation_message($message, false);
}
if (!empty($error)) {
Display::display_error_message($error, false);
}
if (!empty($content)) {
echo $content;
}
if (!empty($search_term)) {
echo "<p><strong>".get_lang('SearchResultsFor')." ".Security::remove_XSS($_POST['search_term'])."</strong><br />";
}
$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 .= '<div class="col-xs-6 col-sm-6 col-md-3"><div class="items">';
// display thumbnail
$html .= returnThumbnail($course, $listCategory[$course['category']]);
// display course title and button bloc
$html .= '<div class="description">';
$html .= return_title($course);
// display button line
$html .= '<div class="toolbar">';
$html .= '<div class="btn-group">';
// 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 .= '</div>';
$html .= '</div>';
$html .= '</div>';
$html .= '</div>';
$html .= '</div>';
echo $html;
}
} else {
if (!isset($_REQUEST['subscribe_user_with_password']) &&
!isset($_REQUEST['subscribe_course'])
) {
Display::display_warning_message(get_lang('ThereAreNoCoursesInThisCategory'));
}
}
}
?>
</div>
</div>
<?php
echo $cataloguePagination;
/**
* Display the course catalog image of a course
* @param array $course
* @param string $categoryTitle
* @return string HTML string
*/
function returnThumbnail($course, $categoryTitle=null)
{
$html = '';
$title = cut($course['title'], 70);
// course path
$course_path = api_get_path(SYS_COURSE_PATH).$course['directory'];
if (file_exists($course_path.'/course-pic.png')) {
$course_medium_image = api_get_path(WEB_COURSE_PATH).$course['directory'].'/course-pic.png'; // redimensioned image 85x85
} else {
// without picture
$course_medium_image = Display::returnIconPath('session_default.png');
}
$html .= '<div class="image">';
$html .= '<img class="img-responsive" src="'.$course_medium_image.'" alt="'.api_htmlentities($title).'"/>';
if (!empty($categoryTitle)) {
$html .= '<span class="category">'. $categoryTitle.'</span>';
$html .= '<div class="cribbon"></div>';
}
$teachers = CourseManager::getTeachersFromCourseByCode($course['code']);
$html .= '<div class="black-shadow">';
$html .= '<div class="author-card">';
$count = 0;
foreach ($teachers as $value) {
if ($count>2) {
break;
}
$name = $value['firstname'].' ' . $value['lastname'];
$html .= '<a href="'.$value['url'].'" class="ajax" data-title="'.$name.'">
<img src="'.$value['avatar'].'"/></a>';
$html .= '<div class="teachers-details"><h5>
<a href="'.$value['url'].'" class="ajax" data-title="'.$name.'">'
. $name . '</a></h5></div>';
$count ++;
}
$html .= '</div></div></div>';
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 .= '<h4 class="title"><a href="' . $linkCourse . '">' . cut($title, 60) . '</a></h4>';
$html .= '<div class="ranking">'. $rating . '</div>';
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 = '<a data-title="' . $title . '" class="ajax btn btn-default btn-sm" href="'.api_get_path(WEB_CODE_PATH).'inc/ajax/course_home.ajax.php?a=show_course_information&code='.$course['code'].'" title="' . get_lang('Description') . '">' .
Display::returnFontAwesomeIcon('info-circle') . '</a>';
}
return $html;
}
/**
* Display the goto course button of a course in the course catalog
* @param $course
*/
function return_goto_button($course)
{
$html = ' <a class="btn btn-default btn-sm" title="' . get_lang('GoToCourse') . '" href="'.api_get_course_url($course['code']).'">'.
Display::returnFontAwesomeIcon('share').'</a>';
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 = ' <a class="btn btn-success btn-sm" title="' . get_lang('Subscribe') . '" href="'.api_get_self().'?action=subscribe_course&sec_token='.$stok.'&subscribe_course='.$course['code'].'&search_term='.$search_term.'&category_code='.$code.'">' .
Display::returnFontAwesomeIcon('sign-in') . '</a>';
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 = ' <a class="btn btn-danger btn-sm" title="' . get_lang('Unsubscribe') . '" href="'. api_get_self().'?action=unsubscribe&sec_token='.$stok.'&unsubscribe='.$course['code'].'&search_term='.$search_term.'&category_code='.$code.'">' .
Display::returnFontAwesomeIcon('sign-out') . '</a>';
return $html;
}

@ -1,280 +0,0 @@
<?php
/* For licensing terms, see /license.txt */
/**
* View (MVC patter) for courses
* @author Christian Fasanando <christian1827@gmail.com> - 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;
?>
<!-- Actions: The menu with the different options in cathe course management -->
<div id="actions" class="actions">
<?php if ($action != 'createcoursecategory') { ?>
<a href="<?php echo api_get_self(); ?>?action=createcoursecategory"><?php echo Display::return_icon('new_folder.png', get_lang('CreateCourseCategory'),'','32'); ?></a>
<?php } ?>
</div>
<?php
if (!empty($message)) {
Display::display_confirmation_message($message, false);
}
// COURSES WITH CATEGORIES
if (!empty($user_course_categories)) {
foreach ($user_course_categories as $row) {
echo Display::page_subheader($row['title']);
echo '<a name="category'.$row['id'].'"></a>';
if (isset($_GET['categoryid']) && $_GET['categoryid'] == $row['id']) { ?>
<!-- We display the edit form for the category -->
<form name="edit_course_category" method="post" action="courses.php?action=<?php echo $action; ?>">
<input type="hidden" name="edit_course_category" value="<?php echo $row['id']; ?>" />
<input type="hidden" name="sec_token" value="<?php echo $stok; ?>">
<input type="text" name="title_course_category" value="<?php echo $row['title']; ?>" />
<button class="save" type="submit" name="submit_edit_course_category"><?php echo get_lang('Ok'); ?></button>
</form>
<?php } ?>
<!-- display category icons -->
<?php
$max_category_key = count($user_course_categories);
if ($action != 'unsubscribe') { ?>
<a href="courses.php?action=sortmycourses&amp;categoryid=<?php echo $row['id']; ?>&amp;sec_token=<?php echo $stok; ?>#category<?php echo $row['id']; ?>">
<?php echo Display::display_icon('edit.png', get_lang('Edit'),'',22); ?>
</a>
<?php if ($row['id'] != $user_course_categories[0]['id']) { ?>
<a href="courses.php?action=<?php echo $action ?>&amp;move=up&amp;category=<?php echo $row['id']; ?>&amp;sec_token=<?php echo $stok; ?>">
<?php echo Display::return_icon('up.png', get_lang('Up'),'',22); ?>
</a>
<?php } else { ?>
<?php echo Display::return_icon('up_na.png', get_lang('Up'),'',22); ?>
<?php } ?>
<?php if ($row['id'] != $user_course_categories[$max_category_key - 1]['id']) { ?>
<a href="courses.php?action=<?php echo $action; ?>&amp;move=down&amp;category=<?php echo $row['id']; ?>&amp;sec_token=<?php echo $stok; ?>">
<?php echo Display::return_icon('down.png', get_lang('Down'),'',22); ?>
</a>
<?php } else { ?>
<?php echo Display::return_icon('down_na.png', get_lang('Down'),'',22); ?>
<?php } ?>
<a href="courses.php?action=deletecoursecategory&amp;id=<?php echo $row['id']; ?>&amp;sec_token=<?php echo $stok; ?>">
<?php echo Display::display_icon('delete.png', get_lang('Delete'), array('onclick' => "javascript: if (!confirm('".addslashes(api_htmlentities(get_lang("CourseCategoryAbout2bedeleted"), ENT_QUOTES, api_get_system_encoding()))."')) return false;"),22) ?>
</a>
<?php }
echo '<br /><br />';
// Show the courses inside this category
echo '<table class="data_table">';
$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) {
?>
<tr>
<td>
<a name="course<?php echo $course['code']; ?>"></a>
<strong><?php echo $course['title']; ?></strong><br />
<?php
if (api_get_setting('display_coursecode_in_courselist') === 'true') {
echo $course['visual_code'];
}
if (api_get_setting('display_coursecode_in_courselist') === 'true' &&
api_get_setting('display_teacher_in_courselist') === 'true'
) {
echo " - ";
}
if (api_get_setting('display_teacher_in_courselist') === 'true') {
echo $course['tutor'];
}
?>
</td>
<td valign="top">
<!-- edit -->
<?php
if (isset($_GET['edit']) && $course['code'] == $_GET['edit']) {
$edit_course = Security::remove_XSS($_GET['edit']); ?>
<form name="edit_course_category" method="post" action="courses.php?action=<?php echo $action; ?>">
<input type="hidden" name="sec_token" value="<?php echo $stok; ?>">
<input type="hidden" name="course_2_edit_category" value="<?php echo $edit_course; ?>" />
<select name="course_categories">
<option value="0"><?php echo get_lang("NoCourseCategory"); ?></option>
<?php foreach ($user_course_categories as $row) { ?>
<option value="<?php echo $row['id'] ?>"><?php echo $row['title']; ?></option>
<?php } ?>
</select>
<button class="save" type="submit" name="submit_change_course_category"><?php echo get_lang('Ok'); ?></button>
</form>
<?php } ?>
<div style="float:left;width:110px;">
<?php
if (api_get_setting('show_courses_descriptions_in_catalog') == 'true') {
$icon_title = get_lang('CourseDetails') . ' - ' . $course['title'];
?>
<a href="<?php echo api_get_path(WEB_CODE_PATH); ?>inc/ajax/course_home.ajax.php?a=show_course_information&code=<?php echo $course['code'] ?>" data-title="<?php echo $icon_title ?>" title="<?php echo $icon_title ?>" class="ajax">
<?php echo Display::return_icon('info.png', $icon_title,'','22') ?>
<?php } ?>
</a>
<?php if (isset($_GET['edit']) && $course['code'] == $_GET['edit']) { ?>
<?php echo Display::display_icon('edit_na.png', get_lang('Edit'),'',22); ?>
<?php } else { ?>
<a href="courses.php?action=<?php echo $action; ?>&amp;edit=<?php echo $course['code']; ?>&amp;sec_token=<?php echo $stok; ?>">
<?php echo Display::display_icon('edit.png', get_lang('Edit'),'',22); ?>
</a>
<?php } ?>
<?php if ($key > 0) { ?>
<a href="courses.php?action=<?php echo $action; ?>&amp;move=up&amp;course=<?php echo $course['code']; ?>&amp;category=<?php echo $course['user_course_cat']; ?>&amp;sec_token=<?php echo $stok; ?>">
<?php echo Display::display_icon('up.png', get_lang('Up'),'',22); ?>
</a>
<?php } else { ?>
<?php echo Display::display_icon('up_na.png', get_lang('Up'),'',22); ?>
<?php } ?>
<?php if ($key < $number_of_courses - 1) { ?>
<a href="courses.php?action=<?php echo $action; ?>&amp;move=down&amp;course=<?php echo $course['code']; ?>&amp;category=<?php echo $course['user_course_cat']; ?>&amp;sec_token=<?php echo $stok; ?>">
<?php echo Display::display_icon('down.png', get_lang('Down'),'',22); ?>
</a>
<?php } else { ?>
<?php echo Display::display_icon('down_na.png', get_lang('Down'),'',22); ?>
<?php } ?>
</div>
<div style="float:left; margin-right:10px;">
<?php if ($course['status'] != 1) {
if ($course['unsubscr'] == 1) {
?>
<form action="<?php echo api_get_self(); ?>" method="post" onsubmit="javascript: if (!confirm('<?php echo addslashes(api_htmlentities(get_lang("ConfirmUnsubscribeFromCourse"), ENT_QUOTES, api_get_system_encoding()))?>')) return false">
<input type="hidden" name="sec_token" value="<?php echo $stok; ?>">
<input type="hidden" name="unsubscribe" value="<?php echo $course['code']; ?>" />
<button class="btn btn-default" value="<?php echo get_lang('Unsubscribe'); ?>" name="unsub">
<?php echo get_lang('Unsubscribe'); ?>
</button>
</form>
</div>
<?php }
}
$key++;
}
echo '</table>';
}
}
}
echo Display::page_subheader(get_lang('NoCourseCategory'));
echo '<table class="data_table">';
// COURSES WITHOUT CATEGORY
if (!empty($courses_without_category)) {
$number_of_courses = count($courses_without_category);
$key = 0;
foreach ($courses_without_category as $course) {
echo '<tr>';
?>
<td>
<a name="course<?php echo $course['code']; ?>"></a>
<strong><?php echo $course['title']; ?></strong><br />
<?php
if (api_get_setting('display_coursecode_in_courselist') === 'true') { echo $course['visual_code']; }
if (api_get_setting('display_coursecode_in_courselist') === 'true' && api_get_setting('display_teacher_in_courselist') === 'true') { echo " - "; }
if (api_get_setting('display_teacher_in_courselist') === 'true') { echo $course['tutor']; }
?>
</td>
<td valign="top">
<!-- the edit icon OR the edit dropdown list -->
<?php if (isset($_GET['edit']) && $course['code'] == $_GET['edit']) {
$edit_course = Security::remove_XSS($_GET['edit']);
?>
<div style="float:left;">
<form name="edit_course_category" method="post" action="courses.php?action=<?php echo $action; ?>">
<input type="hidden" name="sec_token" value="<?php echo $stok; ?>">
<input type="hidden" name="course_2_edit_category" value="<?php echo $edit_course; ?>" />
<select name="course_categories">
<option value="0"><?php echo get_lang("NoCourseCategory"); ?></option>
<?php foreach ($user_course_categories as $row) { ?>
<option value="<?php echo $row['id']; ?>"><?php echo $row['title']; ?></option>
<?php } ?>
</select>
<button class="save" type="submit" name="submit_change_course_category"><?php echo get_lang('Ok') ?></button>
</form><br />
</div>
<?php } ?>
<div style="float:left; width:110px">
<?php
if (api_get_setting('show_courses_descriptions_in_catalog') == 'true') {
$icon_title = get_lang('CourseDetails') . ' - ' . $course['title'];
?>
<a href="<?php echo api_get_path(WEB_CODE_PATH); ?>inc/ajax/course_home.ajax.php?a=show_course_information&code=<?php echo $course['code'] ?>" data-title="<?php echo $icon_title ?>" title="<?php echo $icon_title ?>" class="ajax">
<?php echo Display::return_icon('info.png', $icon_title, '','22'); ?>
</a>
<?php } ?>
<?php if (isset($_GET['edit']) && $course['code'] == $_GET['edit']) { ?>
<?php echo Display::display_icon('edit_na.png', get_lang('Edit'),'',22); ?>
<?php } else { ?>
<a href="courses.php?action=<?php echo $action; ?>&amp;edit=<?php echo $course['code']; ?>&amp;sec_token=<?php echo $stok; ?>">
<?php echo Display::display_icon('edit.png', get_lang('Edit'),'',22); ?>
</a>
<?php } ?>
<!-- up /down icons-->
<?php if ($key > 0) { ?>
<a href="courses.php?action=<?php echo $action; ?>&amp;move=up&amp;course=<?php echo $course['code']; ?>&amp;category=<?php echo $course['user_course_cat']; ?>&amp;sec_token=<?php echo $stok; ?>">
<?php echo Display::display_icon('up.png', get_lang('Up'),'',22) ?>
</a>
<?php } else {
echo Display::display_icon('up_na.png', get_lang('Up'),'',22);
}
if ($key < $number_of_courses - 1) { ?>
<a href="courses.php?action=<?php echo $action; ?>&amp;move=down&amp;course=<?php echo $course['code']; ?>&amp;category=<?php echo $course['user_course_cat']; ?>&amp;sec_token=<?php echo $stok; ?>">
<?php echo Display::display_icon('down.png', get_lang('Down'),'',22); ?>
</a>
<?php } else {
echo Display::display_icon('down_na.png', get_lang('Down'),'',22);
}?>
</div>
<div style="float:left; margin-right:10px;">
<!-- cancel subscrioption-->
<?php if ($course['status'] != 1) {
if ($course['unsubscr'] == 1) {
?>
<!-- changed link to submit to avoid action by the search tool indexer -->
<form action="<?php echo api_get_self(); ?>" method="post" onsubmit="javascript: if (!confirm('<?php echo addslashes(api_htmlentities(get_lang("ConfirmUnsubscribeFromCourse"), ENT_QUOTES, api_get_system_encoding())) ?>')) return false;">
<input type="hidden" name="sec_token" value="<?php echo $stok; ?>">
<input type="hidden" name="unsubscribe" value="<?php echo $course['code']; ?>" />
<button class="btn btn-default" value="<?php echo get_lang('Unsubscribe'); ?>" name="unsub">
<?php echo get_lang('Unsubscribe'); ?>
</button>
</form>
</div>
<?php }
}
?>
</td>
</tr>
<?php
$key++;
}
}
?>
</table>

@ -5,11 +5,10 @@
%}
{% block content %}
<div class="page-inscription">
{{ inscription_header }}
{{ inscription_content }}
{{ form }}
{{ text_after_registration }}
</div>
{{ inscription_header }}
{{ inscription_content }}
{{ form }}
{{ text_after_registration }}
{% endblock %}

@ -1,20 +0,0 @@
<?php
/* For licensing terms, see /license.txt */
/**
* Layout (principal view) used for structuring other views
* @author Christian Fasanando <christian1827@gmail.com> - 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();

@ -1,7 +1,5 @@
{% extends template ~ "/layout/layout_1_col.tpl" %}
{% block content %}
{{ form }}
{% endblock %}

@ -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

@ -1,4 +1,4 @@
{% extends template ~ "/layout/main.tpl" %}
{% extends template ~ "/layout/page.tpl" %}
{% block body %}
<script type="text/javascript">
@ -8,133 +8,157 @@
});
});
</script>
<div class="col-md-12">
<div class="row">
{% if show_courses %}
<div class="col-md-4">
<div class="section-title-catalog">{{ 'Courses'|get_lang }}</div>
{% if not hidden_links %}
<form class="form-horizontal" method="post" action="{{ course_url }}">
<div class="row">
<div class="col-md-12">
<!-- header catalog session -->
<h2 class="title-session">{{ 'Sessions'|get_lang }}</h2>
<div class="search-session">
<div class="row">
<div class="col-md-6">
<form method="post" action="{{ _p.web_self }}?action=display_sessions">
<div class="form-group">
<div class="col-sm-12">
<input type="hidden" name="sec_token" value="{{ search_token }}">
<input type="hidden" name="search_course" value="1" />
<div class="input-group">
<input type="text" name="search_term" class="form-control" />
<span class="input-group-btn">
<button class="btn btn-default" type="submit"><em class="fa fa-search"></em> {{ 'Search'|get_lang }}</button>
</span>
</div>
<label>{{ "ByDate"|get_lang }}</label>
<div class="input-group">
<input type="date" name="date" id="date" title="{{ 'Date'|get_lang }}"
class="form-control" value="{{ search_date }}" readonly>
<span class="input-group-btn">
<button class="btn btn-default" type="submit">
<em class="fa fa-search"></em> {{ 'Search'|get_lang }}
</button>
</span>
</div>
</div>
</form>
{% endif %}
</div>
{% endif %}
<div class="col-md-8">
{% if show_sessions %}
<div class="section-title-catalog">{{ 'Sessions'|get_lang }}</div>
<div class="row">
<div class="col-md-6">
<form class="form-horizontal" method="post" action="{{ _p.web_self }}?action=display_sessions">
<div class="form-group">
<label class="col-sm-3">{{ "ByDate"|get_lang }}</label>
<div class="col-sm-9">
<div class="input-group">
<input type="date" name="date" id="date" class="form-control" value="{{ search_date }}" readonly>
<span class="input-group-btn">
<button class="btn btn-default" type="submit"><em class="fa fa-search"></em> {{ 'Search'|get_lang }}</button>
</span>
</div>
</div>
</div>
</form>
</div>
<div class="col-md-6">
<form class="form-horizontal" method="post" action="{{ _p.web_self }}?action=search_tag">
<div class="form-group">
<label class="col-sm-4">{{ "ByTag"|get_lang }}</label>
<div class="col-sm-8">
<div class="input-group">
<input type="text" name="search_tag" class="form-control" value="{{ search_tag }}" />
<span class="input-group-btn">
<button class="btn btn-default" type="submit"><em class="fa fa-search"></em> {{ 'Search'|get_lang }}</button>
</span>
</div>
</div>
</div>
</form>
</div>
</div>
{% endif %}
<div class="col-md-6">
<form method="post" action="{{ _p.web_self }}?action=search_tag">
<label>{{ "ByTag"|get_lang }}</label>
<div class="input-group">
<input type="text" name="search_tag" title="{{ 'ByTag'|get_lang }}" class="form-control"
value="{{ search_tag }}"/>
<span class="input-group-btn">
<button class="btn btn-default" type="submit">
<em class="fa fa-search"></em> {{ 'Search'|get_lang }}
</button>
</span>
</div>
</form>
</div>
</div>
</div>
{% if show_courses %}
<div class="return-catalog">
<a class="btn btn-default btn-lg btn-block" href="{{ _p.web_self }}">
<em class="fa fa-arrow-left"></em> {{ "CourseManagement"|get_lang }}
</a>
</div>
{% endif %}
</div>
</div>
<section id="session-list">
<div class="col-md-12">
<!-- new view session grib -->
<div class="row">
<div class="grid-courses col-md-12">
<div class="row">
{% for session in sessions %}
<div class="col-xs-6 col-sm-6 col-md-3 session-col">
<div class="item" id="session-{{ session.id }}">
<img src="{{ session.image ? _p.web_upload ~ session.image : _p.web_img ~ 'session_default.png' }}">
<div class="information-item">
<h3 class="title-session">
<a href="{{ _p.web ~ 'session/' ~ session.id ~ '/about/' }}" title="{{ session.name }}">
{{ session.name }}
</a>
</h3>
<ul class="list-unstyled">
{% if show_tutor %}
<li class="author-session">
<em class="fa fa-user"></em> {{ session.coach_name }}
{% for item in sessions %}
<div class="col-md-4 col-sm-6 col-xs-12">
<div id="session-{{ item.id }}" class="items items-courses">
<div class="image">
<a href="{{ _p.web ~ 'session/' ~ item.id ~ '/about/' }}" title="{{ item.name }}">
<img class="img-responsive" src="{{ item.image ? _p.web_upload ~ item.image : 'session_default.png'|icon() }}">
</a>
{% if item.category != '' %}
<span class="category">{{ item.category }}</span>
<div class="cribbon"></div>
{% endif %}
<div class="admin-actions">
<div class="btn-group" role="group">
{% if item.edit_actions != '' %}
<a class="btn btn-default btn-sm" href="{{ item.edit_actions }}">
<i class="fa fa-pencil" aria-hidden="true"></i>
</a>
{% endif %}
{% if item.is_subscribed %}
{{ already_subscribed_label }}
{% endif %}
</div>
</div>
</div>
<div class="description">
<div class="block-title">
<h4 class="title">
<a href="{{ _p.web ~ 'session/' ~ item.id ~ '/about/' }}" title="{{ item.name }}">
{{ item.name }}
</a>
</h4>
</div>
{% if show_tutor %}
<div class="block-author">
<div class="author-card">
<a href="{{ item.coach_url }}" class="ajax" data-title="{{ item.coach_name }}">
<img src="{{ item.coach_avatar }}"/>
</a>
<div class="teachers-details">
<h5>
<a href="{{ item.coach_url }}" class="ajax" data-title="{{ item.coach_name }}">
{{ item.coach_name }}
</a>
</h5>
<p>{{ 'SessionGeneralCoach'|get_lang }}</p>
</div>
</div>
</div>
{% endif %}
<div class="block-info">
<ul class="info list-inline">
<li>
<i class="fa fa-book" aria-hidden="true"></i>
{{ item.nbr_courses ~ ' ' ~ 'Courses'|get_lang }}
</li>
{% endif %}
<li class="date-session">
<em class="fa fa-calendar-o"></em> {{ session.date }}
</li>
{% if session.tags %}
<li class="tags-session">
<em class="fa fa-tags"></em> {{ session.tags|join(', ')}}
<li>
<i class="fa fa-user" aria-hidden="true"></i>
{{ item.nbr_users ~ ' ' ~ 'NbUsers'|get_lang }}
</li>
{% endif %}
</ul>
<div class="options">
{% if not _u.logged %}
<p>
<a class="btn btn-info btn-block btn-sm" href="{{ "#{_p.web}session/#{session.id}/about/" }}" title="{{ session.name }}">{{ 'SeeCourseInformationAndRequirements'|get_lang }}</a>
</p>
{% else %}
<p>
<a class="btn btn-info btn-block btn-sm" role="button" data-toggle="popover" id="session-{{ session.id }}-sequences">{{ 'SeeSequences'|get_lang }}</a>
</p>
<p class="buttom-subscribed">
{% if session.is_subscribed %}
{{ already_subscribed_label }}
{% else %}
{{ session.subscribe_button }}
</ul>
</div>
<div class="block-date">
{{ item.duration ? 'SessionDurationXDaysLeft'|get_lang|format(item.duration) : item.date }}
</div>
<div class="toolbar">
<div class="left">
{% if item.price %}
{{ item.price }}
{% endif %}
</div>
<div class="right">
{% if _u.logged %}
<div class="btn-group btn-group-sm" role="group">
{% if not item.sequences is empty %}
<a class="btn btn-default btn-sm" role="button"
title="{{ 'SeeSequences'|get_lang }}" data-toggle="popover"
id="session-{{ item.id }}-sequences">
<i class="fa fa-sitemap" aria-hidden="true"></i>
</a>
{% endif %}
{% if item.is_subscribed == false %}
{{ item.subscribe_button }}
{% endif %}
</p>
{% endif %}
</div>
{% endif %}
</div>
</div>
</div>
{% if _u.logged %}
<script>
$('#session-{{ session.id }}-sequences').popover({
$('#session-{{ item.id }}-sequences').popover({
placement: 'bottom',
html: true,
trigger: 'click',
content: function () {
var content = '';
{% if session.sequences %}
{% for sequence in session.sequences %}
{% if item.sequences %}
{% for sequence in item.sequences %}
content += '<p class="lead">{{ sequence.name }}</p>';
{% if sequence.requirements %}
@ -163,7 +187,7 @@
content += '</ul>';
{% endif %}
{% if session.sequences|length > 1 %}
{% if item.sequences|length > 1 %}
content += '<hr>';
{% endif %}
{% endfor %}
@ -187,8 +211,7 @@
{% endfor %}
</div>
</div>
</section>
</div>
<!-- end view session grib -->
{{ catalog_pagination }}
{% endblock %}

@ -0,0 +1,4 @@
<div>
{{ dump(data) }}
</div>
Loading…
Cancel
Save