public static function printField($name, $formattedString) { if (swValidate('edit')) { echo "<div style='position:absolute'><a target='_top' class='edit' href='swcms/editrecord.php?edittype=record&name={$name}' class='edit'></a></div>"; } $fieldList = StructuredField::getSortedRecords(StructuredUnit::getUnitId($name), true); $rank = 1; if ($fieldList) { foreach ($fieldList as $field) { $output = $formattedString; $output = str_replace("@@rank", $rank++, $output); $values = StructuredFieldValue::getValues($field[0]); $index = 1; if ($values) { foreach ($values as $value) { $output = str_replace("@@" . $index++, displayValue($value[3]), $output); } } $index = 1; $assets = StructuredFieldAsset::getAssets($field[0]); if ($assets) { foreach ($assets as $asset) { $output = str_replace("@@a" . $index, displayValue($asset[2]), $output); $output = str_replace("@@t" . $index, displayValue($asset[1]), $output); $index++; } } echo $output; } } }
} else { $lockVal = $selectedRecord[4]; } StructuredField::updateRecord($selectedRecord[0], $recordName, $selectedRecord[2], $lockVal); $records = StructuredField::getSortedRecords($id, $isAdmin); } //get default values for the textareas (either from the selecting record, or from the first record) if ($init) { $selectedRecord = StructuredField::readRecord($init); } else { $selectedRecord = $records[0]; $init = $selectedRecord[0]; } if ($init) { $textArray = StructuredFieldValue::getValues($init); $assetArray = StructuredFieldAsset::getAssets($init); $selectedRecordName = displayValue($selectedRecord[3]); // don't show locked record for non-admin users or there is no record name in the URL $lock = $selectedRecord[4]; if (empty($name) || $lock == 1 && !$isAdmin) { header('location:index.php'); } } ?> <!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>standupweb CMS - Edit <?php echo $name; ?>