-
Notifications
You must be signed in to change notification settings - Fork 0
/
Programme_dao.php
72 lines (45 loc) · 1.92 KB
/
Programme_dao.php
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
<?php
/*
A domain Class to demonstrate RESTful web services
*/
require_once("connection_.php");
Class Programme {
public function getProgramme(){
header("Access-Control-Allow-Origin: *");
header('Content-type:application/json');
header('Access-Control-Allow-Headers: Content-Type, Content-Range, Content-Disposition, Content-Description');
$DBConnection = new DBConnection();
$db = $DBConnection->DBConnection();
$postdata = file_get_contents("php://input");
$request = json_decode($postdata);
$req_class1 ='SELECT * from planing';
$retour = $db->prepare($req_class1);
$retour->execute();
$result = $retour->fetchAll(\PDO::FETCH_ASSOC);
return $result;
}
public function setRequestProgramme(){
header("Access-Control-Allow-Origin: *");
header('Content-type:application/json');
header('Access-Control-Allow-Headers: Content-Type, Content-Range, Content-Disposition, Content-Description');
$DBConnection = new DBConnection();
$db = $DBConnection->DBConnection();
$postdata = file_get_contents("php://input");
$request = json_decode($postdata);
$codeProf=$request->code_user;
$code_cl=$request->code_cl;
/*$demande_de='email';
$code_eleve='code';
$attestation='attestaionLibelle';
$commentaire='commentaire';*/
$stmt=$db->prepare('insert into suivi_mod (demande_de,code_eleve,attestation,commentaire) values(:demandede,:codeeleve,:attestationn,:commentairee)');
// $stmt->bind_param($date, $value, $id_temps,$codeClasse);
//$stmt->bindParam(':date', $date, PDO::PARAM_INT);
$stmt->bindParam(':demandede', $codeProf, PDO::PARAM_STR);
$stmt->bindParam(':codeeleve', $code_cl, PDO::PARAM_STR);
$stmt->execute();
$result = 'Done';
return $result;
}
}
?>