<!DOCTYPE html>
<html>

<head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta http-equiv="Cache-control" content="no-cache">
    <meta http-equiv="Expires" content="-1">
    <!-- Tell the browser to be responsive to screen width -->
    <?php echo $setting['meta_tag'];?>
    <?php
   
    if(!empty($setting['favicon_path'])){
        $favicon_path = $setting['favicon_path'];
    } else{
        $favicon_path = 'images/favicon/favicon.ico';
    }
    
    if((APP_SERVER_HOST_URL == CLIENT_PORTAL_DOMAIN) || (strpos(CLIENT_PORTAL_DOMAIN, $_SERVER['REDIRECT_REDIRECT_SSL_TLS_SNI']) !== false)){
        $favicon_path = CLIENT_PORTAL_FAVICON;
        $setting['title'] = CLIENT_PORTAL_DEFAULT_HEADER;
    }
    
    $controller = $this->request->params['controller'];
    $method = $this->request->params['action'];
    
    ?>
    <title><?php echo $setting['title'];?></title>
    <link rel="icon" href="<?php echo $this->request->webroot.'webroot/'.$favicon_path;?>" type="image/icon">
    <!-- Bootstrap 3.3.6 -->
    <link rel="stylesheet" href="<?php echo $this->request->webroot; ?>admin_lte/bootstrap/css/bootstrap.min.css">
    <link rel="stylesheet" href="<?php echo $this->request->webroot; ?>rtgv3/css/dataTables.css">
    <link rel="stylesheet" href="<?php echo $this->request->webroot; ?>rtgv3/css/select2.min.css">
    <!-- Font Awesome -->
    <link rel="stylesheet" href="<?php echo $this->request->webroot; ?>admin_lte/bootstrap/css/font-awesome.min.css">
    <!-- Ionicons -->
    <link rel="stylesheet" href="<?php echo $this->request->webroot; ?>admin_lte/bootstrap/css/ionicons.min.css">
    <!-- Theme style -->
    <link rel="stylesheet" href="<?php echo $this->request->webroot; ?>admin_lte/dist/css/AdminLTE.min.css">
    <!-- AdminLTE Skins. Choose a skin from the css/skins
         folder instead of downloading all of them to reduce the load. -->
    <link rel="stylesheet" href="<?php echo $this->request->webroot; ?>admin_lte/dist/css/skins/_all-skins.min.css">
    <!-- iCheck -->
    <link rel="stylesheet" href="<?php echo $this->request->webroot; ?>admin_lte/plugins/iCheck/flat/blue.css">
    <!-- Morris chart -->
    <!--<link rel="stylesheet" href="<?php echo $this->request->webroot; ?>admin_lte/plugins/morris/morris.css">-->
    <!-- jvectormap -->
    <link rel="stylesheet"
        href="<?php echo $this->request->webroot; ?>admin_lte/plugins/jvectormap/jquery-jvectormap-1.2.2.css">
    <!-- Date Picker -->
    <link rel="stylesheet" href="<?php echo $this->request->webroot; ?>admin_lte/plugins/datepicker/datepicker3.css">
    <!-- Daterange picker -->
    <link rel="stylesheet"
        href="<?php echo $this->request->webroot; ?>admin_lte/plugins/daterangepicker/daterangepicker-bs3.css">
    <!-- summer note - text editor -->
    <link href="<?php echo $this->request->webroot; ?>epicvelocity/js/summernote/summernote.css" rel="stylesheet">
    <!--  cms_style.css   custom style -->
    <link rel="stylesheet" href="<?php echo $this->request->webroot; ?>css/cms_style.css">
    <link rel="stylesheet" href="<?php echo $this->request->webroot; ?>css/reminder-task.css?1.0.0">
    <!--  custom.css   custom style -->
    <link rel="stylesheet" href="<?php echo $this->request->webroot; ?>css/custom.css?1.0.1">
    <link rel="stylesheet" href="<?php echo $this->request->webroot; ?>rtgv3/css/sertg.css?1.0.2">
    <?php //echo $this->CKEditor->loadJs(); ?>
    <!-- HTML5 Shim and Respond.js IE8 support of HTML5 elements and media queries -->
    <!-- WARNING: Respond.js doesn't work if you view the page via file:// -->
    <!--[if lt IE 9]>
    <script src="<?php echo $this->request->webroot; ?>admin_lte/bootstrap/js/html5shiv.min.js"></script>
    <script src="<?php echo $this->request->webroot; ?>admin_lte/bootstrap/js/respond.min.js"></script>
    <![endif]-->


    <!-- Layout ::  new_dashboard  -->
    <!-- Font Awesome -->
    <!-- <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.5.0/css/font-awesome.min.css"> -->
    <!-- Ionicons -->
    <!-- <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/ionicons/2.0.1/css/ionicons.min.css"> -->
    <link rel="stylesheet" href="<?php echo $this->request->webroot; ?>new_layout/css/_all-skins.min.css">

    <!-- Layout ::  new_dashboard  -->

    <link rel="stylesheet" href="<?php echo $this->request->webroot;?>datepicker/bootstrap-datetimepicker.min.css">

    <link rel="stylesheet" href="<?php echo $this->request->webroot; ?>rtgv3/css/conv_core.css">
    <?php if(($controller != "Invoice" && $method != "add") && $controller != "Calendar"){ ?>
    <link rel="stylesheet" href="<?php echo $this->request->webroot; ?>rtgv3/css/conv_components.min.css">
    <?php } ?>
    <link rel="stylesheet" href="<?php echo $this->request->webroot; ?>new_layout/css/style.css">
    <!-- Magnific Popup core CSS file -->
    <link rel="stylesheet" href="<?php echo $this->request->webroot; ?>magnify/magnific-popup.css">

    <!-- jQuery 1.7.2+ or Zepto.js 1.0+ -->


    <!-- Magnific Popup core JS file -->

    <style>
    .swal2-content,
    .swal2-actions {
        font-size: 15px !important;
    }

    .ka-main-content .view-html {
        text-align: left;
    }

    .view-html #personalInfo {
        width: 100%;
    }

    .bootstrap-datetimepicker-widget table {
        table-layout: fixed;
        width: 100%;
    }


    .confirm-btn-area {
        position: relative;
        text-align: center;
        top: -38px;
    }

    .confirm-btn-area a {
        margin: 15px;

    }

    .limited-time {
        display: none;
    }

    .top-title {
        word-break: break-word;
    }

    .swal2-icon .swal2-icon-content {
        font-size: 3.75em !important;
    }

    .swal2-popup .swal2-content {
        font-size: 16px !important;
    }

    .swal2-popup .swal2-styled {
        margin-top: 0 !important;
    }

    .sum-note .note-editor .note-toolbar {
        padding: 0;
        margin: 0;
        padding-left: 5px;
    }

    .sum-note .note-editor.note-frame .note-status-output {
        padding: 0px;
        padding-right: 5px;
        text-align: right;
        color: orangered;
    }

    .sum-note .note-editor.note-frame {
        margin: 0;
    }

    #member-note-modal-edit .modal-dialog {
        width: 600px !important;
        margin: 30px auto !important;
    }

    textarea {
        resize: none;
    }

    .direct-chat-text {
        word-break: break-word
    }

    .direct-chat-text a {
        color: white;
        text-decoration: underline;
    }

    #rtg-before-saving-modal .multiselect .caret,
    #before-saving-modal .multiselect .caret {
        position: absolute;
        top: 50%;
        right: 12px;
        margin-top: -3px;
        width: 9px;
        text-align: right;
    }

    #rtg-before-saving-modal .multiselect-container,
    #before-saving-modal .multiselect-container {
        width: 100%;
        max-height: 250px;
        overflow-y: auto;
    }
    </style>

    <link rel="stylesheet" href="<?php echo $this->request->webroot; ?>js/multiselect/bootstrap-multiselect.css" />

    <link rel="stylesheet" href="<?php echo $this->request->webroot; ?>rtgv3/css/full_page_loader.css?1.0.1">
    <link rel="stylesheet" href="<?php echo $this->request->webroot; ?>css/letter_steps.css?1.0.6">
