Пример #1
0
$sort = isset($_REQUEST['sort']) ? $_REQUEST['sort'] : 'createdon';
$dir = isset($_REQUEST['dir']) ? $_REQUEST['dir'] : 'DESC';
// Get child documents (with paging)
$rs = $modx->db->select('DISTINCT sc.*', "{$tbl_site_content} AS sc\n\t\tLEFT JOIN {$tbl_document_groups} AS dg ON dg.document = sc.id", "sc.parent='{$content['id']}' AND ({$access})", "{$sort} {$dir}", $childsTable->handlePaging());
$filter_sort = '';
$filter_dir = '';
if ($numRecords > 0) {
    $filter_sort = '<p><select size="1" name="sort" onchange="document.location=\'index.php?a=3&id=' . $id . '&dir=' . $dir . '&sort=\'+this.options[this.selectedIndex].value">' . '<option value="createdon"' . ($sort == 'createdon' ? ' selected' : '') . '>' . $_lang['createdon'] . '</option>' . '<option value="pub_date"' . ($sort == 'pub_date' ? ' selected' : '') . '>' . $_lang["page_data_publishdate"] . '</option>' . '<option value="pagetitle"' . ($sort == 'pagetitle' ? ' selected' : '') . '>' . $_lang['pagetitle'] . '</option>' . '<option value="menuindex"' . ($sort == 'menuindex' ? ' selected' : '') . '>' . $_lang['resource_opt_menu_index'] . '</option>' . '<option value="published"' . ($sort == 'published' ? ' selected' : '') . '>' . $_lang['resource_opt_is_published'] . '</option>' . '</select>';
    $filter_dir = '<select size="1" name="dir" onchange="document.location=\'index.php?a=3&id=' . $id . '&sort=' . $sort . '&dir=\'+this.options[this.selectedIndex].value">' . '<option value="DESC"' . ($dir == 'DESC' ? ' selected' : '') . '>' . $_lang['sort_desc'] . '</option>' . '<option value="ASC"' . ($dir == 'ASC' ? ' selected' : '') . '>' . $_lang['sort_asc'] . '</option>' . '</select></p>';
    $resource = $modx->db->makeArray($rs);
    // CSS style for table
    $tableClass = 'grid';
    $rowHeaderClass = 'gridHeader';
    $rowRegularClass = 'gridItem';
    $rowAlternateClass = 'gridAltItem';
    $childsTable->setTableClass($tableClass);
    $childsTable->setRowHeaderClass($rowHeaderClass);
    $childsTable->setRowRegularClass($rowRegularClass);
    $childsTable->setRowAlternateClass($rowAlternateClass);
    // Table header
    $listTableHeader = array('docid' => $_lang['id'], 'title' => $_lang['resource_title'], 'createdon' => $_lang['createdon'], 'pub_date' => $_lang['page_data_publishdate'], 'status' => $_lang['page_data_status'], 'edit' => $_lang['mgrlog_action']);
    $tbWidth = array('2%', '', '10%', '10%', '90', '150');
    $childsTable->setColumnWidths($tbWidth);
    $sd = isset($_REQUEST['dir']) ? '&amp;dir=' . $_REQUEST['dir'] : '&amp;dir=DESC';
    $sb = isset($_REQUEST['sort']) ? '&amp;sort=' . $_REQUEST['sort'] : '&amp;sort=createdon';
    $pg = isset($_REQUEST['page']) ? '&amp;page=' . (int) $_REQUEST['page'] : '';
    $add_path = $sd . $sb . $pg;
    $listDocs = array();
    foreach ($resource as $k => $children) {
        /*
        $listDocs[] = array(