本文整理汇总了PHP中RMPageNav::render方法的典型用法代码示例。如果您正苦于以下问题:PHP RMPageNav::render方法的具体用法?PHP RMPageNav::render怎么用?PHP RMPageNav::render使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类RMPageNav
的用法示例。
在下文中一共展示了RMPageNav::render方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: explode
// Check if there are posts for this date
if ($num <= 0) {
redirect_header(MWFunctions::get_url(), 1, __("There are not posts published on this date", 'mywords'));
die;
}
$page = rmc_server_var($_GET, 'page', 0);
if ($page <= 0) {
$path = explode("/", $request);
$srh = array_search('page', $path);
if (isset($path[$srh]) && $path[$srh] == 'page') {
if (!isset($path[$srh])) {
$page = 0;
} else {
$page = $path[$srh + 1];
}
}
}
$limit = $xoopsModuleConfig['posts_limit'];
$tpages = ceil($num / $limit);
$page = $page > $tpages ? $tpages : $page;
$p = $page > 0 ? $page - 1 : $page;
$start = $num <= 0 ? 0 : $p * $limit;
$nav = new RMPageNav($num, $limit, $page, 5);
$date_prefix = date("d/m/Y", $time);
$nav->target_url(MW_URL . ($mc['permalinks'] > 1 ? $date_prefix . '/page/{PAGE_NUM}/' : '?date=' . $date_prefix . '&page={PAGE_NUM}'));
$xoopsTpl->assign('pagenav', $nav->render(false));
$sql = "SELECT * FROM " . $db->prefix("mw_posts") . " WHERE pubdate BETWEEN {$time} and {$time2} AND ((visibility='public' OR visibility='password') OR (visibility='private' AND author=" . ($xoopsUser ? $xoopsUser->uid() : -1) . ")) ORDER BY pubdate DESC LIMIT {$start},{$limit}";
$result = $db->query($sql);
include 'post_data.php';
$xoopsTpl->assign('xoops_pagetitle', sprintf(__('Posts published on %s', 'mywords'), formatTimestamp($time, 's')));
include 'footer.php';
示例2: DTLicense
$lic = new DTLicense($lic);
// Descargas en esta etiqueta
$sql = "SELECT COUNT(*) FROM " . $db->prefix('dtrans_licsoft') . " AS a INNER JOIN " . $db->prefix('dtrans_software') . " b ON (a.id_lic=" . $lic->id() . " AND a.id_soft=b.id_soft) WHERE b.approved='1' ANd b.delete=0";
list($num) = $db->fetchRow($db->query($sql));
$limit = $mc['xpage'];
$limit = $limit <= 0 ? 10 : $limit;
$tpages = ceil($num / $limit);
if ($tpages < $page && $tpages > 0) {
header('location: ' . DT_URL . ($mc['permalinks'] ? '/license/' . $lic->nameId() : '/?p=license&lic=' . $lic->id()));
die;
}
$p = $page > 0 ? $page - 1 : $page;
$start = $num <= 0 ? 0 : $p * $limit;
$nav = new RMPageNav($num, $limit, $page);
$nav->target_url(DT_URL . ($mc['permalinks'] ? '/license/' . $lic->nameId() . '/page/{PAGE_NUM}/' : '/?p=license&lic=' . $lic->id() . '&page={PAGE_NUM}'));
$xoopsTpl->assign('pagenav', $nav->render(true));
// Seleccionamos los registros
$sql = str_replace('COUNT(*)', 'b.*', $sql);
$sql .= " ORDER BY created DESC";
$sql .= " LIMIT {$start}, {$limit}";
$result = $db->query($sql);
while ($row = $db->fetchArray($result)) {
$item = new DTSoftware();
$item->assignVars($row);
$xoopsTpl->append('download_items', $dtfunc->createItemData($item));
}
// Datos de la etiqueta
$xoopsTpl->assign('license', array('id' => $lic->id(), 'name' => $lic->name(), 'link' => $lic->permalink()));
$tpl->add_xoops_style('main.css', 'dtransport');
$dtfunc->makeHeader();
$xoopsTpl->assign('xoops_pagetitle', sprintf(__('Downloads licensed as %s', 'dtransport'), $lic->name()));
示例3: showSetContent
//.........这里部分代码省略.........
* @desc Formato para el manejo de las imágenes
*/
if ($mc['set_format_mode']) {
$format = $mc['set_format_values'];
$crop = $format[0];
// 0 = Redimensionar, 1 = Cortar
$width = $format[1];
$height = $format[2];
$limit = $format[3];
$cols = $format[4];
@($showdesc = $format[5]);
// Imágenes Grandes
$format = $mc['setbig_format_values'];
$bcrop = $format[0];
$bwidth = $format[1];
$bheight = $format[2];
$blimit = $format[3];
$bcols = $format[4];
@($bshowdesc = $format[5]);
// Medidas
$tpl->assign('big_width', $bwidth + 15);
} else {
$limit = $mc['limit_pics'];
$cols = $mc['cols_pics'];
$showdesc = 0;
}
list($num) = $db->fetchRow($db->query($sql));
if ($page > 0) {
$page -= 1;
}
$start = $page * $limit;
$tpages = (int) ($num / $limit);
if ($num % $limit > 0) {
$tpages++;
}
$pactual = $page + 1;
if ($pactual > $tpages) {
$pactual = $tpages;
$start = ($tpages - 1) * $limit;
}
$urlnav = '';
if ($tpages > 1) {
$urlnav .= $mc['urlmode'] ? 'usr/' . $user->uname() . '/set/' . $set->id() : '?usr=' . $user->uname() . '&set=' . $set->id();
$nav = new RMPageNav($num, $limit, $pactual, 5);
$nav->target_url(GSFunctions::get_url() . $urlnav . ($mc['urlmode'] ? '/pag/{PAGE_NUM}/' : '&pag={PAGE_NUM}'));
$tpl->assign('upNavPage', $nav->render(false));
}
$showmax = $start + $limit;
$showmax = $showmax > $num ? $num : $showmax;
$tpl->assign('lang_showing', sprintf(__('Showing pictures %u to %u out of %u.', 'galleries'), $start + 1, $showmax, $num));
$tpl->assign('limit', $limit);
$tpl->assign('pag', $pactual);
//Fin de barra de navegación
$sql = str_replace("COUNT(*)", '*', $sql);
$sql .= " ORDER BY a.id_image ASC, a.modified DESC LIMIT {$start}, {$limit}";
$result = $db->query($sql);
while ($row = $db->fetchArray($result)) {
$img = new GSImage();
$img->assignVars($row);
$imglink = $user->userURL() . ($mc['urlmode'] ? 'img/' . $img->id() . '/set/' . $set->id() . '/' : '&img=' . $img->id() . '&set=' . $set->id());
$imgfile = $user->filesURL() . '/' . ($mc['set_format_mode'] ? 'formats/set_' : 'ths/') . $img->image();
// Conversion de los formatos
if (!$img->setFormat() && $mc['set_format_mode']) {
GSFunctions::resizeImage($crop, $user->filesPath() . '/' . $img->image(), $user->filesPath() . '/formats/set_' . $img->image(), $width, $height);
$img->setSetFormat(1, 1);
}
$tpl->append('images', array('id' => $img->id(), 'title' => $img->title(), 'thumbnail' => $imgfile, 'link' => $imglink, 'bigimage' => $user->filesURL() . '/' . $img->image()));
}
// Imagen grande del album
$sql = "SELECT * FROM {$tbl1} a, {$tbl2} b WHERE b.id_set='" . $set->id() . "' AND a.id_image=b.id_image {$public} AND owner='" . $user->uid() . "' \n\t\t\tORDER BY a.id_image DESC LIMIT 0,{$blimit}";
$result = $db->query($sql);
$bi = 0;
$tf = new RMTimeFormatter(0, __('%m%/%d%/%Y% %h%:%i%', 'galleries'));
// cremos la imagen grande para los albumes
while ($row = $db->fetchArray($result)) {
$img = new GSImage();
$img->assignVars($row);
if ($mc['set_format_mode'] && !$img->bigSetFormat()) {
GSFunctions::resizeImage($bcrop, $user->filesPath() . '/' . $img->image(), $user->filesPath() . '/formats/bigset_' . $img->image(), $bwidth, $bheight);
$img->setBigSetFormat(1, 1);
}
if ($mc['set_format_mode']) {
list($ancho, $altura, $tipo, $atr) = getimagesize($user->filesPath() . '/formats/bigset_' . $img->image());
$tpl->assign('big_width', $ancho);
}
$imglink = $user->userURL() . 'img/' . $img->id() . '/set/' . $set->id() . '/';
// ASignamos las imagenes grandes para los albumes
$imgfile = $user->filesURL() . '/' . ($mc['set_format_mode'] ? 'formats/bigset_' : 'ths/') . $img->image();
if ($bi == 0) {
$tpl->assign('lang_updated', sprintf(__('Updated on %s', 'galleries'), $tf->format($img->created())));
}
$tpl->append('bigs', array('id' => $img->id(), 'title' => $img->title(), 'image' => $imgfile, 'link' => $imglink));
}
RMFunctions::get_comments('galleries', 'set=' . $set->id());
// Comments form
RMFunctions::comments_form('galleries', 'set=' . $set->id(), 'module', GS_PATH . '/class/galleriescontroller.php');
// Datos para el formato
$tpl->assign('max_cols', $cols);
include 'footer.php';
}
示例4: isset
$page = isset($page) ? $page : 0;
if ($page > 0) {
$page -= 1;
}
$start = $page * $limit;
$tpages = ceil($num / $limit);
$pactual = $page + 1;
if ($pactual > $tpages) {
$rest = $pactual - $tpages;
$pactual = $pactual - $rest + 1;
$start = ($pactual - 1) * $limit;
}
if ($tpages > 1) {
$nav = new RMPageNav($num, $limit, $pactual);
$nav->target_url('topic.php?id=' . $topic->id() . '&pag={PAGE_NUM}');
$tpl->assign('postsNavPage', $nav->render(false));
}
$groups = $xoopsUser ? $xoopsUser->getGroups() : XOOPS_GROUP_ANONYMOUS;
// Permisos
$edit = $forum->isAllowed($groups, 'edit');
$delete = $forum->isAllowed($groups, 'delete');
$report = $forum->isAllowed($groups, 'reply');
$moderator = $xoopsUser ? $forum->isModerator($xoopsUser->uid()) : false;
$admin = $xoopsUser ? $xoopsUser->isAdmin() : false;
$tbl1 = $db->prefix("mod_bxpress_posts");
$tbl2 = $db->prefix("mod_bxpress_posts_text");
$tbl3 = $db->prefix("mod_bxpress_likes");
$sql = "SELECT\n posts.*,\n texts.*,\n (SELECT COUNT(*) FROM {$tbl1} WHERE parent=posts.id_post) as replies,\n GROUP_CONCAT(tlikes.uid ORDER BY " . ($xoopsUser ? "tlikes.uid=" . $xoopsUser->uid() . ' DESC' : 'tlikes.uid') . ") as liked\n FROM\n {$tbl1} posts\n LEFT JOIN {$tbl3} tlikes ON tlikes.post=posts.id_post\n INNER JOIN {$tbl2} texts ON texts.post_id=posts.id_post\n WHERE\n posts.id_topic='" . $topic->id() . "'\n AND\n texts.post_id=posts.id_post\n GROUP BY\n posts.id_post\n ORDER BY\n posts.post_time ASC,\n posts.parent ASC\n LIMIT\n {$start},{$limit}";
$result = $db->query($sql);
$users = array();
$posts_ids = array();
示例5: unset
$edit = '<a href="' . XOOPS_URL . '/modules/mywords/admin/posts.php?op=edit&id=' . $post->id() . '">' . __('Edit Post', 'mywords') . '</a>';
$xoopsTpl->assign('edit_link', $edit);
unset($edit);
}
$xoopsTpl->assign('lang_reads', sprintf(__('%u views', 'mywords'), $post->getVar('reads')));
// Tags
$tags = $post->tags(true);
$tags_list = '';
foreach ($tags as $i => $tag) {
$tags_list .= ($tags_list == '' ? '' : ', ') . '<a href="' . $tag->permalink() . '">' . $tag->getVar('tag') . '</a>';
}
// Post pages
$total_pages = $post->total_pages();
$nav = new RMPageNav($total_pages, 1, $page, 5);
$nav->target_url($post->permalink() . ($mc['permalinks'] > 1 ? 'page/{PAGE_NUM}/' : '&page={PAGE_NUM}'));
$xoopsTpl->assign('post_navbar', $nav->render(true));
// Post data
$post_arr = array('id' => $post->id(), 'title' => $post->getVar('title'), 'published' => sprintf(__('%s by %s', 'mywords'), MWFunctions::format_time($post->getVar('pubdate')), date('H:i', $post->getVar('pubdate')), '<a href="' . $editor->permalink() . '">' . (isset($editor) ? $editor->getVar('name') : __('Anonymous', 'mywords')) . "</a>"), 'text' => $post->content(false, $page), 'cats' => $post->get_categories_names(), 'tags' => $tags_list, 'trackback' => $post->getVar('pingstatus') ? MWFunctions::get_url(true) . $post->id() : '', 'meta' => $post->get_meta('', false), 'time' => $post->getVar('pubdate'), 'image' => $post->getImage($xoopsModuleConfig['post_imgs_size']), 'author' => $editor->getVar('name'), 'alink' => $editor->permalink());
// Plugins?
$post_arr = RMEvents::get()->run_event('mywords.view.post', $post_arr, $post);
$xoopsTpl->assign('post', $post_arr);
// Social sites
if ($xoopsModuleConfig['showbookmarks']) {
foreach ($socials as $site) {
$xoopsTpl->append('socials', array('title' => $site->getVar('title'), 'icon' => $site->getVar('icon'), 'url' => $site->link($post->getVar('title'), $post->permalink(), TextCleaner::truncate($post->content(true), 60)), 'alt' => $site->getVar('alt')));
}
}
unset($tags_list);
// Comments
// When use the common utilities comments system you can choose between
// use of Common Utilities templates or use your own templates
示例6: showBookMarks
/**
* @desc Visualiza todas la imágenes de favoritos
**/
function showBookMarks()
{
global $xoopsOption, $tpl, $db, $xoopsUser, $xoopsModuleConfig, $pag, $xoopsConfig;
$xoopsOption['template_main'] = 'gs_panel_bookmarks.html';
include 'header.php';
$mc =& $xoopsModuleConfig;
GSFunctions::makeHeader();
//Barra de Navegación
$sql = "SELECT COUNT(*) FROM " . $db->prefix('gs_favourites') . " a INNER JOIN " . $db->prefix('gs_images') . " b ON (";
$sql .= " a.id_image=b.id_image AND a.uid='" . $xoopsUser->uid() . "')";
$page = isset($pag) ? $pag : '';
$limit = 10;
list($num) = $db->fetchRow($db->query($sql));
if ($page > 0) {
$page -= 1;
}
$start = $page * $limit;
$tpages = (int) ($num / $limit);
if ($num % $limit > 0) {
$tpages++;
}
$pactual = $page + 1;
if ($pactual > $tpages) {
$rest = $pactual - $tpages;
$pactual = $pactual - $rest + 1;
$start = ($pactual - 1) * $limit;
}
if ($tpages > 1) {
if ($mc['urlmode']) {
$urlnav = 'cpanel/bookmarks/';
} else {
$urlnav = '?cpanel=bookmarks';
}
$nav = new RMPageNav($num, $limit, $pactual, 5);
$nav->target_url(GSFunctions::get_url() . $urlnav . ($mc['urlmode'] ? 'pag/{PAGE_NUM}/' : '&pag={PAGE_NUM}'));
$tpl->assign('bookmarksNavPage', $nav->render(false));
}
$showmax = $start + $limit;
$showmax = $showmax > $num ? $num : $showmax;
if ($num > 0) {
$tpl->assign('lang_showing', sprintf(__('Showing pictures %u to %u from %u'), $start + 1, $showmax, $num));
}
$tpl->assign('limit', $limit);
$tpl->assign('pag', $pactual);
//Fin de barra de navegación
$sql = "SELECT * FROM " . $db->prefix('gs_favourites') . " a INNER JOIN " . $db->prefix('gs_images') . " b ON (";
$sql .= " a.id_image=b.id_image AND a.uid='" . $xoopsUser->uid() . "')";
$sql .= " LIMIT {$start},{$limit}";
$result = $db->query($sql);
$users = array();
while ($rows = $db->fetchArray($result)) {
$img = new GSImage();
$img->assignVars($rows);
if (!isset($users[$img->owner()])) {
$users[$img->owner()] = new GSUser($img->owner(), 1);
}
$urlimg = $users[$img->owner()]->filesURL() . '/ths/' . $img->image();
$link = $users[$img->owner()]->userURL() . 'img/' . $img->id() . '/';
$tpl->append('images', array('id' => $img->id(), 'title' => $img->title(false), 'desc' => $img->desc(), 'public' => $img->isPublic(), 'image' => $urlimg, 'created' => formatTimeStamp($img->created(), 's'), 'owner' => $img->owner(), 'uname' => $users[$img->owner()]->uname(), 'link' => $link));
}
$tpl->assign('lang_exist', __('Existing Bookmarks', 'galleries'));
$tpl->assign('lang_id', __('ID', 'galleries'));
$tpl->assign('lang_title', __('Title', 'galleries'));
$tpl->assign('lang_date', __('Created', 'galleries'));
$tpl->assign('lang_owner', __('by user', 'galleries'));
$tpl->assign('lang_image', __('Picture', 'galleries'));
$tpl->assign('lang_public', __('Public', 'galleries'));
$tpl->assign('lang_options', __('Options', 'galleries'));
$tpl->assign('lang_edit', __('Edit', 'galleries'));
$tpl->assign('lang_del', __('Delete', 'galleries'));
$tpl->assign('lang_confirm', __('Do you really wish to deleted selected favorite?', 'galleries'));
$tpl->assign('lang_confirms', __('Do you really wish to deleted selected favorites?', 'galleries'));
$tpl->assign('delete_link', GSFunctions::get_url() . $xoopsModuleConfig['urlmode'] ? 'cp/delbookmarks/' : '?cp=delbookmarks');
RMTemplate::get()->add_style('panel.css', 'galleries');
createLinks();
include 'footer.php';
}
示例7: COUNT
* Paginamos los resultados
*/
$limit = $mc['posts_limit'];
$table_tags = $db->prefix("mw_tagspost");
$table_posts = $db->prefix("mw_posts");
$sql = "SELECT COUNT(*) FROM {$table_posts} as a, {$table_tags} as b WHERE b.tag='" . $tag->id() . "' AND \n a.id_post=b.post AND status='publish' AND \n\t\t((visibility='public' OR visibility='password') OR (visibility='private' AND\n\t\tauthor=" . ($xoopsUser ? $xoopsUser->uid() : -1) . "))";
list($num) = $db->fetchRow($db->query($sql));
if ($page > 0) {
$page -= 1;
}
$start = $page * $mc['posts_limit'];
$tpages = (int) ($num / $mc['posts_limit']);
if ($num % $mc['posts_limit'] > 0) {
$tpages++;
}
$pactual = $page + 1;
if ($pactual > $tpages) {
$rest = $pactual - $tpages;
$pactual = $pactual - $rest + 1;
$start = ($pactual - 1) * $limit;
}
$nav = new RMPageNav($num, $limit, $pactual, 6);
$nav->target_url($tag->permalink() . ($mc['permalinks'] > 1 ? 'page/{PAGE_NUM}/' : '&page={PAGE_NUM}'));
$xoopsTpl->assign("nav_pages", $nav->render(false, 0));
$xoopsTpl->assign('pactual', $pactual);
$xoopsTpl->assign('lang_taggedtitle', sprintf(__('Posts tagged as "%s"', 'mywords'), $tag->getVar('tag')));
$sql = "SELECT a.* FROM {$table_posts} as a, {$table_tags} as b WHERE b.tag='" . $tag->id() . "' AND\n a.id_post=b.post AND status='publish' AND \n\t\t((visibility='public' OR visibility='password') OR (visibility='private' AND\n\t\tauthor=" . ($xoopsUser ? $xoopsUser->uid() : -1) . ")) ORDER BY pubdate DESC LIMIT {$start},{$limit}";
$result = $db->query($sql);
require 'post_data.php';
$xoopsTpl->assign('xoops_pagetitle', sprintf(__('Posts tagged as "%s"', 'mywords'), $tag->getVar('tag')));
include 'footer.php';
示例8: COUNT
//Barra de Navegación
$sql = "SELECT COUNT(*) FROM " . $db->prefix('pw_works') . " WHERE public=1";
list($num) = $db->fetchRow($db->query($sql));
$limit = $mc['num_recent'];
$limit = $limit <= 0 ? 10 : $limit;
if (!isset($page)) {
$page = rmc_server_var($_GET, 'page', 1);
}
$tpages = ceil($num / $limit);
$page = $page > $tpages ? $tpages : $page;
$start = $num <= 0 ? 0 : ($page - 1) * $limit;
$start = $start < 0 ? 0 : $start;
$nav = new RMPageNav($num, $limit, $page, 5);
$url = $xoopsModuleConfig['urlmode'] ? XOOPS_URL . rtrim($xoopsModuleConfig['htbase'], '/') . '/page/{PAGE_NUM}/' : XOOPS_URL . '/modules/works/?page={PAGE_NUM}';
$nav->target_url($url);
$tpl->assign('navpage', $nav->render(false));
//Fin de barra de navegación
//Obtenemos los trabajos recientes
$sql = "SELECT * FROM " . $db->prefix('pw_works') . " WHERE public=1 ORDER BY created DESC LIMIT {$start},{$limit}";
$result = $db->query($sql);
// Numero de resultados en esta página
$t = $db->getRowsNum($result);
$tpl->assign('page_total', $t);
$tpl->assign('per_col', ceil($t / 2));
$categos = array();
$clients = array();
while ($row = $db->fetchArray($result)) {
$recent = new PWWork();
$recent->assignVars($row);
if (!isset($categos[$recent->category()])) {
$categos[$recent->category()] = new PWCategory($recent->category());
示例9: RMPageNav
}
$start = $page * $limit;
$tpages = (int) ($num / $limit);
if ($num % $limit > 0) {
$tpages++;
}
$pactual = $page + 1;
if ($pactual > $tpages) {
$rest = $pactual - $tpages;
$pactual = $pactual - $rest + 1;
$start = ($pactual - 1) * $limit;
}
if ($tpages > 0) {
$nav = new RMPageNav($num, $limit, $pactual);
$nav->target_url($forum->permalink() . '&pag={PAGE_NUM}');
$tpl->assign('itemsNavPage', $nav->render(false));
}
$sql = str_replace("COUNT(*)", '*', $sql);
$sql .= " ORDER BY sticky DESC,";
$sql .= $xoopsModuleConfig['order_post'] ? " last_post " : " date ";
$sql .= " DESC LIMIT {$start},{$limit}";
$result = $db->query($sql);
/**
* Posters cache
*/
$posters = array();
while ($row = $db->fetchArray($result)) {
$topic = new bXTopic();
$topic->assignVars($row);
$last = new bXPost($topic->lastPost());
if (!isset($posters[$topic->poster])) {
示例10: RMPageNav
}
$start = $page * $limit;
$tpages = (int) ($num / $limit);
if ($num % $limit > 0) {
$tpages++;
}
$pactual = $page + 1;
if ($pactual > $tpages) {
$rest = $pactual - $tpages;
$pactual = $pactual - $rest + 1;
$start = ($pactual - 1) * $limit;
}
if ($tpages > 1) {
$nav = new RMPageNav($num, $limit, $pactual, 5);
$nav->target_url($mc['urlmode'] ? GSFunctions::get_url() . '/search/' . $search . '/pag/{PAGE_NUM}/' : '?search=' . $search . '&pag={PAGE_NUM}');
$tpl->assign('searchNavPage', $nav->render(false));
}
$showmax = $start + $limit;
$showmax = $showmax > $num ? $num : $showmax;
$tpl->assign('lang_showing', sprintf(__('Showing pictures %u to %u from %u'), $start + 1, $showmax, $num));
$tpl->assign('limit', $limit);
$tpl->assign('pag', $pactual);
//Fin de barra de navegación
$sql = "SELECT DISTINCT c.* FROM " . $db->prefix('gs_tags') . " a INNER JOIN " . $db->prefix('gs_tagsimages') . " b INNER JOIN ";
$sql .= $db->prefix('gs_images') . " c ON (";
$sql .= "a.id_tag=b.id_tag AND b.id_image=c.id_image AND c.public=2 AND (";
$sql1 = '';
foreach ($words as $k) {
if (strlen($k) <= 2) {
continue;
}
示例11: RMPageNav
$page -= 1;
}
$start = $page * $limit;
$tpages = (int) ($num / $limit);
if ($num % $limit > 0) {
$tpages++;
}
$pactual = $page + 1;
if ($pactual > $tpages) {
$rest = $pactual - $tpages;
$pactual = $pactual - $rest + 1;
$start = ($pactual - 1) * $limit;
}
$nav = new RMPageNav($num, $limit, $pactual);
$nav->target_url("search.php?limit={$limit}&pag={PAGE_NUM}&search={$search}&type={$type}&themes={$themes}");
$tpl->assign('itemsNavPage', $nav->render(true));
//Fin barra de navegación
$sql1 = '';
$sql2 = '';
if ($themes == 0 && $search == '') {
$sql = " SELECT a.*,b.name FROM {$tbl1} a,{$tbl4} b WHERE a.id_forum=b.id_forum";
$sql1 .= " ORDER BY a.sticky DESC, a.date DESC LIMIT {$start},{$limit} ";
} else {
$sql = "SELECT a.id_topic,a.title,a.views,a.poster_name,a.date,a.replies,a.sticky,a.status,a.last_post,b.post_text,c.*,d.name FROM \n\t{$tbl1} a,{$tbl2} b, {$tbl3} c,{$tbl4} d WHERE ";
if ($search) {
$sql1 = '(';
$sql2 = ')';
//Comprobamos el tipo de búsqueda a realizar
if ($type == 0 || $type == 1) {
if ($type == 0) {
$query = "AND";
示例12: 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}&sort={$sort}&mode={$mode}&cat={$catid}&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> » " . $loc);
xoops_cp_header();
include RMTemplate::get()->get_template('admin/dtrans_items.php', 'module', 'dtransport');
xoops_cp_footer();
}
示例13: array
case '0':
$sql .= " ORDER BY user_regdate";
break;
case '1':
$sql .= " ORDER BY uname";
break;
default:
$sql .= " ORDER BY uid";
break;
}
$sql .= " LIMIT {$start},{$limit}";
//$sql = "SELECT uid, uname FROM ".$db->prefix("users")." WHERE level>0 LIMIT $start,$limit";
$result = $db->query($sql);
$users = array();
if ($all) {
$users[] = array('id' => 0, 'name' => __('All', 'rmcommon'), 'check' => in_array(0, $selected));
}
while ($row = $db->fetchArray($result)) {
$users[] = array('id' => $row['uid'], 'name' => $row['uname'], 'check' => in_array($row['uid'], $selected));
}
$selecteds = array();
if (is_array($selected) && count($selected) > 0) {
$sql = "SELECT uid,uname FROM " . $db->prefix("users") . " WHERE level>0 AND uid IN (" . implode(',', $selected) . ")";
$result = $db->query($sql);
while ($row = $db->fetchArray($result)) {
$selecteds[] = array('id' => $row['uid'], 'name' => $row['uname'], 'check' => true);
}
}
$field_type = $type ? 'checkbox' : 'radio';
$nav->render(false);
include RMTemplate::get()->get_template("rmc-form-users.php", 'module', 'rmcommon');
示例14: showItemsAndOptions
/**
* @desc Muestra todas las opciones configurables
*/
function showItemsAndOptions()
{
global $xoopsUser, $db, $xoopsOption, $tpl, $xoopsModule, $xoopsConfig, $xoopsSecurity;
global $xoopsModuleConfig, $forum;
$xoopsOption['template_main'] = "bxpress_moderate.html";
$xoopsOption['module_subpage'] = "moderate";
include 'header.php';
/**
* Cargamos los temas
*/
$tbl1 = $db->prefix("bxpress_topics");
$tbl2 = $db->prefix("bxpress_forumtopics");
$sql = "SELECT COUNT(*) FROM {$tbl1} WHERE id_forum='" . $forum->id() . "' ";
list($num) = $db->fetchRow($db->queryF($sql));
$page = isset($_REQUEST['pag']) ? $_REQUEST['pag'] : '';
$limit = $xoopsModuleConfig['topicperpage'] > 0 ? $xoopsModuleConfig['topicperpage'] : 15;
if ($page > 0) {
$page -= 1;
}
$start = $page * $limit;
$tpages = (int) ($num / $limit);
if ($num % $limit > 0) {
$tpages++;
}
$pactual = $page + 1;
if ($pactual > $tpages) {
$rest = $pactual - $tpages;
$pactual = $pactual - $rest + 1;
$start = ($pactual - 1) * $limit;
}
if ($tpages > 0) {
$nav = new RMPageNav($num, $limit, $pactual);
$nav->target_url('moderate.php?id=' . $forum->id() . '&pag={PAGE_NUM}');
$tpl->assign('itemsNavPage', $nav->render(false));
}
$sql = str_replace("COUNT(*)", '*', $sql);
$sql .= " ORDER BY sticky DESC, date DESC LIMIT {$start},{$limit}";
$result = $db->query($sql);
while ($row = $db->fetchArray($result)) {
$topic = new bXTopic();
$topic->assignVars($row);
$last = new bXPost($topic->lastPost());
$lastpost = array();
if (!$last->isNew()) {
$lastpost['date'] = bXFunctions::formatDate($last->date());
$lastpost['by'] = sprintf(__('By: %s', 'bxpress'), $last->uname());
$lastpost['id'] = $last->id();
if ($xoopsUser) {
$lastpost['new'] = $last->date() > $xoopsUser->getVar('last_login') && time() - $last->date() < $xoopsModuleConfig['time_new'];
} else {
$lastpost['new'] = time() - $last->date() <= $xoopsModuleConfig['time_new'];
}
}
$tpages = ceil($topic->replies() / $xoopsModuleConfig['perpage']);
if ($tpages > 1) {
$pages = bXFunctions::paginateIndex($tpages);
} else {
$pages = null;
}
$tpl->append('topics', array('id' => $topic->id(), 'title' => $topic->title(), 'replies' => $topic->replies(), 'views' => $topic->views(), 'by' => sprintf(__('By: %s', 'bxpress'), $topic->posterName()), 'last' => $lastpost, 'popular' => $topic->replies() >= $forum->hotThreshold(), 'sticky' => $topic->sticky(), 'pages' => $pages, 'tpages' => $tpages, 'approved' => $topic->approved(), 'closed' => $topic->status()));
}
$tpl->assign('forum', array('id' => $forum->id(), 'title' => $forum->name()));
$tpl->assign('lang_topic', __('Topic', 'bxpress'));
$tpl->assign('lang_replies', __('Replies', 'bxpress'));
$tpl->assign('lang_views', __('Views', 'bxpress'));
$tpl->assign('lang_lastpost', __('Last Post', 'bxpress'));
$tpl->assign('lang_sticky', __('Sticky', 'bxpress'));
$tpl->assign('lang_moderating', __('Moderating Forum', 'bxpress'));
$tpl->assign('lang_pages', __('Pages', 'bxpress'));
$tpl->assign('lang_move', __('Move', 'bxpress'));
$tpl->assign('lang_open', __('Unlock', 'bxpress'));
$tpl->assign('lang_close', __('Lock', 'bxpress'));
$tpl->assign('lang_dosticky', __('Sticky', 'bxpress'));
$tpl->assign('lang_dounsticky', __('Unsticky', 'bxpress'));
$tpl->assign('lang_approved', __('Approved', 'bxpress'));
$tpl->assign('lang_app', __('Approve', 'bxpress'));
$tpl->assign('lang_noapp', __('Unapprove', 'bxpress'));
$tpl->assign('lang_delete', __('Delete', 'bxpress'));
$tpl->assign('lang_confirm', __('Do you really want to delete selected topics?', 'bxpress'));
$tpl->assign('token_input', $xoopsSecurity->getTokenHTML());
bXFunctions::makeHeader();
RMTemplate::get()->add_xoops_style('style.css', 'bxpress');
include 'footer.php';
}
示例15: imgsTag
/**
* @desc Visualiza todas las imágenes de la etiqueta especificada
**/
function imgsTag()
{
global $tpl, $xoopsOption, $xoopsUser, $xoopsConfig, $xoopsModuleConfig, $db, $page, $tag, $usr, $hits;
$xoopsOption['template_main'] = 'gs_imagestag.html';
$xoopsOption['module_subpage'] = 'exploretags';
include 'header.php';
$mc =& $xoopsModuleConfig;
GSFunctions::makeHeader();
//Verificamos si la etiqueta existe
$tag = new GSTag($tag);
if ($tag->isNew()) {
redirect_header(GSFunctions::get_url(), 1, __('Specified tag does not exists!', 'galleries'));
die;
}
//Incrementamos el número de hits de la etiqueta
if (!isset($_SESSION['vtags'])) {
$tag->addHit();
$_SESSION['vtags'] = array($tag->id());
} elseif (!in_array($tag->id(), $_SESSION['vtags'])) {
$tag->addHit();
$_SESSION['vtags'][] = $tag->id();
}
//Verificamos si el usuario existe
if (isset($usr)) {
$user = new GSUser($usr);
if ($user->isNew()) {
redirect_header(GSFunctions::get_url(), 1, __('Specified user does not exists!', 'galleries'));
die;
}
$users[$user->uid()] = $user;
}
//Barra de Navegación
$sql = "SELECT COUNT(*) FROM " . $db->prefix('gs_tagsimages') . " a INNER JOIN " . $db->prefix('gs_images');
$sql .= " b ON (a.id_tag=" . $tag->id() . " AND a.id_image=b.id_image AND b.public=2";
$sql .= $usr ? " AND b.owner=" . $user->uid() . ") " : ")";
$limit = $xoopsModuleConfig['num_imgstags'];
list($num) = $db->fetchRow($db->query($sql));
if ($page > 0) {
$page -= 1;
}
$start = $page * $limit;
$tpages = (int) ($num / $limit);
if ($num % $limit > 0) {
$tpages++;
}
$pactual = $page + 1;
if ($pactual > $tpages) {
$rest = $pactual - $tpages;
$pactual = $pactual - $rest + 1;
$start = ($pactual - 1) * $limit;
}
if ($tpages > 1) {
if ($mc['urlmode']) {
$urlnav = 'explore/tags/tag/' . $tag->getVar('nameid') . '/';
$urlnav .= $usr ? 'usr/' . $user->uname() . '/' : '';
} else {
$urlnav = '?xplore=tags&tag=' . $tag->getVar('nameid');
$urlnav .= $usr ? '&usr=' . $user->uname() : '';
}
$nav = new RMPageNav($num, $limit, $pactual, 5);
$nav->target_url(GSFunctions::get_url() . $urlnav . ($mc['urlmode'] ? 'pag/{PAGE_NUM}/' : '&pag={PAGE_NUM}'));
$tpl->assign('tagsNavPage', $nav->render(false));
}
$showmax = $start + $limit;
$showmax = $showmax > $num ? $num : $showmax;
$tpl->assign('lang_showing', sprintf(__('Showing photos %u to %u from %u.', 'galleries'), $start + 1, $showmax, $num));
$tpl->assign('limit', $limit);
$tpl->assign('pag', $pactual);
//Fin de barra de navegación
//Obtenemos las imágenes pertenecientes a la etiqueta
$sql = "SELECT b.* FROM " . $db->prefix('gs_tagsimages') . " a INNER JOIN " . $db->prefix('gs_images');
$sql .= " b ON (a.id_tag=" . $tag->id() . " AND a.id_image=b.id_image AND b.public=2";
$sql .= $usr ? " AND b.owner=" . $user->uid() . ") " : ")";
$sql .= " GROUP BY b.id_image";
$sql .= " ORDER BY `created` DESC LIMIT {$start}, {$limit}";
$result = $db->query($sql);
$tpl->assign('images', GSFunctions::process_image_data($result));
$tpl->assign('lang_picstag', $usr ? sprintf(__('%s: tagged as %s', 'galleries'), $user->uname(), $tag->tag()) : sprintf(__('Images tagged as "%s"', 'galleries'), $tag->tag()));
$tpl->assign('tagname', $tag->tag());
$tpl->assign('usr', $usr);
if ($usr) {
$tpl->assign('pics_link', GS_URL . '/' . ($mc['urlmode'] ? "usr/" . $user->uname() : "user.php?id=usr/" . $user->uname() . "/"));
$tpl->assign('tags_link', GS_URL . '/' . ($mc['urlmode'] ? "explore/tags/usr/" . $user->uname() . "/" : "explore.php?by=explore/tags/usr/" . $user->uname() . "/"));
$tpl->assign('sets_link', GS_URL . '/' . ($mc['urlmode'] ? "explore/sets/usr/" . $user->uname() . "/" : "explore.php?by=explore/sets/usr/" . $user->uname() . "/"));
$tpl->assign('bmark_link', GS_URL . '/' . ($mc['urlmode'] ? "cpanel/booksmarks/" : "cpanel.php?s=cpanel/bookmarks"));
}
include 'footer.php';
}