</head>

<body class="hold-transition skin-blue sidebar-mini">

    <div class="loading" id="full-page-loader">
        <div class='uil-ring-css' style='transform:scale(0.79);'>
            <div></div>
            <h3></h3>
        </div>
    </div>

    <!--header navbar-->
    <?= $this->element('header_navbar') ?>
    <!--header navbar-->

    <div class="container-fluid ka-body">

        <!--Start of Main Navigation-->
        <?= $this->element('dashboard_nav') ?>
        <!--End of Main Navigation-->

        <div class="col-sm-9 col-xs-12" style="padding-left:0;">
            <?= $this->element('top_link') ?>
            <div class="ka-main-content">
                <?= $this->Flash->render() ?>
                <?= $this->fetch('content') ?>
            </div>
        </div>

    </div>
    <footer class="">
        <div class="ka-footer">
            <?= $this->element('footer') ?>
            <a href="<?php echo $_SESSION['url_list_by_section']['30 Days Access Time Limit']; ?>"
                class="limited-time">Limited Time</a>

        </div>
    </footer>

    <div class="modal fade fa fa-users" id="stt-info" style="display: none;">
        <div class="modal-dialog">
            <div class="modal-content">
                <div class="modal-header">
                    <button type="button" class="close" data-dismiss="modal" aria-label="Close">
                        <span aria-hidden="true">×</span></button>
                    <h4 class="modal-title">Letter Sets</h4>
                </div>
                <div class="modal-body">

                </div>
                <div class="modal-footer">
                    <button type="button" class="btn btn-outline pull-left" data-dismiss="modal">Close</button>
                    <button type="button" class="btn btn-outline">Save changes</button>
                </div>
            </div>
            <!-- /.modal-content -->
        </div>
        <!-- /.modal-dialog -->
    </div>

    <link rel="stylesheet" href="<?php echo $this->request->webroot; ?>css/modal_custom.css?1.0.26" />
    <script src="<?php echo $this->request->webroot; ?>js/jquery-1.11.2.js"></script>
    <!-- jQuery 2.2.0 -->
    <script src="<?php echo $this->request->webroot; ?>admin_lte/plugins/jQuery/jQuery-2.2.0.min.js"></script>
    <!-- jQuery UI 1.11.4 -->
    <script src="<?php echo $this->request->webroot; ?>admin_lte/bootstrap/js/jquery-ui.min.js"></script>
    <!-- Resolve conflict in jQuery UI tooltip with Bootstrap tooltip -->

    <script>
    $.widget.bridge('uibutton', $.ui.button);
    </script>
    <!-- Bootstrap 3.3.6 -->
    <script src="<?php echo $this->request->webroot; ?>admin_lte/bootstrap/js/bootstrap.min.js"></script>
    <script src="<?php echo $this->request->webroot; ?>rtgv3/js/select2.full.min.js"></script>
    <script src="<?php echo $this->request->webroot; ?>js/raphael.min.js"></script>
    <!--<script src="https://cdnjs.cloudflare.com/ajax/libs/raphael/2.1.0/raphael-min.js"></script>-->
    <!--<script src="http://code.jquery.com/jquery-1.8.2.min.js"></script>-->
    <!--<script src="http://cdn.oesmith.co.uk/morris-0.4.1.min.js"></script>-->
    <!--    <script src="https://cdnjs.cat.net/ajax/libs/morris.js/0.4.1/morris.min.js"></script>-->
    <?php echo $this->Html->script('morris/morris.min.js'); ?>
    <!--<script src="<?php echo $this->request->webroot; ?>admin_lte/plugins/morris/morris.min.js"></script>-->
    <!--<script src="<?php echo $this->request->webroot; ?>admin_lte/plugins/moment/moment.js"></script>-->

    <!--
