From a653b0de5f805e754b2ccbb6d3833e127fa96ec5 Mon Sep 17 00:00:00 2001
From: Seth Meranda <smeranda2@unl.edu>
Date: Thu, 17 Sep 2009 13:41:18 +0000
Subject: [PATCH] Added a function to get a list of users alphabatized by name.

---
 plugins/browse/index.php | 81 ++++++++++++++++++++++++----------------
 1 file changed, 49 insertions(+), 32 deletions(-)

diff --git a/plugins/browse/index.php b/plugins/browse/index.php
index de98ee93..1e706ddd 100755
--- a/plugins/browse/index.php
+++ b/plugins/browse/index.php
@@ -19,24 +19,40 @@
     if (!$sorted)
 	$sorted = 0;
    
-if($sorted ==0){  //all users, display alphabatized
+if($sorted ==0){  //Last Login
 	
-	if($photofilter==1){ //if Applied both condition
-		
-	$allusers = get_data("select a.guid from {$CONFIG->dbprefix}users_entity as a,{$CONFIG->dbprefix}entities as b  where a.guid =b.guid and b.enabled = 'yes'  order by a.name ASC");
-   echo $allusers;
+  $totalCount= get_data("select a.guid from {$CONFIG->dbprefix}users_entity as a,{$CONFIG->dbprefix}entities as b  where a.guid =b.guid and b.enabled = 'yes'  order by a.name  ASC");	
+	//exit;
+	$offset=get_input('offset');
+	if(empty($offset))
+	$offset = 0;
+	$root = $CONFIG->wwwroot;
+	$limit =10;
+	$end = $limit;
+	
+	 $allusers = get_data("select a.guid from {$CONFIG->dbprefix}users_entity as a,{$CONFIG->dbprefix}entities as b  where a.guid =b.guid and b.enabled = 'yes'  order by a.name  ASC limit $offset,$end");
+	 
+	 $count =  sizeof($totalCount); 
+	
+													
+													
+													
+ if($photofilter==1){ //if Applied both condition
+   	$allusers = get_data("select a.guid from {$CONFIG->dbprefix}users_entity as a,{$CONFIG->dbprefix}entities as b  where a.guid =b.guid and b.enabled = 'yes'  order by a.name  ASC");
+   
    	foreach($allusers as $userall) {
    	
 	$guid = $userall->guid;
+	//$countentity[] = get_entity($guid);
 	$entity = get_entity($guid);
 	$one = get_entity_icon_url($entity,$size ='medium');
-
+  // echo $one;echo "<br>";
   if (preg_match("/defaultmedium/",$one)) {
-  
+  	
   } else {
   	$result .= elgg_view_entity($entity,$fullview);
   	$countentity[] = $entity;
-  
+  	
          } 
      }   
   
@@ -50,32 +66,33 @@ if($sorted ==0){  //all users, display alphabatized
 												'count' => $count,
 												'limit' => $limit,
 													));
-       
+           
  	}	
- 
- 
- 
- 
- else{
  	
- 	function list_entities_sorted($type= "", $subtype = "", $owner_guid = 0, $limit = 10, $fullview = true, $viewtypetoggle = false, $navigation = true,$order_by) {
-		
-		$offset = (int) get_input('offset');
-		$count = get_entities($type, $subtype, $owner_guid,$order_by, $limit, $offset, true);
-		$entities = get_entities($type, $subtype, $owner_guid, $order_by, $limit, $offset);
-     
-		return elgg_view_entity_list($entities, $count, $offset, $limit, $fullview, $viewtypetoggle, $navigation);
-		
-	}
-	//name
-	$order_by ="time_updated DESC";
-	//$order_by ="name ASC";
-	$result =   list_entities_sorted('user', $subtype = "", $owner_guid = 0, $limit = 10, $fullview = true, $viewtypetoggle = false, $navigation = true,$order_by); 
-	 
-	 
-	 
- } 
-	 
+ 		
+ 	
+ 	else{	//only first condition 	*/
+
+ 	$baseurl= $root.'pg/browse'.'?sortresult='.$sorted;
+	
+	 $nav = elgg_view('navigation/pagination',array(
+												'baseurl' => $baseurl,
+												'offset' => $offset,
+												'count' => $count,
+												'limit' => $limit,
+													));	
+ 				
+ 	
+	foreach($allusers as $userall) {
+	 	
+	$guid = $userall->guid;
+	
+	$entity = get_entity($guid);
+	$result .= elgg_view_entity($entity,$fullview);
+	 	}
+	 	
+	} 	
+
 }
 
 
-- 
GitLab