diff options
-rw-r--r-- | views/default/navigation/menu/user_admin.php | 4 | ||||
-rw-r--r-- | views/default/profile/hover.php | 63 | ||||
-rw-r--r-- | views/default/profile/icon.php | 167 |
3 files changed, 129 insertions, 105 deletions
diff --git a/views/default/navigation/menu/user_admin.php b/views/default/navigation/menu/user_admin.php index 1972d7916..c88142876 100644 --- a/views/default/navigation/menu/user_admin.php +++ b/views/default/navigation/menu/user_admin.php @@ -25,6 +25,6 @@ foreach ($vars['menu'] as $section => $menu_items) { echo '</ul>'; } if ($toggle) { - echo '<li>'; - echo '<ul>'; + echo '</li>'; + echo '</ul>'; }
\ No newline at end of file diff --git a/views/default/profile/hover.php b/views/default/profile/hover.php new file mode 100644 index 000000000..85d6912ba --- /dev/null +++ b/views/default/profile/hover.php @@ -0,0 +1,63 @@ +<?php + + +$user = $vars['entity']; +$username = $vars['username']; +$name = $vars['name']; + +?> + +<div class="avatar_menu_button"><img src="<?php echo elgg_get_site_url(); ?>_graphics/spacer.gif" border="0" width="15" height="15" /></div> +<div class="sub_menu"> + <h3 class="displayname"> + <a href="<?php echo $user->getURL(); ?>"> + <?php echo $name; ?> + <span class="username"> + <?php echo "@" . $username; ?> + </span> + </a> + </h3> + <ul class='sub_menu_list'> +<?php +if (isloggedin()) { + // if not looking at your own avatar menu + if ($user->getGUID() != get_loggedin_userid()) { + + // Add / Remove friend link + $friendlinks = elgg_view('profile/menu/friendlinks',$vars); + if (!empty($friendlinks)) { + echo "<li class='user_menu_profile'>{$friendlinks}</li>"; + } + // view for plugins to extend + echo elgg_view('profile/menu/links',$vars); + } else { + // if looking at your own avatar menu - provide a couple of handy links +?> + <li class="user_menu_profile"> + <a class="edit_profile" href="<?php echo elgg_get_site_url()?>pg/profile/<?php echo $username; ?>/edit/details"> + <?php echo elgg_echo("profile:edit"); ?> + </a> + </li> + <li class="user_menu_profile"> + <a class="edit_avatar" href="<?php echo elgg_get_site_url()?>pg/profile/<?php echo $username; ?>/edit/icon"> + <?php echo elgg_echo("profile:editicon"); ?> + </a> + </li> +<?php + } + + // if Admin is logged in, and not looking at admins own avatar menu + if (isadminloggedin() && get_loggedin_userid() != $user->guid) { + $params = array( + 'user' => $user, + 'sort_by' => 'order', + ); + $admin_links = elgg_view_menu('user_admin', $params); + if (!empty($admin_links)) { + echo "<li class='user_menu_admin'>{$admin_links}</li>"; + } + } +} +?> + </ul> +</div>
\ No newline at end of file diff --git a/views/default/profile/icon.php b/views/default/profile/icon.php index f58fbf10d..8021157b1 100644 --- a/views/default/profile/icon.php +++ b/views/default/profile/icon.php @@ -1,116 +1,77 @@ <?php - /** * Elgg profile icon * - * @package ElggProfile - * * @uses $vars['entity'] The user entity. If none specified, the current user is assumed. - * @uses $vars['size'] The size - small, medium or large. If none specified, medium is assumed. + * @uses $vars['size'] The size - small, medium or large. If none specified, medium is assumed. + * @uses $vars['align'] + * @uses $vars['override'] + * @uses $vars['js'] */ -// Get entity -if (empty($vars['entity'])) { - $vars['entity'] = get_loggedin_user(); +$user = elgg_get_array_value('entity', $vars, get_loggedin_user()); +$size = elgg_get_array_value('size', $vars, 'medium'); +if (!in_array($size, array('topbar', 'tiny', 'small', 'medium', 'large', 'master'))) { + $size = 'medium'; +} + +if (!($user instanceof ElggUser)) { + return true; +} + +$name = htmlspecialchars($user->name, ENT_QUOTES, 'UTF-8'); +$username = $user->username; + +$icontime = $user->icontime; +if (!$icontime) { + $icontime = "default"; +} + +$js = elgg_get_array_value('js', $vars, ''); + +// Get any align and js +if (!empty($vars['align'])) { + $align = " align=\"{$vars['align']}\" "; +} else { + $align = ''; } -if ($vars['entity'] instanceof ElggUser) { - $name = htmlentities($vars['entity']->name, ENT_QUOTES, 'UTF-8'); - $username = $vars['entity']->username; +$override = elgg_get_array_value('override', $vars, false); - if ($icontime = $vars['entity']->icontime) { - $icontime = "{$icontime}"; - } else { - $icontime = "default"; - } - - // Get size - if (!in_array($vars['size'],array('small','medium','large','tiny','master','topbar'))) { - $vars['size'] = 'medium'; - } - - // Get any align and js - if (!empty($vars['align'])) { - $align = " align=\"{$vars['align']}\" "; - } else { - $align = ''; - } +$spacer_url = elgg_get_site_url() . '_graphics/spacer.gif'; +$icon_url = $user->getIcon($size); +$icon = "<img src=\"$spacer_url\" $align alt=\"$name\" title=\"$name\" $js style=\"background: url($icon_url) no-repeat;\" class=\"$size\" />"; - // Override - if (isset($vars['override']) && $vars['override'] == true) { - $override = true; - } else { - $override = false; - } - // profile avatar drop-down menu - if (!$override) { - ?> - <div class="usericon <?php echo $vars['size']; ?>"> - <div class="avatar_menu_button"><img src="<?php echo elgg_get_site_url(); ?>_graphics/spacer.gif" border="0" width="15" height="15" /></div> - <div class="sub_menu"> - <h3 class="displayname"><a href="<?php echo $vars['entity']->getURL(); ?>"><?php echo $vars['entity']->name; ?> - <span class="username"><?php echo "@" . $vars['entity']->username; ?></span></a></h3> - <?php - echo "<ul class='sub_menu_list'>"; - if (isloggedin()) { - // if not looking at your own avatar menu - if ($vars['entity']->getGUID() != get_loggedin_userid()) { - - // Add / Remove friend link - $friendlinks = elgg_view('profile/menu/friendlinks',$vars); - if (!empty($friendlinks)) { - echo "<li class='user_menu_profile'>{$friendlinks}</li>"; - } - // view for plugins to extend - echo elgg_view('profile/menu/links',$vars); - } else { - // if looking at your own avatar menu - provide a couple of handy links - ?> - <li class="user_menu_profile"> - <a class="edit_profile" href="<?php echo elgg_get_site_url()?>pg/profile/<?php echo $vars['entity']->username; ?>/edit/details"><?php echo elgg_echo("profile:edit"); ?></a> - </li> - <li class="user_menu_profile"> - <a class="edit_avatar" href="<?php echo elgg_get_site_url()?>pg/profile/<?php echo $vars['entity']->username; ?>/edit/icon"><?php echo elgg_echo("profile:editicon"); ?></a> - </li> - <?php - } - - // if Admin is logged in, and not looking at admins own avatar menu - if (isadminloggedin() && get_loggedin_userid() != $vars['entity']->guid) { - $params = array( - 'user' => $vars['entity'], - 'sort_by' => 'order', - ); - $admin_links = elgg_view_menu('user_admin', $params); - if (!empty($admin_links)) { - echo "<li class='user_menu_admin'>{$admin_links}</li>"; - } - } - - } - echo "</ul>"; - ?> - </div> - <?php - if ((isadminloggedin()) || (!$vars['entity']->isBanned())) { - ?> - <a href="<?php echo $vars['entity']->getURL(); ?>" class="icon" > - <?php - } - } +// no hover menu if override set +if ($override) { + echo $icon; + return true; +} - // Rounded avatar corners - CSS3 method - users avatar as background image so we can clip it with border-radius in supported browsers - ?> - <img src="<?php echo elgg_get_site_url(); ?>_graphics/spacer.gif" border="0" <?php echo $align; ?> alt="<?php echo htmlentities($vars['entity']->name, ENT_QUOTES, 'UTF-8'); ?>" title="<?php echo htmlentities($vars['entity']->name, ENT_QUOTES, 'UTF-8'); ?>" <?php echo $vars['js']; ?> style="background: url(<?php echo $vars['entity']->getIcon($vars['size']); ?>) no-repeat;" class="<?php echo $vars['size']; ?>" /> - <?php - /* - original avatar method - <img src="<?php echo elgg_format_url($vars['entity']->getIcon($vars['size'])); ?>" border="0" <?php echo $align; ?> alt="<?php echo htmlentities($vars['entity']->name, ENT_QUOTES, 'UTF-8'); ?>" title="<?php echo htmlentities($vars['entity']->name, ENT_QUOTES, 'UTF-8'); ?>" <?php echo $vars['js']; ?> /> - */ +?> +<div class="usericon <?php echo $size; ?>"> +<?php +$params = array( + 'entity' => $user, + 'username' => $username, + 'name' => $name, +); +echo elgg_view('profile/hover', $params); - if (!$override) { - ?> - </a></div> - <?php - } -}
\ No newline at end of file +if ((isadminloggedin()) || (!$user->isBanned())) { +?> + <a href="<?php echo $user->getURL(); ?>" class="icon" > +<?php +} + +// Rounded avatar corners - CSS3 method +// users avatar as background image so we can clip it with border-radius in supported browsers +echo $icon; + +if ((isadminloggedin()) || (!$user->isBanned())) { +?> + </a> +<?php +} +?> +</div> |