$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); $result = "structured field value with id={$id} updated with value={$value} and name={$name} updated"; break; case 'deleteValue': StructuredFieldValue::deleteValue($id, $name); $result = "structured field value with name={$name} deleted"; break; } } ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> <title>simple CMS - unit field value test</title> <link rel="shortcut icon" href="../images/favicon.ico" />
$message .= "Upload {$filename} failed.<br/>"; } else { $message .= "Upload {$filename} successful.<br/>"; } } } } // save new value and redirect to the page to view the change $save = $_POST['save']; if ($save) { // save values $index = 0; $textArray = StructuredFieldValue::getValues($save); if ($textArray) { foreach ($textArray as $textField) { StructuredFieldValue::updateValue($textField[0], $_POST['value' . $index++], $textField[2]); } } // save assets $index = 0; $assetArray = StructuredFieldAsset::getAssets($save); if ($assetArray) { foreach ($assetArray as $asset) { if ($storedfile[$index]) { $asset[2] = $storedfile[$index]; $asset[3] = $ext[$index]; } StructuredFieldAsset::updateAsset($asset[0], $asset[2], $_POST['asset' . $index], $asset[3]); $index++; } }