Removing $_configuration['tracking_enabled'] because its always true see #2808

skala
Julio Montoya 15 years ago
parent b61c08c4ce
commit 0a9c787fe5
  1. 8
      main/admin/statistics/index.php
  2. 27
      main/admin/user_list.php
  3. 111
      main/exercice/mark_free_answer.php
  4. 7
      main/exercice/savescores.php
  5. 2
      main/inc/global.inc.php
  6. 29
      main/inc/local.inc.php
  7. 2
      main/newscorm/lp_ajax_save_item.php
  8. 2
      main/newscorm/lp_comm.server.php
  9. 21
      main/tracking/courseLogCSV.php
  10. 17
      main/tracking/course_access_details.php
  11. 9
      main/tracking/logins_details.php
  12. 24
      main/tracking/personnalLog.php
  13. 15
      main/tracking/toolaccess_details.php
  14. 7
      main/tracking/userLog.php
  15. 11
      main/tracking/userlogCSV.php
  16. 2
      main/user/user.php
  17. 26
      main/user/userInfo.php

@ -18,13 +18,7 @@ $tool_name = get_lang('Statistics');
Display::display_header($tool_name);
api_display_tool_title($tool_name);
if (!$_configuration['tracking_enabled']) {
Display::display_warning_message(get_lang('TrackingDisabled'));
Display::display_footer();
exit;
}
require_once ('statistics.lib.php');
require_once 'statistics.lib.php';
$strCourse = get_lang('Courses');
$strUsers = get_lang('Users');

