fisharebest/webtrees

View on GitHub
resources/views/setup/step-3-database-type.phtml

Summary

Maintainability
Test Coverage
<?php

declare(strict_types=1);

use Fisharebest\Webtrees\DB;
use Fisharebest\Webtrees\I18N;
use Illuminate\Support\Collection;

/**
 * @var string                 $dbhost
 * @var string                 $dbname
 * @var string                 $dbpass
 * @var string                 $dbport
 * @var string                 $dbtype
 * @var string                 $dbuser
 * @var Collection<int,string> $errors
 * @var string                 $lang
 * @var string                 $tblpfx
 * @var Collection<int,string> $warnings
 * @var string                 $wtemail
 * @var string                 $wtname
 * @var string                 $wtpass
 * @var string                 $wtuser
 */

?>

<form method="post" autocomplete="off">
    <input name="lang" type="hidden" value="<?= e($lang) ?>">
    <input name="dbname" type="hidden" value="<?= e($dbname) ?>">
    <input name="tblpfx" type="hidden" value="<?= e($tblpfx) ?>">
    <input name="wtname" type="hidden" value="<?= e($wtname) ?>">
    <input name="wtuser" type="hidden" value="<?= e($wtuser) ?>">
    <input name="wtpass" type="hidden" value="<?= e($wtpass) ?>">
    <input name="wtemail" type="hidden" value="<?= e($wtemail) ?>">

    <h2>
        <?= I18N::translate('Connection to database server') ?>
    </h2>

    <?php foreach ($errors as $error) : ?>
        <p class="alert alert-danger"><?= $error ?></p>
    <?php endforeach ?>

    <?php foreach ($warnings as $warning) : ?>
        <p class="alert alert-warning"><?= $warning ?></p>
    <?php endforeach ?>

    <p>
        <?= I18N::translate('webtrees needs a database to store your genealogy data.') ?>
    </p>

    <div class="row mb-3">
        <label class="col-form-label col-sm-3" for="dbhost">
            <?= I18N::translate('Database type') ?>
        </label>
        <div class="col-sm-9">
            <div class="form-check">
                <input class="form-check-input" type="radio" name="dbtype" id="dbtype-mysql" value="mysql" <?= $dbtype === DB::MYSQL ? 'checked' : '' ?>>
                <label class="form-check-label" for="dbtype-mysql">
                    MySQL
                </label>
            </div>

            <div class="form-check">
                <input class="form-check-input" type="radio" name="dbtype" id="dbtype-sqlite" value="sqlite" <?= $dbtype === DB::SQLITE ? 'checked' : '' ?>>
                <label class="form-check-label" for="dbtype-sqlite">
                    SQLite
                </label>
            </div>

            <div class="form-check">
                <input class="form-check-input" type="radio" name="dbtype" id="dbtype-pgsql" value="pgsql" <?= $dbtype === DB::POSTGRES ? 'checked' : '' ?>>
                <label class="form-check-label" for="dbtype-pgsql">
                    PostgreSQL
                </label>
            </div>

            <div class="form-check">
                <input class="form-check-input" type="radio" name="dbtype" id="dbtype-sqlsrv" value="sqlsrv" <?= $dbtype === DB::SQL_SERVER ? 'checked' : '' ?>>
                <label class="form-check-label" for="dbtype-sqlsrv">
                    SQL Server
                </label>
            </div>

            <div class="form-text">
            </div>
        </div>
    </div>


    <hr>

    <div class="d-flex justify-content-between">
        <button class="btn btn-primary" name="step" type="submit" value="4">
            <?= I18N::translate('next') ?>
        </button>

        <button class="btn btn-secondary" name="step" type="submit" value="2">
            <?= I18N::translate('previous') ?>
        </button>
    </div>
</form>