Minor - cleaning file

skala
Julio Montoya 14 years ago
parent 643dac1a59
commit b415bfb2ce
  1. 24
      main/inc/lib/userportal.lib.php
  2. 12
      user_portal.php

@ -933,22 +933,22 @@ class IndexManager {
}
/**
* The most important function here, prints the session and course list
* The most important function here, prints the session and course list (user_portal.php)
*
* */
function return_courses_and_sessions() {
function return_courses_and_sessions($user_id) {
$courses_tree = array();
$load_history = (isset($_GET['history']) && intval($_GET['history']) == 1) ? true : false;
if ($load_history) {
//Load courses history
$courses_tree = UserManager::get_sessions_by_category(api_get_user_id(), true, true, true);
$courses_tree = UserManager::get_sessions_by_category($user_id, true, true, true);
if (empty($courses_tree[0]) && count($courses_tree) == 1) {
$courses_tree = null;
}
} else {
//Load current courses
$courses_tree = UserManager::get_sessions_by_category(api_get_user_id(), true, false, true);
$courses_tree = UserManager::get_sessions_by_category($user_id, true, false, true);
}
if (!empty($courses_tree)) {
@ -956,14 +956,14 @@ class IndexManager {
$courses_tree[$cat]['details'] = SessionManager::get_session_category($cat);
//Get courses
if ($cat == 0) {
$courses_tree[$cat]['courses'] = CourseManager::get_courses_list_by_user_id(api_get_user_id(), false);
$courses_tree[$cat]['courses'] = CourseManager::get_courses_list_by_user_id($user_id, false);
}
$courses_tree[$cat]['sessions'] = array_flip(array_flip($sessions));
//Get courses in sessions
if (count($courses_tree[$cat]['sessions']) > 0) {
foreach ($courses_tree[$cat]['sessions'] as $k => $s_id) {
$courses_tree[$cat]['sessions'][$k] = array('details' => SessionManager::fetch($s_id));
$courses_tree[$cat]['sessions'][$k]['courses'] = UserManager::get_courses_list_by_session(api_get_user_id(), $s_id);
$courses_tree[$cat]['sessions'][$k]['courses'] = UserManager::get_courses_list_by_session($user_id, $s_id);
}
}
}
@ -986,9 +986,9 @@ class IndexManager {
// If we're not in the history view...
if (!isset($_GET['history'])) { //
//Display special courses
$html .= CourseManager :: display_special_courses(api_get_user_id(), $this->load_directories_preview);
$html .= CourseManager :: display_special_courses($user_id, $this->load_directories_preview);
//Display courses
$html .= CourseManager :: display_courses(api_get_user_id(), $this->load_directories_preview);
$html .= CourseManager :: display_courses($user_id, $this->load_directories_preview);
}
// Independent sessions
@ -1052,8 +1052,7 @@ class IndexManager {
$html .= CourseManager::course_item_parent(CourseManager::course_item_html($params, true), $html_courses_session);
}
}
} else {
} else {
// All sessions included in.
if (!empty($category['details'])) {
$count_courses_session = 0;
@ -1092,7 +1091,7 @@ class IndexManager {
if (api_is_drh()) {
$session_link = $session_box['title'];
} else {
$session_link = Display::tag('a',$session_box['title'], array('href'=>api_get_path(WEB_CODE_PATH).'session/?session_id='.$session['details']['id']));
$session_link = Display::tag('a', $session_box['title'], array('href'=>api_get_path(WEB_CODE_PATH).'session/?session_id='.$session['details']['id']));
}
$params['title'] .= $session_link;
@ -1114,8 +1113,7 @@ class IndexManager {
if (api_is_platform_admin()) {
$params['right_actions'] .= '<a href="'.api_get_path(WEB_CODE_PATH).'admin/session_category_edit.php?&id='.$category['details']['id'].'">'.Display::return_icon('edit.png', get_lang('Edit'), array(),22).'</a>';
}
$params['title'] .= $category['details']['name'];
$params['title'] .= $category['details']['name'];
if ($category['details']['date_end'] != '0000-00-00') {
$params['title'] .= sprintf(get_lang('FromDateXToDateY'),$category['details']['date_start'], $category['details']['date_end']);

@ -8,7 +8,6 @@
* - personal course list
* - menu bar
* Search for CONFIGURATION parameters to modify settings
* @todo rewrite code to separate display, logic, database code
* @package chamilo.main
* @todo Shouldn't the SCRIPTVAL_ and CONFVAL_ constant be moved to the config page? Has anybody any idea what the are used for?
* If these are really configuration settings then we can add those to the dokeos config settings.
@ -132,7 +131,7 @@ if ($load_dirs) {
/* Sniffing system */
//store posts to sessions
if($_SESSION['sniff_navigator']!="checked") {
if ($_SESSION['sniff_navigator']!="checked") {
$_SESSION['sniff_navigator']=Security::remove_XSS($_POST['sniff_navigator']);
$_SESSION['sniff_screen_size_w']=Security::remove_XSS($_POST['sniff_navigator_screen_size_w']);
$_SESSION['sniff__screen_size_h']=Security::remove_XSS($_POST['sniff_navigator_screen_size_h']);
@ -149,23 +148,20 @@ if($_SESSION['sniff_navigator']!="checked") {
$controller = new IndexManager(get_lang('MyCourses'));
//@todo all this could be moved in the IndexManager
$user_id = api_get_user_id();
// Main courses and session list
$courses_and_sessions = $controller->return_courses_and_sessions();
$courses_and_sessions = $controller->return_courses_and_sessions($user_id);
$controller->tpl->assign('content', $courses_and_sessions);
if (api_get_setting('allow_browser_sniffer') == 'true') {
if ($_SESSION['sniff_navigator']!="checked") {
$controller->tpl->assign('show_sniff', 1);
} else{
} else {
$controller->tpl->assign('show_sniff', 0);
}
}
//check for flash and message
$sniff_notification = '';
$some_activex=$_SESSION['sniff_check_some_activex'];

Loading…
Cancel
Save