Correction affichage recherche, maj bouton, suppression requêtes de controller, déplacer mention et about dans page_controller, nettoyage des commentaires pour ctrl, entities & models
This commit is contained in:
parent
8c89a6ec1b
commit
050c804d48
20 changed files with 244 additions and 282 deletions
|
|
@ -5,32 +5,16 @@
|
|||
|
||||
public function __construct(){
|
||||
try{
|
||||
// Connexion à la base de données
|
||||
$this->_db = new PDO(
|
||||
"mysql:host=boulayoune.com;dbname=projet_folliow", // Serveur et BDD "mysql:host=localhost;dbname=projet_folliow",
|
||||
"projet_user", //Nom d'utilisateur de la base de données root
|
||||
"F0lliowRules!",// Mot de passe de la base de données
|
||||
array(PDO::ATTR_DEFAULT_FETCH_MODE => PDO::FETCH_ASSOC) // Mode de renvoi
|
||||
"mysql:host=boulayoune.com;dbname=projet_folliow",
|
||||
"projet_user",
|
||||
"F0lliowRules!",
|
||||
array(PDO::ATTR_DEFAULT_FETCH_MODE => PDO::FETCH_ASSOC)
|
||||
);
|
||||
// Pour résoudre les problèmes d’encodage
|
||||
$this->_db->exec("SET CHARACTER SET utf8");
|
||||
// Configuration des exceptions
|
||||
$this->_db->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
|
||||
} catch(PDOException$e) {
|
||||
echo "Échec : " . $e->getMessage();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
*Pour passer sur le serveur de YASS:
|
||||
*"mysql:host=boulayoune.com;dbname=projet_folliow", // Serveur et BDD
|
||||
"projet_user", //Nom d'utilisateur de la base de données
|
||||
"F0lliowRules!",// Mot de passe de la base de données
|
||||
Site pour BDD: https://phpmyadmin.boulayoune.com/index.php?route=/sql&pos=0&db=projet_folliow&table=project
|
||||
|
||||
*Pour passer en local:
|
||||
*"mysql:host=localhost;dbname=projet_folliow", // Serveur et BDD
|
||||
*"root", //Nom d'utilisateur de la base de données
|
||||
*"",// Mot de passe de la base de données
|
||||
*/
|
||||
}
|
||||
|
|
@ -4,7 +4,7 @@
|
|||
|
||||
/**
|
||||
* Traitement des requêtes pour les projets
|
||||
* @author : Laura
|
||||
* @author Laura & Guillaume
|
||||
*/
|
||||
|
||||
class ProjectModel extends Connect{
|
||||
|
|
@ -30,7 +30,6 @@
|
|||
|
||||
$strAnd = " AND ";
|
||||
|
||||
// Recherche par mot clé avec quote pour éviter bug du '
|
||||
if ($strKeywords != '') {
|
||||
|
||||
$strSafeKeywords = $this->_db->quote("%" . $strKeywords . "%");
|
||||
|
|
@ -39,24 +38,17 @@
|
|||
OR project_content LIKE ".$strSafeKeywords.") ";
|
||||
|
||||
}
|
||||
|
||||
// Recherche par auteur
|
||||
|
||||
if ($intAuthor > 0){
|
||||
$strRq .= $strAnd." user_id = ".$intAuthor;
|
||||
|
||||
}
|
||||
|
||||
// Recherche par catégorie
|
||||
if ($intCategory > 0){
|
||||
$strRq .= $strAnd." project_category = ".$intCategory;
|
||||
}
|
||||
|
||||
//recherche par ancienneté
|
||||
if ($boolOlderThan6Months === true) {
|
||||
$strRq .= $strAnd . " project_creation_date <= DATE_SUB(NOW(), INTERVAL 6 MONTH) ";
|
||||
}
|
||||
|
||||
// Recherche par dates
|
||||
if ($intPeriod == 0){
|
||||
if ($strDate != ''){
|
||||
$strRq .= $strAnd." project_creation_date = '".$strDate."'";
|
||||
|
|
@ -103,12 +95,9 @@
|
|||
$rqPrep->bindValue(":project_user_id", $objProject->getUser_id(), PDO::PARAM_STR);
|
||||
$rqPrep->bindValue(":project_category", $objProject->getCategory(), PDO::PARAM_STR);
|
||||
|
||||
// On met une variable boolOk pour récupérer l'id du projet
|
||||
$boolOk = $rqPrep->execute();
|
||||
|
||||
// Si boolOk est remplis
|
||||
if ($boolOk) {
|
||||
// On récupère l'ID auto-incrémenté et on l'injecte dans l'objet
|
||||
$objProject->setId($this->_db->lastInsertId());
|
||||
}
|
||||
|
||||
|
|
@ -291,11 +280,10 @@
|
|||
|
||||
$rqPrep->bindValue(":name", $fileName, PDO::PARAM_STR);
|
||||
$rqPrep->bindValue(":alt", $alt, PDO::PARAM_STR);
|
||||
// On met le statut par défaut en "en_attente" pour la modération
|
||||
$rqPrep->bindValue(":status", "en_attente", PDO::PARAM_STR);
|
||||
$rqPrep->bindValue(":project", $projectId, PDO::PARAM_INT);
|
||||
|
||||
return $rqPrep->execute();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -4,7 +4,7 @@
|
|||
|
||||
/**
|
||||
* Traitement des requêtes pour les utilisateurs
|
||||
* @author : meilleurGroup
|
||||
* @author : Yasser, Guillaume & Besnik
|
||||
*/
|
||||
|
||||
class UserModel extends Connect{
|
||||
|
|
@ -76,7 +76,6 @@
|
|||
$rqPrep->bindValue(":id", $userId, PDO::PARAM_INT);
|
||||
$rqPrep->bindValue(":token", $token, PDO::PARAM_STR);
|
||||
$rqPrep->bindValue(":exp",
|
||||
//pour faire que le cookies soit valable 15 jours
|
||||
date('Y-m-d H:i:s', time() + (15*24*60*60))
|
||||
, PDO::PARAM_STR);
|
||||
return $rqPrep->execute();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue