Minor - cleaning file

skala
Julio Montoya 14 years ago
parent 643dac1a59
commit b415bfb2ce
  1. 20
      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(); $courses_tree = array();
$load_history = (isset($_GET['history']) && intval($_GET['history']) == 1) ? true : false; $load_history = (isset($_GET['history']) && intval($_GET['history']) == 1) ? true : false;
if ($load_history) { if ($load_history) {
//Load courses 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) { if (empty($courses_tree[0]) && count($courses_tree) == 1) {
$courses_tree = null; $courses_tree = null;
} }
} else { } else {
//Load current courses //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)) { if (!empty($courses_tree)) {
@ -956,14 +956,14 @@ class IndexManager {
$courses_tree[$cat]['details'] = SessionManager::get_session_category($cat); $courses_tree[$cat]['details'] = SessionManager::get_session_category($cat);
//Get courses //Get courses
if ($cat == 0) { 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)); $courses_tree[$cat]['sessions'] = array_flip(array_flip($sessions));
//Get courses in sessions //Get courses in sessions
if (count($courses_tree[$cat]['sessions']) > 0) { if (count($courses_tree[$cat]['sessions']) > 0) {
foreach ($courses_tree[$cat]['sessions'] as $k => $s_id) { 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] = 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 we're not in the history view...
if (!isset($_GET['history'])) { // if (!isset($_GET['history'])) { //
//Display special courses //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 //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 // Independent sessions
@ -1053,7 +1053,6 @@ class IndexManager {
} }
} }
} else { } else {
// All sessions included in. // All sessions included in.
if (!empty($category['details'])) { if (!empty($category['details'])) {
$count_courses_session = 0; $count_courses_session = 0;
@ -1092,7 +1091,7 @@ class IndexManager {
if (api_is_drh()) { if (api_is_drh()) {
$session_link = $session_box['title']; $session_link = $session_box['title'];
} else { } 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; $params['title'] .= $session_link;
@ -1116,7 +1115,6 @@ class IndexManager {
} }
$params['title'] .= $category['details']['name']; $params['title'] .= $category['details']['name'];
if ($category['details']['date_end'] != '0000-00-00') { if ($category['details']['date_end'] != '0000-00-00') {
$params['title'] .= sprintf(get_lang('FromDateXToDateY'),$category['details']['date_start'], $category['details']['date_end']); $params['title'] .= sprintf(get_lang('FromDateXToDateY'),$category['details']['date_start'], $category['details']['date_end']);
} }

@ -8,7 +8,6 @@
* - personal course list * - personal course list
* - menu bar * - menu bar
* Search for CONFIGURATION parameters to modify settings * Search for CONFIGURATION parameters to modify settings
* @todo rewrite code to separate display, logic, database code
* @package chamilo.main * @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? * @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. * 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 */ /* Sniffing system */
//store posts to sessions //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_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_w']=Security::remove_XSS($_POST['sniff_navigator_screen_size_w']);
$_SESSION['sniff__screen_size_h']=Security::remove_XSS($_POST['sniff_navigator_screen_size_h']); $_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')); $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 // Main courses and session list
$courses_and_sessions = $controller->return_courses_and_sessions($user_id);
$courses_and_sessions = $controller->return_courses_and_sessions();
$controller->tpl->assign('content', $courses_and_sessions); $controller->tpl->assign('content', $courses_and_sessions);
if (api_get_setting('allow_browser_sniffer') == 'true') { if (api_get_setting('allow_browser_sniffer') == 'true') {
if ($_SESSION['sniff_navigator']!="checked") { if ($_SESSION['sniff_navigator']!="checked") {
$controller->tpl->assign('show_sniff', 1); $controller->tpl->assign('show_sniff', 1);
} else{ } else {
$controller->tpl->assign('show_sniff', 0); $controller->tpl->assign('show_sniff', 0);
} }
} }
//check for flash and message //check for flash and message
$sniff_notification = ''; $sniff_notification = '';
$some_activex=$_SESSION['sniff_check_some_activex']; $some_activex=$_SESSION['sniff_check_some_activex'];

Loading…
Cancel
Save