Finalisation de la création des antennes dans Tableau de bord Admin

master
nox 3 years ago
parent 034ceec279
commit 1d9249483a
  1. 1
      public/index.php
  2. 2
      public/js/utils.js
  3. 5
      src/Admin/AdminModule.php
  4. 35
      src/Admin/views/dashboard.twig
  5. 137
      src/Antenne/Actions/AntenneCrudAction.php
  6. 1
      src/Antenne/Actions/AntenneEditAction.php
  7. 89
      src/Antenne/views/create.twig
  8. 86
      src/Antenne/views/index.twig
  9. 5
      src/Auth/Action/LoginAttemptAction.php
  10. 22
      src/Framework/Actions/CrudAction.php
  11. 19
      src/Framework/Router.php
  12. 4
      src/Gmarche/Actions/AntenneShowAction.php
  13. 4
      src/Gmarche/Entity/Antenne.php
  14. 11
      src/Gmarche/Table/AntenneTable.php
  15. 8
      src/Product/Actions/RechIndexAction.php
  16. 13
      src/Product/views/admin/recherches/index.twig

@ -21,6 +21,7 @@ use Middlewares\Whoops;
chdir(dirname(__DIR__));
require 'vendor/autoload.php';
$chemin = $_SERVER['DOCUMENT_ROOT'];
$chemin_new = substr($chemin,0,-6);

@ -8,4 +8,4 @@ function cleanArray(array) {
out.push(j);
}
return out;
}
}

