From d19b31731d84c16919d11b8947f2b0d24db3054a Mon Sep 17 00:00:00 2001 From: Sven Slootweg Date: Mon, 30 Dec 2013 03:19:33 +0100 Subject: [PATCH] Implement template addition --- frontend/modules/admin/template/add.php | 22 ++++++++++++++-------- 1 file changed, 14 insertions(+), 8 deletions(-) diff --git a/frontend/modules/admin/template/add.php b/frontend/modules/admin/template/add.php index 008ac74..81a7db0 100644 --- a/frontend/modules/admin/template/add.php +++ b/frontend/modules/admin/template/add.php @@ -29,17 +29,23 @@ if($router->uMethod == "post") return file_exists("/etc/cvm/templates/{$value}"); }) ->Done(); + + foreach($handler->GetGroupedValues("filename", "name", "description") as $uTemplateData) + { + $sTemplate = new Template(); + $sTemplate->uName = $uTemplateData["name"]; + $sTemplate->uTemplateName = $uTemplateData["filename"]; + $sTemplate->uDescription = $uTemplateData["description"]; + $sTemplate->uIsSupported = true; + $sTemplate->uIsOutdated = false; + $sTemplate->uIsAvailable = true; + $sTemplate->InsertIntoDatabase(); + } + + redirect("/admin/templates/"); } catch (FormValidationException $e) { - /*echo("Errors:
"); - foreach($e->exceptions as $exceptionlist) - { - foreach($exceptionlist as $exception) - { - echo("{$exception['key']}[{$exception['index']}] {$exception['error_msg']}
"); - } - }*/ var_dump($e->GetOffendingKeys()); var_dump($e->GetErrors()); }