diff --git a/public/ajax/addRecord.php b/public/ajax/addRecord.php index 4ea1a9d..5b57c6e 100644 --- a/public/ajax/addRecord.php +++ b/public/ajax/addRecord.php @@ -6,11 +6,11 @@ ini_set('display_errors', 0); include '../../config/conf.php'; $bdd = new \PDO("mysql:host=$host;dbname=$database_name", $username, $password); - $params1['slug'] = $_POST['antenne_slug']; + //$params1['slug'] = $_POST['antenne_slug']; // Récupération de l'id de l'antenne à partir de son slug - $req_search = "SELECT id FROM antennes WHERE slug = :slug"; - $stmt = $bdd->prepare($req_search); - $antenne_id = $stmt->execute($params1); + //$req_search = "SELECT id FROM antennes WHERE slug = :slug"; + //$stmt = $bdd->prepare($req_search); + //$antenne_id = $stmt->execute($params1); // Récupération des informations du formulaire $params = array(); @@ -21,7 +21,7 @@ ini_set('display_errors', 0); $params['quantite'] = $_POST['quantite']; $params['prix'] = $_POST['prix']; //$params['created_at'] = date('d-m-Y'); - $params['antenne_id'] = $antenne_id; + $params['antenne_id'] = $_POST['antenne_id']; $params['content'] = ''; // Insertion dans la base diff --git a/public/ajax/readRecords.php b/public/ajax/readRecords.php index 82dcc1e..32f17e1 100644 --- a/public/ajax/readRecords.php +++ b/public/ajax/readRecords.php @@ -41,7 +41,7 @@ $bdd = new \PDO("mysql:host=$host;dbname=$database_name", $username, $password); $data .= ''.$row['name'].''; $data .= ''; $data .= ''.$row['username'].''; - $data .= ''.$row['cle_pub'].''; + $data .= ''; $data .= ''.$row['quantite'].''; $data .= ''.$row['prix'].''; $data .= ''; @@ -81,7 +81,7 @@ $bdd = new \PDO("mysql:host=$host;dbname=$database_name", $username, $password); else { // Il n'y a pas encore de biens/services saisis - $data .= "Pas d'enregistrement"; + $data .= "Aucun enregistrement saisi"; } $data .= ''; diff --git a/public/ajax/upload.php b/public/ajax/upload.php index 069a8e5..e2231bb 100644 --- a/public/ajax/upload.php +++ b/public/ajax/upload.php @@ -3,26 +3,21 @@ // Nom du fichier image $filename = $_FILES['image']['name'] ?? $_FILES['add_image']['name']; -// Location +// Emplacement $path = str_replace('\\', '/', dirname(realpath(__DIR__))); $location = $path.'/uploads/products/'.$filename; $location2 = '/uploads/products/'.$filename; -//echo "location = ".$location; -// file extension +// Extension du fichier $file_extension = pathinfo($location, PATHINFO_EXTENSION); $file_extension = strtolower($file_extension); -// Valid image extensions +// Extensions valides d'image $image_ext = array("jpg","png","jpeg"); $response = 0; if(in_array($file_extension,$image_ext)){ // Upload du fichier - //echo "
files image= ".$_FILES['image']['tmp_name']; - //echo "

"; - //var_dump($_FILES); - //die(); if(move_uploaded_file($_FILES['image']['tmp_name'] ?? $_FILES['add_image']['tmp_name'],$location)){ $response = $location2; } diff --git a/public/js/script.js b/public/js/script.js index 91e4b33..fdd1316 100644 --- a/public/js/script.js +++ b/public/js/script.js @@ -1,5 +1,5 @@ // Add Record -function addRecord(antenne_slug, nom_connecte, id_user) { +function addRecord(antenne_slug, antenne_id, nom_connecte, id_user) { var produit = $("#produit").val(); var image = $("#add_image").val(); @@ -16,7 +16,7 @@ function addRecord(antenne_slug, nom_connecte, id_user) { cle_pub: cle_pub, quantite: quantite, prix: prix, - antenne_slug: antenne_slug, + antenne_id: antenne_id, id_user: id_user }, function (data, status) { // close the popup diff --git a/src/Auth/views/login.twig b/src/Auth/views/login.twig index cdc4ede..e0b8212 100644 --- a/src/Auth/views/login.twig +++ b/src/Auth/views/login.twig @@ -20,7 +20,7 @@ {{ csrf_input() }} {{ field('username', null, 'Nom d\'utilisateur') }} {{ field('password', null, 'Mot de passe', {type: 'password'}) }} -

Mot de passe oublié ?

+

Mot de passe oublié ?

diff --git a/src/Gmarche/Actions/AntenneShowAction.php b/src/Gmarche/Actions/AntenneShowAction.php index ec33082..f5ec230 100644 --- a/src/Gmarche/Actions/AntenneShowAction.php +++ b/src/Gmarche/Actions/AntenneShowAction.php @@ -51,13 +51,13 @@ class AntenneShowAction $antennes = $this->antenneTable->findAllbyRegion($region_id)->paginate(10, $page); $region=$this->regionTable->findBy('slug', $request->getAttribute('slug')); - $antenne = 1; + //$antenne = 1; /*if ($region->slug !== $slug) { return $this->redirect('gmarche.show', [ 'slug' => $region->slug, 'id' => $region->id ]); }*/ - return $this->renderer->render('@gmarche/antenne', compact('slug', 'region', 'antennes','antenne', 'page')); + return $this->renderer->render('@gmarche/antenne', compact('slug', 'region', 'antennes', 'page')); } } diff --git a/src/Gmarche/GmarcheModule.php b/src/Gmarche/GmarcheModule.php index ff2f670..dda3119 100644 --- a/src/Gmarche/GmarcheModule.php +++ b/src/Gmarche/GmarcheModule.php @@ -3,9 +3,6 @@ namespace App\Gmarche; use App\Gmarche\Actions\AntenneShowAction; use App\Gmarche\Actions\RegionIndexAction; -use App\Product\Actions\ProductCrudAction; -use App\Product\Actions\ProductIndexAction; -use Framework\Auth\LoggedInMiddleware; use Framework\Module; use Framework\Renderer\RendererInterface; use Framework\Router; diff --git a/src/Product/views/admin/products/index.twig b/src/Product/views/admin/products/index.twig index 0ab47a2..48ef442 100644 --- a/src/Product/views/admin/products/index.twig +++ b/src/Product/views/admin/products/index.twig @@ -47,17 +47,17 @@ {% endif %}
-
+
-

- +

{% if current_user() %} - -

@@ -68,8 +68,8 @@