Task #1765 - Cleaning the files for the Tracking tool.

skala
Ivan Tcholakov 15 years ago
parent 39f071a55c
commit 7bae09894a
  1. 29
      main/tracking/courseLog.php
  2. 117
      main/tracking/courseLogCSV.php
  3. 76
      main/tracking/userLog.php
  4. 87
      main/tracking/userlogCSV.php

@ -1,14 +1,15 @@
<?php //$id: $ <?php
/* For licensing terms, see /license.txt */ /* For licensing terms, see /license.txt */
/** /**
* @author Thomas Depraetere * @author Thomas Depraetere
* @author Hugues Peeters * @author Hugues Peeters
* @author Christophe Gesche * @author Christophe Gesche
* @author Sebastien Piraux * @author Sebastien Piraux
* @author Toon Keppens (Vi-Host.net) * @author Toon Keppens (Vi-Host.net)
* *
* @package chamilo.tracking * @package chamilo.tracking
*/ */
/* /*
* INIT SECTION * INIT SECTION
@ -70,16 +71,6 @@ if ($export_csv) {
} }
$csv_content = array(); $csv_content = array();
// charset determination
if (!empty($_GET['scormcontopen'])) {
$tbl_lp = Database::get_course_table(TABLE_LP_MAIN);
$contopen = (int) $_GET['scormcontopen'];
$sql = "SELECT default_encoding FROM $tbl_lp WHERE id = $contopen AND session_id = $session_id";
$res = Database::query($sql);
$row = Database::fetch_array($res);
$lp_charset = $row['default_encoding'];
}
$htmlHeadXtra[] = "<style type='text/css'> $htmlHeadXtra[] = "<style type='text/css'>
/*<![CDATA[*/ /*<![CDATA[*/
.secLine {background-color : #E6E6E6;} .secLine {background-color : #E6E6E6;}

@ -12,39 +12,21 @@
// TODO: Is this file deprecated? // TODO: Is this file deprecated?
/* /* INIT SECTION */
==============================================================================
INIT SECTION
==============================================================================
*/
$pathopen = isset($_REQUEST['pathopen']) ? $_REQUEST['pathopen'] : null; $pathopen = isset($_REQUEST['pathopen']) ? $_REQUEST['pathopen'] : null;
// name of the language file that needs to be included // name of the language file that needs to be included
$language_file = "tracking"; $language_file = "tracking";
include('../inc/global.inc.php'); require_once '../inc/global.inc.php';
//includes for SCORM and LP //includes for SCORM and LP
require_once('../newscorm/learnpath.class.php'); require_once '../newscorm/learnpath.class.php';
require_once('../newscorm/learnpathItem.class.php'); require_once '../newscorm/learnpathItem.class.php';
require_once('../newscorm/scorm.class.php'); require_once '../newscorm/scorm.class.php';
require_once('../newscorm/scormItem.class.php'); require_once '../newscorm/scormItem.class.php';
// charset determination /* Constants and variables */
if ($_GET['scormcontopen'])
{
$tbl_lp = Database::get_course_table(TABLE_LP_MAIN);
$contopen = (int) $_GET['scormcontopen'];
$sql = "SELECT default_encoding FROM $tbl_lp WHERE id = ".$contopen;
$res = Database::query($sql);
$row = Database::fetch_array($res);
$lp_charset = $row['default_encoding'];
//header('Content-Type: text/html; charset='. $row['default_encoding']);
}
/*
-----------------------------------------------------------
Constants and variables
-----------------------------------------------------------
*/
// regroup table names for maintenance purpose // regroup table names for maintenance purpose
$TABLETRACK_ACCESS = Database::get_statistic_table(TABLE_STATISTIC_TRACK_E_LASTACCESS); $TABLETRACK_ACCESS = Database::get_statistic_table(TABLE_STATISTIC_TRACK_E_LASTACCESS);
$TABLETRACK_LINKS = Database::get_statistic_table(TABLE_STATISTIC_TRACK_E_LINKS); $TABLETRACK_LINKS = Database::get_statistic_table(TABLE_STATISTIC_TRACK_E_LINKS);
@ -83,11 +65,7 @@ include("../resourcelinker/resourcelinker.inc.php");
$is_allowedToTrack = $is_courseAdmin || $is_platformAdmin || api_is_drh(); $is_allowedToTrack = $is_courseAdmin || $is_platformAdmin || api_is_drh();
/* /* MAIN CODE */
==============================================================================
MAIN CODE
==============================================================================
*/
$title[0]=get_lang('StatsOfCourse')." : ".$_course['official_code']; $title[0]=get_lang('StatsOfCourse')." : ".$_course['official_code'];
@ -106,18 +84,14 @@ if($is_allowedToTrack && $_configuration['tracking_enabled'])
if(!isset($view)) $view ="0000000"; if(!isset($view)) $view ="0000000";
/*************************************************************************** /* Reporting */
*
* Reporting
*
***************************************************************************/
$tempView = $view; $tempView = $view;
if($view[6] == '1'){ if($view[6] == '1'){
$tempView[6] = '0'; $tempView[6] = '0';
//--------------------------------BEGIN users in this course // BEGIN users in this course
$sql = "SELECT $TABLECOURSUSER.user_i, $table_user.lastname, $table_user.firstname $sql = "SELECT $TABLECOURSUSER.user_i, $table_user.lastname, $table_user.firstname
FROM $TABLECOURSUSER, $table_user FROM $TABLECOURSUSER, $table_user
WHERE $TABLECOURSUSER.course_code = '".$_cid."' AND $TABLECOURSUSER.user_id = $table_user.user_id AND $TABLECOURSUSER.relation_type<>".COURSE_RELATION_TYPE_RRHH." WHERE $TABLECOURSUSER.course_code = '".$_cid."' AND $TABLECOURSUSER.user_id = $table_user.user_id AND $TABLECOURSUSER.relation_type<>".COURSE_RELATION_TYPE_RRHH."
@ -138,7 +112,7 @@ if($is_allowedToTrack && $_configuration['tracking_enabled'])
{ {
//--------------------------------BEGIN % visited // BEGIN % visited
// sum of all items (= multiple learningpaths + SCORM imported paths) // sum of all items (= multiple learningpaths + SCORM imported paths)
$sql = "SELECT COUNT(DISTINCT(iv.lp_item_id)) " . $sql = "SELECT COUNT(DISTINCT(iv.lp_item_id)) " .
"FROM $tbl_learnpath_item_view iv " . "FROM $tbl_learnpath_item_view iv " .
@ -157,11 +131,11 @@ if($is_allowedToTrack && $_configuration['tracking_enabled'])
// calculation & bgcolor setting // calculation & bgcolor setting
$lpath_pct_completed = empty($total_lpath_items) ? "-" : round(($total_lpath_items_completed / $total_lpath_items) * 100); $lpath_pct_completed = empty($total_lpath_items) ? "-" : round(($total_lpath_items_completed / $total_lpath_items) * 100);
//--------------------------------END % visited // END % visited
//--------------------------------BEGIN first/last access // BEGIN first/last access
// first access // first access
$sql = "SELECT access_date FROM $TABLETRACK_ACCESS_2 WHERE access_user_id = '".$results[$j][0]."' AND access_cours_code = '".$_course['official_code']."' AND access_tool = 'learnpath' AND access_session_id = '".api_get_session_id()."' ORDER BY access_id ASC LIMIT 1"; $sql = "SELECT access_date FROM $TABLETRACK_ACCESS_2 WHERE access_user_id = '".$results[$j][0]."' AND access_cours_code = '".$_course['official_code']."' AND access_tool = 'learnpath' AND access_session_id = '".api_get_session_id()."' ORDER BY access_id ASC LIMIT 1";
$first_access = getOneResult($sql); $first_access = getOneResult($sql);
@ -171,14 +145,14 @@ if($is_allowedToTrack && $_configuration['tracking_enabled'])
$sql = "SELECT access_date FROM $TABLETRACK_ACCESS WHERE access_user_id = '".$results[$j][0]."' AND access_cours_code = '".$_course['official_code']."' AND access_tool = 'learnpath'"; $sql = "SELECT access_date FROM $TABLETRACK_ACCESS WHERE access_user_id = '".$results[$j][0]."' AND access_cours_code = '".$_course['official_code']."' AND access_tool = 'learnpath'";
$last_access = getOneResult($sql); $last_access = getOneResult($sql);
$last_access = empty($last_access) ? "-" : date('d.m.y',strtotime($last_access)); $last_access = empty($last_access) ? "-" : date('d.m.y',strtotime($last_access));
//--------------------------------END first/last access // END first/last access
//--------------------------------BEGIN presentation of data // BEGIN presentation of data
$line .= $results[$j][1]." ".$results[$j][2].";".$first_access.";".$last_access.";".$lpath_pct_completed."\n"; $line .= $results[$j][1]." ".$results[$j][2].";".$first_access.";".$last_access.";".$lpath_pct_completed."\n";
//--------------------------------END presentation of data // END presentation of data
@ -194,11 +168,7 @@ if($is_allowedToTrack && $_configuration['tracking_enabled'])
/*************************************************************************** /* Main */
*
* Main
*
***************************************************************************/
$tempView = $view; $tempView = $view;
if($view[0] == '1') if($view[0] == '1')
@ -217,11 +187,7 @@ if($is_allowedToTrack && $_configuration['tracking_enabled'])
} }
/*************************************************************************** /* Access to this course */
*
* Access to this course
*
***************************************************************************/
$tempView = $view; $tempView = $view;
if($view[1] == '1'){ if($view[1] == '1'){
@ -274,11 +240,7 @@ if($is_allowedToTrack && $_configuration['tracking_enabled'])
/*************************************************************************** /* Tools */
*
* Tools
*
***************************************************************************/
$tempView = $view; $tempView = $view;
if($view[2] == '1'){ if($view[2] == '1'){
@ -313,11 +275,7 @@ if($is_allowedToTrack && $_configuration['tracking_enabled'])
} }
/*************************************************************************** /* Links */
*
* Links
*
***************************************************************************/
$tempView = $view; $tempView = $view;
if($view[3] == '1'){ if($view[3] == '1'){
@ -352,11 +310,7 @@ if($is_allowedToTrack && $_configuration['tracking_enabled'])
} }
/*************************************************************************** /* Documents */
*
* Documents
*
***************************************************************************/
$tempView = $view; $tempView = $view;
if($view[4] == '1'){ if($view[4] == '1'){
@ -390,11 +344,7 @@ if($is_allowedToTrack && $_configuration['tracking_enabled'])
} }
/*************************************************************************** /* Scorm contents and Learning Path */
*
* Scorm contents and Learning Path
*
***************************************************************************/
$tempView = $view; $tempView = $view;
if($view[5] == '1'){ if($view[5] == '1'){
@ -455,9 +405,8 @@ if($is_allowedToTrack && $_configuration['tracking_enabled'])
$ar3=Database::fetch_array($result3); $ar3=Database::fetch_array($result3);
$title_line .= get_lang('ScormTitleColumn').";".get_lang('ScormStatusColumn').";".get_lang('ScormScoreColumn').";".get_lang('ScormTimeColumn'); $title_line .= get_lang('ScormTitleColumn').";".get_lang('ScormStatusColumn').";".get_lang('ScormScoreColumn').";".get_lang('ScormTimeColumn');
while ($ar3['status'] != '') { while ($ar3['status'] != '') {
require_once('../newscorm/learnpathItem.class.php'); require_once '../newscorm/learnpathItem.class.php';
$time = learnpathItem::get_scorm_time('php',$ar3['total_time']); $time = learnpathItem::get_scorm_time('php',$ar3['total_time']);
$title = api_htmlentities($ar3['title'],ENT_QUOTES,$lp_charset);
$line .= $title.";".$ar3['status'].";".$ar3['score'].";".$time; $line .= $title.";".$ar3['status'].";".$ar3['score'].";".$time;
$ar3=Database::fetch_array($result3); $ar3=Database::fetch_array($result3);
} }
@ -482,17 +431,17 @@ if($is_allowedToTrack && $_configuration['tracking_enabled'])
} }
/***************************************************************************
*
* Export to a CSV file
* force the browser to save the file instead of opening it
***************************************************************************/
/*
* Export to a CSV file
* Force the browser to save the file instead of opening it.
*/
$len = strlen($title_line.$line); $len = strlen($title_line.$line);
header('Content-type: application/octet-stream'); header('Content-type: application/octet-stream');
//header('Content-Type: application/force-download'); //header('Content-Type: application/force-download');
header('Content-length: '.$len); header('Content-length: '.$len);
$filename = html_entity_decode(str_replace(":","",str_replace(" ","_", $title[0].'_'.$title[1].'.csv'))); $filename = api_html_entity_decode(str_replace(":","",str_replace(" ","_", $title[0].'_'.$title[1].'.csv')));
$filename = replace_dangerous_char($filename);
if(preg_match("/MSIE 5.5/",$_SERVER['HTTP_USER_AGENT'])) if(preg_match("/MSIE 5.5/",$_SERVER['HTTP_USER_AGENT']))
{ {
header('Content-Disposition: filename= '.$filename); header('Content-Disposition: filename= '.$filename);
@ -510,12 +459,11 @@ if($is_allowedToTrack && $_configuration['tracking_enabled'])
header('Content-Description: '.$filename); header('Content-Description: '.$filename);
header('Content-transfer-encoding: binary'); header('Content-transfer-encoding: binary');
echo api_html_entity_decode($title_line, ENT_COMPAT, $charset); echo api_html_entity_decode($title_line, ENT_COMPAT);
echo api_html_entity_decode($line, ENT_COMPAT, $charset); echo api_html_entity_decode($line, ENT_COMPAT);
exit; exit;
} }
// not allowed // not allowed
else else
@ -529,4 +477,3 @@ else
api_not_allowed(); api_not_allowed();
} }
} }
?>

@ -1,4 +1,4 @@
<?php // $Id: userLog.php 21626 2009-06-26 12:19:41Z pcool $ <?php
/* For licensing terms, see /license.txt */ /* For licensing terms, see /license.txt */
// TODO: Is this file deprecated? // TODO: Is this file deprecated?
@ -17,8 +17,8 @@ $view = $_REQUEST['view'];
// name of the language file that needs to be included // name of the language file that needs to be included
$language_file = 'tracking'; $language_file = 'tracking';
// including the global Dokeos file // Including the global initialization file
//include('../inc/global.inc.php'); require_once '../inc/global.inc.php';
// the section (for the tabs) // the section (for the tabs)
$this_section = "session_my_space"; $this_section = "session_my_space";
@ -29,34 +29,15 @@ $course_id = api_get_course_id();
//YW Hack security to quick fix RolesRights bug //YW Hack security to quick fix RolesRights bug
$is_allowed = true; $is_allowed = true;
/*
-----------------------------------------------------------
Libraries
-----------------------------------------------------------
*/
include(api_get_path(LIBRARY_PATH).'statsUtils.lib.inc.php');
include(api_get_path(LIBRARY_PATH).'course.lib.php');
include(api_get_path(SYS_CODE_PATH).'resourcelinker/resourcelinker.inc.php');
require_once(api_get_path(SYS_CODE_PATH).'exercice/hotpotatoes.lib.php');
/* /* Libraries */
-----------------------------------------------------------
Header require_once api_get_path(LIBRARY_PATH).'statsUtils.lib.inc.php';
----------------------------------------------------------- require_once api_get_path(LIBRARY_PATH).'course.lib.php';
*/ require_once api_get_path(SYS_CODE_PATH).'resourcelinker/resourcelinker.inc.php';
// charset determination require_once api_get_path(SYS_CODE_PATH).'exercice/hotpotatoes.lib.php';
if (isset($_GET['scormcontopen'])) {
$tbl_lp = Database::get_course_table(TABLE_LP_MAIN); /* Header */
$contopen = Database::escape_string($_GET['scormcontopen']);
if (is_numeric($contopen)) {
$contopen = intval($contopen);
$sql = "SELECT default_encoding FROM $tbl_lp WHERE id = ".$contopen;
$res = Database::query($sql);
$row = Database::fetch_array($res);
$lp_charset = $row['default_encoding'];
}
//header('Content-Type: text/html; charset='. $row['default_encoding']);
}
/* /*
$interbreadcrumb[]= array ("url"=>"../group/group.php", "name"=> get_lang('BredCrumpGroups')); $interbreadcrumb[]= array ("url"=>"../group/group.php", "name"=> get_lang('BredCrumpGroups'));
@ -84,11 +65,8 @@ td {border-bottom: thin dashed gray;}
Display::display_header($nameTools,"Tracking"); Display::display_header($nameTools,"Tracking");
/* /* Constants and variables */
-----------------------------------------------------------
Constants and variables
-----------------------------------------------------------
*/
$is_allowedToTrack = $is_courseAdmin; $is_allowedToTrack = $is_courseAdmin;
$is_course_member = CourseManager::is_user_subscribed_in_real_or_linked_course($user_id, $course_id); $is_course_member = CourseManager::is_user_subscribed_in_real_or_linked_course($user_id, $course_id);
@ -146,11 +124,7 @@ $MonthsShort = api_get_months_short();
$is_allowedToTrack = true; // allowed to track only user of one group $is_allowedToTrack = true; // allowed to track only user of one group
$is_allowedToTrackEverybodyInCourse = $is_allowedToTrack; // allowed to track all students in course $is_allowedToTrackEverybodyInCourse = $is_allowedToTrack; // allowed to track all students in course
/* /* MAIN SECTION */
==============================================================================
MAIN SECTION
==============================================================================
*/
?> ?>
<h3> <h3>
<?php echo $nameTools ?> <?php echo $nameTools ?>
@ -163,11 +137,9 @@ $is_allowedToTrackEverybodyInCourse = $is_allowedToTrack; // allowed to track al
// check if uid is tutor of this group // check if uid is tutor of this group
if( ( $is_allowedToTrack || $is_allowedToTrackEverybodyInCourse ) && $_configuration['tracking_enabled'] ) { if( ( $is_allowedToTrack || $is_allowedToTrackEverybodyInCourse ) && $_configuration['tracking_enabled'] ) {
if(!$uInfo && !isset($uInfo) ) { if(!$uInfo && !isset($uInfo) ) {
/*************************************************************************** /*
*
* Display list of user of this group * Display list of user of this group
* */
***************************************************************************/
echo "<h4>".get_lang('ListStudents')."</h4>"; echo "<h4>".get_lang('ListStudents')."</h4>";
if( $is_allowedToTrackEverybodyInCourse ) { if( $is_allowedToTrackEverybodyInCourse ) {
@ -257,11 +229,9 @@ if( ( $is_allowedToTrack || $is_allowedToTrackEverybodyInCourse ) && $_configura
} else { } else {
// if uInfo is set // if uInfo is set
/*************************************************************************** /*
*
* Informations about student uInfo * Informations about student uInfo
* */
***************************************************************************/
// these checks exists for security reasons, neither a prof nor a tutor can see statistics of a user from // these checks exists for security reasons, neither a prof nor a tutor can see statistics of a user from
// another course, or group // another course, or group
if( $is_allowedToTrackEverybodyInCourse ) { if( $is_allowedToTrackEverybodyInCourse ) {
@ -326,11 +296,9 @@ if( ( $is_allowedToTrack || $is_allowedToTrackEverybodyInCourse ) && $_configura
} }
/*************************************************************************** /*
*
* Scorm contents and Learning Path * Scorm contents and Learning Path
* */
***************************************************************************/
if(substr($view,5,1) == '1') { if(substr($view,5,1) == '1') {
$new_view = substr_replace($view,'0',5,1); $new_view = substr_replace($view,'0',5,1);
echo "<tr> echo "<tr>
@ -380,9 +348,8 @@ if( ( $is_allowedToTrack || $is_allowedToTrackEverybodyInCourse ) && $_configura
</td> </td>
</tr>"; </tr>";
while ($ar3['status'] != '') { while ($ar3['status'] != '') {
require_once('../newscorm/learnpathItem.class.php'); require_once '../newscorm/learnpathItem.class.php';
$time = learnpathItem::get_scorm_time('php',$ar3['total_time']); $time = learnpathItem::get_scorm_time('php',$ar3['total_time']);
$title = api_htmlentities($ar3['title'],ENT_QUOTES,$lp_charset);
echo "<tr><td>&nbsp;&nbsp;&nbsp;</td><td>"; echo "<tr><td>&nbsp;&nbsp;&nbsp;</td><td>";
echo "$title</td><td align=right>{$ar3['status']}</td><td align=right>{$ar3['score']}</td><td align=right>$time</td>"; echo "$title</td><td align=right>{$ar3['status']}</td><td align=right>{$ar3['score']}</td><td align=right>$time</td>";
echo "</tr>"; echo "</tr>";
@ -432,4 +399,3 @@ if( ( $is_allowedToTrack || $is_allowedToTrackEverybodyInCourse ) && $_configura
</table> </table>
<?php <?php
Display::display_footer(); Display::display_footer();
?>

@ -3,23 +3,18 @@
// TODO: Is this file deprecated? // TODO: Is this file deprecated?
/** /**
============================================================================== * @package chamilo.tracking
* @package dokeos.tracking * @todo clean code - structure is unclear and difficult to modify
* @todo clean code - structure is unclear and difficult to modify */
==============================================================================
*/ /* INIT SECTION */
/*
==============================================================================
INIT SECTION
==============================================================================
*/
$uInfo = $_REQUEST['uInfo']; $uInfo = $_REQUEST['uInfo'];
$view = $_REQUEST['view']; $view = $_REQUEST['view'];
// name of the language file that needs to be included // name of the language file that needs to be included
$language_file = 'tracking'; $language_file = 'tracking';
include('../inc/global.inc.php'); require_once '../inc/global.inc.php';
// Roles and rights system // Roles and rights system
$user_id = api_get_user_id(); $user_id = api_get_user_id();
@ -35,33 +30,15 @@ RolesRights::protect_location($role_id, $location_id);
*/ */
//YW Hack security to quick fix RolesRights bug //YW Hack security to quick fix RolesRights bug
$is_allowed = true; $is_allowed = true;
/*
-----------------------------------------------------------
Libraries
-----------------------------------------------------------
*/
include(api_get_path(LIBRARY_PATH).'statsUtils.lib.inc.php');
include(api_get_path(LIBRARY_PATH).'course.lib.php');
include(api_get_path(SYS_CODE_PATH).'resourcelinker/resourcelinker.inc.php');
require_once(api_get_path(SYS_CODE_PATH).'exercice/hotpotatoes.lib.php');
/* /* Libraries */
-----------------------------------------------------------
Header
-----------------------------------------------------------
*/
// charset determination
if ($_GET['scormcontopen'])
{
$tbl_lp = Database::get_course_table(TABLE_LP_MAIN);
$contopen = (int) $_GET['scormcontopen'];
$sql = "SELECT default_encoding FROM $tbl_lp WHERE id = ".$contopen;
$res = Database::query($sql);
$row = Database::fetch_array($res);
$lp_charset = $row['default_encoding'];
//header('Content-Type: text/html; charset='. $row['default_encoding']);
}
require_once api_get_path(LIBRARY_PATH).'statsUtils.lib.inc.php';
require_once api_get_path(LIBRARY_PATH).'course.lib.php';
require_once api_get_path(SYS_CODE_PATH).'resourcelinker/resourcelinker.inc.php';
require_once api_get_path(SYS_CODE_PATH).'exercice/hotpotatoes.lib.php';
/* Header */
/* /*
$interbreadcrumb[]= array ("url"=>"../group/group.php", "name"=> get_lang('BredCrumpGroups')); $interbreadcrumb[]= array ("url"=>"../group/group.php", "name"=> get_lang('BredCrumpGroups'));
@ -75,12 +52,8 @@ if($uInfo)
$nameTools = get_lang('ToolName'); $nameTools = get_lang('ToolName');
/* Constants and variables */
/*
-----------------------------------------------------------
Constants and variables
-----------------------------------------------------------
*/
$is_allowedToTrack = $is_courseAdmin; $is_allowedToTrack = $is_courseAdmin;
$is_course_member = CourseManager::is_user_subscribed_in_real_or_linked_course($user_id, $course_id); $is_course_member = CourseManager::is_user_subscribed_in_real_or_linked_course($user_id, $course_id);
@ -140,11 +113,8 @@ $MonthsShort = api_get_months_short();
$is_allowedToTrack = true; // allowed to track only user of one group $is_allowedToTrack = true; // allowed to track only user of one group
$is_allowedToTrackEverybodyInCourse = $is_allowedToTrack; // allowed to track all students in course $is_allowedToTrackEverybodyInCourse = $is_allowedToTrack; // allowed to track all students in course
/* /* MAIN SECTION */
==============================================================================
MAIN SECTION
==============================================================================
*/
$title[0]=''; $title[0]='';
$title[1]=''; $title[1]='';
$line=''; $line='';
@ -155,11 +125,9 @@ if( ( $is_allowedToTrack || $is_allowedToTrackEverybodyInCourse ) && $_configura
{ {
if(!$uInfo && !isset($uInfo) ) if(!$uInfo && !isset($uInfo) )
{ {
/*************************************************************************** /*
*
* Display list of user of this group * Display list of user of this group
* */
***************************************************************************/
if( $is_allowedToTrackEverybodyInCourse ) if( $is_allowedToTrackEverybodyInCourse )
{ {
@ -240,11 +208,9 @@ if( ( $is_allowedToTrack || $is_allowedToTrackEverybodyInCourse ) && $_configura
} }
else // if uInfo is set else // if uInfo is set
{ {
/*************************************************************************** /*
*
* Informations about student uInfo * Informations about student uInfo
* */
***************************************************************************/
// these checks exists for security reasons, neither a prof nor a tutor can see statistics of a user from // these checks exists for security reasons, neither a prof nor a tutor can see statistics of a user from
// another course, or group // another course, or group
if( $is_allowedToTrackEverybodyInCourse ) if( $is_allowedToTrackEverybodyInCourse )
@ -301,11 +267,9 @@ if( ( $is_allowedToTrack || $is_allowedToTrackEverybodyInCourse ) && $_configura
} }
/*************************************************************************** /*
*
* Scorm contents and Learning Path * Scorm contents and Learning Path
* */
***************************************************************************/
//TODO: scorm tools is in work and the logs will change in few days... //TODO: scorm tools is in work and the logs will change in few days...
/*if(substr($view,5,1) == '1') /*if(substr($view,5,1) == '1')
{ {
@ -338,7 +302,6 @@ if( ( $is_allowedToTrack || $is_allowedToTrackEverybodyInCourse ) && $_configura
while ($ar3['status'] != '') { while ($ar3['status'] != '') {
require_once('../newscorm/learnpathItem.class.php'); require_once('../newscorm/learnpathItem.class.php');
$time = learnpathItem::get_scorm_time('php',$ar3['total_time']); $time = learnpathItem::get_scorm_time('php',$ar3['total_time']);
$title = api_htmlentities($ar3['title'],ENT_QUOTES,$lp_charset);
$line .= $title.';'.$ar3['status'].';'.$ar3['score'].';'.$time."\n"; $line .= $title.';'.$ar3['status'].';'.$ar3['score'].';'.$time."\n";
$ar3=Database::fetch_array($result3); $ar3=Database::fetch_array($result3);
} }
@ -365,17 +328,17 @@ if( ( $is_allowedToTrack || $is_allowedToTrackEverybodyInCourse ) && $_configura
}*/ }*/
} }
/*************************************************************************** /*
*
* Export to a CSV file * Export to a CSV file
* force the browser to save the file instead of opening it * force the browser to save the file instead of opening it
***************************************************************************/ */
$len = strlen($title_line.$line); $len = strlen($title_line.$line);
header('Content-type: application/octet-stream'); header('Content-type: application/octet-stream');
//header('Content-Type: application/force-download'); //header('Content-Type: application/force-download');
header('Content-length: '.$len); header('Content-length: '.$len);
$filename = html_entity_decode(str_replace(":","",str_replace(" ","_", $title[0].'_'.$title[1].'.csv'))); $filename = html_entity_decode(str_replace(":","",str_replace(" ","_", $title[0].'_'.$title[1].'.csv')));
$filename = replace_dangerous_char($filename);
if(preg_match("/MSIE 5.5/",$_SERVER['HTTP_USER_AGENT'])) if(preg_match("/MSIE 5.5/",$_SERVER['HTTP_USER_AGENT']))
{ {
header('Content-Disposition: filename= '.$filename); header('Content-Disposition: filename= '.$filename);

Loading…
Cancel
Save