$recordArray = StructuredField::getSortedRecords($id);
            if (!$recordArray) {
                $result = "no record for the unit with id={$id}";
            } else {
                foreach ($recordArray as $record) {
                    $recordFields[] = implode(",", $record);
                }
                $result = implode("<br/>", $recordFields);
            }
            break;
        case 'switchRank':
            StructuredField::switchRank($id, $id2);
            $result = "record at id={$id2} and id={$id} have switched their ranks";
            break;
        case 'deleteRecord':
            StructuredField::deleteRecord($id, $rank);
            $result = "record for unit with id={$id} at rank={$rank} have been 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 structured field test</title>
<link rel="shortcut icon" href="../images/favicon.ico" />

</head>
<body>
<form method="post" action="<?php 
}
// rename/lock/unlock record
if ($save) {
    $recordName = $_POST['recordName'];
    $selectedRecord = StructuredField::readRecord($init);
    if ($isAdmin) {
        $lockVal = $_POST['lock'];
    } 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');
    }
}
?>
 public static function switchRank($id1, $id2)
 {
     $record1 = StructuredField::readRecord($id1);
     $record2 = StructuredField::readRecord($id2);
     $rank1 = $record1[2];
     $rank2 = $record2[2];
     $query = "UPDATE structured_field SET rank={$rank2} WHERE id={$id1};";
     $result1 = mysql_query($query) or die(sqlError(__FILE__, __LINE__, $query));
     $query = "UPDATE structured_field SET rank={$rank1} WHERE id={$id2};";
     $result2 = mysql_query($query) or die(sqlError(__FILE__, __LINE__, $query));
 }
Exemple #4
0
?>
</h2>
	                    <ul>
	                        <?php 
StructuredField::printField('listOfContents', "<li>\n@@1\n</li>\n");
?>
	                    </ul>
	                </article>
	            </section>
	            <footer>
	            	<?php 
StaticField::includeText('listOfPictures');
?>
	                <ul>
						<?php 
StructuredField::printField('listOfPictures', "<li>\n<img src='swcms/assets/@@a1' alt='@@t1'></img>\n</li>\n");
?>
	                </ul>
	            </footer>
	        </div>
        </div>

<script type="text/javascript">
var gaJsHost = (("https:" == document.location.protocol) ? "https://ssl." : "http://www.");
document.write(unescape("%3Cscript src='" + gaJsHost + "google-analytics.com/ga.js' type='text/javascript'%3E%3C/script%3E"));
</script>
<script type="text/javascript">
try {
var pageTracker = _gat._getTracker("UA-16061291-1");
pageTracker._trackPageview();
} catch(err) {}</script>