<label class="col-sm-4 control-label no-padding-right" for="last_name">Last Name:</label> <div class="col-sm-8"> <?php echo form_input('last_name', $last_name, 'id="last_name" class="form-control input-sm"'); ?> <?php echo form_error('last_name', '<label class="error">', '</label>'); ?> </div> </div> <div class="form-group"> <label class="col-sm-4 control-label no-padding-right" for="group_id">User Group:</label> <div class="col-sm-8"> <?php echo form_dropdown('group_id', groups_dropdown('return', array('first_row' => TRUE)), $group_id, 'id="group_id" class="form-control input-sm" data-placeholder="Select a Group"'); ?> <?php echo form_error('group_id', '<label class="error">', '</label>'); ?> </div> </div> <?php if ($current_user->group_id == GROUP_ADMIN) { ?> <div class="form-group company_option" <?php if (!_has_company_group_access($group_id)) { ?> style="display:none;"<?php }
$added_user = mysql_real_escape_string($_GET['user']); $added_user_text = " '" . $added_user . "' added to group."; $user_dropdown = user_dropdown($selected_group); //dropdown should show only users not already in the group } #get result count $get_records = $Query; $check_get_records = mysql_query($get_records); $result = $check_get_records; #Count table rows $count = mysql_num_rows($result); $grouplist = list_groups(); //list of current troups $gdb_dropdown = gdb_dropdown(); //list all GDB available $groups_dropdown = groups_dropdown(); //select a group ### Mode Button Display $display_block = "\r\n<table style=\"font-size:12px\" width=\"92%\">\r\n<tbody>\r\n\t<tr>\r\n\t\t<td colspan=\"8\">\r\n\t\t\t<h2 class=\"{$edituser} indent1 bottommargin1\">\r\n\t\t\t\tEdit Group Membership:\r\n\t\t\t</h2>\r\n\t\t\t<p class=\"{$edituser} instruction\"> \r\n\t\t\t\tClick radio button(s) to change user Group Member Type, then click 'Update'. <span class=\"heading\"> (Inactive Users are <span class=\"gray\">Gray</span>)</span>\r\n\t\t\t</p>\r\n\t\t\t<p class=\"{$edituser} instruction\">\r\n\t\t\t\tSelect 'REMOVE' to delete a user-group assignment (does NOT affect user's yrGATE account)\r\n\t\t\t</p>\r\n\t\t\t<h2 class=\"{$addgroup} indent1 bottommargin1\">\r\n\t\t\t\tCreate New Group\r\n\t\t\t</h2>\r\n\t\t\t<p class=\"{$addgroup} instruction indent1\">\r\n\t\t\t\tEnter New Group name, single GDB or 'All', and Group Administrator (required).\r\n\t\t\t</p>\r\n\t\t\t<p class=\"{$addgroup} instruction indent1\">\r\n\t\t\t\tOnce you have created this group, click 'Add Users to Group...' from the Groups page.\r\n\t\t\t</p>\t\t\t\r\n \t\t\t<p class= \"{$view}\">\r\n \t\t\t\tyrGATE users can be assigned to one or more <b>Groups</b> that share common curation resources. On this page you can <b>create Groups</b>, add <b>Users</b>, and edit <b>Group Membership</b> (assign Group Admins; remove Members from Group). See also <a href=\"/admin/users.php\">Manage User Accounts</a>\r\n \t\t\t</p>\r\n \t\t\t<p class= \"{$view}\">\r\n \t\t\t\t<b>Only Active users are shown except in Edit mode </b>.\r\n \t\t\t</p>\r\n \t\t\t\t<p class=\"{$view} instruction indent1\">Select an action from the choices below: \r\n \t\t\t</p>\r\n\t\t\t<h2 class=\"{$adduser} indent1 bottommargin1\">\r\n\t\t\tAdd Users to Group:\r\n\t\t\t</h2>\r\n\t\t\t</td>\r\n \t</tr>\r\n\t<tr>\r\n \t\t<td width=\"20%\" align = \"left\">\r\n \t\t\r\n \t\t</td>\r\n\t\t<td align=\"right\" valign=\"bottom\">\r\n\t\t\t<form method=\"post\" action=\"/admin/groups.php\" name=\"add_group_on\" class=\"styled\">\r\n\t\t\t\t<input id=\"creategrp\" class=\"submit {$view}\" type=\"submit\" name=\"mode\" value=\"1. Create New Group...\" />\r\n\t\t\t\t<input type=\"hidden\" name=\"mode\" value=\"AddGroup\" />\r\n\t\t\t</form>\r\n\t\t</td>\r\n\t\t<td width=\"20%\" align = \"right\" >\r\n\t\t</td>\r\n\t\t<td align=\"right\">\r\n\t\t\t<form method=\"post\" action=\"/admin/groups.php\" name=\"add_users_on\" class=\"styled\">\r\n\t\t\t\t<select class=\"submit {$view} normalfont\" name=\"group\">{$groups_dropdown}</select><br />\r\n\t\t\t\t<input id=\"adduser\" class=\"submit {$view}\" type=\"submit\" name=\"mode\" value=\"2. Add Users to Group...\" />\r\n\t\t\t <input type=\"hidden\" name=\"mode\" value=\"AddUser\" />\r\n </form>\r\n\t\t</td>\r\n\t <td width=\"20%\" align=\"right\">\r\n\t\t</td>\r\n\t\t<td align = \"right\" valign=\"bottom\">\r\n\t\t\t<form method=\"post\" action=\"/admin/groups.php\" name=\"edit_status_on\" class=\"styled\">\r\n\t\t\t\t<input id=\"editacct\" class=\"submit {$view}\" type=\"submit\" name=\"mode\" value=\"3. Edit Group Membership...\" />\r\n\t\t\t\t<input type=\"hidden\" name=\"mode\" value=\"EditUser\" />\r\n\t\t\t</form>\r\n\t\t</td>\r\n\t\t<td width=\"20%\" align = \"right\">\r\n\t\t\t<form method=\"post\" action=\"/admin/groups.php\" name=\"view_status_on\" class=\"styled\">\r\n\t\t\t\t<input id=\"cancel\" class=\"{$cancel} submit\" type=\"submit\" value=\" Cancel \" />\r\n\t\t\t\t<input type=\"hidden\" name=\"mode\" value=\"Cancel\" />\r\n\t\t\t</form>\r\n\t\t</td>\r\n\t</tr>\r\n\t</tbody>\r\n</table>\r\n"; #Action Button Display and Table Headers $display_block .= "\r\n\r\n<form name=\"form1\" method=\"post\" action=\"/admin/update_groups.php\" class=\"styled\">\r\n\r\n<table style=\"font-size:12px\" width=\"92%\">\r\n\t\t\t<tr>\r\n\t\t\t\t<td class=\"{$adduser} indent2\" width=\"90%\">\r\n\t\t\t\t\t<p class=\"instruction\">Select Username and Account Type (USER or ADMIN) </p>\r\n\t\t\t\t\t<p class=\"instruction\">If adding more users to this Group, click 'Insert & Next'; or, click 'Insert & Done'</p>\r\n\t\t\t\t</td>\r\n\t\t\t\t<td>\r\n\t\t\t\t\t<input id=\"update\" class=\"{$edituser} submit\" type=\"submit\" name=\"edit_action\" value=\"Update Accounts\">\r\n\t\t\t\t\t<input id=\"count\" class=\"{$edituser} submit\" type=\"hidden\" name=\"count\" value=\"{$count}\">\r\n\t\t\t\t</td>\r\n\t\t\t\t<td align=\"right\">\r\n\t\t\t\t\t<input id=\"insert_group\" class=\"{$addgroup} submit\" type=\"submit\" name=\"group_action\" value=\"Create Group\">\r\n\t\t\t\t</td>\r\n\t\t\t\t<td>\r\n <input id=\"insertuser_repeat\" class=\"{$adduser} submit\" type=\"submit\" name=\"user_action_repeat\" value=\"Insert & Next\">\r\n\t\t\t\t\t<input id=\"insertuser\" class=\"{$adduser} submit\" type=\"submit\" name=\"user_action\" value=\"Insert & Done\">\r\n\t\t\t\t</td>\r\n\t\t\t</tr>\r\n</table>\r\n<table class=\"featuretable bottommargin1 topmargin1\" style=\"font-size:12px\" cellpadding=\"6\">\r\n\t\t<thead align=\"center\">\r\n\t\t\t\t\t\t<tr class=\"{$viewedit}\">\r\n\t\t\t\t\t\t\t<th class=\"reverse_1\">User Group</th>\r\n\t\t\t\t\t\t\t<th class=\"reverse_1\">GDB </th>\r\n\t\t\t\t\t\t\t<th class=\"reverse_1\">User</th>\r\n\t\t\t\t\t\t\t<th class=\"reverse_1\">Email</th>\r\n\t\t\t\t\t\t\t<th class=\"reverse_1\" style=\"width:250px\">\r\n\t\t\t\t\t\t\tGroup Member Type \r\n\t\t\t\t\t\t\t<img id='admin_group_account' title='Help' class='help-button nudge1' src='/XGDB/images/help-icon.png' alt='?' />\r\n\t\t\t\t\t\t\t</th>\r\n\t\t\t\t\t\t</tr>\r\n\t\t\r\n\t\t</thead>\r\n\t\t<tbody>\r\n"; # Table Body Rows for View mode $user_check = array(); $admin_check = array(); $inactive_check = array(); $user_style = array(); $admin_style = array(); $inactive_style = array(); $i = 0; //cycle through all records while ($row = mysql_fetch_array($result)) {
public function permission($id, $method = "echo") { ensure_user_access(TRUE, array('admin', 'management_company', 'user_company')); $output = array('message' => "", 'status' => ""); $details = $this->document_model->details($id); $company_id = $this->input->post('company_id', TRUE) ? $this->input->post('company_id', TRUE) : $details->company_id; $this->form_validation->set_rules('users_allowed', 'Users Allowed', ''); $this->form_validation->set_rules('groups_allowed', 'Groups Allowed', ''); if ($this->form_validation->run() == TRUE) { $groups_allowed = $this->input->post('groups_allowed'); if (empty($groups_allowed)) { $groups_allowed = array(); } elseif (!is_array($groups_allowed)) { $groups_allowed = array($groups_allowed); } $users_allowed = $this->input->post('users_allowed'); if (empty($users_allowed)) { $users_allowed = array(); } elseif (!is_array($users_allowed)) { $users_allowed = array($users_allowed); } $d_per = array("groups_allowed" => $groups_allowed, "users_allowed" => $users_allowed); $is_record_updated = $this->document_model->update_permission_by_id($id, serialize($d_per)); if ($is_record_updated) { $output['message'] = 'The Document Permission was updated.'; $output['status'] = SUCCESS_MESSAGE; $output['document_id'] = $id; } else { $output['message'] = 'An error occurred.'; $output['status'] = ERROR_MESSAGE; } $this->_output_request($output, ''); } else { if (validation_errors()) { $output['message'] = validation_errors(); $output['status'] = ERROR_MESSAGE; } } $data = array('form_action' => site_url('document/permission/' . $id), 'cancel_url' => site_url('document'), 'page' => 'docs/permission_form', 'title' => 'Edit Permission', 'submit_btn_text' => 'Save Changes', 'company_id' => $company_id, 'document_name' => $details->original_name, 'document_type' => $details->document_type, 'document_permission' => get_doc_permission($details->permission, $details->document_type_id), 'groups' => groups_dropdown('return', TRUE, ''), 'js_files' => array('docs/per.form.js')); if ($this->input->is_ajax_request()) { $html = $this->template->raw_view('pages/docs/permission_form', $data, TRUE); if ($method == "ajax") { $output['html'] = $html; $this->_output_request($output, ''); } else { echo $html; } } else { $this->template->load('default', $data); } }
public function _check_user_group($group_id) { $groups = groups_dropdown('return'); $group_types = array(); foreach ($groups as $id => $group_name) { $group_types[] = $id; } if (!in_array($group_id, $group_types)) { $this->form_validation->set_message('_check_user_group', 'Sorry, no such user group found'); return false; } }
<form name="grid-list-param" data-options='{"grid" : { "_grid_url" : "<?php echo $grid_action; ?> " }}' style="display:none;"></form> <div class="panel-heading"> <h3 class="panel-title">Users <a href="<?php echo $new_user_url; ?> " class="btn btn-sm btn-warning mr5 mb10 pull-right wht" style="margin-top:-5px;" data-ajax="wdpajax" data-options='{"form_method" : "GET", "data_type" : "HTML", "role" : "modal", "created_new" : true, "title" : "User Detail", "modal" : {"buttons" : true, "override" : true, "size" : "modal-lg", "modal_success_callback" : "gl.user.listing.load_grid(g);"}, "params" : "echo", "grid" : {"_init" : true, "gType" : "default"}}'><i class="fa fa-plus mr5"></i>New User</a> <div class="pull-right" style="width:300px;margin-right:16px;margin-top:-5px;"> <?php echo form_dropdown('group_id', groups_dropdown('return', array('first_row' => TRUE)), '', 'id="groupSelect" class="form-control input-sm pull-right" data-placeholder="All Groups"'); ?> </div> <?php if ($current_user->group_id == 1) { ?> <div class="pull-right" style="width:300px;margin-right:16px;margin-top:-5px;"> <?php echo form_dropdown('company', companies_dropdown('return', array('first_row' => TRUE)), $company_id, 'id="companySelect" class="form-control input-sm pull-right" data-placeholder="All Companies"'); ?> </div> <?php } ?> </h3>