32 lines
1.1 KiB
PHP
32 lines
1.1 KiB
PHP
<?php
|
|
include 'renderer.php';
|
|
|
|
class Projects extends Renderer {
|
|
protected function generateContent(): void {
|
|
$query = 'SELECT p.short_title, p.description, pt.caption
|
|
FROM project p
|
|
JOIN project_type pt
|
|
ON pt.id = p.project_type_id
|
|
ORDER BY pt.order_id, p.short_title';
|
|
$dbResult = mysqli_query($this->dbConnection, $query);
|
|
$previousSection = '';
|
|
$output = '';
|
|
while ($row = mysqli_fetch_assoc($dbResult)) {
|
|
if ($row['caption'] != $previousSection) {
|
|
if ($output !== '') {
|
|
$output .= '</ul>';
|
|
}
|
|
$output .= '<h3>' . $row['caption'] . '</h3><ul>';
|
|
$previousSection = $row['caption'];
|
|
}
|
|
$output .= '<li>' . $row['short_title'];
|
|
if (trim($row['description']) != '') {
|
|
$output .= ' - ' . $row['description'];
|
|
}
|
|
$output .= '</li>';
|
|
}
|
|
$output .= '</ul>';
|
|
$this->content['projects'] = $output;
|
|
}
|
|
}
|