Only show forum group information, the rest depends in the course.

See BT#5758
1.10.x
Julio Montoya 10 years ago
parent 27105de8d4
commit 412f946093
  1. 8
      main/inc/lib/tracking.lib.php
  2. 176
      main/tracking/course_log_tools.php

@ -3502,7 +3502,6 @@ class Tracking
//protect data //protect data
$last_days = intval($last_days); $last_days = intval($last_days);
$course_code = Database::escape_string($course_code);
$session_id = intval($session_id); $session_id = intval($session_id);
$tbl_stats_access = Database :: get_main_table(TABLE_STATISTIC_TRACK_E_ACCESS); $tbl_stats_access = Database :: get_main_table(TABLE_STATISTIC_TRACK_E_ACCESS);
$now = api_get_utc_datetime(); $now = api_get_utc_datetime();
@ -3863,7 +3862,7 @@ class Tracking
*/ */
public static function get_tools_most_used_by_course($courseId, $session_id = null) public static function get_tools_most_used_by_course($courseId, $session_id = null)
{ {
$course_code = intval($courseId); $courseId = intval($courseId);
$data = array(); $data = array();
$TABLETRACK_ACCESS = Database::get_main_table(TABLE_STATISTIC_TRACK_E_LASTACCESS); $TABLETRACK_ACCESS = Database::get_main_table(TABLE_STATISTIC_TRACK_E_LASTACCESS);
$condition_session = ''; $condition_session = '';
@ -3871,7 +3870,10 @@ class Tracking
$session_id = intval($session_id); $session_id = intval($session_id);
$condition_session = ' AND access_session_id = '. $session_id; $condition_session = ' AND access_session_id = '. $session_id;
} }
$sql = "SELECT access_tool, COUNT(DISTINCT access_user_id),count( access_tool ) as count_access_tool $sql = "SELECT
access_tool,
COUNT(DISTINCT access_user_id),
count(access_tool) as count_access_tool
FROM $TABLETRACK_ACCESS FROM $TABLETRACK_ACCESS
WHERE WHERE
access_tool IS NOT NULL AND access_tool IS NOT NULL AND

