tce_functions_test_stats.php

Statistical functions for test results.

Source: shared/code/tce_functions_test_stats.php

Statistical functions for test results.

Functions

F_getAllUsersTestStat()

Returns users statistic array for the selected test.

function F_getAllUsersTestStat(
    mixed $test_id,
    mixed $group_id = 0,
    mixed $user_id = 0,
    mixed $startdate = 0,
    mixed $enddate = 0,
    mixed $full_order_field = 'total_score',
    mixed $pubmode = false,
    mixed $stats = 2
)

Parameters:

  • $test_id (mixed): (int) test ID.
  • $group_id (mixed): (int) group ID - if greater than zero, filter stats for the specified user group.
  • $user_id (mixed): (int) user ID - if greater than zero, filter stats for the specified user.
  • $startdate (mixed): (string) start date ID - if greater than zero, filter stats for the specified starting date
  • $enddate (mixed): (string) end date ID - if greater than zero, filter stats for the specified ending date
  • $full_order_field (mixed): (string) Ordering fields for SQL query.
  • $pubmode (mixed): (boolean) If true filter the results for the public interface.
  • $stats (mixed): (int) 2 = full stats; 1 = user stats; 0 = disabled stats; return $data array containing test statistics.

Source: shared/code/tce_functions_test_stats.php:1829

F_getRawTestStat()

Returns raw statistic array for the selected test.

function F_getRawTestStat(
    mixed $test_id,
    mixed $group_id = 0,
    mixed $user_id = 0,
    mixed $startdate = 0,
    mixed $enddate = 0,
    mixed $testuser_id = 0,
    mixed $data = [],
    mixed $pubmode = false
)

Parameters:

  • $test_id (mixed): (int) test ID.
  • $group_id (mixed): (int) group ID - if greater than zero, filter stats for the specified user group.
  • $user_id (mixed): (int) user ID - if greater than zero, filter stats for the specified user.
  • $startdate (mixed): (int) start date ID - if greater than zero, filter stats for the specified starting date
  • $enddate (mixed): (int) end date ID - if greater than zero, filter stats for the specified ending date
  • $testuser_id (mixed): (int) test-user ID - if greater than zero, filter stats for the specified test-user.
  • $data (mixed): (array) Array of existing data to be merged with the current one.
  • $pubmode (mixed): (boolean) If true filter the results for the public interface. return $data array containing test statistics.

Source: shared/code/tce_functions_test_stats.php:148

F_getSafeUsersTestStatOrderBy()

Returns a safe ORDER BY clause for user test statistics queries.

function F_getSafeUsersTestStatOrderBy(mixed $full_order_field): string

Parameters:

  • $full_order_field (mixed): Raw ORDER BY input.

Returns: string

Source: shared/code/tce_functions_test_stats.php:2071

F_getTestIDReports()

Returns a comma separated string of test IDs with test_results_to_users enabled

function F_getTestIDReports(mixed $test_id, mixed $user_id): string

Parameters:

  • $test_id (mixed): (int) Test ID.
  • $user_id (mixed)

Returns: string

Source: shared/code/tce_functions_test_stats.php:2154

F_getTestIDResults()

Returns a comma separated string of test IDs with test_results_to_users enabled

function F_getTestIDResults(mixed $test_id, mixed $user_id): string

Parameters:

  • $test_id (mixed): (int) Test ID.
  • $user_id (mixed)

Returns: string

Source: shared/code/tce_functions_test_stats.php:2144

F_getTestIDs()

Returns a comma separated string of test IDs with test_results_to_users enabled

function F_getTestIDs(
    mixed $test_id,
    mixed $user_id,
    mixed $filter = 'test_results_to_users'
): string

Parameters:

  • $test_id (mixed): (int) Test ID.
  • $user_id (mixed)
  • $filter (mixed)

Returns: string

Source: shared/code/tce_functions_test_stats.php:2164

F_getTestStat()

Returns statistic array for the selected test.

function F_getTestStat(
    mixed $test_id,
    mixed $group_id = 0,
    mixed $user_id = 0,
    mixed $startdate = 0,
    mixed $enddate = 0,
    mixed $testuser_id = 0,
    mixed $pubmode = false
)

Parameters:

  • $test_id (mixed): (int) test ID.
  • $group_id (mixed): (int) group ID - if greater than zero, filter stats for the specified user group.
  • $user_id (mixed): (int) user ID - if greater than zero, filter stats for the specified user.
  • $startdate (mixed): (int) start date ID - if greater than zero, filter stats for the specified starting date
  • $enddate (mixed): (int) end date ID - if greater than zero, filter stats for the specified ending date
  • $testuser_id (mixed): (int) test-user ID - if greater than zero, filter stats for the specified test-user.
  • $pubmode (mixed): (boolean) If true filter the results for the public interface. return $data array containing test statistics.

