|
@@ 3877-3907 (lines=31) @@
|
| 3874 |
|
* including sessions, 0 = session is not filtered |
| 3875 |
|
* @return array tools data |
| 3876 |
|
*/ |
| 3877 |
|
public static function get_tools_most_used_by_course($courseId, $session_id = null) |
| 3878 |
|
{ |
| 3879 |
|
$courseId = intval($courseId); |
| 3880 |
|
$data = array(); |
| 3881 |
|
$TABLETRACK_ACCESS = Database::get_main_table(TABLE_STATISTIC_TRACK_E_LASTACCESS); |
| 3882 |
|
$condition_session = ''; |
| 3883 |
|
if (isset($session_id)) { |
| 3884 |
|
$session_id = intval($session_id); |
| 3885 |
|
$condition_session = ' AND access_session_id = '. $session_id; |
| 3886 |
|
} |
| 3887 |
|
$sql = "SELECT |
| 3888 |
|
access_tool, |
| 3889 |
|
COUNT(DISTINCT access_user_id), |
| 3890 |
|
count(access_tool) as count_access_tool |
| 3891 |
|
FROM $TABLETRACK_ACCESS |
| 3892 |
|
WHERE |
| 3893 |
|
access_tool IS NOT NULL AND |
| 3894 |
|
access_tool != '' AND |
| 3895 |
|
c_id = '$courseId' |
| 3896 |
|
$condition_session |
| 3897 |
|
GROUP BY access_tool |
| 3898 |
|
ORDER BY count_access_tool DESC |
| 3899 |
|
LIMIT 0, 3"; |
| 3900 |
|
$rs = Database::query($sql); |
| 3901 |
|
if (Database::num_rows($rs) > 0) { |
| 3902 |
|
while ($row = Database::fetch_array($rs)) { |
| 3903 |
|
$data[] = $row; |
| 3904 |
|
} |
| 3905 |
|
} |
| 3906 |
|
return $data; |
| 3907 |
|
} |
| 3908 |
|
/** |
| 3909 |
|
* Get total clicks |
| 3910 |
|
* THIS FUNCTION IS NOT BEEN USED, IT WAS MEANT TO BE USE WITH track_e_course_access.date_from and track_e_course_access.date_to, |
|
@@ 4043-4070 (lines=28) @@
|
| 4040 |
|
* @param int Limit (optional, default = 0, 0 = without limit) |
| 4041 |
|
* @return array documents downloaded |
| 4042 |
|
*/ |
| 4043 |
|
public static function get_documents_most_downloaded_by_course($course_code, $session_id = null, $limit = 0) |
| 4044 |
|
{ |
| 4045 |
|
//protect data |
| 4046 |
|
$courseId = api_get_course_int_id($course_code); |
| 4047 |
|
$data = array(); |
| 4048 |
|
|
| 4049 |
|
$TABLETRACK_DOWNLOADS = Database::get_main_table(TABLE_STATISTIC_TRACK_E_DOWNLOADS); |
| 4050 |
|
$condition_session = ''; |
| 4051 |
|
if (isset($session_id)) { |
| 4052 |
|
$session_id = intval($session_id); |
| 4053 |
|
$condition_session = ' AND down_session_id = '. $session_id; |
| 4054 |
|
} |
| 4055 |
|
$sql = "SELECT down_doc_path, COUNT(DISTINCT down_user_id), COUNT(down_doc_path) as count_down |
| 4056 |
|
FROM $TABLETRACK_DOWNLOADS |
| 4057 |
|
WHERE c_id = $courseId |
| 4058 |
|
$condition_session |
| 4059 |
|
GROUP BY down_doc_path |
| 4060 |
|
ORDER BY count_down DESC |
| 4061 |
|
LIMIT 0, $limit"; |
| 4062 |
|
$rs = Database::query($sql); |
| 4063 |
|
|
| 4064 |
|
if (Database::num_rows($rs) > 0) { |
| 4065 |
|
while ($row = Database::fetch_array($rs)) { |
| 4066 |
|
$data[] = $row; |
| 4067 |
|
} |
| 4068 |
|
} |
| 4069 |
|
return $data; |
| 4070 |
|
} |
| 4071 |
|
|
| 4072 |
|
/** |
| 4073 |
|
* get links most visited by course |