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

@ -765,7 +765,7 @@ class PageController {
//Default session name
$session_link = $session['session_name'];
$params['link'] = null;
if (api_get_setting('session_page_enabled') == 'true' && !api_is_drh()) {
//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));
@ -885,7 +885,6 @@ class PageController {
*/
static function return_welcome_to_course_block($tpl) {
$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_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_list_link', Display::url(get_lang('here'), $course_list_url));
$tpl->assign('count_courses', $count_courses);
return $tpl->fetch($tpl);
$tpl->assign('welcome_to_course_block', 1);
}
/*function run() {

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

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

@ -153,7 +153,7 @@ class UserPortalController
//Show the chamilo mascot
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);
@ -199,22 +199,6 @@ class UserPortalController
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() {
/**

Loading…
Cancel
Save