2 /****************************************************************/
4 /****************************************************************/
5 /* Copyright (c) 2002-2009 */
6 /* Adaptive Technology Resource Centre / University of Toronto */
9 /* This program is free software. You can redistribute it and/or*/
10 /* modify it under the terms of the GNU General Public License */
11 /* as published by the Free Software Foundation. */
12 /****************************************************************/
13 // $Id: connections.php 8410 2009-04-02 20:49:34Z greg $
14 $_user_location = 'public';
16 define('AT_INCLUDE_PATH', '../../../include/');
17 require(AT_INCLUDE_PATH.'vitals.inc.php');
18 require(AT_SOCIAL_INCLUDE.'constants.inc.php');
19 require(AT_SOCIAL_INCLUDE.'friends.inc.php');
20 //require(AT_SOCIAL_INCLUDE.'classes/PrivacyControl/PrivacyObject.class.php');
21 //require(AT_SOCIAL_INCLUDE.'classes/PrivacyControl/PrivacyController.class.php');
22 require(AT_SOCIAL_INCLUDE.'classes/SocialGroups/SocialGroup.class.php');
23 require(AT_SOCIAL_INCLUDE.'classes/SocialGroups/SocialGroups.class.php');
24 $_custom_css = $_base_path . AT_SOCIAL_BASENAME . 'module.css'; // use a custom stylesheet
26 $id = intval($_REQUEST['id']);
31 // default display all group members
32 $grp_obj = new SocialGroup($id);
33 $grp_members = $grp_obj->getGroupMembers();
35 $rand_key = $addslashes($_POST['rand_key']); //should we excape?
37 //if $_GET['q'] is set, handle Ajax.
38 if (isset($_GET['q'])){
39 $query = $addslashes($_GET['q']);
40 $search_result = $grp_obj->searchMembers($query);
42 if (!empty($search_result)){
43 echo '<div class="suggestions">'._AT('suggestions').':<br/>';
45 foreach($search_result as $member_id=>$member_obj){
46 //display 10 suggestions
50 echo '<a href="javascript:void(0);" onclick="document.getElementById(\'search_friends\').value=\''.printSocialName($member_obj->getID(), false).'\'; document.getElementById(\'search_friends_form\').submit();">'.printSocialName($member_obj->getID(), false).'</a><br/>';
58 //handle search friends request
59 if($rand_key!='' && isset($_POST['search_friends_'.$rand_key])){
60 if (empty($_POST['search_friends_'.$rand_key])){
61 $msg->addError('CANNOT_BE_EMPTY');
62 header('Location: '.url_rewrite(AT_SOCIAL_BASENAME.'groups/list.php?id='.$id, AT_PRETTY_URL_IS_HEADER));
65 $search_field = $addslashes($_POST['search_friends_'.$rand_key]);
66 $grp_members = $grp_obj->searchMembers($search_field);
70 //handle delete friends request
71 if (isset($_GET['remove']) && isset($_GET['member_id'])){
73 $member_id = $_GET['member_id'];
75 //validate if this is the creator of group
76 if($_SESSION['member_id']==$grp_obj->getUser()){
77 $grp_obj->removeMember($member_id);
78 $msg->addFeedback('GRUOP_MEMBER_REMOVED');
79 header('Location: '.url_rewrite(AT_SOCIAL_BASENAME.'groups/list.php?id='.$id, AT_PRETTY_URL_IS_HEADER));
84 include(AT_INCLUDE_PATH.'header.inc.php');
85 $savant->display('pubmenu.tmpl.php');
86 $savant->assign('grp_obj', $grp_obj);
87 $savant->assign('grp_members', $grp_members);
88 $savant->assign('rand_key', $rand_key);
89 $savant->display('sgroup_list.tmpl.php');
90 include(AT_INCLUDE_PATH.'footer.inc.php');