1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140
|
<?php
class parametres_2
{
public function __construct($db)
{
$this-> insert = $db->prepare("insert into scf_parametres_2
(Param1, Param2, Param3, Libelle_Param, Valeur, idCrea, TS_Crea)
values (:Param1, :Param2, :Param3, :Libelle_Param, :Valeur, :idCrea, current_timestamp)");
$this-> historiser = $db->prepare("insert into scf_parametres_2_hist
select current_timestamp, :idHist, Param1, Param2, Param3, Libelle_Param, Valeur, idCrea, TS_Crea, idModif, TS_Modif
from scf_parametres_2 where Param1 = :Param1 and Param2 = :Param2 and Param3 = :Param3");
$this->update = $db->prepare(
"update scf_parametres_2
set Libelle_Param = :Libelle_Param
, Valeur = :Valeur
, idModif = :idModif
, TS_Modif = current_timestamp
where Param1 = :Param1
and Param2 = :Param2
and Param3 = :Param3");
$this-> selectAll = $db->prepare("select * from scf_parametres_2 order by Param1, Param2, Param3");
$this-> selectOne = $db->prepare("select * from scf_parametres_2 where Param1 = :Param1 and Param2 = :Param2 and Param3 = :Param3");
$this-> List_Historique = $db->prepare("select * from scf_parametres_2_hist where Param1 = :Param1 and Param2 = :Param2 and Param3 = :Param3 order by TS_Hist desc");
$this-> selectByCode = $db->prepare("select * from scf_parametres_2 where Param1 = :Param1 order by Param2, Param3");
$this-> selectOneCode = $db->prepare("select * from scf_parametres_2 where Param1 = :Param1 order by Param2, Param3");
$this-> ListCodes = $db->prepare("select distinct Param1 from scf_parametres_2");
}
public function insert($Param1, $Param2, $Param3, $Libelle_Param, $Valeur)
{
try {
$this -> insert -> execute(array(':Param1' => $Param1, ':Param2' => $Param2, ':Param3' => $Param3,
':Libelle_Param' => $Libelle_Param, ':Valeur' => $Valeur, ':idCrea' => $_SESSION['idLicencie']));
return $this->insert->rowCount();
}
catch (PDOException $e) {
echo "<h1 id='msgerreur'>Erreur dans class_parametre.insert : $Param1, $Param2, $Param3, $Libelle_Param, $Valeur<br/></h1>";
die('<br><strong>Erreur : ' . $e->getMessage()) . "</strong></h4>";
}
}
public function historiser($idHist, $Param1, $Param2, $Param3)
{
try {
$this -> historiser-> execute(array(':idHist' => $idHist, ':Param1' => $Param1, ':Param2' => $Param2, ':Param3' => $Param3));
return $this->historiser->rowCount();
}
catch (PDOException $e) {
echo "<h1 id='msgerreur'>Erreur dans class_parametre.historiser : $Param1, $Param2, $Param3<br/></h1>";
die('<br><strong>Erreur : ' . $e->getMessage()) . "</strong></h4>";
}
}
public function update($Param1, $Param2, $Param3, $Libelle_Param, $Valeur)
{
try {
$this -> update-> execute(array(':Param1' => $Param1, ':Param2' => $Param2, ':Param3' => $Param3,
':Libelle_Param' => $Libelle_Param, ':Valeur' => $Valeur, ':idModif' => $_SESSION['idLicencie']));
return $this->update->rowCount();
}
catch (PDOException $e) {
echo "<h1 id='msgerreur'>Erreur dans class_parametre.update : $Param1, $Param2, $Param3, $Libelle_Param, $Valeur<br/></h1>";
die('<br><strong>Erreur : ' . $e->getMessage()) . "</strong></h4>";
}
}
public function selectAll()
{
try {
$this -> selectAll -> execute();
return $this->selectAll->fetchAll();
}
catch (PDOException $e) {
echo "<h1 id='msgerreur'>Erreur dans class_parametre.selectAll<br/></h1>";
die('<br><strong>Erreur : ' . $e->getMessage()) . "</strong></h4>";
}
}
public function List_Historique($Param1, $Param2, $Param3)
{
try {
$this -> List_Historique -> execute(array(':Param1' => $Param1, ':Param2' => $Param2, ':Param3' => $Param3));
return $this->List_Historique->fetchAll();
}
catch (PDOException $e) {
echo "<h1 id='msgerreur'>Erreur dans class_parametre.List_Historique($Param1, $Param2, $Param3)<br/></h1>";
die('<br><strong>Erreur : ' . $e->getMessage()) . "</strong></h4>";
}
}
public function selectOne($Param1, $Param2, $Param3)
{
try {
$this -> selectOne-> execute(array(':Param1' => $Param1, ':Param2' => $Param2, ':Param3' => $Param3));
return $this->selectOne->fetch();
}
catch (PDOException $e) {
echo "<h1 id='msgerreur'>Erreur dans class_parametre.selectOne : $Param1, $Param2, $Param3<br/></h1>";
die('<br><strong>Erreur : ' . $e->getMessage()) . "</strong></h4>";
}
}
public function selectByCode($Param1)
{
try {
$this -> selectByCode -> execute(array(':Param1' => $Param1));
return $this->selectByCode->fetchAll();
}
catch (PDOException $e) {
echo "<h1 id='msgerreur'>Erreur dans class_parametre.selectOne : $Param1, $Param2, $Param3<br/></h1>";
die('<br><strong>Erreur : ' . $e->getMessage()) . "</strong></h4>";
}
}
public function selectOneCode($Param1)
{
try {
$this -> selectOneCode -> execute(array(':Param1' => $Param1));
return $this->selectOneCode->fetch();
}
catch (PDOException $e) {
echo "<h1 id='msgerreur'>Erreur dans class_parametre.selectOneCode : $Param1<br/></h1>";
die('<br><strong>Erreur : ' . $e->getMessage()) . "</strong></h4>";
}
}
public function ListCodes()
{
try {
$this -> ListCodes -> execute();
return $this->ListCodes->fetchAll();
}
catch (PDOException $e) {
echo "<h1 id='msgerreur'>Erreur dans class_parametre.ListCodes<br/></h1>";
die('<br><strong>Erreur : ' . $e->getMessage()) . "</strong></h4>";
}
}
}
?> |
Partager