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


PHP UserGroup::is_group_admin方法代码示例

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


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

示例1: isset

if (api_get_setting('allow_social_tool') != 'true') {
    api_not_allowed();
}
$this_section = SECTION_SOCIAL;
$group_id = isset($_GET['id']) ? intval($_GET['id']) : intval($_POST['id']);
$tool_name = get_lang('GroupEdit');
$interbreadcrumb[] = array('url' => 'home.php', 'name' => get_lang('Social'));
$interbreadcrumb[] = array('url' => 'groups.php', 'name' => get_lang('Groups'));
$usergroup = new UserGroup();
$group_data = $usergroup->get($group_id);
if (empty($group_data)) {
    header('Location: groups.php?id=' . $group_id);
    exit;
}
//only group admins can edit the group
if (!$usergroup->is_group_admin($group_id)) {
    api_not_allowed();
}
// Create the form
$form = new FormValidator('group_edit', 'post', '', '');
$form->addElement('hidden', 'id', $group_id);
$usergroup->setGroupType($usergroup::SOCIAL_CLASS);
$usergroup->setForm($form, 'edit', $group_data);
// Set default values
$form->setDefaults($group_data);
// Validate form
if ($form->validate()) {
    $group = $form->exportValues();
    $group['id'] = $group_id;
    $group['type'] = $usergroup::SOCIAL_CLASS;
    $usergroup->update($group);
开发者ID:ilosada,项目名称:chamilo-lms-icpna,代码行数:31,代码来源:group_edit.php

示例2: show_social_avatar_block

 /**
  * Shows the avatar block in social pages
  *
  * @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
  *
  */
 public static function show_social_avatar_block($show = '', $group_id = 0, $user_id = 0)
 {
     if (empty($user_id)) {
         $user_id = api_get_user_id();
     }
     $show_groups = array('groups', 'group_messages', 'messages_list', 'group_add', 'mygroups', 'group_edit', 'member_list', 'invite_friends', 'waiting_list', 'browse_groups');
     $template = Container::getTwig();
     if (in_array($show, $show_groups) && !empty($group_id)) {
         // Group image
         $userGroup = new UserGroup();
         $group_info = $userGroup->get($group_id);
         $userGroupImage = $userGroup->get_picture_group($group_id, $group_info['picture'], 160, GROUP_IMAGE_SIZE_BIG);
         $template->addGlobal('show_group', true);
         $template->addGlobal('group_id', $group_id);
         $template->addGlobal('user_group_image', $userGroupImage);
         $template->addGlobal('user_group', $group_info);
         $template->addGlobal('user_is_group_admin', $userGroup->is_group_admin($group_id, api_get_user_id()));
     } else {
         $template->addGlobal('show_group', false);
         $template->addGlobal('show_user', true);
         $template->addGlobal('user_image', ['big' => UserManager::getUserPicture($user_id, USER_IMAGE_SIZE_BIG), 'normal' => UserManager::getUserPicture($user_id, USER_IMAGE_SIZE_MEDIUM)]);
     }
     $content = $template->render('@template_style/social/avatar_block.html.twig');
     return $content;
 }
开发者ID:jloguercio,项目名称:chamilo-lms,代码行数:43,代码来源:social.lib.php

示例3: 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

示例4: intval

    }
}
if (isset($_GET['action']) && $_GET['action'] == 'delete') {
    // we add a user only if is a open group
    $user_join = intval($_GET['u']);
    //if i'm a moderator
    if ($userGroup->is_group_moderator($group_id)) {
        $userGroup->delete_user_rel_group($user_join, $group_id);
        Display::addFlash(Display::return_message(get_lang('UserDeleted')));
    }
}
if (isset($_GET['action']) && $_GET['action'] == 'set_moderator') {
    // we add a user only if is a open group
    $user_moderator = intval($_GET['u']);
    //if i'm the admin
    if ($userGroup->is_group_admin($group_id)) {
        $userGroup->update_user_role($user_moderator, $group_id, GROUP_USER_PERMISSION_MODERATOR);
        Display::addFlash(Display::return_message(get_lang('UserChangeToModerator')));
    }
}
if (isset($_GET['action']) && $_GET['action'] == 'delete_moderator') {
    // we add a user only if is a open group
    $user_moderator = intval($_GET['u']);
    //only group admins can do that
    if ($userGroup->is_group_admin($group_id)) {
        $userGroup->update_user_role($user_moderator, $group_id, GROUP_USER_PERMISSION_READER);
        Display::addFlash(Display::return_message(get_lang('UserChangeToReader')));
    }
}
$users = $userGroup->get_users_by_group($group_id, false, array(GROUP_USER_PERMISSION_ADMIN, GROUP_USER_PERMISSION_READER, GROUP_USER_PERMISSION_MODERATOR), 0, 1000);
$new_member_list = array();
开发者ID:jloguercio,项目名称:chamilo-lms,代码行数:31,代码来源:group_members.php

示例5: show_social_avatar_block

 /**
  * Shows the avatar block in social pages
  *
  * @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
  *
  */
 public static function show_social_avatar_block($show = '', $group_id = 0, $user_id = 0)
 {
     if (empty($user_id)) {
         $user_id = api_get_user_id();
     }
     $show_groups = array('groups', 'group_messages', 'messages_list', 'group_add', 'mygroups', 'group_edit', 'member_list', 'invite_friends', 'waiting_list', 'browse_groups');
     $template = new Template(null, false, false, false, false, false);
     if (in_array($show, $show_groups) && !empty($group_id)) {
         // Group image
         $userGroup = new UserGroup();
         $group_info = $userGroup->get($group_id);
         $userGroupImage = $userGroup->get_picture_group($group_id, $group_info['picture'], 160, GROUP_IMAGE_SIZE_BIG);
         $template->assign('show_group', true);
         $template->assign('group_id', $group_id);
         $template->assign('user_group_image', $userGroupImage);
         $template->assign('user_group', $group_info);
         $template->assign('user_is_group_admin', $userGroup->is_group_admin($group_id, api_get_user_id()));
     } else {
         $template->assign('show_user', true);
         $template->assign('user_image', ['big' => UserManager::getUserPicture($user_id, USER_IMAGE_SIZE_BIG), 'normal' => UserManager::getUserPicture($user_id, USER_IMAGE_SIZE_MEDIUM)]);
     }
     $skillBlock = $template->get_template('social/avatar_block.tpl');
     return $template->fetch($skillBlock);
 }
开发者ID:secuencia24,项目名称:chamilo-lms,代码行数:42,代码来源:social.lib.php


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