Source: shared/code/tce_functions_test_stats.php:119

F_getUserTestStat()

Returns statistic array for the test-user

function F_getUserTestStat(
    mixed $test_id,
    mixed $user_id = 0,
    mixed $testuser_id = 0,
    mixed $pubmode = false
)

Parameters:

  • $test_id (mixed): (int) test ID.
  • $user_id (mixed): (int) user ID - if greater than zero, filter stats for the specified user.
  • $testuser_id (mixed): (int) test-user ID - if greater than zero, filter stats for the specified test-user.
  • $pubmode (mixed): (boolean) If true filter the results for the public interface. return $data array containing test-user statistics.

Source: shared/code/tce_functions_test_stats.php:31

F_getUserTestTotals()

Returns test-user totals

function F_getUserTestTotals(
    mixed $test_id,
    mixed $user_id = 0,
    mixed $testuser_id = 0,
    mixed $pubmode = false
)

Parameters:

  • $test_id (mixed): (int) test ID.
  • $user_id (mixed): (int) user ID - if greater than zero, filter stats for the specified user.
  • $testuser_id (mixed): (int) test-user ID - if greater than zero, filter stats for the specified test-user.
  • $pubmode (mixed): (boolean) If true filter the results for the public interface. return $data array containing test-user statistics.

Source: shared/code/tce_functions_test_stats.php:52

F_lockUserTest()

Lock the user’s test.<br>

function F_lockUserTest(mixed $test_id, mixed $user_id)

Parameters:

  • $test_id (mixed): (int) test ID
  • $user_id (mixed): (int) user ID

Source: shared/code/tce_functions_test_stats.php:2116

F_normalizeTestStatAverages()

Calculate average values from TestStat array

function F_normalizeTestStatAverages(mixed $data)

Parameters:

  • $data (mixed): (array) Raw data array. return $data (array) Processed array.

Source: shared/code/tce_functions_test_stats.php:682

F_printTestResultStat()

Returns test stats as HTML table

function F_printTestResultStat(
    mixed $data,
    mixed $nextorderdir,
    mixed $order_field,
    mixed $filter,
    mixed $pubmode = false,
    mixed $stats = 1
)

Parameters:

  • $data (mixed): (array) Array containing test statistics.
  • $nextorderdir (mixed): (int) next order direction.
  • $order_field (mixed): (string) order fields.
  • $filter (mixed): (string) filter string for URLs.
  • $pubmode (mixed): (boolean) If true filter the results for the public interface.
  • $stats (mixed): (int) 2 = full stats; 1 = user stats; 0 = disabled stats; return HTML table string.

Source: shared/code/tce_functions_test_stats.php:1262

F_printTestStat()

Returns test stats as HTML table

function F_printTestStat(
    mixed $test_id,
    mixed $group_id = 0,
    mixed $user_id = 0,
    mixed $startdate = 0,
    mixed $enddate = 0,
    mixed $testuser_id = 0,
    mixed $ts = [],
    mixed $display_mode = 2,
    mixed $pubmode = false
)

Parameters:

  • $test_id (mixed): (int) test ID.
  • $group_id (mixed): (int) group ID - if greater than zero, filter stats for the specified user group.
  • $user_id (mixed): (int) user ID - if greater than zero, filter stats for the specified user.
  • $startdate (mixed): (int) start date ID - if greater than zero, filter stats for the specified starting date
  • $enddate (mixed): (int) end date ID - if greater than zero, filter stats for the specified ending date
  • $testuser_id (mixed): (int) test-user ID - if greater than zero, filter stats for the specified test-user.
  • $ts (mixed): (array) array of stats to print (leave empty to automatically generate new data).
  • $display_mode (mixed): display (int) mode: 0 = disabled; 1 = minimum; 2 = module; 3 = subject; 4 = question; 5 = answer.
  • $pubmode (mixed): (boolean) If true filter the results for the public interface. return $data string containing HTML table.

Source: shared/code/tce_functions_test_stats.php:798

F_printUserTestStat()

Returns user test stats as HTML table

function F_printUserTestStat(mixed $testuser_id)

Parameters:

  • $testuser_id (mixed): (int) test-user ID - if greater than zero, filter stats for the specified test-user. return $data string containing HTML table.

Source: shared/code/tce_functions_test_stats.php:1624