fixed from error
This commit is contained in:
@@ -55,13 +55,13 @@ class Projectsmanagement extends Renderer {
|
||||
WHERE caption = "Fortlaufende Projekte"', $newName);
|
||||
mysqli_query($this->dbConnection, $query);
|
||||
$id = mysqli_insert_id($this->dbConnection);
|
||||
$query = 'SELECT id, short_title FROM project p ORDER BY short_title';
|
||||
$query = 'SELECT id, short_title, project_type_id FROM project p ORDER BY short_title';
|
||||
$dbResult = mysqli_query($this->dbConnection, $query);
|
||||
$list = [];
|
||||
while ($row = mysqli_fetch_assoc($dbResult)) {
|
||||
$list[] = ['id' => $row['id'], 'title' => $row['short_title'] ];
|
||||
$list[] = ['id' => $row['id'], 'title' => $row['short_title'], 'project_type_id' => $row['project_type_id'] ];
|
||||
}
|
||||
echo json_encode(['list' => $list, 'id' => $id]);
|
||||
echo json_encode(['list' => $list, 'id' => $id, 'types' => $this->getProjectTypes()]);
|
||||
}
|
||||
|
||||
protected function setDescription(): void {
|
||||
@@ -90,15 +90,10 @@ class Projectsmanagement extends Renderer {
|
||||
}
|
||||
|
||||
protected function generateContent(): void {
|
||||
$typesQuery = 'SELECT * FROM project_type ORDER BY id';
|
||||
$typesResult = mysqli_query($this->dbConnection, $typesQuery);
|
||||
$types = [];
|
||||
while ($row = mysqli_fetch_assoc($typesResult)) {
|
||||
$types[$row['id'] ] = $row['caption'];
|
||||
}
|
||||
$types = $this->getProjectTypes();
|
||||
$query = 'SELECT * FROM project ORDER BY short_title';
|
||||
$result = mysqli_query($this->dbConnection, $query);
|
||||
$overviewHtml = '<table><thead><tr><th>Projekt</th><th>Projekttyp</th><tr><thead><tbody>';
|
||||
$overviewHtml = '<table id="projectoverview"><thead><tr><th>Projekt</th><th>Projekttyp</th><tr><thead><tbody>';
|
||||
while ($row = mysqli_fetch_assoc($result)) {
|
||||
$overviewHtml .= '<tr><td>' . $row['short_title'] . '</td>';
|
||||
$overviewHtml .= '<td><select name="project_type" data="' . $row['id'] . '">';
|
||||
@@ -111,4 +106,14 @@ class Projectsmanagement extends Renderer {
|
||||
$overviewHtml .= '</tbody></table>';
|
||||
$this->content['projects'] = $overviewHtml;
|
||||
}
|
||||
|
||||
protected function getProjectTypes(): array {
|
||||
$typesQuery = 'SELECT * FROM project_type ORDER BY id';
|
||||
$typesResult = mysqli_query($this->dbConnection, $typesQuery);
|
||||
$types = [];
|
||||
while ($row = mysqli_fetch_assoc($typesResult)) {
|
||||
$types[$row['id'] ] = $row['caption'];
|
||||
}
|
||||
return $types;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user