| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485 |
- <?php
- require_once("util.php");
- require_once("NTK/NTK.php");
- require_once("DataBase/Product.php");
- ?>
- <html>
- <head>
- <title> Index </title>
- <?php
- include("Modules/Product/db_action.php");
- $main_box = new NTKVBox("main_box", 0, 0, False);
- // Toolbar
- $page = "product";
- $printfile = "";
- include("Modules/toolbar.php");
- // small Toolbar
- include("Modules/Product/toolbar.php");
- // main content
- $action = var_get_post("action", "");
- $search = var_post("search_entry", "");
- $product_id = var_get_post("product_id", "");
- $onload .= "document.getElementById('search_entry').focus();";
- if($action == "new")
- {
- include("Modules/Product/new_form.php");
- }
- elseif($action == "edit" && $product_id != "")
- {
- $data = $product->get($product_id);
- include("Modules/Product/edit_form.php");
- }
- elseif($action == "search" && $search != "")
- {
- $search_toggle = var_post("search_toggle", "");
- $search_category = var_post("search_category", "");
- $search_in = "";
- if($search_category != "")
- {
- if($search_toggle && count($search_category) > 0)
- {
- for($i = 0; $i < count($search_category); $i++)
- $search_in .= " category_id='".$search_category[$i]."' AND ";
- }
- elseif(count($search_category) > 0)
- {
- for($i = 0; $i < count($search_category); $i++)
- $search_in .= " category_id<>'".$search_category[$i]."' AND ";
- }
- }
- $list_view = new NTKListView("list_view", array('Produktnummer','Name','Beschreibung'), "location.href = 'product.php?action=edit&product_id=%0%';");
- $results = $product->get('', array('product_id', 'name', 'details'), $search_in." (product_id LIKE '%$search%' OR name LIKE'%$search%' OR details LIKE '%$search%' OR order_number LIKE '%$search%')");
- if(count($results) == 1)
- $onload = "location.href = 'product.php?action=edit&product_id=".$results[0][0]."';";
- $list_view->addLines($results);
- $main_box->add($list_view, -1, -1, "background-color: #dfe7f3; vertical-align: top;");
- }
- else
- {
- /*$list_view = new NTKListView("list_view", array('Produktnummer','Name','Beschreibung'), "location.href = '$PHP_SELF?action=edit&product_id=%0%';");
- $list_view->addLines($product->get('', array('product_id', 'name', 'details')));
- $main_box->add($list_view, -1, -1, "background-color: #dfe7f3; vertical-align: top;");*/
- $main_box->add(new NTKSpacer(), -1, -1);
- }
- echo getHead();
- echo $main_box->getHtml();
- ?>
- </body>
- </html>
|