order images sorted by score
this is solution for issue #17 (Method to sort by top scored images in numeric_score module)
This commit is contained in:
		
							parent
							
								
									16bb38f343
								
							
						
					
					
						commit
						eb16ab09ed
					
				@ -109,6 +109,7 @@
 | 
			
		||||
 *        <li>downvoted_by=Username -- search for a user's dislikes
 | 
			
		||||
 *        <li>upvoted_by_id=UserID -- search for a user's likes by user ID
 | 
			
		||||
 *        <li>downvoted_by_id=UserID -- search for a user's dislikes by user ID
 | 
			
		||||
 *        <li>order=score_(ASC, DESC) -- find all images sorted from by score
 | 
			
		||||
 *      </ul>
 | 
			
		||||
 *    <li>Image Rating
 | 
			
		||||
 *      <ul>
 | 
			
		||||
 | 
			
		||||
@ -254,6 +254,13 @@ class NumericScore extends Extension {
 | 
			
		||||
				"images.id in (SELECT image_id FROM numeric_score_votes WHERE user_id=:ns_user_id AND score=-1)",
 | 
			
		||||
				array("ns_user_id"=>$iid)));
 | 
			
		||||
		}
 | 
			
		||||
		else if(preg_match("/^order[=|:](numeric_)?(score)[_]?(desc|asc)?$/i", $event->term, $matches)){
 | 
			
		||||
			global $order_sql;
 | 
			
		||||
			$default_order_for_column = "DESC";
 | 
			
		||||
			$sort = isset($matches[3]) ? strtoupper($matches[3]) : $default_order_for_column;
 | 
			
		||||
			$order_sql = "numeric_score $sort";
 | 
			
		||||
			$event->add_querylet(new Querylet("1=1")); //small hack to avoid metatag being treated as normal tag
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	private function install() {
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user