<?php
N2Html::topBar();

$conflictsModel = new N2SmartsliderConflictsModel();
$conflicts      = $conflictsModel->getConflicts();

?>
<div class="n2-admin-section" id="n2-admin-possible-conflicts">
    <div class="n2-admin-section-block">
        <div class="n2-admin-possible-conflicts-container">
            <div class="n2-admin-possible-conflicts-img">
                <?php if (empty($conflicts)): ?>
                    <img src="<?php echo N2ImageHelper::fixed('$ss$/admin/images/conflicts/no.png'); ?>"/>
                <?php else: ?>
                    <img src="<?php echo N2ImageHelper::fixed('$ss$/admin/images/conflicts/yes.png'); ?>"/>
                <?php endif; ?>
            </div>
            <div class="n2-admin-possible-conflicts-details">

                <?php if (empty($conflicts)): ?>
                    <div class="n2-h1"><?php n2_e('No conflicts detected'); ?></div>
                <?php else: ?>
                    <div class="n2-h1"><?php n2_e('Possible Conflicts'); ?></div>
                    <?php foreach ($conflicts AS $conflict): ?>
                        <p><?php echo $conflict; ?></p>
                    <?php endforeach; ?>
                <?php endif; ?>
                <p style="margin-top:30px;">
                    <a href="<?php echo $this->appType->router->createUrl('help/testApi'); ?>" class="n2-button n2-button-normal n2-button-m n2-radius-s n2-button-blue n2-h4 n2-b n2-uc">Test API connection</a>
                </p>
            </div>

        </div>
    </div>
</div>

<div class="n2-admin-section" id="n2-admin-help-search">
    <div class="n2-admin-section-block">
        <div class="n2-h1"><?php n2_e('Hey! How can we help you today?'); ?></div>
        <form target="_blank" action="https://smartslider3.helpscoutdocs.com/search" method="get">
            <input name="query" type="text" placeholder="<?php n2_e('Search in the knowledge base'); ?>"/>
            <button type="submit"><?php n2_e('Search'); ?></button>
        </form>
        <div class="n2-admin-help-more">
            <a href="<?php echo 'https://smartslider3.helpscoutdocs.com/?utm_campaign=' . N2SS3::$campaign . '&utm_source=dashboard-documentation&utm_medium=smartslider-' . N2Platform::getPlatform() . '-' . N2SS3::$plan; ?>" target="_blank">
                <img src="<?php echo N2ImageHelper::fixed('$ss$/admin/images/help/documentation.png'); ?>"/>
                <div class="n2-h2"><?php n2_e('Documentation'); ?></div>
                <p><?php n2_e('To get started with Smart Slider 3, please refer to this guide for downloading, installing, and using.'); ?></p>
            </a>
            <a href="https://smartslider3.com/contact-us/support/" onclick="document.getElementById('support-form').submit(); return false;">
                <img src="<?php echo N2ImageHelper::fixed('$ss$/admin/images/help/email-support.png'); ?>"/>
                <div class="n2-h2"><?php n2_e('Email support'); ?></div>
                <p><?php n2_e('Need one-to-one assistance? Get in touch with our Support team! We\'d love the opportunity to help you.'); ?></p>
            </a>
            <a href="<?php echo 'https://www.youtube.com/watch?v=lsq09izc1H4&list=PLSawiBnEUNfvzcI3pBHs4iKcbtMCQU0dB&utm_campaign=' . N2SS3::$campaign . '&utm_source=dashboard-watch-videos&utm_medium=smartslider-' . N2Platform::getPlatform() . '-' . N2SS3::$plan; ?>" target="_blank">
                <img src="<?php echo N2ImageHelper::fixed('$ss$/admin/images/help/videos.png'); ?>"/>
                <div class="n2-h2"><?php n2_e('Tutorial Videos'); ?></div>
                <p><?php n2_e('Check our video tutorials which cover everything you need to know about Smart Slider 3.'); ?></p>
            </a>
        </div>
    </div>
</div>

