Fixing welcome to course

skala
Julio Montoya 13 years ago
parent ec6be91494
commit 235419d26a
  1. 23
      main/inc/global.inc.php
  2. 6
      main/inc/lib/page.lib.php
  3. 2
      main/template/default/layout/error.tpl
  4. 72
      main/template/default/layout/layout_2_col.tpl
  5. 18
      user_portal.php

@ -188,7 +188,7 @@ $app->register(new DoctrineOrmServiceProvider, array(
array( array(
"type" => "annotation", "type" => "annotation",
"namespace" => "Entity", "namespace" => "Entity",
"path" => api_get_path(INCLUDE_PATH).'', "path" => api_get_path(INCLUDE_PATH).'Entity',
) )
// Using PSR-0 namespaceish embedded resources // Using PSR-0 namespaceish embedded resources
// (requires registering a PSR-0 Resource Locator // (requires registering a PSR-0 Resource Locator
@ -259,16 +259,21 @@ $app->error(function (\Exception $e, $code) use ($app) {
if ($app['debug']) { if ($app['debug']) {
//return; //return;
} }
switch ($code) { if (isset($code)) {
case 404: switch ($code) {
$message = 'The requested page could not be found.'; case 404:
break; $message = 'The requested page could not be found.';
default: break;
//$message = 'We are sorry, but something went terribly wrong.'; default:
$message = $e->getMessage(); //$message = 'We are sorry, but something went terribly wrong.';
$message = $e->getMessage();
}
} else {
$code = null;
$message = null;
} }
//$code = ($e instanceof HttpException) ? $e->getStatusCode() : 500; //$code = ($e instanceof HttpException) ? $e->getStatusCode() : 500;
$app['template']->assign('code', $code); $app['template']->assign('error_code', $code);
$app['template']->assign('error_message', $message); $app['template']->assign('error_message', $message);
$response = $app['template']->render_layout('error.tpl'); $response = $app['template']->render_layout('error.tpl');
return new Response($response); return new Response($response);

@ -765,7 +765,7 @@ class PageController {
//Default session name //Default session name
$session_link = $session['session_name']; $session_link = $session['session_name'];
$params['link'] = null; $params['link'] = null;
if (api_get_setting('session_page_enabled') == 'true' && !api_is_drh()) { if (api_get_setting('session_page_enabled') == 'true' && !api_is_drh()) {
//session name with link //session name with link
$session_link = Display::tag('a', $session['session_name'], array('href'=>api_get_path(WEB_CODE_PATH).'session/index.php?session_id='.$session_id)); $session_link = Display::tag('a', $session['session_name'], array('href'=>api_get_path(WEB_CODE_PATH).'session/index.php?session_id='.$session_id));
@ -885,7 +885,6 @@ class PageController {
*/ */
static function return_welcome_to_course_block($tpl) { static function return_welcome_to_course_block($tpl) {
$count_courses = CourseManager::count_courses(); $count_courses = CourseManager::count_courses();
$tpl = $tpl->get_template('layout/welcome_to_course.tpl');
$course_catalog_url = api_get_path(WEB_CODE_PATH).'auth/courses.php'; $course_catalog_url = api_get_path(WEB_CODE_PATH).'auth/courses.php';
$course_list_url = api_get_path(WEB_PATH).'user_portal.php'; $course_list_url = api_get_path(WEB_PATH).'user_portal.php';
@ -895,8 +894,7 @@ class PageController {
$tpl->assign('course_catalog_link', Display::url(get_lang('here'), $course_catalog_url)); $tpl->assign('course_catalog_link', Display::url(get_lang('here'), $course_catalog_url));
$tpl->assign('course_list_link', Display::url(get_lang('here'), $course_list_url)); $tpl->assign('course_list_link', Display::url(get_lang('here'), $course_list_url));
$tpl->assign('count_courses', $count_courses); $tpl->assign('count_courses', $count_courses);
$tpl->assign('welcome_to_course_block', 1);
return $tpl->fetch($tpl);
} }
/*function run() { /*function run() {

@ -1,7 +1,7 @@
{% extends 'default/layout/layout_1_col.tpl' %} {% extends 'default/layout/layout_1_col.tpl' %}
{% block content %} {% block content %}
{{ code }} {{ error_code }}
{{ error_message }} {{ error_message }}
{% endblock %} {% endblock %}

@ -1,16 +1,16 @@
{% extends "default/layout/main.tpl" %} {% extends "default/layout/main.tpl" %}
{% block body %} {% block body %}
{# Main content #} {# Main content #}
{# Right column #} {# Right column #}
<div class="span3 menu-column"> <div class="span3 menu-column">
{% if plugin_menu_top %} {% if plugin_menu_top %}
<div id="plugin_menu_top"> <div id="plugin_menu_top">
{{plugin_menu_top}} {{plugin_menu_top}}
</div> </div>
{% endif %} {% endif %}
{# if user is not login show the login form #} {# if user is not login show the login form #}
{% if _u.logged == 0 %} {% if _u.logged == 0 %}
{% include "default/layout/login_form.tpl" %} {% include "default/layout/login_form.tpl" %}
@ -18,55 +18,55 @@
{# User picture #} {# User picture #}
{{ user_image_block }} {{ user_image_block }}
{# User Profile links #} {# User Profile links #}
{{ profile_block }} {{ profile_block }}
{# Course block - admin #} {# Course block - admin #}
{{ course_block }} {{ course_block }}
{# Course block - teacher #} {# Course block - teacher #}
{{ teacher_block }} {{ teacher_block }}
{# Notice #} {# Notice #}
{{ notice_block }} {{ notice_block }}
{# Help #} {# Help #}
{{ help_block }} {{ help_block }}
{# Links that are not added in the tabs #} {# Links that are not added in the tabs #}
{{ navigation_course_links }} {{ navigation_course_links }}
{# Reservation block #} {# Reservation block #}
{{ reservation_block }} {{ reservation_block }}
{# Search (xapian) #} {# Search (xapian) #}
{{ search_block }} {{ search_block }}
{# Classes #} {# Classes #}
{{ classes_block }} {{ classes_block }}
{# Skills #} {# Skills #}
{{ skills_block }} {{ skills_block }}
{# Plugin courses sidebar #} {# Plugin courses sidebar #}
{# Plugins for footer section #} {# Plugins for footer section #}
{% if plugin_menu_bottom %} {% if plugin_menu_bottom %}
<div id="plugin_menu_bottom"> <div id="plugin_menu_bottom">
{{ plugin_menu_bottom }} {{ plugin_menu_bottom }}
</div> </div>
{% endif %} {% endif %}
</div> </div>
<div class="span9 content-column"> <div class="span9 content-column">
{# Plugin bottom #} {# Plugin bottom #}
{% if plugin_content_top %} {% if plugin_content_top %}
<div id="plugin_content_top"> <div id="plugin_content_top">
{{ plugin_content_top }} {{ plugin_content_top }}
</div> </div>
{% endif %} {% endif %}
{# Portal homepage #} {# Portal homepage #}
{% if home_page_block %} {% if home_page_block %}
<section id="homepage"> <section id="homepage">
@ -77,32 +77,32 @@
</div> </div>
</section> </section>
{% endif %} {% endif %}
{# ?? #} {# ?? #}
{{ sniff_notification }} {{ sniff_notification }}
{% include "default/layout/page_body.tpl" %} {% include "default/layout/page_body.tpl" %}
{# Welcome to course block #} {# Welcome to course block #}
{% if welcome_to_course_block %} {% if welcome_to_course_block %}
<section id="welcome_to_course"> <section id="welcome_to_course">
{{ welcome_to_course_block }} {% include "default/layout/welcome_to_course.tpl" %}
</section> </section>
{% endif %} {% endif %}
{% if content is not null %} {% if content is not null %}
<section id="main_content"> <section id="main_content">
{{ content }} {{ content }}
</section> </section>
{% endif %} {% endif %}
{# Announcements #} {# Announcements #}
{% if announcements_block %} {% if announcements_block %}
<section id="announcements"> <section id="announcements">
{{ announcements_block }} {{ announcements_block }}
</section> </section>
{% endif %} {% endif %}
{# Course categories (must be turned on in the admin settings) #} {# Course categories (must be turned on in the admin settings) #}
{% if course_category_block %} {% if course_category_block %}
<section id="course_category"> <section id="course_category">
@ -113,17 +113,17 @@
</div> </div>
</section> </section>
{% endif %} {% endif %}
{# Hot courses template #} {# Hot courses template #}
{% include "default/layout/hot_courses.tpl" %} {% include "default/layout/hot_courses.tpl" %}
{# Content bottom #} {# Content bottom #}
{% if plugin_content_bottom %} {% if plugin_content_bottom %}
<div id="plugin_content_bottom"> <div id="plugin_content_bottom">
{{plugin_content_bottom}} {{plugin_content_bottom}}
</div> </div>
{% endif %} {% endif %}
&nbsp; &nbsp;
</div> </div>
{% endblock %} {% endblock %}

@ -153,7 +153,7 @@ class UserPortalController
//Show the chamilo mascot //Show the chamilo mascot
if (empty($courses_and_sessions) && !isset($_GET['history'])) { if (empty($courses_and_sessions) && !isset($_GET['history'])) {
$app['template']->assign('welcome_to_course_block', self::return_welcome_to_course_block($app)); PageController::return_welcome_to_course_block($app['template']);
} }
$app['template']->assign('content', $courses_and_sessions); $app['template']->assign('content', $courses_and_sessions);
@ -199,22 +199,6 @@ class UserPortalController
return new Response($response, 200, array()); return new Response($response, 200, array());
} }
function return_welcome_to_course_block(Application $app) {
$count_courses = CourseManager::count_courses();
$tpl = $app['template']->get_template('layout/welcome_to_course.tpl');
$course_catalog_url = api_get_path(WEB_CODE_PATH).'auth/courses.php';
$course_list_url = api_get_path(WEB_PATH).'user_portal.php';
$app['template']->assign('course_catalog_url', $course_catalog_url);
$app['template']->assign('course_list_url', $course_list_url);
$app['template']->assign('course_catalog_link', Display::url(get_lang('here'), $course_catalog_url));
$app['template']->assign('course_list_link', Display::url(get_lang('here'), $course_list_url));
$app['template']->assign('count_courses', $count_courses);
return $app['template']->fetch($tpl);
}
function check_last_login() { function check_last_login() {
/** /**

Loading…
Cancel
Save