コード例 #1
0
ファイル: group_topics.php プロジェクト: KRCM13/chamilo-lms
    api_not_allowed(true);
} else {
    $group_info = $usergroup->get($group_id);
    if (empty($group_info)) {
        api_not_allowed(true);
    }
    $is_member = $usergroup->is_group_member($group_id);
    if ($group_info['visibility'] == GROUP_PERMISSION_CLOSED && !$is_member) {
        api_not_allowed(true);
    }
}
if (isset($_REQUEST['action']) && $_REQUEST['action'] == 'delete') {
    $group_role = $usergroup->get_user_group_role(api_get_user_id(), $group_id);
    if (api_is_platform_admin() || in_array($group_role, array(GROUP_USER_PERMISSION_ADMIN, GROUP_USER_PERMISSION_MODERATOR))) {
        $usergroup->delete_topic($group_id, $topic_id);
        Display::addFlash(DIsplay::return_message(get_lang('Deleted')));
        header("Location: group_view.php?id={$group_id}");
        exit;
    }
}
$content = null;
$social_right_content = '';
if (isset($_POST['action'])) {
    $title = isset($_POST['title']) ? $_POST['title'] : null;
    $content = $_POST['content'];
    $group_id = intval($_POST['group_id']);
    $parent_id = intval($_POST['parent_id']);
    if ($_POST['action'] == 'reply_message_group') {
        $title = cut($content, 50);
    }
    if ($_POST['action'] == 'edit_message_group') {
コード例 #2
0
ファイル: group_add.php プロジェクト: KRCM13/chamilo-lms
    api_not_allowed();
}
if (api_get_setting('allow_students_to_create_groups_in_social') == 'false' && !api_is_allowed_to_edit()) {
    api_not_allowed();
}
$table_message = Database::get_main_table(TABLE_MESSAGE);
$usergroup = new UserGroup();
$form = new FormValidator('add_group');
$usergroup->setGroupType($usergroup::SOCIAL_CLASS);
$usergroup->setForm($form, 'add', array());
if ($form->validate()) {
    $values = $form->exportValues();
    $values['group_type'] = UserGroup::SOCIAL_CLASS;
    $values['relation_type'] = GROUP_USER_PERMISSION_ADMIN;
    $groupId = $usergroup->save($values);
    Display::addFlash(DIsplay::return_message(get_lang('GroupAdded')));
    header('Location: group_view.php?id=' . $groupId);
    exit;
}
$nameTools = get_lang('AddGroup');
$this_section = SECTION_SOCIAL;
$interbreadcrumb[] = array('url' => 'home.php', 'name' => get_lang('Social'));
$interbreadcrumb[] = array('url' => 'groups.php', 'name' => get_lang('Groups'));
$interbreadcrumb[] = array('url' => '#', 'name' => $nameTools);
$social_avatar_block = SocialManager::show_social_avatar_block('group_add');
$social_menu_block = SocialManager::show_social_menu('group_add');
$social_right_content = $form->returnForm();
$tpl = new Template(null);
SocialManager::setSocialUserBlock($tpl, $user_id, null, null);
$tpl->setHelp('Groups');
$tpl->assign('social_menu_block', $social_menu_block);