function build_edit_user_popup($uid) { $helper_obj = new Helper(); $db_functions_obj = new DbFunctions(); // $validation_js_obj = new Validation_js(); $user_info = $db_functions_obj->get_user_detail_by_id($uid); // $output = $validation_js_obj->edit_user_validation(); $output = "<script>\$(document).ready(function() { \$('#edit_user').ajaxForm(function(res) { \n var isvalid = \$(\"#edit_user\").valid();\n if (isvalid) { \n var data = res.split(\"***#***\"); \n \$('#user_' + data[1]).after(data[0]);\n \$('#user_' + data[1]).remove(); \n closePopup();\n } \n }); });</script>"; $output .= "<div class='popup-header'>" . $helper_obj->t("Edit User") . " " . $user_info['username'] . "</div>"; $output .= "<form class='form-horizontal form-validate form-vertical form-bordered' name='edit_user' id='edit_user' method='post' action='edit_user'>"; $output .= "<div class='control-group'> \n <label class='control-label' for='client_name'>User Name</label>\n <div class='controls'>\n <input class='input-xlarge' data-rule-required='true' data-rule-minlength='4' value='" . $user_info['username'] . "' type='text' id='user_name_update' name='user_name_update' placeholder='" . $helper_obj->t("UserName") . "'>\n </div>\n </div>"; $output .= "<div class='control-group'> \n <label class='control-label' for='client_name'>Password</label>\n <div class='controls'>\n <input type='text' id='password_update' name='password_update' placeholder='" . $helper_obj->t("Password") . "'>\n </div>\n </div>"; $output .= "<div class='control-group'> \n <label class='control-label' for='client_name'>Email</label>\n <div class='controls'>\n <input class='input-xlarge' data-rule-email='true' data-rule-required='true' value='" . $user_info['email'] . "' type='text' id='email_update' name='email_update' placeholder='" . $helper_obj->t("Email") . "'>\n </div>\n </div>"; $output .= "<div class='control-group'> \n <label class='control-label' for='client_name'>Phone</label>\n <div class='controls'>\n <input value='" . $user_info['phone'] . "' type='text' id='phone_update' name='phone_update' placeholder='" . $helper_obj->t("Phone") . "'>\n </div>\n </div>"; $output .= "<input class='btn btn-primary' type='submit' value='" . $helper_obj->t("Save") . "'>"; $output .= "<input type='hidden' name='user_id_updated' value='" . $user_info['id'] . "'>"; $output .= "</form>"; return $output; }
function add_user() { global $user; $user_obj = new User(); $db_function_obj = new DbFunctions(); $helper_obj = new Helper(); $uid = $user['id']; $rid = $user['rid']; //only super admin can delete client if ($helper_obj->user_is_logged_in() && $helper_obj->check_role(SUPER_ADMIN_ROLE_ID) && isset($_POST) && $_POST['username'] != "" && $_POST['password'] && $_POST['email'] && $_POST['phone'] && $_POST['add_role']) { $last_uid = $user_obj->add_user($_POST); $user_info = $db_function_obj->get_user_detail_by_id($last_uid); $output = $user_obj->build_user_row($user_info); echo $output; exit; } }