$result = "no record found";
            }
            break;
        case 'getSortedRecords':
            $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" />
예제 #2
0
    if ($id) {
        $records = StructuredField::getSortedRecords($id, $isAdmin);
    } else {
        header('location:editlist.php?name=' . $name);
    }
}
//move rank up
$moveRankUp = $_GET['moveup'];
if ($moveRankUp) {
    StructuredField::switchRank($records[$moveRankUp][0], $records[$moveRankUp - 1][0]);
    $records = StructuredField::getSortedRecords($id, $isAdmin);
}
//move rank down
$moveRankDown = $_GET['movedown'];
if ($moveRankDown) {
    StructuredField::switchRank($records[$moveRankDown][0], $records[1 + $moveRankDown][0]);
    $records = StructuredField::getSortedRecords($id, $isAdmin);
}
// 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)