当前位置: 首页>>代码示例>>PHP>>正文


PHP RMPageNav::start方法代码示例

本文整理汇总了PHP中RMPageNav::start方法的典型用法代码示例。如果您正苦于以下问题:PHP RMPageNav::start方法的具体用法?PHP RMPageNav::start怎么用?PHP RMPageNav::start使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在RMPageNav的用法示例。


在下文中一共展示了RMPageNav::start方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: show_groups_list

/**
 * Shows existing groups
 */
function show_groups_list()
{
    global $xoopsDB;
    define('RMCSUBLOCATION', 'allgroups');
    list($total) = $xoopsDB->fetchRow($xoopsDB->query("SELECT COUNT(*) FROM " . $xoopsDB->prefix("groups_users_link")));
    $navigation = new RMPageNav($total, 20, RMHttpRequest::get('page', 'integer', 1));
    $navigation->target_url(RMCURL . '/users.php?action=groups&page={PAGE_NUM}');
    $sql = "SELECT g.*, (SELECT COUNT(*) FROM " . $xoopsDB->prefix("groups_users_link") . "\n            WHERE groupid = g.groupid) as total_users FROM " . $xoopsDB->prefix("groups") . " as g ORDER BY g.name\n            LIMIT " . $navigation->start() . ", 20";
    $result = $xoopsDB->query($sql);
    $groups = array();
    while ($row = $xoopsDB->fetchArray($result)) {
        $groups[] = (object) $row;
    }
    $bc = RMBreadCrumb::get();
    $bc->add_crumb(__('Users Management', 'rmcommon'), RMCURL . '/users.php');
    $bc->add_crumb(__('Groups', 'rmcommon'));
    RMTemplate::get()->assign('xoops_pagetitle', __('Groups Management', 'rmcommon'));
    RMFunctions::get()->create_toolbar();
    RMTemplate::get()->add_script('cu-groups.js', 'rmcommon', array('footer' => 1));
    include RMCPATH . '/js/cu-js-language.php';
    RMTemplate::get()->header();
    include RMTemplate::get()->get_template('rmc-groups.php', 'module', 'rmcommon');
    RMTemplate::get()->footer();
}
开发者ID:txmodxoops,项目名称:rmcommon,代码行数:27,代码来源:groups.php

示例2: dt_show_items

/**
* @desc Muestra todos lo elementos registrados
**/
function dt_show_items()
{
    define('RMCSUBLOCATION', 'downitems');
    global $xoopsModule, $xoopsSecurity;
    $search = rmc_server_var($_REQUEST, 'search', '');
    $sort = rmc_server_var($_REQUEST, 'sort', 'id_soft');
    $mode = rmc_server_var($_REQUEST, 'mode', 1);
    $sort = $sort == '' ? 'id_soft' : $sort;
    $catid = rmc_server_var($_REQUEST, 'cat', 0);
    $type = rmc_server_var($_REQUEST, 'type', '');
    //Barra de Navegación
    $db = XoopsDatabaseFactory::getDatabaseConnection();
    $sql = "SELECT COUNT(*) FROM " . ($type == 'edit' ? $db->prefix('dtrans_software_edited') : $db->prefix('dtrans_software'));
    $sql .= $catid ? " WHERE id_cat='{$catid}'" : '';
    $sql .= $type == 'wait' ? $catid ? " AND approved=0" : " WHERE approved=0" : "";
    $sql1 = '';
    if ($search) {
        $words = explode(" ", $search);
        foreach ($words as $k) {
            //Verificamos si la palabra proporcionada es mayor a 2 caracteres
            if (strlen($k) <= 2) {
                continue;
            }
            $sql1 .= ($sql1 == '' ? $catid || $type == 'wait' ? " AND " : " WHERE " : " OR ") . " (name LIKE '%{$k}%' OR uname LIKE '%{$k}%') ";
        }
    }
    $sql2 = " ORDER BY {$sort} " . ($mode ? "DESC" : "ASC");
    list($num) = $db->fetchRow($db->queryF($sql . $sql1 . $sql2));
    $page = rmc_server_var($_REQUEST, 'page', 1);
    $limit = 15;
    $nav = new RMPageNav($num, $limit, $page);
    $nav->target_url("items.php?search={$search}&amp;sort={$sort}&amp;mode={$mode}&amp;cat={$catid}&amp;type={$type}&page={PAGE_NUM}");
    $navpage = $nav->render(false, true);
    $start = $nav->start();
    //Fin de barra de navegación
    $catego = new DTCategory($catid);
    $sql = "SELECT * FROM " . ($type == 'edit' ? $db->prefix('dtrans_software_edited') : $db->prefix('dtrans_software'));
    $sql .= $catid ? " WHERE id_cat={$catid}" : '';
    $sql .= $type == 'wait' ? $catid ? " AND approved=0" : " WHERE approved=0" : "";
    $sql2 .= " LIMIT {$start},{$limit}";
    $result = $db->queryF($sql . $sql1 . $sql2);
    $items = array();
    $timeFormat = new RMTimeFormatter(0, '%m%-%d%-%Y%');
    while ($rows = $db->fetchArray($result)) {
        if ($type == 'edit') {
            $sw = new DTSoftwareEdited();
        } else {
            $sw = new DTSoftware();
        }
        $sw->assignVars($rows);
        $img = new RMImage($sw->getVar('image'));
        $user = new XoopsUser($sw->getVar('uid'));
        $items[] = array('id' => $type == 'edit' ? $sw->software() : $sw->id(), 'name' => $sw->getVar('name'), 'screens' => $sw->getVar('screens'), 'image' => $img->get_smallest(), 'secure' => $sw->getVar('secure'), 'approved' => $sw->getVar('approved'), 'uname' => $user->getVar('uname'), 'created' => $timeFormat->format($sw->getVar('created')), 'modified' => $timeFormat->format($sw->getVar('modified')), 'link' => $sw->permalink(), 'featured' => $sw->getVar('featured'), 'daily' => $sw->getVar('daily'), 'password' => $sw->getVar('password') != '', 'deletion' => $sw->getVar('delete'));
    }
    //Lista de categorías
    $categories = array();
    DTFunctions::getCategos($categos, 0, 0, array(), true);
    foreach ($categos as $k) {
        $cat = $k['object'];
        $categories[] = array('id' => $cat->id(), 'name' => str_repeat('--', $k['jumps']) . ' ' . $cat->name());
    }
    switch ($type) {
        case 'wait':
            $loc = __('Pending Downloads', 'dtransport');
            break;
        case 'edit':
            $loc = __('Edited Downloads', 'dtransport');
            break;
        default:
            $loc = __('Downloads Management', 'dtransport');
            break;
    }
    DTFunctions::toolbar();
    $tpl = RMTemplate::get();
    $tpl->add_style('admin.css', 'dtransport');
    $tpl->add_local_script('admin.js', 'dtransport');
    $tpl->add_local_script('items.js', 'dtransport');
    $tpl->add_local_script('jquery.checkboxes.js', 'rmcommon', 'include');
    include DT_PATH . '/include/js_strings.php';
    xoops_cp_location("<a href='./'>" . $xoopsModule->name() . "</a> &raquo; " . $loc);
    xoops_cp_header();
    include RMTemplate::get()->get_template('admin/dtrans_items.php', 'module', 'dtransport');
    xoops_cp_footer();
}
开发者ID:laiello,项目名称:bitcero-modules,代码行数:87,代码来源:items.php


注:本文中的RMPageNav::start方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。