paginated aliases
This commit is contained in:
		
							parent
							
								
									fc6ed22988
								
							
						
					
					
						commit
						b9fabb5d8a
					
				@ -46,9 +46,27 @@ class AliasEditor implements Extension {
 | 
				
			|||||||
				}
 | 
									}
 | 
				
			||||||
			}
 | 
								}
 | 
				
			||||||
			else if($event->get_arg(0) == "list") {
 | 
								else if($event->get_arg(0) == "list") {
 | 
				
			||||||
				$this->theme->display_aliases($page,
 | 
									$page_number = $event->get_arg(1);
 | 
				
			||||||
						$database->db->GetAssoc("SELECT oldtag, newtag FROM aliases ORDER BY newtag"),
 | 
									if(is_null($page_number) || !is_numeric($page_number)) {
 | 
				
			||||||
						$user->is_admin());
 | 
										$page_number = 0;
 | 
				
			||||||
 | 
									}
 | 
				
			||||||
 | 
									else if ($page_number <= 0) {
 | 
				
			||||||
 | 
										$page_number = 0;
 | 
				
			||||||
 | 
									}
 | 
				
			||||||
 | 
									else {
 | 
				
			||||||
 | 
										$page_number--;
 | 
				
			||||||
 | 
									}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
									$alias_per_page = $config->get_int('alias_items_per_page', 30);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
									$alias = $database->db->GetAssoc(
 | 
				
			||||||
 | 
										"SELECT oldtag, newtag FROM aliases ORDER BY newtag ASC LIMIT ?, ?",
 | 
				
			||||||
 | 
										array($page_number * $alias_per_page, $alias_per_page)
 | 
				
			||||||
 | 
									);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
									$total_pages = ceil($database->db->GetOne("SELECT COUNT(*) FROM aliases") / $alias_per_page);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
									$this->theme->display_aliases($page, $alias, $user->is_admin(), $page_number + 1, $total_pages);
 | 
				
			||||||
			}
 | 
								}
 | 
				
			||||||
			else if($event->get_arg(0) == "export") {
 | 
								else if($event->get_arg(0) == "export") {
 | 
				
			||||||
				$page->set_mode("data");
 | 
									$page->set_mode("data");
 | 
				
			||||||
 | 
				
			|||||||
@ -7,7 +7,7 @@ class AliasEditorTheme extends Themelet {
 | 
				
			|||||||
	 * $aliases = an array of ($old_tag => $new_tag)
 | 
						 * $aliases = an array of ($old_tag => $new_tag)
 | 
				
			||||||
	 * $is_admin = whether things like "add new alias" should be shown
 | 
						 * $is_admin = whether things like "add new alias" should be shown
 | 
				
			||||||
	 */
 | 
						 */
 | 
				
			||||||
	public function display_aliases(Page $page, $aliases, $is_admin) {
 | 
						public function display_aliases(Page $page, $aliases, $is_admin, $pageNumber, $totalPages) {
 | 
				
			||||||
		if($is_admin) {
 | 
							if($is_admin) {
 | 
				
			||||||
			$action = "<th width='10%'>Action</th>";
 | 
								$action = "<th width='10%'>Action</th>";
 | 
				
			||||||
			$add = "
 | 
								$add = "
 | 
				
			||||||
@ -73,6 +73,8 @@ class AliasEditorTheme extends Themelet {
 | 
				
			|||||||
		if($is_admin) {
 | 
							if($is_admin) {
 | 
				
			||||||
			$page->add_block(new Block("Bulk Upload", $bulk_html, "main", 51));
 | 
								$page->add_block(new Block("Bulk Upload", $bulk_html, "main", 51));
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
							$this->display_paginator($page, "alias/list", null, $pageNumber, $totalPages);
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
?>
 | 
					?>
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user