function drawdrawColumnDelete($prompt = false, $id = false, $action = "delete", $adminOnly = true) { //if we're going to backend all the table stuff, then this should be incorporated somehow. perhaps we will need to extend the class global $page, $_josh; if ($adminOnly && !$page['is_admin']) { return false; } if (!$id) { return '<td width="16"> </td>'; } return draw_tag("td", array("width" => "16"), draw_img("/images/icons/delete.png", drawDeleteLink($prompt, $id, $action))); }
db_delete('organizations', $_GET['delete_id']); url_drop('delete_id,action'); } echo drawTop(); if (url_id()) { //form $f = new form('organizations', @$_GET['id']); $f->set_field(array('type' => 'text', 'name' => 'title' . langExt(), 'label' => getString('title'))); langUnsetFields($f, 'title'); langTranslateCheckbox($f); echo $f->draw(); } else { //modules list $t = new table('organizations', drawHeader()); $t->set_column('draggy', 'd', ' '); $t->set_column('title', 'l', getString('title')); $t->set_column('delete', 'd', ' '); $result = db_table('SELECT id, title' . langExt() . ' title FROM organizations WHERE is_active = 1 ORDER BY precedence'); foreach ($result as &$r) { $r['draggy'] = draw_img('/images/icons/move.png'); $r['title'] = draw_link('organizations.php?id=' . $r['id'], $r['title']); $r['delete'] = drawColumnDelete($r['id']); } echo $t->draw($result, 'No organizations'); //add new $f = new form('organizations'); $f->set_field(array('type' => 'text', 'name' => 'title' . langExt(), 'label' => getString('title'))); langUnsetFields($f, 'title'); echo $f->draw(false, false); } echo drawBottom();
<?php include "../../include.php"; echo drawTop(); $blurbs = db_table("SELECT \n\t\tr.id,\n\t\tr.title,\n\t\tt.icon,\n\t\tISNULL(r.updated_date, r.created_date) updated\n\t\tFROM employer_strategy_resources r\n\t\tJOIN docs_types t ON r.type_id = t.id\n\t\tWHERE r.is_active = 1\n\t\tORDER BY updated DESC", 20); $t = new table("web_news_blurbs"); $t->set_column("icon"); $t->set_column("title"); $t->set_column("updated", "r"); $t->set_title(drawHeader(array("add new" => "edit/"))); foreach ($blurbs as &$b) { $b["icon"] = draw_img($b["icon"]); $b["title"] = draw_link("edit/?id=" . $b["id"], $b["title"]); $b["updated"] = format_date($b["updated"]); } echo $t->draw($blurbs); echo drawBottom();
function drawBottom() { global $_josh, $modules, $helpdeskOptions, $helpdeskStatus, $modulettes, $page; $return = ' </div> <div id="right"> <div id="tools"> <a class="right button" href="/index.php?action=logout">' . getString('log_out') . '</a> ' . getString('hello') . ' <a href="/staff/view.php?id=' . $_SESSION['user_id'] . '"><b>' . $_SESSION['full_name'] . '</b></a>'; //search $return .= '<form name="search" accept-charset="utf-8" method="get" action="/staff/search.php" onsubmit="javascript:return doSearch(this);"> <input type="text" name="q" placeholder="' . getString('staff_search') . '"/> </form>'; //channel or language selectors if (getOption('channels')) { //$return .= draw_form_select('channel_id', 'SELECT id, title' . langExt() . ' title FROM channels WHERE is_active = 1 AND is_private = 0 ORDER BY precedence', $_SESSION['channel_id'], false, 'channels', 'url_query_set(\'channel_id\', this.value)', getString('networks_view_all')); $return .= draw_form_select('channel_id', 'SELECT c.id, c.title' . langExt() . ' title FROM channels c WHERE c.is_active = 1 AND (c.is_private = 0 OR (SELECT COUNT(*) FROM users_to_channels u2c WHERE u2c.channel_id = c.id AND u2c.user_id = ' . user() . ') > 0) ORDER BY precedence', $_SESSION['channel_id'], false, 'channels', 'url_query_set(\'channel_id\', this.value)', getString('networks_view_all')); } if (getOption('languages')) { $return .= draw_form_select('language_id', 'SELECT id, title FROM languages ORDER BY title', $_SESSION['language_id'], true, 'languages', 'url_query_set(\'language_id\', this.value)'); } //links $links = db_table('SELECT title' . langExt() . ' title, url FROM links WHERE is_active = 1 ORDER BY precedence'); foreach ($links as &$l) { $l = draw_link($l['url'], $l['title'], true); } $return .= draw_div('#links', draw_container('h3', getString('links')) . (admin() ? draw_link('/a/admin/links.php', getString('edit'), false, array('class' => 'right button')) : false) . draw_list($links)); $return .= '</div>'; foreach ($modules as $m) { $return .= ' <table class="right ' . $m['folder'] . '" cellspacing="1"> <tr> <td colspan="2" class="head" style="background-color:#' . $m['color'] . ';"> <a href="/' . $m['folder'] . '/" class="left">' . $m['title'] . '</a> ' . draw_img('/images/arrows-new/' . format_boolean($m['is_closed'], 'up|down') . '.png', url_query_add(array('module' => $m['id']), false)) . ' </td> </tr>'; if (!$m['is_closed']) { include DIRECTORY_ROOT . DIRECTORY_SEPARATOR . $m['folder'] . DIRECTORY_SEPARATOR . 'pallet.php'; } $return .= '</table>'; } $return .= '</div> <div id="footer">'; //if (admin()) $return .= 'page rendered in ' . format_time_exec() . '<br/>'; $return .= getString('copyright') . '<br/>'; if (getOption('legal')) { $return .= draw_link('/login/legal.php', getString('legal_title')); } $return .= '</div></div> <div id="subfooter"></div> </body> </html>'; //record pageview if ($page['id'] && user()) { db_query('INSERT INTO pages_views ( page_id, user_id, timestamp ) VALUES ( ' . $page['id'] . ', ' . user('NULL') . ', GETDATE() )'); } return $return; }
<?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();
<td><a href="add_edit.php?requestID=<?php echo $r["id"]; ?> "><?php echo $r["lastname"]; ?> , <?php echo $r["firstname"]; ?> </a></td> <td class="r"><?php echo format_date_time($r["created_date"]); ?> </td> <td width="16"><?php echo draw_img("/images/icons/delete.png", url_query_add(array("action" => "deletereq", "id" => $r["id"]), false)); ?> </td> </tr> <?php } } else { echo drawEmptyResult(getString('staff_requests_empty')); } echo drawTableEnd(); //never logged in echo drawTableStart(); echo drawHeaderRow(getString('staff_never_logged_in'), 3, getString('staff_invite_all'), url_query_add(array("action" => "invite"), false)); $result = db_query("SELECT id, lastname, firstname, created_date FROM users WHERE lastlogin IS NULL AND is_active = 1 ORDER BY lastname"); if (db_found($result)) { ?>
<?php include "include.php"; if (url_action('delete')) { db_delete('bb_topics_types'); url_drop('action,id'); } echo drawTop(); $t = new table('bb_topics_types', drawHeader($page['is_admin'] ? array('category_edit.php' => getString('category_new')) : false)); $t->set_column('category', 'l', getString('category')); $t->set_column('topics', 'r', getString('topics')); if ($page['is_admin']) { $t->set_column('delete', 'd', ' '); } $result = db_table('SELECT y.id, y.title' . langExt() . ' category, (SELECT COUNT(*) FROM bb_topics t WHERE t.type_id = y.id AND t.is_active = 1) topics FROM bb_topics_types y WHERE y.is_active = 1 ORDER BY y.title'); foreach ($result as &$r) { $r['category'] = draw_link('category.php?id=' . $r['id'], $r['category']); if ($page['is_admin']) { $r['delete'] = draw_img('/images/icons/delete.png', url_query_add(array('action' => 'delete', 'id' => $r['id']), false)); } } echo $t->draw($result, 'No categories added yet'); echo drawBottom();
function drawTicketRow($r, $mode = "status") { //mode can be status or type global $priorityOptions, $statusOptions, $ownerOptions, $typeOptions, $_josh; $return = ' <tr> <td rowspan="2">' . drawName($r["created_user"], $r["first"] . ' ' . $r["last"], $r["created_date"], true, $r['updated']) . '</td> <td colspan="3"><a href="ticket.php?id=' . $r["id"] . '"><b>' . $r["title"] . '</b></a></td> <td rowspan="2">' . draw_img("/images/icons/delete.png", drawDeleteLink("Delete this ticket?", $r["id"], "delete", "ticketID")) . '</td> </tr> <tr>'; $t = array("ticketID" => $r["id"]); if ($mode == "status") { $return .= '<td>' . draw_form_select("", $priorityOptions, $r["priorityID"], false, "field", "location.href='" . url_query_add($t, false) . "&newPriority=' + this.value") . '</td> <td>' . draw_form_select("", $statusOptions, $r["statusID"], true, "field", "location.href='" . url_query_add($t, false) . "&newStatus=' + this.value") . '</td> <td>' . draw_form_select("", $ownerOptions, $r["ownerID"], false, "field", "location.href='" . url_query_add($t, false) . "&newOwner=' + this.value") . '</td>'; } elseif ($mode == "type") { $return .= '<td colspan="3">' . draw_form_select("", $typeOptions, $r["type_id"], false, "field", "location.href='" . url_query_add($t, false) . "&newType=' + this.value") . '</td>'; } $return .= '</tr>'; return $return; }
' . db_updated('u') . ' FROM users u JOIN languages l ON u.language_id = l.id 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
<td><a href="add_edit.php?requestID=<?php echo $r["id"]; ?> "><?php echo $r["lastname"]; ?> , <?php echo $r["firstname"]; ?> </a></td> <td class="r"><?php echo format_date_time($r["createdOn"]); ?> </td> <td width="16"><?php echo draw_img($locale . "images/icons/delete.gif", url_query_add(array("action" => "deletereq", "id" => $r["id"]), false)); ?> </td> </tr> <?php } } else { echo drawEmptyResult("No pending requests!"); } echo drawTableEnd(); echo drawTableStart(); echo drawHeaderRow("Never Logged In", 3, "invite them all", url_query_add(array("action" => "invite"), false)); $result = db_query("SELECT userid, lastname, firstname, createdOn FROM intranet_users WHERE lastlogin IS NULL AND isactive = 1 ORDER BY lastname"); if (db_found($result)) { ?> <tr>
function draw_navigation($options, $match = false, $type = "text", $class = "navigation") { //type could be text, images or rollovers global $_josh; //debug(); $return = $_josh["newline"] . $_josh["newline"] . "<!--start nav-->" . $_josh["newline"] . "<ul class='" . $class . "'>"; if ($match === false) { $match = $_josh["request"]["path"]; } elseif ($match === true) { $match = $_josh["request"]["path_query"]; } elseif ($match == "//") { //to take care of a common / . folder . / scenario $match = "/"; } error_debug("<b>draw_navigation</b> match is " . $match); $counter = 1; $javascript = $_josh["newline"]; foreach ($options as $title => $url) { $name = 'option' . $counter; $return .= $_josh["newline"] . '<li><a href="' . $url . '" class="' . $name; if (str_replace(url_base(), "", $url) == $match) { $img_state = "_on"; $return .= ' selected'; } else { $img_state = "_off"; if ($type == "rollovers") { $return .= '" onmouseover="javascript:roll(\'' . $name . '\',\'on\');" onmouseout="javascript:roll(\'' . $name . '\',\'off\');'; } } $return .= '">'; if ($type == "text") { $return .= $title; } elseif ($type == "images" || $type == "rollovers") { $img = str_replace("/", "", $url); if (empty($img)) { $img = "home"; } $img = "/images/navigation/" . $img; if ($type == "rollovers") { $javascript .= $name . "_on\t\t = new Image;" . $_josh["newline"]; $javascript .= $name . "_off\t = new Image;" . $_josh["newline"]; $javascript .= $name . "_on.src\t = '" . $img . "_on.png';" . $_josh["newline"]; $javascript .= $name . "_off.src = '" . $img . "_off.png';" . $_josh["newline"]; } $img .= $img_state . ".png"; $return .= draw_img($img, false, false, $name); } $return .= '</a></li>'; $counter++; } $return .= $_josh["newline"] . "</ul>"; if ($type == "rollovers") { $return = draw_javascript('if (document.images) {' . $javascript . '} function roll(what, how) { eval("document." + what + ".src = " + what + "_" + how + ".src;"); }') . $return; } return $return; }
<?php $corners = array('top-left', 'top-right', 'bottom-left', 'bottom-right'); foreach ($corners as $c) { echo draw_div_class($c, draw_img('/images/corners-white/' . $c . '.png')); } echo draw_img(DIRECTORY_WRITE . "/login.png"); $f = new form('login', false, getString('submit')); $f->set_field(array('name' => 'email', 'type' => 'text', 'label' => getString('email'), 'value' => @$_COOKIE["last_email"])); $f->set_field(array('name' => 'password', 'type' => 'password', 'label' => getString('password'))); $f->set_field(array('name' => 'goto', 'type' => 'hidden', 'value' => @$_GET["goto"])); $f->set_focus(@$_COOKIE["last_email"] ? 'password' : 'email'); echo $f->draw(); ?> </div> <div id="grey"> <?php foreach ($corners as $c) { echo draw_div_class($c, draw_img('/images/corners-grey/' . $c . '.png')); } echo getString("app_welcome"); echo draw_nav(array('/login/password_reset.php' => getString("login_forgot_password"), '/login/account_request.php' => getString("login_need_account"), 'mailto:' . $_josh['email_default'] => getString("login_ask_question"))); ?> </div> <?php if (getOption('languages')) { echo draw_div('language', draw_form_select('language_id', 'SELECT id, title FROM languages ORDER BY title', $_SESSION['language_id'], true, 'grey', 'url_query_set(\'language_id\', this.value)')); } ?> </div> </body> </html>
<?php include "../include.php"; echo drawTop(); ?> <table class="left" cellspacing="1"> <?php echo drawHeaderRow("Former Staff", 5); ?> <?php $staff = db_query("SELECT \n\t\t\t\t\t\t\tu.id, \n\t\t\t\t\t\t\tu.lastname,\n\t\t\t\t\t\t\tISNULL(u.nickname, u.firstname) firstname, \n\t\t\t\t\t\t\tu.bio, \n\t\t\t\t\t\t\tu.phone, \n\t\t\t\t\t\t\tf.name office, \n\t\t\t\t\t\t\tu.title, \n\t\t\t\t\t\t\td.departmentName\n\t\t\t\t\t\tFROM users u\n\t\t\t\t\t\tLEFT JOIN departments d ON d.departmentID = u.departmentID \n\t\t\t\t\t\tLEFT JOIN offices f ON f.id = u.officeID\n\t\t\t\t\t\tWHERE u.is_active = 0\n\t\t\t\t\t\tORDER BY u.lastname, ISNULL(u.nickname, u.firstname)"); while ($s = db_fetch($staff)) { ?> <tr height="38"> <td width="47" align="center"><?php echo draw_img(DIRECTORY_WRITE . "/staff/" . $r["user_id"] . "-small.jpg", "/staff/view.php?id=" . $r["user_id"]); ?> </td> <td><nobr><a href="view.php?id=<?php echo $s["user_id"]; ?> "><?php echo $s["lastname"]; ?> , <?php echo $s["firstname"]; ?> </a></nobr></td> <td><?php echo $s["title"]; ?>
<th>Name</th> <th class="r">Updated</th> <?php if ($page['is_admin']) { ?> <th width="16"></th><?php } ?> </tr> <?php while ($d = db_fetch($docs)) { $link = "./?id=" . $d["id"]; ?> <tr> <td width="16"><?php echo draw_img(DIRECTORY_WRITE . $d["icon"], $link); ?> </td> <td><a href="<?php echo $link; ?> "><?php echo $d["name"]; ?> </a></td> <td class="r"><?php echo format_date($d["updated_date"]); ?> </td> <?php echo drawdrawColumnDelete("Delete document?", $d["id"]);
<?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'])); }
</td> </tr> <tr> <td class="left">Date</td> <td><?php echo format_date($r["pubDate"]); ?> </td> </tr> <?php if ($r["docExt"]) { ?> <tr> <td class="left">File</td> <td><table class="nospacing"><tr><td><?php echo draw_img(DIRECTORY_WRITE . $r["icon"], "download.php?id=" . $_GET["id"]); ?> </td> <td><a href="download.php?id=<?php echo $_GET["id"]; ?> "> <?php echo $r["docTypeDesc"]; ?> (<?php echo format_size(strlen($r["content"])); ?> )</a></td> </tr></table></td> </tr> <?php