当前位置: 首页>>代码示例>>PHP>>正文


PHP UserGroup::get_groups_by_user方法代码示例

本文整理汇总了PHP中UserGroup::get_groups_by_user方法的典型用法代码示例。如果您正苦于以下问题:PHP UserGroup::get_groups_by_user方法的具体用法?PHP UserGroup::get_groups_by_user怎么用?PHP UserGroup::get_groups_by_user使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在UserGroup的用法示例。


在下文中一共展示了UserGroup::get_groups_by_user方法的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: header

            Display::addFlash(Display::return_message(get_lang('InvitationSent')));
        }
        header('Location: ' . api_get_self() . '?id=' . $group_id);
        exit;
    }
}
$nosessionUsersList = $sessionUsersList = array();
$order_clause = api_sort_by_first_name() ? ' ORDER BY firstname, lastname, username' : ' ORDER BY lastname, firstname, username';
$friends = SocialManager::get_friends(api_get_user_id());
$suggest_friends = false;
$Users = array();
if (!$friends) {
    $suggest_friends = true;
} else {
    foreach ($friends as $friend) {
        $group_friend_list = $usergroup->get_groups_by_user($friend['friend_user_id'], 0);
        if (!empty($group_friend_list)) {
            $friend_group_id = '';
            if (isset($group_friend_list[$group_id]) && $group_friend_list[$group_id]['id'] == $group_id) {
                $friend_group_id = $group_id;
            }
            if (!isset($group_friend_list[$group_id]) || isset($group_friend_list[$group_id]) && $group_friend_list[$group_id]['relation_type'] == '') {
                $Users[$friend['friend_user_id']] = array('user_id' => $friend['friend_user_id'], 'firstname' => $friend['firstName'], 'lastname' => $friend['lastName'], 'username' => $friend['username'], 'group_id' => $friend_group_id);
            }
        } else {
            $Users[$friend['friend_user_id']] = array('user_id' => $friend['friend_user_id'], 'firstname' => $friend['firstName'], 'lastname' => $friend['lastName'], 'username' => $friend['username'], 'group_id' => null);
        }
    }
}
if (is_array($Users) && count($Users) > 0) {
    foreach ($Users as $user) {
开发者ID:omaoibrahim,项目名称:chamilo-lms,代码行数:31,代码来源:group_invitation.php

示例2: array

                     }
                     break;
             }
         }
     }
     // if there are information to show
     if (!empty($extra_information_value)) {
         $extra_information .= Display::panel($extra_information_value, get_lang('ExtraInformation'));
     }
 }
 // If there are information to show Block Extra Information
 if (!empty($extra_information_value)) {
     $social_extra_info_block = $extra_information;
 }
 // MY GROUPS
 $results = $userGroup->get_groups_by_user($my_user_id, 0);
 $grid_my_groups = array();
 $max_numbers_of_group = 4;
 if (is_array($results) && count($results) > 0) {
     $i = 1;
     foreach ($results as $result) {
         if ($i > $max_numbers_of_group) {
             break;
         }
         $id = $result['id'];
         $url_open = '<a href="group_view.php?id=' . $id . '">';
         $url_close = '</a>';
         $icon = '';
         $name = cut($result['name'], CUT_GROUP_NAME, true);
         if ($result['relation_type'] == GROUP_USER_PERMISSION_ADMIN) {
             $icon = Display::return_icon('social_group_admin.png', get_lang('Admin'), array('style' => 'vertical-align:middle;width:16px;height:16px;'));
开发者ID:KRCM13,项目名称:chamilo-lms,代码行数:31,代码来源:profile.php

示例3: display_all_announcements

    /**
     * @param $visible
     * @param $id
     * @param int $start
     * @param string $user_id
     * @return string
     */
    public static function display_all_announcements($visible, $id = -1, $start = 0, $user_id = '')
    {
        $user_selected_language = api_get_interface_language();
        $start = intval($start);
        $userGroup = new UserGroup();
        $tbl_announcement_group = Database::get_main_table(TABLE_MAIN_SYSTEM_ANNOUNCEMENTS_GROUPS);
        $temp_user_groups = $userGroup->get_groups_by_user(api_get_user_id(), 0);
        $groups = array();
        foreach ($temp_user_groups as $user_group) {
            $groups = array_merge($groups, array($user_group['id']));
            $groups = array_merge($groups, $userGroup->get_parent_groups($user_group['id']));
        }
        // Checks if tables exists to not break platform not updated
        $groups_string = '(' . implode($groups, ',') . ')';
        $db_table = Database::get_main_table(TABLE_MAIN_SYSTEM_ANNOUNCEMENTS);
        $now = api_get_utc_datetime();
        $sql = "SELECT * FROM " . $db_table . "\n\t\t\t\tWHERE\n\t\t\t\t    (lang = '{$user_selected_language}' OR lang IS NULL) AND\n\t\t\t\t    ( '{$now}' >= date_start AND '{$now}' <= date_end) ";
        switch ($visible) {
            case self::VISIBLE_GUEST:
                $sql .= " AND visible_guest = 1 ";
                break;
            case self::VISIBLE_STUDENT:
                $sql .= " AND visible_student = 1 ";
                break;
            case self::VISIBLE_TEACHER:
                $sql .= " AND visible_teacher = 1 ";
                break;
        }
        if (count($groups) > 0) {
            $sql .= " OR id IN (\n                    SELECT announcement_id FROM {$tbl_announcement_group}\n                    WHERE group_id in {$groups_string}\n                    ) ";
        }
        if (api_is_multiple_url_enabled()) {
            $current_access_url_id = api_get_current_access_url_id();
            $sql .= " AND access_url_id IN ('1', '{$current_access_url_id}')";
        }
        if (!isset($_GET['start']) || $_GET['start'] == 0) {
            $sql .= " ORDER BY date_start DESC LIMIT " . $start . ",20";
        } else {
            $sql .= " ORDER BY date_start DESC LIMIT " . ($start + 1) . ",20";
        }
        $announcements = Database::query($sql);
        $content = '';
        if (Database::num_rows($announcements) > 0) {
            $query_string = ereg_replace('announcement=[1-9]+', '', $_SERVER['QUERY_STRING']);
            $query_string = ereg_replace('&$', '', $query_string);
            $url = api_get_self();
            $content .= '<div class="system_announcements">';
            $content .= '<h3>' . get_lang('SystemAnnouncements') . '</h3>';
            $content .= '<table align="center">';
            $content .= '<tr>';
            $content .= '<td>';
            $content .= SystemAnnouncementManager::display_arrow($user_id);
            $content .= '</td>';
            $content .= '</tr>';
            $content .= '</table>';
            $content .= '<table align="center" border="0" width="900px">';
            while ($announcement = Database::fetch_object($announcements)) {
                $display_date = api_convert_and_format_date($announcement->display_date, DATE_FORMAT_LONG);
                $content .= '<tr><td>';
                $content .= '<a name="' . $announcement->id . '"></a>
						<div class="system_announcement">
						<h2>' . $announcement->title . '</h2><div class="system_announcement_date">' . $display_date . '</div>
						<br />
					  	<div class="system_announcement_content">' . $announcement->content . '
						</div>
					  </div><br />';
                $content .= '</tr></td>';
            }
            $content .= '</table>';
            $content .= '<table align="center">';
            $content .= '<tr>';
            $content .= '<td>';
            $content .= SystemAnnouncementManager::display_arrow($user_id);
            $content .= '</td>';
            $content .= '</tr>';
            $content .= '</table>';
            $content .= '</div>';
        }
        return $content;
    }
开发者ID:KRCM13,项目名称:chamilo-lms,代码行数:87,代码来源:system_announcements.lib.php

示例4: UserGroup

     if (api_is_student_boss()) {
         $columns[] = 'group';
         $column_names[] = get_lang('Group');
     }
     if (!in_array($sidx, array('title'))) {
         $sidx = 'title';
     }
     if (api_is_student_boss() && empty($userIdList)) {
         $result = [];
         break;
     }
     $result = CourseManager::get_user_list_from_course_code(null, null, "LIMIT {$start}, {$limit}", " {$sidx} {$sord}", null, null, true, false, null, $courseCodeList, $userIdList, null, $sessionIdList);
     if (api_is_student_boss()) {
         $userGroup = new UserGroup();
         foreach ($result as &$item) {
             $userGroups = $userGroup->get_groups_by_user($item['user_id']);
             $item['group'] = implode(", ", array_column($userGroups, 'name'));
             unset($item['user_id']);
         }
     }
     break;
 case 'get_user_skill_ranking':
     $columns = array('photo', 'firstname', 'lastname', 'skills_acquired', 'currently_learning', 'rank');
     $result = $skill->get_user_list_skill_ranking($start, $limit, $sidx, $sord, $whereCondition);
     $result = ArrayClass::msort($result, 'skills_acquired', 'asc');
     $skills_in_course = array();
     if (!empty($result)) {
         foreach ($result as &$item) {
             $user_info = api_get_user_info($item['user_id']);
             $personal_course_list = UserManager::get_personal_session_course_list($item['user_id']);
             $count_skill_by_course = array();
开发者ID:jloguercio,项目名称:chamilo-lms,代码行数:31,代码来源:model.ajax.php

示例5: array

    if (!isset($_GET['id'])) {
        $interbreadcrumb[] = array('url' => '#', 'name' => get_lang('GroupList'));
    }
}
// getting group information
$relation_group_title = '';
$my_group_role = 0;
$usergroup = new UserGroup();
$create_thread_link = '';
$show_menu = 'browse_groups';
if (isset($_GET['view']) && $_GET['view'] == 'mygroups') {
    $show_menu = $_GET['view'];
}
$social_right_content = null;
// My groups
$results = $usergroup->get_groups_by_user(api_get_user_id(), 0);
$grid_my_groups = array();
$my_group_list = array();
if (is_array($results) && count($results) > 0) {
    foreach ($results as $result) {
        $id = $result['id'];
        $result['name'] = Security::remove_XSS($result['name'], STUDENT, true);
        $result['description'] = Security::remove_XSS($result['description'], STUDENT, true);
        $my_group_list[] = $id;
        $url_open = '<a href="group_view.php?id=' . $id . '">';
        $url_close = '</a>';
        $name = cut($result['name'], GROUP_TITLE_LENGTH, true);
        if ($result['relation_type'] == GROUP_USER_PERMISSION_ADMIN) {
            $name .= ' ' . Display::return_icon('social_group_admin.png', get_lang('Admin'), array('style' => 'vertical-align:middle'));
        } elseif ($result['relation_type'] == GROUP_USER_PERMISSION_MODERATOR) {
            $name .= ' ' . Display::return_icon('social_group_moderator.png', get_lang('Moderator'), array('style' => 'vertical-align:middle'));
开发者ID:KRCM13,项目名称:chamilo-lms,代码行数:31,代码来源:groups.php

示例6: delete_user


//.........这里部分代码省略.........
     }
     $table_user = Database::get_main_table(TABLE_MAIN_USER);
     $usergroup_rel_user = Database::get_main_table(TABLE_USERGROUP_REL_USER);
     $table_course_user = Database::get_main_table(TABLE_MAIN_COURSE_USER);
     $table_course = Database::get_main_table(TABLE_MAIN_COURSE);
     $table_session = Database::get_main_table(TABLE_MAIN_SESSION);
     $table_admin = Database::get_main_table(TABLE_MAIN_ADMIN);
     $table_session_user = Database::get_main_table(TABLE_MAIN_SESSION_USER);
     $table_session_course_user = Database::get_main_table(TABLE_MAIN_SESSION_COURSE_USER);
     $table_group = Database::get_course_table(TABLE_GROUP_USER);
     $table_work = Database::get_course_table(TABLE_STUDENT_PUBLICATION);
     // Unsubscribe the user from all groups in all his courses
     $sql = "SELECT c.id FROM {$table_course} c, {$table_course_user} cu\n                WHERE\n                    cu.user_id = '" . $user_id . "' AND\n                    relation_type<>" . COURSE_RELATION_TYPE_RRHH . " AND\n                    c.id = cu.c_id";
     $res = Database::query($sql);
     while ($course = Database::fetch_object($res)) {
         $sql = "DELETE FROM {$table_group}\n                    WHERE c_id = {$course->id} AND user_id = {$user_id}";
         Database::query($sql);
     }
     // Unsubscribe user from all classes
     //Classes are not longer supported
     /* $sql = "DELETE FROM $table_class_user WHERE user_id = '".$user_id."'";
        Database::query($sql); */
     // Unsubscribe user from usergroup_rel_user
     $sql = "DELETE FROM {$usergroup_rel_user} WHERE user_id = '" . $user_id . "'";
     Database::query($sql);
     // Unsubscribe user from all courses
     $sql = "DELETE FROM {$table_course_user} WHERE user_id = '" . $user_id . "'";
     Database::query($sql);
     // Unsubscribe user from all courses in sessions
     $sql = "DELETE FROM {$table_session_course_user} WHERE user_id = '" . $user_id . "'";
     Database::query($sql);
     // If the user was added as a id_coach then set the current admin as coach see BT#
     $currentUserId = api_get_user_id();
     $sql = "UPDATE {$table_session} SET id_coach = {$currentUserId}  WHERE id_coach = '" . $user_id . "'";
     Database::query($sql);
     $sql = "UPDATE {$table_session} SET id_coach = {$currentUserId}  WHERE session_admin_id = '" . $user_id . "'";
     Database::query($sql);
     // Unsubscribe user from all sessions
     $sql = "DELETE FROM {$table_session_user} WHERE user_id = '" . $user_id . "'";
     Database::query($sql);
     // Delete user picture
     /* TODO: Logic about api_get_setting('split_users_upload_directory') == 'true'
        a user has 4 different sized photos to be deleted. */
     $user_info = api_get_user_info($user_id);
     if (strlen($user_info['picture_uri']) > 0) {
         $path = self::getUserPathById($user_id, 'system');
         $img_path = $path . $user_info['picture_uri'];
         if (file_exists($img_path)) {
             unlink($img_path);
         }
     }
     // Delete the personal course categories
     $course_cat_table = Database::get_main_table(TABLE_USER_COURSE_CATEGORY);
     $sql = "DELETE FROM {$course_cat_table} WHERE user_id = '" . $user_id . "'";
     Database::query($sql);
     // Delete user from database
     $sql = "DELETE FROM {$table_user} WHERE id = '" . $user_id . "'";
     Database::query($sql);
     // Delete user from the admin table
     $sql = "DELETE FROM {$table_admin} WHERE user_id = '" . $user_id . "'";
     Database::query($sql);
     // Delete the personal agenda-items from this user
     $agenda_table = Database::get_main_table(TABLE_PERSONAL_AGENDA);
     $sql = "DELETE FROM {$agenda_table} WHERE user = '" . $user_id . "'";
     Database::query($sql);
     $gradebook_results_table = Database::get_main_table(TABLE_MAIN_GRADEBOOK_RESULT);
     $sql = 'DELETE FROM ' . $gradebook_results_table . ' WHERE user_id = ' . $user_id;
     Database::query($sql);
     $extraFieldValue = new ExtraFieldValue('user');
     $extraFieldValue->deleteValuesByItem($user_id);
     if (api_get_multiple_access_url()) {
         $url_id = api_get_current_access_url_id();
         UrlManager::delete_url_rel_user($user_id, $url_id);
     } else {
         //we delete the user from the url_id =1
         UrlManager::delete_url_rel_user($user_id, 1);
     }
     if (api_get_setting('allow_social_tool') == 'true') {
         $userGroup = new UserGroup();
         //Delete user from portal groups
         $group_list = $userGroup->get_groups_by_user($user_id);
         if (!empty($group_list)) {
             foreach ($group_list as $group_id => $data) {
                 $userGroup->delete_user_rel_group($user_id, $group_id);
             }
         }
         // Delete user from friend lists
         SocialManager::remove_user_rel_user($user_id, true);
     }
     // Removing survey invitation
     SurveyManager::delete_all_survey_invitations_by_user($user_id);
     // Delete students works
     $sql = "DELETE FROM {$table_work} WHERE user_id = {$user_id} AND c_id <> 0";
     Database::query($sql);
     // Add event to system log
     $user_id_manager = api_get_user_id();
     Event::addEvent(LOG_USER_DELETE, LOG_USER_ID, $user_id, api_get_utc_datetime(), $user_id_manager);
     Event::addEvent(LOG_USER_DELETE, LOG_USER_OBJECT, $user_info, api_get_utc_datetime(), $user_id_manager);
     return true;
 }
开发者ID:secuencia24,项目名称:chamilo-lms,代码行数:101,代码来源:usermanager.lib.php

示例7: count

                }
                break 2;
            case 'deny':
                // delete invitation
                $usergroup->delete_user_rel_group(api_get_user_id(), $value);
                $show_message = Display::return_message(get_lang('GroupInvitationWasDeny'));
                break 2;
        }
    }
}
$social_left_content = SocialManager::show_social_menu('invitations');
$social_right_content = '<div id="id_response" align="center"></div>';
$user_id = api_get_user_id();
$list_get_invitation = SocialManager::get_list_invitation_of_friends_by_user_id($user_id);
$list_get_invitation_sent = SocialManager::get_list_invitation_sent_by_user_id($user_id);
$pending_invitations = $usergroup->get_groups_by_user($user_id, GROUP_USER_PERMISSION_PENDING_INVITATION);
$number_loop = count($list_get_invitation);
$total_invitations = $number_loop + count($list_get_invitation_sent) + count($pending_invitations);
if ($total_invitations == 0 && count($_GET) <= 0) {
    $social_right_content .= '<div class="span8"><a class="btn" href="search.php">' . get_lang('TryAndFindSomeFriends') . '</a></div>';
}
if ($number_loop != 0) {
    $social_right_content .= '<div class="span8">' . Display::page_subheader(get_lang('InvitationReceived')) . '</div>';
    foreach ($list_get_invitation as $invitation) {
        $sender_user_id = $invitation['user_sender_id'];
        $userInfo = api_get_user_info($sender_user_id);
        $social_right_content .= '<div id="id_' . $sender_user_id . '" class="invitation_confirm span8">';
        $picture = UserManager::get_user_picture_path_by_id($sender_user_id, 'web', false, true);
        $friends_profile = SocialManager::get_picture_user($sender_user_id, $picture['file'], 92);
        $title = Security::remove_XSS($invitation['title'], STUDENT, true);
        $content = Security::remove_XSS($invitation['content'], STUDENT, true);
开发者ID:ilosada,项目名称:chamilo-lms-icpna,代码行数:31,代码来源:invitations.php

示例8: set_header_parameters


//.........这里部分代码省略.........
            $resize .= '<a title="' . get_lang('ResetFontSize') . '" href="#" class="reset_font btn btn-default"><em class="fa fa-font"></em></a>';
            $resize .= '<a title="' . get_lang('IncreaseFontSize') . '" href="#" class="increase_font btn btn-default"><em class="fa fa-font"></em></a>';
            $resize .= '</div>';
            $resize .= '</div>';
        }
        $this->assign('accessibility', $resize);
        // Preparing values for the menu
        // Logout link
        $hideLogout = api_get_setting('hide_logout_button');
        if ($hideLogout === 'true') {
            $this->assign('logout_link', null);
        } else {
            $this->assign('logout_link', api_get_path(WEB_PATH) . 'index.php?logout=logout&uid=' . api_get_user_id());
        }
        //Profile link
        if (api_get_setting('social.allow_social_tool') == 'true') {
            $profile_url = api_get_path(WEB_CODE_PATH) . 'social/home.php';
            $profile_link = Display::url(get_lang('Profile'), $profile_url);
        } else {
            $profile_url = api_get_path(WEB_CODE_PATH) . 'auth/profile.php';
            $profile_link = Display::url(get_lang('Profile'), $profile_url);
        }
        $this->assign('profile_link', $profile_link);
        $this->assign('profile_url', $profile_url);
        //Message link
        $message_link = null;
        $message_url = null;
        if (api_get_setting('message.allow_message_tool') == 'true') {
            $message_url = api_get_path(WEB_CODE_PATH) . 'messages/inbox.php';
            $message_link = '<a href="' . api_get_path(WEB_CODE_PATH) . 'messages/inbox.php">' . get_lang('Inbox') . '</a>';
        }
        $this->assign('message_link', $message_link);
        $this->assign('message_url', $message_url);
        $institution = api_get_setting('platform.institution');
        $portal_name = empty($institution) ? api_get_setting('platform.site_name') : $institution;
        $this->assign('portal_name', $portal_name);
        //Menu
        $menu = return_menu();
        $this->assign('menu', $menu);
        // Setting notifications
        $count_unread_message = 0;
        if (api_get_setting('message.allow_message_tool') == 'true') {
            // get count unread message and total invitations
            $count_unread_message = MessageManager::get_number_of_messages(true);
        }
        $total_invitations = 0;
        if (api_get_setting('social.allow_social_tool') == 'true') {
            $number_of_new_messages_of_friend = SocialManager::get_message_number_invitation_by_user_id(api_get_user_id());
            $usergroup = new UserGroup();
            $group_pending_invitations = $usergroup->get_groups_by_user(api_get_user_id(), GROUP_USER_PERMISSION_PENDING_INVITATION, false);
            if (!empty($group_pending_invitations)) {
                $group_pending_invitations = count($group_pending_invitations);
            } else {
                $group_pending_invitations = 0;
            }
            $total_invitations = intval($number_of_new_messages_of_friend) + $group_pending_invitations + intval($count_unread_message);
        }
        $total_invitations = !empty($total_invitations) ? Display::badge($total_invitations) : null;
        $this->assign('user_notifications', $total_invitations);
        // Block Breadcrumb
        $breadcrumb = return_breadcrumb($interbreadcrumb, $language_file, $nameTools);
        $this->assign('breadcrumb', $breadcrumb);
        //Extra content
        $extra_header = null;
        if (!api_is_platform_admin()) {
            $extra_header = trim(api_get_setting('header_extra_content'));
        }
        $this->assign('header_extra_content', $extra_header);
        if ($sendHeaders) {
            header('Content-Type: text/html; charset=' . api_get_system_encoding());
            header('X-Powered-By: ' . $_configuration['software_name'] . ' ' . substr($_configuration['system_version'], 0, 1));
        }
        $socialMeta = '';
        $metaTitle = api_get_setting('meta_title');
        if (!empty($metaTitle)) {
            $socialMeta .= '<meta name="twitter:card" content="summary" />' . "\n";
            $socialMeta .= '<meta property="og:title" content="' . $metaTitle . '" />' . "\n";
            $socialMeta .= '<meta property="og:url" content="' . api_get_path(WEB_PATH) . '" />' . "\n";
            $metaDescription = api_get_setting('meta_description');
            if (!empty($metaDescription)) {
                $socialMeta .= '<meta property="og:description" content="' . $metaDescription . '" />' . "\n";
            }
            $metaSite = api_get_setting('meta_twitter_site');
            if (!empty($metaSite)) {
                $socialMeta .= '<meta name="twitter:site" content="' . $metaSite . '" />' . "\n";
                $metaCreator = api_get_setting('meta_twitter_creator');
                if (!empty($metaCreator)) {
                    $socialMeta .= '<meta name="twitter:creator" content="' . $metaCreator . '" />' . "\n";
                }
            }
            $metaImage = api_get_setting('meta_image_path');
            if (!empty($metaImage)) {
                if (is_file(api_get_path(SYS_PATH) . $metaImage)) {
                    $path = api_get_path(WEB_PATH) . $metaImage;
                    $socialMeta .= '<meta property="og:image" content="' . $path . '" />' . "\n";
                }
            }
        }
        $this->assign('social_meta', $socialMeta);
    }
开发者ID:omaoibrahim,项目名称:chamilo-lms,代码行数:101,代码来源:template.lib.php

示例9: return_profile_block

 /**
  * @return null|string|void
  */
 public function return_profile_block()
 {
     global $_configuration;
     $user_id = api_get_user_id();
     if (empty($user_id)) {
         return;
     }
     $userGroup = new UserGroup();
     $profile_content = '<ul class="nav nav-pills nav-stacked">';
     //  @todo Add a platform setting to add the user image.
     if (api_get_setting('message.allow_message_tool') == 'true') {
         // 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 = $userGroup->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('social.allow_social_tool') == 'true') {
             $link = '?f=social';
         }
         $profile_content .= '<li class="inbox-message-social"><a href="' . api_get_path(WEB_PATH) . 'main/messages/inbox.php' . $link . '">' . Display::return_icon('inbox.png', get_lang('Inbox'), null, ICON_SIZE_SMALL) . 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 . '">' . Display::return_icon('new-message.png', get_lang('Compose'), null, ICON_SIZE_SMALL) . get_lang('Compose') . ' </a></li>';
         if (api_get_setting('social.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">' . Display::return_icon('invitations.png', get_lang('PendingInvitations'), null, ICON_SIZE_SMALL) . 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 = Display::getProfileEditionLink($user_id);
     $profile_content .= '<li class="profile-social"><a href="' . $editProfileUrl . '">' . Display::return_icon('edit-profile.png', get_lang('EditProfile'), null, ICON_SIZE_SMALL) . get_lang('EditProfile') . '</a></li>';
     $profile_content .= '</ul>';
     $html = self::show_right_block(get_lang('Profile'), $profile_content, 'profile_block', null, 'profile', 'profileCollapse');
     return $html;
 }
开发者ID:omaoibrahim,项目名称:chamilo-lms,代码行数:43,代码来源:userportal.lib.php

示例10: show_social_menu

 /**
  * Shows the right menu of the Social Network tool
  *
  * @param string $show highlight link possible values:
  * group_add,
  * home,
  * messages,
  * messages_inbox,
  * messages_compose ,
  * messages_outbox,
  * invitations,
  * shared_profile,
  * friends,
  * groups search
  * @param int $group_id group id
  * @param int $user_id user id
  * @param bool $show_full_profile show profile or not (show or hide the user image/information)
  * @param bool $show_delete_account_button
  *
  */
 public static function show_social_menu($show = '', $group_id = 0, $user_id = 0, $show_full_profile = false, $show_delete_account_button = false)
 {
     if (empty($user_id)) {
         $user_id = api_get_user_id();
     }
     $usergroup = new UserGroup();
     $user_info = api_get_user_info($user_id, true);
     $current_user_id = api_get_user_id();
     $current_user_info = api_get_user_info($current_user_id, true);
     if ($current_user_id == $user_id) {
         $user_friend_relation = null;
     } else {
         $user_friend_relation = SocialManager::get_relation_between_contacts($current_user_id, $user_id);
     }
     $show_groups = array('groups', 'group_messages', 'messages_list', 'group_add', 'mygroups', 'group_edit', 'member_list', 'invite_friends', 'waiting_list', 'browse_groups');
     // get count unread message and total invitations
     $count_unread_message = MessageManager::get_number_of_messages(true);
     $count_unread_message = !empty($count_unread_message) ? Display::badge($count_unread_message) : null;
     $number_of_new_messages_of_friend = SocialManager::get_message_number_invitation_by_user_id(api_get_user_id());
     $group_pending_invitations = $usergroup->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;
     $total_invitations = !empty($total_invitations) ? Display::badge($total_invitations) : '';
     $filesIcon = Display::return_icon('sn-files.png', get_lang('MyFiles'), '', ICON_SIZE_SMALL);
     $friendsIcon = Display::return_icon('sn-friends.png', get_lang('Friends'), '', ICON_SIZE_SMALL);
     $groupsIcon = Display::return_icon('sn-groups.png', get_lang('SocialGroups'), '', ICON_SIZE_SMALL);
     $homeIcon = Display::return_icon('sn-home.png', get_lang('Home'), '', ICON_SIZE_SMALL);
     $invitationsIcon = Display::return_icon('sn-invitations.png', get_lang('Invitations'), '', ICON_SIZE_SMALL);
     $messagesIcon = Display::return_icon('sn-message.png', get_lang('Messages'), '', ICON_SIZE_SMALL);
     $sharedProfileIcon = Display::return_icon('sn-profile.png', get_lang('ViewMySharedProfile'));
     $searchIcon = Display::return_icon('sn-search.png', get_lang('Search'), '', ICON_SIZE_SMALL);
     $html = '';
     $active = null;
     if (!in_array($show, array('shared_profile', 'groups', 'group_edit', 'member_list', 'waiting_list', 'invite_friends'))) {
         $links = '<ul class="nav nav-pills nav-stacked">';
         $active = $show == 'home' ? 'active' : null;
         $links .= '
             <li class="home-icon ' . $active . '">
                 <a href="' . api_get_path(WEB_CODE_PATH) . 'social/home.php">
                     ' . $homeIcon . ' ' . get_lang('Home') . '
                 </a>
             </li>';
         $active = $show == 'messages' ? 'active' : null;
         $links .= '
             <li class="messages-icon ' . $active . '">
                 <a href="' . api_get_path(WEB_CODE_PATH) . 'messages/inbox.php?f=social">
                     ' . $messagesIcon . ' ' . get_lang('Messages') . $count_unread_message . '
                 </a>
             </li>';
         //Invitations
         $active = $show == 'invitations' ? 'active' : null;
         $links .= '
             <li class="invitations-icon ' . $active . '">
                 <a href="' . api_get_path(WEB_CODE_PATH) . 'social/invitations.php">
                     ' . $invitationsIcon . ' ' . get_lang('Invitations') . $total_invitations . '
                 </a>
             </li>';
         //Shared profile and groups
         $active = $show == 'shared_profile' ? 'active' : null;
         $links .= '
             <li class="shared-profile-icon' . $active . '">
                 <a href="' . api_get_path(WEB_CODE_PATH) . 'social/profile.php">
                     ' . $sharedProfileIcon . ' ' . get_lang('ViewMySharedProfile') . '
                 </a>
             </li>';
         $active = $show == 'friends' ? 'active' : null;
         $links .= '
             <li class="friends-icon ' . $active . '">
                 <a href="' . api_get_path(WEB_CODE_PATH) . 'social/friends.php">
                     ' . $friendsIcon . ' ' . get_lang('Friends') . '
                 </a>
             </li>';
         $active = $show == 'browse_groups' ? 'active' : null;
         $links .= '
             <li class="browse-groups-icon ' . $active . '">
                 <a href="' . api_get_path(WEB_CODE_PATH) . 'social/groups.php">
                     ' . $groupsIcon . ' ' . get_lang('SocialGroups') . '
                 </a>
             </li>';
         //Search users
//.........这里部分代码省略.........
开发者ID:jloguercio,项目名称:chamilo-lms,代码行数:101,代码来源:social.lib.php

示例11: show_social_menu

 /**
  * Shows the right menu of the Social Network tool
  *
  * @param string highlight link possible values: group_add, home, messages, messages_inbox, messages_compose ,messages_outbox ,invitations, shared_profile, friends, groups search
  * @param int group id
  * @param int user id
  * @param bool show profile or not (show or hide the user image/information)
  *
  */
 public static function show_social_menu($show = '', $group_id = 0, $user_id = 0, $show_full_profile = false, $show_delete_account_button = false)
 {
     if (empty($user_id)) {
         $user_id = api_get_user_id();
     }
     $usergroup = new UserGroup();
     $user_info = api_get_user_info($user_id, true);
     $current_user_id = api_get_user_id();
     $current_user_info = api_get_user_info($current_user_id, true);
     if ($current_user_id == $user_id) {
         $user_friend_relation = null;
     } else {
         $user_friend_relation = SocialManager::get_relation_between_contacts($current_user_id, $user_id);
     }
     $show_groups = array('groups', 'group_messages', 'messages_list', 'group_add', 'mygroups', 'group_edit', 'member_list', 'invite_friends', 'waiting_list', 'browse_groups');
     // get count unread message and total invitations
     $count_unread_message = MessageManager::get_number_of_messages(true);
     $count_unread_message = !empty($count_unread_message) ? Display::badge($count_unread_message) : '';
     $number_of_new_messages_of_friend = SocialManager::get_message_number_invitation_by_user_id(api_get_user_id());
     $group_pending_invitations = $usergroup->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;
     $total_invitations = !empty($total_invitations) ? Display::badge($total_invitations) : '';
     $html = '<div class="social-menu">';
     if (in_array($show, $show_groups) && !empty($group_id)) {
         //--- Group image
         $group_info = $usergroup->get($group_id);
         $big = $usergroup->get_picture_group($group_id, $group_info['picture'], 160, GROUP_IMAGE_SIZE_BIG);
         $html .= '<div class="social-content-image">';
         $html .= '<div class="well social-background-content">';
         $html .= Display::url('<img src=' . $big['file'] . ' class="social-groups-image" /> </a><br /><br />', api_get_path(WEB_PATH) . 'main/social/groups.php?id=' . $group_id);
         if ($usergroup->is_group_admin($group_id, api_get_user_id())) {
             $html .= '<div id="edit_image" class="hidden_message" style="display:none"><a href="' . api_get_path(WEB_PATH) . 'main/social/group_edit.php?id=' . $group_id . '">' . get_lang('EditGroup') . '</a></div>';
         }
         $html .= '</div>';
         $html .= '</div>';
     } else {
         $img_array = UserManager::get_user_picture_path_by_id($user_id, 'web', true, true);
         $big_image = UserManager::get_picture_user($user_id, $img_array['file'], '', USER_IMAGE_SIZE_BIG);
         $big_image = $big_image['file'];
         $normal_image = $img_array['dir'] . $img_array['file'];
         //--- User image
         $html .= '<div class="well social-background-content">';
         if ($img_array['file'] != 'unknown.jpg') {
             $html .= '<a class="thumbnail ajax" href="' . $big_image . '"><img src=' . $normal_image . ' /> </a>';
         } else {
             $html .= '<img src=' . $normal_image . ' width="110px" />';
         }
         if (api_get_user_id() == $user_id) {
             $html .= '<div id="edit_image" class="hidden_message" style="display:none">';
             $html .= '<a href="' . api_get_path(WEB_PATH) . 'main/auth/profile.php">' . get_lang('EditProfile') . '</a></div>';
         }
         $html .= '</div>';
     }
     if (!in_array($show, array('shared_profile', 'groups', 'group_edit', 'member_list', 'waiting_list', 'invite_friends'))) {
         $html .= '<div class="well sidebar-nav"><ul class="nav nav-list">';
         $active = $show == 'home' ? 'active' : null;
         $html .= '<li class="' . $active . '"><a href="' . api_get_path(WEB_PATH) . 'main/social/home.php">' . Display::return_icon('home.png', get_lang('Home'), array()) . get_lang('Home') . '</a></li>';
         if (api_get_setting('allow_message_tool') == 'true') {
             $active = $show == 'messages' ? 'active' : null;
             $html .= '<li class="' . $active . '"><a href="' . api_get_path(WEB_PATH) . 'main/messages/inbox.php?f=social">' . Display::return_icon('instant_message.png', get_lang('Messages'), array()) . get_lang('Messages') . $count_unread_message . '</a></li>';
         }
         // Invitations
         if (api_get_setting('allow_message_tool') == 'true') {
             $active = $show == 'invitations' ? 'active' : null;
             $html .= '<li class="' . $active . '"><a href="' . api_get_path(WEB_PATH) . 'main/social/invitations.php">' . Display::return_icon('invitation.png', get_lang('Invitations'), array()) . get_lang('Invitations') . $total_invitations . '</a></li>';
         }
         //Shared profile and groups
         $active = $show == 'shared_profile' ? 'active' : null;
         $html .= '<li class="' . $active . '"><a href="' . api_get_path(WEB_PATH) . 'main/social/profile.php">' . Display::return_icon('my_shared_profile.png', get_lang('ViewMySharedProfile'), array()) . get_lang('ViewMySharedProfile') . '</a></li>';
         $active = $show == 'friends' ? 'active' : null;
         $html .= '<li class="' . $active . '"><a href="' . api_get_path(WEB_PATH) . 'main/social/friends.php">' . Display::return_icon('friend.png', get_lang('Friends'), array()) . get_lang('Friends') . '</a></li>';
         $active = $show == 'browse_groups' ? 'active' : null;
         $html .= '<li class="' . $active . '"><a href="' . api_get_path(WEB_PATH) . 'main/social/groups.php">' . Display::return_icon('group_s.png', get_lang('SocialGroups'), array()) . get_lang('SocialGroups') . '</a></li>';
         //Search users
         $active = $show == 'search' ? 'active' : null;
         $html .= '<li class="' . $active . '"><a href="' . api_get_path(WEB_PATH) . 'main/social/search.php">' . Display::return_icon('zoom.png', get_lang('Search'), array()) . get_lang('Search') . '</a></li>';
         $html .= '</ul>
               </div>';
     }
     if (in_array($show, $show_groups) && !empty($group_id)) {
         $html .= $usergroup->show_group_column_information($group_id, api_get_user_id(), $show);
     }
     if ($show == 'shared_profile') {
         //echo '<div align="center" class="social-menu-title" ><span class="social-menu-text1">'.get_lang('Menu').'</span></div>';
         $html .= '<div class="well sidebar-nav">
                 <ul class="nav nav-list">';
         // My own profile
         if ($show_full_profile && $user_id == intval(api_get_user_id())) {
             $html .= '<li><a href="' . api_get_path(WEB_PATH) . 'main/social/home.php">' . Display::return_icon('home.png', get_lang('Home'), array()) . get_lang('Home') . '</a></li>';
             if (api_get_setting('allow_message_tool') == 'true') {
//.........这里部分代码省略.........
开发者ID:ragebat,项目名称:chamilo-lms,代码行数:101,代码来源:social.lib.php

示例12: show_social_menu

 /**
  * Shows the right menu of the Social Network tool
  *
  * @param string $show highlight link possible values:
  * group_add,
  * home,
  * messages,
  * messages_inbox,
  * messages_compose ,
  * messages_outbox,
  * invitations,
  * shared_profile,
  * friends,
  * groups search
  * @param int $group_id group id
  * @param int $user_id user id
  * @param bool $show_full_profile show profile or not (show or hide the user image/information)
  * @param bool $show_delete_account_button
  *
  */
 public static function show_social_menu($show = '', $group_id = 0, $user_id = 0, $show_full_profile = false, $show_delete_account_button = false)
 {
     if (empty($user_id)) {
         $user_id = api_get_user_id();
     }
     $usergroup = new UserGroup();
     $user_info = api_get_user_info($user_id, true);
     $current_user_id = api_get_user_id();
     $current_user_info = api_get_user_info($current_user_id, true);
     if ($current_user_id == $user_id) {
         $user_friend_relation = null;
     } else {
         $user_friend_relation = SocialManager::get_relation_between_contacts($current_user_id, $user_id);
     }
     $show_groups = array('groups', 'group_messages', 'messages_list', 'group_add', 'mygroups', 'group_edit', 'member_list', 'invite_friends', 'waiting_list', 'browse_groups');
     // get count unread message and total invitations
     $count_unread_message = MessageManager::get_number_of_messages(true);
     $count_unread_message = !empty($count_unread_message) ? Display::badge($count_unread_message) : null;
     $number_of_new_messages_of_friend = SocialManager::get_message_number_invitation_by_user_id(api_get_user_id());
     $group_pending_invitations = $usergroup->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;
     $total_invitations = !empty($total_invitations) ? Display::badge($total_invitations) : '';
     $html = '';
     $active = null;
     if (!in_array($show, array('shared_profile', 'groups', 'group_edit', 'member_list', 'waiting_list', 'invite_friends'))) {
         $html .= '<div class="panel panel-default sidebar-nav">';
         $html .= '<div class="panel-body">';
         $html .= '<ul class="nav nav-pills nav-stacked">';
         $active = $show == 'home' ? 'active' : null;
         $html .= '<li class="home-icon ' . $active . '"><a href="' . api_get_path(WEB_CODE_PATH) . 'social/home.php">' . Display::return_icon('social-home.png', get_lang('Home'), '', ICON_SIZE_SMALL) . ' ' . get_lang('Home') . '</a></li>';
         $active = $show == 'messages' ? 'active' : null;
         $html .= '<li class="messages-icon ' . $active . '"><a href="' . api_get_path(WEB_CODE_PATH) . 'messages/inbox.php?f=social">' . Display::return_icon('social-message.png', get_lang('Messages'), '', ICON_SIZE_SMALL) . ' ' . get_lang('Messages') . $count_unread_message . '</a></li>';
         //Invitations
         $active = $show == 'invitations' ? 'active' : null;
         $html .= '<li class="invitations-icon ' . $active . '"><a href="' . api_get_path(WEB_CODE_PATH) . 'social/invitations.php">' . Display::return_icon('social-invitations.png', get_lang('Invitations'), '', ICON_SIZE_SMALL) . ' ' . get_lang('Invitations') . $total_invitations . '</a></li>';
         //Shared profile and groups
         $active = $show == 'shared_profile' ? 'active' : null;
         $html .= '<li class="shared-profile-icon' . $active . '"><a href="' . api_get_path(WEB_CODE_PATH) . 'social/profile.php">' . Display::return_icon('social-profile.png', get_lang('ViewMySharedProfile'), '', ICON_SIZE_SMALL) . ' ' . get_lang('ViewMySharedProfile') . '</a></li>';
         $active = $show == 'friends' ? 'active' : null;
         $html .= '<li class="friends-icon ' . $active . '"><a href="' . api_get_path(WEB_CODE_PATH) . 'social/friends.php">' . Display::return_icon('social-friends.png', get_lang('Friends'), '', ICON_SIZE_SMALL) . ' ' . get_lang('Friends') . '</a></li>';
         $active = $show == 'browse_groups' ? 'active' : null;
         $html .= '<li class="browse-groups-icon ' . $active . '"><a href="' . api_get_path(WEB_CODE_PATH) . 'social/groups.php">' . Display::return_icon('social-groups.png', get_lang('SocialGroups'), '', ICON_SIZE_SMALL) . ' ' . get_lang('SocialGroups') . '</a></li>';
         //Search users
         $active = $show == 'search' ? 'active' : null;
         $html .= '<li class="search-icon ' . $active . '"><a href="' . api_get_path(WEB_CODE_PATH) . 'social/search.php">' . Display::return_icon('social-search.png', get_lang('Search'), '', ICON_SIZE_SMALL) . ' ' . get_lang('Search') . '</a></li>';
         //My files
         $active = $show == 'myfiles' ? 'active' : null;
         $html .= '<li class="myfiles-icon ' . $active . '"><a href="' . api_get_path(WEB_CODE_PATH) . 'social/myfiles.php">' . Display::return_icon('social-files.png', get_lang('MyFiles'), '', ICON_SIZE_SMALL) . ' ' . get_lang('MyFiles') . '</span></a></li>';
         $html .= '</ul></div></div>';
     }
     if (in_array($show, $show_groups) && !empty($group_id)) {
         $html .= $usergroup->show_group_column_information($group_id, api_get_user_id(), $show);
     }
     if ($show == 'shared_profile') {
         $html .= '<div class="panel panel-default sidebar-nav">';
         $html .= '<div class="panel-body">';
         $html .= '<ul class="nav nav-pills nav-stacked">';
         // My own profile
         if ($show_full_profile && $user_id == intval(api_get_user_id())) {
             $html .= '<li class="home-icon ' . $active . '"><a href="' . api_get_path(WEB_CODE_PATH) . 'social/home.php">' . Display::return_icon('social-home.png', get_lang('Home'), '', ICON_SIZE_SMALL) . ' ' . get_lang('Home') . '</a></li>
                       <li class="messages-icon ' . $active . '"><a href="' . api_get_path(WEB_CODE_PATH) . 'messages/inbox.php?f=social">' . Display::return_icon('social-message.png', get_lang('Messages'), '', ICON_SIZE_SMALL) . ' ' . get_lang('Messages') . $count_unread_message . '</a></li>';
             $active = $show == 'invitations' ? 'active' : null;
             $html .= '<li class="invitations-icon' . $active . '"><a href="' . api_get_path(WEB_CODE_PATH) . 'social/invitations.php">' . Display::return_icon('social-invitations.png', get_lang('Invitations'), '', ICON_SIZE_SMALL) . ' ' . get_lang('Invitations') . $total_invitations . '</a></li>';
             $html .= '<li class="shared-profile-icon active"><a href="' . api_get_path(WEB_CODE_PATH) . 'social/profile.php">' . Display::return_icon('social-profile.png', get_lang('ViewMySharedProfile'), '', ICON_SIZE_SMALL) . ' ' . get_lang('ViewMySharedProfile') . '</a></li>
                       <li class="friends-icon"><a href="' . api_get_path(WEB_CODE_PATH) . 'social/friends.php">' . Display::return_icon('social-friends.png', get_lang('Friends'), '', ICON_SIZE_SMALL) . ' ' . get_lang('Friends') . '</a></li>
                       <li class="browse-groups-icon"><a href="' . api_get_path(WEB_CODE_PATH) . 'social/groups.php">' . Display::return_icon('social-groups.png', get_lang('SocialGroups'), '', ICON_SIZE_SMALL) . ' ' . get_lang('SocialGroups') . '</a></li>';
             $active = $show == 'search' ? 'active' : null;
             $html .= '<li class="search-icon ' . $active . '"><a href="' . api_get_path(WEB_CODE_PATH) . 'social/search.php">' . Display::return_icon('social-search.png', get_lang('Search'), '', ICON_SIZE_SMALL) . ' ' . get_lang('Search') . '</a></li>';
             $active = $show == 'myfiles' ? 'active' : null;
             $html .= '<li class="myfiles-icon ' . $active . '"><a href="' . api_get_path(WEB_CODE_PATH) . 'social/myfiles.php">' . Display::return_icon('social-files.png', get_lang('MyFiles'), '', ICON_SIZE_SMALL) . ' ' . get_lang('MyFiles') . '</a></li>';
         }
         // My friend profile.
         if ($user_id != api_get_user_id()) {
             $html .= '<li><a href="#" class="btn-to-send-message" data-send-to="' . $user_id . '" title="' . get_lang('SendMessage') . '">';
             $html .= Display::return_icon('compose_message.png', get_lang('SendMessage')) . '&nbsp;&nbsp;' . get_lang('SendMessage') . '</a></li>';
         }
         // Check if I already sent an invitation message
         $invitation_sent_list = SocialManager::get_list_invitation_sent_by_user_id(api_get_user_id());
         if (isset($invitation_sent_list[$user_id]) && is_array($invitation_sent_list[$user_id]) && count($invitation_sent_list[$user_id]) > 0) {
//.........这里部分代码省略.........
开发者ID:KRCM13,项目名称:chamilo-lms,代码行数:101,代码来源:social.lib.php

示例13: delete_user

 /**
  * Delete a user from the platform, and all its belongings. This is a
  * very dangerous function that should only be accessible by
  * super-admins. Other roles should only be able to disable a user,
  * which removes access to the platform but doesn't delete anything.
  * @param int The ID of th user to be deleted
  * @return boolean true if user is succesfully deleted, false otherwise
  * @assert (null) === false
  * @assert ('abc') === false
  */
 public static function delete_user($user_id)
 {
     if ($user_id != strval(intval($user_id))) {
         return false;
     }
     if ($user_id === false) {
         return false;
     }
     if (!self::can_delete_user($user_id)) {
         return false;
     }
     $user_info = api_get_user_info($user_id);
     $table_user = Database::get_main_table(TABLE_MAIN_USER);
     $usergroup_rel_user = Database::get_main_table(TABLE_USERGROUP_REL_USER);
     $table_course_user = Database::get_main_table(TABLE_MAIN_COURSE_USER);
     $table_course = Database::get_main_table(TABLE_MAIN_COURSE);
     $table_admin = Database::get_main_table(TABLE_MAIN_ADMIN);
     $table_session_user = Database::get_main_table(TABLE_MAIN_SESSION_USER);
     $table_session_course_user = Database::get_main_table(TABLE_MAIN_SESSION_COURSE_USER);
     $table_group = Database::get_course_table(TABLE_GROUP_USER);
     $table_work = Database::get_course_table(TABLE_STUDENT_PUBLICATION);
     // Unsubscribe the user from all groups in all his courses
     $sql = "SELECT c.id FROM {$table_course} c, {$table_course_user} cu\n                WHERE cu.user_id = '" . $user_id . "' AND relation_type<>" . COURSE_RELATION_TYPE_RRHH . " AND c.id = cu.c_id";
     $res = Database::query($sql);
     while ($course = Database::fetch_object($res)) {
         $sql = "DELETE FROM {$table_group} WHERE c_id = {$course->id} AND user_id = {$user_id}";
         Database::query($sql);
     }
     // Unsubscribe user from all classes
     //Classes are not longer supported
     /*$sql = "DELETE FROM $table_class_user WHERE user_id = '".$user_id."'";
       Database::query($sql);*/
     // Unsubscribe user from usergroup_rel_user
     $sql = "DELETE FROM {$usergroup_rel_user} WHERE user_id = '" . $user_id . "'";
     Database::query($sql);
     // Unsubscribe user from all courses
     $sql = "DELETE FROM {$table_course_user} WHERE user_id = '" . $user_id . "'";
     Database::query($sql);
     // Unsubscribe user from all courses in sessions
     $sql = "DELETE FROM {$table_session_course_user} WHERE id_user = '" . $user_id . "'";
     Database::query($sql);
     // Unsubscribe user from all sessions
     $sql = "DELETE FROM {$table_session_user} WHERE id_user = '" . $user_id . "'";
     Database::query($sql);
     // Delete user picture
     // TODO: Logic about api_get_setting('split_users_upload_directory') === 'true' , a user has 4 differnt sized photos to be deleted.
     if (strlen($user_info['picture_uri']) > 0) {
         $img_path = api_get_path(SYS_DATA_PATH) . 'upload/users/' . $user_id . '/' . $user_info['picture_uri'];
         if (file_exists($img_path)) {
             unlink($img_path);
         }
     }
     // Delete the personal course categories
     $course_cat_table = Database::get_main_table(TABLE_USER_COURSE_CATEGORY);
     $sql = "DELETE FROM {$course_cat_table} WHERE user_id = '" . $user_id . "'";
     Database::query($sql);
     // Delete user from database
     $sql = "DELETE FROM {$table_user} WHERE user_id = '" . $user_id . "'";
     Database::query($sql);
     // Delete user from the admin table
     $sql = "DELETE FROM {$table_admin} WHERE user_id = '" . $user_id . "'";
     Database::query($sql);
     // Delete the personal agenda-items from this user
     $agenda_table = Database::get_main_table(TABLE_PERSONAL_AGENDA);
     $sql = "DELETE FROM {$agenda_table} WHERE user = '" . $user_id . "'";
     Database::query($sql);
     $gradebook_results_table = Database::get_main_table(TABLE_MAIN_GRADEBOOK_RESULT);
     $sql = 'DELETE FROM ' . $gradebook_results_table . ' WHERE user_id = ' . $user_id;
     Database::query($sql);
     $t_ufv = Database::get_main_table(TABLE_MAIN_USER_FIELD_VALUES);
     $sqlv = "DELETE FROM {$t_ufv} WHERE user_id = {$user_id}";
     Database::query($sqlv);
     if (api_get_multiple_access_url()) {
         $url_id = api_get_current_access_url_id();
         UrlManager::delete_url_rel_user($user_id, $url_id);
     } else {
         //we delete the user from the url_id =1
         UrlManager::delete_url_rel_user($user_id, 1);
     }
     if (api_get_setting('allow_social_tool') == 'true') {
         $usergroup = new UserGroup();
         //Delete user from portal groups
         $group_list = $usergroup->get_groups_by_user($user_id);
         if (!empty($group_list)) {
             foreach ($group_list as $group_id => $data) {
                 $usergroup->delete_user_rel_group($user_id, $group_id);
             }
         }
         // Delete user from friend lists
         SocialManager::remove_user_rel_user($user_id, true);
//.........这里部分代码省略.........
开发者ID:ilosada,项目名称:chamilo-lms-icpna,代码行数:101,代码来源:usermanager.lib.php


注:本文中的UserGroup::get_groups_by_user方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。