customer.php 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  1. <?php
  2. require_once("util.php");
  3. require_once("NTK/NTK.php");
  4. ?>
  5. <html>
  6. <head>
  7. <title> Index </title>
  8. <?php
  9. include("Modules/Customer/db_action.php");
  10. $main_box = new NTKVBox("main_box", 0, 0, False);
  11. // Toolbar
  12. $page = "customer";
  13. $printfile = "";
  14. include("Modules/toolbar.php");
  15. // small Toolbar
  16. include("Modules/Customer/toolbar.php");
  17. // main content
  18. $action = var_get_post("action", "");
  19. $search = var_post("search_entry", "");
  20. $customer_id = var_get("customer_id", "");
  21. $onload .= "document.getElementById('search_entry').focus();";
  22. if($action == "new")
  23. {
  24. include("Modules/Customer/new_form.php");
  25. }
  26. elseif($action == "edit" && $customer_id != "")
  27. {
  28. $data = $customer->get($customer_id);
  29. include("Modules/Customer/edit_form.php");
  30. }
  31. elseif($action == "search" && $search != "")
  32. {
  33. $list_view = new NTKListView("list_view", array('Kundennummer','Name','Details'), "location.href = 'customer.php?action=edit&customer_id=%0%';");
  34. $results = $customer->get('', array('customer_id', 'prename', 'postname'), "customer_id LIKE '%$search%' OR prename LIKE'%$search%' OR postname LIKE '%$search%'");
  35. if(count($results) == 1)
  36. $onload = "location.href = 'customer.php?action=edit&customer_id=".$results[0][0]."';";
  37. $list_view->addLines($results);
  38. $main_box->add($list_view, -1, -1, "background-color: #dfe7f3; vertical-align: top;");
  39. }
  40. else
  41. {
  42. /*$list_view = new NTKListView("list_view", array('Kundennummer','Vorname','Nachname'), "location.href = 'customer.php?action=edit&customer_id=%0%';");
  43. $list_view->addLines($customer->get('', array('customer_id', 'prename', 'postname')));
  44. $main_box->add($list_view, -1, -1, "background-color: #dfe7f3; vertical-align: top;");*/
  45. $main_box->add(new NTKSpacer(), -1, -1);
  46. }
  47. echo getHead();
  48. echo $main_box->getHtml();
  49. ?>
  50. </body>
  51. </html>