public static function switchRank($id1, $id2)
 {
     $record1 = StructuredFieldAssetLabel::read($id1);
     $record2 = StructuredFieldAssetLabel::read($id2);
     $rank1 = $record1[sizeOf(StructuredFieldAssetLabel::getStructure()) + 2];
     $rank2 = $record2[sizeOf(StructuredFieldAssetLabel::getStructure()) + 2];
     $query = "UPDATE structured_field_asset_label SET rank={$rank2} WHERE id={$id1};";
     $result1 = mysql_query($query) or die(sqlError(__FILE__, __LINE__, $query));
     $query = "UPDATE structured_field_asset_label SET rank={$rank1} WHERE id={$id2};";
     $result2 = mysql_query($query) or die(sqlError(__FILE__, __LINE__, $query));
 }
示例#2
0
    if (strcmp($type, 'value') == 0) {
        StructuredFieldValueLabel::switchRank($valueLabels[$moveRankUp][0], $valueLabels[$moveRankUp + 1][0]);
        $valueLabels = StructuredFieldValueLabel::getSorted($id);
    } else {
        StructuredFieldAssetLabel::switchRank($assetLabels[$moveRankUp][0], $assetLabels[$moveRankUp + 1][0]);
        $assetLabels = StructuredFieldAssetLabel::getSorted($id);
    }
}
//get default values for the textareas (either from the selecting record, or from the first record)
if ($init) {
    // init with value label
    if (strcmp($type, 'value') == 0) {
        $selectedRecord = StructuredFieldValueLabel::read($init);
        $recordStructure = StructuredFieldValueLabel::getStructure();
    } else {
        $selectedRecord = StructuredFieldAssetLabel::read($init);
        $recordStructure = StructuredFieldAssetLabel::getStructure();
    }
    $selectedRecordName = displayValue($selectedRecord[2]);
}
?>
<!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 list: <?php 
echo $name;
?>
</title>
<link rel="stylesheet" href="css/style.css" type="text/css" media="all" />
<link rel="stylesheet" href="css/roar.css" type="text/css" media="all" />
$name = $_POST["name"];
$id = $_POST["id"];
$id_switch = $_POST["id_switch"];
$assets[] = $_POST["asset1"];
if ($type) {
    switch ($type) {
        case 'create':
            StructuredFieldAssetLabel::create($id);
            $result = "structured field asset label with name={$name} created";
            break;
        case 'update':
            StructuredFieldAssetLabel::update($id, $assets);
            $result = "structured field asset label with name={$name} updated";
            break;
        case 'read':
            $asset = StructuredFieldAssetLabel::read($id);
            $result = "The asset label with id={$id} is '" . implode(', ', $asset) . "'";
            break;
        case 'delete':
            StructuredFieldAssetLabel::delete($id);
            $result = "structured field asset label with id={$id} deleted";
            break;
        case 'getsorted':
            $assetArray = StructuredFieldAssetLabel::getSorted($id);
            if (!$assetArray) {
                $result = "no unit for the id={$id}";
            } else {
                foreach ($assetArray as $v) {
                    $vArray[] = implode(",", $v);
                }
                $result = "getSorted result:\n" . implode("<br/>", $vArray);