-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathsearch_writers.php
More file actions
88 lines (76 loc) · 2.27 KB
/
Copy pathsearch_writers.php
File metadata and controls
88 lines (76 loc) · 2.27 KB
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
<?php
$title = "Search writers";
require("template/top.tpl.php");
require_once("gb/controller/SearchWritersController.php");
require_once("gb/domain/Writer.php");
require_once("gb/mapper/CountryMapper.php");
$searchWriterController = new gb\controller\SearchWritersController();
$searchWriterController->process();
$countryMapper = new gb\mapper\CountryMapper();
$allCountries = $countryMapper->findAll();
?>
<form method="post">
<table style="width: 100%">
<tr>
<td colspan="4">
<table style="width: 100%">
<tr>
<td>Writer name</td>
<td><input type="text" name ="full_name" ></td>
<td>Date of birth</td>
<td><input type="text" name ="date_of_birth" ></td>
</tr>
<tr>
<td>Country</td>
<td colspan="3" style="width: 85%">
<select style="width: 50%" name="country">
<option value="">--------Select country ---------- </option>
<?php
foreach($allCountries as $country) {
echo "<option value=\"", $country->getIsoCode(), "\">", $country->getCountryName(), "</option>" ;
}
?>
</select>
</td>
</tr>
<tr>
<td > </td>
<td > </td>
<td><input type ="submit" name="search_writer" value="Search" ></td>
<td > </td>
</tr>
</table>
</td>
</table>
</form>
<?php
$writers = $searchWriterController->getSearchResult();
print count($writers) . " writers found";
if (count($writers) > 0) {
?>
<table style="width: 100%">
<tr>
<td>Full name</td>
<td>Birth date</td>
<td>Death date</td>
<td>Description</td>
</tr>
<?php
foreach($writers as $writer) {
?>
<tr>
<td><?php echo $writer->getFullName(); ?></td>
<td><?php echo $writer->getDateOfBirth(); ?></td>
<td><?php echo $writer->getDateOfDeath(); ?></td>
<td><?php echo $writer->getDescription(); ?></td>
</tr>
<?php
}
?>
</table>
<?php
}
?>
<?php
require("template/bottom.tpl.php");
?>