Files
thetool/application/BuildingFile/BuildingFileController.php
2021-08-29 16:56:46 +02:00

36 lines
858 B
PHP

<?php
class BuildingFileController extends mfBaseController {
protected function init() {
$this->needlogin=true;
$me = new User();
$me->loadMe();
$this->me = $me;
$this->layout()->set("me",$me);
if(!$me->isAdmin()) {
$this->redirect("Dashboard");
}
}
protected function editAction() {
// internal redirect to File::editAction
}
protected function deleteAction() {
$id = $this->request->id;
$buildingfile = new BuildingFile($id);
if(!$buildingfile->id || $buildingfile->id != $id) {
$this->layout()->setFlash("Datei nicht gefunden.", "error");
$this->redirect("Building");
}
$building_id = $buildingfile->order_id;
$buildingfile->file->delete();
$buildingfile->delete();
$this->redirect("Building", "edit", ["id" => $building_id]);
}
}