Beispiel #1
0
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'));
}
Beispiel #2
0
    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', '&nbsp;');
    $t->set_column('title', 'l', getString('title'));
    $t->set_column('delete', 'd', '&nbsp;');
    $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();
Beispiel #3
0
<?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();
Beispiel #4
0
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', '&nbsp;', 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', '&nbsp;', 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);
}
Beispiel #5
0
<?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', '&nbsp;');
$t->set_column('draggy', 'd', '&nbsp;');
$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();
Beispiel #6
0
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', '&nbsp;');
    $t->set_column('draggy', 'd', '&nbsp;');
    $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();
Beispiel #7
0
<?php

include '../include.php';
echo drawTop();
$t = new table('staff', drawHeader());
$t->set_column('picture', 'l', '&nbsp;', '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();
Beispiel #8
0
<?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', '&nbsp;');
}
$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();
Beispiel #9
0
    $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', '&nbsp;');
    $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();
Beispiel #10
0
			<?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();
Beispiel #11
0
<?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();
Beispiel #12
0
<?php

include "../include.php";
echo drawTop();
$result = db_table('SELECT 
		c.id, 
		c.title' . langExt() . ' title, 
		c.pub_date, 
		t.title' . langExt() . ' "group", 
		c.publication' . langExt() . ' publication, 
		' . db_updated('c') . '
	FROM press_clips c 
	JOIN press_clips_types t ON c.type_id = t.id 
	' . getChannelsWhere('press_clips', 'c', 'clip_id') . '
	ORDER BY t.title, pub_date DESC', 20);
$t = new table('press-clips', drawHeader(array('edit.php' => getString('add_new'))));
$t->set_column('title', 'l', getString('title'));
foreach ($result as &$r) {
    $r['title'] = draw_link("clip.php?id=" . $r["id"], format_string($r["title"], 80)) . '<br>' . $r["publication"] . ' <span class="light">' . format_date($r["pub_date"]) . '</span>';
}
echo $t->draw($result, getString('pressclips_recent_empty'));
include "edit.php";
echo drawBottom();
Beispiel #13
0
<?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();
Beispiel #14
0
} elseif (url_action('delete')) {
    db_delete('dl_categories');
    url_drop('action,id');
}
echo drawTop();
if (!empty($_GET['category_id'])) {
    //category form
    if ($_GET['category_id'] == 'new') {
        $_GET['category_id'] = false;
    }
    $f = new form('dl_categories', $_GET['category_id'], ($_GET['category_id'] ? 'Edit' : 'Add') . ' Category');
    $f->set_title_prefix($page['breadcrumbs']);
    echo $f->draw();
} else {
    //list of categories
    $result = db_table('SELECT id, title, ' . db_updated() . ' FROM dl_categories WHERE is_active = 1 ORDER BY precedence');
    $links = $page['is_admin'] ? array(url_query_add(array('category_id' => 'new'), false) => getString('add_new')) : false;
    $t = new table('dl_categories', drawHeader($links));
    $t->set_column('draggy', 'd', '&nbsp;');
    $t->set_column('title', 'l', getString('title'));
    $t->set_column('updated', 'r', getString('updated'));
    $t->set_column('delete', 'd', '&nbsp;');
    foreach ($result as &$r) {
        $r['draggy'] = draw_img('/images/icons/move.png');
        $r['title'] = draw_link(url_query_add(array('category_id' => $r['id']), false), $r['title']);
        $r['updated'] = format_date($r['updated']);
        $r['delete'] = draw_link(url_query_add(array('action' => 'delete', 'id' => $r['id']), false), 'x', false, 'confirm');
    }
    echo $t->draw($result, getString('categories_empty'));
}
echo drawBottom();
Beispiel #15
0
            ?>
'><?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']) . ' &gt; ' . 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();
Beispiel #16
0
<?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();