themable user links
This commit is contained in:
parent
43d9161d6b
commit
63be20458d
4 changed files with 13 additions and 5 deletions
|
@ -5,7 +5,7 @@ class UserBlockBuildingEvent extends Event {
|
|||
|
||||
public function add_link($name, $link, $position=50) {
|
||||
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) {
|
||||
$h_name = html_escape($user->name);
|
||||
$html = "Logged in as $h_name<br>";
|
||||
$html .= join("\n<br/>", $parts);
|
||||
$html = "Logged in as $h_name";
|
||||
foreach($parts as $part) {
|
||||
$html .= "<br><a href='{$part["link"]}'>{$part["name"]}</a>";
|
||||
}
|
||||
$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) {
|
||||
$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));
|
||||
}
|
||||
|
||||
|
|
|
@ -3,7 +3,10 @@
|
|||
class CustomUserPageTheme extends UserPageTheme {
|
||||
public function display_user_block(Page $page, User $user, $parts) {
|
||||
$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));
|
||||
}
|
||||
public function display_login_block(Page $page) {
|
||||
|
|
Reference in a new issue