|
@@ -27,7 +27,7 @@ function confirmation() {
|
|
|
if (confirm(\" ".trim(get_lang('AreYouSureToDelete'))." ?\"))
|
|
|
{return true;}
|
|
|
else
|
|
|
- {return false;}
|
|
|
+ {return false;}
|
|
|
}
|
|
|
</script>";
|
|
|
|
|
@@ -46,7 +46,7 @@ switch ($action) {
|
|
|
|
|
|
$certificate_list = get_list_users_certificates($cat_id);
|
|
|
$certificate_path_list = array();
|
|
|
-
|
|
|
+
|
|
|
if (!empty($certificate_list)) {
|
|
|
foreach ($certificate_list as $index=>$value) {
|
|
|
$list_certificate = get_list_gradebook_certificates_by_user_id($value['user_id'], $cat_id);
|
|
@@ -56,24 +56,24 @@ switch ($action) {
|
|
|
if ($certificate_obj->html_file_is_generated()) {
|
|
|
$certificate_path_list[]= $certificate_obj->html_file;
|
|
|
}
|
|
|
- }
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
if (!empty($certificate_path_list)) {
|
|
|
- // Print certificates (without the common header/footer/watermark
|
|
|
+ // Print certificates (without the common header/footer/watermark
|
|
|
// stuff) and return as one multiple-pages PDF
|
|
|
$pdf->html_to_pdf($certificate_path_list, get_lang('Certificates'), null, false, false);
|
|
|
}
|
|
|
break;
|
|
|
case 'generate_all_certificates':
|
|
|
- $user_list = Coursemanager::get_user_list_from_course_code(api_get_course_id(), api_get_session_id());
|
|
|
+ $user_list = CourseManager::get_user_list_from_course_code(api_get_course_id(), api_get_session_id());
|
|
|
if (!empty($user_list)) {
|
|
|
- foreach ($user_list as $user_info) {
|
|
|
+ foreach ($user_list as $user_info) {
|
|
|
Category::register_user_certificate($cat_id, $user_info['user_id']);
|
|
|
}
|
|
|
}
|
|
|
break;
|
|
|
- case 'delete_all_certificates':
|
|
|
+ case 'delete_all_certificates':
|
|
|
$certificate_list = get_list_users_certificates($cat_id);
|
|
|
if (!empty($certificate_list)) {
|
|
|
foreach ($certificate_list as $index=>$value) {
|
|
@@ -102,7 +102,7 @@ if ($_GET['action'] == 'delete') {
|
|
|
if ($result ==true) {
|
|
|
Display::display_confirmation_message(get_lang('CertificateRemoved'));
|
|
|
} else {
|
|
|
- Display::display_error_message(get_lang('CertificateNotRemoved'));
|
|
|
+ Display::display_error_message(get_lang('CertificateNotRemoved'));
|
|
|
}
|
|
|
}
|
|
|
}
|
|
@@ -114,47 +114,47 @@ echo Display::page_header(get_lang('GradebookListOfStudentsCertificates'));
|
|
|
|
|
|
//@todo replace all this code with something like get_total_weight()
|
|
|
$cats = Category :: load ($cat_id, null, null, null, null, null, false);
|
|
|
-
|
|
|
+
|
|
|
if (!empty($cats)) {
|
|
|
-
|
|
|
+
|
|
|
//with this fix the teacher only can view 1 gradebook
|
|
|
if (api_is_platform_admin()) {
|
|
|
$stud_id= (api_is_allowed_to_edit() ? null : api_get_user_id());
|
|
|
} else {
|
|
|
$stud_id= api_get_user_id();
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
$total_weight = $cats[0]->get_weight();
|
|
|
-
|
|
|
+
|
|
|
$allcat = $cats[0]->get_subcategories($stud_id, api_get_course_id(), api_get_session_id());
|
|
|
$alleval = $cats[0]->get_evaluations($stud_id);
|
|
|
$alllink = $cats[0]->get_links($stud_id);
|
|
|
-
|
|
|
+
|
|
|
$datagen = new GradebookDataGenerator ($allcat,$alleval, $alllink);
|
|
|
-
|
|
|
+
|
|
|
$total_resource_weight = 0;
|
|
|
- if (!empty($datagen)) {
|
|
|
+ if (!empty($datagen)) {
|
|
|
$data_array = $datagen->get_data(GradebookDataGenerator :: GDG_SORT_NAME,0,null,true);
|
|
|
-
|
|
|
+
|
|
|
if (!empty($data_array)) {
|
|
|
$newarray = array();
|
|
|
foreach ($data_array as $data) {
|
|
|
$newarray[] = array_slice($data, 1);
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
foreach($newarray as $item) {
|
|
|
$total_resource_weight = $total_resource_weight + $item['2'];
|
|
|
- }
|
|
|
+ }
|
|
|
}
|
|
|
- }
|
|
|
-
|
|
|
+ }
|
|
|
+
|
|
|
if ($total_resource_weight != $total_weight) {
|
|
|
Display::display_warning_message(get_lang('SumOfActivitiesWeightMustBeEqualToTotalWeight'));
|
|
|
}
|
|
|
}
|
|
|
-
|
|
|
- $certificate_list = get_list_users_certificates($cat_id);
|
|
|
-
|
|
|
+
|
|
|
+ $certificate_list = get_list_users_certificates($cat_id);
|
|
|
+
|
|
|
echo '<div class="btn-group">';
|
|
|
$url = api_get_self().'?action=generate_all_certificates'.'&'.api_get_cidReq().'&cat_id='.$cat_id;
|
|
|
echo Display::url(get_lang('GenerateCertificates'), $url, array('class' => 'btn'));
|
|
@@ -177,7 +177,7 @@ echo '</div>';
|
|
|
echo '</tr>';
|
|
|
echo '<tr><td>
|
|
|
<table class="data_table">';
|
|
|
- $list_certificate = get_list_gradebook_certificates_by_user_id ($value['user_id'], $cat_id);
|
|
|
+ $list_certificate = get_list_gradebook_certificates_by_user_id ($value['user_id'], $cat_id);
|
|
|
foreach ($list_certificate as $value_certificate) {
|
|
|
echo '<tr>';
|
|
|
echo '<td width="50%">'.get_lang('Score').' : '.$value_certificate['score_certificate'].'</td>';
|
|
@@ -189,10 +189,10 @@ echo '</div>';
|
|
|
echo '<a onclick="return confirmation();" href="gradebook_display_certificate.php?sec_token='.$token.'&cidReq='.$course_code.'&action=delete&cat_id='.$cat_id.'&certificate_id='.$value_certificate['id'].'">
|
|
|
'.Display::return_icon('delete.png',get_lang('Delete')).'
|
|
|
</a>';
|
|
|
- echo '</td></tr>';
|
|
|
+ echo '</td></tr>';
|
|
|
}
|
|
|
echo '</table>';
|
|
|
- echo '</td></tr>';
|
|
|
+ echo '</td></tr>';
|
|
|
}
|
|
|
echo '</table>';
|
|
|
}
|