|
|
|
@ -22,54 +22,70 @@ if (empty($courseInfo)) { |
|
|
|
|
|
|
|
|
|
$sessionId = isset($_GET['id_session']) ? (int) $_GET['id_session'] : 0; |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* @param array $course |
|
|
|
|
* @param int $session_id |
|
|
|
|
* @return array |
|
|
|
|
*/ |
|
|
|
|
function get_course_usage($course, $session_id = 0) |
|
|
|
|
{ |
|
|
|
|
$courseId = $course['real_id']; |
|
|
|
|
// Learnpaths |
|
|
|
|
$table = Database::get_course_table(TABLE_LP_MAIN); |
|
|
|
|
$usage[] = array( |
|
|
|
|
get_lang(ucfirst(TOOL_LEARNPATH)), |
|
|
|
|
CourseManager::count_rows_course_table($table, $session_id, $courseId) |
|
|
|
|
); |
|
|
|
|
// Forums |
|
|
|
|
$table = Database::get_course_table(TABLE_FORUM); |
|
|
|
|
$usage[] = array(get_lang('Forums'), CourseManager::count_rows_course_table($table, $session_id, $courseId)); |
|
|
|
|
// Quizzes |
|
|
|
|
$table = Database::get_course_table(TABLE_QUIZ_TEST); |
|
|
|
|
$usage[] = array( |
|
|
|
|
get_lang(ucfirst(TOOL_QUIZ)), |
|
|
|
|
CourseManager::count_rows_course_table($table, $session_id, $courseId) |
|
|
|
|
); |
|
|
|
|
// Documents |
|
|
|
|
$table = Database::get_course_table(TABLE_DOCUMENT); |
|
|
|
|
$usage[] = array( |
|
|
|
|
get_lang(ucfirst(TOOL_DOCUMENT)), |
|
|
|
|
CourseManager::count_rows_course_table($table, $session_id, $courseId) |
|
|
|
|
); |
|
|
|
|
// Groups |
|
|
|
|
$table = Database::get_course_table(TABLE_GROUP); |
|
|
|
|
$usage[] = array( |
|
|
|
|
get_lang(ucfirst(TOOL_GROUP)), |
|
|
|
|
CourseManager::count_rows_course_table($table, $session_id, $courseId) |
|
|
|
|
); |
|
|
|
|
// Calendar |
|
|
|
|
$table = Database::get_course_table(TABLE_AGENDA); |
|
|
|
|
$usage[] = array( |
|
|
|
|
get_lang(ucfirst(TOOL_CALENDAR_EVENT)), |
|
|
|
|
CourseManager::count_rows_course_table($table, $session_id, $courseId) |
|
|
|
|
); |
|
|
|
|
// Link |
|
|
|
|
$table = Database::get_course_table(TABLE_LINK); |
|
|
|
|
$usage[] = array( |
|
|
|
|
get_lang(ucfirst(TOOL_LINK)), |
|
|
|
|
CourseManager::count_rows_course_table($table, $session_id, $courseId) |
|
|
|
|
); |
|
|
|
|
// Announcements |
|
|
|
|
$table = Database::get_course_table(TABLE_ANNOUNCEMENT); |
|
|
|
|
$usage[] = array( |
|
|
|
|
get_lang(ucfirst(TOOL_ANNOUNCEMENT)), |
|
|
|
|
CourseManager::count_rows_course_table($table, $session_id, $courseId) |
|
|
|
|
); |
|
|
|
|
$tables = [ |
|
|
|
|
[ |
|
|
|
|
Database::get_course_table(TABLE_LP_MAIN), |
|
|
|
|
get_lang(ucfirst(TOOL_LEARNPATH)), |
|
|
|
|
], |
|
|
|
|
[ |
|
|
|
|
Database::get_course_table(TABLE_FORUM), |
|
|
|
|
get_lang('Forums'), |
|
|
|
|
], |
|
|
|
|
[ |
|
|
|
|
Database::get_course_table(TABLE_QUIZ_TEST), |
|
|
|
|
get_lang(ucfirst(TOOL_QUIZ)), |
|
|
|
|
], |
|
|
|
|
[ |
|
|
|
|
Database::get_course_table(TABLE_DOCUMENT), |
|
|
|
|
get_lang(ucfirst(TOOL_DOCUMENT)), |
|
|
|
|
], |
|
|
|
|
[ |
|
|
|
|
Database::get_course_table(TABLE_GROUP), |
|
|
|
|
get_lang(ucfirst(TOOL_GROUP)), |
|
|
|
|
], |
|
|
|
|
[ |
|
|
|
|
Database::get_course_table(TABLE_AGENDA), |
|
|
|
|
get_lang('Calendar'), |
|
|
|
|
], |
|
|
|
|
[ |
|
|
|
|
Database::get_course_table(TABLE_LINK), |
|
|
|
|
get_lang(ucfirst(TOOL_LINK)), |
|
|
|
|
], |
|
|
|
|
[ |
|
|
|
|
Database::get_course_table(TABLE_ANNOUNCEMENT), |
|
|
|
|
get_lang(ucfirst(TOOL_ANNOUNCEMENT)), |
|
|
|
|
] |
|
|
|
|
]; |
|
|
|
|
|
|
|
|
|
$usage = []; |
|
|
|
|
$conditionSession = ''; |
|
|
|
|
if ($session_id !== '') { |
|
|
|
|
$session_id = intval($session_id); |
|
|
|
|
$conditionSession = " AND session_id = '$session_id' "; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
foreach ($tables as $tableInfo) { |
|
|
|
|
$table = $tableInfo[0]; |
|
|
|
|
$title = $tableInfo[1]; |
|
|
|
|
$sql = "SELECT COUNT(*) count FROM $table |
|
|
|
|
WHERE c_id = '$courseId' $conditionSession "; |
|
|
|
|
$rs = Database::query($sql); |
|
|
|
|
$row = Database::fetch_array($rs); |
|
|
|
|
|
|
|
|
|
$usage[] = array( |
|
|
|
|
$title, |
|
|
|
|
$row['count'] |
|
|
|
|
); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
return $usage; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
@ -88,7 +104,12 @@ Display::display_header($tool_name); |
|
|
|
|
|
|
|
|
|
echo Display::page_header(get_lang('CourseUsage')); |
|
|
|
|
|
|
|
|
|
$table = new SortableTableFromArray(get_course_usage($courseInfo, $sessionId), 0, 20, 'usage_table'); |
|
|
|
|
$table = new SortableTableFromArray( |
|
|
|
|
get_course_usage($courseInfo, $sessionId), |
|
|
|
|
0, |
|
|
|
|
20, |
|
|
|
|
'usage_table' |
|
|
|
|
); |
|
|
|
|
$table->set_additional_parameters(array('code' => $courseInfo['code'])); |
|
|
|
|
$table->set_other_tables(array('user_table', 'class_table')); |
|
|
|
|
$table->set_header(0, get_lang('Tool'), true); |
|
|
|
|