summaryrefslogtreecommitdiff
path: root/modules/gallery/helpers/gallery_event.php
diff options
context:
space:
mode:
authorTim Almdal <tnalmdal@shaw.ca>2009-11-06 14:08:46 -0800
committerTim Almdal <tnalmdal@shaw.ca>2009-11-06 14:08:46 -0800
commitb5f2dbc2c4fa974f486bc92c75054940424ed323 (patch)
tree90c38929aabd5f4786088ad49a0c8534c620e522 /modules/gallery/helpers/gallery_event.php
parentb01056da917e7da2921a5cd4c65b129489cbc19f (diff)
Create a user_menu for the top of the page. Change the login, edit profile and logout portions of the banner to be rendered by the Theme_View::user_menu callback. This fires the user_menu event. Fixes Ticket #871.
Diffstat (limited to 'modules/gallery/helpers/gallery_event.php')
-rw-r--r--modules/gallery/helpers/gallery_event.php28
1 files changed, 28 insertions, 0 deletions
diff --git a/modules/gallery/helpers/gallery_event.php b/modules/gallery/helpers/gallery_event.php
index e3cb6a9b..43920815 100644
--- a/modules/gallery/helpers/gallery_event.php
+++ b/modules/gallery/helpers/gallery_event.php
@@ -97,6 +97,34 @@ class gallery_event_Core {
$data[] = $item->title;
}
+ static function user_menu($menu, $theme) {
+ if ($theme->page_type != "login") {
+ Kohana::log("alert", "in gallery::user_menu");
+ $user = identity::active_user();
+ if ($user->guest) {
+ $menu->append(Menu::factory("dialog")
+ ->id("user_menu_login")
+ ->css_id("g-login-link")
+ ->url(url::site("login/ajax"))
+ ->label(t("Login")));
+ } else {
+ $csrf = access::csrf_token();
+ $menu->append(Menu::factory("dialog")
+ ->id("user_menu_edit_profile")
+ ->css_id("g-user-profile-link")
+ ->view("login_current_user.html")
+ ->url(url::site("form/edit/users/{$user->id}"))
+ ->label($user->display_name()));
+ $menu->append(Menu::factory("link")
+ ->id("user_menu_logout")
+ ->css_id("g-logout-link")
+ ->url(url::site("logout?csrf=$csrf&amp;continue=" .
+ urlencode(url::current(true))))
+ ->label(t("Logout")));
+ }
+ }
+ }
+
static function site_menu($menu, $theme) {
if ($theme->page_type != "login") {
$menu->append(Menu::factory("link")