Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Arthur BOSSHARDT
Projet_Tutore_ANNEE_2
Commits
0e0f43dd
Commit
0e0f43dd
authored
Feb 26, 2018
by
Charles DORMEVAL
Browse files
Patch levenstein + ajout lien auteur citation aleatoire
parent
243dd42b
Changes
2
Hide whitespace changes
Inline
Side-by-side
Modele/MoteurDeRecherche.php
View file @
0e0f43dd
...
...
@@ -8,11 +8,11 @@ class MoteurDeRecherche
private
$authors
;
public
function
__construct
(){
try
{
$this
->
connexion
=
new
PDO
(
"mysql:host="
.
HOST
.
"; dbname="
.
BD
,
LOGIN
,
PASSWORD
,
array
(
PDO
::
MYSQL_ATTR_INIT_COMMAND
=>
"SET NAMES utf8"
));
}
catch
(
PDOException
$e
){
die
(
$e
->
getMessage
());
}
try
{
$this
->
connexion
=
new
PDO
(
"mysql:host="
.
HOST
.
"; dbname="
.
BD
,
LOGIN
,
PASSWORD
,
array
(
PDO
::
MYSQL_ATTR_INIT_COMMAND
=>
"SET NAMES utf8"
));
}
catch
(
PDOException
$e
){
die
(
$e
->
getMessage
());
}
$this
->
requestPattern
=
"select a.nom_auteur, c.contenu, o.nom_oeuvre, o.date_oeuvre from auteurs a, citations c, oeuvres o where a.id_auteur=o.id_auteur and o.id_oeuvre=c.id_oeuvre "
;
...
...
@@ -63,7 +63,7 @@ class MoteurDeRecherche
$result
=
""
;
foreach
(
$authors
as
$author
){
$lev
=
levenshtein
(
$auteur
,
$author
);
$lev
=
levenshtein
(
$auteur
,
strtolower
(
$author
)
)
;
if
(
$lev
==
$min
){
$result
=
$author
;
}
...
...
@@ -101,12 +101,10 @@ class MoteurDeRecherche
$result
=
""
;
foreach
(
$authors
as
$author
){
$lev
=
levenshtein
(
$auteur
,
$author
);
if
(
$lev
==
$min
){
$result
=
$author
;
}
if
(
$lev
<
$min
){
$lev
=
levenshtein
(
$auteur
,
strtolower
(
$author
));
if
(
$lev
<=
$min
){
$result
=
$author
;
$min
=
$lev
;
}
...
...
Vue/Vue.php
View file @
0e0f43dd
...
...
@@ -77,7 +77,7 @@
<h2
class=
"titre"
>
Citation Aléatoire
</h2>
<li
class=
"citation_recherchee"
style=
"list-style-type:none;"
>
<div
class=
"auteurAleatoire"
>
<p>
<?php
echo
$citationAleatoire
[
0
][
"nom_auteur"
]
?>
</p>
<p>
<a
href=
"index.php?correction=
<?php
echo
$citationAleatoire
[
0
][
"nom_auteur"
]
?>
&type=auteur&date=-1&citations=20"
>
<?php
echo
$citationAleatoire
[
0
][
"nom_auteur"
]
?>
</a>
</p>
</div>
<div
class=
"texteAleatoire"
>
<p>
<?php
echo
$citationAleatoire
[
0
][
"contenu"
]
?>
</p>
...
...
@@ -179,7 +179,7 @@
</div>
<p
class=
"texte_resultat_null"
>
Aucun résultat n'a pu être trouvé pour votre recherche !
</p>
</br></br></br></br></br></br></br></br></br></br></br></br></br></br></br></br></br></br></br></br>
</br></br></br></br></br></br></br></br></br></br></br></br></br></br></br></br></br></br></br></br>
<br/><br/><br/></br></br></br></br></br>
</body>
<footer>
<p>
Posted by: Medjo Johann, Dormeval Charles, Gauducheau Clément and Bosshardt Arthur
</p></br>
...
...
@@ -248,7 +248,7 @@
<p>
Nous n'avons pas trouvé de résultat pour votre recherche, cependant il est possible de la corriger, essayez :
</p>
<a
href=
"index.php?correction=
<?php
echo
$elementCorrige
;
?>
&type=
<?php
echo
$type
;
?>
&date=
<?php
echo
$date
;
?>
&citations=
<?php
echo
$citationsParPage
;
?>
"
>
<?php
echo
$elementCorrige
;
?>
</a>
</div>
</br></br></br></br></br></br></br></br></br></br></br></br></br></br></br></br></br></br></br></br>
</br></br></br></br></br></br></br></br></br></br></br></br></br></br></br></br></br></br></br></br>
<br/><br/><br/></br></br></br></br></br>
</body>
<footer>
<p>
Posted by: Medjo Johann, Dormeval Charles, Gauducheau Clément and Bosshardt Arthur
</p></br>
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment