@ -540,7 +540,7 @@ if (isset ($move_form)){
// LOAD DATA & DISPLAY TABLE
// LOAD DATA & DISPLAY TABLE
$is_platform_admin = api_is_platform_admin();
$is_platform_admin = api_is_platform_admin();
$is_course_admin = api_is_allowed_to_create_course();
$is_course_admin = api_is_allowed_to_edit(null, true);// api_is_allowed_to_ create_course();
//load data for category, evaluation and links
//load data for category, evaluation and links
if (empty ($_GET['selectcat'])) {
if (empty ($_GET['selectcat'])) {
@ -802,6 +802,7 @@ if (( count($allcat) == 0) && ( count($alleval) == 0 ) && ( count($alllink) == 0
Display :: display_normal_message(get_lang('GradebookWelcomeMessage') . '< br / > < br / > < form name = "createcat" method = "post" action = "' . api_get_self() . '?createallcategories=1" > < input type = "submit" value = "' . get_lang('CreateAllCat') . '" > < / form > ',false);
Display :: display_normal_message(get_lang('GradebookWelcomeMessage') . '< br / > < br / > < form name = "createcat" method = "post" action = "' . api_get_self() . '?createallcategories=1" > < input type = "submit" value = "' . get_lang('CreateAllCat') . '" > < / form > ',false);
}
}
}
}
//here we are in a sub category
//here we are in a sub category
if ($category != '0') {
if ($category != '0') {
$cat = new Category();
$cat = new Category();
@ -851,6 +852,7 @@ if ($category != '0') {
$cattotal = Category :: load($category_id);
$cattotal = Category :: load($category_id);
$scoretotal= $cattotal[0]->calc_score(api_get_user_id());
$scoretotal= $cattotal[0]->calc_score(api_get_user_id());
/*
/*
//Overwritten the old total with the real total of the gradebook if the line below is deleted, then when a user doesn't finish a test the total will be different from the real total
//Overwritten the old total with the real total of the gradebook if the line below is deleted, then when a user doesn't finish a test the total will be different from the real total
$scoretotal[1] = $item_total;
$scoretotal[1] = $item_total;
@ -867,7 +869,7 @@ if ($category != '0') {
//$score_compare = ($scoretotal[0] / $scoretotal[1]) * 100; //build the total percentage obtained in order to compare it to the minimum certification percentage
//$score_compare = ($scoretotal[0] / $scoretotal[1]) * 100; //build the total percentage obtained in order to compare it to the minimum certification percentage
if (isset($certificate_min_score) & & $item_value >= $certificate_min_score) {
if (isset($certificate_min_score) & & $item_value >= $certificate_min_score) {
$url = api_get_path(WEB_CODE_PATH) .'gradebook/'.Security::remove_XSS($_SESSION['gradebook_dest']).'?export_certificate=yes&cat_id='.$cats[0]->get_id();
$url = api_get_path(WEB_CODE_PATH) .'gradebook/'.Security::remove_XSS($_SESSION['gradebook_dest']).'?export_certificate=yes&cat_id='.$cats[0]->get_id();
//$certificates.= '< img src = "'.api_get_path(WEB_CODE_PATH) . 'img/logo.gif" / > '.get_lang('Certificates').'< / a > < strong > '.get_lang('Total').': '.$scoretotal_display.'< / strong > ';
$certificates = Display::url(Display::return_icon('certificate.png', get_lang('Certificates'), array(), 48), $url, array('target'=>'_blank'));
$certificates = Display::url(Display::return_icon('certificate.png', get_lang('Certificates'), array(), 48), $url, array('target'=>'_blank'));
echo '< div class = "actions" align = "right" > ';
echo '< div class = "actions" align = "right" > ';
@ -875,6 +877,7 @@ if ($category != '0') {
echo '< / div > ';
echo '< / div > ';
}
}
} //end hack
} //end hack
DisplayGradebook::display_header_gradebook($cats[0], 0, $category_id, $is_course_admin, $is_platform_admin, $simple_search_form, false, true);
DisplayGradebook::display_header_gradebook($cats[0], 0, $category_id, $is_course_admin, $is_platform_admin, $simple_search_form, false, true);
}
}
} else {
} else {
@ -889,6 +892,7 @@ if (api_is_allowed_to_edit(null, true)) {
if ( (isset ($_GET['selectcat']) & & $_GET['selectcat']< >0) ) {
if ( (isset ($_GET['selectcat']) & & $_GET['selectcat']< >0) ) {
//
//
} else {
} else {
if (((isset ($_GET['selectcat']) & & $_GET['selectcat']==0) || ((isset($_GET['cidReq']) & & $_GET['cidReq']!==''))) || isset($_GET['isStudentView']) & & $_GET['isStudentView']=='false') {
if (((isset ($_GET['selectcat']) & & $_GET['selectcat']==0) || ((isset($_GET['cidReq']) & & $_GET['cidReq']!==''))) || isset($_GET['isStudentView']) & & $_GET['isStudentView']=='false') {
$cats = Category :: load(null, null, $course_code, null, null, $session_id, false);
$cats = Category :: load(null, null, $course_code, null, null, $session_id, false);
if (!$first_time=1) {
if (!$first_time=1) {