chamilo/chamilo-lms

View on GitHub
public/plugin/test2pdf/start.php

Summary

Maintainability
A
0 mins
Test Coverage
<?php

/* For license terms, see /license.txt */

/**
 * This script initiates a test2pdf plugin.
 */
require_once __DIR__.'/../../vendor/autoload.php';

$course_plugin = 'test2pdf'; //needed in order to load the plugin lang variables
require_once __DIR__.'/config.php';

$tool_name = get_lang('Test2pdf');

$plugin = Test2pdfPlugin::create();
$enable = 'true' == $plugin->get('enable_plugin');

if ($enable) {
    $url = 'src/view-pdf.php?'.api_get_cidreq();
    header('Location: '.$url);
    exit;
} else {
    Display::addFlash(Display::return_message($plugin->get_lang('PluginDisabledFromAdminPanel')));
    $url = api_get_path(WEB_PATH).'courses/'.api_get_course_id().'/index.php?id_session='.api_get_session_id();
    header('Location:'.$url);
    exit;
}