<?php
$selectedArticles = array(
    array(
        'https://smartslider3.helpscoutdocs.com/article/54-free-version'                           => 'Free vs Pro',
        'https://smartslider3.helpscoutdocs.com/article/484-updating-the-free-version-to-the-full' => 'How to update to the Pro version?',
        'https://smartslider3.helpscoutdocs.com/article/1454-publish'                              => 'How can I publish my sliders?',
        'https://smartslider3.helpscoutdocs.com/article/1101-license'                              => 'How can I add the license key?',
        'https://smartslider3.helpscoutdocs.com/article/1522-canvas-vs-content-mode'               => 'Content vs Canvas',
        'https://smartslider3.helpscoutdocs.com/article/56-slider-settings-general#fillmode'       => 'Why does the slider crop my images?',
        'https://smartslider3.helpscoutdocs.com/article/185-how-can-i-speed-up-my-website'         => 'How can I speed up my site?',
    ),
    array(
        'https://smartslider3.helpscoutdocs.com/article/60-autoplay'                                                                                            => 'Where is the autoplay?',
        'https://smartslider3.helpscoutdocs.com/article/1372-all-video-options'                                                                                 => 'How can I add my videos?',
        'https://smartslider3.helpscoutdocs.com/article/299-using-your-own-fonts'                                                                               => 'Can I use my fonts in the slider?',
        'https://smartslider3.helpscoutdocs.com/article/88-generator-functionality'                                                                             => 'Dynamic slide does not refresh',
        'https://smartslider3.helpscoutdocs.com/article/371-link'                                                                                               => 'Can I create a lightbox?',
        'https://smartslider3.helpscoutdocs.com/article/1275-cant-make-my-fullpage-slider-responsive?_ga=2.2863280.1497016966.1529905256-1631431887.1528198647' => 'Full page slider responsiveness',
        'https://smartslider3.helpscoutdocs.com/article/1473-how-to-disable-the-slider-on-mobile'                                                               => 'How to disable the slider on moble?',
    ),
    array(
        'https://smartslider3.helpscoutdocs.com/article/1195-how-big-images-should-i-use'                                  => 'How big images should I use?',
        'https://smartslider3.helpscoutdocs.com/article/1556-video-autoplay-handling'                                      => 'Why isn\'t my video autoplaying?',
        'https://smartslider3.helpscoutdocs.com/category/1422-events'                                                      => 'Event tutorials',
        'https://smartslider3.helpscoutdocs.com/article/1534-what-to-do-with-smart-slider-3-when-you-are-moving-a-website' => 'What to do after migration',
        'https://smartslider3.helpscoutdocs.com/article/1526-custom-javascript-and-php-codes'                              => 'Developer documentation',
        'https://smartslider3.helpscoutdocs.com/collection/205-troubleshooting'                                            => 'Troubleshooting',
    )
);

?>
<div class="n2-admin-section" id="n2-admin-help-selected-articles">
    <div class="n2-admin-section-block">
        <div class="n2-h1"><?php n2_e('Selected Articles'); ?></div>

        <div class="n2-admin-selected-articles-container">
            <?php foreach ($selectedArticles AS $column): ?>
                <div class="n2-admin-selected-articles-column">
                    <?php foreach ($column AS $url => $label): ?>
                        <a href="<?php echo $url . '?utm_campaign=' . N2SS3::$campaign . '&utm_source=dashboard-selected-articles&utm_medium=smartslider-' . N2Platform::getPlatform() . '-' . N2SS3::$plan; ?>" target="_blank">
                            <?php echo $label; ?>
                        </a>
                    <?php endforeach; ?>
                </div>
            <?php endforeach; ?>
        </div>
    </div>
</div>

<form id="support-form" method="post" action="https://smartslider3.com/contact-us/support/" target="_blank" style="max-width: 1140px;margin: 0 auto;">
    <div class="n2-h1"><?php n2_e('Debug Information'); ?></div>
    <?php
    $debug = array(
        'Smart Slider 3 - version: ' . N2SS3::$completeVersion . ' - ' . N2SS3::$plan,
        'Platform: ' . N2Platform::getPlatformName() . ' - ' . N2Platform::getPlatformVersion(),
        'Site url: ' . N2Platform::getSiteUrl(),
        'Path: ' . N2Filesystem::getBasePath(),
        'Uri: ' . N2Uri::getBaseUri(),
        'Browser: ' . $_SERVER['HTTP_USER_AGENT'],
        ''
    );

    if ($conflictsModel->curlLog) {
        $debug   = array_merge($debug, $conflictsModel->curlLog);
        $debug[] = '';
    }

    if (function_exists('ini_get')) {
        $debug[] = 'PHP: ' . PHP_VERSION;
        $debug[] = 'PHP - memory_limit: ' . ini_get('memory_limit');
        $debug[] = 'PHP - max_input_vars: ' . ini_get('max_input_vars');

        $debug[] = '';
    }

    $debugConflicts = $conflictsModel->getDebugConflicts();
    if (empty($debugConflicts)) {
        $debug[] = 'No conflicts detected';
    } else {
        $debug[] = 'Conflicts:';
        foreach ($debugConflicts AS $conflict) {
            $debug[] = ' - ' . $conflict;
        }
        $debug[] = '';
    }

    $debug = array_merge($debug, N2Platform::getDebug());

    ?>
    <textarea readonly name="debug_information" style="width:100%;height:800px;"><?php echo htmlspecialchars(implode("\n", $debug), ENT_QUOTES, 'utf-8'); ?></textarea>
</form>