function bbDrawTable($limit = false, $where = false, $title = false) { //only show add new on main page $options = !$limit ? false : array('#bottom' => getString('add_new')); $t = new table('bb_topics', drawHeader($options, $title)); $t->set_column('topic', 'l', getString('topic')); $t->set_column('starter', 'l', getString('starter'), 120); $t->set_column('replies', 'c', getString('replies'), 30); $t->set_column('last_post', 'r', getString('last_post'), 100); $result = bbGetTopics($where, $limit); foreach ($result as &$r) { array_argument($r, 'thread'); if ($r['is_admin']) { array_argument($r, 'admin'); } $r['link'] = 'topic.php?id=' . $r['id']; if (empty($r['topic'])) { $r['topic'] = '<i>no topic entered</i>'; } $r['topic'] = draw_link($r['link'], $r['topic']); $r['starter'] = $r['firstname'] . ' ' . $r['lastname']; $r['last_post'] = format_date($r['last_post']); } return $t->draw($result, getString('topics_empty')); }
<?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();
$f->set_field(array('name' => 'content', 'label' => getString('file'), 'type' => 'file', 'additional' => getString('upload_max') . file_get_max())); $f->set_field(array('name' => 'categories', 'label' => getString('categories'), 'type' => 'checkboxes', 'options_table' => 'dl_categories', 'option_title' => 'title', 'linking_table' => 'dl_docs_to_categories', 'object_id' => 'doc_id', 'option_id' => 'category_id')); echo $f->draw(); } else { $result = db_table('SELECT d.id, d.title, ' . db_updated('d') . ', d.extension, c.title "group" FROM dl_docs d JOIN dl_docs_to_categories d2c ON d.id = d2c.doc_id JOIN dl_categories c ON d2c.category_id = c.id ORDER BY c.precedence, d.title;'); $links = $page['is_admin'] ? array(url_query_add(array('doc_id' => 'new'), false) => getString('add_new')) : false; $t = new table('dl_docs', drawHeader($links)); $t->set_column('icon', 'd', ' '); $t->set_column('title', 'l', getString('title')); $t->set_column('updated', 'r', getString('updated')); foreach ($result as &$r) { $link = 'info.php?id=' . $r['id']; $r['icon'] = file_icon($r['extension'], $link); $r['title'] = draw_link($link, $r['title']); if (getOption('languages')) { $r['title'] .= ' (' . $r['language'] . ')'; } $r['updated'] = format_date($r['updated']); } echo $t->draw($result, getString('documents_empty')); } echo drawBottom();
<?php } ?> </td> </tr> <?php } ?> </table> <?php } else { //main table $result = db_table('SELECT e.id, e.title' . langExt() . ' title, t.title' . langExt() . ' "group", e2t.type_id FROM external_orgs e JOIN external_orgs_to_types e2t ON e.id = e2t.org_id JOIN external_orgs_types t ON e2t.type_id = t.id WHERE e.is_active = 1 ORDER BY t.title, e.title '); $t = new table('external_orgs_types', drawHeader(array('#bottom' => getString('add_new')))); $t->set_column('title', 'l', getString('title')); foreach ($result as &$r) { $r['group'] = draw_link('./type.php?id=' . $r['type_id'], $r['group']); $r['title'] = draw_link('./?id=' . $r['id'], $r['title']); } echo $t->draw($result, 'There are no external orgs added yet.'); //add new include 'edit.php'; } echo drawBottom();
<?php include "../include.php"; echo drawTop(); if (url_id()) { $title = db_grab('SELECT title' . langExt() . ' title FROM press_clips_types WHERE id = ' . $_GET["id"]); $result = db_table('SELECT c.id, c.title' . langExt() . ' title, c.pub_date, c.publication' . langExt() . ' publication, ISNULL(c.created_date, c.updated_date) updated FROM press_clips c ' . getChannelsWhere('press_clips', 'c', 'clip_id') . ' AND c.type_id = ' . $_GET["id"] . ' ORDER BY updated DESC'); $t = new table('press_clips', drawHeader(false, $title)); $t->set_column('title', 'l', getString('title')); $t->set_column('publication', 'l', getString('publication')); $t->set_column('pub_date', 'r', getString('published')); foreach ($result as &$r) { $r['title'] = draw_link('clip.php?id=' . $r['id'], format_string($r['title'], 50)); $r['pub_date'] = format_date($r['pub_date']); } echo $t->draw($result, 'There are no clips tagged <i>' . $title . '</i>.'); } else { $t = new table('press_clips', drawHeader()); $t->set_column('category', 'l', getString('category')); $t->set_column('clips', 'r', getString('clips')); $result = db_table('SELECT t.id, t.title' . langExt() . ' category, (SELECT COUNT(*) FROM press_clips c WHERE c.type_id = t.id) clips FROM press_clips_types t ORDER BY t.precedence'); foreach ($result as &$r) { $r['category'] = draw_link(url_query_add(array('id' => $r['id']), false), $r['category']); } echo $t->draw($result); } echo drawBottom();
<?php include "../../include.php"; echo drawTop(); $t = new table('emails', drawHeader()); $t->set_column('address', 'l', 'Email Address'); $t->set_column('created_date', 'r', 'Sent'); $emails = db_table('SELECT address, subject "group", created_date FROM emails ORDER BY created_date DESC', 100); foreach ($emails as &$e) { $e['created_date'] = format_date_time($e['created_date']); } echo $t->draw($emails); 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();
<?php include "../../include.php"; if (url_id('module_id')) { $result = db_table('SELECT p.id, p.title, p.url, p.is_hidden FROM pages p WHERE module_id = ' . $_GET['module_id'] . ' ORDER BY p.precedence'); } elseif (url_id('modulette_id')) { $result = db_table('SELECT p.id, p.title, p.url, p.is_hidden FROM pages p WHERE modulette_id = ' . $_GET['modulette_id'] . ' ORDER BY p.precedence'); } else { url_change('./'); } echo drawTop(); //pages list $t = new table('pages', drawHeader()); $t->set_column('is_hidden', 'd', ' '); $t->set_column('draggy', 'd', ' '); $t->set_column('title', 'l', getString('title')); $t->set_column('url'); $t->set_draggable('draggy'); foreach ($result as &$r) { $r['is_hidden'] = draw_form_checkbox('foo', !$r['is_hidden'], false, 'ajax_set(\'pages\', \'is_hidden\', ' . $r['id'] . ', ' . abs($r['is_hidden'] - 1) . ');'); $r['draggy'] = draw_img('/images/icons/move.png'); $r['title'] = draw_link('page.php?id=' . $r['id'], $r['title']); if (empty($r['url'])) { $r['url'] = 'index.php'; } } echo $t->draw($result, 'No pages'); echo drawBottom();
<?php include '../../include.php'; if ($posting) { langTranslatePost('title'); $id = db_save('modulettes'); url_drop('id'); } echo drawTop(); if (url_id()) { //form $f = new form('modulettes', @$_GET['id']); langUnsetFields($f, 'title'); langTranslateCheckbox($f); echo $f->draw(); } else { //modulettes list $t = new table('modulettes', drawHeader()); $t->set_column('is_active', 'd', ' '); $t->set_column('title', 'l', getString('title')); $t->set_column('pages', 'r'); $result = db_table('SELECT m.id, m.title' . langExt() . ' title, m.is_active, (SELECT COUNT(*) FROM pages p WHERE p.modulette_id = m.id) pages FROM modulettes m ORDER BY m.title' . langExt()); foreach ($result as &$r) { $r['is_active'] = draw_form_checkbox('is_active', $r['is_active'], false, 'ajax_set(\'modulettes\', \'is_active\', ' . $r['id'] . ', ' . abs($r['is_active'] - 1) . ');'); $r['title'] = draw_link('modulettes.php?id=' . $r['id'], $r['title']); $r['pages'] = draw_link('pages.php?modulette_id=' . $r['id'], format_quantitize($r['pages'], 'page')); } echo $t->draw($result, 'No modulettes'); } echo drawBottom();
<?php include '../../include.php'; echo drawtop(); $t = new table('ldcodes', drawHeader(false, 'Long Distance Codes')); $t->set_column('code', 'c', 'Code'); $t->set_column('user', 'l', 'User'); $result = db_table('SELECT l.code, (SELECT CONCAT_WS(",", u.lastname, u.firstname, u.id) FROM users u WHERE u.longDistanceCode = l.code AND u.is_active = 1) user FROM ldcodes l ORDER BY user'); foreach ($result as &$r) { if ($r['user']) { $r['group'] = 'Assigned'; list($lastname, $firstname, $id) = explode(',', $r['user']); $r['user'] = draw_link('/staff/view.php?id=' . $id, $lastname . ', ' . $firstname); } else { $r['group'] = 'Unassigned Codes'; } } echo $t->draw($result, 'There are no long distance codes'); echo drawBottom();
<?php include "../include.php"; echo drawTop(); $result = db_table('SELECT d.id, d.title' . langExt() . ' title, (SELECT COUNT(*) FROM docs_views v WHERE v.documentID = d.id) downloads, i.extension, i.description alt FROM docs d JOIN docs_types i ON d.type_id = i.id ' . getChannelsWhere('docs', 'd', 'doc_id') . ' ORDER BY downloads DESC', 20); $t = new table('docs', drawHeader()); $t->set_column('icon', 'd', ' '); $t->set_column('title', 'l', getString('title')); $t->set_column('downloads', 'r', getString('downloads')); foreach ($result as &$r) { $link = 'info.php?id=' . $r['id']; $r['icon'] = file_icon($r['extension'], $link); $r['title'] = draw_link($link, $r['title']); } echo $t->draw($result, getString('documents_empty')); echo drawBottom();
<?php include '../../include.php'; if (url_action('delete')) { db_delete('soc_members', $_GET['delete_id']); url_drop('action,delete_id'); } echo drawTop(); $t = new table('soc_members', drawHeader(array('edit.php' => 'Add New'))); $t->set_column('is_selected', 'd', ' '); $t->set_column('name'); $t->set_column('updated', 'r'); $t->set_column('delete', 'd', ' '); $result = db_table('SELECT m.id, m.name, m.is_selected, c.en "group", ' . db_updated('m') . ' FROM soc_members m JOIN jr_countries c ON m.country_id = c.id WHERE m.is_active = 1 ORDER BY c.en, m.name'); foreach ($result as &$r) { $r['is_selected'] = draw_form_checkbox('foo', $r['is_selected'], false, 'ajax_set(\'soc_members\', \'is_selected\', ' . $r['id'] . ', ' . abs($r['is_selected'] - 1) . ');'); $r['name'] = draw_link('edit.php?id=' . $r['id'], format_string($r['name'], 70)); $r['updated'] = format_date($r['updated']); $r['delete'] = drawColumnDelete($r['id']); } echo $t->draw($result); echo drawBottom();
<?php include "../../include.php"; echo drawTop(); $t = new table(); $t->set_column("organization"); $t->set_column("location"); $t->set_column("updated", "r"); $t->set_title(drawHeader()); $result = db_table("SELECT o.id, o.name organization, z.city, z.state, o.updated_date updated FROM web_organizations o JOIN zip_codes z ON o.zip = z.zip ORDER BY o.name"); foreach ($result as &$r) { $r["organization"] = draw_link("organization_view.php?id=" . $r["id"], format_string($r["organization"], 50)); $r["location"] = $r["city"] . ", " . $r["state"]; $r["updated"] = "<nobr>" . format_date($r["updated"]) . "</nobr>"; } echo $t->draw($result); echo drawBottom();
?> '><?php } else { ?> <b><?php } echo format_string($o['title'], 26); ?> </b></a></td> <?php } ?> </tr> </table> <?php } else { echo drawPanel(draw_form_select('foo', $orgs, url_id(), false, false, 'location.href=\'' . $request['path'] . '?id=\' + this.value')); } if (url_id()) { $where = $_GET['id'] == 0 ? ' IS NULL ' : ' = ' . $_GET['id']; $links = $page['is_admin'] ? array('add_edit.php' => getString('add_new')) : false; echo drawStaffList('u.is_active = 1 AND u.organization_id ' . $where, 'This organization has no staff associated with it.', $links, draw_link($request['path_query'], $page['title']) . ' > ' . db_grab('SELECT title FROM organizations WHERE id = ' . $_GET['id'])); } else { $t = new table('foo', drawHeader()); $t->set_column('title', false, getString('title')); foreach ($orgs as &$o) { $o['title'] = draw_link('organizations.php?id=' . $o['id'], $o['title']); } echo $t->draw($orgs); } echo drawBottom();
<?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();
if ($posting) { langTranslatePost('title'); $id = db_save('modules'); url_drop('id'); } echo drawTop(); if (url_id()) { //form $f = new form('modules', @$_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('modules', drawHeader()); $t->set_column('is_selected', 'd', ' '); $t->set_column('draggy', 'd', ' '); $t->set_column('title', 'l', getString('title')); $t->set_column('pages', 'r'); $result = db_table('SELECT m.id, m.title' . langExt() . ' title, m.is_active, (SELECT COUNT(*) FROM pages p WHERE p.module_id = m.id AND p.modulette_id IS NULL) pages FROM modules m ORDER BY m.precedence'); $t->set_draggable('draggy'); foreach ($result as &$r) { $r['is_selected'] = draw_form_checkbox('foo', $r['is_active'], false, 'ajax_set(\'modules\', \'is_active\', ' . $r['id'] . ', ' . abs($r['is_active'] - 1) . ');'); $r['draggy'] = draw_img('/images/icons/move.png'); $r['title'] = draw_link('./?id=' . $r['id'], $r['title']); $r['pages'] = draw_link('pages.php?module_id=' . $r['id'], format_quantitize($r['pages'], 'page')); } echo $t->draw($result, 'No modules'); } echo drawBottom();
<?php include "../include.php"; echo drawTop(); $t = new table('bb_topics', drawHeader()); $t->set_column('contact', 'l', 'Contact Record'); $t->set_column('action'); //$t->set_column('contact', 'l', 'Done By'); $t->set_column('when', 'r'); $result = db_table('SELECT c.id, c.firstname, c.lastname, c.updated_date, ' . db_updated('c') . ' FROM contacts c ORDER BY updated DESC', 40); foreach ($result as &$r) { $r['contact'] = draw_link('contact.php?id=' . $r['id'], $r['lastname'] . ', ' . $r['firstname']); $r['action'] = $r['updated_date'] ? 'Update' : 'New Contact'; $r['when'] = format_date($r['updated']); } echo $t->draw($result); echo drawBottom();
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); }
c.address_2, RIGHT("00000" + RTRIM(c.zip), 5) zip, c.phone, c.fax, c.mobile_phone, c.email, z.city, z.state, c.notes FROM contacts c LEFT JOIN zip_codes z ON c.zip = z.zip WHERE c.id = ' . $_GET['id']); $d = new display(); $d->row('Name', $r['salutation'] . ' ' . $r['firstname'] . ' ' . $r['lastname'] . ($r['suffix'] ? ', ' . $r['suffix'] : '')); $d->row('Company', $r['organization']); $d->row('Job Title', $r['title']); $d->row('Address', $r['address_1'] . ($r['address_2'] ? BR . $r['address_2'] : false) . BR . $r['city'] . ', ' . $r['state'] . ' ' . $r['zip']); $d->row('Phone', $r['phone']); $d->row('Fax', $r['fax']); $d->row('Mobile', $r['mobile_phone']); $d->row('Email', draw_link('mailto:' . $r['email'])); $d->row('Notes', nl2br($r['notes'])); echo $d->draw(); $result = db_table('SELECT t.id, t.tag, y.title "group" FROM contacts_to_tags c2t JOIN contacts_tags t ON c2t.tag_id = t.id JOIN contacts_tags_types y ON t.type_id = y.id WHERE c2t.contact_id = ' . $_GET['id']); $t = new table('contacts_tags'); $t->set_column('tag'); foreach ($result as &$r) { $r['tag'] = draw_link('value.php?id=' . $r['id'], $r['tag']); } echo $t->draw($result); echo drawBottom();
} elseif (url_action('delete') && url_id('delete_id')) { 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); }
<?php include "../../include.php"; if (url_id() && url_action('delete')) { db_delete('web_news_blurbs', $_GET['delete_id']); url_drop('action,delete_id'); } echo drawTop(); $blurbs = db_table("SELECT b.id, b.title, b.publish_date FROM web_news_blurbs b WHERE b.is_active = 1 ORDER BY b.publish_date DESC"); $t = new table("web_news_blurbs"); $t->set_column("title"); $t->set_column("publish_date", "r"); $t->set_column('delete', 'c', ' '); $t->set_title(drawHeader(array("add new" => "edit/"))); foreach ($blurbs as &$b) { $b["title"] = draw_link("edit/?id=" . $b["id"], $b["title"]); $b["publish_date"] = format_date($b["publish_date"]); $b['delete'] = draw_img('/images/icons/delete.gif', url_query_add(array('action' => 'delete', 'id' => $b['id']), false)); } echo $t->draw($blurbs); echo drawBottom();