<link rel="stylesheet" href="//cdnjs.cloudflare.com/ajax/libs/morris.js/0.5.1/morris.css">
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.9.0/jquery.min.js"></script>
<script src="//cdnjs.cloudflare.com/ajax/libs/raphael/2.1.0/raphael-min.js"></script>
<script src="//cdnjs.cloudflare.com/ajax/libs/morris.js/0.5.1/morris.min.js"></script>-->



    <!-- Sparkline -->
    <script src="<?php echo $this->request->webroot; ?>admin_lte/plugins/sparkline/jquery.sparkline.min.js"></script>
    <!-- jvectormap -->
    <script src="<?php echo $this->request->webroot; ?>admin_lte/plugins/jvectormap/jquery-jvectormap-1.2.2.min.js">
    </script>
    <script src="<?php echo $this->request->webroot; ?>admin_lte/plugins/jvectormap/jquery-jvectormap-world-mill-en.js">
    </script>
    <!-- jQuery Knob Chart -->
    <script src="<?php echo $this->request->webroot; ?>admin_lte/plugins/knob/jquery.knob.js"></script>
    <!-- daterangepicker -->
    <script src="<?php echo $this->request->webroot; ?>admin_lte/bootstrap/js/moment.min.js"></script>
    <script src="<?php echo $this->request->webroot; ?>admin_lte/plugins/daterangepicker/daterangepicker.js"></script>
    <!-- datepicker -->
    <script src="<?php echo $this->request->webroot; ?>admin_lte/plugins/datepicker/bootstrap-datepicker.js"></script>

    <!-- Bootstrap WYSIHTML5 -->
    <!--<script src="<?php //echo $this->request->webroot; ?>admin_lte/plugins/bootstrap-wysihtml5/bootstrap3-wysihtml5.all.min.js"></script>-->
    <!-- Slimscroll -->
    <script src="<?php echo $this->request->webroot; ?>admin_lte/plugins/slimScroll/jquery.slimscroll.min.js"></script>
    <!-- FastClick -->
    <script src="<?php echo $this->request->webroot; ?>admin_lte/plugins/fastclick/fastclick.js"></script>
    <!-- AdminLTE App -->
    <script src="<?php echo $this->request->webroot; ?>admin_lte/dist/js/app.min.js"></script>
    <!-- AdminLTE dashboard demo (This is only for demo purposes) -->
    <script src="<?php echo $this->request->webroot; ?>admin_lte/dist/js/pages/dashboard.js"></script>
    <!-- AdminLTE for demo purposes -->
    <script src="<?php echo $this->request->webroot; ?>admin_lte/dist/js/demo.js"></script>

    <!-- summernote -->
    <script src="<?php echo $this->request->webroot; ?>epicvelocity/js/summernote/summernote.min.js"></script>

    <!-- InnerTablist1 Select Option Value -->
    <?php echo $this->Html->script('selectbox1/jcf.js'); ?>
    <?php echo $this->Html->script('selectbox1/jcf.select.js'); ?>
    <?php echo $this->Html->script('selectbox1/jcf.scrollable.js'); ?>

    <!-- SmartMenus jQuery plugin -->
    <?php echo $this->Html->script('smartmenus.js'); ?>

    <!-- SmartMenus jQuery Bootstrap Addon -->
    <?php echo $this->Html->script('jquery.smartmenus.bootstrap.js'); ?>


    <!-- bootstrap date picker -->
    <?php echo $this->Html->script('bootstrap-datepicker.js'); ?>
    <?php echo $this->Html->script('timepick.js') ?>
    <?php echo $this->Html->script('jquery.countdown.js') ?>

    <!-- Datatable -->
    <script src="<?php echo $this->request->webroot; ?>rtgv3/js/dataTables.js"></script>

    <!-- important custom js -->

    <!-- note reminder -->
    <script src="<?php echo $this->request->webroot;?>js/sweetalert2/sweetalert2.min.js"></script>
    <script src="<?php echo $this->request->webroot;?>datepicker/moment.js"></script>
    <?php echo $this->Html->script('bootstrap-datetimepicker.min.js'); ?>
    <script>
    $(".date-time-picker").datetimepicker({
        format: "YYYY-MM-DD HH:mm",
        minDate: moment(),
        ignoreReadonly: true
    });

    $(".rtg-date-time-picker").datetimepicker({
        format: "YYYY-MM-DD",
        minDate: moment(),
        ignoreReadonly: true,
    });
    </script>

    <!-- note reminder -->

    <?php echo "";//$this->Html->script('custom.js'); ?>
    <?php echo $this->Html->script('globalsettings.js'); ?>

    <!--<script src="https://cdnjs.cloudflare.com/ajax/libs/tinymce/5.0.0/tinymce.min.js"></script>-->


    <script>
    function registerSummernote(element, callbackMax) {

        var placeholder = $(element).attr('placeholder');
        var max = 400;
        if ($(element).attr('maxChar')) {
            max = $(element).attr('maxChar');
        }
        $('.note-status-output').text(max)
        var summernoteElement = $(element);
        $(element).summernote({
            height: 300,
            placeholder,
            spellCheck: true,
            callbacks: {
                onKeydown: function(e) {
                    var t = e.currentTarget.innerText;
                    if (t.length >= max) {
                        //delete key
                        if (e.keyCode != 8)
                            e.preventDefault();
                        // add other keys ...
                    }
                },
                onKeyup: function(e) {
                    var t = e.currentTarget.innerText;
                    if (typeof callbackMax == 'function') {
                        callbackMax(max - t.length);
                    }
                },
                onPaste: function(e) {
                    var t = e.currentTarget.innerText;
                    var bufferText = ((e.originalEvent || e).clipboardData || window.clipboardData).getData(
                        'Text');
                    e.preventDefault();
                    var all = t + bufferText;
                    document.execCommand('insertText', false, all.trim().substring(0, 400));
                    if (typeof callbackMax == 'function') {
                        callbackMax(max - t.length);
                    }
                },
                onChange: function(contents, $editable) {

                    var sum_note_area = $('.sum-note .note-editor');

                    if (contents) {
                        sum_note_area.css({
                            'border-color': '#a9a9a9'
                        })
                        sum_note_area.next('.error').remove();
                    }
                }
            }
        });
    }
    registerSummernote('textarea.summernote_texteditor', function(max) {
        $('.note-status-output').text("Remaining characters " + max)
    });
    </script>
    <?php echo $this->element('tinymce_js'); ?>
    <script src="<?php echo $this->request->webroot; ?>magnify/jquery.magnific-popup.js"></script>
    <script>
    $('#popup-youtube, #popup-youtube2').magnificPopup({
        type: 'iframe',
        iframe: {
            patterns: {
                youtube: {
                    index: 'youtube.com',
                    id: 'v=',
                    src: 'https://www.youtube.com/embed/%id%?rel=0&autoplay=1'
                }
            }
        },
    });

    $('.limited-time').magnificPopup({
        type: 'iframe',
        midClick: true,
        closeOnBgClick: false,
        iframe: {
            patterns: {
                youtube: {
                    index: 'youtube.com',
                    id: 'v=',
                    src: '<?php echo $_SESSION['url_list_by_section']['30 Days Access Time Limit']; ?>'
                }
            },
            markup: '<div class="mfp-iframe-scaler">' +
                '<iframe allow="autoplay;" class="mfp-iframe" frameborder="0" allowfullscreen></iframe>' +
                '</div><div class="confirm-btn-area">' +
                '<a class="btn btn-primary btn-orange-color" href="<?php echo $this->Url->build('/Statistics/getPurchase'); ?>">YES! I want to Upgrade Now</a>' +
                '<a class="btn btn-primary btn-orange-color" href="<?php echo $this->Url->build('/users/logout/'); ?>">No! I will Do It Later</a></div>',
        },
        //        callbacks: {
        //                    open: function () {
        //                        console.log('popup open');
        //                        target.trigger('click');
        //                    },
        //                }
    });
    </script>
    <?php
