forked from projectsend/projectsend
-
Notifications
You must be signed in to change notification settings - Fork 0
/
groups-form.php
93 lines (85 loc) · 3.58 KB
/
groups-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
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
<?php
/**
* Contains the form that is used when adding or editing groups.
*
* @package ProjectSend
* @subpackage Groups
*
*/
?>
<script type="text/javascript">
$(document).ready(function() {
$("form").submit(function() {
clean_form(this);
is_complete(this.add_group_form_name,'<?php echo $validation_no_name; ?>');
// show the errors or continue if everything is ok
if (show_form_errors() == false) { return false; }
});
});
</script>
<?php
switch ($groups_form_type) {
case 'new_group':
$submit_value = __('Create group','cftp_admin');
$form_action = 'groups-add.php';
break;
case 'edit_group':
$submit_value = __('Save group','cftp_admin');
$form_action = 'groups-edit.php?id='.$group_id;
break;
}
?>
<form action="<?php echo html_output($form_action); ?>" name="addgroup" method="post" class="form-horizontal">
<div class="form-group">
<label for="add_group_form_name" class="col-sm-4 control-label"><?php _e('Group name','cftp_admin'); ?></label>
<div class="col-sm-8">
<input type="text" name="add_group_form_name" id="add_group_form_name" class="form-control required" value="<?php echo (isset($add_group_data_name)) ? html_output(stripslashes($add_group_data_name)) : ''; ?>" />
</div>
</div>
<div class="form-group">
<label for="add_group_form_description" class="col-sm-4 control-label"><?php _e('Description','cftp_admin'); ?></label>
<div class="col-sm-8">
<textarea name="add_group_form_description" id="add_group_form_description" class="form-control"><?php echo (isset($add_group_data_description)) ? html_output($add_group_data_description) : ''; ?></textarea>
</div>
</div>
<div class="form-group assigns">
<label for="add_group_form_members" class="col-sm-4 control-label"><?php _e('Members','cftp_admin'); ?></label>
<div class="col-sm-8">
<select multiple="multiple" id="members-select" class="form-control chosen-select" name="add_group_form_members[]" data-placeholder="<?php _e('Select one or more options. Type to search.', 'cftp_admin');?>">
<?php
$sql = $dbh->prepare("SELECT * FROM " . TABLE_USERS . " WHERE level = '0' ORDER BY name ASC");
$sql->execute();
$sql->setFetchMode(PDO::FETCH_ASSOC);
while ( $row = $sql->fetch() ) {
?>
<option value="<?php echo $row["id"]; ?>"
<?php
if($groups_form_type == 'edit_group') {
if (in_array($row["id"],$current_members)) {
echo ' selected="selected"';
}
}
?>
><?php echo html_output($row["name"]); ?></option>
<?php
}
?>
</select>
<div class="list_mass_members">
<a href="#" class="btn btn-default add-all" data-type="assigns"><?php _e('Add all','cftp_admin'); ?></a>
<a href="#" class="btn btn-default remove-all" data-type="assigns"><?php _e('Remove all','cftp_admin'); ?></a>
</div>
</div>
</div>
<div class="form-group">
<div class="col-sm-8 col-sm-offset-4">
<label for="add_group_form_public">
<input type="checkbox" name="add_group_form_public" id="add_group_form_public" <?php echo (isset($add_group_data_public) && $add_group_data_public == 1) ? 'checked="checked"' : ''; ?>> <?php _e('Public','cftp_admin'); ?>
<p class="field_note"><?php _e('Allows clients to request access to this group in the registraron process and when editing their own profile. This feature requires the corresponding option to be enabled on the CLIENTS OPTIONS page.','cftp_admin'); ?></p>
</label>
</div>
</div>
<div class="inside_form_buttons">
<button type="submit" name="submit" class="btn btn-wide btn-primary"><?php echo html_output($submit_value); ?></button>
</div>
</form>