Reworked Device Module and Vue Components
This commit is contained in:
@@ -18,11 +18,7 @@ class DevicetypeController extends mfBaseController
|
||||
|
||||
protected function indexAction()
|
||||
{
|
||||
|
||||
$this->layout()->setTemplate("Devicetype/Index");
|
||||
$devicetypes = DevicetypeModel::getAll();
|
||||
$this->layout()->set("devicetypes", $devicetypes);
|
||||
|
||||
$this->redirect("Device");
|
||||
}
|
||||
|
||||
protected function addAction()
|
||||
@@ -38,17 +34,17 @@ class DevicetypeController extends mfBaseController
|
||||
|
||||
if (!is_numeric($id) || !$id) {
|
||||
$this->layout()->setFlash("Gerätetyp nicht gefunden", "error");
|
||||
$this->redirect("Devicetype");
|
||||
$this->redirect("Device");
|
||||
}
|
||||
|
||||
$devicetypes = new Devicetype($id);
|
||||
if ($devicetypes->id != $id) {
|
||||
$this->layout()->setFlash("Gerätetyp nicht gefunden", "error");
|
||||
$this->redirect("Devicetype");
|
||||
$this->redirect("Device");
|
||||
}
|
||||
|
||||
$this->layout()->set("devicetypes", $devicetypes);
|
||||
return $this->addAction();
|
||||
$this->addAction();
|
||||
}
|
||||
|
||||
protected function saveAction()
|
||||
@@ -61,7 +57,7 @@ class DevicetypeController extends mfBaseController
|
||||
$devicetype = new Devicetype($id);
|
||||
if (!$devicetype->id) {
|
||||
$this->layout()->setFlash("Gerätetyp nicht gefunden", "error");
|
||||
$this->redirect("Devicetype");
|
||||
$this->redirect("Device");
|
||||
}
|
||||
} else {
|
||||
$mode = "add";
|
||||
@@ -95,7 +91,7 @@ class DevicetypeController extends mfBaseController
|
||||
|
||||
if (!$data['name']) {
|
||||
$this->layout()->setFlash("Name darf nicht leer sein", "error");
|
||||
$this->redirect("Devicetype");
|
||||
$this->redirect("Device");
|
||||
}
|
||||
|
||||
|
||||
@@ -116,7 +112,7 @@ class DevicetypeController extends mfBaseController
|
||||
|
||||
if (!$id) {
|
||||
$this->layout()->setFlash("Gerätetyp konnte nicht angelegt werden", "error");
|
||||
$this->redirect("Devicetype");
|
||||
$this->redirect("Device");
|
||||
}
|
||||
|
||||
if ($mode == "edit") {
|
||||
@@ -124,7 +120,7 @@ class DevicetypeController extends mfBaseController
|
||||
} else if ($mode = "add") {
|
||||
$this->layout()->setFlash("Gerätetyp erfolgreich angelegt", "success");
|
||||
}
|
||||
$this->redirect("Devicetype");
|
||||
$this->redirect("Device");
|
||||
}
|
||||
|
||||
|
||||
@@ -134,11 +130,12 @@ class DevicetypeController extends mfBaseController
|
||||
$devicetype = new Devicetype($id);
|
||||
if (!$devicetype->id || $devicetype->id != $id) {
|
||||
$this->layout()->setFlash("Gerätetyp nicht gefunden.", "error");
|
||||
$this->redirect("Devicetype");
|
||||
$this->redirect("Device");
|
||||
}
|
||||
|
||||
$devicetype->delete();
|
||||
$this->redirect("Devicetype");
|
||||
$this->layout()->setFlash("Gerätetyp erfolgreich gelöscht", "success");
|
||||
$this->redirect("Device");
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user