This repository has been archived by the owner on Oct 31, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
config_form.php
63 lines (59 loc) · 2.24 KB
/
config_form.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
<?php $view = get_view(); ?>
<div class="field">
<div class="two columns alpha">
<label><?php echo __('Limit to own Items')?></label>
</div>
<div class="inputs five columns omega">
<p class="explanation"><?php echo __("Check the roles that will be able to see only their own Items (in Admin mode). <br>N.B.: by default, Super User's role is not available for limitation."); ?></p>
<div class="input-block">
<?php
if (get_option('limit_visibility_to_own_items_roles') <> '') {
$limitedRoles = unserialize(get_option('limit_visibility_to_own_items_roles'));
} else {
$limitedRoles = array();
}
$userRoles = get_user_roles();
unset($userRoles['super']);
echo '<ul style="list-style-type:none">';
foreach($userRoles as $role=>$label) {
echo '<li>';
echo $view->formCheckbox('limit_visibility_to_own_items_roles[]', $role,
array('checked'=> (count($limitedRoles) > 0 ? in_array($role, $limitedRoles) : false) ? 'checked' : '')
);
echo ' ' . __($label);
echo '</li>';
}
echo '</ul>';
?>
</div>
</div>
</div>
<div class="field">
<div class="two columns alpha">
<label><?php echo __('Limit to own Collections')?></label>
</div>
<div class="inputs five columns omega">
<p class="explanation"><?php echo __("Check the roles that will be able to see only their own Collections (in Admin mode). <br>N.B.: by default, Super User's role is not available for limitation."); ?></p>
<div class="input-block">
<?php
if (get_option('limit_visibility_to_own_collections_roles') <> '') {
$limitedRoles = unserialize(get_option('limit_visibility_to_own_collections_roles'));
} else {
$limitedRoles = array();
}
$userRoles = get_user_roles();
unset($userRoles['super']);
echo '<ul style="list-style-type:none">';
foreach($userRoles as $role=>$label) {
echo '<li>';
echo $view->formCheckbox('limit_visibility_to_own_collections_roles[]', $role,
array('checked'=> (count($limitedRoles) > 0 ? in_array($role, $limitedRoles) : false) ? 'checked' : '')
);
echo ' ' . __($label);
echo '</li>';
}
echo '</ul>';
?>
</div>
</div>
</div>