function drawStaffList($where, $searchterms = false) { global $isAdmin, $_josh; $return = drawJumpToStaff() . '<table class="left" cellspacing="1">'; if ($isAdmin) { $colspan = 5; $return .= drawHeaderRow(false, $colspan, "new", "add_edit.php"); } else { $colspan = 4; $return .= drawHeaderRow(false, $colspan); } $return .= '<tr> <th class="image"></th> <th>Name / Office</th> <th>Title / Department</th> <th class="r">Phone</th>'; if ($isAdmin) { $return .= '<th></th>'; } $return .= '</tr>'; $result = db_query("SELECT \n\t\t\tu.userID, \n\t\t\tu.lastname,\n\t\t\tISNULL(u.nickname, u.firstname) firstname, \n\t\t\tu.bio, \n\t\t\tu.phone,\n\t\t\tc.description corporationName,\n\t\t\tu.corporationID,\n\t\t\to.name office, \n\t\t\tu.title, \n\t\t\td.departmentName\n\t\tFROM intranet_users u\n\t\tLEFT JOIN intranet_departments d\tON d.departmentID = u.departmentID \n\t\tLEFT JOIN organizations c\t\t\tON u.corporationID = c.id\n\t\tLEFT JOIN intranet_offices o\t\tON o.id = u.officeID\n\t\tWHERE " . $where . "\n\t\tORDER BY u.lastname, ISNULL(u.nickname, u.firstname)"); $count = db_found($result); if ($count) { if ($count == 1 && $searchterms) { $r = db_fetch($result); $_josh["slow"] = true; url_change("view.php?id=" . $r["userID"]); } else { while ($r = db_fetch($result)) { $return .= drawStaffRow($r, $searchterms); } } } else { $return .= drawEmptyResult("No staff match those criteria.", $colspan); } return $return . '</table>'; }
<?php include "include.php"; drawTop(); echo drawJumpToStaff(); ?> <table class="left" cellspacing="1"> <?php if ($isAdmin) { echo drawHeaderRow("Comings", 2, "new", "add_edit.php"); } else { echo drawHeaderRow("Comings", 2); } $staff = db_query("SELECT\n\t\tu.userID,\n\t\tISNULL(u.nickname, u.firstname) first, \n\t\tu.lastname last,\n\t\tu.title,\n\t\td.departmentName,\n\t\to.name office,\n\t\tu.startdate,\n\t\tu.bio\n\tFROM intranet_users u\n\tJOIN intranet_offices o ON u.officeID = o.id\n\tJOIN intranet_departments d ON u.departmentID = d.departmentID\n\tWHERE " . db_datediff("u.startdate", "GETDATE()") . " < 60 AND u.isActive = 1\n\tORDER BY u.startdate DESC"); while ($s = db_fetch($staff)) { ?> <tr> <td width="129" height="90" align="center" style="padding:1px;"><?php echo "<a href='/staff/view.php?id=" . $s["userID"] . "'>" . drawImg($s['userID']) . "</a>"; ?> </td> <td class="text"> <b><a href="/staff/view.php?id=<?php echo $s["userID"]; ?> "><?php echo $s["first"]; ?> <?php echo $s["last"]; ?>
LEFT JOIN channels c ON u2c.channel_id = c.id LEFT JOIN intranet_ranks r ON u.rankID = r.id LEFT JOIN organizations o ON u.organization_id = o.id LEFT JOIN departments d ON d.departmentID = u.departmentID LEFT JOIN offices f ON f.id = u.officeID LEFT JOIN intranet_us_states s ON u.homeStateID = s.stateID WHERE u.id = ' . $_GET['id']); $r['nickname'] = trim($r['nickname']); $r['organization'] = empty($r['organization']) ? '<a href="organizations.php?id=0">' . getString('shared') . '</a>' : '<a href="organizations.php?id=' . $r['organization_id'] . '">' . $r['organization'] . '</a>'; //if (!isset($r['is_active'])) url_change("./"); if (!($img = draw_img(file_dynamic('users', 'image_large', $_GET['id'], 'jpg', $r['updated'])))) { $img = draw_img(DIRECTORY_WRITE . "/images/to-be-taken.png"); } file_dynamic('users', 'image_medium', $_GET['id'], 'jpg', $r['updated']); file_dynamic('users', 'image_small', $_GET['id'], 'jpg', $r['updated']); echo drawJumpToStaff($_GET['id']); if (!$r['is_active']) { $msg = "This is a former staff member. "; if ($r['endDate']) { $msg .= $r['nickname'] ? $r['nickname'] : $r['firstname']; $msg .= "'s last day was " . format_date($r['endDate']) . "."; } echo drawMessage($msg, "center"); } ?> <table class="left" cellspacing="1"> <?php if ($page['is_admin']) { if ($r['is_active']) { echo drawHeaderRow($page['breadcrumbs'] . $page['title'], 3, getString('edit'), "add_edit.php?id=" . $_GET['id'], getString('delete'), drawDeleteLink("Deactivate this staff member?")); } else {
email_user($r["email"], "Intranet Password Reset", drawEmptyResult($user["first"] . ' has just reset your password on the Intranet. To pick a new password, please <a href="http://' . $_josh["request"]["host"] . '/login/password_reset.php?id=' . $r["userID"] . '">follow this link</a>.')); url_query_drop("action"); } elseif (url_action("invite")) { $r = db_grab("SELECT nickname, email, firstname FROM intranet_users WHERE userID = " . $_GET["id"]); $name = !$r["nickname"] ? $r["firstname"] : $r["nickname"]; email_invite($_GET["id"], $r["email"], $name); url_query_drop("action"); } url_query_require(); drawTop(); $r = db_grab("SELECT \n\t\tu.firstname,\n\t\tu.lastname,\n\t\tu.nickname, \n\t\tu.bio, \n\t\tu.email,\n\t\t" . db_pwdcompare("", "u.password") . " password,\n\t\tu.phone, \n\t\tu.lastlogin, \n\t\tu.title,\n\t\tf.name office, \n\t\td.departmentName,\n\t\tu.corporationID,\n\t\tc.description corporationName,\n\t\tu.homeAddress1,\n\t\tu.homeAddress2,\n\t\tu.homeCity,\n\t\ts.stateAbbrev,\n\t\tu.homeZIP,\n\t\tu.homePhone,\n\t\tu.homeCell,\n\t\tu.homeEmail,\n\t\tu.emerCont1Name,\n\t\tu.emerCont1Relationship,\n\t\tu.emerCont1Phone,\n\t\tu.emerCont1Cell,\n\t\tu.emerCont1Email,\n\t\tu.emerCont2Name,\n\t\tu.emerCont2Relationship,\n\t\tu.emerCont2Phone,\n\t\tu.emerCont2Cell,\n\t\tu.emerCont2Email,\n\t\tu.startDate,\n\t\tu.longDistanceCode,\n\t\tu.endDate,\n\t\tu.isActive,\n\t\tr.description rank\n\tFROM intranet_users u\n\tJOIN intranet_ranks r ON u.rankID = r.id\n\tLEFT JOIN organizations\t\t\tc ON u.corporationID = c.id\n\tLEFT JOIN intranet_departments\t\td ON d.departmentID\t= u.departmentID \t\t\t\t\n\tLEFT JOIN intranet_offices \t\tf ON f.id\t\t\t= u.officeID \t\t\t\t\n\tLEFT JOIN intranet_us_states\t\ts ON u.homeStateID\t= s.stateID\n\tWHERE u.userID = " . $_GET["id"]); $r["corporationName"] = empty($r["corporationName"]) ? '<a href="organizations.php?id=0">Shared</a>' : '<a href="organizations.php?id=' . $r["corporationID"] . '">' . $r["corporationName"] . '</a>'; if (!isset($r["isActive"])) { url_change("./"); } echo drawJumpToStaff($_GET["id"]); if (!$r["isActive"]) { $msg = "This is a former staff member. "; if ($r["endDate"]) { $msg .= $r["nickname"] ? $r["nickname"] : $r["firstname"]; $msg .= "'s last day was " . format_date($r["endDate"]) . "."; } echo drawServerMessage($msg, "center"); } ?> <table class="left" cellspacing="1"> <?php if ($isAdmin) { if ($r["isActive"]) { echo drawHeaderRow("View Staff Info", 3, "edit", "add_edit.php?id=" . $_GET["id"], "deactivate", deleteLink("Deactivate this staff member?")); } else {