Example #1
0
 /**
  * Displays the information of an individual user
  * @param int $user_id
  */
 public static function display_individual_user($user_id)
 {
     global $interbreadcrumb;
     $safe_user_id = intval($user_id);
     $currentUserId = api_get_user_id();
     $user_table = Database::get_main_table(TABLE_MAIN_USER);
     $sql = "SELECT * FROM {$user_table} WHERE user_id = " . $safe_user_id;
     $result = Database::query($sql);
     $html = null;
     if (Database::num_rows($result) == 1) {
         $user_object = Database::fetch_object($result);
         $userInfo = api_get_user_info($user_id);
         $alt = $userInfo['complete_name'] . ($currentUserId == $user_id ? ' (' . get_lang('Me') . ')' : '');
         $status = get_status_from_code($user_object->status);
         $interbreadcrumb[] = array('url' => 'whoisonline.php', 'name' => get_lang('UsersOnLineList'));
         $html .= '<div class ="thumbnail">';
         $fullurl = $userInfo['avatar'];
         $html .= '<img src="' . $fullurl . '" alt="' . $alt . '" />';
         if (!empty($status)) {
             $html .= '<div class="caption">' . $status . '</div>';
         }
         $html .= '</div>';
         if (api_get_setting('display.show_email_addresses') == 'true') {
             $html .= Display::encrypted_mailto_link($user_object->email, $user_object->email) . '<br />';
         }
         if ($user_object->competences) {
             $html .= Display::page_subheader(get_lang('MyCompetences'));
             $html .= '<p>' . $user_object->competences . '</p>';
         }
         if ($user_object->diplomas) {
             $html .= Display::page_subheader(get_lang('MyDiplomas'));
             $html .= '<p>' . $user_object->diplomas . '</p>';
         }
         if ($user_object->teach) {
             $html .= Display::page_subheader(get_lang('MyTeach'));
             $html .= '<p>' . $user_object->teach . '</p>';
         }
         SocialManager::display_productions($user_object->user_id);
         if ($user_object->openarea) {
             $html .= Display::page_subheader(get_lang('MyPersonalOpenArea'));
             $html .= '<p>' . $user_object->openarea . '</p>';
         }
     } else {
         $html .= '<div class="actions-title">';
         $html .= get_lang('UsersOnLineList');
         $html .= '</div>';
     }
     return $html;
 }
Example #2
0
function api_get_roles_to_string($roles)
{
    $role_names = array();
    if (!empty($roles)) {
        foreach ($roles as $role) {
            $role_names[] = get_status_from_code($role);
        }
    }
    if (!empty($role_names)) {
        return implode(', ', $role_names);
    }
    return null;
}
Example #3
0
    /**
     * Displays the information of an individual user
     * @param int $user_id
     */
    public static function display_individual_user($user_id)
    {
        global $interbreadcrumb;
        $safe_user_id = intval($user_id);

        $user_table = Database::get_main_table(TABLE_MAIN_USER);
        $sql = "SELECT * FROM $user_table WHERE user_id = ".$safe_user_id;
        $result = Database::query($sql);
        $html = null;
        if (Database::num_rows($result) == 1) {
            $user_object = Database::fetch_object($result);
            $alt = GetFullUserName($user_id).($_SESSION['_uid'] == $user_id ? '&nbsp;('.get_lang('Me').')' : '');
            $status = get_status_from_code($user_object->status);
            $interbreadcrumb[] = array('url' => 'whoisonline.php', 'name' => get_lang('UsersOnLineList'));

            $html .= '<div class ="thumbnail">';
            if (strlen(trim($user_object->picture_uri)) > 0) {
                $sysdir_array = UserManager::get_user_picture_path_by_id($safe_user_id, 'system');
                $sysdir = $sysdir_array['dir'];
                $webdir_array = UserManager::get_user_picture_path_by_id($safe_user_id, 'web');
                $webdir = $webdir_array['dir'];
                $fullurl = $webdir.$user_object->picture_uri;
                $system_image_path = $sysdir.$user_object->picture_uri;
                list($width, $height, $type, $attr) = @getimagesize($system_image_path);
                $height += 30;
                $width += 30;
                // get the path,width and height from original picture
                $big_image = $webdir.'big_'.$user_object->picture_uri;
                $big_image_size = api_getimagesize($big_image);
                $big_image_width = $big_image_size['width'];
                $big_image_height = $big_image_size['height'];
                $url_big_image = $big_image.'?rnd='.time();
                //echo '<a href="javascript:void()" onclick="javascript: return show_image(\''.$url_big_image.'\',\''.$big_image_width.'\',\''.$big_image_height.'\');" >';
                $html .= '<img src="'.$fullurl.'" alt="'.$alt.'" />';
            } else {
                $html .= Display::return_icon('unknown.jpg', get_lang('Unknown'));
            }
            if (!empty($status)) {
                $html .= '<div class="caption">'.$status.'</div>';
            }
            $html .= '</div>';

            if (api_get_setting('show_email_addresses') == 'true') {
                $html .= Display::encrypted_mailto_link($user_object->email, $user_object->email).'<br />';
            }

            if ($user_object->competences) {
                $html .= Display::page_subheader(get_lang('MyCompetences'));
                $html .= '<p>'.$user_object->competences.'</p>';
            }
            if ($user_object->diplomas) {
                $html .= Display::page_subheader(get_lang('MyDiplomas'));
                $html .= '<p>'.$user_object->diplomas.'</p>';
            }
            if ($user_object->teach) {
                $html .= Display::page_subheader(get_lang('MyTeach'));
                $html .= '<p>'.$user_object->teach.'</p>';
            }
            SocialManager::display_productions($user_object->user_id);
            if ($user_object->openarea) {
                $html .= Display::page_subheader(get_lang('MyPersonalOpenArea'));
                $html .= '<p>'.$user_object->openarea.'</p>';
            }
        } else {
            $html .= '<div class="actions-title">';
            $html .= get_lang('UsersOnLineList');
            $html .= '</div>';
        }

        return $html;
    }