forked from malnuxstarck/Sitedusavoir
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsearch.php
93 lines (72 loc) · 2.51 KB
/
search.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
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
<?php
include "./includes/session.php";
$titre = "Recherche | SiteduSavoir.com";
require_once("./includes/identifiants.php");
require_once("./includes/debut.php");
require_once("./includes/menu.php");
$managerSearch = new ManagerSearch($bdd);
if (isset($_GET['q']) AND !empty($_GET['q']))
{
$motChercher = $_GET['q'];
$resultats = $managerSearch->search($motChercher);
if(empty($resultats))
{
echo '<p> Aucun resultats trouvees </p>';
echo '<div class="formulaire"/>
<form method="GET" action="search.php">
<div class="form-content">
<div class="input">
<label for="q"><img src="images/icones/Search.png"></label>
<input type="text" name="q" placeholder="Mot a rechercher">
</div>
<div class="submit">
<input type = "submit" value="Rechercher"/>
</div>
</div>
</form>
</div>';
}else
{
foreach ($resultats as $key => $value) {
var_dump($value);
/*
switch ($key) {
case 'topic':
foreach ($value as $topicDonnee) {
$topic = new Topic($topicDonnee);
echo '<div class = "sujet">';
echo '<h1>'.$topic->titre().'</h1>
<p>'.$topic->topictime().'<a href="forum/voirtopic.php?t='.$topic->id().'">Voir le sujet</a><p>';
echo '</div';
}
break;
case 'post':
break;
case 'contenus':
break;
default:
# code...
break;
}
*/
}
}
}
else
{
echo '<p> Le champs est vides , reesayer</p>
<div class="formulaire"/>
<form method="GET" action="search.php">
<div class="form-content">
<div class="input">
<label for="q"><img src="images/icones/Search.png"></label>
<input type="text" name="q" placeholder="Mot a rechercher">
</div>
<div class="submit">
<input type = "submit" value="Rechercher"/>
</div>
</div>
</form>
</div>';
}
include "./includes/footer.php";