Changeset 1095
- Timestamp:
- 05/11/07 16:00:59 (2 years ago)
- Files:
-
- devel/mod/community/lib.php (modified) (4 diffs)
- devel/mod/community/lib/communities_config.php (modified) (1 diff)
- devel/mod/community/lib/communities_edit.php (modified) (5 diffs)
- devel/mod/community/lib/communities_members.php (modified) (3 diffs)
- devel/mod/community/lib/communities_membership_requests.php (modified) (1 diff)
- devel/mod/community/lib/communities_moderator_of.php (modified) (3 diffs)
- devel/mod/community/lib/community_memberships.php (modified) (1 diff)
- devel/mod/community/lib/permissions_check.php (modified) (2 diffs)
- devel/mod/community/members.php (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
devel/mod/community/lib.php
r1080 r1095 26 26 global $CFG; 27 27 global $USER; 28 global $metatags;29 28 30 29 require_once (dirname(__FILE__)."/default_template.php"); 31 30 require_once (dirname(__FILE__)."/lib/communities_config.php"); 32 31 33 $metatags .= "<link rel=\"stylesheet\" href=\"" . $CFG->wwwroot . "mod/community/css.css\" type=\"text/css\" media=\"screen\" />";34 35 32 $page_owner = $profile_id; 36 33 … … 38 35 39 36 $username= user_info('username', $page_owner); 37 38 if (isloggedin()) { 39 if (defined("context") && context == COMMUNITY_CONTEXT && context!="network" && $page_owner == $_SESSION['userid']) { 40 41 $PAGE->menu[] = array( 'name' => 'community', 42 'html' => "<li><a href=\"{$CFG->wwwroot}{$_SESSION['username']}/communities\" class=\"selected\" >" .__gettext("Your Communities").'</a></li>'); 43 } else { 44 $PAGE->menu[] = array( 'name' => 'community', 45 'html' => "<li><a href=\"{$CFG->wwwroot}{$_SESSION['username']}/communities\" >" .__gettext("Your Communities").'</a></li>'); 46 } 47 } 40 48 41 49 if ($usertype == "community") { … … 76 84 'html' => a_href("{$CFG->wwwroot}{$username}/community/requests", 77 85 __gettext("View membership requests"))); 86 87 88 /*-----------------------------------* 89 * O2O BEGIN modified by mac 90 /*-----------------------------------*/ 91 /** 92 *it connects to invite to a person from a group by mac 93 */ 94 /* 95 $PAGE->menu_sub[] = array( 'name' => 'community:invite', 96 'html' => a_href( "{$CFG->wwwroot}_invite/", __gettext("Invite a friend"))); 97 */ 98 99 /**---- I hypertie to contact to add a group like member by mac --**/ 100 /* 101 $PAGE->menu_sub[] = array( 'name' => 'community:addgroup', 102 'html' => a_href("{$CFG->wwwroot}_communities/addgroup.php?profile_id=$page_owner", 103 __gettext("Invite a Community"))); 104 */ 105 /*-----------------------------------* 106 * O2O BEGIN modified by mac 107 /*-----------------------------------*/ 78 108 } 79 109 } … … 131 161 132 162 // 'Communities' aspect to the little menus beneath peoples' icons 163 $function['community:infobox:menu'][] = $CFG->dirroot . "mod/community/lib/communities_info_menu.php"; 133 164 $function['users:infobox:menu:text'][] = $CFG->dirroot . "mod/community/lib/user_info_menu_text.php"; 134 165 devel/mod/community/lib/communities_config.php
r1080 r1095 34 34 * Type: boolean 35 35 */ 36 define('COMMUNITY_COMPACT_VIEW', true); 36 define('COMMUNITY_COMPACT_VIEW', false); 37 38 /** 39 * Defines if its allowed to a community have members of type 'community' 40 * Type: boolean 41 */ 42 define('COMMUNITY_ALLOW_COMMUNITY_TYPE_MEMBERS',false); 37 43 ?> devel/mod/community/lib/communities_edit.php
r1087 r1095 10 10 JOIN '.$CFG->prefix.'users u ON u.ident = f.friend 11 11 WHERE f.owner = ? AND u.user_type = ?', array($user_id,'community')); 12 13 END;14 12 $i = 1; 15 13 if (!empty($result)) { … … 19 17 $friends_name = user_name($info->ident); 20 18 $info->icon = run("icons:get",$info->ident); 21 $friends_menu = run(" users:infobox:menu",array($info->ident));19 $friends_menu = run("community:infobox:menu",array($info)); 22 20 $friends_icon = user_icon_html($info->ident,COMMUNITY_ICON_SIZE); 23 21 $link = $CFG->wwwroot.$info->username."/"; 24 $functions = array(); 25 $members = get_records("friends","friend",$info->ident); 26 $membercount = count($members); 27 $functions[] = "<a href=\"".$CFG->wwwroot.$info->username."/community/members\">".__gettext("Members")." (".$membercount.")</a>"; 28 if($info->owner == $_SESSION['userid']){ 29 $_body = &$owned; 30 $functions[] = "<a href=\"".$CFG->wwwroot.$info->username."/profile\">".__gettext("Administrate")."</a>"; 31 $msg= "onclick=\"return confirm('". addslashes(__gettext("Are you sure you want to delete this community?")) ."')\""; 32 $functions[] = "<a href=\"".$CFG->wwwroot.$info->username."/community/delete\" $msg>".__gettext("Delete")."</a>"; 33 if ($user_id != $_SESSION['userid']) { 34 $_body = &$member; 35 $msg= "onclick=\"return confirm('". addslashes(__gettext("Are you sure you want to separate this user from the community?")) ."')\""; 36 $functions[] = "<a href=\"".$CFG->wwwroot.$info->username."/community/separate/".$user_id."\" $msg>".__gettext("Separate")."</a>"; 37 } 22 if ($info->owner == $user_id) { 23 $_body = & $owned; 24 } else { 25 $_body = & $member; 38 26 } 39 $functions = implode("\n",array_map(create_function('$entry',"return \"<li>\$entry</li>\";"),$functions));40 27 $_body[] = templates_draw(array( 41 28 'context' => 'community_member', … … 43 30 'icon' => $friends_icon, 44 31 'link' => $link, 45 'functions' => $f unctions32 'functions' => $friends_menu 46 33 ) 47 34 ); … … 53 40 array_walk($member,create_function('&$body,$i',$separator_function)); 54 41 $separator="<td $colspan>$memberlabel</td></tr><tr>"; 55 $memberlabel = "<h2>".__gettext("Communities to which I belong")."</h2>"; 42 //$memberlabel = "<h2>".__gettext("Communities to which I belong")."</h2>"; 43 $memberlabel = "<h2>".sprintf(__gettext("Communities were %s belongs"),user_info('name',$user_id))."</h2>"; 56 44 if(!empty($owned)){ 57 $body="<td $colspan><h2>". __gettext("Owned Communities")."</h2></td></tr><tr>";45 $body="<td $colspan><h2>".sprintf(__gettext("Communities owned by %s"),user_info('name',$user_id))."</h2></td></tr><tr>"; 58 46 $body.= implode("\n",$owned); 59 47 $separator="<td $colspan><hr>$memberlabel</td></tr><tr>"; … … 69 57 $body = implode("\n",$member); 70 58 } 71 72 59 } else { 73 60 if ($user_id == $_SESSION['userid']) { devel/mod/community/lib/communities_members.php
r1087 r1095 2 2 global $CFG; 3 3 // Given a user ID as a parameter, will display a list of communities 4 4 5 5 6 if (isset($parameter[0])) { … … 9 10 $community_owner = user_info('owner',$community_id); 10 11 11 $result = get_records_sql('SELECT u.*, f.ident AS friendident FROM '.$CFG->prefix.'friends f 12 if(COMMUNITY_ALLOW_COMMUNITY_TYPE_MEMBERS){ 13 $result = get_records_sql('SELECT u.*, f.ident AS friendident FROM '.$CFG->prefix.'friends f 14 JOIN '.$CFG->prefix.'users u ON u.ident = f.owner 15 WHERE f.friend = ?',array($community_id)); 16 17 } 18 else{ 19 $result = get_records_sql('SELECT u.*, f.ident AS friendident FROM '.$CFG->prefix.'friends f 12 20 JOIN '.$CFG->prefix.'users u ON u.ident = f.owner 13 21 WHERE f.friend = ? AND u.user_type = ?',array($community_id,'person')); 22 } 14 23 15 24 $i = 1; … … 22 31 // $friends_menu = run("users:infobox:menu",array($info->ident)); 23 32 $functions = array(); 24 if($community_owner != $info->ident && 25 $community_owner == $_SESSION['userid']){ 33 if($community_owner != $info->ident && $community_owner == $_SESSION['userid']){ 26 34 $msg= "onclick=\"return confirm('". __gettext("Are you sure you want to separate this user from the community?") ."')\""; 27 35 $functions[] = "<a href=\"".$CFG->wwwroot.$community_name."/community/separate/".$info->ident."\" $msg>".__gettext("Separate")."</a>"; 28 36 } 29 else if ($community_owner == $info->ident){30 $functions[] = "<b>(".__gettext("Owner").")</b>";37 else if($community_owner == $info->ident){ 38 $functions[] = "<b>(".__gettext("Owner").")</b>"; 31 39 } 32 //@todo Add the funcionality to add admin users.33 40 34 41 $functions = implode("\n",array_map(create_function('$entry',"return \"<li>\$entry</li>\";"),$functions)); devel/mod/community/lib/communities_membership_requests.php
r1080 r1095 1 1 <?php 2 2 global $CFG; 3 3 4 $body = ''; 4 5 // Lists membership requests for a community devel/mod/community/lib/communities_moderator_of.php
r1087 r1095 16 16 $friends_name = user_name($info->ident); 17 17 $info->icon = run("icons:get",$info->ident); 18 // $friends_menu = run("users:infobox:menu",array($info->ident));18 $friends_menu = run("community:infobox:menu",array($info)); 19 19 $friends_icon = user_icon_html($info->ident,COMMUNITY_ICON_SIZE); 20 20 $link = $CFG->wwwroot.$info->username."/"; 21 $functions = array();22 $members = get_records("friends","friend",$info->ident);23 $membercount = count($members);24 $functions[] = "<a href=\"".$CFG->wwwroot.$info->username."/community/members\">".__gettext("Members")." (".$membercount.")</a>";25 if ($info->owner == $_SESSION['userid']) {26 $functions[] = "<a href=\"".$CFG->wwwroot.$info->username."/profile\">".__gettext("Administrate")."</a>";27 $msg= "onclick=\"return confirm('". __gettext("Are you sure you want to delete this community?") ."')\"";28 $functions[] = "<a href=\"".$CFG->wwwroot.$info->username."/community/delete\" $msg>".__gettext("Delete")."</a>";29 }30 21 31 $functions = implode("\n",array_map(create_function('$entry',"return \"<li>\$entry</li>\";"),$functions));32 22 $body .= templates_draw(array( 33 23 'context' => 'community_member', … … 35 25 'icon' => $friends_icon, 36 26 'link' => $link, 37 'functions' => $f unctions27 'functions' => $friends_menu 38 28 ) 39 29 ); … … 59 49 60 50 } 61 62 51 ?> devel/mod/community/lib/community_memberships.php
r1087 r1095 2 2 global $CFG; 3 3 global $page_owner; 4 4 5 5 if ($page_owner != -1) { 6 6 if (user_type($page_owner) == "person" || user_type($page_owner) == "external") { devel/mod/community/lib/permissions_check.php
r1094 r1095 45 45 if (record_exists('users','ident',$owner,'owner',$USER->ident,'user_type','community')) { 46 46 $run_result = true; 47 } /*47 } 48 48 if (empty($run_result)) { 49 /* 49 50 if (count_records_sql('SELECT count(u.ident) FROM '.$CFG->prefix.'friends f 50 51 JOIN '.$CFG->prefix.'users u ON u.ident = f.friend … … 53 54 $run_result = true; 54 55 } 55 }*/ 56 */ 57 } 56 58 break; 57 59 case "userdetails:change": devel/mod/community/members.php
r1080 r1095 18 18 19 19 // Whose friends are we looking at? 20 global $page_owner ;20 global $page_owner,$profile_id; 21 21 22 22 // You must be logged on to view this!
