Ejemplo n.º 1
0
 /**
  * Get the profile edition link for a user
  * @param int $userId The user id
  * @param boolean $asAdmin Optional. Whether get the URL for the platform admin
  * @return string The link
  */
 public static function getProfileEditionLink($userId, $asAdmin = false)
 {
     $editProfileUrl = api_get_path(WEB_CODE_PATH) . 'auth/profile.php';
     if ($asAdmin) {
         $editProfileUrl = api_get_path(WEB_CODE_PATH) . "admin/user_edit.php?user_id=" . intval($userId);
     }
     if (api_get_setting('sso_authentication') === 'true') {
         $subSSOClass = api_get_setting('sso_authentication_subclass');
         $objSSO = null;
         if (!empty($subSSOClass)) {
             require_once api_get_path(SYS_CODE_PATH) . "auth/sso/sso.{$subSSOClass}.class.php";
             $subSSOClass = 'sso' . $subSSOClass;
             $objSSO = new $subSSOClass();
         } else {
             $objSSO = new sso();
         }
         $editProfileUrl = $objSSO->generateProfileEditingURL($userId, $asAdmin);
     }
     return $editProfileUrl;
 }
Ejemplo n.º 2
0
    function return_profile_block()
    {
        global $_configuration;
        $user_id = api_get_user_id();

        if (empty($user_id)) {
            return;
        }

        $profile_content = '<ul class="nav nav-list">';

        //  @todo Add a platform setting to add the user image.
        if (api_get_setting('allow_message_tool') == 'true') {
            require_once api_get_path(LIBRARY_PATH).'group_portal_manager.lib.php';

            // New messages.
            $number_of_new_messages             = MessageManager::get_new_messages();
            // New contact invitations.
            $number_of_new_messages_of_friend   = SocialManager::get_message_number_invitation_by_user_id(api_get_user_id());

            // New group invitations sent by a moderator.
            $group_pending_invitations = GroupPortalManager::get_groups_by_user(api_get_user_id(), GROUP_USER_PERMISSION_PENDING_INVITATION, false);
            $group_pending_invitations = count($group_pending_invitations);

            $total_invitations = $number_of_new_messages_of_friend + $group_pending_invitations;
            $cant_msg = Display::badge($number_of_new_messages);

            $link = '';
            if (api_get_setting('allow_social_tool') == 'true') {
                $link = '?f=social';
            }
            $profile_content .= '<li class="inbox-social"><a href="'.api_get_path(WEB_PATH).'main/messages/inbox.php'.$link.'">'.get_lang('Inbox').$cant_msg.' </a></li>';
            $profile_content .= '<li class="new-message-social"><a href="'.api_get_path(WEB_PATH).'main/messages/new_message.php'.$link.'">'.get_lang('Compose').' </a></li>';

            if (api_get_setting('allow_social_tool') == 'true') {
                $total_invitations = Display::badge($total_invitations);
                $profile_content .= '<li class="invitations-social"><a href="'.api_get_path(WEB_PATH).'main/social/invitations.php">'.get_lang('PendingInvitations').$total_invitations.'</a></li>';
            }

            if (isset($_configuration['allow_my_files_link_in_homepage']) && $_configuration['allow_my_files_link_in_homepage']) {
                $profile_content .= '<li class="myfiles-social"><a href="'.api_get_path(WEB_PATH).'main/social/myfiles.php">'.get_lang('MyFiles').'</a></li>';
            }
        }

        $editProfileUrl = api_get_path(WEB_CODE_PATH) . 'auth/profile.php';

        if (api_get_setting('sso_authentication') === 'true') {
            $subSSOClass = api_get_setting('sso_authentication_subclass');
            $objSSO = null;

            if (!empty($subSSOClass)) {
                require_once api_get_path(SYS_CODE_PATH) . 'auth/sso/sso.' . $subSSOClass . '.class.php';

                $subSSOClass = 'sso' . $subSSOClass;
                $objSSO = new $subSSOClass();
            } else {
                $objSSO = new sso();
            }

            $editProfileUrl = $objSSO->generateProfileEditingURL();
        }

        $profile_content .= '<li class="profile-social"><a href="' . $editProfileUrl . '">'.get_lang('EditProfile').'</a></li>';
        $profile_content .= '</ul>';
        $html = self::show_right_block(get_lang('Profile'), $profile_content, 'profile_block');
        return $html;
    }
Ejemplo n.º 3
0
$editProfileUrl = api_get_path(WEB_CODE_PATH) . 'auth/profile.php';

if (api_get_setting('sso_authentication') === 'true') {
    $subSSOClass = api_get_setting('sso_authentication_subclass');
    $objSSO = null;

    if (!empty($subSSOClass)) {
        require_once api_get_path(SYS_CODE_PATH) . 'auth/sso/sso.' . $subSSOClass . '.class.php';

        $subSSOClass = 'sso' . $subSSOClass;
        $objSSO = new $subSSOClass();
    } else {
        $objSSO = new sso();
    }

    $editProfileUrl = $objSSO->generateProfileEditingURL();
}

$socialRightContent .= '
    <div class="form-actions">
    <a class="btn" href="' . $editProfileUrl . '">
        ' . get_lang('EditProfile') . '
    </a>
    </div></div></div>';
$socialRightInformation = '<div class="span4">';
if (api_get_setting('allow_skills_tool') == 'true') {
    $socialRightInformation .= '<div class="well_border">';
    $skill = new Skill();
    $ranking = $skill->get_user_skill_ranking(api_get_user_id());
    $url = api_get_path(WEB_CODE_PATH) . 'social/skills_ranking.php';
    $ranking_url = Display::url(