if(isset( $_SESSION['forumLoginScript'])){
echo $_SESSION['forumLoginScript'];
unset($_SESSION['forumLoginScript']);
}




?>
    <?php echo $this->element('datepicker_js') ?>
    <script>
    var ENVIROMENT = '<?php echo ENVIROMENT; ?>'
     
    </script>
    <script src="<?php echo $this->request->webroot; ?>js/multiselect/bootstrap-multiselect.js"></script>
    <script src="<?php echo $this->request->webroot; ?>js/reminder_event.js?1.0.2"></script>
    <script src="<?php echo $this->request->webroot; ?>js/unwanted_char_remove.js?1.0.9"></script>
    <script src="<?php echo $this->request->webroot;?>js/js.input.validation.js?1.0.2"></script>
    <script src="<?php echo $this->request->webroot; ?>js/note_event.js?1.0.0"></script>
    <?php echo $this->element('sidebar_js'); ?>
    <?php echo $this->element('letter_count_textarea'); ?>
    <?php echo $this->element('reminder_checkbox'); ?>
    <?php echo $this->Html->script('letter_steps.js?1.0.1'); ?>
    <?php echo $this->element('js_clipboardcopy'); ?>
    <script src="<?php echo $this->request->webroot; ?>dist/js/jquery.flagstrap.js"></script>
    <script>
                        $('#options').flagStrap({
                            countries: {
                                "US": "English",
                                "SP": "Spanish"
                            },
                            buttonSize: "btn-lg",
                            buttonType: "btn-primary btn-flat btn-primary-custom",
                            labelMargin: "10px",
                            scrollable: false,
                            scrollableHeight: "350px",
                            onSelect: function(value, element) {
                                document.forms["languageSelectionForm"].submit();

                            }
                        });
    </script>
    <script>
        function affiliateNotificationUpdate() {
            event.preventDefault();
            $('#affiliate-notif-alert').hide();
            $.ajax({
                url: '<?php echo $this->Url->build(['controller' => 'Dashboard', 'action' => 'ajaxrequest']); ?>',
                type: 'POST',
                data: {
                    'type':'AFFILIATE_NOTIFICATION_UPDATE',
                    'is_notified': 0
                },
                success: function(data) {
                    var json = JSON.parse(data);
                    console.log(json);

                }
            });
        }
    </script>
</body>

</html>