Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php include $_SERVER["DOCUMENT_ROOT"] . '/includes/config.php'; ?>
- <script type="text/javascript" src="/includes/jquery/js/jquery.users.js"></script>
- <?php if ($_SESSION['level'] == 9) {
- echo <<< EOD
- <div class="hcenter">
- <button id="newUser" class="ui-state-default ui-corner-all">Create New User</button>
- </div>
- EOD;
- }?>
- <br />
- <table id="userTable" class="hcenter no-center-text ui-state-default ui-corner-all">
- <tr class="hcenter">
- <th>First Name</th>
- <th>Last Name</th>
- <th>Username</th>
- <th>Email</th>
- <th>Branch</th>
- <th>Status</th>
- <th>Level</th>
- </tr>
- <?php
- $prefix = $sql->tblPrefix();
- $query = "Select * from " . $prefix . "users";
- $users = $sql->sqlQuery($query);
- $rows = $sql->sqlRows($users);
- for ($i=0; $i<$rows; $i++) {
- $branchQuery = "Select City from " . $prefix . "branches where id='" . $sql->sqlResult($users,$i,'Branch') . "';";
- $branchResult = $sql->sqlQuery($branchQuery);
- $branch = $sql->sqlResult($branchResult,0,'City');
- if ($sql->sqlResult($users,$i,'Enabled')) {
- $status = "Enabled";
- } else {
- $status = "Disabled";
- };
- echo "<tr class='";
- if ($i%2) {
- echo "odd'>\n";
- } else {
- echo "even'>\n";
- };
- echo "<td>" . $sql->sqlResult($users,$i,'FirstName') . "</td>\n";
- echo "<td>" . $sql->sqlResult($users,$i,'LastName') . "</td>\n";
- echo "<td>" . $sql->sqlResult($users,$i,'Username') . "</td>\n";
- echo "<td>" . $sql->sqlResult($users,$i,'Email') . "</td>\n";
- echo "<td>" . $branch . "</td>\n";
- echo "<td>" . $status . "</td>\n";
- echo "<td>" . $sql->sqlResult($users,$i,'AccessLevel') . "</td>\n";
- echo "</tr>\n";
- };
- ?>
- </table>
- <div id="addUserDiv" title="Add User" class="ui-state-default">
- <form id="addUserForm" name="addUserForm" method="post" action="includes/php/process.php">
- <fieldset>
- <input type="hidden" name="formID" value="addUser">
- <label for="firstname" class="ui-label">First Name:</label>
- <input type="text" id="firstname" name="firstname" />
- <br />
- <label for="password" class="ui-label">Last Name:</label>
- <input type="text" id="lastname" name="lastname" />
- <br />
- <label for="username" class="ui-label">Username:</label>
- <input type="text" id="username" name="username" />
- <br />
- <label for="email" class="ui-label">Email Address:</label>
- <input type="text" id="email" name="email" />
- <br />
- <label for="password" class="ui-label">Password:</label>
- <input type="text" id="password" name="password" />
- <br />
- <label for="branch" class="ui-label">Branch:</label>
- <select name="branch" id="branch">
- <?php
- //this will populate the branch selector with info from the branch table
- $branchQuery = "select id,city from " . $prefix . "branches;";
- $branchResult = $sql->sqlQuery($branchQuery);
- $branchRows = $sql->sqlRows($branchResult);
- for ($i=0; $i<$branchRows; $i++) {
- $id=$sql->sqlResult($branchResult, $i, 'id');
- $city=$sql->sqlResult($branchResult, $i, 'city');
- echo "<option value=\"" . $id . "\">" . $city . "</option>\n";
- };
- ?>
- </select>
- <br />
- <label for="enabled">Status:</label>
- <select name="enabled" id="enabled">
- <option value="1">Enabled</option>
- <option value="0">Disabled</option>
- </select>
- <br />
- <label for="accessLevel" class="ui-label">Access Level</label>
- <select name="accessLevel" id="accessLevel">
- <option value="3">Standard User</option>
- <option value="9">Full Admin</option>
- </select>
- </fieldset>
- </form>
- </div>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement