summaryrefslogtreecommitdiffstats
path: root/application/modules/user/views/scripts/group/show.phtml
blob: 7e2eec0d4c6734eee0056efd0728236665822237 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
<h1>Groupdetails - <?php echo $this->group->getTitle();?></h1>
<?php
if($this->usergroup == $this->requestgroup){
	if(Pbs_Acl::checkRight('gd')){
	echo $this->formButton('deletegroup', 'Delete', array(
							'onclick' => 'self.location="/user/group/delete/"',
							'class' => 'rightbutton'));
	}
	if(Pbs_Acl::checkRight('geo')){
	echo $this->formButton('editgroup', 'Edit', array(
							'onclick' => 'self.location="/user/group/edit/"',
							'class' => 'rightbutton'));
	}
}
elseif($this->usergroup != $this->requestgroup){
	if(Pbs_Acl::checkRight('gd')){
	echo $this->formButton('deletegroup', 'Delete', array(
							'onclick' => 'self.location="/user/group/delete/groupID/' . $this->group->getID() .'"',
							'class' => 'rightbutton'));
	}
	if(Pbs_Acl::checkRight('ge')){
	echo $this->formButton('editgroup', 'Edit', array(
							'onclick' => 'self.location="/user/group/edit/groupID/' . $this->group->getID() .'"',
							'class' => 'rightbutton'));
	}
}
?>
<div class='listelement'>
<div class='element'>
<div class='number'><?php			
if($this->usergroup == $this->requestgroup){ ?>
<div class='smallnumber'>Your Group</div>
<?php }else{ ?>
<div class='smallnumber'>Group</div>
<?php echo $this->group->getID(); ?> <?php } ?></div>
<div class='content'>
<div class='title'><?php echo $this->group->getTitle(); ?></div>
<div class='subtitle'><?php echo $this->group->getDescription(); ?></div>
<?php if(isset($parentGroup) && is_object($parentGroup)): ?>
<div class='details'><label>Superordinated Group:</label>
<div class='item'><?php echo $this->parentGroup->getTitle(); ?></div>
</div>
<?php endif ;?></div>
<div class='clear'></div>
</div>
</div>
<div class='bottomimg'>
		<img alt="" src='/stats/graphgroup/group/<?php echo $this->group->getID();?>' />
	</div>
<?php


