mirror of
https://github.com/Floriansylvain/projet_programmation_web.git
synced 2026-08-19 11:43:16 +02:00
🚧 First introduction of these and dump system
This commit is contained in:
@@ -1,22 +1,39 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
class dump {
|
class dump {
|
||||||
private PDO $pdo;
|
private these $these;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param PDO $pdo
|
* @param these $these
|
||||||
*/
|
*/
|
||||||
public function __construct(PDO $pdo) {
|
public function __construct(these $these) {
|
||||||
$this->pdo = $pdo;
|
$this->these = $these;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function sendThese() {
|
public function sendThese() {
|
||||||
$sql = 'SELECT * FROM theses';
|
$data = [
|
||||||
$req = $this->pdo->query($sql);
|
'author' => $this->these->getAuthor(),
|
||||||
while($row = $req->fetch()) {
|
'id_author' => $this->these->getIdAuthor(),
|
||||||
echo "<p>" . $row['author'] . " | " . $row['title'] . "</p>";
|
'these_director' => $this->these->getTheseDirector(),
|
||||||
}
|
'title' => $this->these->getTitle(),
|
||||||
$req->closeCursor();
|
'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);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -0,0 +1,3 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
$pdo = new PDO('mysql:host=localhost;dbname=projet_prog_web', 'root', 'root');
|
||||||
+29
-4
@@ -1,10 +1,34 @@
|
|||||||
<?php
|
<?php
|
||||||
$pdo = new PDO('mysql:host=localhost;dbname=projet_prog_web', 'root', 'root');
|
|
||||||
|
|
||||||
|
require_once("conf.php");
|
||||||
|
require_once("class/these.php");
|
||||||
|
require_once("class/dump.php");
|
||||||
|
|
||||||
|
$these = new these("Florian",
|
||||||
|
"967125",
|
||||||
|
"Ma thèse très sympa",
|
||||||
|
"Didier Deschamps",
|
||||||
|
"Deschamps Didier",
|
||||||
|
"8516243",
|
||||||
|
"IUT Marne la vallée",
|
||||||
|
"128675",
|
||||||
|
"Informatique",
|
||||||
|
"passée",
|
||||||
|
"2001-1-3",
|
||||||
|
"2000-12-24",
|
||||||
|
"en",
|
||||||
|
"2146795",
|
||||||
|
false,
|
||||||
|
"2000-1-1",
|
||||||
|
"2000-1-1"
|
||||||
|
);
|
||||||
|
|
||||||
$row = 1;
|
$dump = new dump($these);
|
||||||
if (($handle = fopen("scripts/dump_abes_thesesfr.csv", "r")) !== FALSE) {
|
$dump->sendThese();
|
||||||
|
|
||||||
|
/*
|
||||||
|
$row = 1;
|
||||||
|
if (($handle = fopen("scripts/dump_abes_thesesfr.csv", "r")) !== FALSE) {
|
||||||
while (($data = fgetcsv($handle, 10000, ";")) !== FALSE) {
|
while (($data = fgetcsv($handle, 10000, ";")) !== FALSE) {
|
||||||
$num = count($data);
|
$num = count($data);
|
||||||
echo "<p>---------------- " . $row . " -----------------<br /></p>\n";
|
echo "<p>---------------- " . $row . " -----------------<br /></p>\n";
|
||||||
@@ -18,7 +42,8 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
fclose($handle);
|
fclose($handle);
|
||||||
}
|
}*/
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
$sql = 'SELECT * FROM theses';
|
$sql = 'SELECT * FROM theses';
|
||||||
|
|||||||
Reference in New Issue
Block a user