if (count($certificate_list) > 0) {
    $url = api_get_self() . '?action=export_all_certificates' . '&' . api_get_cidReq() . '&cat_id=' . $cat_id;
    echo Display::url(get_lang('ExportAllCertificatesToPDF'), $url, array('class' => 'btn'));
}
echo '</div>';
if (count($certificate_list) == 0) {
    echo Display::display_warning_message(get_lang('NoResultsAvailable'));
} else {
    echo '<br /><br /><table class="data_table">';
    foreach ($certificate_list as $index => $value) {
        echo '<tr>
                    <td width="100%" class="actions">' . get_lang('Student') . ' : ' . api_get_person_name($value['firstname'], $value['lastname']) . ' ( ' . $value['username'] . ')</td>';
        echo '</tr>';
        echo '<tr><td>
            <table class="data_table">';
        $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>';
            echo '<td width="30%">' . get_lang('Date') . ' : ' . api_convert_and_format_date($value_certificate['created_at']) . '</td>';
            echo '<td width="20%">';
            $url = Certificate::getCertificatePublicURL($value_certificate['id']);
            $certificates = Display::url(get_lang('Certificate'), $url, array('target' => '_blank', 'class' => 'btn'));
            echo $certificates;
            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 '</table>';
        echo '</td></tr>';
Esempio n. 2
0
 /**
  * @param int $catId
  */
 public static function deleteAllCertificates($catId)
 {
     $certificate_list = get_list_users_certificates($catId);
     if (!empty($certificate_list)) {
         foreach ($certificate_list as $index => $value) {
             $list_certificate = get_list_gradebook_certificates_by_user_id($value['user_id'], $catId);
             foreach ($list_certificate as $value_certificate) {
                 $certificate_obj = new Certificate($value_certificate['id']);
                 $certificate_obj->delete(true);
             }
         }
     }
 }