[svn r10062] refactoring: replace $is_trackingEnabled with $_configuration['tracking_enabled']

skala
Patrick Cool 18 years ago
parent 27bb2c85e0
commit f8a6334c66
  1. 6
      main/admin/user_list.php
  2. 3
      main/exercice/exercice.php
  3. 48
      main/exercice/exercise_result.php
  4. 5
      main/exercice/mark_free_answer.php
  5. 7
      main/exercice/savescores.php
  6. 128
      main/inc/lib/events.lib.inc.php
  7. 2
      main/inc/local.inc.php
  8. 4
      main/install/configuration.dist.php
  9. 4
      main/tracking/courseLog.php
  10. 4
      main/tracking/course_access_details.php
  11. 4
      main/tracking/logins_details.php
  12. 2
      main/tracking/personnalLog.php
  13. 8
      main/tracking/toolaccess_details.php
  14. 8
      main/tracking/userLog.php
  15. 2
      main/user/user.php
  16. 2
      main/user/userInfo.php

@ -1,6 +1,6 @@
<?php
// $Id: user_list.php 9991 2006-11-15 12:11:22Z pcool $
// $Id: user_list.php 10062 2006-11-20 19:37:38Z pcool $
/*
==============================================================================
Dokeos - elearning and course management software
@ -49,7 +49,7 @@ api_protect_admin_script();
function login_user($user_id)
{
//init ---------------------------------------------------------------------
global $uidReset, $loginFailed, $uidReset, $is_trackingEnabled, $_user;
global $uidReset, $loginFailed, $uidReset, $_configuration, $_user;
global $is_platformAdmin, $is_allowedCreateCourse;
$main_user_table = Database :: get_main_table(MAIN_USER_TABLE);
@ -83,7 +83,7 @@ function login_user($user_id)
if ($user_id) // a uid is given (log in succeeded)
{
if ($is_trackingEnabled)
if ($_configuration['tracking_enabled'])
{
$sql_query = "SELECT user.*, a.user_id is_admin,
UNIX_TIMESTAMP(login.login_date) login_date

@ -718,7 +718,8 @@ if($show == 'test'){
/*****************************************/
// if tracking is enabled
if($is_trackingEnabled){
if($_configuration['tracking_enabled'])
{
?>
<br>
<br>

@ -1,4 +1,4 @@
<?php // $Id: exercise_result.php 9774 2006-10-25 15:13:32Z yannoo $
<?php // $Id: exercise_result.php 10062 2006-11-20 19:37:38Z pcool $
/*
==============================================================================
Dokeos - elearning and course management software
@ -620,22 +620,22 @@ $exerciseTitle=api_parse_tex($exerciseTitle);
$totalWeighting+=$questionWeighting;
//added by priya saini
if($is_trackingEnabled)
{
if($_configuration['tracking_enabled'])
{
if ($answerType==2 )
{
$reply = array_keys($choice);
{
$reply = array_keys($choice);
for ($i=0;$i<sizeof($reply);$i++)
{
$ans = $reply[$i];
exercise_attempt($questionScore,$ans,$quesId,$exeId);
}
{
$ans = $reply[$i];
exercise_attempt($questionScore,$ans,$quesId,$exeId);
}
else if ($answerType==4)
{ $j=3;
for ($i=0;$i<sizeof($choice);$i++,$j++)
{
}
elseif ($answerType==4)
{
$j=3;
for ($i=0;$i<sizeof($choice);$i++,$j++)
{
$val = $choice[$j];
if (preg_match_all ('#<font color="red"><s>([0-9a-z ]*)</s></font>#', $val, $arr1))
$val = $arr1[1][0];
@ -644,25 +644,25 @@ $exerciseTitle=api_parse_tex($exerciseTitle);
$answer = mysql_result($res,0,"position");
exercise_attempt($questionScore,$answer,$quesId,$exeId,$j);
}
}
else if ($answerType==5)
}
}
elseif ($answerType==5)
{
$answer = $choice;
exercise_attempt($questionScore,$answer,$quesId,$exeId);
$answer = $choice;
exercise_attempt($questionScore,$answer,$quesId,$exeId);
}
else if ($answerType==1)
elseif ($answerType==1)
{
$sql = "select id from $table_ans where question_id=$questionId and position=$choice";
$res = api_sql_query($sql, __FILE__, __LINE__);
$answer = mysql_result($res,0,"id");
exercise_attempt($questionScore,$answer,$quesId,$exeId);
}
else
else
{
exercise_attempt($questionScore,$answer,$quesId,$exeId);
}
}
} // end huge foreach() block that loops over all questions
?>
<table width="100%" border="0" cellpadding="3" cellspacing="2">
@ -695,7 +695,7 @@ $exerciseTitle=api_parse_tex($exerciseTitle);
==============================================================================
*/
if($is_trackingEnabled)
if($_configuration['tracking_enabled'])
{
//include(api_get_path(LIBRARY_PATH).'events.lib.inc.php');
event_exercice($objExercise->selectId(),$totalScore,$totalWeighting,$answer,$question_id);

@ -112,8 +112,9 @@ 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 $is_trackingEnabled, $statsDbName;
if($is_trackingEnabled){
global $_configuration, $statsDbName;
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;

@ -50,7 +50,7 @@ $origin = $_REQUEST['origin'];
function save_scores($file, $score)
{
global $is_trackingEnabled, $origin, $tbl_learnpath_user,
global $_configuration, $origin, $tbl_learnpath_user,
$learnpath_id, $learnpath_item_id, $_user, $_cid,
$TABLETRACK_HOTPOTATOES;
// if tracking is disabled record nothing
@ -58,7 +58,10 @@ function save_scores($file, $score)
$reallyNow = time();
$date = date("Y-m-d H:i:s", $reallyNow);
if (!$is_trackingEnabled){return 0;}
if (!$_configuration['tracking_enabled'])
{
return 0;
}
if ($_user['user_id'])
{

@ -65,12 +65,16 @@ $TABLETRACK_LASTACCESS = $statsDbName."`.`track_e_lastaccess"; //for "what's new
*/
function event_open()
{
global $is_trackingEnabled, $_SERVER;
// if tracking is disabled record nothing
if (!$is_trackingEnabled)
return 0;
global $_configuration, $_SERVER;
global $rootWeb;
global $TABLETRACK_OPEN;
// if tracking is disabled record nothing
if (!$_configuration['tracking_enabled'])
{
return 0;
}
// @getHostByAddr($_SERVER['REMOTE_ADDR']) : will provide host and country information
// $_SERVER['HTTP_USER_AGENT'] : will provide browser and os information
// $_SERVER['HTTP_REFERER'] : provide information about refering url
@ -107,12 +111,16 @@ function event_open()
*/
function event_login()
{
global $is_trackingEnabled;
// if tracking is disabled record nothing
if (!$is_trackingEnabled)
return 0;
global $_configuration;
global $_user;
global $TABLETRACK_LOGIN;
// if tracking is disabled record nothing
if (!$_configuration['tracking_enabled'])
{
return 0;
}
$reallyNow = time();
$sql = "INSERT INTO `".$TABLETRACK_LOGIN."`
@ -136,15 +144,18 @@ function event_login()
*/
function event_access_course()
{
global $is_trackingEnabled;
// if tracking is disabled record nothing
if (!$is_trackingEnabled)
return 0;
global $_configuration;
global $_user;
global $_cid;
global $TABLETRACK_ACCESS;
global $TABLETRACK_LASTACCESS; //for "what's new" notification
// if tracking is disabled record nothing
if (!$_configuration['tracking_enabled'])
{
return 0;
}
if(api_get_setting('use_session_mode')=='true' && isset($_SESSION['id_session']))
{
$id_session = intval($_SESSION['id_session']);
@ -208,9 +219,9 @@ function event_access_course()
*/
function event_access_tool($tool, $id_session=0)
{
global $is_trackingEnabled;
global $_configuration;
// if tracking is disabled record nothing
// if( ! $is_trackingEnabled ) return 0; //commented because "what's new" notification must always occur
// if( ! $_configuration['tracking_enabled'] ) return 0; //commented because "what's new" notification must always occur
global $_user;
global $_cid;
global $TABLETRACK_ACCESS;
@ -237,7 +248,7 @@ function event_access_tool($tool, $id_session=0)
// added for "what's new" notification
$pos2 = strpos(strtolower($_SERVER['HTTP_REFERER']), strtolower($rootWeb."index"));
// end "what's new" notification
if ($is_trackingEnabled && ($pos !== false || $pos2 !== false))
if ($_configuration['tracking_enabled'] && ($pos !== false || $pos2 !== false))
{
$sql = "INSERT INTO `".$TABLETRACK_ACCESS."`
(`access_user_id`,
@ -284,13 +295,17 @@ function event_access_tool($tool, $id_session=0)
*/
function event_download($doc_url)
{
global $is_trackingEnabled;
// if tracking is disabled record nothing
if (!$is_trackingEnabled)
return 0;
global $_configuration;
global $_user;
global $_cid;
global $TABLETRACK_DOWNLOADS;
// if tracking is disabled record nothing
if (!$_configuration['tracking_enabled'])
{
return 0;
}
$reallyNow = time();
if ($_user['user_id'])
{
@ -329,13 +344,16 @@ function event_download($doc_url)
*/
function event_upload($doc_id)
{
global $is_trackingEnabled;
// if tracking is disabled record nothing
if (!$is_trackingEnabled)
return 0;
global $_configuration;
global $_user;
global $_cid;
global $TABLETRACK_UPLOADS;
// if tracking is disabled record nothing
if (!$_configuration['tracking_enabled'])
{
return 0;
}
$reallyNow = time();
if ($_user['user_id'])
{
@ -373,13 +391,17 @@ function event_upload($doc_id)
*/
function event_link($link_id)
{
global $is_trackingEnabled;
// if tracking is disabled record nothing
if (!$is_trackingEnabled)
return 0;
global $_configuration;
global $_user;
global $_cid;
global $TABLETRACK_LINKS;
// if tracking is disabled record nothing
if (!$_configuration['tracking_enabled'])
{
return 0;
}
$reallyNow = time();
if ($_user['user_id'])
{
@ -418,14 +440,18 @@ function event_link($link_id)
*/
function event_exercice($exo_id, $score, $weighting)
{
global $is_trackingEnabled;
// if tracking is disabled record nothing
if (!$is_trackingEnabled)
return 0;
global $_configuration;
global $_user;
global $_cid;
global $TABLETRACK_EXERCICES;
global $origin, $learnpath_id, $learnpath_item_id;
// if tracking is disabled record nothing
if (!$_configuration['tracking_enabled'])
{
return 0;
}
$reallyNow = time();
if ($_user['user_id'])
{
@ -478,12 +504,16 @@ function event_exercice($exo_id, $score, $weighting)
*/
function event_subscription($cours_id, $action)
{
global $is_trackingEnabled;
// if tracking is disabled record nothing
if (!$is_trackingEnabled)
return 0;
global $_configuration;
global $_user;
global $TABLETRACK_SUBSCRIPTIONS;
// if tracking is disabled record nothing
if (!$_configuration['tracking_enabled'])
{
return 0;
}
$sql = "INSERT INTO `$TABLETRACK_SUBSCRIPTIONS`
(`sub_user_id`,
`sub_cours_id`,
@ -507,13 +537,17 @@ function event_subscription($cours_id, $action)
*/
function event_default($type_event, $values)
{
global $is_trackingEnabled;
// if tracking is disabled record nothing
if (!$is_trackingEnabled)
return 0;
global $_configuration;
global $_user;
global $_cid;
global $TABLETRACK_DEFAULT;
global $TABLETRACK_DEFAULT;
// if tracking is disabled record nothing
if (!$_configuration['tracking_enabled'])
{
return 0;
}
$reallyNow = time();
if ($_user['user_id'])
{
@ -551,14 +585,18 @@ function event_default($type_event, $values)
function exercise_attempt($score,$answer,$quesId,$exeId,$j)
{
global $is_trackingEnabled;
// if tracking is disabled record nothing
if (!$is_trackingEnabled)
return 0;
global $_configuration;
global $_user;
global $_cid;
global $TABLETRACK_ATTEMPT;
global $origin, $learnpath_id, $learnpath_item_id;
// if tracking is disabled record nothing
if (!$_configuration['tracking_enabled'])
{
return 0;
}
$reallyNow = time();
if ($_user['user_id'])
{
@ -604,6 +642,4 @@ function exercise_attempt($score,$answer,$quesId,$exeId,$j)
$res = mysql_query($sql) or die(mysql_error());
//return 0;
}
?>

@ -375,7 +375,7 @@ if (isset($uidReset) && $uidReset) // session data refresh requested
{
$user_table = Database::get_main_table(MAIN_USER_TABLE);
$admin_table = Database::get_main_table(MAIN_ADMIN_TABLE);
if ($is_trackingEnabled)
if ($_configuration['tracking_enabled'])
{
$sql = "SELECT `user`.*, `a`.`user_id` `is_admin`,
UNIX_TIMESTAMP(`login`.`login_date`) `login_date`

@ -43,7 +43,7 @@ install time.
* Besides the $_configuration array there is also a $_settings array that contains variables that
* can be changed and will not break the platform.
* Some of the variables that are used here can move to the $_settings array (and thus be stored in the database)
* example: $is_trackingEnabled (assuming that the install script creates the necessary tables anyway.
* example: $_configuration['tracking_enabled'] (assuming that the install script creates the necessary tables anyway.
* $phpMyAdminPath
*
* @todo use more obvious names for the variables and respect the code guidelines
@ -63,7 +63,7 @@ $_configuration['db_password'] = '{DATABASE_PASSWORD}';
// Database settings
//============================================================================
// Is tracking enabled?
$is_trackingEnabled = {TRACKING_ENABLED};
$_configuration['tracking_enabled'] = {TRACKING_ENABLED};
// Is single database enabled (DO NOT MODIFY THIS)
$singleDbEnabled = {SINGLE_DATABASE};
// Prefix for course tables (IF NOT EMPTY, can be replaced by another prefix,

@ -128,7 +128,7 @@ $is_allowedToTrack = $is_courseAdmin;
<?php
// check if uid is prof of this group
if($is_allowedToTrack && $is_trackingEnabled)
if($is_allowedToTrack && $_configuration['tracking_enabled'])
{
// show all : view must be equal to the sum of all view values (1024+512+...+64)
// show none : less than the tiniest value
@ -707,7 +707,7 @@ if($is_allowedToTrack && $is_trackingEnabled)
// not allowed
else
{
if(!$is_trackingEnabled)
if(!$_configuration['tracking_enabled'])
{
echo get_lang('TrackingDisabled');
}

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

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

@ -85,7 +85,7 @@ api_display_tool_title($nameTools);
MAIN SECTION
==============================================================================
*/
if ( $is_trackingEnabled )
if ( $_configuration['tracking_enabled'] )
{
// show all : view must be equal to the sum of all view values (1024+512+...+64)
// show none : 0

@ -1,4 +1,4 @@
<?php // $Id: toolaccess_details.php 9246 2006-09-25 13:24:53Z bmol $
<?php // $Id: toolaccess_details.php 10062 2006-11-20 19:37:38Z pcool $
/*
==============================================================================
Dokeos - elearning and course management software
@ -106,7 +106,7 @@ $reqdate=$_REQUEST['reqdate'];
$is_allowedToTrack = $is_platformAdmin;
$courseCodeEqualcidIfNeeded = "";
}
if( $is_allowedToTrack && $is_trackingEnabled)
if( $is_allowedToTrack && $_configuration['tracking_enabled'])
{
// list of all tools
if (!isset($tool))
@ -289,13 +289,13 @@ $reqdate=$_REQUEST['reqdate'];
}
else // not allowed to track
{
if(!$is_trackingEnabled)
if(!$_configuration['tracking_enabled'])
{
echo $langTrackingDisabled;
}
else
{
echo $langNotAllowed;
echo get_lang('NotAllowed');
}
}

@ -1,4 +1,4 @@
<?php // $Id: userLog.php 9718 2006-10-25 08:16:19Z bmol $
<?php // $Id: userLog.php 10062 2006-11-20 19:37:38Z pcool $
/*
==============================================================================
Dokeos - elearning and course management software
@ -115,8 +115,6 @@ Display::display_header($nameTools,"Tracking");
Constants and variables
-----------------------------------------------------------
*/
//$is_allowed_to_track = $is_allowed[EDIT_RIGHT] && $is_trackingEnabled;
//YW hack security to quick fix RolesRights bug
$is_allowedToTrack = $is_courseAdmin;
$is_course_member = CourseManager::is_user_subscribed_in_real_or_linked_course($user_id, $course_id);
@ -617,7 +615,7 @@ function display_document_tracking_info($view, $user_id, $course_id)
<table width="100%" cellpadding="2" cellspacing="3" border="0">
<?php
// check if uid is tutor of this group
if( ( $is_allowedToTrack || $is_allowedToTrackEverybodyInCourse ) && $is_trackingEnabled )
if( ( $is_allowedToTrack || $is_allowedToTrackEverybodyInCourse ) && $_configuration['tracking_enabled'] )
{
if(!$uInfo && !isset($uInfo) )
{
@ -907,7 +905,7 @@ if( ( $is_allowedToTrack || $is_allowedToTrackEverybodyInCourse ) && $is_trackin
// not allowed
else
{
if(!$is_trackingEnabled)
if(!$_configuration['tracking_enabled'])
{
echo myEnc(get_lang('TrackingDisabled'));
}

@ -178,7 +178,7 @@ event_access_tool(TOOL_USER);
Setting the permissions for this page
--------------------------------------
*/
$is_allowed_to_track = $is_courseAdmin && $is_trackingEnabled;
$is_allowed_to_track = $is_courseAdmin && $_configuration['tracking_enabled'];
/*
--------------------------------------
Unregistering a user section

@ -97,7 +97,7 @@ $userIdViewer = $_user['user_id']; // id fo the user currently online
$allowedToEditContent = ($userIdViewer == $userIdViewed) || $is_platformAdmin;
$allowedToEditDef = $is_courseAdmin;
$is_allowedToTrack = $is_courseAdmin && $is_trackingEnabled;
$is_allowedToTrack = $is_courseAdmin && $_configuration['tracking_enabled'];
// Library connection
include ("userInfoLib.php");

Loading…
Cancel
Save