[svn r20384] Fixing access details for a user see FS#4165

skala
Julio Montoya 16 years ago
parent c82cb80abf
commit 16bd5eaea1
  1. 31
      main/mySpace/access_details.php

@ -123,7 +123,6 @@ function calculHours($seconds)
}
/* MAIN */
$user_id = Database::escape_string($_REQUEST['student']);
$course_code=Database::escape_string($_REQUEST['course']);
@ -131,21 +130,34 @@ include_once(api_get_path(LIBRARY_PATH).'pchart/pData.class.php');
include_once(api_get_path(LIBRARY_PATH).'pchart/pChart.class.php');
include_once(api_get_path(LIBRARY_PATH).'pchart/pCache.class.php');
$connections = get_connections_to_course($user_id, $course_code);
$i = 0;
if (api_is_xml_http_request()) {
$type = Security::remove_XSS($_GET['type']);
$main_year = $main_month_year = $main_day = array();
// get last 8 days/months
$last_days = 8;
$last_months = 5;
for ($i=$last_days; $i>=0; $i--) {
$main_day[date ('d-m-Y', mktime () - $i * 3600 * 24)]=0;
}
for ($i=$last_months; $i>=0; $i--) {
$main_month_year[date ('m-Y', mktime () - $i*30 * 3600 * 24)]=0;
}
$i = 0;
if (is_array($connections) && count($connections)>0 ){
foreach ($connections as $key=>$data) {
//creating the main array
//$main_year[date('Y',$data['login'])]+=calculHours($data['logout']-$data['login'])*60;
$main_month_year[date('m-Y',$data['login'])]+=calculHours($data['logout']-$data['login'])*60;
$main_day[date('d-m-Y',$data['login'])]+=calculHours($data['logout']-$data['login'])*60;
//$main_month_year[date('m-Y',$data['login'])]+=calculHours($data['logout']-$data['login'])*60;
$main_month_year[date('m-Y',$data['login'])]+=float_format(($data['logout']-$data['login'])/60, 0);
//$main_day[date('d-m-Y',$data['login'])]+=calculHours($data['logout']-$data['login'])*60;
$main_day[date('d-m-Y',$data['login'])]+=float_format(($data['logout']-$data['login'])/60, 0);
if ($i > 500) {
break;
}
$i++;
}
//var_dump($main_month_year);
switch ($type) {
case 'day':
$main_date = $main_day;
@ -157,8 +169,8 @@ if (api_is_xml_http_request()) {
$main_date = $main_year;
break;
}
//echo '<pre>'; print_r($main_date);
// the nice graphics :D
$labels = array_keys($main_date);
if (count($main_date)==1) {
@ -234,12 +246,14 @@ if (api_is_xml_http_request()) {
$img_file = $Cache->GetHash($graph_id,$DataSet->GetData());
}
echo '<img src="'.api_get_path(WEB_CODE_PATH).'garbage/'.$img_file.'">';
} else {
Display::display_warning_message (get_lang('GraphicNotAvailable'));
}
exit;
}
$nameTools= get_lang('AccessDetails');
//StudentDetails
if (isset($_GET['origin']) && strcmp($_GET['origin'],'tracking_course')===0) {
$interbreadcrumb[] = array ("url" => "../tracking/courseLog.php?cidReq=".Security::remove_XSS($_GET['course'])."&amp;studentlist=true&id_session=".api_get_session_id(), "name" => get_lang("Tracking"));
@ -251,7 +265,6 @@ if (isset($_GET['origin']) && strcmp($_GET['origin'],'tracking_course')===0) {
$interbreadcrumb[] = array ("url" => "#", "name" => get_lang("Details"));
}
$htmlHeadXtra[] = '<script src="../inc/lib/javascript/jquery.js" type="text/javascript" language="javascript"></script>'; //jQuery
$htmlHeadXtra[] = '<script src="../inc/lib/javascript/jquery-1.1.3.1.pack.js" type="text/javascript"></script>';
$htmlHeadXtra[] = '<script src="../inc/lib/javascript/jquery.history_remote.pack.js" type="text/javascript"></script>';
@ -278,7 +291,7 @@ foreach ($connections as $key=>$data) {
api_display_tool_title(get_lang('DetailsStudentInCourse'));
echo '<div class="actions">';
echo '<strong>'.get_lang('User').': '.$mainUserInfo['firstName'].' '.$mainUserInfo['lastName'].'</strong>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<strong>'.get_lang('Course').': '.$course_code.'</strong></div>';
echo '<br/>';
?>
<div id="container-9">
<ul>

Loading…
Cancel
Save