Beispiel #1
0
function showGroups($option)
{
    $database = JFactory::getDBO();
    $search = trim(strtolower(JRequest::getString('search', '', 'post')));
    $limit = intval(JRequest::getInt('limit', 10, 'post'));
    $limitstart = intval(JRequest::getInt('limitstart', 0, 'post'));
    $where = array();
    if ($search) {
        $where[] = "LOWER(groups_name) LIKE '%{$search}%'";
    }
    // get the total number of records
    $database->setQuery("SELECT count(*) FROM #__docman_groups" . (count($where) ? "\nWHERE " . implode(' AND ', $where) : ""));
    $total = $database->loadResult();
    echo $database->getErrorMsg();
    if ($limit > $total) {
        $limitstart = 0;
    }
    $pageNav = new DOCMAN_Pagination($total, $limitstart, $limit);
    $query = "SELECT *" . "\n FROM #__docman_groups" . (count($where) ? "\n WHERE " . implode(' AND ', $where) : "") . "\n ORDER BY groups_name";
    $database->setQuery($query, $pageNav->limitstart, $pageNav->limit);
    $rows = $database->loadObjectList();
    if ($database->getErrorNum()) {
        echo $database->stderr();
        return false;
    }
    HTML_DMGroups::showGroups($option, $rows, $search, $pageNav);
}
Beispiel #2
0
function showGroups($option)
{
    global $database;
    $search = trim(strtolower(mosGetParam($_POST, 'search', '')));
    $limit = intval(mosGetParam($_POST, 'limit', 10));
    $limitstart = intval(mosGetParam($_POST, 'limitstart', 0));
    $where = array();
    if ($search) {
        $where[] = "LOWER(groups_name) LIKE '%{$search}%'";
    }
    // get the total number of records
    $database->setQuery("SELECT count(*) FROM #__docman_groups" . (count($where) ? "\nWHERE " . implode(' AND ', $where) : ""));
    $total = $database->loadResult();
    echo $database->getErrorMsg();
    if ($limit > $total) {
        $limitstart = 0;
    }
    $query = "SELECT *" . "\n FROM #__docman_groups" . (count($where) ? "\n WHERE " . implode(' AND ', $where) : "") . "\n ORDER BY groups_name";
    $database->setQuery($query, $limitstart, $limit);
    $rows = $database->loadObjectList();
    if ($database->getErrorNum()) {
        echo $database->stderr();
        return false;
    }
    require_once $GLOBALS['mosConfig_absolute_path'] . '/administrator/includes/pageNavigation.php';
    $pageNav = new mosPageNav($total, $limitstart, $limit);
    HTML_DMGroups::showGroups($option, $rows, $search, $pageNav);
}