$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" />

</head>
<body>
<form method="post" action="<?php 
 public static function deleteRecord($id)
 {
     $query = "delete from structured_field where id={$id}";
     $result = mysql_query($query) or die(sqlError(__FILE__, __LINE__, $query));
     // delete values and assets
     StructuredFieldValue::deleteAll($id);
     StructuredFieldAsset::deleteAll($id);
 }
Example #3
0
    }
    echo "</table>\n";
}
echo "<br/><br/>Create a new record:&nbsp;<a class='new' href='" . $_SERVER['PHP_SELF'] . "?name={$name}&new=1'></a>";
echo "</div>\n";
// display left content panel
echo "<div class='admin-content-edit'>\n";
if ($selectedRecordName) {
    echo "<h2>Edit the following properties for '{$selectedRecordName}' and save</h2>\n";
    echo "<form method='post' action='" . $_SERVER['PHP_SELF'] . "' enctype='multipart/form-data'>";
    // update values
    $index = 0;
    if ($textArray) {
        foreach ($textArray as $textField) {
            echo "<h3>" . $textField[2] . "</h3>\n";
            switch (StructuredFieldValue::getType($textField[2])) {
                case 'text':
                    echo "<input type='text' name='value" . $index++ . "' value='" . restoreValue($textField[3]) . "' width=40></input><br/>\n";
                    break;
                case 'textarea':
                    echo "<textarea name='value" . $index++ . "' rows='15' cols='70'>" . restoreValue($textField[3]) . "</textarea>";
                    break;
            }
        }
    }
    // update assets
    $index = 0;
    if ($assetArray) {
        foreach ($assetArray as $asset) {
            echo "<h3>" . $asset[5] . "</h3>\n";
            echo "enter the title here<br/><input type='text' name='asset{$index}' value='" . displayValue($asset[1]) . "' width=40></input><br/>\n";