start.php 801 B

12345678910111213141516171819202122232425262728
  1. <?php
  2. /* For license terms, see /license.txt */
  3. /**
  4. * This script initiates a test2pdf plugin.
  5. *
  6. * @package chamilo.plugin.test2pdf
  7. */
  8. require_once __DIR__.'/../../vendor/autoload.php';
  9. $course_plugin = 'test2pdf'; //needed in order to load the plugin lang variables
  10. require_once __DIR__.'/config.php';
  11. $tool_name = get_lang('Test2pdf');
  12. $plugin = Test2pdfPlugin::create();
  13. $enable = $plugin->get('enable_plugin') == 'true';
  14. if ($enable) {
  15. $url = 'src/view-pdf.php?'.api_get_cidreq();
  16. header('Location: '.$url);
  17. exit;
  18. } else {
  19. Display::addFlash(Display::return_message($plugin->get_lang('PluginDisabledFromAdminPanel')));
  20. $url = api_get_path(WEB_PATH).'courses/'.api_get_course_id().'/index.php?id_session='.api_get_session_id();
  21. header('Location:'.$url);
  22. exit;
  23. }