'document.php', 'name' => get_lang('Documents')); $htmlHeadXtra[] = api_get_js('jqplot/jquery.jqplot.min.js'); $htmlHeadXtra[] = api_get_js('jqplot/plugins/jqplot.pieRenderer.min.js'); $htmlHeadXtra[] = api_get_js('jqplot/plugins/jqplot.donutRenderer.min.js'); $htmlHeadXtra[] = api_get_css(api_get_path(WEB_LIBRARY_PATH).'javascript/jqplot/jquery.jqplot.min.css'); $course_code = api_get_course_id(); $course_id = api_get_course_int_id(); $session_id = api_get_session_id(); $group_id = api_get_group_id(); $user_id = api_get_user_id(); $user_info = api_get_user_info($user_id); $session = array(); $user_name = $user_info['complete_name']; $course_list = SessionManager::get_course_list_by_session_id ($session_id); $session_list = SessionManager::get_session_by_course($course_id); $total_quota_bytes = DocumentManager::get_course_quota(); $quota_bytes = DocumentManager::documents_total_space($course_id, 0 , 0); $quota_percentage = round($quota_bytes/$total_quota_bytes, 2)*100; $session[] = array(get_lang('Course').' ('.Text::format_file_size($quota_bytes).')', $quota_percentage); $used_quota_bytes = $quota_bytes; if (!empty($session_list)) { foreach ($session_list as $session_data) { $quota_percentage = 0; $quota_bytes = intval(DocumentManager::documents_total_space($course_id, null, $session_data['id'])); if (!empty($quota_bytes)) { $quota_percentage = round($quota_bytes/$total_quota_bytes, 2)*100; } if ($session_id == $session_data['id']) { $session_data['name'] = $session_data['name'] . ' * '; } $used_quota_bytes += $quota_bytes; $session[] = array(addslashes(get_lang('Session').': '.$session_data['name']).' ('.Text::format_file_size($quota_bytes).')', $quota_percentage); } } $group_list = GroupManager::get_groups(); if (!empty($group_list)) { foreach ($group_list as $group_data) { $quota_percentage = 0; $my_group_id = $group_data['id']; $quota_bytes = intval(DocumentManager::documents_total_space($course_id, $my_group_id, 0)); if (!empty($quota_bytes)) { $quota_percentage = round($quota_bytes/$total_quota_bytes, 2)*100; } if ($group_id == $my_group_id) { $group_data['name'] = $group_data['name'] . ' * '; } $used_quota_bytes += $quota_bytes; $session[] = array(addslashes(get_lang('Group').': '.$group_data['name']).' ('.Text::format_file_size($quota_bytes).')', $quota_percentage); } } //Showing weight of documents uploaded by user $document_list = DocumentManager::get_all_document_data($_course); if (is_array($document_list)) { foreach ($document_list as $document_data) { if ($document_data['insert_user_id'] == api_get_user_id() && $document_data['filetype'] == 'file') { $quota_bytes += $document_data['size']; } } if ($quota_bytes != 0) { $quota_percentage = round($quota_bytes/$total_quota_bytes, 2)*100; } $session[] = array(addslashes(get_lang('Teacher').': '.$user_name).' ('.Text::format_file_size($quota_bytes).')', $quota_percentage); //if a sesson is active if ($session_id != 0) { if (!empty($course_list)) { $total_courses_quota = 0; $total_quota_bytes = 0; foreach ($course_list as $course_data) { $total_quota_bytes += DocumentManager::get_course_quota($course_data['id']); } if ($quota_bytes != 0) { $quota_percentage = round($quota_bytes/$total_quota_bytes, 2)*100; } } $session[] = array(addslashes(get_lang('Teacherinsession').': '.$user_name), $quota_percentage); } } $quota_percentage = round(($total_quota_bytes - $used_quota_bytes)/$total_quota_bytes, 2)*100; $session[] = array(addslashes(get_lang('ShowCourseQuotaUse')).' ('.Text::format_file_size($total_quota_bytes - $used_quota_bytes).') ', $quota_percentage); $quota_data = json_encode($session); $htmlHeadXtra[] = " "; $app['title'] = $tool_name; $tpl = $app['template']; $content = Display::page_subheader(get_lang('ShowCourseQuotaUse')).'
'; $tpl->assign('content', $content); $tpl->display_one_col_template();