maj commentaires
This commit is contained in:
parent
124381521f
commit
11f0595801
5 changed files with 51 additions and 17 deletions
|
|
@ -39,13 +39,10 @@
|
||||||
|
|
||||||
public function search(){
|
public function search(){
|
||||||
|
|
||||||
//variable pour faire fonctionner le script en footer
|
|
||||||
$strPage = "search";
|
|
||||||
|
|
||||||
// inclusion du header
|
// inclusion du header
|
||||||
include('../app/views/partials/header.php');
|
include('../app/views/partials/header.php');
|
||||||
|
|
||||||
//Récupérer les informations du Formulaire
|
//Récupérer les informations du formulaire
|
||||||
$strKeywords = $_POST['keywords']??'';
|
$strKeywords = $_POST['keywords']??'';
|
||||||
$intAuthor = $_POST['author']??0;
|
$intAuthor = $_POST['author']??0;
|
||||||
$intPeriod = $_POST['period']??0;
|
$intPeriod = $_POST['period']??0;
|
||||||
|
|
|
||||||
|
|
@ -11,6 +11,7 @@ class Category extends Entity{
|
||||||
|
|
||||||
private int $_id;
|
private int $_id;
|
||||||
protected string $_name = '';
|
protected string $_name = '';
|
||||||
|
protected string $_parent = '';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructeur (j'ai toujours pas compris à quoi ça sert)
|
* Constructeur (j'ai toujours pas compris à quoi ça sert)
|
||||||
|
|
@ -53,5 +54,20 @@ class Category extends Entity{
|
||||||
$this->_name = $name;
|
$this->_name = $name;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Récuperation du nom du parent de la catégorie
|
||||||
|
* @return string nom de la catégorie
|
||||||
|
*/
|
||||||
|
public function getParent(){
|
||||||
|
return $this->_parent;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Mise à jour du nom du parent de la catégorie
|
||||||
|
* @param string le nouveau nom de la catégorie
|
||||||
|
*/
|
||||||
|
public function setParent($parent){
|
||||||
|
$this->_parent = $parent;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
@ -8,18 +8,40 @@
|
||||||
|
|
||||||
class CategoryModel extends Connect{
|
class CategoryModel extends Connect{
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Fonction de récupération des catégories
|
||||||
|
* @return array
|
||||||
|
*/
|
||||||
|
|
||||||
public function findAllCategory(int $intLimit=0):array{
|
public function findAllCategory(int $intLimit=0):array{
|
||||||
|
|
||||||
// Ecrire la requête
|
|
||||||
$strRq = "SELECT category.*
|
$strRq = "SELECT category.*
|
||||||
FROM category";
|
FROM category";
|
||||||
|
|
||||||
|
|
||||||
if ($intLimit > 0){
|
if ($intLimit > 0){
|
||||||
$strRq .= " LIMIT ".$intLimit;
|
$strRq .= " LIMIT ".$intLimit;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Lancer la requête et récupérer les résultats
|
|
||||||
return $this->_db->query($strRq)->fetchAll();
|
return $this->_db->query($strRq)->fetchAll();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* fonction d'insertion d'une nouvelle catégorie dans la bdd
|
||||||
|
* @param object $objUser L'objet utilisateur
|
||||||
|
* @return bool Est-ce que la requête s'est bien passée (true/false)
|
||||||
|
*/
|
||||||
|
|
||||||
|
public function insert(object $objCategory):bool{
|
||||||
|
|
||||||
|
$strRq = "INSERT INTO category (category_name, category_parent)
|
||||||
|
VALUES (:name, :parent)";
|
||||||
|
|
||||||
|
$rqPrep = $this->_db->prepare($strRq);
|
||||||
|
|
||||||
|
$rqPrep->bindValue(":name", $objCategory->getName(), PDO::PARAM_STR);
|
||||||
|
$rqPrep->bindValue(":parent", $objCategory->getParent(), PDO::PARAM_STR);
|
||||||
|
|
||||||
|
return $rqPrep->execute();
|
||||||
|
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -8,9 +8,13 @@
|
||||||
|
|
||||||
class ImageModel extends Connect{
|
class ImageModel extends Connect{
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Fonction de récupération des images
|
||||||
|
* @return array
|
||||||
|
*/
|
||||||
|
|
||||||
public function findAllImage(int $intLimit=0):array{
|
public function findAllImage(int $intLimit=0):array{
|
||||||
|
|
||||||
// Ecrire la requête
|
|
||||||
$strRq = "SELECT image.*
|
$strRq = "SELECT image.*
|
||||||
FROM image";
|
FROM image";
|
||||||
|
|
||||||
|
|
@ -19,7 +23,6 @@
|
||||||
$strRq .= " LIMIT ".$intLimit;
|
$strRq .= " LIMIT ".$intLimit;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Lancer la requête et récupérer les résultats
|
|
||||||
return $this->_db->query($strRq)->fetchAll();
|
return $this->_db->query($strRq)->fetchAll();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -58,11 +58,7 @@
|
||||||
public function insert(object $objUser):bool{
|
public function insert(object $objUser):bool{
|
||||||
|
|
||||||
// 2. Construire la requête
|
// 2. Construire la requête
|
||||||
/*$strRq = "INSERT INTO users (user_name, user_firstname, user_mail, user_pwd)
|
|
||||||
VALUES ('".$objUser->getName()."',
|
|
||||||
'".$objUser->getFirstname()."',
|
|
||||||
'".$objUser->getMail()."',
|
|
||||||
'".$objUser->getPwdHash()."')";*/
|
|
||||||
$strRq = "INSERT INTO users (user_name, user_firstname, user_pseudo, user_mail, user_password, user_phone, user_work, user_location, user_description)
|
$strRq = "INSERT INTO users (user_name, user_firstname, user_pseudo, user_mail, user_password, user_phone, user_work, user_location, user_description)
|
||||||
VALUES (:name, :firstname, :pseudo,:mail, :pwd, :phone, :work, :location,:description)";
|
VALUES (:name, :firstname, :pseudo,:mail, :pwd, :phone, :work, :location,:description)";
|
||||||
// Préparer la requête
|
// Préparer la requête
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue