Minor - update templates,

pull/2487/head
jmontoyaa 7 years ago
parent 83b6259924
commit f00567904b
  1. 88
      main/inc/global.inc.php
  2. 10
      main/inc/lib/database.lib.php
  3. 1
      main/inc/lib/display.lib.php
  4. 14
      main/inc/lib/template.lib.php
  5. 14
      main/template/default/layout/head.tpl
  6. 2
      main/template/default/layout/hot_course_item.tpl
  7. 6
      main/template/default/layout/hot_course_item_popup.tpl
  8. 3
      main/template/default/layout/hot_courses.tpl
  9. 2
      main/template/default/layout/menu.tpl
  10. 2
      main/template/default/user_portal/grid_session.tpl
  11. 3
      src/ThemeBundle/Resources/views/Layout/base-layout.html.twig

@ -14,49 +14,63 @@ use Chamilo\CoreBundle\Framework\Container;
* *
* @package chamilo.include * @package chamilo.include
* @todo remove the code that displays the button that links to the install page * @todo remove the code that displays the button that links to the install page
* but use a redirect immediately. By doing so the $alreadyInstalled variable can be removed.
* *
*/ */
// Showing/hiding error codes in global error messages. // Showing/hiding error codes in global error messages.
define('SHOW_ERROR_CODES', false); define('SHOW_ERROR_CODES', false);
// Specification for usernames:
// 1. ASCII-letters, digits, "." (dot), "_" (underscore) are acceptable, 40 characters maximum length.
// 2. Empty username is formally valid, but it is reserved for the anonymous user.
// 3. Checking the login_is_email portal setting in order to accept 100 chars maximum
define('USERNAME_MAX_LENGTH', 100);
define('_MPDF_TEMP_PATH', __DIR__.'/../../var/cache/mpdf/');
define('_MPDF_TTFONTDATAPATH', __DIR__.'/../../var/cache/mpdf/');
require_once __DIR__.'/../../vendor/autoload.php'; require_once __DIR__.'/../../vendor/autoload.php';
require_once __DIR__.'/../../public/legacy.php';
// Check the PHP version
api_check_php_version(__DIR__.'/');
// Get settings from .env file created when installation Chamilo // Get settings from .env file created when installation Chamilo
$envFile = __DIR__.'/../../.env'; $envFile = __DIR__.'/../../.env';
if (file_exists($envFile)) { if (file_exists($envFile)) {
(new Dotenv())->load($envFile); (new Dotenv())->load($envFile);
} else { } else {
throw new \RuntimeException('APP_ENV environment variable is not defined. throw new \RuntimeException('APP_ENV environment variable is not defined.
You need to define environment variables for configuration to load variables from a .env file.'); You need to define environment variables for configuration to load variables from a .env file.');
} }
$env = $_SERVER['APP_ENV'] ?? 'dev'; $env = $_SERVER['APP_ENV'] ?? 'dev';
$kernel = new Chamilo\Kernel($env, true); $kernel = new Chamilo\Kernel($env, true);
// Include the main Chamilo platform configuration file.
$alreadyInstalled = false;
require_once __DIR__.'/../../public/legacy.php';
$request = Sonata\PageBundle\Request\RequestFactory::createFromGlobals( $request = Sonata\PageBundle\Request\RequestFactory::createFromGlobals(
'host_with_path_by_locale' 'host_with_path_by_locale'
); );
$response = $kernel->handle($request); $response = $kernel->handle($request);
//$kernel->boot();
//var_dump($request->getBasePath());
if ($kernel->isInstalled()) { if ($kernel->isInstalled()) {
require_once $kernel->getConfigurationFile(); require_once $kernel->getConfigurationFile();
} else { } else {
$_configuration = []; $_configuration = [];
// Redirects to the main/install/ page // Redirects to the main/install/ page
$global_error_code = 2; $global_error_code = 2;
// The system has not been installed yet. // The system has not been installed yet.
require_once __DIR__.'/../inc/global_error_message.inc.php'; require_once __DIR__.'/../inc/global_error_message.inc.php';
exit; exit;
} }
$append = $kernel->getUrlAppend();
/*$baseUrl = '..';
if (!empty($append)) {
$request->setBaseUrl("/$append/");
}*/
$kernel->setApi($_configuration); $kernel->setApi($_configuration);
// Ensure that _configuration is in the global scope before loading // Ensure that _configuration is in the global scope before loading
@ -71,48 +85,35 @@ $libraryPath = __DIR__.'/lib/';
// Include the main Chamilo platform library file. // Include the main Chamilo platform library file.
require_once $libraryPath.'api.lib.php'; require_once $libraryPath.'api.lib.php';
// Check the PHP version
api_check_php_version(__DIR__.'/');
// Specification for usernames:
// 1. ASCII-letters, digits, "." (dot), "_" (underscore) are acceptable, 40 characters maximum length.
// 2. Empty username is formally valid, but it is reserved for the anonymous user.
// 3. Checking the login_is_email portal setting in order to accept 100 chars maximum
define('USERNAME_MAX_LENGTH', 100);
define('_MPDF_TEMP_PATH', __DIR__.'/../../var/cache/mpdf/');
define('_MPDF_TTFONTDATAPATH', __DIR__.'/../../var/cache/mpdf/');
// @todo convert this libs in classes
require_once $libraryPath.'database.constants.inc.php';
require_once $libraryPath.'text.lib.php';
require_once $libraryPath.'array.lib.php';
require_once $libraryPath.'online.inc.php';
require_once $libraryPath.'banner.lib.php';
require_once $libraryPath.'fileManage.lib.php';
require_once $libraryPath.'fileUpload.lib.php';
require_once $libraryPath.'fileDisplay.lib.php';
require_once $libraryPath.'course_category.lib.php';
$container = $kernel->getContainer(); $container = $kernel->getContainer();
// Connect Chamilo with the Symfony container // Fix chamilo URL when used inside a folder: example.com/chamilo
Container::setContainer($container);
Container::setLegacyServices($container);
$router = $container->get('router');
$context = $container->get('router.request_context');
$append = $kernel->getUrlAppend(); $append = $kernel->getUrlAppend();
$baseUrl = '..'; $baseUrl = '..';
if (!empty($append)) { if (!empty($append)) {
$baseUrl = $append; $router = $container->get('router');
$requestStack = $container->get('request_stack');
$context = $container->get('router.request_context');
$host = $router->getContext()->getHost();
$context->setBaseUrl("/$append/");
$container->set('router.request_context', $context);
$packages = $container->get('assets.packages');
$routerContext = $container->get('router')->getContext();
$version = new Symfony\Component\Asset\VersionStrategy\EmptyVersionStrategy();
$newDefault = new Symfony\Component\Asset\PathPackage("/$append/public/", $version);
$packages = $container->get('assets.packages');
$packages->setDefaultPackage($newDefault);
} }
$context->setBaseUrl($baseUrl);
$router->setContext($context);
//$container->setParameter('router', $router);
\CourseManager::setCourseManager( // Connect Chamilo with the Symfony container
$container->get('chamilo_core.entity.manager.course_manager') Container::setContainer($container);
); Container::setLegacyServices($container);
//$kernel->boot();
//var_dump($container->get('assets.context')->getBasePath());
//var_dump($container->get('assets.empty_package')->getUrl('/build/'));
if (!is_dir(_MPDF_TEMP_PATH)) { if (!is_dir(_MPDF_TEMP_PATH)) {
mkdir(_MPDF_TEMP_PATH, api_get_permissions_for_new_directories(), true); mkdir(_MPDF_TEMP_PATH, api_get_permissions_for_new_directories(), true);
@ -306,7 +307,6 @@ foreach ($configurationFiles as $file) {
} }
/* LOAD LANGUAGE FILES SECTION */ /* LOAD LANGUAGE FILES SECTION */
// if we use the javascript version (without go button) we receive a get // if we use the javascript version (without go button) we receive a get
// if we use the non-javascript version (with the go button) we receive a post // if we use the non-javascript version (with the go button) we receive a post
$user_language = ''; $user_language = '';

@ -226,7 +226,8 @@ class Database
/** /**
* Frees all the memory associated with the provided result identifier. * Frees all the memory associated with the provided result identifier.
* @return boolean|null Returns TRUE on success or FALSE on failure. * @return boolean|null Returns TRUE on success or FALSE on failure.
* Notes: Use this method if you are concerned about how much memory is being used for queries that return large result sets. * Notes: Use this method if you are concerned about how much memory is being
* used for queries that return large result sets.
* Anyway, all associated result memory is automatically freed at the end of the script's execution. * Anyway, all associated result memory is automatically freed at the end of the script's execution.
*/ */
public static function free_result(Statement $result) public static function free_result(Statement $result)
@ -281,7 +282,6 @@ class Database
* *
* @return Statement * @return Statement
* *
* @throws \Doctrine\DBAL\DBALException
*/ */
public static function query($query) public static function query($query)
{ {
@ -335,9 +335,9 @@ class Database
/** /**
* Database insert * Database insert
* @param string $table_name * @param string $table_name
* @param array $attributes * @param array $attributes
* @param bool $show_query * @param bool $show_query
* *
* @return false|int * @return false|int
*/ */

@ -826,6 +826,7 @@ class Display
// When moving this to production, the return_icon() calls should // When moving this to production, the return_icon() calls should
// ask for the SVG version directly // ask for the SVG version directly
$svgIcons = api_get_setting('icons_mode_svg'); $svgIcons = api_get_setting('icons_mode_svg');
if ($svgIcons == 'true' && $return_only_path == false) { if ($svgIcons == 'true' && $return_only_path == false) {
$svgImage = substr($image, 0, -3).'svg'; $svgImage = substr($image, 0, -3).'svg';
if (is_file($code_path.$theme.'svg/'.$svgImage)) { if (is_file($code_path.$theme.'svg/'.$svgImage)) {

@ -129,6 +129,7 @@ class Template
} }
$this->twig = new Twig_Environment($loader, $options); $this->twig = new Twig_Environment($loader, $options);
//$this->twig = \Chamilo\CoreBundle\Framework\Container::getTemplating();
if ($isTestMode) { if ($isTestMode) {
$this->twig->addExtension(new Twig_Extension_Debug()); $this->twig->addExtension(new Twig_Extension_Debug());
@ -354,9 +355,6 @@ class Template
{ {
$tpl = $this->get_template('layout/layout_1_col.html.twig'); $tpl = $this->get_template('layout/layout_1_col.html.twig');
echo \Chamilo\CoreBundle\Framework\Container::getTemplating()->render($tpl, $this->params); echo \Chamilo\CoreBundle\Framework\Container::getTemplating()->render($tpl, $this->params);
/*$tpl = $this->get_template('layout/layout_1_col.tpl');
$this->display($tpl);*/
} }
/** /**
@ -366,8 +364,6 @@ class Template
{ {
$tpl = $this->get_template('layout/layout_2_col.html.twig'); $tpl = $this->get_template('layout/layout_2_col.html.twig');
echo \Chamilo\CoreBundle\Framework\Container::getTemplating()->render($tpl, $this->params); echo \Chamilo\CoreBundle\Framework\Container::getTemplating()->render($tpl, $this->params);
//$this->display($tpl);
} }
/** /**
@ -617,6 +613,8 @@ class Template
$this->theme = $this->preview_theme; $this->theme = $this->preview_theme;
} }
$this->assign('theme', $this->theme);
$this->themeDir = self::getThemeDir($this->theme); $this->themeDir = self::getThemeDir($this->theme);
// Setting app paths/URLs // Setting app paths/URLs
@ -762,8 +760,9 @@ class Template
$css_file_to_string = null; $css_file_to_string = null;
foreach ($css as $file) { foreach ($css as $file) {
$css_file_to_string .= api_get_css($file); // $css_file_to_string .= api_get_css($file);
} }
// @todo move this somewhere else. Special fix when using tablets in order to see the text near icons // @todo move this somewhere else. Special fix when using tablets in order to see the text near icons
if (SHOW_TEXT_NEAR_ICONS == true) { if (SHOW_TEXT_NEAR_ICONS == true) {
//hack in order to fix the actions buttons //hack in order to fix the actions buttons
@ -873,9 +872,10 @@ class Template
//$js_file_to_string .= '<script type="text/javascript" src="'.api_get_path(WEB_PUBLIC_PATH).'assets/'.$file.'"></script>'."\n"; //$js_file_to_string .= '<script type="text/javascript" src="'.api_get_path(WEB_PUBLIC_PATH).'assets/'.$file.'"></script>'."\n";
} }
$js_file_to_string .= '<script type="text/javascript" src="'.api_get_path(WEB_PUBLIC_PATH).'build/chamilo.js"></script>'."\n"; /*$js_file_to_string .= '<script type="text/javascript" src="'.api_get_path(WEB_PUBLIC_PATH).'build/chamilo.js"></script>'."\n";
$js_file_to_string .= '<script type="text/javascript" src="'.api_get_path(WEB_PUBLIC_PATH).'libs/ckeditor/ckeditor.js"></script>'."\n"; $js_file_to_string .= '<script type="text/javascript" src="'.api_get_path(WEB_PUBLIC_PATH).'libs/ckeditor/ckeditor.js"></script>'."\n";
$js_file_to_string .= '<script type="text/javascript" src="'.api_get_path(WEB_PUBLIC_PATH).'libs/readmore-js/readmore.js"></script>'."\n"; $js_file_to_string .= '<script type="text/javascript" src="'.api_get_path(WEB_PUBLIC_PATH).'libs/readmore-js/readmore.js"></script>'."\n";
*/
foreach ($js_files as $file) { foreach ($js_files as $file) {
//$js_file_to_string .= api_get_js($file); //$js_file_to_string .= api_get_js($file);

@ -18,7 +18,18 @@
<title>{{ title_string }}</title> <title>{{ title_string }}</title>
{{ social_meta }} {{ social_meta }}
{{ css_static_file_to_string }} {{ css_static_file_to_string }}
{{ js_file_to_string }} {#{{ js_file_to_string }}#}
<link rel="stylesheet" href="{{ asset('build/chamilo.css') }}"/>
<link rel="stylesheet" href="{{ asset('build/css/base.css') }}"/>
<link rel="stylesheet" href="{{ asset('build/css/themes/'~ theme ~'/default.css') }}"/>
<link rel="stylesheet" media="print" href="{{ asset('build/css/print.css') }}"/>
<script src="{{ asset('build/chamilo.js') }}"></script>
<script src="{{ asset('libs/ckeditor/ckeditor.js') }}"></script>
<script src="{{ asset('libs/readmore-js/readmore.min.js') }}"></script>
<script src="{{ asset('libs/js-cookie/src/js.cookie.js') }}"></script>
{{ extra_headers }} {{ extra_headers }}
<script> <script>
/* Global chat variables */ /* Global chat variables */
@ -27,7 +38,6 @@ var online_button = '{{ online_button }}';
var offline_button = '{{ offline_button }}'; var offline_button = '{{ offline_button }}';
var connect_lang = '{{ "ChatConnected"|get_lang }}'; var connect_lang = '{{ "ChatConnected"|get_lang }}';
var disconnect_lang = '{{ "ChatDisconnected"|get_lang }}'; var disconnect_lang = '{{ "ChatDisconnected"|get_lang }}';
var logOutUrl = '{{ _p.web_ajax }}course.ajax.php?a=course_logout'; var logOutUrl = '{{ _p.web_ajax }}course.ajax.php?a=course_logout';
$(document).ready(function () { $(document).ready(function () {

@ -1,3 +1,4 @@
{% autoescape false %}
{% for item in hot_courses %} {% for item in hot_courses %}
{% if item.title %} {% if item.title %}
<div class="col-xs-12 col-sm-6 col-md-4"> <div class="col-xs-12 col-sm-6 col-md-4">
@ -99,3 +100,4 @@
</div> </div>
{% endif %} {% endif %}
{% endfor %} {% endfor %}
{% endautoescape %}

@ -1,5 +1,6 @@
{% for hot_course in hot_courses %} {% autoescape false %}
{% if hot_course.extra_info.title %} {% for hot_course in hot_courses %}
{% if hot_course.extra_info.title %}
<div class="row"> <div class="row">
<div class="col-sm-3"> <div class="col-sm-3">
<div class="thumbnail"> <div class="thumbnail">
@ -21,3 +22,4 @@
</div> </div>
{% endif %} {% endif %}
{% endfor %} {% endfor %}
{% endautoescape %}

@ -1,5 +1,5 @@
{% autoescape false %}
{% if hot_courses is not null and hot_courses is not empty %} {% if hot_courses is not null and hot_courses is not empty %}
<script> <script>
$(document).ready( function() { $(document).ready( function() {
$('.star-rating li a').on('click', function(event) { $('.star-rating li a').on('click', function(event) {
@ -40,3 +40,4 @@ $(document).ready( function() {
</div> </div>
</section> </section>
{% endif %} {% endif %}
{% endautoescape %}

@ -12,7 +12,7 @@
<a class="navbar-brand" href="{{ _p.web }}">{{ _s.site_name }}</a> <a class="navbar-brand" href="{{ _p.web }}">{{ _s.site_name }}</a>
</div> </div>
<div class="collapse navbar-collapse" id="menuone"> <div class="collapse navbar-collapse" id="menuone">
{{ mopa_bootstrap_menu('ChamiloCoreBundle:NavBuilder:leftMenu', {'automenu': 'navbar', 'stacked' : false}) }} {#{{ mopa_bootstrap_menu('ChamiloCoreBundle:NavBuilder:leftMenu', {'automenu': 'navbar', 'stacked' : false}) }}#}
{#<ul class="nav navbar-nav">#} {#<ul class="nav navbar-nav">#}
{#{% for item in menu %}#} {#{% for item in menu %}#}

@ -1,3 +1,4 @@
{% autoescape false %}
{% set group_courses = 'view_grid_courses_grouped_categories_in_sessions'| api_get_configuration_value %} {% set group_courses = 'view_grid_courses_grouped_categories_in_sessions'| api_get_configuration_value %}
{% macro course_block(course, show_category) %} {% macro course_block(course, show_category) %}
@ -170,3 +171,4 @@
</div> </div>
</div> </div>
{% endfor %} {% endfor %}
{% endautoescape %}

@ -24,7 +24,7 @@
<link href="https://chamilo.org/the-association/" rel="author"/> <link href="https://chamilo.org/the-association/" rel="author"/>
<link href="https://chamilo.org/the-association/" rel="copyright"/> <link href="https://chamilo.org/the-association/" rel="copyright"/>
<link rel="apple-touch-icon" href="{{ asset('apple-touch-icon.png') }}"/> <link rel="apple-touch-icon" href="{{ asset('apple-touch-icon.png') }}"/>
<link rel="icon" type="image/x-icon" href="{{ asset('build/css/themes/'~ theme ~'/favicon.ico') }}"/>julio <link rel="icon" type="image/x-icon" href="{{ asset('build/css/themes/'~ theme ~'/favicon.ico') }}"/>
<title> <title>
{% block title %} {% block title %}
{{ chamilo_settings_get('platform.institution') }} - {{ chamilo_settings_get('platform.site_name') }} {{ chamilo_settings_get('platform.institution') }} - {{ chamilo_settings_get('platform.site_name') }}
@ -57,6 +57,7 @@
<link rel="stylesheet" href="{{ asset('build/css/base.css') }}"/> <link rel="stylesheet" href="{{ asset('build/css/base.css') }}"/>
<link rel="stylesheet" href="{{ asset('build/css/themes/'~ theme ~'/default.css') }}"/> <link rel="stylesheet" href="{{ asset('build/css/themes/'~ theme ~'/default.css') }}"/>
<link rel="stylesheet" media="print" href="{{ asset('build/css/print.css') }}"/> <link rel="stylesheet" media="print" href="{{ asset('build/css/print.css') }}"/>
<script src="{{ asset('build/chamilo.js') }}"></script> <script src="{{ asset('build/chamilo.js') }}"></script>
<script src="{{ asset('libs/ckeditor/ckeditor.js') }}"></script> <script src="{{ asset('libs/ckeditor/ckeditor.js') }}"></script>
<script src="{{ asset('libs/readmore-js/readmore.min.js') }}"></script> <script src="{{ asset('libs/readmore-js/readmore.min.js') }}"></script>

Loading…
Cancel
Save