start.php 1.0 KB

12345678910111213141516171819202122232425262728293031323334
  1. <?php
  2. /**
  3. * This script initiates a customcertificate plugin.
  4. *
  5. * @package chamilo.plugin.customcertificate
  6. */
  7. $course_plugin = 'customcertificate';
  8. require_once __DIR__.'/config.php';
  9. $plugin = CustomCertificatePlugin::create();
  10. $enable = $plugin->get('enable_plugin_customcertificate') == 'true';
  11. if ($enable) {
  12. if (api_is_platform_admin() || api_is_teacher()) {
  13. $url = 'src/index.php?';
  14. $url .= (isset($_GET['cidReq']) ? api_get_cidreq() : 'default=1');
  15. header('Location: '.$url);
  16. exit;
  17. } else {
  18. $session = api_get_session_entity(api_get_session_id());
  19. $_course = api_get_course_info();
  20. $webCoursePath = api_get_path(WEB_COURSE_PATH);
  21. $url = $webCoursePath.$_course['path'].'/index.php'.($session ? '?id_session='.$session->getId() : '');
  22. Display::addFlash(
  23. Display::return_message($plugin->get_lang('OnlyAdminPlatform'))
  24. );
  25. header('Location: '.$url);
  26. exit;
  27. }
  28. } else {
  29. api_not_allowed(true, $plugin->get_lang('ToolDisabled'));
  30. }