You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
92 lines
3.5 KiB
92 lines
3.5 KiB
<?php
|
|
|
|
include 'dal/Gateway/GatewayAbstrait.php';
|
|
|
|
class ProfilGateway extends GatewayAbstrait{
|
|
|
|
public function __construct(Connection $con){
|
|
$this->con = $con;
|
|
}
|
|
|
|
public function insererProfil(string $email,string $alumni,string $cv, string $nom,string $prenom,string $linkedin,string $github,string $portfolio){
|
|
try{
|
|
$query='INSERT INTO Profil(id,alumni,email,cv,nom,prenom,linkedin_url,github_url,portfolio_url) VALUES (:id,:alumni,:email,:cv,:nom,:prenom,:linkedin_url,github_url,portfolio_url)';
|
|
$this->con->executeQuery($query, array(
|
|
':id' => array($id, PDO::PARAM_STR),
|
|
':alumni' => array($alumni, PDO::PARAM_STR),
|
|
':cv' => array($cv, PDO::PARAM_STR),
|
|
':nom' => array($nom, PDO::PARAM_STR),
|
|
':prenom' => array($prenom, PDO::PARAM_STR),
|
|
':linkedin_url' => array($linkedin, PDO::PARAM_STR),
|
|
':github_url' => array($github, PDO::PARAM_STR),
|
|
':portfolio_url' => array($portfolio, PDO::PARAM_STR),
|
|
':email' => array($email, PDO::PARAM_STR)
|
|
));
|
|
} catch(PDOException $Exception){
|
|
require 'vues/erreur.html';
|
|
} catch (Exception $Exception){
|
|
require 'vues/erreur.html';
|
|
}
|
|
}
|
|
|
|
public function supprimeAlumni(string $id){
|
|
try{
|
|
$query='DELETE FROM Profil WHERE id = (:id)';
|
|
$this->con->executeQuery($query, array(
|
|
':id' => array($id, PDO::PARAM_STR),
|
|
));
|
|
} catch(PDOException $Exception){
|
|
require 'vues/erreur.html';
|
|
} catch (Exception $Exception){
|
|
require 'vues/erreur.html';
|
|
}
|
|
}
|
|
|
|
public function editAlumni(string $id,string $email,string $alumni,string $cv, string $nom,string $prenom,string $linkedin,string $github,string $portfolio){
|
|
try{
|
|
supprimeAlumni($id);
|
|
insererProfil($email,$alumni,$cv,$nom,$prenom,$linkedin,$github,$portfolio);
|
|
} catch(PDOException $Exception){
|
|
require 'vues/erreur.html';
|
|
} catch (Exception $Exception){
|
|
require 'vues/erreur.html';
|
|
}
|
|
|
|
}
|
|
|
|
public function recupereProfil(string $id){
|
|
try{
|
|
$query='SELECT * FROM Profil WHERE id=(:id)';
|
|
$this->con->executeQuery($query, array(
|
|
':id' => array($id, PDO::PARAM_STR),
|
|
));
|
|
$res = $this->con->getResults();
|
|
return new Profil($res['id'],$res['alumni'],$res['email'],$res['cv'],$res['nom'],$res['prenom'],$res['linkedin_url'],$res['github_url'],$res['portfolio_url']);
|
|
} catch(PDOException $Exception){
|
|
require 'vues/erreur.html';
|
|
} catch (Exception $Exception){
|
|
require 'vues/erreur.html';
|
|
}
|
|
}
|
|
|
|
public function recupereDataProfil(){
|
|
try{
|
|
$query='SELECT * FROM Alumni';
|
|
$this->con->executeQuery($query);
|
|
$res = $this->con->getResults();
|
|
$AlumniArray = array();
|
|
foreach($res as $v){
|
|
$a=new Profil($v['id'],$v['alumni'],$v['email'],$v['cv'],$v['nom'],$v['prenom'],$v['linkedin_url'],$v['github_url'],$v['portfolio_url']);
|
|
array_push($AlumniArray,$a);
|
|
}
|
|
return $AlumniArray;
|
|
} catch(PDOException $Exception){
|
|
require 'vues/erreur.html';
|
|
} catch (Exception $Exception){
|
|
require 'vues/erreur.html';
|
|
}
|
|
}
|
|
|
|
}
|
|
|
|
?>
|