<?php
/**
 *
 * @extension       Marlev - Template Manager
 * @author          Lev Milicenco<support@marlev.it>
 * @link            http://www.marlev.it
 * @copyright       Copyright 2014 marlev.it All Rights Reserved
 * @license         http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL
 */
defined('_JEXEC') or die;
$input = JFactory::getApplication()->input;
$updatetime = $input->getInt("updatetime", 0);
if($updatetime === 1){
    echo '<span id="update-time" style="color:green;">'.JFactory::getDate()->format('Y-m-d H:i:s').'</span>';
    exit();
}
JHtml::_('bootstrap.tooltip');

JHtml::_('behavior.keepalive');
JHtml::_('formbehavior.chosen', 'select');

JHtml::_('jquery.framework');

$id = JRequest::getInt("id");
$session = JFactory::getSession();
$activemenu = $session->get('activemenu', "tm-home");
$session->clear('activemenu');
$document = JFactory::getDocument();
$prepare_rand = rand(0, 99999) . time();
$rand = substr(md5($prepare_rand), 0, 25);
$document->addStyleSheet(JURI::base() . 'components/com_tmarlevv2/helpers/style.css?' . $rand);
$document->addStyleSheet('https://maxcdn.bootstrapcdn.com/font-awesome/4.3.0/css/font-awesome.min.css');
//
$document->addStyleSheet(JURI::base() . 'components/com_tmarlevv2/helpers/bootstrap.css?' . $rand);
$document->addStyleSheet(JURI::base() . 'components/com_tmarlevv2/helpers/slides.css?' . $rand);
$getlink = str_replace("administrator/", "", JURI::base()) . 'templates/' . $this->load->template . "/";
$document->addScript(JURI::base() . 'components/com_tmarlevv2/helpers/jquery-ui.min.js?' . $rand);
$document->addScript(JURI::base() . 'components/com_tmarlevv2/helpers/functions.js?' . $rand);
$document->addScript(JURI::base() . 'components/com_tmarlevv2/helpers/admin.js?' . $rand);
$document->addScript(JURI::base() . 'components/com_tmarlevv2/helpers/layout.js?' . $rand);
?>
<?php //start close jomla divs          ?>
</div>
</div>
<?php //end close jomla divs     ?>
<div id="ml-save-fixed" class="btns-closed" style="display: none;">
    <div class="ml-apply-fixed ml-submit ml-apply" data-lang="<?php echo jText::_('COM_TMARLEV_SAVE_ALL') ?>" data-task="template.apply" >
        <?php echo jText::_('COM_TMARLEV_SAVE_ALL') ?>
    </div>

    <div class="ml-cancell-fixed ml-submit" data-lang="<?php echo jText::_('COM_TMARLEV_CANCELL') ?>" data-task="template.cancel">
        <?php echo jText::_('COM_TMARLEV_CANCELL') ?>
    </div>
</div>
<div class="layout-lift">
    <div class="layout-lift-section">
        <?php echo $this->layout_sections; ?>
    </div>
    <div class="layout-lift-block">
        <?php echo $this->layout_positionsblock; ?>
    </div>
</div>
<div id="ml-head">
    <div class="marlev-logo-container">
        <img align="center" src="<?php echo JUri::base() ?>/components/com_tmarlevv2/images/logo.png" alt="Marlev Logo" />
    </div>
    <div class="head-btns">
        <button class="btn button-cancel ml-submit" data-lang="<span class='icon-cancel'  ></span> <?php echo jText::_('COM_TMARLEV_CANCELL') ?>" data-task="template.cancel">
            <span class="icon-cancel"  ></span>
            <?php echo jText::_('COM_TMARLEV_CANCELL') ?></button>


        <button class="btn btn-success ml-submit" data-lang="<span class='icon-apply icon-white' ></span> <?php echo jText::_('COM_TMARLEV_SAVE_ALL') ?>" data-task="template.apply" >
            <span class="icon-apply icon-white" ></span>
            <?php echo jText::_('COM_TMARLEV_SAVE_ALL') ?></button>
    </div>
</div>


<div class=" marlev_manager">
    <div class="container-fluid">



        <form action="" method="post" name="adminForm" id="adminForm" class="form-validate" >

            <div class="menu-container">

                <div class="marlev_menu" style="height:1200px;">

                    <div class="header_mmenu">

                        <?php require_once $this->load->patch . "menu.php"; ?>

                    </div> 
                    <div class="clearfix"></div>
                </div>
                <div class="clearfix"></div>
            </div>
           

            <div id="tms-container">
<!--ml-append-messagge-->
                <div id="alert-box" data-height="0" class="">
                    <?php echo $this->message; ?>
                </div>

                <div class="tm-home">

                    <?php require_once $this->load->patch . "load_home.php"; ?>
                    <div class="clearfix"></div>
                </div>
                <div class=" tm-layout">
                    <h3><?php echo JText::_("Layout & Style"); ?></h3>
                    <div class="slide-config-title">
                        &nbsp;
                    </div>
                    <div id="tm-layout"></div>

                </div>
                <?php require_once $this->load->patch . "marlev_index.php"; ?>
                <?php echo $this->loadTemplate('assignment'); ?>
            </div>

            <div id="layout-slider-block" data-state="close">
                <div id="load-slider-content"></div>
            </div>

            <div id="hidden-input">
                <?php if ($this->installtype === "install"): ?>
                    <input type="hidden" id='ultimateinstall' name="ultimateinstall" value="1" />
                <?php else: ?>
                    <input type="hidden"  name="ultimateinstall" value="0" />
                <?php endif; ?>
                <input type="hidden" id="layout-id" name="params[id]" value="<?php echo $id; ?>" />
                <input type="hidden" id="task" name="task" value="template.apply" />
                <input type="hidden" name="params[patch]" value="<?php echo base64_encode($this->load->patch); ?>" />
                <input type="hidden" id="layout-template" name="params[template]" value="<?php echo $this->load->template; ?>" />
                <input type="hidden" name="params[name]" value="<?php echo $this->load->template; ?>" />
                <input type="hidden" name="params[active_menu]" class="tm-active-menu" value="<?php echo $activemenu; ?>" />
            </div>
            <div id="hidden-token">
                <?php echo JHtml::_('form.token'); ?>
            </div>

        </form>
        <input type="hidden" id="ml-uri" value="<?php echo JUri::base(); ?>" />
        <div  class="clearfix"></div>
    </div>
</div>
<?php //open jomla divs ?>
<div>
    <div>