예제 #1
0
파일: table.php 프로젝트: earist/eksam
<?php

require_once "functions.php";
if (isset($_GET["delete"])) {
    deleteComponent($_GET["delete"]);
}
if (isset($_POST["save"])) {
    updateComponent($_POST["id"], $_POST["component_name"], $_POST["price"]);
}
$component_array = getComponentInfo();
?>

<html>
<head>
<meta charset="utf-8">
<title>Komponentide andmetabel</title>
</head>
<h2>Komponentide andmetabel</h2>
<table border="1">
	<tr>
		<th>ID number</th>
		<th>Komponendi nimi</th>
		<th>Komponendi hind</th>
		<th>Kustuta</th>
		<th>Muuda</th>
	</tr>
	<?php 
for ($i = 0; $i < count($component_array); $i++) {
    if (isset($_GET["edit"]) && $component_array[$i]->id == $_GET["edit"]) {
        echo "<tr>";
        echo "<form action='table.php' method='post'>";
		exit(0);
		break;
	case "remove_unit_make":
		$ignore_return = removeUnitMake ($_GET['unit'],$_GET['make_id']);
		header("Location: system_editor_unit_makes.php?rd=".urlencode($_GET['rd'])."&unit=".$_GET['unit']);
		exit(0);
		break;
	case "component_edit":
		if ($_GET["component_id"] == "0") {
			//should force entry of driveline_series and steel_driveshaft_tube_od
			if (strlen($_GET["driveline_series"]) < 1 || strlen($_GET["steel_driveshaft_tube_od"]) < 1) {
				f_OutputErrorNow("Driveline Series and Steel Driveshaft Tube OD are required");
			}
			$ignore_return = insertPtsComponent($_GET);
		} else {
			$ignore_return = updateComponent($_GET);
		}
		break;
	case "unit_component_indent":
		$ignore_return =  setComponentIndent($_GET['component_id'],$_GET['indent']);
		break;
	case "edit_assembly_name":
		$ignore_return = updateAssemblyName($_GET['assembly_id'],$_GET['assembly_name']);
		break;
	case "assembly_delete":
		$ignore_return = deleteAssembly($_GET['assembly_id']);
		break;
	case "assembly_add":
		$ignore_return = addAssembly($_GET['unit'],$_GET['assembly']);
		break;
	case "assembly_add_part":