Fixed syntax error in groupSelection
[PHPCredLocker.git] / lib / includes / groupSelection.php
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
<?php
/** Single Group Selection Select Menu
*
* Copyright (C) 2012 B Tasker
* Released under GNU GPL V2
* See LICENSE
*
*
* Set the variable multiselect to 1 before calling this file to display checkboxes
*/
 
defined('_CREDLOCK') or die;
 
 
 
 
if (!isset($auth)){
$auth = new AuthDB;
}
 
if (!isset($crypt)){
$crypt = new Crypto;
}
 
 
 
$groups = $auth->retrieveGroupNames();
 
if (BTMain::getUser()->PortalLogin == 1):?>
 
 
<select name="frmGroup" id="frmGroup" style="display: none;">
<option value="<?php if (isset($preselect)){ echo $preselect; } else{ echo 0;}?>">nochange</option>
</select>
 
</select>
 
 
<?php else: ?>
 
 
<?php if ($multiselect != 1):
?> 
<label for="frmGroup">Group</label><select name="frmGroup" id="frmGroup">
<option value='null'> -- Select Group --</option>
<option value="0" <?php if (isset($preselect) && $preselect == 0){ echo "selected";}?>>All users</option>
<?php
 
foreach ($groups as $group){
 
$plaintext = $crypt->decrypt($group->Name,'Groups');
 
$str = "<option value='{$group->id}' ";
 
if ($group->id == $preselect){
$str .= "selected";
}
 
$str .= ">$plaintext</option>";
 
$grps[$plaintext] = $str;
 
}
 
ksort($grps);
echo implode("\n",$grps);
unset($grps);
?>
</select>
 
<?php else:?>
 
<fieldset class='groupsMultiSelect' id='groupsMultiSelect'><legend>Select Groups</legend>
<?php
foreach ($groups as $group){
 
$plaintext = $crypt->decrypt($group->Name,'Groups');
 
$grps[$plaintext] = "<span class='checkbox'><input type='checkbox' name='frmGroup[]' value='{$group->id}'";
 
if (in_array($group->id,$Ugroups)): $grps[$plaintext] .= " checked"; endif;
 
$grps[$plaintext] .= ">$plaintext</span>";
 
}
 
ksort($grps);
echo implode("\n",$grps);
unset($grps);
?>
</fieldset>
<?php endif;?>
 
<?php endif; ?>