@ -25,8 +25,6 @@ class AdminModule extends Module
)
{
$chemin = str_replace('Admin','Antenne',__DIR__);
//var_dump($chemin);
//die();
$renderer->addPath('antenne', $chemin . '/views');
$router->get('/dashboard/{user:[a-zA-Z\-0-9]+}', [LoggedInMiddleware::class, DashboardAction::class], 'dashboard');
$router->get('/dashboard/details/{user:[a-zA-Z\-0-9]+}', [LoggedInMiddleware::class, DashboardUserAction::class], 'dashboard.user');
@ -34,7 +32,8 @@ class AdminModule extends Module
$router->post('/activation', ActiveAction::class);
$router->get('/profil-user', [LoggedInMiddleware::class, AccountUserEditAction::class], 'account.user');
$router->post('/profil-user', [LoggedInMiddleware::class, AccountUserEditAction::class]);
$router->get('/antenne/create', [LoggedInMiddleware::class, AntenneCrudAction::class], 'antenne.create');
//$router->get('/antenne/new', [LoggedInMiddleware::class, AntenneCrudAction::class], 'antenne.create');
$router->crud('/antenne', [LoggedInMiddleware::class, AntenneCrudAction::class],'antenne');
$router->get('/antenne/edit', [LoggedInMiddleware::class, AntenneEditAction::class], 'antenne.edit');
$router->post('/antenne/edit', [LoggedInMiddleware::class, AntenneEditAction::class]);
if ($renderer instanceof TwigRenderer) {

@ -7,14 +7,14 @@
<div class="container tab-de-bord">
<h3 style="display:inline-block;">Tableau de bord - </h3>
<h4 style="display:inline-block;">
{% if affiche_role() == 0 %} Super Admin{% endif %}
{% if affiche_role() == 1 %} Admin général{% endif %}
{% if affiche_role() == 2 %} Admin Antenne{% endif %}
{% if (sess.role == 0) %} Super Admin{% endif %}
{% if (sess.role == 1) %} Admin général{% endif %}
{% if (sess.role == 2) %} Admin Antenne{% endif %}
</h4>
</h3>
</div>
<p></p>
{% if affiche_role() == 0 %}
{% if (sess.role == 0) %}
<h4>Liste des admins généraux</h4>
<ul class="list-group list-group-flush">
{% for admin_gen in liste_adminGeneral %}
@ -27,7 +27,7 @@
</ul>
{% endif %}
<p></p>
{% if (affiche_role() == 0 or affiche_role() == 1) %}
{% if (sess.role==0 or sess.role==1) %}
<h4>Liste des admins Antenne</h4>
<ul class="list-group list-group-flush">
{% for admin_ant in liste_adminAntenne %}
@ -40,17 +40,19 @@
</ul>
{% endif %}
<p></p>
{% if affiche_role()==0 or affiche_role()==1 or affiche_role()==2 %}
{% if (sess.role==0 or sess.role==1 or sess.role==2) %}
<h4>Gérer les antennes</h4>
<button class="btn btn-primary" style="max-width: 6rem;margin-top:0rem;margin-bottom:0.7rem;height:2rem;">
<a class="nav-link" href="{{ path('antenne.edit') }}" style="padding-left:0.2rem;margin-top:-0.4rem;color:white;font-size:14px;">MODIFIER</a>
</button>
<button class="btn btn-primary" style="margin-top:0rem;margin-bottom:0.7rem;height:2rem;padding-left:-1rem;">
<a class="nav-link" href="{{ path('antenne.create') }}" style="margin-top:-0.4rem;color:white;font-size:14px;">CREER</a>
</button>
<button class="btn btn-primary" style="max-width:6.4rem;margin-top:0rem;margin-bottom:0.7rem;height:2rem;">
<a class="nav-link" href="{{ path('antenne.edit') }}" style="padding-left:0rem;margin-top:-0.4rem;color:white;font-size:14px;">SUPPRIMER</a>
</button>
{% if (sess.role==0 or sess.role==1) %}
<button class="btn btn-primary" style="margin-top:0rem;margin-bottom:0.7rem;height:2rem;padding-left:-1rem;">
<a class="nav-link" href="{{ path('antenne.create') }}" style="margin-top:-0.4rem;color:white;font-size:14px;">CREER</a>
</button>
<button class="btn btn-primary" style="max-width:6.4rem;margin-top:0rem;margin-bottom:0.7rem;height:2rem;">
<a class="nav-link" href="{{ path('antenne.edit') }}" style="padding-left:0rem;margin-top:-0.4rem;color:white;font-size:14px;">SUPPRIMER</a>
</button>
{% endif %}
<h4>Liste des régions/antennes</h4>
<ul class="list-group list-group-flush">
@ -78,7 +80,7 @@
</ul>
{% endif %}
<p></p>
{% if affiche_role()==0 or affiche_role()==1 or affiche_role()==2 %}
{% if (sess.role==0 or sess.role==1 or sess.role==2) %}
<h4>Liste des utilisateurs</h4>
<ul class="list-group list-group-flush">
@ -103,13 +105,6 @@
</ul>
{% endif %}
<p></p>
{% if (affiche_role()== 0 or affiche_role()== 1) %}
<h4>Gestion d'une antenne</h4>
{% endif %}
<p></p>
{% if affiche_role()==0 or affiche_role()==1 or affiche_role()==2 %}
<h4>Gestion d'un G-Marché</h4>
{% endif %}
<div class="row">
{{ widgets | raw }}
</div>

@ -4,16 +4,22 @@ if (!isset($_SESSION)) {
session_start();
}
use App\Gmarche\Entity\Antenne;
use App\Gmarche\Table\AntenneTable;
use App\Gmarche\Table\RegionTable;
use Framework\Actions\CrudAction;
use Framework\Actions\RouterAwareAction;
use Framework\Renderer\RendererInterface;
use Psr\Container\ContainerInterface;
use Framework\Response\RedirectResponse;
use Framework\Router;
use Framework\Session\FlashService;
use Framework\Validator;
use Psr\Http\Message\ServerRequestInterface as Request;
class AntenneCrudAction
class AntenneCrudAction extends CrudAction
{
protected $viewPath = "@antenne";
protected $routePrefix = "antenne";
/**
* @var RendererInterface
*/
@ -22,40 +28,133 @@ class AntenneCrudAction
/**
* @var RegionTable
*/
private $regionTable;
protected $regionTable;
/**
* @var AntenneTable
*/
private $antenneTable;
protected $antenneTable;
/**
* @var FlashService
*/
private $flashService;
use RouterAwareAction;
public function __construct(
RendererInterface $renderer,
RegionTable $regionTable,
Router $router,
AntenneTable $antenneTable,
ContainerInterface $container
RegionTable $regionTable,
FlashService $flash
) {
parent::__construct($renderer, $router, $antenneTable, $regionTable, $flash);
$this->renderer = $renderer;
$this->regionTable = $regionTable;
$this->antenneTable = $antenneTable;
$this->container = $container;
$this->flashService = $flash;
}
public function delete(Request $request)
{
$antenne = $this->antenneTable->find($request->getAttribute('id'));
// $this->postUpload->delete($post->image);
return parent::delete($request);
}
protected function formParams(array $params): array
{
return $params;
}
protected function getNewEntity()
{
$antenne = new Antenne();
$antenne->created_at = new \DateTime();
return $antenne;
}
/**
* @param Request $request
* @param Antenne $antenne
* @return array
*/
protected function prePersist(Request $request, $antenne): array
{
$params = $request->getParsedBody();
$params = array_filter($params, function ($key) {
return in_array($key, ['region_id', 'name', 'slug', 'created_at', 'listeRegions']);
}, ARRAY_FILTER_USE_KEY);
return array_merge($params, ['test' => $test, 'updated_at' => date('Y-m-d H:i:s')]);
}
protected function getValidator(Request $request)
{
$validator = parent::getValidator($request)
->required('region_id', 'name', 'slug', 'created_at')
->length('name', 2, 250)
->dateTime('created_at')
->slug('slug');
/*if (is_null($request->getAttribute('id'))) {
$validator->uploaded('image');
}*/
return $validator;
}
public function __invoke(Request $request)
{
$params = $request->getQueryParams();
// On récupère l'id de la région cliquée
$slug = $request->getAttribute('slug') ?: $_SESSION['connecte'];
$region_id = $this->regionTable->findBy('slug', $slug)->id ?: 1;
$page = $params['p'] ?? 1; // Si la page n'est pas définie, on l'initialise à 1
$antennes = $this->antenneTable->findAllbyRegion($region_id)->paginate(25, $page);
$region = $this->regionTable->findBy('slug', $slug);
$viewPath = '@antenne';
$sess = $_SESSION;
return $this->renderer->render('@antenne/create', compact('sess','page', 'region', 'viewPath', 'antennes'));
if ($request->getMethod() === 'POST') {
$params = $request->getParsedBody();
$date = $params['datepicker'];
$time = '00:00:00';
$date_us = substr($date,6,4).'-'.substr($date,3,2).'-'.substr($date,0,2);
$date_us .= ' '.$time;
$madate = date("Y-m-d H:i:s", strtotime($date_us));
$text = $params['antenne'];
// replace non letter or digits by -
$text = preg_replace('~[^\pL\d]+~u', '-', $text);
// transliterate
$text = iconv('utf-8', 'us-ascii//TRANSLIT', $text);
// remove unwanted characters
$text = preg_replace('~[^-\w]+~', '', $text);
// trim
$text = trim($text, '-');
// remove duplicate -
$text = preg_replace('~-+~', '-', $text);
// lowercase
$slug = strtolower($text);
$admin = '';
$content = '';
$image = '';
$created_at = date("Y-m-d H:i:s");
$validator = (new Validator($params))
->required('antenne', 'region');
if ($validator->isValid()) {
$antenneParams = [
'id' => $antenne_id,
'name' => $params['antenne'],
'slug' => $slug,
'admin' => $admin,
'content' => $content,
'image' => $image,
'created_at' => $created_at,
'region_id' => $params['region'],
'gmarcheAt' => $madate,
'edito1' => $params['contenu1'],
'edito2' => $params['contenu2'],
'edito3' => $params['contenu3'],
'edito4' => $params['contenu4']
];
$this->antenneTable->insert($antenneParams);
$this->flashService->success("L'antenne ".$params['antenne']." a bien été créée.");
return new RedirectResponse($request->getUri()->getPath());
}
}
//$errors = $validator->getErrors();
$listeRegions = $this->regionTable->findAll();
$role = $_SESSION['role'];
return $this->renderer->render('@antenne/create', compact('listeRegions','role'));
}
}

@ -59,7 +59,6 @@ class AntenneEditAction
public function __invoke(Request $request)
{
$role = $request->getAttribute('user')->role;
$user_id = $request->getAttribute('user')->id;
if ($role < 3) {

@ -1,16 +1,83 @@
{% extends 'layout.twig' %}
{% block title "Ğ1-Marché - Créer une antenne" %}
{% block title "Ğ1-Marché - Créer Antennes" %}
{% block body %}
<div class="container" style="background-color: lightgray;opacity: 0.9;margin: 1rem;padding:1rem;">
<h4>Créer une antenne</h4>
<script src="https://cdnjs.cloudflare.com/ajax/libs/flatpickr/3.0.7/flatpickr.js"></script>
<link rel="stylesheet" href="/css/jquery-ui.min.css">
<script src="https://code.jquery.com/ui/1.12.0/jquery-ui.js"></script>
<script type="text/javascript">
$.datepicker.setDefaults(
{
altField: "#datepicker",
closeText: 'Fermer',
prevText: 'Précédent',
nextText: 'Suivant',
currentText: 'Aujourd\'hui',
monthNames: ['Janvier', 'Février', 'Mars', 'Avril', 'Mai', 'Juin', 'Juillet', 'Août', 'Septembre', 'Octobre', 'Novembre', 'Décembre'],
monthNamesShort: ['Janv.', 'Févr.', 'Mars', 'Avril', 'Mai', 'Juin', 'Juil.', 'Août', 'Sept.', 'Oct.', 'Nov.', 'Déc.'],
dayNames: ['Dimanche', 'Lundi', 'Mardi', 'Mercredi', 'Jeudi', 'Vendredi', 'Samedi'],
dayNamesShort: ['Dim.', 'Lun.', 'Mar.', 'Mer.', 'Jeu.', 'Ven.', 'Sam.'],
dayNamesMin: ['D', 'L', 'M', 'M', 'J', 'V', 'S'],
weekHeader: 'Sem.',
dateFormat: 'dd-mm-yy'
}
);
</script>
<script>
$( function() {
$( "#datepicker" ).datepicker();
});
</script>
<div class="container_main">
<div id="la_page">
<span style="color:white;font-size:1.4rem;">
CREATION D'UNE ANTENNE
</span>
<div class="container" style="color:white;padding:3rem; width:55rem;border:1px solid white;margin:auto;">
<form action="" method="post">
{{ csrf_input }}
<div class="row">
<div class="col-md-4">
{{ field('antenne', item.name, "Nom de l'antenne") }}
</div>
<div class="col-md-4" style="max-width: 15rem;">
<span style="margin-left:1rem;">REGION</span>
<select id="region_select" name="region" class="form-control">
<option class="list-group-item list-group-item-action" value="0">
Sélectionnez une région
</option>
{% for item in listeRegions %}
<option class="list-group-item list-group-item-action" value="{{ item.id }}">
{{ item.name }}
</option>
{% endfor %}
</select>
</div>
{{ field('updated_at', item.updatedAt, "", {type: 'hidden'}) }}
{{ field('created_at', date(), "", {type: 'hidden'}) }}
<div class="col-md-3">
<div style="margin-top:-0.4rem;float:left;min-width: 13rem;">
{{ field('datepicker', item.gmarcheAt, "Date Prochain G-marché", {class: 'datepicker'}) }}
</div>
</div>
</div>
<form action="" method="post" enctype="multipart/form-data">
<form action="{{ path('antenne.create', { id: item.id, region: explodeUrl()[2], slug: explodeUrl()[3], antenne: explodeUrl()[4]}) }}" method="post" enctype="multipart/form-data">
{% include viewPath ~ '/form.twig' %}
<!--input id="antenne_id" name="antenne_id" type="hidden" value=" explodeUrl()[4] }}"-->
<button class="btn btn-primary" type="submit">Ajouter</button>
</form>
</div>
<div style="clear:both;">
<div class="row" style="color:white;">
<div class="col-md-12" style="margin-top:1rem;height:auto;">
<div class="form-group">
<label for="comment">Annonce de présentation de l'antenne</label><p></p>
Ligne 1 <textarea id="edito1" class="form-control" rows="2" name="contenu1"></textarea>
Ligne 2 <textarea id="edito2" class="form-control" rows="2" name="contenu2"></textarea>
Ligne 3 <textarea id="edito3" class="form-control" rows="2" name="contenu3"></textarea>
Ligne 4 <textarea id="edito4" class="form-control" rows="2" name="contenu4"></textarea>
</div>
</div>
</div>
<button class="btn btn-primary" type="submit">Enregistrer</button>
</div>
</form>
</div>
</div>
</div>
{% endblock %}

@ -1,21 +1,81 @@
{% extends 'layout.twig' %}
{% block title "Ğ1-Marché - Antennes" %}
{% block title "Ğ1-Marché - Créer Antennes" %}
{% block body %}
<script src="https://cdnjs.cloudflare.com/ajax/libs/flatpickr/3.0.7/flatpickr.js"></script>
<link rel="stylesheet" href="/css/jquery-ui.min.css">
<script src="https://code.jquery.com/ui/1.12.0/jquery-ui.js"></script>
<script type="text/javascript">
$.datepicker.setDefaults(
{
altField: "#datepicker",
closeText: 'Fermer',
prevText: 'Précédent',
nextText: 'Suivant',
currentText: 'Aujourd\'hui',
monthNames: ['Janvier', 'Février', 'Mars', 'Avril', 'Mai', 'Juin', 'Juillet', 'Août', 'Septembre', 'Octobre', 'Novembre', 'Décembre'],
monthNamesShort: ['Janv.', 'Févr.', 'Mars', 'Avril', 'Mai', 'Juin', 'Juil.', 'Août', 'Sept.', 'Oct.', 'Nov.', 'Déc.'],
dayNames: ['Dimanche', 'Lundi', 'Mardi', 'Mercredi', 'Jeudi', 'Vendredi', 'Samedi'],
dayNamesShort: ['Dim.', 'Lun.', 'Mar.', 'Mer.', 'Jeu.', 'Ven.', 'Sam.'],
dayNamesMin: ['D', 'L', 'M', 'M', 'J', 'V', 'S'],
weekHeader: 'Sem.',
dateFormat: 'dd-mm-yy'
}
);
</script>
<script>
$( function() {
$( "#datepicker" ).datepicker();
});
</script>
<div class="container_main">
<div id="la_page">
<span style="color:white;font-size:1.4rem;">
GESTION DES ANTENNES
</span>
<div class="container" style="margin:2rem 1rem;">
<a target="_blank" href="{{ path('antenne.create') }}" style="color:white;font-size: 1rem;"
class="btn btn-primary">Ajouter</a>
</div>
<div class="container" style="margin:1rem;">
<a target="_blank" href="{{ path('antenne.edit', {id: antenne.id}) }}" style="color:white;font-size: 1rem;"
class="btn btn-primary">Modifier</a>
<div id="la_page" style="color:white;">
<span style="color:white;font-size:1.4rem;">
CREATION D'UNE ANTENNE
</span>
<div class="container" style="padding:3rem; width:55rem;border:1px solid white;margin:auto;">
<form action="" method="post">
{{ csrf_input }}
<div class="row">
<div class="col-md-4">
{{ field('antenne', item.name, "Nom de l'antenne") }}
</div>
<div class="col-md-4" style="max-width: 15rem;">
<span style="margin-left:1rem;">REGION</span>
<select id="region_select" name="region" class="form-control">
<option class="list-group-item list-group-item-action" value="0">
Sélectionnez une région
</option>
{% for item in listeRegions %}
<option class="list-group-item list-group-item-action" value="{{ item.id }}">
{{ item.name }}
</option>
{% endfor %}
</select>
</div>
<div class="col-md-3">
<div style="margin-top:-0.4rem;float:left;" style="min-width: 13rem;">
{{ field('datepicker', item.gmarcheAt, "Prochain G-marché", {class: 'datepicker'}) }}
</div>
</div>
</div>
<div style="clear:both;">
<div class="row" style="color:white;">
<div class="col-md-12" style="margin-top:1rem;height:auto;">
<div class="form-group">
<label for="comment">Annonce de présentation de l'antenne</label><p></p>
Ligne 1 <textarea id="edito1" class="form-control" rows="2" name="contenu1"></textarea>
Ligne 2 <textarea id="edito2" class="form-control" rows="2" name="contenu2"></textarea>
Ligne 3 <textarea id="edito3" class="form-control" rows="2" name="contenu3"></textarea>
Ligne 4 <textarea id="edito4" class="form-control" rows="2" name="contenu4"></textarea>
</div>
</div>
</div>
<button class="btn btn-primary" type="submit">Enregistrer</button>
</div>
</form>
</div>
</div>
</div>
</div>
{% endblock %}

@ -71,6 +71,9 @@ class LoginAttemptAction
public function test_user($user, $params) {
$role = $this->userTable->findBy('username', $params['username'])->role;
echo "params_username=".$params['username'];
echo "<br />role=".$role;
// die();
$path = $this->session->get('auth.redirect') ?: $this->router->generateUri('gmarche.index');
$this->session->delete('auth.redirect');
//$path = $this->router->generateUri('gmarche.index');
@ -86,6 +89,8 @@ class LoginAttemptAction
}
$_SESSION['connecte'] = $params['username'];
$_SESSION['role'] = $role;
echo "<br />role2=".$role;
// die();
//$this->renderer->addGlobal('user', $user);
//$this->renderer->addGlobal('role', $role);

@ -2,13 +2,12 @@
namespace Framework\Actions;
use App\Gmarche\Table\AntenneTable;
use App\Gmarche\Table\RegionTable;
use Framework\Database\Hydrator;
use Framework\Database\Table;
use Framework\Renderer\RendererInterface;
use Framework\Router;
use Framework\Session\FlashService;
use Framework\Validator;
use App\Product\Entity\Product;
use Psr\Http\Message\ResponseInterface;
use Psr\Http\Message\ServerRequestInterface as Request;
@ -26,14 +25,9 @@ class CrudAction
private $router;
/**
* @var Table
*/
protected $table;
/**
* @var AntenneTable
*/
protected $table2;
protected $antenneTable;
/**
* @var FlashService
@ -54,9 +48,9 @@ class CrudAction
* @var string
*/
protected $messages = [
'create' => "L'élément truc a bien été créé", /* truc sera remplacé par le vrai nom ensuite */
'edit' => "L'élément truc a bien été modifié", /* truc sera remplacé par le vrai nom ensuite */
'delete' => "L'élément truc a bien été supprimé" /* truc sera remplacé par le vrai nom ensuite */
'create' => "L'antenne truc a bien été créée", /* truc sera remplacé par le vrai nom ensuite */
'edit' => "L'antenne truc a bien été modifiée", /* truc sera remplacé par le vrai nom ensuite */
'delete' => "L'antenne truc a bien été supprimée" /* truc sera remplacé par le vrai nom ensuite */
];
/**
@ -69,12 +63,14 @@ class CrudAction
public function __construct(
RendererInterface $renderer,
Router $router,
Table $table,
AntenneTable $antenneTable,
RegionTable $regionTable,
FlashService $flash
) {
$this->renderer = $renderer;
$this->router = $router;
$this->table = $table;
$this->antenneTable = $antenneTable;
$this->regionTable = $regionTable;
$this->flash = $flash;
}

@ -72,27 +72,16 @@ class Router
* @param $callable
* @param string $prefixName
*/
/* public function crud(string $prefixPath, $callable, string $prefixName)
public function crud(string $prefixPath, $callable, string $prefixName)
{
$this->get("$prefixPath", $callable, "$prefixName.index");
$this->get("$prefixPath/new", $callable, "$prefixName.create");
$this->post("$prefixPath/new", $callable);
$this->get("$prefixPath/{id:\d+}", $callable, "$prefixName.edit");
$this->post("$prefixPath/{id:\d+}", $callable);
// $this->get("$prefixPath/{id:\d+}", $callable, "$prefixName.edit");
// $this->post("$prefixPath/{id:\d+}", $callable);
$this->delete("$prefixPath/{id:\d+}", $callable, "$prefixName.delete");
}*/
}
/* public function crud_product(string $prefixPath, $callable, string $prefixName)
{
$this->get("$prefixPath", $callable, "$prefixName.index");
$this->get("$prefixPath/new", $callable, "$prefixName.create");
$this->post("$prefixPath/new", $callable);
$this->get("$prefixPath/{id:\d+}", $callable, "$prefixName.edit");
$this->post("$prefixPath/{id:\d+}", $callable);
$this->delete("$prefixPath/{id:\d+}", $callable, "$prefixName.delete");
}*/
/**
* @param ServerRequestInterface $request
* @return Route|null

@ -45,10 +45,6 @@ class AntenneShowAction
public function __invoke(Request $request)
{
/* echo "<pre>";
var_dump($container);
echo "</pre>";
die();*/
if ($request->getMethod() === 'GET') {
$params = $request->getQueryParams();
$gmarchePrefix = $this->container->get('gmarche.prefix');

@ -20,6 +20,10 @@ class Antenne
public $createdAt;
public $regionId;
public $edito1;
public $edito2;
public $edito3;
public $edito4;
public function setCreatedAt($datetime)
{

@ -3,7 +3,6 @@
namespace App\Gmarche\Table;
use App\Gmarche\Entity\Antenne;
use App\Auth\UserTable;
use Framework\Database\Query;
use Framework\Database\Table;
@ -22,6 +21,16 @@ class AntenneTable extends Table
->where("a.region_id = $region_id")
->order('a.name ASC');
}
public function findAllRegions(): Query
{
//$region = new RegionTable($this->pdo);
$table = 'regions';
return $this->makeQuery()
->select('r.*')
->order('r.name ASC');
}
public function findAnyAntennes(string $tri, $antennes_select): Query
{
$region = new RegionTable($this->pdo);

@ -53,6 +53,10 @@ class RechIndexAction
$requete = $this->antenneTable->findBy('slug', $antenne_slug);
$antenne_name = $requete->name;
$antenne_id = $requete->id;
$edito1 = $requete->edito1;
$edito2 = $requete->edito2;
$edito3 = $requete->edito3;
$edito4 = $requete->edito4;
$requete_region = $this->regionTable->findBy('slug', $region_slug);
$region_name = $requete_region->name;
$page = $params['p'] ?? 1;
@ -68,6 +72,8 @@ class RechIndexAction
$user_id = '';
}
$sess = $_SESSION;
return $this->renderer->render($viewPath.'/index', compact('sess','nom_user','user_id','antenne_slug','gmarchePrefix','region_name','region_slug','antenne_id','antenne_name','viewPath', 'items' ));
return $this->renderer->render($viewPath.'/index', compact('sess','nom_user','user_id',
'antenne_slug','gmarchePrefix','region_name','region_slug','antenne_id','antenne_name','viewPath',
'items', 'edito1', 'edito2','edito3','edito4' ));
}
}

@ -39,14 +39,11 @@
<div class="row">
<div class="col-md-12">
<div class="container" style="font-size:18px; color:white;line-height:1.4rem;">
<div>Tous les mois, la Toile Francilienne organise des rencontres entre utilisateurs de la Monnaie Libre.</div>
C'est l'occasion rêvée d'échanger avec d'autres membres !
{{ annonce_ligne1 }}
{{ annonce_ligne2 }}
{{ annonce_ligne3 }}
<p></p>
<div>Consultez, rajoutez, modifiez vos propositions dans la liste du mois.</div>
Mettez bien le pseudo, la clé publique, le bien ou service, et le prix en june.
<div>
{{ edito1 }}
<p>{{ edito2 }}</p>
{{ edito3 }}
<p>{{ edito4 }}</p>
</div>
<p>
{% if affiche_username() != '' or (sess.connecte != '' and sess.connecte != '---') %}

Loading…
Cancel
Save