<?php
/**
 * Copyright (c) 2006-2022 LogicalDOC
 * WebSites: www.logicaldoc.com
 * 
 * No bytes were intentionally harmed during the development of this application.
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 2 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License along
 * with this program; if not, write to the Free Software Foundation, Inc.,
 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
 */
defined('_JEXEC') or die;

//ini_set('display_errors', false);
//error_reporting(E_ALL);
$format = JRequest::getVar('format');
if ($format == 'html' || $format == null) {
    ?>

    <link rel="stylesheet" media="screen" type="text/css" href="<?= JURI::base(true) . '/components/com_logicaldoc/assets/css/normalize.css'; ?>" />

    <!-- Icon web fonts -->
    <link rel="stylesheet" media="screen" type="text/css" href="<?= JURI::base(true) . '/components/com_logicaldoc/assets/css/fortawesome/font-awesome.min.css'; ?>" />

    <link type="text/css" href="<?php echo JURI::base(true) . '/components/com_logicaldoc/assets/css/jqueryui/jquery-ui-1.11.4.min.css'; ?>" rel="stylesheet" />    

    <!--Style table-->
    <link type="text/css" href="<?php echo JURI::base(true) . '/components/com_logicaldoc/assets/css/datatables/dataTables.jqueryui.css'; ?>" rel="stylesheet" />    

    <!--Estilo para la validacion-->
    <link type="text/css" href="<?php echo JURI::base(true) . '/components/com_logicaldoc/assets/css/validationEngine.jquery.css'; ?>" rel="stylesheet" />

    <!--radio y check-->
    <link type="text/css" href="<?php echo JURI::base(true) . '/components/com_logicaldoc/assets/css/icheck/all.css'; ?>" rel="stylesheet"/>

    <link type="text/css" href="<?php echo JURI::base(true) . '/components/com_logicaldoc/assets/css/style.css'; ?>" rel="stylesheet" />

    <!--Script de jquery-->
    <script type="text/javascript" src="<?php echo JURI::base(true) . '/components/com_logicaldoc/assets/js/jquery-1.11.2.min.js'; ?>"></script>
    <script type="text/javascript" src="<?php echo JURI::base(true) . '/components/com_logicaldoc/assets/js/jquery-ui-1.11.4.min.js'; ?>"></script>
    <script type="text/javascript" src="<?php echo JURI::base(true) . '/components/com_logicaldoc/assets/js/jquery.ui.datepicker-es.js'; ?>"></script>

    <!--script para la validacion-->
    <script type="text/javascript" src="<?php echo JURI::base(true) . '/components/com_logicaldoc/assets/js/validador/jquery.validationEngine-en.js'; ?>"></script>
    <script type="text/javascript" src="<?php echo JURI::base(true) . '/components/com_logicaldoc/assets/js/validador/jquery.validationEngine.js'; ?>"></script>

    <!--script para la tabla-->
    <script type="text/javascript" src="<?php echo JURI::base(true) . '/components/com_logicaldoc/assets/js/datatables/jquery.dataTables.min.js'; ?>"></script>
    <script type="text/javascript" src="<?php echo JURI::base(true) . '/components/com_logicaldoc/assets/js/datatables/dataTables.jqueryui.min.js'; ?>"></script>

    <!--radio y check-->
    <script type="text/javascript" src="<?php echo JURI::base(true) . '/components/com_logicaldoc/assets/js/jquery.icheck.js'; ?>"></script>

    <script language="javascript" type="text/javascript">
        $(document).ready(function () {
            $('input[type=checkbox]').each(function () {
                var self = $(this),
                        label = self.next(),
                        label_text = label.text();

                label.remove();
                self.iCheck({
                    checkboxClass: 'icheckbox_line-grey',
                    radioClass: 'iradio_line-red',
                    insert: '<div class="icheck_line-icon"></div>' + label_text
                });
            });
        });
    </script>
    <?php
}
if (!defined('DS'))
    define('DS', DIRECTORY_SEPARATOR);

include JPATH_COMPONENT . DS . 'assets/php/1/logicaldoc/LogicalDOC.php';

use logicaldoc\LogicalDOC;

$logicaldoc = new LogicalDOC();
$controller = JRequest::getVar('view');
switch ($controller) {
    case 'desktop':
        require_once(JPATH_COMPONENT . DS . 'controllers' . DS . $controller . '.php');
        $controllerName = 'LogicalDOCController' . $controller;
        $controller = new $controllerName();
        $controller->execute(JRequest::getCmd('task'));
        $controller->redirect();
        break;
    case 'search':
        require_once(JPATH_COMPONENT . DS . 'controllers' . DS . $controller . '.php');
        $controllerName = 'LogicalDOCController' . $controller;
        $controller = new $controllerName();
        $controller->execute(JRequest::getCmd('task'));
        $controller->redirect();
        break;
}
?>
