Changing layout names and setting user info, so we can call user info in templates ...

skala
Julio Montoya 14 years ago
parent 9af85360ce
commit 266e2e55cc
  1. 7
      index-smarty.php
  2. 2
      main/admin/index.php
  3. 24
      main/inc/lib/template.lib.php
  4. 0
      main/template/default/layout/layout_1_col.tpl
  5. 0
      main/template/default/layout/layout_2_col.tpl
  6. 31
      main/template/default/layout/layout_3_col.tpl
  7. 0
      main/template/experimental/layout/layout_1_col.tpl
  8. 1
      main/template/experimental/layout/layout_2_col.tpl
  9. 34
      main/template/experimental/layout/layout_3_col.tpl
  10. 2
      userportal-smarty.php

@ -40,8 +40,11 @@ $(document).ready(function(){
$index = new IndexManager($header_title);
$tpl = $index->tpl->get_template('layout/layout_two_col.tpl');
if (api_get_user_id()) {
$tpl = $index->tpl->get_template('layout/layout_3_col.tpl');
} else {
$tpl = $index->tpl->get_template('layout/layout_2_col.tpl');
}
//@todo move this inside the IndexManager

@ -14,8 +14,6 @@ $cidReset = true;
// Including some necessary chamilo files.
require_once '../inc/global.inc.php';
require_once api_get_path(LIBRARY_PATH).'security.lib.php';
require_once api_get_path(LIBRARY_PATH).'usermanager.lib.php';
require_once api_get_path(SYS_CODE_PATH).'admin/statistics/statistics.lib.php';
require_once api_get_path(LIBRARY_PATH).'urlmanager.lib.php';

@ -45,18 +45,34 @@ class Template extends Smarty {
$this->caching = true;
$this->cache_lifetime = Smarty::CACHING_OFF; // no caching
//$this->cache_lifetime = 120;
$this->set_header_parameters();
$this->set_user_parameters();
$this->set_header_parameters();
$this->set_footer_parameters();
//Now we can call the get_lang from a template!!! Just use {"MyString"|get_lang}
$this->registerPlugin("modifier","get_lang", "get_lang");
//$this->loadPlugin('smarty_function_get_lang');
//$this->caching = Smarty::CACHING_LIFETIME_CURRENT;
$this->assign('style', $this->style);
$this->assign('style', $this->style);
}
function set_user_parameters() {
if (api_get_user_id()) {
$user_info = api_get_user_info();
//$this->assign('user_info', $user_info);
$this->assign('user_complete_name', api_get_person_name($user_info['firstname'], $user_info['lastname']));
} else {
}
}
function get_template($name) {
return $this->style.'/'.$name;
}

@ -0,0 +1,31 @@
{extends file="default/layout/main.tpl"}
{block name=header}
{include file="default/layout/header.tpl"}
{/block}
{block name=body}
<div id="maincontent" class="maincontent">
{$plugin_courses_block}
{$home_page_block}
{$content}
{$announcements_block}
</div>
<div id="menu-wrapper">
{$login_block}
{$profile_block}
{$account_block}
{$teacher_block}
{$notice_block}
{$navigation_course_links}
{$plugin_courses_right_block}
{$reservation_block}
{$search_block}
{$classes_block}
</div>
{/block}
{block name=footer}
{include file="default/layout/footer.tpl"}
{/block}

@ -5,7 +5,6 @@
{/block}
{block name=body}
<h1>{"WelcomeUserXToTheSiteX"|get_lang} </h1>
<div id="maincontent" class="maincontent">
{$home_page_block}
{$plugin_courses_block}

@ -0,0 +1,34 @@
{extends file="default/layout/main.tpl"}
{block name=header}
{include file="default/layout/header.tpl"}
{/block}
{block name=body}
<h1>{"WelcomeUserXToTheSiteX"|get_lang} </h1>
<div id="left_col">
{$announcements_block}
</div>
<div id="center_col">
{$content}
</div>
<div id="right">
{$user_complete_name}
{$login_block}
{$profile_block}
{$account_block}
{$teacher_block}
{$notice_block}
{$navigation_course_links}
{$plugin_courses_right_block}
{$reservation_block}
{$search_block}
{$classes_block}
</div>
{/block}
{block name=footer}
{include file="default/layout/footer.tpl"}
{/block}

@ -20,7 +20,7 @@ $this_section = SECTION_COURSES;
api_block_anonymous_users(); // Only users who are logged in can proceed.
$userportal = new IndexManager(get_lang('MyCourses'));
$tpl = $userportal->tpl->get_template('layout/layout_two_col.tpl');
$tpl = $userportal->tpl->get_template('layout/layout_3_col.tpl');
//if (!$userportal->tpl->isCached($tpl, api_get_user_id())) {

Loading…
Cancel
Save