@ -30,6 +30,22 @@ if (!$is_allowedToTrack) {
exit; exit;
} }
$showChatReporting = true;
$showTrackingReporting = true;
$documentReporting = true;
$linkReporting = true;
$exerciseReporting = true;
$lpReporting = true;
if (!empty($groupId)) {
$showChatReporting = false;
$showTrackingReporting = false;
$documentReporting = false;
$linkReporting = false;
$exerciseReporting = false;
$lpReporting = false;
}
// Including additional libraries. // Including additional libraries.
require_once api_get_path(SYS_CODE_PATH).'resourcelinker/resourcelinker.inc.php'; require_once api_get_path(SYS_CODE_PATH).'resourcelinker/resourcelinker.inc.php';
@ -129,6 +145,7 @@ echo '</div>';
$course_code = api_get_course_id(); $course_code = api_get_course_id();
$course_id = api_get_course_int_id(); $course_id = api_get_course_int_id();
if ($lpReporting) {
$list = new LearnpathList(null, $course_code, $session_id); $list = new LearnpathList(null, $course_code, $session_id);
$flat_list = $list->get_flat_list(); $flat_list = $list->get_flat_list();
@ -137,7 +154,10 @@ if (count($flat_list) > 0) {
// learning path tracking // learning path tracking
echo '<div class="report_section"> echo '<div class="report_section">
'.Display::page_subheader( '.Display::page_subheader(
Display::return_icon('scorms.gif',get_lang('AverageProgressInLearnpath')).get_lang('AverageProgressInLearnpath') Display::return_icon(
'scorms.gif',
get_lang('AverageProgressInLearnpath')
).get_lang('AverageProgressInLearnpath')
).' ).'
<table class="data_table">'; <table class="data_table">';
@ -182,11 +202,17 @@ if (count($flat_list) > 0) {
$csv_content[] = $temp; $csv_content[] = $temp;
} }
} }
}
if ($exerciseReporting) {
// Exercices tracking. // Exercices tracking.
echo '<div class="report_section"> echo '<div class="report_section">
'.Display::page_subheader( '.Display::page_subheader(
Display::return_icon('quiz.gif',get_lang('AverageResultsToTheExercices')).get_lang('AverageResultsToTheExercices') Display::return_icon(
'quiz.gif',
get_lang('AverageResultsToTheExercices')
).get_lang('AverageResultsToTheExercices')
).' ).'
<table class="data_table">'; <table class="data_table">';
@ -209,15 +235,27 @@ if (Database::num_rows($rs) > 0) {
$quiz_avg_score = 0; $quiz_avg_score = 0;
if ($studentCount > 0) { if ($studentCount > 0) {
foreach ($student_ids as $student_id) { foreach ($student_ids as $student_id) {
$avg_student_score = Tracking::get_avg_student_exercise_score($student_id, $course_code, $quiz['id'], $session_id); $avg_student_score = Tracking::get_avg_student_exercise_score(
$student_id,
$course_code,
$quiz['id'],
$session_id
);
$quiz_avg_score += $avg_student_score; $quiz_avg_score += $avg_student_score;
} }
} }
$studentCount = ($studentCount == 0 || is_null($studentCount) || $studentCount == '') ? 1 : $studentCount; $studentCount = ($studentCount == 0 || is_null(
$studentCount
) || $studentCount == '') ? 1 : $studentCount;
$quiz_avg_score = round(($quiz_avg_score / $studentCount), 2).'%'; $quiz_avg_score = round(($quiz_avg_score / $studentCount), 2).'%';
$url = api_get_path(WEB_CODE_PATH).'exercice/overview.php?exerciseId='.$quiz['id'].$course_path_params; $url = api_get_path(
WEB_CODE_PATH
echo '<tr><td>'.Display::url($quiz['title'], $url).'</td><td align="right">'.$quiz_avg_score.'</td></tr>'; ).'exercice/overview.php?exerciseId='.$quiz['id'].$course_path_params;
echo '<tr><td>'.Display::url(
$quiz['title'],
$url
).'</td><td align="right">'.$quiz_avg_score.'</td></tr>';
if ($export_csv) { if ($export_csv) {
$temp = array($quiz['title'], $quiz_avg_score); $temp = array($quiz['title'], $quiz_avg_score);
$csv_content[] = $temp; $csv_content[] = $temp;
@ -233,6 +271,7 @@ if (Database::num_rows($rs) > 0) {
echo '</table></div>'; echo '</table></div>';
echo '<div class="clear"></div>'; echo '<div class="clear"></div>';
}
$filterByUsers = array(); $filterByUsers = array();
@ -259,10 +298,10 @@ $count_number_of_posts_by_course = Tracking:: count_number_of_posts_by_course(
); );
if ($export_csv) { if ($export_csv) {
$csv_content[] = array(get_lang('Forum'), ''); $csv_content[] = array(get_lang('Forum'));
$csv_content[] = array(get_lang('ForumForumsNumber', ''), $count_number_of_forums_by_course); $csv_content[] = array(get_lang('ForumForumsNumber'), $count_number_of_forums_by_course);
$csv_content[] = array(get_lang('ForumThreadsNumber', ''), $count_number_of_threads_by_course); $csv_content[] = array(get_lang('ForumThreadsNumber'), $count_number_of_threads_by_course);
$csv_content[] = array(get_lang('ForumPostsNumber', ''), $count_number_of_posts_by_course); $csv_content[] = array(get_lang('ForumPostsNumber'), $count_number_of_posts_by_course);
} }
// Forums tracking. // Forums tracking.
@ -282,26 +321,51 @@ echo '</table></div>';
echo '<div class="clear"></div>'; echo '<div class="clear"></div>';
// Chat tracking. // Chat tracking.
if ($showChatReporting) {
echo '<div class="report_section"> echo '<div class="report_section">
'.Display::page_subheader(Display::return_icon('chat.gif',get_lang('Chat')).get_lang('Chat')).' '.Display::page_subheader(
Display::return_icon('chat.gif', get_lang('Chat')).get_lang('Chat')
).'
<table class="data_table">'; <table class="data_table">';
$chat_connections_during_last_x_days_by_course = Tracking::chat_connections_during_last_x_days_by_course($course_code, 7, $session_id); $chat_connections_during_last_x_days_by_course = Tracking::chat_connections_during_last_x_days_by_course(
$course_code,
7,
$session_id
);
if ($export_csv) { if ($export_csv) {
$csv_content[] = array(get_lang('Chat', ''), ''); $csv_content[] = array(get_lang('Chat', ''), '');
$csv_content[] = array(sprintf(get_lang('ChatConnectionsDuringLastXDays', ''), '7'), $chat_connections_during_last_x_days_by_course); $csv_content[] = array(
sprintf(
get_lang('ChatConnectionsDuringLastXDays', ''),
'7'
),
$chat_connections_during_last_x_days_by_course
);
} }
echo '<tr><td>'.sprintf(get_lang('ChatConnectionsDuringLastXDays'), '7').'</td><td align="right">'.$chat_connections_during_last_x_days_by_course.'</td></tr>'; echo '<tr><td>'.sprintf(
get_lang('ChatConnectionsDuringLastXDays'),
'7'
).'</td><td align="right">'.$chat_connections_during_last_x_days_by_course.'</td></tr>';
echo '</table></div>'; echo '</table></div>';
echo '<div class="clear"></div>'; echo '<div class="clear"></div>';
}
// Tools tracking. // Tools tracking.
if ($showTrackingReporting) {
echo '<div class="report_section"> echo '<div class="report_section">
'.Display::page_subheader(Display::return_icon('acces_tool.gif', get_lang('ToolsMostUsed')).get_lang('ToolsMostUsed')).' '.Display::page_subheader(
Display::return_icon(
'acces_tool.gif',
get_lang('ToolsMostUsed')
).get_lang('ToolsMostUsed')
).'
<table class="data_table">'; <table class="data_table">';
$tools_most_used = Tracking::get_tools_most_used_by_course($course_id, $session_id); $tools_most_used = Tracking::get_tools_most_used_by_course(
$course_id,
$session_id
);
if ($export_csv) { if ($export_csv) {
$temp = array(get_lang('ToolsMostUsed'), ''); $temp = array(get_lang('ToolsMostUsed'), '');
@ -312,10 +376,15 @@ if (!empty($tools_most_used)) {
foreach ($tools_most_used as $row) { foreach ($tools_most_used as $row) {
echo ' <tr> echo ' <tr>
<td>'.get_lang(ucfirst($row['access_tool'])).'</td> <td>'.get_lang(ucfirst($row['access_tool'])).'</td>
<td align="right">'.$row['count_access_tool'].' '.get_lang('Clicks').'</td> <td align="right">'.$row['count_access_tool'].' '.get_lang(
'Clicks'
).'</td>
</tr>'; </tr>';
if ($export_csv) { if ($export_csv) {
$temp = array(get_lang(ucfirst($row['access_tool']), ''), $row['count_access_tool'].' '.get_lang('Clicks', '')); $temp = array(
get_lang(ucfirst($row['access_tool']), ''),
$row['count_access_tool'].' '.get_lang('Clicks', '')
);
$csv_content[] = $temp; $csv_content[] = $temp;
} }
} }
@ -323,21 +392,34 @@ if (!empty($tools_most_used)) {
echo '</table></div>'; echo '</table></div>';
echo '<div class="clear"></div>'; echo '<div class="clear"></div>';
}
if ($documentReporting) {
// Documents tracking. // Documents tracking.
if (!isset($_GET['num']) || empty($_GET['num'])) { if (!isset($_GET['num']) || empty($_GET['num'])) {
$num = 3; $num = 3;
$link = '&nbsp;-&nbsp;<a href="'.api_get_self().'?'.api_get_cidreq().'&num=1#documents_tracking">'.get_lang('SeeDetail').'</a>'; $link = '&nbsp;-&nbsp;<a href="'.api_get_self().'?'.api_get_cidreq(
).'&num=1#documents_tracking">'.get_lang('SeeDetail').'</a>';
} else { } else {
$num = 1000; $num = 1000;
$link = '&nbsp;-&nbsp;<a href="'.api_get_self().'?'.api_get_cidreq().'&num=0#documents_tracking">'.get_lang('ViewMinus').'</a>'; $link = '&nbsp;-&nbsp;<a href="'.api_get_self().'?'.api_get_cidreq(
).'&num=0#documents_tracking">'.get_lang('ViewMinus').'</a>';
} }
echo '<a name="documents_tracking" id="a"></a><div class="report_section"> echo '<a name="documents_tracking" id="a"></a><div class="report_section">
'.Display::page_subheader(Display::return_icon('documents.gif',get_lang('DocumentsMostDownloaded')).'&nbsp;'.get_lang('DocumentsMostDownloaded').$link).' '.Display::page_subheader(
Display::return_icon(
'documents.gif',
get_lang('DocumentsMostDownloaded')
).'&nbsp;'.get_lang('DocumentsMostDownloaded').$link
).'
<table class="data_table">'; <table class="data_table">';
$documents_most_downloaded = Tracking::get_documents_most_downloaded_by_course($course_code, $session_id, $num); $documents_most_downloaded = Tracking::get_documents_most_downloaded_by_course(
$course_code,
$session_id,
$num
);
if ($export_csv) { if ($export_csv) {
$temp = array(get_lang('DocumentsMostDownloaded', ''), ''); $temp = array(get_lang('DocumentsMostDownloaded', ''), '');
@ -348,11 +430,21 @@ if ($export_csv) {
if (!empty($documents_most_downloaded)) { if (!empty($documents_most_downloaded)) {
foreach ($documents_most_downloaded as $row) { foreach ($documents_most_downloaded as $row) {
echo '<tr> echo '<tr>
<td>'.Display::url($row['down_doc_path'], api_get_path(WEB_CODE_PATH).'document/show_content.php?file='.$row['down_doc_path'].$course_path_params).'</td> <td>'.Display::url(
<td align="right">'.$row['count_down'].' '.get_lang('Clicks').'</td> $row['down_doc_path'],
api_get_path(
WEB_CODE_PATH
).'document/show_content.php?file='.$row['down_doc_path'].$course_path_params
).'</td>
<td align="right">'.$row['count_down'].' '.get_lang(
'Clicks'
).'</td>
</tr>'; </tr>';
if ($export_csv) { if ($export_csv) {
$temp = array($row['down_doc_path'], $row['count_down'].' '.get_lang('Clicks', '')); $temp = array(
$row['down_doc_path'],
$row['count_down'].' '.get_lang('Clicks', '')
);
$csv_content[] = $temp; $csv_content[] = $temp;
} }
} }
@ -366,13 +458,24 @@ if (!empty($documents_most_downloaded)) {
echo '</table></div>'; echo '</table></div>';
echo '<div class="clear"></div>'; echo '<div class="clear"></div>';
}
if ($linkReporting) {
// links tracking // links tracking
echo '<div class="report_section"> echo '<div class="report_section">
'.Display::page_subheader(Display::return_icon('link.gif',get_lang('LinksMostClicked')).'&nbsp;'.get_lang('LinksMostClicked')).' '.Display::page_subheader(
Display::return_icon(
'link.gif',
get_lang('LinksMostClicked')
).'&nbsp;'.get_lang('LinksMostClicked')
).'
<table class="data_table">'; <table class="data_table">';
$links_most_visited = Tracking::get_links_most_visited_by_course($course_code, $session_id); $links_most_visited = Tracking::get_links_most_visited_by_course(
$course_code,
$session_id
);
if ($export_csv) { if ($export_csv) {
$temp = array(get_lang('LinksMostClicked'), ''); $temp = array(get_lang('LinksMostClicked'), '');
@ -383,11 +486,19 @@ if ($export_csv) {
if (!empty($links_most_visited)) { if (!empty($links_most_visited)) {
foreach ($links_most_visited as $row) { foreach ($links_most_visited as $row) {
echo ' <tr> echo ' <tr>
<td>'.Display::url($row['title'].' ('.$row['url'].')', $row['url']).'</td> <td>'.Display::url(
<td align="right">'.$row['count_visits'].' '.get_lang('Clicks').'</td> $row['title'].' ('.$row['url'].')',
$row['url']
).'</td>
<td align="right">'.$row['count_visits'].' '.get_lang(
'Clicks'
).'</td>
</tr>'; </tr>';
if ($export_csv) { if ($export_csv) {
$temp = array($row['title'], $row['count_visits'].' '.get_lang('Clicks', '')); $temp = array(
$row['title'],
$row['count_visits'].' '.get_lang('Clicks', '')
);
$csv_content[] = $temp; $csv_content[] = $temp;
} }
} }
@ -400,6 +511,7 @@ if (!empty($links_most_visited)) {
} }
echo '</table></div>'; echo '</table></div>';
echo '<div class="clear"></div>'; echo '<div class="clear"></div>';
}
// send the csv file if asked // send the csv file if asked
if ($export_csv) { if ($export_csv) {

Loading…
Cancel
Save