Beispiel #1
0
<?php

use Core\HTML\DafstyleForm;
$actuTable = App::getInstance()->getTable('Actuality');
$catsTable = App::getInstance()->getTable('Category');
if (!empty($_POST)) {
    $result = $actuTable->update($_GET['id'], ['titre' => $_POST['titre'], 'contenu' => $_POST['contenu'], 'category_id' => $_POST['category_id']]);
    if ($result) {
        ?>
<div class="alert alert-succes">Modification éffectuée avec succès.</div><?php 
    }
}
$actus = $actuTable->find($_GET['id']);
$categs = $catsTable->extractThis('id', 'titre');
$form = new DafstyleForm($actus);
?>
<div class="daf-gr-ctnr">
    <div class="daf-sct-10">
    <div class="alert titro">EDITER - " <?php 
echo $actus->titre;
?>
 "</div>
    <form method="post">
        <?php 
echo $form->select('category_id', 'Catégorie', $categs);
?>
        <?php 
echo $form->input('titre', 'Titre de l\'actualités');
?>
        <?php 
echo $form->input('contenu', 'Contenu de l\'actualité', ['type' => 'textarea']);
Beispiel #2
0
<?php

use Core\HTML\DafstyleForm;
use Core\Auth\DBAuth;
if (!empty($_POST)) {
    $auth = new DBAuth(App::getInstance()->getDb());
    if ($auth->login($_POST['username'], $_POST['password'])) {
        header('Location:admin.php');
    } else {
        ?>
<div class="alert alert-warm">Identifiant ou mot de passe incorrect.</div><?php 
    }
}
$form = new DafstyleForm($_POST);
?>
<div class="daf-gr-ctnr">
    <div class="daf-sct-10">
    <div class="alert titro">Connexion au back-office</div>
    <form method="post">
        <?php 
echo $form->input('username', 'Nom d\'utilisateur');
?>
        <?php 
echo $form->input('password', 'Mot de passe', ['type' => 'password']);
?>
        <button class="btn btn-primary">Connexion</button>
    </form>
    </div>
</div>
Beispiel #3
0
<?php

use Core\HTML\DafstyleForm;
$app = App::getInstance()->getTable('Category');
if (!empty($_POST)) {
    $result = $app->update($_GET['id'], ['titre' => $_POST['titre']]);
    if ($result) {
        header('Location: admin.php?p=categs.home');
    } else {
        ?>
<div class="alert alert-warm">Impossible d'éffectuer cet enregistrement.</div><?php 
    }
}
$categs = $app->find($_GET['id']);
$form = new DafstyleForm($categs);
?>
<div class="daf-gr-ctnr">
    <div class="daf-sct-10">
    <div class="alert titro">EDITER - " <?php 
echo $categs->titre;
?>
 "</div>
    <form method="post">
        <?php 
echo $form->input('titre', 'Titre de la catégorie');
?>
        <button class="btn btn-primary">Editer</button>
    </form>
    <br>
    <a href="?p=categs.home" class="btn-link">Retour</a>
    </div>