示例#1
0
function drawLawXML($level, $node)
{
    if ($level > 0) {
        $delete = "";
        if (isset($node['edit']) && $node['edit']['add'] == 'f') {
            $delete = " delete='true'";
        }
        $id = explode('.', $node['path']);
        $id = $id[count($id) - 1];
        if (strstr($node['path'], '-') === false) {
            printf("<p id='%s'{$delete}>\n", $id);
        } else {
            printf("<p{$delete}>\n");
        }
        if (isset($node['edit']) && $node['edit']['add'] == 't') {
            printf("<h>%s</h>\n%s\n", $node['edit']['title'], $node['edit']['text']);
        }
    }
    foreach ($node['sub'] as $key => $subNode) {
        if ($key != '0') {
            drawLawXML($level + 1, $subNode);
        }
    }
    if ($level > 0) {
        echo "</p>\n";
    }
}
示例#2
0
文件: law.php 项目: redhog/DemoWave
function drawLawXML($level, $node)
{
    if ($level > 0) {
        $delete = "";
        if ($node['add'] == 'f') {
            $delete = " delete='true'";
        }
        $id = explode('.', $node['path']);
        $id = $id[count($id) - 1];
        $id_attr = '';
        if (strstr($node['path'], ':') === false) {
            $id_attr = " id='{$id}'";
        }
        printf("<p changed_at='{$node['changed']}' changed_in='{$node['referendum']}' {$id_attr}{$delete}>\n");
        if ($node['add'] == 't') {
            printf("<h>%s</h>\n%s\n", $node['title'], $node['text']);
        }
    }
    foreach ($node['sub'] as $key => $subNode) {
        if ($key != '0') {
            drawLawXML($level + 1, $subNode);
        }
    }
    if ($level > 0) {
        echo "</p>\n";
    }
}