// Show Request List
if(isset($this->groupRequestList) && (Pbs_Acl::checkRight('grog') || Pbs_Acl::checkRight('grotg'))){
	?>
<br />
<h2>Requests:</h2>
<div class='listelement'><?php
foreach($this->groupRequestList as $grouprequest) {
	$grouprequestID = $grouprequest['grouprequestID'];
	$person = $grouprequest['person'];
	?>
	<div class='element'>
		<div class='content'><?php 
		if($this->usergroup == $this->requestgroup && (Pbs_Acl::checkRight('gam') || Pbs_Acl::checkRight('gdm'))){
			?>
		<div class='actions'><?php if(Pbs_Acl::checkRight('gam')): ?>
			<form action="/user/group/grantperson" method="post">
				<input	type="hidden" name="grouprequestID" value="<?php echo $grouprequestID; ?>" />Role:<?php printRoleSelect($this->roleList); ?>
				<input type="image" src='/media/img/save.png' alt='Grant Person' name="confirm" value="confirm" /> <?php endif; ?> <?php if(Pbs_Acl::checkRight('gdm')): ?>
				<a href="<?php echo $this->url(
						array(
							'module'	=> 'user',
							'controller' => 'group',
							'action'     => 'decline',
							'grouprequestID'   =>  $grouprequestID,
						),
						'default',
						true) ?>"><img src='/media/img/delete.png' alt='Decline Membership' /></a> <?php endif; ?></form>
		</div>
		<?php
		}
		?>

		<div class='title'><?php echo $person->getTitle(); ?>&nbsp;<?php echo $person->getFirstname(); ?>&nbsp;<?php echo $person->getName(); ?></div>
		<div class='subtitle'><?php echo $person->getCity(); ?></div>
		<div class='details dispnone'>
			<label>Email</label>
			<div class='item'><?php echo $person->getEmail(); ?>
		</div>
	</div>
</div>
</div>
<?php
}
?></div>
<?php
}
// Show Memberlist
if(isset($this->membersList) && 
	(
		(Pbs_Acl::checkRight('gsmg') && $this->group->getID() != $this->usergroup) || 
		(Pbs_Acl::checkRight('gsmgo') && $this->group->getID() == $this->usergroup)
		)){
	?>
<br />
<h2>Members:</h2>
<div class='listelement'><?php 
if(count($this->membersList)==0)
echo "This hroup has no members."
?> <?php foreach ($this->membersList as $k => $member): ?> <?php
$membershipID = $member['membershipID'];
$suspend = $member['suspend'];
$person = $member['person'];
$role = $member['role'];
$class='';
if($person->getID() == $this->userIDsNamespace['personID'])
$class= 'highlight checked';
?>
<div class='element<?php echo " $class";?>'><?php
if($person->getID() != $this->userIDsNamespace['personID']) {
	?>
<div class='number'>
<div class='smallnumber'>Person</div>
	<?php echo $k+1; ?></div>
	<?php
}
?>
<div class='content'>
<div class='actions'><?php
if((Pbs_Acl::checkRight('gdmo') && $this->usergroup == $this->requestgroup) || (Pbs_Acl::checkRight('gdmog') && $this->usergroup != $this->requestgroup)):
?> <a
	href="<?php echo $this->url(
						array(
							'module'	=> 'user',
							'controller' => 'group',
							'action'     => 'revokeperson',
							'membershipID'   =>  $membershipID,
						),
						'default',
						true) ?>"> <img src='/media/img/delete.png'
	alt='Revoke Membership' /></a> <?php
	endif;
	if(Pbs_Acl::checkRight('gsm')) {
		if($suspend == 1)
		{
			?> <a
	href=" <?php echo $this->url(
						array(
							'module'	=> 'user',
							'controller' => 'group',
							'action'     => 'resumemembership',
							'membershipID'   =>  $membershipID
						),
						'default',
						true); ?>"> <img src='/media/img/resume.png'
	alt='Resume Membership' /></a> <?php
		} else {
			?> <a
	href=" <?php echo $this->url(
						array(
							'module'	=> 'user',
							'controller' => 'group',
							'action'     => 'suspendmembership',
							'membershipID'   =>  $membershipID
						),
						'default',
						true); ?>"> <img src='/media/img/suspend.png'
	alt='Suspend Membership' /></a> <?php
		}
	}
	?></div>
<div class='title'><?php echo $person->getFirstname(); ?> <?php echo $person->getName(); ?></div>
<div class='subtitle'>Role: <?php echo $role->getTitle(); ?></div>
<div class='details dispnone'><label>Email</label>
<div class='item'><?php echo $person->getEmail(); ?></div>
<label>City</label>
<div class='item'><?php echo $person->getCity(); ?></div>
	<?php
	if(Pbs_Acl::checkRight('gsm')) {
		?> <label>Membership suspended</label>
<div class='item'><?php if($suspend == 1) echo "yes"; else echo "no"; ?></div>
		<?php
	}
	?></div>
</div>
<div class='clear'></div>
</div>
	<?php endforeach ?></div>
	<?php echo $this->memberPagination; ?>
	<?php

}

function printRoleSelect($roleList) {
	$s = '';
	echo "<select name=\"roleID\">";
	foreach($roleList as $grouptitle=>$head) {
		#print_a($grouptitle,$head);
		echo "<optgroup label='".$grouptitle."'>";
		foreach($head as $role){		
			echo "<option value=\"" . $role->getID() . "\">" . $role->getTitle() . "</option>";
		}
		echo "</optgroup>";
	}
	echo "</select>";
}
?>