|
|
|
@ -35,8 +35,8 @@ class Statistics |
|
|
|
|
*/ |
|
|
|
|
public static function countCourses($categoryCode = null) |
|
|
|
|
{ |
|
|
|
|
$course_table = Database :: get_main_table(TABLE_MAIN_COURSE); |
|
|
|
|
$access_url_rel_course_table = Database :: get_main_table(TABLE_MAIN_ACCESS_URL_REL_COURSE); |
|
|
|
|
$course_table = Database::get_main_table(TABLE_MAIN_COURSE); |
|
|
|
|
$access_url_rel_course_table = Database::get_main_table(TABLE_MAIN_ACCESS_URL_REL_COURSE); |
|
|
|
|
$current_url_id = api_get_current_access_url_id(); |
|
|
|
|
if (api_is_multiple_url_enabled()) { |
|
|
|
|
$sql = "SELECT COUNT(*) AS number |
|
|
|
@ -68,8 +68,8 @@ class Statistics |
|
|
|
|
if (!isset($visibility)) { |
|
|
|
|
return 0; |
|
|
|
|
} |
|
|
|
|
$course_table = Database :: get_main_table(TABLE_MAIN_COURSE); |
|
|
|
|
$access_url_rel_course_table = Database :: get_main_table(TABLE_MAIN_ACCESS_URL_REL_COURSE); |
|
|
|
|
$course_table = Database::get_main_table(TABLE_MAIN_COURSE); |
|
|
|
|
$access_url_rel_course_table = Database::get_main_table(TABLE_MAIN_ACCESS_URL_REL_COURSE); |
|
|
|
|
$current_url_id = api_get_current_access_url_id(); |
|
|
|
|
if (api_is_multiple_url_enabled()) { |
|
|
|
|
$sql = "SELECT COUNT(*) AS number |
|
|
|
@ -104,7 +104,7 @@ class Statistics |
|
|
|
|
$course_user_table = Database:: get_main_table(TABLE_MAIN_COURSE_USER); |
|
|
|
|
$course_table = Database:: get_main_table(TABLE_MAIN_COURSE); |
|
|
|
|
$user_table = Database:: get_main_table(TABLE_MAIN_USER); |
|
|
|
|
$access_url_rel_user_table= Database :: get_main_table(TABLE_MAIN_ACCESS_URL_REL_USER); |
|
|
|
|
$access_url_rel_user_table= Database::get_main_table(TABLE_MAIN_ACCESS_URL_REL_USER); |
|
|
|
|
$current_url_id = api_get_current_access_url_id(); |
|
|
|
|
$active_filter = $onlyActive?' AND active=1':''; |
|
|
|
|
$status_filter = isset($status)?' AND status = '.intval($status):''; |
|
|
|
@ -155,8 +155,8 @@ class Statistics |
|
|
|
|
*/ |
|
|
|
|
public static function countSessions() |
|
|
|
|
{ |
|
|
|
|
$session_table = Database :: get_main_table(TABLE_MAIN_SESSION); |
|
|
|
|
$access_url_rel_session_table= Database :: get_main_table(TABLE_MAIN_ACCESS_URL_REL_SESSION); |
|
|
|
|
$session_table = Database::get_main_table(TABLE_MAIN_SESSION); |
|
|
|
|
$access_url_rel_session_table= Database::get_main_table(TABLE_MAIN_ACCESS_URL_REL_SESSION); |
|
|
|
|
if (api_is_multiple_url_enabled()) { |
|
|
|
|
$current_url_id = api_get_current_access_url_id(); |
|
|
|
|
$sql = "SELECT COUNT(id) AS number |
|
|
|
@ -179,9 +179,9 @@ class Statistics |
|
|
|
|
public static function getNumberOfActivities() |
|
|
|
|
{ |
|
|
|
|
// Database table definitions |
|
|
|
|
$track_e_default = Database :: get_main_table(TABLE_STATISTIC_TRACK_E_DEFAULT); |
|
|
|
|
$track_e_default = Database::get_main_table(TABLE_STATISTIC_TRACK_E_DEFAULT); |
|
|
|
|
$table_user = Database::get_main_table(TABLE_MAIN_USER); |
|
|
|
|
$access_url_rel_user_table= Database :: get_main_table(TABLE_MAIN_ACCESS_URL_REL_USER); |
|
|
|
|
$access_url_rel_user_table= Database::get_main_table(TABLE_MAIN_ACCESS_URL_REL_USER); |
|
|
|
|
$current_url_id = api_get_current_access_url_id(); |
|
|
|
|
if (api_is_multiple_url_enabled()) { |
|
|
|
|
$sql = "SELECT count(default_id) AS total_number_of_items |
|
|
|
@ -345,7 +345,7 @@ class Statistics |
|
|
|
|
*/ |
|
|
|
|
public static function getCourseCategories() |
|
|
|
|
{ |
|
|
|
|
$categoryTable = Database :: get_main_table(TABLE_MAIN_CATEGORY); |
|
|
|
|
$categoryTable = Database::get_main_table(TABLE_MAIN_CATEGORY); |
|
|
|
|
$sql = "SELECT code, name |
|
|
|
|
FROM $categoryTable |
|
|
|
|
ORDER BY tree_pos"; |
|
|
|
@ -390,7 +390,7 @@ class Statistics |
|
|
|
|
public static function printStats($title, $stats, $showTotal = true, $isFileSize = false) |
|
|
|
|
{ |
|
|
|
|
$total = 0; |
|
|
|
|
$data = Statistics::rescale($stats); |
|
|
|
|
$data = self::rescale($stats); |
|
|
|
|
|
|
|
|
|
echo '<table class="data_table" cellspacing="0" cellpadding="3"> |
|
|
|
|
<tr><th colspan="'.($showTotal ? '4' : '3').'">'.$title.'</th></tr>'; |
|
|
|
@ -403,7 +403,7 @@ class Statistics |
|
|
|
|
if (!$isFileSize) { |
|
|
|
|
$number_label = number_format($number, 0, ',', '.'); |
|
|
|
|
} else { |
|
|
|
|
$number_label = Statistics::makeSizeString($number); |
|
|
|
|
$number_label = self::makeSizeString($number); |
|
|
|
|
} |
|
|
|
|
$percentage = ($total>0?number_format(100*$number/$total, 1, ',', '.'):'0'); |
|
|
|
|
|
|
|
|
@ -421,7 +421,7 @@ class Statistics |
|
|
|
|
if (!$isFileSize) { |
|
|
|
|
$total_label = number_format($total, 0, ',', '.'); |
|
|
|
|
} else { |
|
|
|
|
$total_label = Statistics::makeSizeString($total); |
|
|
|
|
$total_label = self::makeSizeString($total); |
|
|
|
|
} |
|
|
|
|
echo '<tr><th colspan="4" align="right">'.get_lang('Total').': '.$total_label.'</td></tr>'; |
|
|
|
|
} |
|
|
|
@ -435,7 +435,7 @@ class Statistics |
|
|
|
|
public static function printLoginStats($type) |
|
|
|
|
{ |
|
|
|
|
$table = Database::get_main_table(TABLE_STATISTIC_TRACK_E_LOGIN); |
|
|
|
|
$access_url_rel_user_table= Database :: get_main_table(TABLE_MAIN_ACCESS_URL_REL_USER); |
|
|
|
|
$access_url_rel_user_table = Database::get_main_table(TABLE_MAIN_ACCESS_URL_REL_USER); |
|
|
|
|
$current_url_id = api_get_current_access_url_id(); |
|
|
|
|
|
|
|
|
|
$table_url = null; |
|
|
|
@ -488,7 +488,7 @@ class Statistics |
|
|
|
|
$stat_date = ($type === 'day') ? $periodCollection[$obj->stat_date] : $obj->stat_date; |
|
|
|
|
$result_last_x[$stat_date] = $obj->number_of_logins; |
|
|
|
|
} |
|
|
|
|
Statistics::printStats(get_lang('LastLogins').' ('.$period.')', $result_last_x, true); |
|
|
|
|
self::printStats(get_lang('LastLogins').' ('.$period.')', $result_last_x, true); |
|
|
|
|
flush(); //flush web request at this point to see something already while the full data set is loading |
|
|
|
|
echo '<br />'; |
|
|
|
|
} |
|
|
|
@ -508,7 +508,7 @@ class Statistics |
|
|
|
|
} |
|
|
|
|
$result[$stat_date] = $obj->number_of_logins; |
|
|
|
|
} |
|
|
|
|
Statistics::printStats(get_lang('AllLogins').' ('.$period.')', $result, true); |
|
|
|
|
self::printStats(get_lang('AllLogins').' ('.$period.')', $result, true); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
@ -520,7 +520,7 @@ class Statistics |
|
|
|
|
{ |
|
|
|
|
$totalLogin = array(); |
|
|
|
|
$table = Database::get_main_table(TABLE_STATISTIC_TRACK_E_LOGIN); |
|
|
|
|
$access_url_rel_user_table= Database :: get_main_table(TABLE_MAIN_ACCESS_URL_REL_USER); |
|
|
|
|
$access_url_rel_user_table = Database::get_main_table(TABLE_MAIN_ACCESS_URL_REL_USER); |
|
|
|
|
$current_url_id = api_get_current_access_url_id(); |
|
|
|
|
if (api_is_multiple_url_enabled()) { |
|
|
|
|
$table_url = ", $access_url_rel_user_table"; |
|
|
|
@ -544,9 +544,9 @@ class Statistics |
|
|
|
|
$totalLogin[$index] = $obj->number; |
|
|
|
|
} |
|
|
|
|
if ($distinct) { |
|
|
|
|
Statistics::printStats(get_lang('DistinctUsersLogins'), $totalLogin, false); |
|
|
|
|
self::printStats(get_lang('DistinctUsersLogins'), $totalLogin, false); |
|
|
|
|
} else { |
|
|
|
|
Statistics::printStats(get_lang('Logins'), $totalLogin, false); |
|
|
|
|
self::printStats(get_lang('Logins'), $totalLogin, false); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
@ -559,7 +559,7 @@ class Statistics |
|
|
|
|
{ |
|
|
|
|
$totalLogin = []; |
|
|
|
|
$table = Database::get_main_table(TABLE_STATISTIC_TRACK_E_LOGIN); |
|
|
|
|
$access_url_rel_user_table= Database :: get_main_table(TABLE_MAIN_ACCESS_URL_REL_USER); |
|
|
|
|
$access_url_rel_user_table = Database::get_main_table(TABLE_MAIN_ACCESS_URL_REL_USER); |
|
|
|
|
$current_url_id = api_get_current_access_url_id(); |
|
|
|
|
if (api_is_multiple_url_enabled()) { |
|
|
|
|
$table_url = ", $access_url_rel_user_table"; |
|
|
|
@ -592,7 +592,7 @@ class Statistics |
|
|
|
|
public static function printToolStats() |
|
|
|
|
{ |
|
|
|
|
$table = Database::get_main_table(TABLE_STATISTIC_TRACK_E_ACCESS); |
|
|
|
|
$access_url_rel_course_table = Database :: get_main_table(TABLE_MAIN_ACCESS_URL_REL_COURSE); |
|
|
|
|
$access_url_rel_course_table = Database::get_main_table(TABLE_MAIN_ACCESS_URL_REL_COURSE); |
|
|
|
|
$current_url_id = api_get_current_access_url_id(); |
|
|
|
|
|
|
|
|
|
$tools = array( |
|
|
|
@ -637,7 +637,7 @@ class Statistics |
|
|
|
|
$result[$tool_names[$obj->access_tool]] = $obj->number_of_logins; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
Statistics::printStats(get_lang('PlatformToolAccess'), $result, true); |
|
|
|
|
self::printStats(get_lang('PlatformToolAccess'), $result, true); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
@ -645,8 +645,8 @@ class Statistics |
|
|
|
|
*/ |
|
|
|
|
public static function printCourseByLanguageStats() |
|
|
|
|
{ |
|
|
|
|
$table = Database :: get_main_table(TABLE_MAIN_COURSE); |
|
|
|
|
$access_url_rel_course_table = Database :: get_main_table(TABLE_MAIN_ACCESS_URL_REL_COURSE); |
|
|
|
|
$table = Database::get_main_table(TABLE_MAIN_COURSE); |
|
|
|
|
$access_url_rel_course_table = Database::get_main_table(TABLE_MAIN_ACCESS_URL_REL_COURSE); |
|
|
|
|
$current_url_id = api_get_current_access_url_id(); |
|
|
|
|
if (api_is_multiple_url_enabled()) { |
|
|
|
|
$sql = "SELECT course_language, count( c.code ) AS number_of_courses |
|
|
|
@ -664,7 +664,7 @@ class Statistics |
|
|
|
|
while ($obj = Database::fetch_object($res)) { |
|
|
|
|
$result[$obj->course_language] = $obj->number_of_courses; |
|
|
|
|
} |
|
|
|
|
Statistics::printStats(get_lang('CountCourseByLanguage'), $result, true); |
|
|
|
|
self::printStats(get_lang('CountCourseByLanguage'), $result, true); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
@ -672,8 +672,8 @@ class Statistics |
|
|
|
|
*/ |
|
|
|
|
public static function printUserPicturesStats() |
|
|
|
|
{ |
|
|
|
|
$user_table = Database :: get_main_table(TABLE_MAIN_USER); |
|
|
|
|
$access_url_rel_user_table = Database :: get_main_table(TABLE_MAIN_ACCESS_URL_REL_USER); |
|
|
|
|
$user_table = Database::get_main_table(TABLE_MAIN_USER); |
|
|
|
|
$access_url_rel_user_table = Database::get_main_table(TABLE_MAIN_ACCESS_URL_REL_USER); |
|
|
|
|
$current_url_id = api_get_current_access_url_id(); |
|
|
|
|
$url_condition = null; |
|
|
|
|
$url_condition2 = null; |
|
|
|
@ -694,7 +694,7 @@ class Statistics |
|
|
|
|
$result[get_lang('No')] = $count1->n - $count2->n; |
|
|
|
|
$result[get_lang('Yes')] = $count2->n; // #users with picture |
|
|
|
|
|
|
|
|
|
Statistics::printStats(get_lang('CountUsers').' ('.get_lang('UserPicture').')', $result, true); |
|
|
|
|
self::printStats(get_lang('CountUsers').' ('.get_lang('UserPicture').')', $result, true); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
@ -755,7 +755,7 @@ class Statistics |
|
|
|
|
*/ |
|
|
|
|
public static function printCourseLastVisit() |
|
|
|
|
{ |
|
|
|
|
$access_url_rel_course_table = Database :: get_main_table(TABLE_MAIN_ACCESS_URL_REL_COURSE); |
|
|
|
|
$access_url_rel_course_table = Database::get_main_table(TABLE_MAIN_ACCESS_URL_REL_COURSE); |
|
|
|
|
$current_url_id = api_get_current_access_url_id(); |
|
|
|
|
|
|
|
|
|
$columns[0] = 't.c_id'; |
|
|
|
@ -841,7 +841,7 @@ class Statistics |
|
|
|
|
{ |
|
|
|
|
$message_table = Database::get_main_table(TABLE_MESSAGE); |
|
|
|
|
$user_table = Database::get_main_table(TABLE_MAIN_USER); |
|
|
|
|
$access_url_rel_user_table = Database :: get_main_table(TABLE_MAIN_ACCESS_URL_REL_USER); |
|
|
|
|
$access_url_rel_user_table = Database::get_main_table(TABLE_MAIN_ACCESS_URL_REL_USER); |
|
|
|
|
|
|
|
|
|
$current_url_id = api_get_current_access_url_id(); |
|
|
|
|
|
|
|
|
@ -889,7 +889,7 @@ class Statistics |
|
|
|
|
{ |
|
|
|
|
$user_friend_table = Database::get_main_table(TABLE_MAIN_USER_REL_USER); |
|
|
|
|
$user_table = Database::get_main_table(TABLE_MAIN_USER); |
|
|
|
|
$access_url_rel_user_table= Database :: get_main_table(TABLE_MAIN_ACCESS_URL_REL_USER); |
|
|
|
|
$access_url_rel_user_table = Database::get_main_table(TABLE_MAIN_ACCESS_URL_REL_USER); |
|
|
|
|
$current_url_id = api_get_current_access_url_id(); |
|
|
|
|
|
|
|
|
|
if (api_is_multiple_url_enabled()) { |
|
|
|
@ -929,7 +929,7 @@ class Statistics |
|
|
|
|
{ |
|
|
|
|
$totalLogin = array(); |
|
|
|
|
$table = Database::get_main_table(TABLE_STATISTIC_TRACK_E_LOGIN); |
|
|
|
|
$access_url_rel_user_table = Database :: get_main_table(TABLE_MAIN_ACCESS_URL_REL_USER); |
|
|
|
|
$access_url_rel_user_table = Database::get_main_table(TABLE_MAIN_ACCESS_URL_REL_USER); |
|
|
|
|
$current_url_id = api_get_current_access_url_id(); |
|
|
|
|
$total = self::countUsers(); |
|
|
|
|
if (api_is_multiple_url_enabled()) { |
|
|
|
@ -965,7 +965,7 @@ class Statistics |
|
|
|
|
$r = $total - $obj->number; |
|
|
|
|
$totalLogin[$index] = $r < 0 ? 0 : $r; |
|
|
|
|
} |
|
|
|
|
Statistics::printStats( |
|
|
|
|
self::printStats( |
|
|
|
|
get_lang('StatsUsersDidNotLoginInLastPeriods'), |
|
|
|
|
$totalLogin, |
|
|
|
|
false |
|
|
|
|