diff options
Diffstat (limited to 'Database/meth_dbsearch.php')
| -rw-r--r-- | Database/meth_dbsearch.php | 62 |
1 files changed, 47 insertions, 15 deletions
diff --git a/Database/meth_dbsearch.php b/Database/meth_dbsearch.php index 7557583..eed9915 100644 --- a/Database/meth_dbsearch.php +++ b/Database/meth_dbsearch.php @@ -1,18 +1,26 @@ <?php -// **************************************************************************** -// Description: Ensemble de méthodes pour étendre dbmain afin -// d'effectuer des recherches dans la bdd -// **************************************************************************** + +// ############################################################################ +// # # +// # Description: Ensemble de méthodes pour étendre dbmain afin # +// # d'effectuer des recherches dans la bdd # +// # # +// ############################################################################ + // Infos pour les "join": // https://www.freecodecamp.org/news/sql-joins-tutorial/ // Import de dbmain -require_once(dirname( __FILE__ )."/dbmain.php"); +require_once(dirname( __FILE__ )."./dbmain.php"); + // Extension de cette classe avec dbmain class DbSearch extends DbMain { + // **************************************************************************** + // RECUPERATION DES INFORMATIONS RELATIVES AUX UTILISATEURS + // **************************************************************************** // Récupération des infos d'un compte par son id - final public function get_user_account_by_id($id) { + final public function get_user_account_by_userid($userId) { $reqSearchUser = " SELECT userId, email, inscriptionDate, userStatus @@ -20,12 +28,12 @@ class DbSearch extends DbMain { ".$this->tableUserAccount." WHERE userId = ?"; - $result = $this->exec_cmd($reqSearchUser, array($id))->fetch(PDO::FETCH_ASSOC); + $result = $this->exec_cmd($reqSearchUser, array($userId))->fetch(PDO::FETCH_ASSOC); return $result; } // Récupération des infos d'un utilisateur par son id - final public function get_user_info_by_id($id) { + final public function get_user_info_by_userid($userId) { $reqGetUserInfo = " SELECT userId, lastname, firstname, degree, @@ -35,12 +43,32 @@ class DbSearch extends DbMain { ".$this->tableUserInfo." WHERE userId = ?"; - $result = $this->exec_cmd($reqGetUserInfo, array($id))->fetchAll(PDO::FETCH_ASSOC); + $result = $this->exec_cmd($reqGetUserInfo, array($userId))->fetchAll(PDO::FETCH_ASSOC); + return $result; + } + + // **************************************************************************** + // RECUPERATION DES INFORMATIONS RELATIVES AUX PROS + // **************************************************************************** + final public function get_all_pro_by_jobid($jobId) { + $reqSearchConsultant = " + SELECT + ".$this->tableUserInfo.".userId, + lastname, firstname, capability + FROM + ".$this->tableUserInfo." + INNER JOIN + ".$this->tableUserJob." + ON + ".$this->tableUserInfo.".userId = ".$this->tableUserJob.".userId + WHERE + jobCategoryId = ?"; + $result = $this->exec_cmd($reqSearchConsultant, array($jobId))->fetchAll(PDO::FETCH_ASSOC); return $result; } // Récupération des infos d'un pro par son nom - final public function get_pro_info_by_lastname($research) { + final public function get_pro_info_by_lastname($lastname) { $reqSearchConsultant = " SELECT ".$this->tableUserInfo.".userId, @@ -55,12 +83,12 @@ class DbSearch extends DbMain { userStatus = '1' AND lastname LIKE CONCAT('%', ?, '%')"; - $result = $this->exec_cmd($reqSearchConsultant, array($research))->fetchAll(PDO::FETCH_ASSOC); + $result = $this->exec_cmd($reqSearchConsultant, array($lastname))->fetchAll(PDO::FETCH_ASSOC); return $result; } // Récupération des emploies associés à un pro - final public function get_pro_job_category($proId) { + final public function get_pro_job_by_proid($proId) { $reqGetAll = " SELECT ".$this->tableUserJob.".jobCategoryId, @@ -78,7 +106,7 @@ class DbSearch extends DbMain { } // Récupération des notes d'un consultant par son nom - final public function get_pro_note_by_id($proId) { + final public function get_pro_note_by_proid($proId) { $reqCountMission = " SELECT note @@ -94,8 +122,11 @@ class DbSearch extends DbMain { return $result; } + // **************************************************************************** + // RECUPERATION DES INFORMATIONS RELATIVES AUX EMPLOIS + // **************************************************************************** // Récupérer toutes les infos de la table jobCategory - final public function get_job_category_all() { + final public function get_job_all() { $reqGetAllJobs = " SELECT * @@ -106,7 +137,7 @@ class DbSearch extends DbMain { } // Récupérer toutes les infos de la table jobCategory - final public function get_job_category_by_id($jobId) { + final public function get_job_by_jobid($jobId) { $reqGetJobinfo = " SELECT * @@ -118,4 +149,5 @@ class DbSearch extends DbMain { return $result; } } + ?>
\ No newline at end of file |
