2 /****************************************************************/
4 /****************************************************************/
5 /* Copyright (c) 2002-2009 */
6 /* Inclusive Design Institute */
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 /****************************************************************/
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/PrivacyController.class.php');
21 require(AT_SOCIAL_INCLUDE.'classes/PrivacyControl/PrivacyObject.class.php');
22 $_custom_css = $_base_path . AT_SOCIAL_BASENAME . 'module.css'; // use a custom stylesheet
25 if (!$_SESSION['valid_user']) {
26 require(AT_INCLUDE_PATH.'header.inc.php');
27 $info = array('INVALID_USER', $_SESSION['course_id']);
28 $msg->printInfos($info);
29 require(AT_INCLUDE_PATH.'footer.inc.php');
35 $id = intval($_GET['id']);
36 if ($id=='' || $id==0){
37 $id = $_SESSION['member_id'];
39 $_SESSION['last_visited_page'] = $_base_href.AT_SOCIAL_BASENAME.'sprofile.php?id='.$id;
42 $friends = getFriends($id);
45 if ($id!=$_SESSION['member_id']){
46 $my_friends = getFriends($_SESSION['member_id']);
47 $mutual_friends = array_intersect($friends, $my_friends);
49 $mutual_friends = array();
53 $act_obj = new Activity();
54 $activities = $act_obj->getActivities($id);
57 $profile = new Member($id);
60 if ($profile->getID() != $_SESSION['member_id']){
61 $profile->addVisitor($_SESSION['member_id']);
65 $pc = new PrivacyController();
66 $privacy_obj = $pc->getPrivacyObject($id);
67 if ($privacy_obj==null){
69 //add error and redirect back to is own page?
70 // header('Location: sprofile.php');
73 $relationship = $pc->getRelationship($id);
74 $profile_prefs = $privacy_obj->getProfile();
78 if (isset($_GET['delete'])){
79 $id = intval($_GET['delete']);
81 if ($act_obj->deleteActivity($id)){
82 $msg->addFeedBack('ACTIVITY_DELETED');
84 $msg->addError('ACTIVITY_DELETE_FAILED');
86 header('Location: '.url_rewrite(AT_SOCIAL_BASENAME.'sprofile.php', AT_PRETTY_URL_HEADER));
92 include(AT_INCLUDE_PATH.'header.inc.php');
94 $savant->display('social/pubmenu.tmpl.php');
95 if (!empty($mutual_friends)){
96 $savant->assign('mutual_friends', $mutual_friends);
98 $savant->assign('scope', ($id!=$_SESSION['member_id']) ? 'viewer' : 'owner');
99 $savant->assign('profile', $profile->getDetails());
100 $savant->assign('education', $profile->getEducation());
101 $savant->assign('position', $profile->getPosition());
102 $savant->assign('websites', $profile->getWebsites());
103 $savant->assign('friends', $friends);
104 $savant->assign('activities', $activities);
105 $savant->assign('prefs', $profile_prefs);
106 $savant->assign('relationship', $relationship);
107 $savant->assign('representation', $profile->getRepresentation());
108 $savant->assign('contact', $profile->getContact());
109 $savant->assign('personal', $profile->getPersonal());
111 $savant->display('social/sprofile.tmpl.php');
112 include(AT_INCLUDE_PATH.'footer.inc.php');