Minor - format code.

1.9.x
Julio Montoya 12 years ago
parent 40b2d239db
commit 49fa5ac510
  1. 61
      main/social/group_add.php
  2. 61
      main/social/group_edit.php
  3. 209
      main/social/group_invitation.php
  4. 1
      main/social/group_members.php
  5. 67
      main/social/group_topics.php
  6. 60
      main/social/group_waiting_list.php

@ -4,9 +4,6 @@
* @package chamilo.social
* @author Julio Montoya <gugli100@gmail.com>
*/
/**
* Initialization
*/
$language_file= 'userInfo';
$cidReset=true;
require_once '../inc/global.inc.php';
@ -19,22 +16,20 @@ if (api_get_setting('allow_social_tool') !='true') {
require_once api_get_path(LIBRARY_PATH).'group_portal_manager.lib.php';
if (api_get_setting('allow_students_to_create_groups_in_social') == 'false' && !api_is_allowed_to_edit()) {
api_not_allowed();
api_not_allowed();
}
global $charset;
//jquery already called from main/inc/header.inc.php
$htmlHeadXtra[] = '<script type="text/javascript">
$htmlHeadXtra[] = '<script>
textarea = "";
num_characters_permited = 255;
function text_longitud(){
num_characters = document.forms[0].description.value.length;
if (num_characters > num_characters_permited){
document.forms[0].description.value = textarea;
}else{
num_characters = document.forms[0].description.value.length;
if (num_characters > num_characters_permited){
document.forms[0].description.value = textarea;
} else {
textarea = document.forms[0].description.value;
}
}
}
</script>';
@ -69,31 +64,31 @@ $status[GROUP_PERMISSION_OPEN] = get_lang('Open');
$status[GROUP_PERMISSION_CLOSED] = get_lang('Closed');
$form->addElement('select', 'visibility', get_lang('GroupPermissions'), $status);
$form->addElement('style_submit_button','add_group', get_lang('AddGroup'),'class="save"');
$form->addElement('style_submit_button', 'add_group', get_lang('AddGroup'), 'class="save"');
$form->setRequiredNote(api_xml_http_response_encode('<span class="form_required">*</span> <small>'.get_lang('ThisFieldIsRequired').'</small>'));
if ($form->validate()) {
$values = $form->exportValues();
$picture_element = $form->getElement('picture');
$picture = $picture_element->getValue();
$picture_uri = '';
$name = $values['name'];
$description = $values['description'];
$url = $values['url'];
$status = intval($values['visibility']);
$picture = $_FILES['picture'];
$group_id = GroupPortalManager::add($name, $description, $url, $status);
GroupPortalManager::add_user_to_group(api_get_user_id(), $group_id,GROUP_USER_PERMISSION_ADMIN);
if (!empty($picture['name'])) {
$picture_uri = GroupPortalManager::update_group_picture($group_id, $_FILES['picture']['name'], $_FILES['picture']['tmp_name']);
GroupPortalManager::update($group_id, $name, $description, $url,$status, $picture_uri);
}
header('Location: groups.php?id='.$group_id.'&action=show_message&message='.urlencode(get_lang('GroupAdded')));
exit();
$values = $form->exportValues();
$picture_element = $form->getElement('picture');
$picture = $picture_element->getValue();
$picture_uri = '';
$name = $values['name'];
$description = $values['description'];
$url = $values['url'];
$status = intval($values['visibility']);
$picture = $_FILES['picture'];
$group_id = GroupPortalManager::add($name, $description, $url, $status);
GroupPortalManager::add_user_to_group(api_get_user_id(), $group_id,GROUP_USER_PERMISSION_ADMIN);
if (!empty($picture['name'])) {
$picture_uri = GroupPortalManager::update_group_picture($group_id, $_FILES['picture']['name'], $_FILES['picture']['tmp_name']);
GroupPortalManager::update($group_id, $name, $description, $url, $status, $picture_uri);
}
header('Location: groups.php?id='.$group_id.'&action=show_message&message='.urlencode(get_lang('GroupAdded')));
exit();
}
$nameTools = get_lang('AddGroup');

@ -4,9 +4,6 @@
* @package chamilo.social
* @author Julio Montoya <gugli100@gmail.com>
*/
/**
* Initialization
*/
// Language files that should be included
$language_file = array('userInfo');
$cidReset = true;
@ -49,13 +46,13 @@ $table_group = Database::get_main_table(TABLE_MAIN_GROUP);
$sql = "SELECT * FROM $table_group WHERE id = '".$group_id."'";
$res = Database::query($sql);
if (Database::num_rows($res) != 1) {
header('Location: groups.php?id='.$group_id);
exit;
header('Location: groups.php?id='.$group_id);
exit;
}
//only group admins can edit the group
if (!GroupPortalManager::is_group_admin($group_id)) {
api_not_allowed();
api_not_allowed();
}
$group_data = Database::fetch_array($res, 'ASSOC');
@ -86,7 +83,7 @@ $form->addElement('file', 'picture', get_lang('AddPicture'));
$allowed_picture_types = array ('jpg', 'jpeg', 'png', 'gif');
$form->addRule('picture', get_lang('OnlyImagesAllowed').' ('.implode(',', $allowed_picture_types).')', 'filetype', $allowed_picture_types);
if (strlen($group_data['picture_uri']) > 0) {
$form->addElement('checkbox', 'delete_picture', '', get_lang('DelImage'));
$form->addElement('checkbox', 'delete_picture', '', get_lang('DelImage'));
}
// Status
@ -95,7 +92,6 @@ $status[GROUP_PERMISSION_OPEN] = get_lang('Open');
$status[GROUP_PERMISSION_CLOSED] = get_lang('Closed');
$form->addElement('select', 'visibility', get_lang('GroupPermissions'), $status, array());
// Submit button
$form->addElement('style_submit_button', 'submit', get_lang('ModifyInformation'), 'class="save"');
@ -103,32 +99,31 @@ $form->addElement('style_submit_button', 'submit', get_lang('ModifyInformation')
$form->setDefaults($group_data);
// Validate form
if ( $form->validate()) {
$group = $form->exportValues();
$picture_element = $form->getElement('picture');
$picture = $picture_element->getValue();
$picture_uri = $group_data['picture_uri'];
if ($group['delete_picture']) {
$picture_uri = GroupPortalManager::delete_group_picture($group_id);
}
elseif (!empty($picture['name'])) {
$picture_uri = GroupPortalManager::update_group_picture($group_id, $_FILES['picture']['name'], $_FILES['picture']['tmp_name']);
}
$name = $group['name'];
$description = $group['description'];
$url = $group['url'];
$status = intval($group['visibility']);
GroupPortalManager::update($group_id, $name, $description, $url, $status, $picture_uri);
$tok = Security::get_token();
header('Location: groups.php?id='.$group_id.'&action=show_message&message='.urlencode(get_lang('GroupUpdated')).'&sec_token='.$tok);
exit();
if ($form->validate()) {
$group = $form->exportValues();
$picture_element = $form->getElement('picture');
$picture = $picture_element->getValue();
$picture_uri = $group_data['picture_uri'];
if ($group['delete_picture']) {
$picture_uri = GroupPortalManager::delete_group_picture($group_id);
} elseif (!empty($picture['name'])) {
$picture_uri = GroupPortalManager::update_group_picture($group_id, $_FILES['picture']['name'], $_FILES['picture']['tmp_name']);
}
$name = $group['name'];
$description = $group['description'];
$url = $group['url'];
$status = intval($group['visibility']);
GroupPortalManager::update($group_id, $name, $description, $url, $status, $picture_uri);
$tok = Security::get_token();
header('Location: groups.php?id='.$group_id.'&action=show_message&message='.urlencode(get_lang('GroupUpdated')).'&sec_token='.$tok);
exit();
}
// Group picture
$image_path = GroupPortalManager::get_group_picture_path_by_id($group_id,'web');
$image_path = GroupPortalManager::get_group_picture_path_by_id($group_id, 'web');
$image_dir = $image_path['dir'];
$image = $image_path['file'];
$image_file = ($image != '' ? $image_dir.$image : api_get_path(WEB_CODE_PATH).'img/unknown_group.jpg');
@ -141,10 +136,9 @@ $big_image_width = $big_image_size['width'];
$big_image_height = $big_image_size['height'];
$url_big_image = $big_image.'?rnd='.time();
$social_left_content = SocialManager::show_social_menu('group_edit',$group_id);
$social_left_content = SocialManager::show_social_menu('group_edit', $group_id);
$social_right_content = $form->return_form();
$tpl = new Template($tool_name);
$tpl->set_help('Groups');
$tpl->assign('social_left_content', $social_left_content);
@ -155,4 +149,3 @@ $tpl->assign('message', $show_message);
$tpl->assign('content', $content);
$social_layout = $tpl->get_template('layout/social_layout.tpl');
$tpl->display($social_layout);

@ -42,8 +42,8 @@ $tool_name = get_lang('SubscribeUsersToGroup');
$group_id = intval($_REQUEST['id']);
$add_type = 'multiple';
if(isset($_REQUEST['add_type']) && $_REQUEST['add_type']!=''){
$add_type = Security::remove_XSS($_REQUEST['add_type']);
if (isset($_REQUEST['add_type']) && $_REQUEST['add_type']!=''){
$add_type = Security::remove_XSS($_REQUEST['add_type']);
}
//checking for extra field with filter on
@ -51,120 +51,117 @@ require_once api_get_path(LIBRARY_PATH).'group_portal_manager.lib.php';
//todo @this validation could be in a function in group_portal_manager
if (empty($group_id)) {
api_not_allowed();
api_not_allowed();
} else {
$group_info = GroupPortalManager::get_group_data($group_id);
if (empty($group_info)) {
api_not_allowed();
}
//only admin or moderator can do that
if (!GroupPortalManager::is_group_member($group_id)) {
api_not_allowed();
}
$group_info = GroupPortalManager::get_group_data($group_id);
if (empty($group_info)) {
api_not_allowed();
}
//only admin or moderator can do that
if (!GroupPortalManager::is_group_member($group_id)) {
api_not_allowed();
}
}
function search_users($needle,$type) {
global $tbl_user,$tbl_group_rel_user,$group_id;
$xajax_response = new XajaxResponse();
$return = '';
if (!empty($needle) && !empty($type)) {
// xajax send utf8 datas... datas in db can be non-utf8 datas
$charset = api_get_system_encoding();
$needle = Database::escape_string($needle);
$needle = api_convert_encoding($needle, $charset, 'utf-8');
$user_anonymous=api_get_anonymous_id();
$order_clause = api_sort_by_first_name() ? ' ORDER BY firstname, lastname, username' : ' ORDER BY lastname, firstname, username';
$cond_user_id = '';
if (!empty($id_session)) {
$group_id = Database::escape_string($group_id);
// check id_user from session_rel_user table
$sql = 'SELECT id_user FROM '.$tbl_group_rel_user.' WHERE group_id ="'.(int)$group_id.'"';
$res = Database::query($sql);
$user_ids = array();
if (Database::num_rows($res) > 0) {
while ($row = Database::fetch_row($res)) {
$user_ids[] = (int)$row[0];
}
}
if (count($user_ids) > 0){
$cond_user_id = ' AND user_id NOT IN('.implode(",",$user_ids).')';
}
global $tbl_user,$tbl_group_rel_user,$group_id;
$xajax_response = new XajaxResponse();
$return = '';
if (!empty($needle) && !empty($type)) {
// xajax send utf8 datas... datas in db can be non-utf8 datas
$charset = api_get_system_encoding();
$needle = Database::escape_string($needle);
$needle = api_convert_encoding($needle, $charset, 'utf-8');
$user_anonymous=api_get_anonymous_id();
$order_clause = api_sort_by_first_name() ? ' ORDER BY firstname, lastname, username' : ' ORDER BY lastname, firstname, username';
$cond_user_id = '';
if (!empty($id_session)) {
$group_id = Database::escape_string($group_id);
// check id_user from session_rel_user table
$sql = 'SELECT id_user FROM '.$tbl_group_rel_user.' WHERE group_id ="'.(int)$group_id.'"';
$res = Database::query($sql);
$user_ids = array();
if (Database::num_rows($res) > 0) {
while ($row = Database::fetch_row($res)) {
$user_ids[] = (int)$row[0];
}
}
if (count($user_ids) > 0){
$cond_user_id = ' AND user_id NOT IN('.implode(",",$user_ids).')';
}
}
if ($type == 'single') {
// search users where username or firstname or lastname begins likes $needle
$sql = 'SELECT user_id, username, lastname, firstname FROM '.$tbl_user.' user
WHERE (username LIKE "'.$needle.'%"
OR firstname LIKE "'.$needle.'%"
OR lastname LIKE "'.$needle.'%") AND user_id<>"'.$user_anonymous.'"'.
$order_clause.
' LIMIT 11';
} else {
$sql = 'SELECT user_id, username, lastname, firstname FROM '.$tbl_user.' user
WHERE '.(api_sort_by_first_name() ? 'firstname' : 'lastname').' LIKE "'.$needle.'%" AND user_id<>"'.$user_anonymous.'"'.$cond_user_id.
$order_clause;
}
global $_configuration;
if ($_configuration['multiple_access_urls']) {
$tbl_user_rel_access_url= Database::get_main_table(TABLE_MAIN_ACCESS_URL_REL_USER);
$access_url_id = api_get_current_access_url_id();
if ($access_url_id != -1){
if ($type == 'single') {
$sql = 'SELECT user.user_id, username, lastname, firstname FROM '.$tbl_user.' user
INNER JOIN '.$tbl_user_rel_access_url.' url_user ON (url_user.user_id=user.user_id)
WHERE access_url_id = '.$access_url_id.' AND (username LIKE "'.$needle.'%"
OR firstname LIKE "'.$needle.'%"
OR lastname LIKE "'.$needle.'%") AND user.user_id<>"'.$user_anonymous.'"'.
$order_clause.
' LIMIT 11';
} else {
$sql = 'SELECT user.user_id, username, lastname, firstname FROM '.$tbl_user.' user
INNER JOIN '.$tbl_user_rel_access_url.' url_user ON (url_user.user_id=user.user_id)
WHERE access_url_id = '.$access_url_id.'
AND '.(api_sort_by_first_name() ? 'firstname' : 'lastname').' LIKE "'.$needle.'%" AND user.user_id<>"'.$user_anonymous.'"'.$cond_user_id.
$order_clause;
}
if ($type == 'single') {
// search users where username or firstname or lastname begins likes $needle
$sql = 'SELECT user_id, username, lastname, firstname FROM '.$tbl_user.' user
WHERE (username LIKE "'.$needle.'%"
OR firstname LIKE "'.$needle.'%"
OR lastname LIKE "'.$needle.'%") AND user_id<>"'.$user_anonymous.'"'.
$order_clause.
' LIMIT 11';
} else {
$sql = 'SELECT user_id, username, lastname, firstname FROM '.$tbl_user.' user
WHERE '.(api_sort_by_first_name() ? 'firstname' : 'lastname').' LIKE "'.$needle.'%" AND user_id<>"'.$user_anonymous.'"'.$cond_user_id.
$order_clause;
}
}
}
if (api_is_multiple_url_enabled()) {
$tbl_user_rel_access_url = Database::get_main_table(TABLE_MAIN_ACCESS_URL_REL_USER);
$access_url_id = api_get_current_access_url_id();
if ($access_url_id != -1) {
if ($type == 'single') {
$sql = 'SELECT user.user_id, username, lastname, firstname FROM '.$tbl_user.' user
INNER JOIN '.$tbl_user_rel_access_url.' url_user ON (url_user.user_id=user.user_id)
WHERE access_url_id = '.$access_url_id.' AND (username LIKE "'.$needle.'%"
OR firstname LIKE "'.$needle.'%"
OR lastname LIKE "'.$needle.'%") AND user.user_id<>"'.$user_anonymous.'"'.
$order_clause.
' LIMIT 11';
} else {
$sql = 'SELECT user.user_id, username, lastname, firstname FROM '.$tbl_user.' user
INNER JOIN '.$tbl_user_rel_access_url.' url_user ON (url_user.user_id=user.user_id)
WHERE access_url_id = '.$access_url_id.'
AND '.(api_sort_by_first_name() ? 'firstname' : 'lastname').' LIKE "'.$needle.'%" AND user.user_id<>"'.$user_anonymous.'"'.$cond_user_id.
$order_clause;
}
}
}
$rs = Database::query($sql);
$i=0;
if ($type=='single') {
while ($user = Database :: fetch_array($rs)) {
$i++;
if ($i<=10) {
$person_name = api_get_person_name($user['firstname'], $user['lastname']);
$return .= '<a href="javascript: void(0);" onclick="javascript: add_user(\''.$user['user_id'].'\',\''.$person_name.' ('.$user['username'].')'.'\')">'.$person_name.' ('.$user['username'].')</a><br />';
} else {
$return .= '...<br />';
}
}
$xajax_response -> addAssign('ajax_list_users_single','innerHTML',api_utf8_encode($return));
$rs = Database::query($sql);
$i = 0;
if ($type=='single') {
while ($user = Database :: fetch_array($rs)) {
$i++;
if ($i<=10) {
$person_name = api_get_person_name($user['firstname'], $user['lastname']);
$return .= '<a href="javascript: void(0);" onclick="javascript: add_user(\''.$user['user_id'].'\',\''.$person_name.' ('.$user['username'].')'.'\')">'.$person_name.' ('.$user['username'].')</a><br />';
} else {
$return .= '...<br />';
}
}
$xajax_response -> addAssign('ajax_list_users_single','innerHTML',api_utf8_encode($return));
} else {
global $nosessionUsersList;
$return .= '<select id="origin_users" name="nosessionUsersList[]" multiple="multiple" size="15" style="width:360px;">';
while ($user = Database :: fetch_array($rs)) {
$person_name = api_get_person_name($user['firstname'], $user['lastname']);
$return .= '<option value="'.$user['user_id'].'">'.$person_name.' ('.$user['username'].')</option>';
}
$return .= '</select>';
$xajax_response -> addAssign('ajax_list_users_multiple','innerHTML',api_utf8_encode($return));
}
} else {
global $nosessionUsersList;
$return .= '<select id="origin_users" name="nosessionUsersList[]" multiple="multiple" size="15" style="width:360px;">';
while ($user = Database :: fetch_array($rs)) {
$person_name = api_get_person_name($user['firstname'], $user['lastname']);
$return .= '<option value="'.$user['user_id'].'">'.$person_name.' ('.$user['username'].')</option>';
}
$return .= '</select>';
$xajax_response -> addAssign('ajax_list_users_multiple','innerHTML',api_utf8_encode($return));
}
}
return $xajax_response;
}
$xajax -> processRequests();
$xajax->processRequests();
$htmlHeadXtra[] = $xajax->getJavascript('../inc/lib/xajax/');
$htmlHeadXtra[] = '
<script type="text/javascript">
$htmlHeadXtra[] = '<script>
function add_user (code, content) {
// document.getElementById("user_to_add").value = "";
//document.getElementById("ajax_list_users_single").innerHTML = "";
@ -227,12 +224,10 @@ if ($_POST['form_sent']) {
}
}
}
}
$nosessionUsersList = $sessionUsersList = array();
$ajax_search = $add_type == 'unique' ? true : false;
global $_configuration;
$order_clause = api_sort_by_first_name() ? ' ORDER BY firstname, lastname, username' : ' ORDER BY lastname, firstname, username';
if ($ajax_search) {
@ -242,7 +237,7 @@ if ($ajax_search) {
ON (gu.user_id = u.user_id) WHERE gu.group_id = $group_id ".
$order_clause;
if ($_configuration['multiple_access_urls']) {
if (api_is_multiple_url_enabled()) {
$tbl_user_rel_access_url= Database::get_main_table(TABLE_MAIN_ACCESS_URL_REL_USER);
$access_url_id = api_get_current_access_url_id();
if ($access_url_id != -1){
@ -263,7 +258,6 @@ if ($ajax_search) {
}
} else {
$friends = SocialManager::get_friends(api_get_user_id());
$suggest_friends = false;
if (!$friends) {
@ -284,8 +278,9 @@ if ($ajax_search) {
}
if (is_array($Users) && count($Users) > 0 ) {
foreach ($Users as $user) {
if($user['group_id'] != $group_id)
$nosessionUsersList[$user['user_id']] = $user ;
if ($user['group_id'] != $group_id) {
$nosessionUsersList[$user['user_id']] = $user;
}
}
}

@ -134,4 +134,3 @@ $tpl->assign('message', $show_message);
$tpl->assign('content', $content);
$social_layout = $tpl->get_template('layout/social_layout.tpl');
$tpl->display($social_layout);

@ -22,18 +22,16 @@ $message_id = intval($_GET['msg_id']);
//todo @this validation could be in a function in group_portal_manager
if (empty($group_id)) {
api_not_allowed(true);
api_not_allowed(true);
} else {
$group_info = GroupPortalManager::get_group_data($group_id);
if (empty($group_info)) {
api_not_allowed(true);
}
$is_member = GroupPortalManager::is_group_member($group_id);
if ($group_info['visibility'] == GROUP_PERMISSION_CLOSED && !$is_member ) {
api_not_allowed(true);
}
$group_info = GroupPortalManager::get_group_data($group_id);
if (empty($group_info)) {
api_not_allowed(true);
}
$is_member = GroupPortalManager::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') {
@ -48,24 +46,24 @@ if (isset($_REQUEST['action']) && $_REQUEST['action'] == 'delete') {
// save message group
if (isset($_POST['token']) && $_POST['token'] === $_SESSION['sec_token']) {
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') {
$edit_message_id = intval($_POST['message_id']);
$res = MessageManager::send_message(0, $title, $content, $_FILES, '', $group_id, $parent_id, $edit_message_id, 0, $topic_id);
} else {
if ($_POST['action'] == 'add_message_group' && !$is_member) {
api_not_allowed();
}
$res = MessageManager::send_message(0, $title, $content, $_FILES, '', $group_id, $parent_id, 0, $topic_id);
}
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') {
$edit_message_id = intval($_POST['message_id']);
$res = MessageManager::send_message(0, $title, $content, $_FILES, '', $group_id, $parent_id, $edit_message_id, 0, $topic_id);
} else {
if ($_POST['action'] == 'add_message_group' && !$is_member) {
api_not_allowed();
}
$res = MessageManager::send_message(0, $title, $content, $_FILES, '', $group_id, $parent_id, 0, $topic_id);
}
// display error messages
if (!$res) {
@ -156,18 +154,17 @@ $(document).ready(function() {
url,
{},
function(responseText, textStatus, XMLHttpRequest) {
dialog.dialog({
modal : true,
width : 520,
height : 400,
});
dialog.dialog({
modal : true,
width : 520,
height : 400,
});
});
//prevent the browser to follow the link
return false;
});
});
</script>';
$this_section = SECTION_SOCIAL;

@ -30,15 +30,15 @@ $group_id = intval($_GET['id']);
if (empty($group_id)) {
api_not_allowed();
} else {
$group_info = GroupPortalManager::get_group_data($group_id);
if (empty($group_info)) {
api_not_allowed();
}
//only admin or moderator can do that
$user_role = GroupPortalManager::get_user_group_role(api_get_user_id(), $group_id);
if (!in_array($user_role, array(GROUP_USER_PERMISSION_ADMIN, GROUP_USER_PERMISSION_MODERATOR))) {
api_not_allowed();
}
$group_info = GroupPortalManager::get_group_data($group_id);
if (empty($group_info)) {
api_not_allowed();
}
//only admin or moderator can do that
$user_role = GroupPortalManager::get_user_group_role(api_get_user_id(), $group_id);
if (!in_array($user_role, array(GROUP_USER_PERMISSION_ADMIN, GROUP_USER_PERMISSION_MODERATOR))) {
api_not_allowed();
}
}
// Group information
@ -46,34 +46,34 @@ $admins = GroupPortalManager::get_users_by_group($group_id, true, array(GROUP_U
$show_message = '';
if (isset($_GET['action']) && $_GET['action']=='accept') {
// we add a user only if is a open group
$user_join = intval($_GET['u']);
//if i'm a moderator
if (GroupPortalManager::is_group_moderator($group_id)) {
GroupPortalManager::update_user_role($user_join, $group_id);
$show_message = get_lang('UserAdded');
}
// we add a user only if is a open group
$user_join = intval($_GET['u']);
//if i'm a moderator
if (GroupPortalManager::is_group_moderator($group_id)) {
GroupPortalManager::update_user_role($user_join, $group_id);
$show_message = get_lang('UserAdded');
}
}
if (isset($_GET['action']) && $_GET['action']=='deny') {
// we add a user only if is a open group
$user_join = intval($_GET['u']);
//if i'm a moderator
if (GroupPortalManager::is_group_moderator($group_id)) {
GroupPortalManager::delete_user_rel_group($user_join, $group_id);
$show_message = get_lang('UserDeleted');
}
// we add a user only if is a open group
$user_join = intval($_GET['u']);
//if i'm a moderator
if (GroupPortalManager::is_group_moderator($group_id)) {
GroupPortalManager::delete_user_rel_group($user_join, $group_id);
$show_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 (GroupPortalManager::is_group_admin($group_id)) {
GroupPortalManager::update_user_role($user_moderator, $group_id, GROUP_USER_PERMISSION_MODERATOR);
$show_message = get_lang('UserChangeToModerator');
}
// we add a user only if is a open group
$user_moderator= intval($_GET['u']);
//if i'm the admin
if (GroupPortalManager::is_group_admin($group_id)) {
GroupPortalManager::update_user_role($user_moderator, $group_id, GROUP_USER_PERMISSION_MODERATOR);
$show_message = get_lang('UserChangeToModerator');
}
}
$users = GroupPortalManager::get_users_by_group($group_id, true, array(GROUP_USER_PERMISSION_PENDING_INVITATION_SENT_BY_USER), 0, 1000);

Loading…
Cancel
Save