Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
mahara
mahara
Commits
89fdc919
Commit
89fdc919
authored
Jan 26, 2007
by
Nigel McNie
Committed by
Nigel McNie
Jan 26, 2007
Browse files
Merge with
git+ssh://git.catalyst.net.nz/var/git/mahara.git#master
parents
f2c95f8a
77ba7d21
Changes
3
Hide whitespace changes
Inline
Side-by-side
htdocs/contacts/communities/view.php
View file @
89fdc919
...
...
@@ -40,13 +40,15 @@ if (!$community = get_record('community', 'id', $id)) {
$community
->
ownername
=
display_name
(
get_record
(
'usr'
,
'id'
,
$community
->
owner
));
$membership
=
user_can_access_community
(
$id
);
// $membership is a bit string summing all membership types
$ismember
=
(
bool
)
(
$membership
&
COMMUNITY_MEMBERSHIP_MEMBER
);
if
(
!
empty
(
$joincontrol
))
{
// leave, join, acceptinvite, request
switch
(
$joincontrol
)
{
case
'leave'
:
// make sure they're a member and can leave
if
(
$member
ship
==
COMMUNITY_MEMBERSHIP_MEMBER
&&
$community
->
jointype
!=
'controlled'
)
{
if
(
$
is
member
&&
$community
->
jointype
!=
'controlled'
)
{
community_remove_member
(
$id
,
$USER
->
get
(
'id'
));
$SESSION
->
add_ok_msg
(
get_string
(
'leftcommunity'
));
}
...
...
@@ -55,7 +57,7 @@ if (!empty($joincontrol)) {
}
break
;
case
'join'
:
if
(
empty
(
$
member
ship
)
&&
$community
->
jointype
==
'open'
)
{
if
(
!
$is
member
&&
$community
->
jointype
==
'open'
)
{
community_add_member
(
$id
,
$USER
->
get
(
'id'
));
$SESSION
->
add_ok_msg
(
get_string
(
'joinedcommunity'
));
}
...
...
@@ -80,7 +82,7 @@ if (!empty($joincontrol)) {
$SESSION
->
add_ok_msg
(
$message
);
break
;
case
'request'
:
if
(
empty
(
$
member
ship
)
&&
$community
->
jointype
==
'request'
if
(
!
$is
member
&&
$community
->
jointype
==
'request'
&&
!
record_exists
(
'community_member_request'
,
'community'
,
$id
,
'member'
,
$USER
->
get
(
'id'
)))
{
$cmr
=
new
StdClass
;
$cmr
->
reason
=
param_variable
(
'reason'
,
null
);
...
...
@@ -135,14 +137,14 @@ $removefromwatchliststr = get_string('removefromwatchlist', 'activity');
$addtowatchliststr
=
get_string
(
'addtowatchlist'
,
'activity'
);
// all the permissions stuff
$tutor
=
(
int
)(
$membership
<
COMMUNITY_MEMBERSHIP_MEMBER
);
$tutor
=
(
int
)(
$membership
&&
(
$membership
<
COMMUNITY_MEMBERSHIP_MEMBER
)
)
;
$controlled
=
(
int
)(
$community
->
jointype
==
'controlled'
);
$admin
=
(
int
)(
$membership
==
COMMUNITY_MEMBERSHIP_ADMIN
);
$admin
=
(
int
)(
$membership
&
COMMUNITY_MEMBERSHIP_ADMIN
!=
0
);
$canremove
=
(
int
)((
$tutor
&&
$controlled
)
||
$admin
);
$canpromote
=
(
int
)
$tutor
;
$canleave
=
(
$member
ship
==
COMMUNITY_MEMBERSHIP_MEMBER
&&
$community
->
jointype
!=
'controlled'
);
$canrequestjoin
=
(
empty
(
$
member
ship
)
&&
empty
(
$invited
)
&&
empty
(
$requested
)
&&
$community
->
jointype
==
'request'
);
$canjoin
=
(
empty
(
$
member
ship
)
&&
$community
->
jointype
==
'open'
);
$canleave
=
(
$
is
member
&&
$community
->
jointype
!=
'controlled'
);
$canrequestjoin
=
(
!
$is
member
&&
empty
(
$invited
)
&&
empty
(
$requested
)
&&
$community
->
jointype
==
'request'
);
$canjoin
=
(
!
$is
member
&&
$community
->
jointype
==
'open'
);
$javascript
=
''
;
if
(
$membership
)
{
...
...
htdocs/lib/community.php
View file @
89fdc919
...
...
@@ -200,9 +200,9 @@ function get_tutor_communities($userid=0, $jointype=null) {
// constants for community membership type
define
(
'COMMUNITY_MEMBERSHIP_ADMIN'
,
1
);
define
(
'COMMUNITY_MEMBERSHIP_STAFF'
,
2
);
define
(
'COMMUNITY_MEMBERSHIP_OWNER'
,
3
);
define
(
'COMMUNITY_MEMBERSHIP_TUTOR'
,
4
);
define
(
'COMMUNITY_MEMBERSHIP_MEMBER'
,
5
);
define
(
'COMMUNITY_MEMBERSHIP_OWNER'
,
4
);
define
(
'COMMUNITY_MEMBERSHIP_TUTOR'
,
8
);
define
(
'COMMUNITY_MEMBERSHIP_MEMBER'
,
16
);
/**
...
...
@@ -238,25 +238,27 @@ function user_can_access_community($community, $user=null) {
throw
new
InvalidArgumentException
(
"not useful community arg given to user_can_access_community:
$community
"
);
}
$membertypes
=
0
;
if
(
$user
->
get
(
'admin'
))
{
return
COMMUNITY_MEMBERSHIP_ADMIN
;
$membertypes
=
COMMUNITY_MEMBERSHIP_ADMIN
;
}
if
(
$user
->
get
(
'staff'
))
{
return
COMMUNITY_MEMBERSHIP_STAFF
;
$membertypes
=
$membertypes
|
COMMUNITY_MEMBERSHIP_STAFF
;
}
if
(
$community
->
owner
==
$user
->
get
(
'id'
))
{
return
COMMUNITY_MEMBERSHIP_OWNER
;
$membertypes
=
$membertypes
|
COMMUNITY_MEMBERSHIP_OWNER
;
}
if
(
!
$membership
=
get_record
(
'community_member'
,
'community'
,
$community
->
id
,
'member'
,
$user
->
get
(
'id'
)))
{
return
false
;
return
$membertypes
;
}
if
(
$membership
->
tutor
)
{
return
COMMUNITY_MEMBERSHIP_TUTOR
;
$membertypes
=
$membertypes
|
COMMUNITY_MEMBERSHIP_TUTOR
;
}
return
COMMUNITY_MEMBERSHIP_MEMBER
;
return
(
$membertypes
|
COMMUNITY_MEMBERSHIP_MEMBER
)
;
}
...
...
htdocs/view/view.php
View file @
89fdc919
...
...
@@ -169,7 +169,7 @@ function feedbackform() {
}
}
appendChildNodes(form,
TABLE(
null
,
TABLE(
{'border':0, 'cellspacing':0, 'id':'feedback'}
,
TBODY(null,
TR(null, TH(null, LABEL(null, {$getstring['message']}))),
TR(null, TD(null, TEXTAREA({'rows':5, 'cols':80, 'name':'message'}))),
...
...
@@ -200,7 +200,7 @@ function objectionform() {
return false;
}
appendChildNodes(form,
TABLE({'border':0, 'cellspacing':0},
TABLE({'border':0, 'cellspacing':0
, 'id':'objection'
},
TBODY(null,
TR(null, TH(null, LABEL(null, {$getstring['complaint']}))),
TR(null, TD(null, TEXTAREA({'rows':5, 'cols':80, 'name':'message'}))),
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment