public static function switchRank($id1, $id2)
 {
     $record1 = StructuredFieldValueLabel::read($id1);
     $record2 = StructuredFieldValueLabel::read($id2);
     $offset = sizeOf(StructuredFieldValueLabel::getStructure()) + 2;
     $rank1 = $record1[$offset];
     $rank2 = $record2[$offset];
     $query = "UPDATE structured_field_value_label SET rank={$rank2} WHERE id={$id1};";
     $result1 = mysql_query($query) or die(sqlError(__FILE__, __LINE__, $query));
     $query = "UPDATE structured_field_value_label SET rank={$rank1} WHERE id={$id2};";
     $result2 = mysql_query($query) or die(sqlError(__FILE__, __LINE__, $query));
 }
Example #2
0
if ($moveRankDown) {
    // move value label down
    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>
            $valueArray = StructuredFieldValueLabel::getSorted($id);
            if (!$valueArray) {
                $result = "no unit for the id={$id}";
            } else {
                foreach ($valueArray as $v) {
                    $vArray[] = implode(",", $v);
                }
                $result = "getSorted result:\n" . implode("<br/>", $vArray);
            }
            break;
        case 'switchrank':
            StructuredFieldValueLabel::switchRank($id, $id_switch);
            $result = "structured field value lael {$id} and {$id_switch} have switched their ranks";
            break;
        case 'getstructure':
            $result = StructuredFieldValueLabel::getStructure();
            $result = "structured of structured_field_value_label: " . implode(', ', $result);
            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>standupweb CMS - structured field value label test</title>
<link rel="shortcut icon" href="../images/favicon.ico" />

</head>
<body>
<form method="post" action="<?php