Esempio n. 1
0
 /**
  * Display the widget!
  *
  * @param array MUST contain at least the basic display params
  */
 function display($params)
 {
     if (!is_logged_in()) {
         // Only logged in users can see this tools panel
         return false;
     }
     $this->init_display($params);
     // just in case it hasn't been done before
     $this->disp_params['item_start'] .= '<strong>';
     $this->disp_params['item_end'] = '</strong>' . $this->disp_params['item_end'];
     $tools_links = '';
     if ($this->get_param('user_postnew_link_show')) {
         // Write new post - disp=edit
         $tools_links .= get_item_new_link($this->disp_params['item_start'], $this->disp_params['item_end'], $this->disp_params['user_postnew_link']);
     }
     if ($this->get_param('user_messaging_link_show')) {
         // Messaging - disp=threads
         $tools_links .= get_user_messaging_link($this->disp_params['item_start'], $this->disp_params['item_end'], $this->disp_params['user_messaging_link'], $this->disp_params['user_messaging_link'], $this->disp_params['show_badge']);
     }
     if ($this->get_param('user_contacts_link_show')) {
         // Contacts - disp=contacts
         $tools_links .= get_user_contacts_link($this->disp_params['item_start'], $this->disp_params['item_end'], $this->disp_params['user_contacts_link'], $this->disp_params['user_contacts_link']);
     }
     if ($this->get_param('user_view_link_show')) {
         // See profile - disp=user
         $tools_links .= get_user_tab_link('user', $this->disp_params['item_start'], $this->disp_params['item_end'], $this->disp_params['user_view_link'], $this->disp_params['user_view_link']);
     }
     if ($this->get_param('user_profile_link_show')) {
         // Edit profile - disp=profile
         $tools_links .= get_user_profile_link($this->disp_params['item_start'], $this->disp_params['item_end'], $this->disp_params['user_profile_link'], $this->disp_params['user_profile_link']);
     }
     if ($this->get_param('user_picture_link_show')) {
         // Edit picture - disp=avatar
         $tools_links .= get_user_tab_link('avatar', $this->disp_params['item_start'], $this->disp_params['item_end'], $this->disp_params['user_picture_link'], $this->disp_params['user_picture_link']);
     }
     if ($this->get_param('user_password_link_show')) {
         // Edit password - disp=pwdchange
         $tools_links .= get_user_tab_link('pwdchange', $this->disp_params['item_start'], $this->disp_params['item_end'], $this->disp_params['user_password_link'], $this->disp_params['user_password_link']);
     }
     if ($this->get_param('user_preferences_link_show')) {
         // Edit preferences - disp=userprefs
         $tools_links .= get_user_tab_link('userprefs', $this->disp_params['item_start'], $this->disp_params['item_end'], $this->disp_params['user_preferences_link'], $this->disp_params['user_preferences_link']);
     }
     if ($this->get_param('user_subs_link_show')) {
         // Edit notifications - disp=subs
         $tools_links .= get_user_subs_link($this->disp_params['item_start'], $this->disp_params['item_end'], $this->disp_params['user_subs_link'], $this->disp_params['user_subs_link']);
     }
     if ($this->get_param('user_admin_link_show')) {
         // Admin
         $tools_links .= get_user_admin_link($this->disp_params['item_start'], $this->disp_params['item_end'], $this->disp_params['user_admin_link']);
     }
     if ($this->get_param('user_logout_link_show')) {
         // Logout
         $tools_links .= get_user_logout_link($this->disp_params['item_start'], $this->disp_params['item_end'], $this->disp_params['user_logout_link']);
     }
     if (empty($tools_links)) {
         // No available links to display
         return false;
     }
     // User tools:
     echo $this->disp_params['block_start'];
     if (!empty($this->disp_params['title'])) {
         // Display title
         echo $this->disp_params['block_title_start'];
         echo $this->disp_params['title'];
         echo $this->disp_params['block_title_end'];
     }
     echo $this->disp_params['list_start'];
     echo $tools_links;
     if (isset($this->BlockCache)) {
         // Do NOT cache because some of these links are using a redirect_to param, which makes it page dependent.
         // Note: also beware of the source param.
         // so this will be cached by the PageCache; there is no added benefit to cache it in the BlockCache
         // (which could have been shared between several pages):
         $this->BlockCache->abort_collect();
     }
     echo $this->disp_params['list_end'];
     echo $this->disp_params['block_end'];
 }
Esempio n. 2
0
/**
 * Template tag: Output a link to the backoffice.
 *
 * Usually provided in skins in order for newbies to find the admin interface more easily...
 *
 * @param string To be displayed before the link.
 * @param string To be displayed after the link.
 * @param string The page/controller to link to inside of {@link $admin_url}
 * @param string Text for the link.
 * @param string Title for the link.
 */
function user_admin_link($before = '', $after = '', $link_text = '', $link_title = '#', $not_visible = '')
{
    echo get_user_admin_link($before, $after, $link_text, $link_title, $not_visible);
}