예제 #1
0
파일: index.php 프로젝트: druus/oscar
             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();
                         $template = $twig->loadTemplate('admin-suppliers_list.tmpl');
                     }
                 }
             }
         }
     }
     echo $template->render(array('pageTitle' => "OSCAR v3 Admin - Suppliers", 'cfgData' => $cfgData, 'formCmd' => $formCmd, 'suppliers' => $suppliers));
 } catch (Exception $e) {
     $template = $twig->loadTemplate('error.tmpl');