$scoretotal_display = $scoredisplay->display_score($scoretotal,SCORE_DIV_PERCENT); //a student always sees only the teacher's repartition
//$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) {
@ -133,14 +133,7 @@ class GradebookTable extends SortableTable {
// list of items inside the gradebook (exercises, lps, fora, etc)
$row = array ();
$item = $data[0];
$id = $item->get_id();
//the following condition seems strange to me - YW 20110421
//GET['selectcat'] is the main gradebook. When defined, it means we are looking at the whole stuff instead of one sub-element (or something like that?)
//if (empty($_GET['selectcat']) ) { //if not particular gradebook item was selected, take the certificate score for the current item
$sql_verified='SELECT count(*) AS count,path_certificate as path,user_id FROM '.$table_certificate.' gc WHERE cat_id="'.Database::escape_string($cat_id).'" AND user_id="'.Database::escape_string($user_id).'" GROUP BY user_id,cat_id';
if (is_file($path_directory_user_certificate)===false) {
$delete_db=true;
} else {
$delete_db=false;
}
}
if (Database::result($rs_verified,0,'count')==1 && $delete_db===true) {
$sql_delete='DELETE FROM '.$table_certificate.' WHERE cat_id="'.Database::escape_string($cat_id).'" AND user_id="'.Database::escape_string($user_id).'" ';
$rs_delete=Database::query($sql_delete);
return true;
} else {
return false;
}
} else {
//path is not generate delete only the DB record
$sql_delete='DELETE FROM '.$table_certificate.' WHERE cat_id="'.Database::escape_string($cat_id).'" AND user_id="'.Database::escape_string($user_id).'" ';
$rs_delete=Database::query($sql_delete);
return true;
}
}
function get_user_certificate_content($user_id, $course_code, $is_preview = false) {