?
Current Path : /home1/savoy/public_html/savoyglobal.net/sec/application/views/settings/ |
Linux gator3171.hostgator.com 4.19.286-203.ELK.el7.x86_64 #1 SMP Wed Jun 14 04:33:55 CDT 2023 x86_64 |
Current File : /home1/savoy/public_html/savoyglobal.net/sec/application/views/settings/edit_user.php |
<?php if (!defined('BASEPATH')) exit('No direct script access allowed'); $this->load->view('documentreadyfunctions'); ?> <script> $(document).ready(function() { var checkbox_list = $("input[type=checkbox]:not(.toggle), input[type=radio]:not(.toggle, .star)"); if (checkbox_list.size() > 0) { checkbox_list.each(function () { if ($(this).parents(".checker").size() == 0) { $(this).show(); $(this).uniform(); } }); } $('#selectall').click(function(event) { var checked=this.checked; $('.report_select').each(function() { this.checked = checked; }); setPermission(); }); $('.selectall_chek').click(function() { var checked=this.checked; var operation = $(this).data('operation'); $('.chek' + operation).each(function() { this.checked = checked; }); setPermission(); }); $('.view_all,.add_all,.edit_all,.delete_all,.homepage_all').click(function() { var checked=this.checked; var operation = $(this).data('operation'); $('.' + operation).each(function() { this.checked = checked; }); setPermission(); }); $('.view-module,.add-module,.edit-module,.delete-module,.homepage-module').click(function() { var checked=this.checked; var operation = $(this).data('operation'); var module = $(this).data('module'); $('.' + operation).each(function() { this.checked = checked;}); if(checked) $('.view-' + module).each(function() { this.checked = checked; }); setPermission(); }); }); $('.view,.add,.edit,.delete,.homepage').click(function() { setPermission(); }); function setPermission() { $.uniform.update(); var permissionstring = ""; var homepermission = ""; $('.view').each(function(i,o){ var permission = 0; permission += $('#view_' + i).is(':checked') ? parseInt($('#view_' + i).val()) : 0; permission += $('#add_' + i).is(':checked') ? parseInt($('#add_' + i).val()) : 0; permission += $('#edit_' + i).is(':checked') ? parseInt($('#edit_' + i).val()) : 0; permission += $('#delete_' + i).is(':checked') ? parseInt($('#delete_' + i).val()) : 0; var temp = ($('#homepage_' + i).is(':checked') ? "1" : "0") ; homepermission += temp + ","; permissionstring += permission + ','; }); $('#home_page_list').val(homepermission); $('#TxtPermissionList').val(permissionstring); } </script> <div class="row-fluid"> <div class="tab-pane " id="tab_2"> <div class="portlet box blue"> <div class="portlet-title"> <div class="caption"><i class="icon-reorder"></i>Updating User Details</div> <div class="tools"> <a href="#" onclick="viewdata('settings','viewinsettingssearch','search_user','view_user','<?= $_SESSION['pagenum']; ?>')" class="remove"></a> </div> </div> <div class="portlet-body form"> <!-- BEGIN FORM--> <?php $attributes = array('id' => 'validateform', 'class' => 'form-horizontal validate'); echo form_open('settings/addinsettings/update_user/view_user/1', $attributes); ?> <h3 class="form-section"></h3> <div class="row-fluid"> <div class="span6 "> <div class="control-group"> <label class="control-label">Employee Name</label> <div class="controls"> <span class="text bold"><?= $this->mastermodel->get_single_field_value('employee', 'employee_name', 'employee_id', $viewinfo->employee_id); ?></span> </div> </div> </div> <div class="span6 "> <div class="control-group"> <label class="control-label">Designation </label> <div class="controls"> <span class="text bold"> <?= $this->mastermodel->get_single_joined_value('designation_name', 'designation', 'employee', 'designation_id', 'employee_designation_id', 'employee_id', $viewinfo->employee_id); ?></span> </div> </div> </div> </div> <div class="row-fluid"> <div class="span6 "> <div class="control-group"> <label class="control-label">User Name</label> <div class="controls"> <input type="text" name="username" id="username" readonly class="required" value="<?= $viewinfo->user_name; ?>" onchange="checkexistence('user','user_name',this.value)" /> </div> </div> </div> </div> <div class="portlet box blue"> <div class="portlet-title"> <div class="caption"><i class="icon-reorder"></i></div> </div> <div class="portlet-body" id="role_permissions"> <table class="table table-striped table-hover table-bordered" id="sample_3"> <thead> <tr> <th>Module Name</th> <th><input style="width: 15px;" type="checkbox" class="view_all" data-operation="view" id="view_check_all">View </th> <th><input style="width: 15px;" type="checkbox" class="add_all" data-operation="add" id="add_check_all">Create </th> <th><input style="width: 15px;" type="checkbox" class="edit_all" data-operation="edit" id="edit_check_all"> Edit</th> <th><input style="width: 15px;" type="checkbox" class="delete_all" data-operation="delete" id="delete_check_all">Delete</th> <th><input style="width: 15px;" type="checkbox" class="homepage_all" data-operation="homepage" id="homepage_check_all">Home Page</th> </tr> </thead> <tbody> <?php $viewinfo1 = $this->settingsmodel->get_user_permission_by_user_id($viewinfo->user_id); $modules = $this->mastermodel->getmoduledata(); $reportmodules = $this->mastermodel->getreportmoduledata(); $modname = ""; $i = 1; $j = 0; $viewCount = 0; $initialPermission = ""; $moduleidList = ""; $tmp = $viewinfo1[0]; $homepage_list = $tmp['home_page']; $is_homepage = explode(',', $tmp['home_page']); $allowed = explode(",", $tmp['user_modules']); $edit_del = explode(",", $tmp['modules_permission']); foreach ($modules as $menulst) { $menuid = $menulst['menu_id']; $poss = ''; for ($i = 1; $i < sizeof($allowed) + 1; $i++) if ($allowed[$i - 1] == $menuid) $poss = $i; if ($poss != '') { $val = 0; if (isset($edit_del[$poss - 1])) $val = $edit_del[$poss - 1]; } else { $val = 0; $val1 = 0; } $a = decbin($val); $d = sprintf('%04u', $a); $ar = str_split($d); $viewCount++; $initialPermission .= "0,"; $moduleidList .= $menulst['menu_id'] . ","; if ($modname != $menulst['module_name']) { $modname = $menulst['module_name']; ?> <tr> <th style="background-color:lavender;"><span><?= $menulst['module_title']; ?></span></th> <th style="background-color:lavender;"><input style="width: 15px;" data-module="<?= $modname ?>" data-operation="view-<?= $modname ?>" class="view-module" type="checkbox" id="view_<?= $modname ?>" >View</th> <th style="background-color:lavender;"><input style="width: 15px;" data-module="<?= $modname ?>" data-operation="add-<?= $modname ?>" class="add-module" type="checkbox" id="add_<?= $modname ?>" >Create</th> <th style="background-color:lavender;"><input style="width: 15px;" data-module="<?= $modname ?>" data-operation="edit-<?= $modname ?>" class="edit-module" type="checkbox" id="edit_<?= $modname ?>" >Edit</th> <th style="background-color:lavender;"><input style="width: 15px;" data-module="<?= $modname ?>" data-operation="delete-<?= $modname ?>" class="delete-module" type="checkbox" id="delete_<?= $modname ?>" >Delete</th> <th style="background-color:lavender;"><input style="width: 15px;" data-module="<?= $modname ?>" data-operation="homepage-<?= $modname ?>" class="homepage-module" type="checkbox" id="homepage_<?= $modname ?>" >Home Page</th> </tr> <tr> <td><?= $menulst['caption']; ?></td> <td style="text-align: center;"><input class="view view-<?= $modname ?>" style="width: 15px;" name="view_<?= $modname ?>[]" id="view_<?php echo $j; ?>" value="8" type="checkbox" <?php if ($ar[0] == "1") { echo 'checked="checked"'; } ?>></td> <td style="text-align: center;"><input class="add add-<?= $modname ?>" style="width: 15px;" name="add_<?= $modname ?>[]" id="add_<?php echo $j; ?>" value="4" type="checkbox" <?php if ($ar[1] == "1") { echo 'checked="checked"'; } ?>></td> <td style="text-align: center;"><input class="edit edit-<?= $modname ?>" style="width: 15px;" name="edit_<?= $modname ?>[]" id="edit_<?php echo $j; ?>" value="2" type="checkbox" <?php if ($ar[2] == "1") { echo 'checked="checked"'; } ?>></td> <td style="text-align: center;"><input class="delete delete-<?= $modname ?>" style="width: 15px;" name="delete_<?= $modname ?>[]" id="delete_<?php echo $j; ?>" value="1" type="checkbox" <?php if ($ar[3] == "1") { echo 'checked="checked"'; } ?>></td> <td style="text-align: center;"><input class="homepage homepage-<?= $modname ?>" style="width: 15px;" name="homepage_<?= $modname ?>[]" id="homepage_<?php echo $j; ?>" value="1" type="checkbox" <?php if (isset($is_homepage[$j]) && $is_homepage[$j] == 1) { echo "checked"; } ?>></td> </tr> <?php $i++; } else { ?> <tr> <td><?= $menulst['caption']; ?></td> <td style="text-align: center;"><input class="view view-<?= $modname ?>" style="width: 15px;" name="view_<?= $modname ?>[]" id="view_<?php echo $j; ?>" value="8" type="checkbox" <?php if ($ar[0] == "1") { echo 'checked="checked"'; } ?> ></td> <td style="text-align: center;"><input class="add add-<?= $modname ?>" style="width: 15px;" name="add_<?= $modname ?>[]" id="add_<?php echo $j; ?>" value="4" type="checkbox" <?php if ($ar[1] == "1") { echo 'checked="checked"'; } ?>></td> <td style="text-align: center;"><input class="edit edit-<?= $modname ?>" style="width: 15px;" name="edit_<?= $modname ?>[]" id="edit_<?php echo $j; ?>" value="2" type="checkbox" <?php if ($ar[2] == "1") { echo 'checked="checked"'; } ?>></td> <td style="text-align: center;"><input class="delete delete-<?= $modname ?>" style="width: 15px;" name="delete_<?= $modname ?>[]" id="delete_<?php echo $j; ?>" value="1" type="checkbox" <?php if ($ar[3] == "1") { echo 'checked="checked"'; } ?>></td> <td style="text-align: center;"><input class="homepage homepage-<?= $modname ?>" style="width: 15px;" name="homepage_<?= $modname ?>[]" id="homepage_<?php echo $j; ?>" value="1" type="checkbox" <?php if (isset($is_homepage[$j]) && $is_homepage[$j] == 1) { echo "checked"; } ?>></td> </tr> <?php } $j++; } ?> </tbody> </table> <input type="hidden" id="ViewCount" value='<?php echo $viewCount ?>'/> <input type="hidden" id="TxtPermissionList" name="modules_permission" value='<?php echo $tmp['modules_permission'] ?>'/> <input type="hidden" id="ModuleidList" name="user_modules" value="<?php echo $moduleidList ?>"/> <input type="hidden" id="home_page_list" name="user_home_page" value="<?php echo $homepage_list ?>"/> <table class="table table-striped table-hover table-bordered" id="sample_3"> <thead> <tr> <th>Module Name</th> <th><input style="width: 15px;" type="checkbox" id="selectall"></th> </tr> </thead> <tbody> <?php $user_report = $this->mastermodel->get_data('user_report', $viewinfo->user_id, 'user_id'); $data = array(); foreach ($user_report as $row) $data[] = $row['report_id']; $i = 1; foreach ($reportmodules as $menulst) { if ($menuid != $menulst['report_module_id']) { $menuid = $menulst['report_module_id']; ?> <tr><th><?= $menulst['caption']; ?></th><th><input style="width: 15px;" type="checkbox" class="report_select selectall_chek" data-operation="<?= $menuid; ?>" id="selectall_chek"name="report_select[]"></th></tr> <tr> <td><?= $menulst['report_label']; ?></td> <td><input <?php if (in_array($menulst['report_id'], $data)) { echo "checked"; } ?> style="width: 15px;" type="checkbox" class="report_select chek<?= $menuid; ?>" value="<?= $menulst['report_id']; ?>" name="report_select[]"></td> </tr> <?php } else { ?> <tr> <td><?= $menulst['report_label']; ?></td> <td><input <?php if (in_array($menulst['report_id'], $data)) { echo "checked"; } ?> style="width: 15px;" type="checkbox" class="report_select chek<?= $menuid; ?>" value="<?= $menulst['report_id']; ?>" name="report_select[]"></td> </tr> <?php } $i++; } ?> </tbody> </table> </div> <div class="form-actions"> <input type="hidden" id="tab_name" name="tab_name" value="user"/> <input type="hidden" name="resfunction" value="search_agent"/> <input type="hidden" name="reminder_id" value="<?= $viewinfo->user_id ?>"/> <input type="hidden" name="user_id" value="<?= $viewinfo->user_id; ?>"/> <button type="submit" onclick="addformdata('validateform')" class="btn blue"><i class="icon-ok"></i> Update</button> <button type="button" onclick="viewdata('settings','viewinsettingssearch','search_user','view_user','<?= $_SESSION['pagenum']; ?>')" class="btn">Cancel</button> </div> <?php echo form_close(); ?> <!-- END FORM--> </div> </div> </div> </div> </div>