コード例 #1
0
ファイル: booklibrary.php プロジェクト: rdegennaro/Check-It
function showCategories()
{
    global $database, $my, $option, $menutype, $mainframe, $mosConfig_list_limit, $acl;
    $grooups = get_group_children_bl();
    $section = "com_booklibrary";
    $sectionid = $mainframe->getUserStateFromRequest("sectionid{$section}{$section}", 'sectionid', 0);
    $limit = $mainframe->getUserStateFromRequest("viewlistlimit", 'limit', $mosConfig_list_limit);
    $limitstart = $mainframe->getUserStateFromRequest("view{$section}limitstart", 'limitstart', 0);
    $levellimit = $mainframe->getUserStateFromRequest("view{$option}limit{$menutype}", 'levellimit', 10);
    $query = "SELECT  c.*, c.checked_out as checked_out_contact_category, c.parent_id as parent,\n                        c.params, u.name AS editor, COUNT(bc.id) AS cc" . "\n FROM #__booklibrary_main_categories AS c" . "\n LEFT JOIN #__booklibrary_categories as bc ON bc.catid=c.id" . "\n LEFT JOIN #__users AS u ON u.id = c.checked_out" . "\n WHERE c.section='{$section}'" . "\n GROUP BY c.id " . "\n ORDER BY parent_id DESC, ordering";
    $database->setQuery($query);
    $rows = $database->loadObjectList();
    foreach ($rows as $k => $v) {
        $rows[$k]->ncourses = 0;
        foreach ($rows as $k1 => $v1) {
            if ($v->id == $v1->parent) {
                $rows[$k]->cc += $v1->cc;
            }
        }
        $rows[$k]->cc == 0 ? "-" : "<a href=\"?option=com_booklibrary&section=book&catid=" . $v->id . "\">" . $v->cc . "</a>";
        //for 1.6
        $curgroup = "";
        $ss = explode(',', $v->params);
        foreach ($ss as $s) {
            if ($s == '') {
                $s = '-2';
            }
            $curgroup[] = $grooups[$s];
        }
        $rows[$k]->groups = implode(', ', $curgroup);
    }
    if ($database->getErrorNum()) {
        echo $database->stderr();
        return false;
    }
    // establish the hierarchy of the categories
    $children = array();
    // first pass - collect children
    foreach ($rows as $v) {
        $pt = $v->parent;
        $list = @$children[$pt] ? $children[$pt] : array();
        array_push($list, $v);
        $children[$pt] = $list;
    }
    // second pass - get an indent list of the items
    $list = bookLibraryTreeRecurse(0, '', array(), $children, max(0, $levellimit - 1));
    $total = count($list);
    $pageNav = new JPagination($total, $limitstart, $limit);
    // for J 1.6
    $levellist = mosHTML::integerSelectList(1, 20, 1, 'levellimit', 'size="1" onchange="document.adminForm.submit();"', $levellimit);
    // slice out elements based on limits
    $list = array_slice($list, $pageNav->limitstart, $pageNav->limit);
    $count = count($list);
    // get list of sections for dropdown filter
    $javascript = 'onchange="document.adminForm.submit();"';
    if (version_compare(JVERSION, "3.0.0", "lt")) {
        $mosAdminMenus = new mosAdminMenus();
        $lists['sectionid'] = $mosAdminMenus->SelectSection('sectionid', $sectionid, $javascript);
    }
    HTML_Categories::show($list, $my->id, $pageNav, $lists, 'other');
}
コード例 #2
0
ファイル: admin.categories.php プロジェクト: cwcw/cms
/**
* Compiles a list of categories for a section
* @param string The name of the category section
* @param string The name of the current user
*/
function showCategories($section, $option)
{
    global $database, $my, $mainframe, $mosConfig_list_limit;
    global $adminLanguage;
    $sectionid = $mainframe->getUserStateFromRequest("sectionid{$option}{$section}", 'sectionid', 0);
    $limit = $mainframe->getUserStateFromRequest("viewlistlimit", 'limit', $mosConfig_list_limit);
    $limitstart = $mainframe->getUserStateFromRequest("view{$section}limitstart", 'limitstart', 0);
    $section_name = '';
    if (intval($section) > 0) {
        $table = 'content';
        $database->setQuery("SELECT name FROM #__sections WHERE id='{$section}'");
        $section_name = $database->loadResult();
        $section_name .= ' Section';
        $where = "\n WHERE c.section='{$section}'";
        $type = 'content';
    } else {
        if (strpos($section, 'com_') === 0) {
            $table = substr($section, 4);
            $database->setQuery("SELECT name FROM #__components WHERE link='option={$section}'");
            $section_name = $database->loadResult();
            $where = "\n WHERE c.section='{$section}'";
            $type = 'other';
        } else {
            $table = $section;
            $where = "\n WHERE c.section='{$section}'";
            $type = 'other';
        }
    }
    $content_add = '';
    $content_join = '';
    $order = "\n ORDER BY c.ordering, c.name";
    // get the total number of records
    $database->setQuery("SELECT count(*) FROM #__categories WHERE section='{$section}'");
    $total = $database->loadResult();
    // allows for viweing of all content categories
    if ($section == 'content') {
        $table = 'content';
        $content_add = "\n , z.title AS section_name";
        $content_join = "\n LEFT JOIN #__sections AS z ON z.id = c.section";
        //$where = "\n WHERE s1.catid = c.id";
        $where = "\n WHERE c.section NOT LIKE '%com_%'";
        $order = "\n ORDER BY c.section, c.ordering, c.name";
        $section_name = 'All Content';
        // get the total number of records
        $database->setQuery("SELECT count(*) FROM #__categories INNER JOIN #__sections AS s ON s.id = section");
        $total = $database->loadResult();
        $type = 'content';
    }
    // used by filter
    if ($sectionid > 0) {
        $filter = "\n AND c.section = '{$sectionid}'";
    } else {
        $filter = '';
    }
    require_once $GLOBALS['mosConfig_absolute_path'] . '/administrator/includes/pageNavigation.php';
    $pageNav = new mosPageNav($total, $limitstart, $limit);
    $query = "SELECT  c.*, c.checked_out as checked_out_contact_category, g.name AS groupname, u.name AS editor," . "COUNT(DISTINCT s2.checked_out) AS checked_out" . $content_add . "\n FROM #__categories AS c" . "\n LEFT JOIN #__users AS u ON u.id = c.checked_out" . "\n LEFT JOIN #__groups AS g ON g.id = c.access" . "\n LEFT JOIN #__{$table} AS s2 ON s2.catid = c.id AND s2.checked_out > 0" . $content_join . $where . $filter . "\n AND c.published != -2" . "\n GROUP BY c.id" . $order . "\n LIMIT {$pageNav->limitstart}, {$pageNav->limit}";
    $database->setQuery($query);
    $rows = $database->loadObjectList();
    if ($database->getErrorNum()) {
        echo $database->stderr();
        return false;
    }
    $count = count($rows);
    // number of Active Items
    for ($i = 0; $i < $count; $i++) {
        $query = "SELECT COUNT( a.id )" . "\n FROM #__content AS a" . "\n WHERE a.catid = " . $rows[$i]->id . "\n AND a.state <> '-2'";
        $database->setQuery($query);
        $active = $database->loadResult();
        $rows[$i]->active = $active;
    }
    // number of Trashed Items
    for ($i = 0; $i < $count; $i++) {
        $query = "SELECT COUNT( a.id )" . "\n FROM #__content AS a" . "\n WHERE a.catid = " . $rows[$i]->id . "\n AND a.state = '-2'";
        $database->setQuery($query);
        $trash = $database->loadResult();
        $rows[$i]->trash = $trash;
    }
    // get list of sections for dropdown filter
    $javascript = 'onchange="document.adminForm.submit();"';
    $lists['sectionid'] = mosAdminMenus::SelectSection('sectionid', $sectionid, $javascript);
    categories_html::show($rows, $section, $section_name, $my->id, $pageNav, $lists, $type);
}
コード例 #3
0
ファイル: admin.content.php プロジェクト: cwcw/cms
/**
* Shows a list of archived content items
* @param int The section id
*/
function viewArchive($sectionid, $option)
{
    global $database, $mainframe, $mosConfig_list_limit;
    $catid = $mainframe->getUserStateFromRequest("catidarc{$option}{$sectionid}", 'catid', 0);
    $limit = $mainframe->getUserStateFromRequest("viewlistlimit", 'limit', $mosConfig_list_limit);
    $limitstart = $mainframe->getUserStateFromRequest("viewarc{$option}{$sectionid}limitstart", 'limitstart', 0);
    $search = $mainframe->getUserStateFromRequest("searcharc{$option}{$sectionid}", 'search', '');
    $filter_sectionid = $mainframe->getUserStateFromRequest("filter_sectionid{$option}{$sectionid}", 'filter_sectionid', 0);
    $search = $database->getEscaped(trim(strtolower($search)));
    $redirect = $sectionid;
    if ($sectionid == 0) {
        $where = array("c.state = -1", "c.catid=cc.id", "cc.section=s.id", "s.scope='content'");
        $filter = "\n , #__sections AS s WHERE s.id = c.section";
        $all = 1;
    } else {
        $where = array("c.state = -1", "c.catid=cc.id", "cc.section=s.id", "s.scope='content'", "c.sectionid='{$sectionid}'");
        $filter = "\n WHERE section = '{$sectionid}'";
        $all = NULL;
    }
    // used by filter
    if ($filter_sectionid > 0) {
        $where[] = "c.sectionid = '{$filter_sectionid}'";
    }
    if ($catid > 0) {
        $where[] = "c.catid='{$catid}'";
    }
    if ($search) {
        $where[] = "LOWER(c.title) LIKE '%{$search}%'";
    }
    // get the total number of records
    $query = "SELECT count(*)" . "FROM #__content AS c, #__categories AS cc, #__sections AS s" . (count($where) ? "\n WHERE " . implode(' AND ', $where) : '');
    $database->setQuery($query);
    $total = $database->loadResult();
    require_once $GLOBALS['mosConfig_absolute_path'] . '/administrator/includes/pageNavigation.php';
    $pageNav = new mosPageNav($total, $limitstart, $limit);
    $query = "SELECT c.*, g.name AS groupname, cc.name" . "\n FROM #__content AS c, #__categories AS cc, #__sections AS s" . "\n LEFT JOIN #__groups AS g ON g.id = c.access" . (count($where) ? "\nWHERE " . implode(' AND ', $where) : '') . "\n ORDER BY c.catid, c.ordering" . "\n LIMIT {$pageNav->limitstart},{$pageNav->limit}";
    $database->setQuery($query);
    $rows = $database->loadObjectList();
    if ($database->getErrorNum()) {
        echo $database->stderr();
        return false;
    }
    // get list of categories for dropdown filter
    $query = "SELECT c.id AS value, c.title AS text" . "\n FROM #__categories AS c" . $filter . "\n ORDER BY c.ordering";
    $lists['catid'] = filterCategory($query, $catid);
    // get list of sections for dropdown filter
    $javascript = 'onchange="document.adminForm.submit();"';
    $lists['sectionid'] = mosAdminMenus::SelectSection('filter_sectionid', $filter_sectionid, $javascript);
    $section = new mosSection($database);
    $section->load($sectionid);
    HTML_content::showArchive($rows, $section, $lists, $search, $pageNav, $option, $all, $redirect);
}
コード例 #4
0
/**
* Shows a list of archived content items
* @param int The section id
*/
function viewArchive($sectionid, $option)
{
    global $database, $mainframe, $mosConfig_list_limit;
    $catid = intval($mainframe->getUserStateFromRequest("catidarc{$option}{$sectionid}", 'catid', 0));
    $limit = intval($mainframe->getUserStateFromRequest("viewlistlimit", 'limit', $mosConfig_list_limit));
    $limitstart = intval($mainframe->getUserStateFromRequest("viewarc{$option}{$sectionid}limitstart", 'limitstart', 0));
    $filter_authorid = intval($mainframe->getUserStateFromRequest("filter_authorid{$option}{$sectionid}", 'filter_authorid', 0));
    $filter_sectionid = intval($mainframe->getUserStateFromRequest("filter_sectionid{$option}{$sectionid}", 'filter_sectionid', 0));
    $search = $mainframe->getUserStateFromRequest("searcharc{$option}{$sectionid}", 'search', '');
    if (get_magic_quotes_gpc()) {
        $search = stripslashes($search);
    }
    $redirect = $sectionid;
    if ($sectionid == 0) {
        $where = array("c.state \t= -1", "c.catid\t= cc.id", "cc.section = s.id", "s.scope  \t= 'content'");
        $filter = "\n , #__sections AS s WHERE s.id = c.section";
        $all = 1;
    } else {
        $where = array("c.state \t= -1", "c.catid\t= cc.id", "cc.section\t= s.id", "s.scope\t= 'content'", "c.sectionid= " . (int) $sectionid);
        $filter = "\n WHERE section = '" . (int) $sectionid . "'";
        $all = NULL;
    }
    // used by filter
    if ($filter_sectionid > 0) {
        $where[] = "c.sectionid = " . (int) $filter_sectionid;
    }
    if ($filter_authorid > 0) {
        $where[] = "c.created_by = " . (int) $filter_authorid;
    }
    if ($catid > 0) {
        $where[] = "c.catid = " . (int) $catid;
    }
    if ($search) {
        $where[] = "LOWER( c.title ) LIKE '%" . $database->getEscaped(trim(strtolower($search))) . "%'";
    }
    // get the total number of records
    $query = "SELECT COUNT(*)" . "\n FROM #__content AS c" . "\n LEFT JOIN #__categories AS cc ON cc.id = c.catid" . "\n LEFT JOIN #__sections AS s ON s.id = c.sectionid" . (count($where) ? "\n WHERE " . implode(' AND ', $where) : '');
    $database->setQuery($query);
    $total = $database->loadResult();
    require_once $GLOBALS['mosConfig_absolute_path'] . '/administrator/includes/pageNavigation.php';
    $pageNav = new mosPageNav($total, $limitstart, $limit);
    $query = "SELECT c.*, g.name AS groupname, cc.name, v.name AS author" . "\n FROM #__content AS c" . "\n LEFT JOIN #__categories AS cc ON cc.id = c.catid" . "\n LEFT JOIN #__sections AS s ON s.id = c.sectionid" . "\n LEFT JOIN #__groups AS g ON g.id = c.access" . "\n LEFT JOIN #__users AS v ON v.id = c.created_by" . (count($where) ? "\n WHERE " . implode(' AND ', $where) : '') . "\n ORDER BY c.catid, c.ordering";
    $database->setQuery($query, $pageNav->limitstart, $pageNav->limit);
    $rows = $database->loadObjectList();
    if ($database->getErrorNum()) {
        echo $database->stderr();
        return;
    }
    // get list of categories for dropdown filter
    $query = "SELECT c.id AS value, c.title AS text" . "\n FROM #__categories AS c" . $filter . "\n ORDER BY c.ordering";
    $lists['catid'] = filterCategory($query, $catid);
    // get list of sections for dropdown filter
    $javascript = 'onchange="document.adminForm.submit();"';
    $lists['sectionid'] = mosAdminMenus::SelectSection('filter_sectionid', $filter_sectionid, $javascript);
    $section = new mosSection($database);
    $section->load((int) $sectionid);
    // get list of Authors for dropdown filter
    $query = "SELECT c.created_by, u.name" . "\n FROM #__content AS c" . "\n INNER JOIN #__sections AS s ON s.id = c.sectionid" . "\n LEFT JOIN #__users AS u ON u.id = c.created_by" . "\n WHERE c.state = -1" . "\n GROUP BY u.name" . "\n ORDER BY u.name";
    $authors[] = mosHTML::makeOption('0', _SEL_AUTHOR, 'created_by', 'name');
    $database->setQuery($query);
    $authors = array_merge($authors, $database->loadObjectList());
    $lists['authorid'] = mosHTML::selectList($authors, 'filter_authorid', 'class="inputbox" size="1" onchange="document.adminForm.submit( );"', 'created_by', 'name', $filter_authorid);
    HTML_content::showArchive($rows, $section, $lists, $search, $pageNav, $option, $all, $redirect);
}
コード例 #5
0
/**
* Compiles a list of frontpage items
*/
function viewFrontPage($option)
{
    global $database, $mainframe, $mosConfig_list_limit;
    $catid = intval($mainframe->getUserStateFromRequest("catid{$option}", 'catid', 0));
    $filter_authorid = intval($mainframe->getUserStateFromRequest("filter_authorid{$option}", 'filter_authorid', 0));
    $filter_sectionid = intval($mainframe->getUserStateFromRequest("filter_sectionid{$option}", 'filter_sectionid', 0));
    $limit = intval($mainframe->getUserStateFromRequest("viewlistlimit", 'limit', $mosConfig_list_limit));
    $limitstart = intval($mainframe->getUserStateFromRequest("view{$option}limitstart", 'limitstart', 0));
    $search = $mainframe->getUserStateFromRequest("search{$option}", 'search', '');
    if (get_magic_quotes_gpc()) {
        $search = stripslashes($search);
    }
    $where = array("c.state >= 0");
    // used by filter
    if ($filter_sectionid > 0) {
        $where[] = "c.sectionid = " . (int) $filter_sectionid;
    }
    if ($catid > 0) {
        $where[] = "c.catid = " . (int) $catid;
    }
    if ($filter_authorid > 0) {
        $where[] = "c.created_by = " . (int) $filter_authorid;
    }
    if ($search) {
        $where[] = "LOWER( c.title ) LIKE '%" . $database->getEscaped(trim(strtolower($search))) . "%'";
    }
    // get the total number of records
    $query = "SELECT count(*)" . "\n FROM #__content AS c" . "\n INNER JOIN #__categories AS cc ON cc.id = c.catid" . "\n INNER JOIN #__sections AS s ON s.id = cc.section AND s.scope='content'" . "\n INNER JOIN #__content_frontpage AS f ON f.content_id = c.id" . (count($where) ? "\n WHERE " . implode(' AND ', $where) : '');
    $database->setQuery($query);
    $total = $database->loadResult();
    require_once $GLOBALS['mosConfig_absolute_path'] . '/administrator/includes/pageNavigation.php';
    $pageNav = new mosPageNav($total, $limitstart, $limit);
    $query = "SELECT c.*, g.name AS groupname, cc.name, s.name AS sect_name, u.name AS editor, f.ordering AS fpordering, v.name AS author" . "\n FROM #__content AS c" . "\n INNER JOIN #__categories AS cc ON cc.id = c.catid" . "\n INNER JOIN #__sections AS s ON s.id = cc.section AND s.scope='content'" . "\n INNER JOIN #__content_frontpage AS f ON f.content_id = c.id" . "\n INNER JOIN #__groups AS g ON g.id = c.access" . "\n LEFT JOIN #__users AS u ON u.id = c.checked_out" . "\n LEFT JOIN #__users AS v ON v.id = c.created_by" . (count($where) ? "\nWHERE " . implode(' AND ', $where) : "") . "\n ORDER BY f.ordering";
    $database->setQuery($query, $pageNav->limitstart, $pageNav->limit);
    $rows = $database->loadObjectList();
    if ($database->getErrorNum()) {
        echo $database->stderr();
        return false;
    }
    // get list of categories for dropdown filter
    $query = "SELECT cc.id AS value, cc.title AS text, section" . "\n FROM #__categories AS cc" . "\n INNER JOIN #__sections AS s ON s.id = cc.section " . "\n ORDER BY s.ordering, cc.ordering";
    $categories[] = mosHTML::makeOption('0', _SEL_CATEGORY);
    $database->setQuery($query);
    $categories = array_merge($categories, $database->loadObjectList());
    $lists['catid'] = mosHTML::selectList($categories, 'catid', 'class="inputbox" size="1" onchange="document.adminForm.submit( );"', 'value', 'text', $catid);
    // get list of sections for dropdown filter
    $javascript = 'onchange="document.adminForm.submit();"';
    $lists['sectionid'] = mosAdminMenus::SelectSection('filter_sectionid', $filter_sectionid, $javascript);
    // get list of Authors for dropdown filter
    $query = "SELECT c.created_by, u.name" . "\n FROM #__content AS c" . "\n INNER JOIN #__sections AS s ON s.id = c.sectionid" . "\n LEFT JOIN #__users AS u ON u.id = c.created_by" . "\n WHERE c.state != -1" . "\n AND c.state != -2" . "\n GROUP BY u.name" . "\n ORDER BY u.name";
    $authors[] = mosHTML::makeOption('0', _SEL_AUTHOR, 'created_by', 'name');
    $database->setQuery($query);
    $authors = array_merge($authors, $database->loadObjectList());
    $lists['authorid'] = mosHTML::selectList($authors, 'filter_authorid', 'class="inputbox" size="1" onchange="document.adminForm.submit( );"', 'created_by', 'name', $filter_authorid);
    HTML_content::showList($rows, $search, $pageNav, $option, $lists);
}
コード例 #6
0
ファイル: categories.php プロジェクト: RangerWalt/ecci
function showCategories()
{
    global $database, $my, $option, $menutype, $mainframe, $mosConfig_list_limit;
    $section = "com_docman";
    $sectionid = $mainframe->getUserStateFromRequest("sectionid{$section}{$section}", 'sectionid', 0);
    $limit = $mainframe->getUserStateFromRequest("viewlistlimit", 'limit', $mosConfig_list_limit);
    $limitstart = $mainframe->getUserStateFromRequest("view{$section}limitstart", 'limitstart', 0);
    $levellimit = $mainframe->getUserStateFromRequest("view{$option}limit{$menutype}", 'levellimit', 10);
    $query = "SELECT  c.*, c.checked_out as checked_out_contact_category, c.parent_id as parent, g.name AS groupname, u.name AS editor" . "\n FROM #__categories AS c" . "\n LEFT JOIN #__users AS u ON u.id = c.checked_out" . "\n LEFT JOIN #__groups AS g ON g.id = c.access" . "\n WHERE c.section='{$section}'" . "\n AND c.published != -2" . "\n ORDER BY parent_id,ordering";
    $database->setQuery($query);
    $rows = $database->loadObjectList();
    if ($database->getErrorNum()) {
        echo $database->stderr();
        return false;
    }
    // establish the hierarchy of the categories
    $children = array();
    // first pass - collect children
    foreach ($rows as $v) {
        $pt = $v->parent;
        $list = @$children[$pt] ? $children[$pt] : array();
        array_push($list, $v);
        $children[$pt] = $list;
    }
    // second pass - get an indent list of the items
    $list = DOCMAN_Utils::mosTreeRecurse(0, '', array(), $children, max(0, $levellimit - 1));
    $list = is_array($list) ? $list : array();
    $total = count($list);
    require_once $GLOBALS['mosConfig_absolute_path'] . '/administrator/includes/pageNavigation.php';
    $pageNav = new mosPageNav($total, $limitstart, $limit);
    $levellist = mosHTML::integerSelectList(1, 20, 1, 'levellimit', 'size="1" onchange="document.adminForm.submit();"', $levellimit);
    // slice out elements based on limits
    $list = array_slice($list, $pageNav->limitstart, $pageNav->limit);
    $count = count($list);
    // number of Active Items
    for ($i = 0; $i < $count; $i++) {
        $query = "SELECT COUNT( d.id )" . "\n FROM #__docman AS d" . "\n WHERE d.catid = " . $list[$i]->id;
        // . "\n AND d.state <> '-2'";
        $database->setQuery($query);
        $active = $database->loadResult();
        $list[$i]->documents = $active;
    }
    // get list of sections for dropdown filter
    $javascript = 'onchange="document.adminForm.submit();"';
    $lists['sectionid'] = mosAdminMenus::SelectSection('sectionid', $sectionid, $javascript);
    HTML_DMCategories::show($list, $my->id, $pageNav, $lists, 'other');
}
コード例 #7
0
/**
* Compiles a list of categories for a section
* @param string The name of the category section
*/
function showCategories($section, $option)
{
    global $database, $mainframe, $mosConfig_list_limit, $mosConfig_absolute_path, $mosConfig_dbprefix;
    $sectionid = intval($mainframe->getUserStateFromRequest("sectionid{$option}{$section}", 'sectionid', 0));
    $limit = intval($mainframe->getUserStateFromRequest("viewlistlimit", 'limit', $mosConfig_list_limit));
    $limitstart = intval($mainframe->getUserStateFromRequest("view{$section}limitstart", 'limitstart', 0));
    $section_name = '';
    $content_add = '';
    $content_join = '';
    $order = "\n ORDER BY c.ordering, c.name";
    if (intval($section) > 0) {
        $table = 'content';
        $query = "SELECT name" . "\n FROM #__sections" . "\n WHERE id = " . (int) $section;
        $database->setQuery($query);
        $section_name = $database->loadResult();
        $section_name = 'Conteúdo: ' . $section_name;
        $where = "\n WHERE c.section = " . $database->Quote($section);
        $type = 'content';
    } else {
        if (strpos($section, 'com_') === 0) {
            $table = substr($section, 4);
            $query = "SELECT name" . "\n FROM #__components" . "\n WHERE link = 'option=" . $database->getEscaped($section) . "'";
            $database->setQuery($query);
            $section_name = $database->loadResult();
            $where = "\n WHERE c.section = " . $database->Quote($section);
            $type = 'other';
            // special handling for contact component
            if ($section == 'com_contact_details') {
                $section_name = 'Contato';
            }
            $section_name = 'Component: ' . $section_name;
        } else {
            $table = $section;
            $where = "\n WHERE c.section = " . $database->Quote($section);
            $type = 'other';
        }
    }
    // get the total number of records
    $query = "SELECT COUNT(*)" . "\n FROM #__categories" . "\n WHERE section = " . $database->Quote($section);
    $database->setQuery($query);
    $total = $database->loadResult();
    // allows for viweing of all content categories
    if ($section == 'content') {
        $table = 'content';
        $content_add = "\n , z.title AS section_name";
        $content_join = "\n LEFT JOIN #__sections AS z ON z.id = c.section";
        //$where = "\n WHERE s1.catid = c.id";
        $where = "\n WHERE c.section NOT LIKE '%com_%'";
        $order = "\n ORDER BY c.section, c.ordering, c.name";
        $section_name = 'Todo o Conteúdo';
        // get the total number of records
        $query = "SELECT COUNT(*)" . "\n FROM #__categories" . "\n INNER JOIN #__sections AS s ON s.id = section";
        if ($sectionid > 0) {
            $query .= "\n WHERE section = " . $database->Quote($sectionid);
        }
        $database->setQuery($query);
        $total = $database->loadResult();
        $type = 'content';
    }
    // used by filter
    if ($sectionid > 0) {
        $filter = "\n AND c.section = " . $database->Quote($sectionid);
    } else {
        $filter = '';
    }
    require_once $mosConfig_absolute_path . '/administrator/includes/pageNavigation.php';
    $pageNav = new mosPageNav($total, $limitstart, $limit);
    $tablesAllowed = $database->getTableList();
    if (!in_array($mosConfig_dbprefix . $table, $tablesAllowed)) {
        $table = 'content';
    }
    $query = "SELECT  c.*, c.checked_out as checked_out_contact_category, g.name AS groupname, u.name AS editor," . "COUNT( DISTINCT s2.checked_out ) AS checked_out" . $content_add . "\n FROM #__categories AS c" . "\n LEFT JOIN #__users AS u ON u.id = c.checked_out" . "\n LEFT JOIN #__groups AS g ON g.id = c.access" . "\n LEFT JOIN `#__{$table}` AS s2 ON s2.catid = c.id AND s2.checked_out > 0" . $content_join . $where . $filter . "\n AND c.published != -2" . "\n GROUP BY c.id" . $order;
    $database->setQuery($query, $pageNav->limitstart, $pageNav->limit);
    $rows = $database->loadObjectList();
    if ($database->getErrorNum()) {
        echo $database->stderr();
        return;
    }
    $count = count($rows);
    // number of Active Items
    for ($i = 0; $i < $count; $i++) {
        $query = "SELECT COUNT( a.id )" . "\n FROM #__content AS a" . "\n WHERE a.catid = " . (int) $rows[$i]->id . "\n AND a.state != -2";
        $database->setQuery($query);
        $active = $database->loadResult();
        $rows[$i]->active = $active;
    }
    // number of Trashed Items
    for ($i = 0; $i < $count; $i++) {
        $query = "SELECT COUNT( a.id )" . "\n FROM #__content AS a" . "\n WHERE a.catid = " . (int) $rows[$i]->id . "\n AND a.state = -2";
        $database->setQuery($query);
        $trash = $database->loadResult();
        $rows[$i]->trash = $trash;
    }
    // get list of sections for dropdown filter
    $javascript = 'onchange="document.adminForm.submit();"';
    $lists['sectionid'] = mosAdminMenus::SelectSection('sectionid', $sectionid, $javascript);
    categories_html::show($rows, $section, $section_name, $pageNav, $lists, $type);
}