示例#1
0
function build_dir_path($id)
{
    global $db;
    $result = $db->Execute("select parent_id, title from " . TABLE_DC_DOCUMENT . " where id = '" . $id . "'");
    $title = $id ? $result->fields['title'] : '';
    if ($result->fields['parent_id']) {
        $title = build_dir_path($result->fields['parent_id']) . '/' . $title;
    }
    return $title;
}
/**************  include page specific files    *********************/
require_once DIR_FS_MODULES . 'phreeform/defaults.php';
require_once DIR_FS_MODULES . 'phreeform/functions/phreeform.php';
/**************   page specific initialization  *************************/
if (!isset($_REQUEST['list'])) {
    $_REQUEST['list'] = 1;
}
$fieldset_content = 'NULL';
$id = (int) $_GET['id'];
if (!isset($_GET['id'])) {
    die;
}
$doc_details = $db->Execute("select * from " . TABLE_PHREEFORM . " where id = '" . $id . "'");
if ($id == 0 || $doc_details->fields['doc_type'] == '0') {
    // folder
    $dir_path = TEXT_PATH . ': /' . build_dir_path($id);
    $result = html_heading_bar(array(), array(' ', $dir_path, TEXT_ACTION));
    $list_header = $result['html_code'];
    $field_list = array('id', 'doc_type', 'doc_title', 'security');
    $query_raw = "select SQL_CALC_FOUND_ROWS " . implode(', ', $field_list) . " from " . TABLE_PHREEFORM . " where parent_id = '" . $id . "'";
    $query_result = $db->Execute($query_raw, MAX_DISPLAY_SEARCH_RESULTS * ($_REQUEST['list'] - 1) . ", " . MAX_DISPLAY_SEARCH_RESULTS);
    // the splitPageResults should be run directly after the query that contains SQL_CALC_FOUND_ROWS
    $query_split = new splitPageResults($_REQUEST['list'], '');
    include DIR_FS_MODULES . 'phreeform/pages/main/tab_folder.php';
} else {
    // load document details
    include DIR_FS_MODULES . 'phreeform/pages/main/tab_report.php';
}
$html = "<div>";
$html .= $fieldset_content;
$html .= "</div>";