Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- $table = '';
- //let us get the controllers name first
- $head = array_keys($permissions);
- //Now let us create the permission checkboxs for each controller
- foreach ($head as $headings){
- $table .= '<tr>';
- switch ($headings){
- case 'Groups':
- $table .= '<td height="30" colspan="6"><strong> Roles </strong></td>';
- break;
- default:
- $table .= '<td height="30" colspan="6"><strong>'.$headings.'</strong></td>';
- }
- $table .= '</tr>';
- $table .= '<tr>';
- foreach($permissions[$headings] as $permission){
- $checkbox = $form->input($permission['alias'],array('label' => false, 'div'=>false, 'type'=>'checkbox', 'value'=>$permission['id']));
- switch ($headings){
- case 'index':
- $table .= '<td height="30" width="14%" class="tabbedtext">'.$checkbox.' View</td>';
- break;
- default:
- $table .= '<td height="30" width="14%" class="tabbedtext">'.$checkbox.' '.ucfirst($permission['alias']).'</td>';
- }
- }
- $table .= '</tr>';
- }
- ?>
- <style type="text/css">
- #GroupAddForm { width: 670px; }
- #GroupAddForm label.error {
- color: red;
- margin-left: 10px;
- width: auto;
- display: inline;
- }
- </style>
- <h1 align="center">Manage Roles</h1>
- <br>
- <!--BOX CONTENT STARTS-->
- <div class="box_borderoutter" style="width: 95%;">
- <div class="box_border" style="padding: 10px 10px 10px 10px;"><!-- FORM SECTION STARTS -->
- <div class="login"><!-- ****************MIDDLE CONTENT STARTS *************-->
- <?php echo $form->create('Group',array('name'=>'group'));?>
- <table border="0" cellspacing="0" cellpadding="0">
- <tr>
- <td>
- <div id="middle_container_csv"><!--TABLE LISTING STARTS-->
- <div class="content_container">
- <table border="0" cellspacing="0" cellpadding="0" width="85%">
- <tr>
- <td class="labeltext">
- <label class="labeltext">Office :</label>
- <?= $form->input('office_id',array('label' => false, 'class'=>'selectbox', 'style'=>'width: 400px;')) ?>
- </td>
- <td class="labeltext" width="50%">
- <label class="labeltext">Role Name :</label>
- <?= $form->input('name', array('id'=>'roleName','label' => false, 'class'=>'textbox', 'style'=>'width: 390px; height: 18px')) ?>
- </td>
- <tr>
- <td></td>
- <td>
- <div id="error1" class="error2" style="display: none;"> </div>
- </td>
- </tr>
- <tr>
- <td colspan="2"><label class="labeltext">Description :</label>
- <?= $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;')); ?>
- </td>
- </tr>
- </table>
- <p> </p>
- <table width="83%" cellpadding="0" cellspacing="0" border="0">
- <thead>
- </thead>
- <tbody>
- <?= $table ?>
- </tbody>
- </table>
- </div>
- <!-- TABLE LISTING ENDS
- *****PAGINATION STARTS --></div><br />
- <div align="center">
- <table border="0" cellspacing="0" cellpadding="0">
- <tr>
- <td align="right"> <?php echo $form->button('Edit',array('class'=>'btnsyle_disable_form'));?> </td>
- <td align="center"> <?php echo $form->submit('Save',array('class'=>'btnsyle','div'=>false)); ?> </td>
- <td align="left"> <?php echo $form->button('Cancel',array('class'=>'btnsyle','onClick'=>"tb_remove();"));?> </td>
- </tr>
- </table>
- </div>
- <script type="text/javascript">
- $().ready(function() {
- $("#GroupAddForm").validate({
- rules: {
- roleName: {
- required: true,
- minlength: 3
- }
- },
- messages: {
- roleName: {
- required: "Please enter the role name",
- minlength: "Role name length cannot be less than 3"
- }
- },
- submitHandler: function(form) {
- jQuery(form).ajaxSubmit({
- success: function(data) {
- if (data =="success") {
- window.location = site_url + 'groups';
- }
- },
- debug:true
- });
- }
- });
- });
- </script>
Add Comment
Please, Sign In to add comment