View file modules/admin/templates/counters_form.phtml

File size: 3.53Kb
<?php

/**
 * This file is part of JohnCMS Content Management System.
 *
 * @copyright JohnCMS Community
 * @license   https://opensource.org/licenses/GPL-3.0 GPL-3.0
 * @link      https://johncms.com JohnCMS Project
 */

/**
 * @var $title
 * @var $page_title
 * @var $data
 */

$this->layout(
    'system::layout/default',
    [
        'title'      => $title,
        'page_title' => $title,
    ]
);
$this->sectionReplace('sidebar-menu', $this->fetch('admin::sidebar-admin-menu', ['module_menu' => ['counters' => true]]));
?>


<?php if (! empty($data['success_message'])): ?>
    <?= $this->fetch(
        'system::app/alert',
        [
            'alert_type' => 'alert-success',
            'alert'      => $data['success_message'],
        ]
    ) ?>
<?php endif; ?>
<form action="<?= $data['form_action'] ?>" method="post">
    <?php if (! empty($data['id'])): ?>
        <input type="hidden" value="<?= $data['id'] ?>" name="id">
    <?php endif; ?>
    <div class="form-group">
        <label for="name"><?= __('Name') ?></label>
        <input type="text" name="name" class="form-control" id="name" value="<?= $data['name'] ?>" placeholder="<?= __('Name') ?>">
    </div>
    <div class="form-group">
        <label for="link1"><?= __('Option 1') ?></label>
        <textarea class="form-control" rows="<?= $user->config->fieldHeight ?>" name="link1" id="link1"><?= $data['counter_1'] ?></textarea>
        <div class="small text-muted"><?= __('Code for main page') ?></div>
    </div>
    <div class="form-group">
        <label for="link2"><?= __('Option 2') ?></label>
        <textarea class="form-control" rows="<?= $user->config->fieldHeight ?>" name="link2" id="link2"><?= $data['counter_2'] ?></textarea>
        <div class="small text-muted"><?= __('Code for other pages') ?></div>
    </div>

    <h3><?= __('Display mode') ?></h3>
    <div class="custom-control custom-radio">
        <input type="radio" id="mode1" name="mode" value="1" class="custom-control-input"
            <?= ($data['mode'] === 0 || $data['mode'] === 1 ? 'checked="checked" ' : '') ?>>
        <label class="custom-control-label" for="mode1"><?= __('Default') ?></label>
    </div>
    <div class="small text-muted">
        <?= __('On the main showing option 1, on the other pages option 2.<br>If &quot;option 2&quot; not filled, counter would only appear on the main page.') ?>
    </div>

    <div class="custom-control custom-radio">
        <input type="radio" id="term3" name="mode" value="2" class="custom-control-input" <?= ($data['mode'] === 2 ? 'checked="checked" ' : '') ?>>
        <label class="custom-control-label" for="term3"><?= __('Option 1') ?></label>
    </div>
    <div class="custom-control custom-radio">
        <input type="radio" id="term2" name="mode" value="3" class="custom-control-input" <?= ($data['mode'] === 3 ? 'checked="checked" ' : '') ?>>
        <label class="custom-control-label" for="term2"><?= __('Option 2') ?></label>
    </div>

    <div class="alert alert-info mb-3 mt-3">
        <div class="font-weight-bold"><?= __('WARNING!') ?></div>
        <div><?= __('Make sure you have correctly entered the code. It must meet the standard of XML') ?></div>
        <div><?= __('If you click &quot;View&quot; and XHTML errors occured, then click &quot;Back&quot; button in your browser, return to this form and correct the errors.') ?></div>
    </div>

    <div class="mt-3">
        <input type="submit" name="submit" value="<?= __('Viewing') ?>" class="btn btn-primary"/>
        <a href="/admin/counters/" class="btn btn-secondary"><?= __('Cancel') ?></a>
    </div>
</form>