@ -252,23 +252,16 @@ function login_user($user_id) {
$uidReset = false;
if ($user_id) { // a uid is given (log in succeeded)
if ($_configuration['tracking_enabled']) {
$sql_query = "SELECT user.*, a.user_id is_admin,
UNIX_TIMESTAMP(login.login_date) login_date
FROM $main_user_table
LEFT JOIN $main_admin_table a
ON user.user_id = a.user_id
LEFT JOIN $track_e_login_table login
ON user.user_id = login.login_user_id
WHERE user.user_id = '".$user_id."'
ORDER BY login.login_date DESC LIMIT 1";
} else {
$sql_query = "SELECT user.*, a.user_id is_admin
FROM $main_user_table
LEFT JOIN $main_admin_table a
ON user.user_id = a.user_id
WHERE user.user_id = '".$user_id."'";
}
$sql_query = "SELECT user.*, a.user_id is_admin,
UNIX_TIMESTAMP(login.login_date) login_date
FROM $main_user_table
LEFT JOIN $main_admin_table a
ON user.user_id = a.user_id
LEFT JOIN $track_e_login_table login
ON user.user_id = login.login_user_id
WHERE user.user_id = '".$user_id."'
ORDER BY login.login_date DESC LIMIT 1";
$sql_result = Database::query($sql_query);

@ -103,70 +103,61 @@ $interbreadcrumb[]=array("url" => "exercice.php","name" => get_lang('Exercices')
$my_msg = 'No change.';
if($action == 'mark'){
if (!empty($_POST['score']) AND $_POST['score'] < $obj_question->selectWeighting() AND $_POST['score'] >= 0){
if ($action == 'mark') {
if (!empty($_POST['score']) AND $_POST['score'] < $obj_question->selectWeighting() AND $_POST['score'] >= 0) {
//mark the user mark into the database using something similar to the following function:
global $_configuration;
if($_configuration['tracking_enabled'])
{
$exercise_table = Database::get_statistic_table('track_e_exercices');
#$tbl_learnpath_user = Database::get_course_table('learnpath_user');
#global $origin, $tbl_learnpath_user, $learnpath_id, $learnpath_item_id;
$sql = "SELECT * FROM $exercise_table
WHERE exe_user_id = '".Database::escape_string($my_usr)."' AND exe_cours_id = '".Database::escape_string($my_cid)."' AND exe_exo_id = '".Database::escape_string($my_exe)."'
ORDER BY exe_date DESC";
$exercise_table = Database::get_statistic_table('track_e_exercices');
#$tbl_learnpath_user = Database::get_course_table('learnpath_user');
#global $origin, $tbl_learnpath_user, $learnpath_id, $learnpath_item_id;
$sql = "SELECT * FROM $exercise_table
WHERE exe_user_id = '".Database::escape_string($my_usr)."' AND exe_cours_id = '".Database::escape_string($my_cid)."' AND exe_exo_id = '".Database::escape_string($my_exe)."'
ORDER BY exe_date DESC";
#echo $sql;
$res = Database::query($sql);
if(Database::num_rows($res)>0){
$row = Database::fetch_array($res);
//@todo Check that just summing past score and the new free answer mark doesn't come up
// with a score higher than the possible score for that exercise
$my_score = $row['exe_result'] + $_POST['score'];
$sql = "UPDATE $exercise_table SET exe_result = '$my_score'
WHERE exe_id = '".$row['exe_id']."'";
#echo $sql;
$res = Database::query($sql);
if(Database::num_rows($res)>0){
$row = Database::fetch_array($res);
//@todo Check that just summing past score and the new free answer mark doesn't come up
// with a score higher than the possible score for that exercise
$my_score = $row['exe_result'] + $_POST['score'];
$sql = "UPDATE $exercise_table SET exe_result = '$my_score'
WHERE exe_id = '".$row['exe_id']."'";
#echo $sql;
$res = Database::query($sql);
$my_msg = get_lang('MarkIsUpdated');
}else{
$my_score = $_POST['score'];
$reallyNow = time();
$sql = "INSERT INTO $exercise_table
(
exe_user_id,
exe_cours_id,
exe_exo_id,
exe_result,
exe_weighting,
exe_date
)
VALUES
(
'".Database::escape_string($my_usr)."',
'".Database::escape_string($my_cid)."',
'".Database::escape_string($my_exe)."',
'".Database::escape_string($my_score)."',
'".Database::escape_string($obj_question->selectWeighting())."',
FROM_UNIXTIME(".$reallyNow.")
)";
#if ($origin == 'learnpath')
#{
# if ($user_id == "NULL")
# {
# $user_id = '0';
# }
# $sql2 = "update $tbl_learnpath_user set score='$score' where (user_id=$user_id and learnpath_id='$learnpath_id' and learnpath_item_id='$learnpath_item_id')";
# $res2 = Database::query($sql2);
#}
$res = Database::query($sql);
$my_msg = get_lang('MarkInserted');
}
//Database::query($sql);
//return 0;
$my_msg = get_lang('MarkIsUpdated');
}else{
$my_score = $_POST['score'];
$reallyNow = time();
$sql = "INSERT INTO $exercise_table (
exe_user_id,
exe_cours_id,
exe_exo_id,
exe_result,
exe_weighting,
exe_date
) VALUES (
'".Database::escape_string($my_usr)."',
'".Database::escape_string($my_cid)."',
'".Database::escape_string($my_exe)."',
'".Database::escape_string($my_score)."',
'".Database::escape_string($obj_question->selectWeighting())."',
FROM_UNIXTIME(".$reallyNow.")
)";
#if ($origin == 'learnpath')
#{
# if ($user_id == "NULL")
# {
# $user_id = '0';
# }
# $sql2 = "update $tbl_learnpath_user set score='$score' where (user_id=$user_id and learnpath_id='$learnpath_id' and learnpath_item_id='$learnpath_item_id')";
# $res2 = Database::query($sql2);
#}
$res = Database::query($sql);
$my_msg = get_lang('MarkInserted');
}
}else{
//Database::query($sql);
//return 0;
} else {
$my_msg .= get_lang('TotalScoreTooBig');
}
}

@ -50,18 +50,13 @@ $jscript2run = '';
* @return void
*/
function save_scores($file, $score) {
global $_configuration, $origin,
$_user, $_cid,
global $origin, $_user, $_cid,
$TABLETRACK_HOTPOTATOES;
// if tracking is disabled record nothing
$weighting = 100; // 100%
$reallyNow = time();
$date = date("Y-m-d H:i:s", $reallyNow);
if (!$_configuration['tracking_enabled']) {
return 0;
}
if ($_user['user_id']) {
$user_id = $_user['user_id'];
} else {

@ -517,7 +517,7 @@ $text_dir = api_get_text_direction();
//Update of the logout_date field in the table track_e_login (needed for the calculation of the total connection time)
if ($_configuration['tracking_enabled'] && !isset($_SESSION['login_as']) && isset($_user)) {
if (!isset($_SESSION['login_as']) && isset($_user)) {
// if $_SESSION['login_as'] is set, then the user is an admin logged as the user
$tbl_track_login = Database :: get_statistic_table(TABLE_STATISTIC_TRACK_E_LOGIN);

@ -585,22 +585,15 @@ if (isset($uidReset) && $uidReset) { // session data refresh requested
{
$user_table = Database::get_main_table(TABLE_MAIN_USER);
$admin_table = Database::get_main_table(TABLE_MAIN_ADMIN);
if ($_configuration['tracking_enabled']) {
$sql = "SELECT user.*, a.user_id is_admin, UNIX_TIMESTAMP(login.login_date) login_date
FROM $user_table
LEFT JOIN $admin_table a
ON user.user_id = a.user_id
LEFT JOIN ".$_configuration['statistics_database'].".track_e_login login
ON user.user_id = login.login_user_id
WHERE user.user_id = '".$_user['user_id']."'
ORDER BY login.login_date DESC LIMIT 1";
} else {
$sql = "SELECT user.*, a.user_id is_admin
FROM $user_table
LEFT JOIN $admin_table a
ON user.user_id = a.user_id
WHERE user.user_id = '".$_user['user_id']."'";
}
$sql = "SELECT user.*, a.user_id is_admin, UNIX_TIMESTAMP(login.login_date) login_date
FROM $user_table
LEFT JOIN $admin_table a
ON user.user_id = a.user_id
LEFT JOIN ".$_configuration['statistics_database'].".track_e_login login
ON user.user_id = login.login_user_id
WHERE user.user_id = '".$_user['user_id']."'
ORDER BY login.login_date DESC LIMIT 1";
$result = Database::query($sql);
@ -707,7 +700,7 @@ if (isset($cidReset) && $cidReset) { // course session data refresh requested or
}
}
if ($_configuration['tracking_enabled'] && !isset($_SESSION['login_as'])) {
if (!isset($_SESSION['login_as'])) {
//We add a new record in the course tracking table
$course_tracking_table = Database :: get_statistic_table(TABLE_STATISTIC_TRACK_E_COURSE_ACCESS);
$time = api_get_datetime();
@ -760,7 +753,7 @@ if (isset($cidReset) && $cidReset) { // course session data refresh requested or
list($_SESSION['session_name']) = Database::fetch_array($rs);
}
if ($_configuration['tracking_enabled'] && !isset($_SESSION['login_as'])) {
if (!isset($_SESSION['login_as'])) {
$course_tracking_table = Database :: get_statistic_table(TABLE_STATISTIC_TRACK_E_COURSE_ACCESS);
if (isset($_configuration['session_lifetime'])) {

@ -179,7 +179,7 @@ function save_item($lp_id, $user_id, $view_id, $item_id, $score = -1, $max = -1,
if ($debug > 1) { error_log('End of save_item()', 0); }
}
if ($_configuration['tracking_enabled'] && !isset($_SESSION['login_as'])) {
if (!isset($_SESSION['login_as'])) {
// If $_SESSION['login_as'] is set, then the user is an admin logged as the user.
$tbl_track_login = Database :: get_statistic_table(TABLE_STATISTIC_TRACK_E_LOGIN);

@ -163,7 +163,7 @@ function save_item($lp_id, $user_id, $view_id, $item_id, $score = -1, $max = -1,
if ($debug > 1) { error_log('End of xajax_save_item()', 0); }
}
if ($_configuration['tracking_enabled'] && !isset($_SESSION['login_as'])) {
if (!isset($_SESSION['login_as'])) {
// If $_SESSION['login_as'] is set, then the user is an admin logged as the user.
$tbl_track_login = Database :: get_statistic_table(TABLE_STATISTIC_TRACK_E_LOGIN);

@ -72,8 +72,7 @@ $title[0]=get_lang('StatsOfCourse')." : ".$_course['official_code'];
// check if uid is prof of this group
if($is_allowedToTrack && $_configuration['tracking_enabled'])
{
if ($is_allowedToTrack) {
// show all : view must be equal to the sum of all view values (1024+512+...+64)
// show none : less than the tiniest value
/*echo "<div>
@ -463,18 +462,6 @@ if($is_allowedToTrack && $_configuration['tracking_enabled'])
echo api_html_entity_decode($title_line, ENT_COMPAT);
echo api_html_entity_decode($line, ENT_COMPAT);
exit;
}
// not allowed
else
{
if(!$_configuration['tracking_enabled'])
{
echo get_lang('TrackingDisabled');
}
else
{
api_not_allowed();
}
}
} else {
api_not_allowed();
}

@ -58,7 +58,7 @@ $is_allowedToTrack = $is_courseAdmin;
</h3>
<table width="100%" cellpadding="2" cellspacing="3" border="0">
<?php
if( $is_allowedToTrack && $_configuration['tracking_enabled'])
if ($is_allowedToTrack)
{
if( !isset($reqdate) || $reqdate < 0 || $reqdate > 2149372861 )
$reqdate = time();
@ -210,22 +210,9 @@ $is_allowedToTrack = $is_courseAdmin;
}
else // not allowed to track
{
if(!$_configuration['tracking_enabled'])
{
echo get_lang('TrackingDisabled');
}
else
{
api_not_allowed();
}
}
?>
</table>
<?php
Display::display_footer();
?>
Display::display_footer();

@ -76,7 +76,7 @@ $is_allowedToTrackEverybodyInCourse = $is_courseAdmin; // allowed to track all s
<?php
// check if uid is tutor of this group
if( ( $is_allowedToTrack || $is_allowedToTrackEverybodyInCourse ) && $_configuration['tracking_enabled'] )
if( ( $is_allowedToTrack || $is_allowedToTrackEverybodyInCourse ))
{
if( $is_allowedToTrackEverybodyInCourse )
{
@ -246,14 +246,7 @@ if( ( $is_allowedToTrack || $is_allowedToTrackEverybodyInCourse ) && $_configura
// not allowed
else
{
if(!$_configuration['tracking_enabled'])
{
echo get_lang('TrackingDisabled');
}
else
{
api_not_allowed();
}
}
?>

@ -60,15 +60,10 @@ include(api_get_path(LIBRARY_PATH)."statsUtils.lib.inc.php");
Display::display_header($nameTools,"Tracking");
api_display_tool_title($nameTools);
/*
==============================================================================
MAIN SECTION
==============================================================================
*/
if ( $_configuration['tracking_enabled'] )
{
// show all : view must be equal to the sum of all view values (1024+512+...+64)
// show none : 0
/* MAIN SECTION */
// show all : view must be equal to the sum of all view values (1024+512+...+64)
// show none : 0
echo "
<table width=\"100%\" cellpadding=\"2\" cellspacing=\"0\" border=\"0\">
@ -277,12 +272,5 @@ if ( $_configuration['tracking_enabled'] )
";
}
*/
echo "\n</table>";
}
else
{
echo get_lang('TrackingDisabled');
}
Display::display_footer();
?>
echo "</table>";
Display::display_footer();

@ -88,7 +88,7 @@ $reqdate=$_REQUEST['reqdate'];
$is_allowedToTrack = $is_platformAdmin;
$courseCodeEqualcidIfNeeded = "";
}
if( $is_allowedToTrack && $_configuration['tracking_enabled'])
if( $is_allowedToTrack)
{
// list of all tools
if (!isset($tool))
@ -268,17 +268,8 @@ $reqdate=$_REQUEST['reqdate'];
break;
}
}
}
else // not allowed to track
{
if(!$_configuration['tracking_enabled'])
{
echo $langTrackingDisabled;
}
else
{
echo get_lang('NotAllowed');
}
} else { // not allowed to track
echo get_lang('NotAllowed');
}
echo '</table>';
// footer

@ -134,7 +134,7 @@ $is_allowedToTrackEverybodyInCourse = $is_allowedToTrack; // allowed to track al
<table width="100%" cellpadding="2" cellspacing="3" border="0">
<?php
// check if uid is tutor of this group
if( ( $is_allowedToTrack || $is_allowedToTrackEverybodyInCourse ) && $_configuration['tracking_enabled'] ) {
if( ( $is_allowedToTrack || $is_allowedToTrackEverybodyInCourse )) {
if(!$uInfo && !isset($uInfo) ) {
/*
* Display list of user of this group
@ -387,12 +387,7 @@ if( ( $is_allowedToTrack || $is_allowedToTrackEverybodyInCourse ) && $_configura
}
} else {
// not allowed
if(!$_configuration['tracking_enabled'])
{
echo get_lang('TrackingDisabled');
} else {
api_not_allowed();
}
}
?>
</table>

@ -122,7 +122,7 @@ $line='';
$title_line='';
// check if uid is tutor of this group
if( ( $is_allowedToTrack || $is_allowedToTrackEverybodyInCourse ) && $_configuration['tracking_enabled'] )
if( ( $is_allowedToTrack || $is_allowedToTrackEverybodyInCourse))
{
if(!$uInfo && !isset($uInfo) )
{
@ -366,12 +366,5 @@ if( ( $is_allowedToTrack || $is_allowedToTrackEverybodyInCourse ) && $_configura
// not allowed
else
{
if(!$_configuration['tracking_enabled'])
{
echo get_lang('TrackingDisabled');
}
else
{
api_not_allowed();
}
api_not_allowed();
}

@ -312,7 +312,7 @@ if (isset($message)) {
//statistics
event_access_tool(TOOL_USER);
/* Setting the permissions for this page */
$is_allowed_to_track = ($is_courseAdmin || $is_courseTutor) && $_configuration['tracking_enabled'];
$is_allowed_to_track = ($is_courseAdmin || $is_courseTutor);
// Tool introduction

@ -1,4 +1,4 @@
<?php // $Id: userInfo.php 20951 2009-05-23 19:07:59Z ivantcholakov $
<?php
/* For licensing terms, see /license.txt */
/**
@ -56,13 +56,10 @@ if ($tool_info['visibility'] == 1 ) {
$interbreadcrumb[] = array ('url' => 'user.php', 'name' => get_lang('Users'));
}
if ($origin != 'learnpath')
{ //so we are not in learnpath tool
if ($origin != 'learnpath') { //so we are not in learnpath tool
Display :: display_header($nameTools, "User");
$origin = Security::remove_XSS($_GET['origin']);
}
else
{
} else {
?> <link rel="stylesheet" type="text/css" href="<?php echo api_get_path(WEB_CODE_PATH);?>css/default.css" /> <?php
}
@ -100,22 +97,14 @@ $userIdViewer = $_user['user_id']; // id fo the user currently online
$allowedToEditContent = ($userIdViewer == $userIdViewed) || $is_platformAdmin;
$allowedToEditDef = api_is_allowed_to_edit(null, true);
$is_allowedToTrack = api_is_allowed_to_edit(null, true) && $_configuration['tracking_enabled'];
$is_allowedToTrack = api_is_allowed_to_edit(null, true);
// Library connection
require_once ("userInfoLib.php");
/*
==============================================================================
FUNCTIONS
==============================================================================
*/
/* FUNCTIONS */
/*
==============================================================================
COMMANDS SECTION
==============================================================================
*/
/* COMMANDS SECTION */
$displayMode = "viewContentList";
$removeDef = Security::remove_XSS($_GET['removeDef']);
@ -618,5 +607,4 @@ elseif ($displayMode == "viewContentEdit") {
// Back button for each display mode (bottom)
//echo "<div class=\"actions\"><a href=\"user.php?".api_get_cidreq()."&amp;origin=".$origin."\">".get_lang('BackUser')."</a></div>\n";
/* FOOTER */
Display :: display_footer();
?>
Display :: display_footer();
Loading…
Cancel
Save