From ae7f4d88e7ead1e921b0a75ad98287e1a011c569 Mon Sep 17 00:00:00 2001
From: Florian SYLVAIN
Date: Sat, 18 Sep 2021 14:13:10 +0200
Subject: [PATCH] =?UTF-8?q?=F0=9F=9A=A7=20First=20introduction=20of=20thes?=
=?UTF-8?q?e=20and=20dump=20system?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
ProjetProgWeb/class/dump.php | 37 ++++++++++++++++++-------
ProjetProgWeb/conf.php | 3 ++
ProjetProgWeb/index.php | 53 ++++++++++++++++++++++++++----------
3 files changed, 69 insertions(+), 24 deletions(-)
create mode 100644 ProjetProgWeb/conf.php
diff --git a/ProjetProgWeb/class/dump.php b/ProjetProgWeb/class/dump.php
index cf44b96..99c391c 100644
--- a/ProjetProgWeb/class/dump.php
+++ b/ProjetProgWeb/class/dump.php
@@ -1,22 +1,39 @@
pdo = $pdo;
+ public function __construct(these $these) {
+ $this->these = $these;
}
public function sendThese() {
- $sql = 'SELECT * FROM theses';
- $req = $this->pdo->query($sql);
- while($row = $req->fetch()) {
- echo "" . $row['author'] . " | " . $row['title'] . "
";
- }
- $req->closeCursor();
+ $data = [
+ 'author' => $this->these->getAuthor(),
+ 'id_author' => $this->these->getIdAuthor(),
+ 'these_director' => $this->these->getTheseDirector(),
+ 'title' => $this->these->getTitle(),
+ 'these_director_name_lastname' => $this->these->getTheseDirectorNameLastname(),
+ 'id_director' => $this->these->getIdDirector(),
+ 'soutenance_establishment' => $this->these->getSoutenanceEstablishment(),
+ 'id_establishment' => $this->these->getIdEstablishment(),
+ 'discipline' => $this->these->getDiscipline(),
+ 'status' => $this->these->getStatus(),
+ 'date_first_registration' => $this->these->getDateFirstRegistration(),
+ 'date_soutenance' => $this->these->getDateSoutenance(),
+ 'language' => $this->these->getLanguage(),
+ 'id_these' => $this->these->getIdThese(),
+ 'online' => $this->these->isOnline() ? "yes" : "no",
+ 'date_publication' => $this->these->getDatePublication(),
+ 'date_update' => $this->these->getDateUpdate()
+ ];
+ $sql = "INSERT INTO theses (author, id_author, these_director, title, these_director_name_lastname, id_director, soutenance_establishment, id_establishment, discipline, status, date_first_registration, date_soutenance, language, id_these, online, date_publication, date_update) VALUES (:author, :id_author, :these_director, :title, :these_director_name_lastname, :id_director, :soutenance_establishment, :id_establishment, :discipline, :status, :date_first_registration, :date_soutenance, :language, :id_these, :online, :date_publication, :date_update)";
+ $pdo = new PDO('mysql:host=localhost;dbname=projet_prog_web', 'root', 'root');
+ $stmt= $pdo->prepare($sql);
+ $stmt->execute($data);
}
}
\ No newline at end of file
diff --git a/ProjetProgWeb/conf.php b/ProjetProgWeb/conf.php
new file mode 100644
index 0000000..7564d0b
--- /dev/null
+++ b/ProjetProgWeb/conf.php
@@ -0,0 +1,3 @@
+---------------- " . $row . " -----------------
\n";
- $row++;
- for ($c=0; $c < $num; $c++) {
- if ($data[$c]) {
- echo $data[$c] . "
\n";
- } else {
- echo "NULL
\n";
- }
+$dump = new dump($these);
+$dump->sendThese();
+
+/*
+$row = 1;
+if (($handle = fopen("scripts/dump_abes_thesesfr.csv", "r")) !== FALSE) {
+ while (($data = fgetcsv($handle, 10000, ";")) !== FALSE) {
+ $num = count($data);
+ echo "---------------- " . $row . " -----------------
\n";
+ $row++;
+ for ($c=0; $c < $num; $c++) {
+ if ($data[$c]) {
+ echo $data[$c] . "
\n";
+ } else {
+ echo "NULL
\n";
}
}
- fclose($handle);
}
+ fclose($handle);
+}*/
+
/*
$sql = 'SELECT * FROM theses';