true];
$start_date = isset($_REQUEST['startDate']) ? $_REQUEST['startDate'] : '';
$end_date = isset($_REQUEST['endDate']) ? $_REQUEST['endDate'] : '';
$user_id = isset($_REQUEST['student']) ? $_REQUEST['student'] : '';
$course_code = isset($_REQUEST['course']) ? $_REQUEST['course'] : '';
$type = isset($_REQUEST['type']) ? $_REQUEST['type'] : '';
$sessionId = isset($_REQUEST['session_id']) ? $_REQUEST['session_id'] : 0;
$courseInfo = api_get_course_info($course_code);
$sql_result = MySpace::get_connections_to_course_by_date(
$user_id,
$courseInfo,
$sessionId,
$start_date,
$end_date
);
if (is_array($sql_result) && count($sql_result) > 0) {
$db['is_empty'] = false;
$db['result'] = convert_to_string($sql_result);
$rst = get_stats(
$user_id,
$courseInfo,
$sessionId,
$start_date,
$end_date
);
$foo_stats = ''.get_lang('Total').': '.$rst['total'].'
';
$foo_stats .= ''.get_lang('Average').': '.$rst['avg'].'
';
$foo_stats .= ''.get_lang('Quantity').' : '.$rst['times'].'
';
$db['stats'] = $foo_stats;
$db['graph_result'] = grapher($sql_result, $start_date, $end_date, $type);
} else {
$db['result'] = Display::return_message(
get_lang('NoDataAvailable'),
'warning'
);
$db['graph_result'] = Display::return_message(
get_lang('NoDataAvailable'),
'warning'
);
$db['stats'] = Display::return_message(
get_lang('NoDataAvailable'),
'warning'
);
}
header('Cache-Control: no-cache');
echo json_encode($db);
break;
}
exit;