aboutsummaryrefslogtreecommitdiffstats
path: root/mod
diff options
context:
space:
mode:
authorMike Macgirvin <mike@macgirvin.com>2010-07-10 00:45:18 -0700
committerMike Macgirvin <mike@macgirvin.com>2010-07-10 00:45:18 -0700
commita4850cb3d7886db727b4c98a98a94c51f008526f (patch)
tree7836c6f5a9462c99c0758567149cde6b9c4e0acd /mod
parentcb54cda17454fde783c165c37d6ece1ba2067253 (diff)
downloadvolse-hubzilla-a4850cb3d7886db727b4c98a98a94c51f008526f.tar.gz
volse-hubzilla-a4850cb3d7886db727b4c98a98a94c51f008526f.tar.bz2
volse-hubzilla-a4850cb3d7886db727b4c98a98a94c51f008526f.zip
added pager
Diffstat (limited to 'mod')
-rw-r--r--mod/directory.php20
1 files changed, 17 insertions, 3 deletions
diff --git a/mod/directory.php b/mod/directory.php
index aec34f910..2dd4b15d9 100644
--- a/mod/directory.php
+++ b/mod/directory.php
@@ -1,8 +1,10 @@
<?php
-
+function directory_init(&$a) {
+ $a->set_pager_itemspage(60);
+}
function directory_content(&$a) {
-
+dbg(2);
$search = ((x($_GET,'search')) ? notags(trim($_GET['search'])) : '');
$tpl .= file_get_contents('view/directory_header.tpl');
@@ -16,7 +18,17 @@ function directory_content(&$a) {
$search = dbesc($search);
$sql_extra = ((strlen($search)) ? " AND MATCH (`profile`.`name`, `user`.`nickname`, `locality`,`region`,`country-name`,`gender`,`marital`,`sexual`,`about`,`romance`,`employer`,`school`) AGAINST ('$search' IN BOOLEAN MODE) " : "");
- $r = q("SELECT `profile`.*, `profile`.`uid` AS `profile_uid`, `user`.`nickname`, `user`.`timezone` FROM `profile` LEFT JOIN `user` ON `user`.`uid` = `profile`.`uid` WHERE `is-default` = 1 AND `publish` = 1 $sql_extra ORDER BY `name` ASC");
+
+ $r = q("SELECT COUNT(*) AS `total` FROM `profile` LEFT JOIN `user` ON `user`.`uid` = `profile`.`uid` WHERE `is-default` = 1 AND `publish` = 1 AND `user`.`blocked` = 0 $sql_extra ");
+ if(count($r))
+ $a->set_pager_total($r[0]['total']);
+
+
+
+ $r = q("SELECT `profile`.*, `profile`.`uid` AS `profile_uid`, `user`.`nickname`, `user`.`timezone` FROM `profile` LEFT JOIN `user` ON `user`.`uid` = `profile`.`uid` WHERE `is-default` = 1 AND `publish` = 1 AND `user`.`blocked` = 0 $sql_extra ORDER BY `name` ASC LIMIT %d , %d ",
+ intval($a->pager['start']),
+ intval($a->pager['itemspage'])
+ );
if(count($r)) {
$tpl = file_get_contents('view/directory_item.tpl');
@@ -62,6 +74,8 @@ function directory_content(&$a) {
}
$o .= "<div class=\"directory-end\" ></div>\r\n";
+ $o .= paginate($a);
+
}
else
notice("No entries (some entries may be hidden).");