my_certificates.php 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. <?php
  2. /* For licensing terms, see /license.txt */
  3. /**
  4. * List of achieved certificates by the current user
  5. * @author Angel Fernando Quiroz Campos <angel.quiroz@beeznest.com>
  6. * @package chamilo.gradebook
  7. */
  8. $cidReset = true;
  9. require_once __DIR__.'/../inc/global.inc.php';
  10. if (api_is_anonymous()) {
  11. api_not_allowed(true);
  12. }
  13. $userId = api_get_user_id();
  14. $courseList = GradebookUtils::getUserCertificatesInCourses($userId);
  15. $sessionList = GradebookUtils::getUserCertificatesInSessions($userId);
  16. if (empty($courseList) && empty($sessionList)) {
  17. Display::addFlash(
  18. Display::return_message(get_lang('YouNotYetAchievedCertificates'), 'warning')
  19. );
  20. }
  21. $template = new Template(get_lang('MyCertificates'));
  22. $template->assign('course_list', $courseList);
  23. $template->assign('session_list', $sessionList);
  24. $templateName = $template->get_template('gradebook/my_certificates.tpl');
  25. $content = $template->fetch($templateName);
  26. if (api_get_setting('allow_public_certificates') === 'true') {
  27. $template->assign(
  28. 'actions',
  29. Display::toolbarButton(
  30. get_lang('SearchCertificates'),
  31. api_get_path(WEB_CODE_PATH)."gradebook/search.php",
  32. 'search',
  33. 'info'
  34. )
  35. );
  36. }
  37. $template->assign('content', $content);
  38. $template->display_one_col_template();