This repository was archived by the owner on Mar 1, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathspecies.php
More file actions
96 lines (92 loc) · 3.9 KB
/
species.php
File metadata and controls
96 lines (92 loc) · 3.9 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
89
90
91
92
93
94
95
96
<?php
include_once 'init.php';
$page_title = 'Espécies';
?>
<!doctype html>
<html lang="pt">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<meta name="description" content="">
<meta name="keywords" content="">
<meta name="author" content="<?php echo $author; ?>">
<title><?php echo $page_title; ?> - <?php echo $site_name; ?></title>
<?php include_once 'modules/head.php'; ?>
</head>
<body class="bg-light">
<?php include_once 'modules/menu.php'; ?>
<div class="container-fluid" role="main">
<div class="row">
<div class="col-12 col-md-8">
<div class="my-3 p-3 bg-white rounded box-shadow">
<h5>Peixes</h5>
<?php
$sql = 'SELECT
sp.id AS id, CONCAT(sp.genus, " ", sp.specie) AS nomenclature, sp.year AS year,
GROUP_CONCAT(tx.name) AS taxonomists
FROM sp_taxonomists_map AS tx_map
LEFT JOIN sp_species AS sp
ON tx_map.id_specie = sp.id
LEFT JOIN sp_taxonomists AS tx
ON tx_map.id_taxonomist = tx.id
WHERE sp.published = 1
AND validate = 1
GROUP BY sp.id
ORDER BY sp.genus, sp.specie
';
if($result=mysqli_query($mysqli,$sql))
{
if($result->num_rows)
{
echo '<ul>'."\n";
// Fetch one and one row
while ($row=mysqli_fetch_assoc($result))
{
$taxonomists = explode(',', $row['taxonomists']);
if (count($taxonomists) == 1)
{
$taxonomists = $row['taxonomists'];
}
else
{
$last = array_pop($taxonomists);
$firsts = implode(', ', $taxonomists);
$taxonomists = sprintf('%s & %s', $firsts, $last);
}
echo '<li>'."\n";
echo '<a class="badge badge-id" href="specie.php?id='.$row['id'].'" target="_blank">'.$row['nomenclature'].' </a>'."\n";
echo ' <span class="badge badge-light">('.$taxonomists.', '.$row['year'].')</span>'."\n";
/*echo ' <span class="badge badge-brd">BRD*</span>'."\n";
echo ' <span class="badge badge-danger">Gênero</span>'."\n";
echo ' <span class="changed">Leporinus mormyrops</span>'."\n";*/
echo '</li>'."\n";
}
echo '</ul>'."\n";
// Free result set
mysqli_free_result($result);
}
else
{
echo '<p>No entries</p>';
}
}
mysqli_close($mysqli);
?>
</div>
</div>
<div class="col-12 col-md-4">
<div class="my-3 p-3 bg-white rounded box-shadow">
<?php include_once 'modules/references.php'; ?>
</div>
<div class="my-3 p-3 bg-white rounded box-shadow">
<?php include_once 'modules/captions.php'; ?>
</div>
<div class="my-3 p-3 bg-white rounded box-shadow">
<?php include_once 'modules/abbreviations.php'; ?>
</div>
</div>
</div>
</div>
<?php include_once 'modules/footer.php'; ?>
</body>
</html>