PageRenderTime 595ms CodeModel.GetById 483ms app.highlight 7ms RepoModel.GetById 103ms app.codeStats 0ms

/halogy/application/modules/users/views/add_group.php

https://bitbucket.org/haloweb/halogy-1.0/
PHP | 86 lines | 66 code | 20 blank | 0 comment | 5 complexity | 4ba764d453b99acaac1a3496492744d2 MD5 | raw file
 1<script type="text/javascript">
 2$(function(){
 3	$flag = false;
 4	$('div.permissions input[type="checkbox"]').each(function(){
 5		if ($(this).attr('checked')) {
 6			$(this).parent('div').prev('div').children('input[type="checkbox"]').attr('checked', true);
 7		}
 8	});
 9	$('.selectall').click(function(){
10		$el = $(this).parent('div').next('div').children('input[type="checkbox"]');
11		$flag = $(this).attr('checked');
12		if ($flag) {
13			$($el).attr('checked', true);
14		}
15		else {
16			$($el).attr('checked', false);
17		}
18	});
19	$('.seemore').click(function(){
20		$el = $(this).parent('div').next('div');
21		$($el).toggle('400');
22	});
23	$('a.selectall').click(function(event){
24		event.preventDefault();
25		$('input[type="checkbox"]').attr('checked', true);
26	});
27	$('a.deselectall').click(function(event){
28		event.preventDefault();
29		$('input[type="checkbox"]').attr('checked', false);
30	});	
31});
32</script>
33
34<form method="post" action="<?php echo $this->uri->uri_string(); ?>" class="default">
35
36	<h1 class="headingleft">Add User Group <small>(<a href="/admin/users/groups">Back to User Groups</a>)</small></h1>
37
38	<div class="headingright">
39		<input type="submit" value="Save Changes" class="button" />
40	</div>
41	
42	<div class="clear"></div>
43	
44	<?php if ($errors = validation_errors()): ?>
45		<div class="error">
46			<?php echo $errors; ?>
47		</div>
48	<?php endif; ?>
49
50	<label for="groupName">Name this group:</label><br class="clear" />
51	<?php echo @form_input('groupName',set_value('groupName', $data['groupName']), 'id="groupName" class="formelement"'); ?>
52	<br class="clear" /><br />
53
54	<?php if ($permissions): ?>
55
56	<h3>Administrative Permissions</h3>
57	
58	<p><a href="#" class="selectall button small nolabel grey">Select All</a> <a href="#" class="deselectall button small grey">De-Select All</a></p>
59	
60	<?php foreach ($permissions as $cat => $perms): ?>
61
62		<div class="perm-heading">
63			<label for="<?php echo strtolower($cat); ?>_all" class="radio"><?php echo $cat; ?></label>
64			<input type="checkbox" class="selectall checkbox" id="<?php echo strtolower($cat); ?>_all" />
65			<input type="button" value="See more" class="seemore small-button" />
66		</div>
67
68		<div class="permissions">
69
70		<?php foreach ($perms as $perm): ?>
71
72			<label for="<?php echo 'perm_'.$perm['key']; ?>" class="radio"><?php echo $perm['permission']; ?></label>
73			<?php echo @form_checkbox('perm'.$perm['permissionID'], 1, set_value('perm'.$perm['permissionID'], $data['perm'.$perm['permissionID']]), 'id="'.'perm_'.$perm['key'].'" class="checkbox"'); ?>
74			<br class="clear" />
75
76		<?php endforeach; ?>
77
78		</div>
79
80	<?php endforeach; ?>
81	<?php endif; ?>
82
83
84	<p class="clear" style="text-align: right;"><a href="#" class="button grey" id="totop">Back to top</a></p>
85	
86</form>