diff --git a/main/admin/add_users_to_group.php b/main/admin/add_users_to_group.php index 591f0acf48..c6d8c97ee7 100755 --- a/main/admin/add_users_to_group.php +++ b/main/admin/add_users_to_group.php @@ -1,4 +1,4 @@ - 'group_list.php','name' => get_lang('GroupList $tbl_group = Database::get_main_table(TABLE_MAIN_GROUP); $tbl_user = Database::get_main_table(TABLE_MAIN_USER); $tbl_group_rel_user = Database::get_main_table(TABLE_MAIN_USER_REL_GROUP); +$tbl_user_rel_access_url= Database::get_main_table(TABLE_MAIN_ACCESS_URL_REL_USER); // setting the name of the tool $tool_name = get_lang('SubscribeUsersToGroup'); @@ -43,8 +45,8 @@ if(isset($_REQUEST['add_type']) && $_REQUEST['add_type']!=''){ //checking for extra field with filter on $xajax = new xajax(); $xajax->registerFunction('search_users'); -function search_users($needle,$type,$relation_type) { - global $tbl_user,$tbl_group_rel_user,$group_id,$_configuration; +function search_users($needle,$type,$relation_type) { + global $tbl_user,$tbl_user_rel_access_url, $tbl_group_rel_user,$group_id,$_configuration; $xajax_response = new XajaxResponse(); $return = $return_origin = $return_destination = ''; $without_user_id = $without_user_id = $condition_relation = ''; @@ -53,7 +55,7 @@ function search_users($needle,$type,$relation_type) { $group_id = intval($group_id); $relation_type = intval($relation_type); // get user_id from relation type and group id - $sql = "SELECT user_id FROM $tbl_group_rel_user + $sql = "SELECT user_id FROM $tbl_group_rel_user WHERE group_id = '$group_id' AND relation_type IN (".GROUP_USER_PERMISSION_ADMIN.",".GROUP_USER_PERMISSION_READER.",".GROUP_USER_PERMISSION_PENDING_INVITATION.",".GROUP_USER_PERMISSION_MODERATOR.") "; $res = Database::query($sql); @@ -62,10 +64,10 @@ function search_users($needle,$type,$relation_type) { while ($row = Database::fetch_row($res)) { $user_ids[] = $row[0]; } - $without_user_id = " AND user_id NOT IN(".implode(',',$user_ids).") "; + $without_user_id = " AND user.user_id NOT IN(".implode(',',$user_ids).") "; } - if ($relation_type==GROUP_USER_PERMISSION_PENDING_INVITATION) { + if ($relation_type == GROUP_USER_PERMISSION_PENDING_INVITATION) { $condition_relation = " AND groups.relation_type IN (".GROUP_USER_PERMISSION_PENDING_INVITATION.",".GROUP_USER_PERMISSION_READER.") "; } else { $condition_relation = " AND groups.relation_type = '$relation_type' "; @@ -88,6 +90,7 @@ function search_users($needle,$type,$relation_type) { } else { $return_destination .= ''; } + $xajax_response -> addAssign('ajax_destination_list','innerHTML',api_utf8_encode($return_destination)); } else { @@ -110,7 +113,7 @@ function search_users($needle,$type,$relation_type) { $needle = Database::escape_string($needle); $needle = api_convert_encoding($needle, $charset, 'utf-8'); $user_anonymous=api_get_anonymous_id(); - $tbl_user_rel_access_url= Database::get_main_table(TABLE_MAIN_ACCESS_URL_REL_USER); + $order_clause = api_sort_by_first_name() ? ' ORDER BY firstname, lastname, username' : ' ORDER BY lastname, firstname, username'; if ($type == 'single') { @@ -148,8 +151,8 @@ function search_users($needle,$type,$relation_type) { } else { // multiple if (!empty($group_id) && !empty($relation_type)) { - $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' $without_user_id $order_clause "; + $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' $without_user_id $order_clause "; if ($_configuration['multiple_access_urls']) { $access_url_id = api_get_current_access_url_id(); if ($access_url_id != -1) { @@ -160,6 +163,7 @@ function search_users($needle,$type,$relation_type) { AND user.user_id<>'$user_anonymous' $without_user_id $order_clause "; } } + $rs_multiple = Database::query($sql); $return_origin .= ' - + @@ -439,7 +448,7 @@ if(!empty($errorMsg)) { :   - : + : diff --git a/main/admin/group_list.php b/main/admin/group_list.php index 2f52ed248b..a7e49e5129 100755 --- a/main/admin/group_list.php +++ b/main/admin/group_list.php @@ -1,21 +1,19 @@ -'.Display::return_icon('subscribe_users_social_network.png',get_lang('AddUsersToGroup'),'','22').''; - $result .= ''.Display::return_icon('edit.gif', get_lang('Edit')).'  '; - $result .= ''.Display::return_icon('delete.gif', get_lang('Delete')).''; + $result .= ''.Display::return_icon('edit.png', get_lang('Edit'), array(), 22).'  '; + $result .= ''.Display::return_icon('delete.png', get_lang('Delete'), array(), 22).''; } return $result; } @@ -265,18 +263,12 @@ function lock_unlock_user($status,$user_id) * @version march 2008 * @author Patrick Cool , Ghent University, Belgium */ -function status_filter($status) -{ +function status_filter($status) { $statusname = api_get_status_langvars(); return $statusname[$status]; } - -/** -============================================================================== - INIT SECTION -============================================================================== -*/ +// INIT SECTION $action = $_GET["action"]; if (isset ($_GET['search']) && $_GET['search'] == 'advanced') { @@ -422,10 +414,4 @@ else $table->set_form_actions(array ('delete' => get_lang('DeleteFromPlatform'))); $table->display(); } -/* -============================================================================== - FOOTER -============================================================================== -*/ -Display :: display_footer(); -?> +Display :: display_footer(); \ No newline at end of file