my_certificates.php 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  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. if (api_is_anonymous()) {
  10. api_not_allowed(true);
  11. }
  12. $userId = api_get_user_id();
  13. $courseList = GradebookUtils::getUserCertificatesInCourses($userId);
  14. $sessionList = GradebookUtils::getUserCertificatesInSessions($userId);
  15. if (empty($courseList) && empty($sessionList)) {
  16. Display::addFlash(
  17. Display::return_message(get_lang('YouNotYetAchievedCertificates'), 'warning')
  18. );
  19. }
  20. $template = \Chamilo\CoreBundle\Framework\Container::getTwig();
  21. $template->addGlobal('course_list', $courseList);
  22. $template->addGlobal('session_list', $sessionList);
  23. if (api_get_setting('course.allow_public_certificates') == 'true') {
  24. $template->addGlobal(
  25. 'actions',
  26. Display::toolbarButton(
  27. get_lang('SearchCertificates'),
  28. api_get_path(WEB_CODE_PATH) . "gradebook/search.php",
  29. 'search',
  30. 'info'
  31. )
  32. );
  33. }
  34. echo $template->render('@template_style/gradebook/my_certificates.html.twig');