function drawStaffList($where, $errmsg = false, $options = false, $listtitle = false, $searchterms = false) { global $page, $_josh; if (!$errmsg) { $errmsg = getString('results_empty'); } //only show delete for admins on pages that aren't the chagnes page $showDelete = $page['is_admin'] && $page['id'] != 35; $t = new table('staff', drawHeader($options, $listtitle)); $t->set_column('pic', 'c', ' ', 50); $t->set_column('name', 'l', getString('name') . (getOption('staff_showoffice') ? ' / ' . getString('location') : '')); $t->set_column('title', 'l', getString('staff_title') . ' / ' . (getOption('staff_showdept') ? getString('department') : getString('organization')), 222); $t->set_column('phone', 'l', getString('telephone')); if ($showDelete) { $t->set_column('del', 'c', ' ', 16); } $result = db_table('SELECT DISTINCT u.id, u.lastname, ISNULL(u.nickname, u.firstname) firstname, u.bio, u.phone, c.title' . langExt() . ' organization, u.organization_id, o.name office, o.isMain, u.title, d.departmentName department FROM users u LEFT JOIN users_to_channels u2c ON u.id = u2c.user_id LEFT JOIN departments d ON d.departmentID = u.departmentID LEFT JOIN organizations c ON u.organization_id = c.id LEFT JOIN offices o ON o.id = u.officeID ' . getChannelsWhere('users', 'u', 'user_id') . ' AND ' . $where . ' ORDER BY u.lastname, ISNULL(u.nickname, u.firstname)'); foreach ($result as &$r) { $link = '/staff/view.php?id=' . $r['id']; $r['pic'] = draw_img(file_dynamic('users', 'image_small', $r['id'], 'jpg'), $link); $r['name'] = draw_link($link, $r['lastname'] . ', ' . $r['firstname']); if (getOption('staff_showoffice')) { $r['name'] .= '<br/>' . $r['office']; } if (getOption('staff_showdept')) { $r['title'] .= '<br/>' . $r['department']; } else { $r['title'] .= '<br/>' . draw_link('organizations.php?id=' . $r['organization_id'], format_string($r['organization'])); } if ($showDelete) { $r['del'] = drawColumnDelete($r['id']); } } return $t->draw($result, $errmsg); }
<?php include '../include.php'; echo drawTop(); $t = new table('staff', drawHeader()); $t->set_column('picture', 'l', ' ', '50'); $t->set_column('name'); $t->set_column('organization'); $t->set_column('last_login', 'r'); $result = db_table('SELECT u.id, u.firstname, u.lastname, u.title, o.title organization, u.organization_id, u.lastLogin last_login FROM users u LEFT JOIN organizations o ON u.organization_id = o.id JOIN users_to_modules u2m ON u.id = u2m.user_id WHERE u.is_active = 1 AND u2m.module_id = ' . $page['module_id'] . ' ORDER BY u.lastname, u.firstname'); foreach ($result as &$r) { $link = '/staff/view.php?id=' . $r['id']; $r['picture'] = draw_img(file_dynamic('users', 'image_small', $r['id'], 'jpg'), $link); $r['name'] = draw_link($link, $r['firstname'] . ' ' . $r['lastname']); if ($r['organization']) { $r['organization'] = draw_link('/staff/organizations.php?id=' . $r['organization_id'], $r['organization']) . '<br>'; } $r['organization'] .= $r['title']; $r['last_login'] = format_date($r['last_login']); } echo $t->draw($result, 'No administrators for this module yet!'); echo drawBottom();
<?php include 'include.php'; $users = db_table('SELECT id, ' . db_updated() . ' FROM users'); foreach ($users as $u) { echo draw_img(file_dynamic('users', 'image_large', $u['id'], 'jpg', $u['updated'])); echo draw_img(file_dynamic('users', 'image_medium', $u['id'], 'jpg', $u['updated'])); echo draw_img(file_dynamic('users', 'image_small', $u['id'], 'jpg', $u['updated'])); }
LEFT JOIN users_to_channels u2c ON u.id = u2c.user_id 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?"));
<?php include "../../include.php"; echo drawTop(); if (url_action("delete")) { db_delete("news_stories"); url_drop("action,id"); } elseif (url_id()) { $r = db_grab("SELECT \n\t\tn.headline,\n\t\tn.outlet,\n\t\tn.content,\n\t\td2.extension docExt,\n\t\td2.icon,\n\t\td2.description docTypeDesc,\n\t\tn.image,\n\t\td.extension imageExt,\n\t\tn.pubDate,\n\t\tn.url,\n\t\tn.description,\n\t\tISNULL(n.updated_date, n.created_date) updated\n\t\tFROM news_stories n\n\t\tLEFT JOIN docs_types d ON n.imageTypeID = d.id\n\t\tLEFT JOIN docs_types d2 ON n.fileTypeID = d2.id\n\t\tWHERE n.id = " . $_GET["id"]); if ($r["image"]) { //should be has_image, but whatever $filename = DIRECTORY_WRITE . "/news/thumbnail-" . $_GET["id"] . "." . $r["imageExt"]; file_dynamic($filename, $r["updated"], "SELECT image FROM news_stories WHERE id = " . $_GET["id"]); } echo drawTableStart(); echo drawHeaderRow("News Item", 2, "edit", "edit.php?id=" . $_GET["id"]); ?> <tr> <td class="left">Organization(s)</td> <td><?php $organizations = db_query("SELECT \n\t\t\to.description \n\t\t\tFROM news_stories_to_organizations ns2o\n\t\t\tJOIN organizations o ON ns2o.organizationID = o.id\n\t\t\tWHERE ns2o.newsID = " . $_GET["id"]); while ($o = db_fetch($organizations)) { echo $o["description"] . "<br>"; } ?> </td> </tr> <tr> <td class="left">Headline</td> <td class="big"><?php echo draw_img(DIRECTORY_WRITE . "/news/thumbnail-" . $_GET["id"] . "." . $r["imageExt"], false, "", "news-thumbnail");