$suppliers = $adminUtils->getSupplier($values['suppid']); $suppliers = $suppliers[0]; $formCmd = "update"; $template = $twig->loadTemplate('admin-suppliers_edit.tmpl'); } else { if ($values['subcmd'] == "new") { $formCmd = "create"; $template = $twig->loadTemplate('admin-suppliers_edit.tmpl'); } else { if ($values['subcmd'] == "delete" && $values['suppid'] > 0) { $adminUtils->deleteSupplier($values['suppid']); $suppliers = $adminUtils->getSuppliers(); $template = $twig->loadTemplate('admin-suppliers_list.tmpl'); } else { if ($values['subcmd'] == "create") { if (!($supplier = $adminUtils->createSupplier($values['supplier'], $values['description'], $values['website'], $_SESSION['username']))) { echo "Bugger, something is not right!<br/>The last inserted ID we received is: " . $supplier . "\n"; } $suppliers = $adminUtils->getSupplier($supplier); $suppliers = $suppliers[0]; $formCmd = "update"; $template = $twig->loadTemplate('admin-suppliers_edit.tmpl'); } else { if ($values['subcmd'] == "update" && $values['suppid'] > 0) { $adminUtils->updateSupplier($values['suppid'], $values['supplier'], $values['description'], $values['website']); $suppliers = $adminUtils->getSupplier($values['suppid']); $suppliers = $suppliers[0]; $formCmd = "update"; $template = $twig->loadTemplate('admin-suppliers_edit.tmpl'); } else { $suppliers = $adminUtils->getSuppliers();