gradebook_display_certificate.php 2.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586
  1. <?php
  2. /* For licensing terms, see /license.txt */
  3. $language_file = 'gradebook';
  4. //$cidReset = true;
  5. require_once '../inc/global.inc.php';
  6. require_once 'lib/gradebook_functions.inc.php';
  7. require_once api_get_path(LIBRARY_PATH).'usermanager.lib.php';
  8. //extra javascript functions for in html head:
  9. $htmlHeadXtra[] =
  10. "<script language='javascript' type='text/javascript'>
  11. function confirmation()
  12. {
  13. if (confirm(\" ".trim(get_lang('AreYouSureToDelete'))." ?\"))
  14. {return true;}
  15. else
  16. {return false;}
  17. }
  18. </script>";
  19. api_block_anonymous_users();
  20. if (!api_is_allowed_to_edit()) {
  21. api_not_allowed(true);
  22. }
  23. $interbreadcrumb[] = array ('url' => Security::remove_XSS($_SESSION['gradebook_dest']).'?', 'name' => get_lang('Gradebook'));
  24. $interbreadcrumb[] = array ('url' => Security::remove_XSS($_SESSION['gradebook_dest']).'?selectcat='.Security::remove_XSS($_GET['cat_id']),'name' => get_lang('Details'));
  25. $interbreadcrumb[] = array ('url' => 'gradebook_display_certificate.php?cat_id='.Security::remove_XSS($_GET['cat_id']),'name' => get_lang('GradebookListOfStudentsCertificates'));
  26. Display::display_header('');
  27. ?>
  28. <?php
  29. if (isset($_GET['user_id']) && $_GET['user_id']==strval(intval($_GET['user_id'])) && isset($_GET['cat_id']) && $_GET['cat_id']==strval(intval($_GET['cat_id']))) {
  30. if($_GET['action'] == 'delete') {
  31. $info=delete_certificate($_GET['cat_id'],$_GET['user_id']);
  32. if ($info===true) {
  33. Display::display_confirmation_message(get_lang('CertificateRemoved'));
  34. } else {
  35. Display::display_error_message(get_lang('CertificateNotRemoved'));
  36. }
  37. }
  38. }
  39. ?>
  40. <h3 class="actions" ><?php echo get_lang('GradebookListOfStudentsCertificates'); ?></h3>
  41. <table class="data_table" border="0" width="100%" >
  42. <?php
  43. $cat_id=isset($_GET['cat_id']) ? (int)$_GET['cat_id'] : null;
  44. $certificate_list = get_list_users_certificates($cat_id);
  45. if (count($certificate_list)==0) {
  46. echo get_lang('NoResultsAvailable');
  47. } else {
  48. foreach ($certificate_list as $index=>$value) {
  49. ?>
  50. <tr>
  51. <td width="100%" class="actions"><?php echo get_lang('Student').' : '. $value['firstname'].' '.$value['lastname'] ?>
  52. </td>
  53. </tr>
  54. <tr>
  55. <td>
  56. <table class="data_table" width="100%" >
  57. <?php
  58. $list_certificate = get_list_gradebook_certificates_by_user_id ($value['user_id'],$cat_id);
  59. foreach ($list_certificate as $index_certificate=>$value_certificate) {
  60. ?>
  61. <tr >
  62. <td width="50%"><?php echo get_lang('Score').' : '.$value_certificate['score_certificate'] ?></td>
  63. <td width="30%"><?php echo get_lang('Date').' : '.$value_certificate['date_certificate'] ?></td>
  64. <td width="20%"><a onclick="return confirmation();" href="gradebook_display_certificate.php?action=delete&<?php echo 'user_id='.$value_certificate['user_id'].'&amp;cat_id='.$value_certificate['cat_id'] ?>"><?php echo Display::return_icon('delete.gif',get_lang('Delete')); ?></a></td>
  65. </tr>
  66. <?php
  67. }
  68. ?>
  69. </table>
  70. </td>
  71. </tr>
  72. <?php
  73. }
  74. }
  75. ?>
  76. </table>
  77. <?php
  78. Display::display_footer();
  79. ?>