Guest User

Untitled

a guest
May 25th, 2018
222
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.88 KB | None | 0 0
  1. <?php
  2. $table = '';
  3. //let us get the controllers name first
  4. $head = array_keys($permissions);
  5.  
  6. //Now let us create the permission checkboxs for each controller
  7. foreach ($head as $headings){
  8. $table .= '<tr>';
  9. switch ($headings){
  10. case 'Groups':
  11. $table .= '<td height="30" colspan="6"><strong> Roles </strong></td>';
  12. break;
  13. default:
  14. $table .= '<td height="30" colspan="6"><strong>'.$headings.'</strong></td>';
  15. }
  16. $table .= '</tr>';
  17.  
  18. $table .= '<tr>';
  19. foreach($permissions[$headings] as $permission){
  20. $checkbox = $form->input($permission['alias'],array('label' => false, 'div'=>false, 'type'=>'checkbox', 'value'=>$permission['id']));
  21. switch ($headings){
  22. case 'index':
  23. $table .= '<td height="30" width="14%" class="tabbedtext">'.$checkbox.'&nbsp;View</td>';
  24. break;
  25. default:
  26. $table .= '<td height="30" width="14%" class="tabbedtext">'.$checkbox.'&nbsp;'.ucfirst($permission['alias']).'</td>';
  27. }
  28. }
  29. $table .= '</tr>';
  30. }
  31.  
  32. ?>
  33. <style type="text/css">
  34. #GroupAddForm { width: 670px; }
  35. #GroupAddForm label.error {
  36. color: red;
  37. margin-left: 10px;
  38. width: auto;
  39. display: inline;
  40. }
  41. </style>
  42. <h1 align="center">Manage Roles</h1>
  43. <br>
  44. <!--BOX CONTENT STARTS-->
  45. <div class="box_borderoutter" style="width: 95%;">
  46. <div class="box_border" style="padding: 10px 10px 10px 10px;"><!-- FORM SECTION STARTS -->
  47. <div class="login"><!-- ****************MIDDLE CONTENT STARTS *************-->
  48. <?php echo $form->create('Group',array('name'=>'group'));?>
  49. <table border="0" cellspacing="0" cellpadding="0">
  50. <tr>
  51. <td>
  52.  
  53. <div id="middle_container_csv"><!--TABLE LISTING STARTS-->
  54. <div class="content_container">
  55.  
  56. <table border="0" cellspacing="0" cellpadding="0" width="85%">
  57. <tr>
  58. <td class="labeltext">
  59. <label class="labeltext">Office :</label>
  60. <?= $form->input('office_id',array('label' => false, 'class'=>'selectbox', 'style'=>'width: 400px;')) ?>
  61. </td>
  62. <td class="labeltext" width="50%">
  63. <label class="labeltext">Role Name :</label>
  64. <?= $form->input('name', array('id'=>'roleName','label' => false, 'class'=>'textbox', 'style'=>'width: 390px; height: 18px')) ?>
  65. </td>
  66. <tr>
  67. <td></td>
  68. <td>
  69. <div id="error1" class="error2" style="display: none;">&nbsp;</div>
  70. </td>
  71. </tr>
  72. <tr>
  73. <td colspan="2"><label class="labeltext">Description :</label>
  74. <?= $form->input('description',array('id'=>'description','class'=>'textarea','label'=>false, 'div'=>false,'style'=>'width: 795px; height: 50px; font-family: Arial,Helvetica,sans-serif; font-size: 13px;')); ?>
  75. </td>
  76. </tr>
  77. </table>
  78. <p>&nbsp;</p>
  79. <table width="83%" cellpadding="0" cellspacing="0" border="0">
  80. <thead>
  81.  
  82. </thead>
  83. <tbody>
  84. <?= $table ?>
  85. </tbody>
  86. </table>
  87.  
  88.  
  89. </div>
  90. <!-- TABLE LISTING ENDS
  91. *****PAGINATION STARTS --></div><br />
  92. <div align="center">
  93. <table border="0" cellspacing="0" cellpadding="0">
  94. <tr>
  95. <td align="right"> <?php echo $form->button('Edit',array('class'=>'btnsyle_disable_form'));?> &nbsp;&nbsp; </td>
  96. <td align="center"> <?php echo $form->submit('Save',array('class'=>'btnsyle','div'=>false)); ?> &nbsp;&nbsp; </td>
  97. <td align="left"> <?php echo $form->button('Cancel',array('class'=>'btnsyle','onClick'=>"tb_remove();"));?> </td>
  98. </tr>
  99. </table>
  100. </div>
  101. <script type="text/javascript">
  102. $().ready(function() {
  103. $("#GroupAddForm").validate({
  104. rules: {
  105. roleName: {
  106. required: true,
  107. minlength: 3
  108. }
  109. },
  110. messages: {
  111. roleName: {
  112. required: "Please enter the role name",
  113. minlength: "Role name length cannot be less than 3"
  114. }
  115. },
  116. submitHandler: function(form) {
  117. jQuery(form).ajaxSubmit({
  118. success: function(data) {
  119. if (data =="success") {
  120. window.location = site_url + 'groups';
  121. }
  122. },
  123. debug:true
  124. });
  125. }
  126. });
  127. });
  128. </script>
Add Comment
Please, Sign In to add comment