themable user links
This commit is contained in:
		
							parent
							
								
									6322589265
								
							
						
					
					
						commit
						b2c2368cfc
					
				@ -5,7 +5,7 @@ class UserBlockBuildingEvent extends Event {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
	public function add_link($name, $link, $position=50) {
 | 
						public function add_link($name, $link, $position=50) {
 | 
				
			||||||
		while(isset($this->parts[$position])) $position++;
 | 
							while(isset($this->parts[$position])) $position++;
 | 
				
			||||||
		$this->parts[$position] = "<a href='$link'>$name</a>";
 | 
							$this->parts[$position] = array("name" => $name, "link" => $link);
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
				
			|||||||
@ -30,8 +30,10 @@ class UserPageTheme extends Themelet {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
	public function display_user_block(Page $page, User $user, $parts) {
 | 
						public function display_user_block(Page $page, User $user, $parts) {
 | 
				
			||||||
		$h_name = html_escape($user->name);
 | 
							$h_name = html_escape($user->name);
 | 
				
			||||||
		$html = "Logged in as $h_name<br>";
 | 
							$html = "Logged in as $h_name";
 | 
				
			||||||
		$html .= join("\n<br/>", $parts);
 | 
							foreach($parts as $part) {
 | 
				
			||||||
 | 
								$html .= "<br><a href='{$part["link"]}'>{$part["name"]}</a>";
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
		$page->add_block(new Block("User Links", $html, "left", 90));
 | 
							$page->add_block(new Block("User Links", $html, "left", 90));
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
				
			|||||||
@ -15,7 +15,10 @@ class CustomUserPageTheme extends UserPageTheme {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
	public function display_user_block($page, $user, $parts) {
 | 
						public function display_user_block($page, $user, $parts) {
 | 
				
			||||||
		$h_name = html_escape($user->name);
 | 
							$h_name = html_escape($user->name);
 | 
				
			||||||
		$html = "<li>" . join("\n<li>", $parts);
 | 
							$html = "";
 | 
				
			||||||
 | 
							foreach($parts as $part) {
 | 
				
			||||||
 | 
								$html .= "<li><a href='{$part["link"]}'>{$part["name"]}</a>";
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
		$page->add_block(new Block("User Links", $html, "user", 90));
 | 
							$page->add_block(new Block("User Links", $html, "user", 90));
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
				
			|||||||
@ -3,7 +3,10 @@
 | 
				
			|||||||
class CustomUserPageTheme extends UserPageTheme {
 | 
					class CustomUserPageTheme extends UserPageTheme {
 | 
				
			||||||
	public function display_user_block(Page $page, User $user, $parts) {
 | 
						public function display_user_block(Page $page, User $user, $parts) {
 | 
				
			||||||
		$h_name = html_escape($user->name);
 | 
							$h_name = html_escape($user->name);
 | 
				
			||||||
		$html = join("\n | ", $parts);
 | 
							$html = " | ";
 | 
				
			||||||
 | 
							foreach($parts as $part) {
 | 
				
			||||||
 | 
								$html .= "<a href='{$part["link"]}'>{$part["name"]}</a> | ";
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
		$page->add_block(new Block("Logged in as $h_name", $html, "head", 90));
 | 
							$page->add_block(new Block("Logged in as $h_name", $html, "head", 90));
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	public function display_login_block(Page $page) {
 | 
						public function display_login_block(Page $page) {
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user