if (!swValidate('s_username')) { header("location: ../index.php"); } connect(); $type = $_POST["type"]; $name = $_POST["name"]; $id = $_POST["id"]; $value = $_POST["value"]; if ($type) { switch ($type) { case 'createValue': StructuredFieldValue::createValue($id, $value, $name); $result = "structured field value with name={$name} created"; break; case 'readValue': $value = StructuredFieldValue::readValue($id); $result = "The value with id={$id} is '" . implode(', ', $value) . "'"; break; case 'getValues': $valueArray = StructuredFieldValue::getValues($id); if (!$valueArray) { $result = "no record for the name={$name}"; } else { foreach ($valueArray as $v) { $vArray[] = implode(",", $v); } $result = "getValues result:\n" . implode("<br/>", $vArray); } break; case 'updateValue': StructuredFieldValue::updateValue($id, $value, $name);