Ejemplo n.º 1
0
                $id = intval($v);
                if ($id > 0 && !is_array($v)) {
                    $ans = CAdmin::removeUser($id);
                    echo $ans ? "OK" : "Can't remove user";
                    exit;
                } else {
                    exit;
                }
            } else {
                exit;
            }
            break;
        default:
            exit;
    }
}
$content = "<div class='container'><div class='page-header'> ";
$content = "<div class='panel'>\n<form class=\"form-inline toggle-disabled\" method='post'>\n  <div class=\"form-group\">\n    <label for=\"name\">Name</label>\n    <input type=\"text\" name='username' class=\"form-control valid\" id=\"username\" placeholder=\"Jane Doe\"\n     data-validation-event='keyup'\n     data-validation=\"letternumeric,required,length\"\n     data-validation-length=\"3-32\"\n     >\n  </div>\n  <div class=\"form-group\">\n    <label for=\"p\">Password</label>\n    <input type=\"password\" name='password' class=\"form-control valid\" id=\"password\" placeholder=\"My Precious\"\n    data-validation-event='keyup'\n    data-validation=\"required,letternumeric\"\n    data-validation-error-msg='Only alphabetic chars and digits allowed'\n    >\n  </div>\n  <button type='submit' class=\"btn btn-default\">Add User</button>\n  <button class=\"btn btn-info media-right\" id='button-refresh-table'>Refresh Table</button>\n</form>\n<script>\n\$.validate({\n    modules :  'security, toggleDisabled',\n    disabledFormFilter : 'form.toggle-disabled',\n    onModulesLoaded : function() {\n        console.log('validators loaded');\n    }\n  });\n</script>\n</div>";
$content .= "<table class='table table-hover'>\n<thead>\n<tr>\n    <td>#</td>\n    <td>Username</td>\n    <td>Created</td>\n    <td></td>\n</tr>\n</thead>\n<tbody>";
$users = CAdmin::getUsersArray();
$i = 0;
foreach ($users as $u) {
    $i++;
    $date = date("d-m-Y", strtotime($u["created"]));
    $id = $u['id'];
    $actions = "<a href='#' class=\"glyphicon glyphicon-remove button_user_remove\" data-target='{$id}' aria-hidden=\"true\"  style=\"text-decoration: none\"/>";
    $content .= "<tr id='user-row-{$id}'><td>{$i}</td><td>{$u["name"]}</td><td>{$date}</td><td>{$actions}</td></tr>";
}
$content .= "</tbody></table>";
$content .= "</div></div>";
include "_main.html";