/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. <form method="post" action="<?php echo $this->uri->uri_string(); ?>" class="default">
  34. <h1 class="headingleft">Add User Group <small>(<a href="/admin/users/groups">Back to User Groups</a>)</small></h1>
  35. <div class="headingright">
  36. <input type="submit" value="Save Changes" class="button" />
  37. </div>
  38. <div class="clear"></div>
  39. <?php if ($errors = validation_errors()): ?>
  40. <div class="error">
  41. <?php echo $errors; ?>
  42. </div>
  43. <?php endif; ?>
  44. <label for="groupName">Name this group:</label><br class="clear" />
  45. <?php echo @form_input('groupName',set_value('groupName', $data['groupName']), 'id="groupName" class="formelement"'); ?>
  46. <br class="clear" /><br />
  47. <?php if ($permissions): ?>
  48. <h3>Administrative Permissions</h3>
  49. <p><a href="#" class="selectall button small nolabel grey">Select All</a> <a href="#" class="deselectall button small grey">De-Select All</a></p>
  50. <?php foreach ($permissions as $cat => $perms): ?>
  51. <div class="perm-heading">
  52. <label for="<?php echo strtolower($cat); ?>_all" class="radio"><?php echo $cat; ?></label>
  53. <input type="checkbox" class="selectall checkbox" id="<?php echo strtolower($cat); ?>_all" />
  54. <input type="button" value="See more" class="seemore small-button" />
  55. </div>
  56. <div class="permissions">
  57. <?php foreach ($perms as $perm): ?>
  58. <label for="<?php echo 'perm_'.$perm['key']; ?>" class="radio"><?php echo $perm['permission']; ?></label>
  59. <?php echo @form_checkbox('perm'.$perm['permissionID'], 1, set_value('perm'.$perm['permissionID'], $data['perm'.$perm['permissionID']]), 'id="'.'perm_'.$perm['key'].'" class="checkbox"'); ?>
  60. <br class="clear" />
  61. <?php endforeach; ?>
  62. </div>
  63. <?php endforeach; ?>
  64. <?php endif; ?>
  65. <p class="clear" style="text-align: right;"><a href="#" class="button grey" id="totop">Back to top</a></p>
  66. </form>