// could be post in case of form submitting, or get in case of 'new', 'delete'... $type = $_POST['type']; $type = empty($type) ? $_GET['type'] : $type; // save new value and redirect to the page to view the change $save = $_POST['save']; if ($save) { $name = $_POST['name']; $index = 1; while ($value = $_POST['value' . $index++]) { $values[] = $value; } // save new value label if (strcmp($type, 'value') == 0) { StructuredFieldValueLabel::update($save, $values); } else { StructuredFieldAssetLabel::update($save, $values); } $message = "{$type} label " . $values[0] . " updated in the list {$name}"; // redirect if needed if ($_POST['submitAndEdit']) { header("location: editrecord.php?name=" . $name); } $init = $save; } else { $init = $_GET['init']; $name = $_GET['name']; } // get the unit id $id = StructuredUnit::getUnitId($name); // create a new value label record $new = $_GET['new'];
header("location: ../index.php"); } connect(); $type = $_POST["type"]; $name = $_POST["name"]; $id = $_POST["id"]; $id_switch = $_POST["id_switch"]; $assets[] = $_POST["asset1"]; if ($type) { switch ($type) { case 'create': StructuredFieldAssetLabel::create($id); $result = "structured field asset label with name={$name} created"; break; case 'update': StructuredFieldAssetLabel::update($id, $assets); $result = "structured field asset label with name={$name} updated"; break; case 'read': $asset = StructuredFieldAssetLabel::read($id); $result = "The asset label with id={$id} is '" . implode(', ', $asset) . "'"; break; case 'delete': StructuredFieldAssetLabel::delete($id); $result = "structured field asset label with id={$id} deleted"; break; case 'getsorted': $assetArray = StructuredFieldAssetLabel::getSorted($id); if (!$assetArray) { $result = "no unit for the id={$id}"; } else {