Adding own template to userportal

skala
Julio Montoya 12 years ago
parent fc0cec17a0
commit 4026006516
  1. 9
      main/inc/lib/course.lib.php
  2. 6
      main/inc/lib/page.lib.php
  3. 4
      main/inc/lib/template.lib.php
  4. 47
      main/template/default/userportal/course_item.tpl
  5. 1
      main/template/default/userportal/index.tpl
  6. 5
      user_portal.php

@ -5,7 +5,7 @@
* All main course functions should be placed here.
*
* Many functions of this library deal with providing support for
* virtual/linked/combined courses (this was already used in several
* virtual/linked/combined courses (this was already used in several
* universities but not available in standard Chamilo).
*
* The implementation changed, initially a course was a real course
@ -243,7 +243,7 @@ class CourseManager {
}
/**
* Returns all the information of a given coursecode from the course
* Returns all the information of a given coursecode from the course
* table by it integer ID
* @param int the course id
* @return an array with all the fields of the course table
@ -324,7 +324,7 @@ class CourseManager {
}
/**
* Returns the status of a user in a course, which is COURSEMANAGER
* Returns the status of a user in a course, which is COURSEMANAGER
* or STUDENT.
* @param int User ID
* @param string Course code
@ -2975,6 +2975,8 @@ class CourseManager {
$with_special_courses = ' course.code IN ("'.implode('","',$special_course_list).'")';
}
//$course_items = array();
if (!empty($with_special_courses)) {
$sql = "SELECT course.id, course.code, course.subscribe subscr, course.unsubscribe unsubscr, course_rel_user.status status,
course_rel_user.sort sort, course_rel_user.user_course_cat user_course_cat, course_rel_user.user_id
@ -3048,6 +3050,7 @@ class CourseManager {
}
$html .= self::course_item_html($params, false);
//$course_items[] = $params;
$key++;
}
}

@ -187,7 +187,7 @@ class PageController
if (empty($home_notice)) {
$home_notice = @(string) file_get_contents($sys_path.$home.'home_notice.html');
}
//var_dump($sys_path.$home.'home_notice_'.$user_selected_language.'.html');exit;
if (!empty($home_notice)) {
$home_notice = api_to_system_encoding($home_notice, api_detect_encoding(strip_tags($home_notice)));
$home_notice = Display::div($home_notice, array('class' => 'homepage_notice'));
@ -739,6 +739,8 @@ class PageController
if (empty($user_id)) {
return false;
}
$session_categories = array();
$load_history = (isset($_GET['history']) && intval($_GET['history']) == 1) ? true : false;
@ -767,7 +769,9 @@ class PageController
// If we're not in the history view...
if (!isset($_GET['history'])) {
//Display special courses
$special_courses = CourseManager::display_special_courses($user_id, $load_directories_preview);
//Display courses
$courses_html .= CourseManager::display_courses($user_id, $load_directories_preview);
}

@ -829,8 +829,8 @@ class Template {
return $this->app['twig']->render($this->app['template_style'].'/layout/'.$layout);
}
function render_template($template) {
return $this->app['twig']->render($this->app['template_style'].'/'.$template);
function render_template($template, $elements = array()) {
return $this->app['twig']->render($this->app['template_style'].'/'.$template, $elements);
}
/**

@ -0,0 +1,47 @@
<div class="course_item">
<div class="row">
<div class="span7">
<div class="row">
<div class="span1 course-box-thumbnail-box">
<div class="thumbnail">
{{ item.image }}
<img src="http://localhost/chamilo11/main/img/icons/48/folder_yellow.png" alt="aaa" title="aaa">
</div>
</div>
<div class="span6 table_user_course_category course-box-text">
<h3>{{ item.title }}</h3>
</div>
</div>
</div>
<div class="span1 pull-right course-box-actions">
{{ item.actions }}
</div>
</div>
</div>
<div class="course_item">
<div class="row">
<div class="span7">
<div class="row">
<div class="span1 course-box-thumbnail-box">
<a class="thumbnail" href="http://localhost/chamilo11/courses/AAAMATHS/?id_session=0">
<img src="http://localhost/chamilo11/main/img/icons/48/blackboard.png" alt="aaa Maths" title="aaa Maths"></a>
</div>
<div class="span6 course-box-text">
<h3>
<a href="http://localhost/chamilo11/courses/AAAMATHS/?id_session=0"> aaa Maths</a>&nbsp;
</h3>
<h5>
<img src="http://localhost/chamilo11/main/img/icons/16/teacher.png" alt="Trainer" title="Trainer">
<a class="ajax" href="http://localhost/chamilo11/main/inc/ajax/user_manager.ajax.php?a=get_user_popup&amp;resizable=0&amp;height=300&amp;user_id=1"> John Doe</a>
</h5>
</div>
</div>
</div>
<div class="span1 pull-right course-box-actions">
<a href="http://localhost/chamilo11/main/course_info/infocours.php?cidReq=AAAMATHS">
<img src="http://localhost/chamilo11/main/img/icons/22/edit.png" alt="Edit" title="Edit" align="absmiddle">
</a>
</div>
</div>
</div>

@ -0,0 +1 @@
{% extends "default/layout/layout_2_col.tpl" %}

@ -148,6 +148,8 @@ class UserPortalController
$_SESSION['sniff_java_sun_ver']=Security::remove_XSS($_POST['sniff_navigator_java_sun_ver']);
}*/
// Main courses and session list
$courses_and_sessions = PageController::return_courses_and_sessions(api_get_user_id());
@ -184,6 +186,7 @@ class UserPortalController
PageController::return_profile_block();
PageController::return_user_image_block();
PageController::return_course_block();
$app['template']->assign('navigation_course_links', $app['template']->return_navigation_links());
PageController::return_reservation_block();
$app['template']->assign('search_block', PageController::return_search_block());
@ -193,7 +196,7 @@ class UserPortalController
// Deleting the session_id.
Session::erase('session_id');
$response = $app['template']->render_layout('layout_2_col.tpl');
$response = $app['template']->render_template('userportal/index.tpl');
//return new Response($response, 200, array('Cache-Control' => 's-maxage=3600, private'));
return new Response($response, 200, array());

Loading…
Cancel
Save