Example #1
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', ' ', 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);
}
Example #2
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();
Example #3
0
    url_query_add(array("month" => $_POST['start_dateMonth'], "year" => $_POST['start_dateYear']));
}
if (!isset($_GET['month']) || !isset($_GET['year'])) {
    url_query_add(array("month" => $_josh['month'], "year" => $_josh['year']));
}
echo drawTop();
echo drawNavigationCal($_GET['month'], $_GET['year']);
//get events
$result = db_query('SELECT 
			e.id,
			DAY(e.start_date) startDay,
			e.title' . langExt() . ' title,
			t.color
		FROM cal_events e
		JOIN cal_events_types t ON e.type_id = t.id
	' . getChannelsWhere('cal_events', 'e', 'event_id') . '
			AND 
			MONTH(e.start_date) = ' . $_GET['month'] . ' AND
			YEAR(e.start_date) = ' . $_GET['year']);
while ($r = db_fetch($result)) {
    $events[$r['startDay']][$r['id']]['title'] = $r['title'];
    $events[$r['startDay']][$r['id']]['color'] = $r['color'];
}
//SET UP VARIABLES
$monthname = $_josh['months'][$_GET['month'] - 1];
$firstday = date("w", mktime(0, 0, 0, $_GET['month'], 1, $_GET['year']));
$lastday = date("d", mktime(0, 0, 0, $_GET['month'] + 1, 0, $_GET['year']));
$prevmonth = $_GET['month'] - 1;
$prevyear = $_GET['year'];
$nextmonth = $_GET['month'] + 1;
$nextyear = $_GET['year'];
Example #4
0
if (url_action('delete')) {
    db_delete('external_orgs', $_GET['org_id']);
    url_drop('action,org_id');
}
echo drawTop();
//main table
echo drawTableStart();
if ($page['is_admin']) {
    echo drawHeaderRow($page['breadcrumbs'] . format_string(db_grab('SELECT title' . langExt() . ' title FROM external_orgs_types WHERE id = ' . $_GET['id'])), 1, getString('add_new'), '#bottom');
} else {
    echo drawHeaderRow($page['breadcrumbs'] . format_string(db_grab('SELECT title' . langExt() . ' title FROM external_orgs_types WHERE id = ' . $_GET['id'])));
}
$orgs = db_query('SELECT 
	o.id, o.url, o.title' . langExt() . ' title, o.description' . langExt() . ' description 
	FROM external_orgs o 
		' . getChannelsWhere('external_orgs', 'o', 'org_id') . '
		AND (SELECT COUNT(*) FROM external_orgs_to_types t WHERE t.org_id = o.id AND t.type_id = ' . $_GET['id'] . ' > 0)
	ORDER BY o.title');
if (db_found($orgs)) {
    while ($o = db_fetch($orgs)) {
        ?>
	<tr>
		<td class='text'>
			<?php 
        if ($page['is_admin']) {
            ?>
			<a href="<?php 
            echo drawDeleteLink('delete this org?', $o['id'], 'delete', 'org_id');
            ?>
" class="button-light right"><?php 
            echo getString('delete');
Example #5
0
<?php

$events = db_query('SELECT
			e.id, 
			e.title' . langExt() . ' title, 
			e.start_date,
			t.color
		FROM cal_events e
		LEFT JOIN cal_events_types t ON e.type_id = t.id
		' . getChannelsWhere('cal_events', 'e', 'event_id') . ' AND e.start_date > ' . db_date() . '
		ORDER BY e.start_date ASC', 4);
if (db_found($events)) {
    while ($e = db_fetch($events)) {
        $return .= '
	<tr>
		<td width="80%"><a href="/' . $m['folder'] . '/event.php?id=' . $e['id'] . '" class="block" style="background-color:' . $e['color'] . ';">' . $e['title'] . '</a></td>
		<td width="20%" align="right">' . format_date($e['start_date'], "", "%b %d") . '</td>
	</tr>';
    }
} else {
    $return .= '<tr><td colspan="2" class="empty">' . getString('events_empty') . '</td></tr>';
}
Example #6
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();
Example #7
0
<?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', '&nbsp;');
$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();
Example #8
0
<?php

$clips = db_query('SELECT c.id, c.title' . langExt() . ' title FROM press_clips c ' . getChannelsWhere('press_clips', 'c', 'clip_id') . ' ORDER BY c.pub_date DESC', 4);
if (db_found($clips)) {
    while ($c = db_fetch($clips)) {
        $return .= '<tr><td colspan="2"><a href="/' . $m['folder'] . '/clip.php?id=' . $c['id'] . '">' . format_string($c['title'], 40) . '</a></td></tr>';
    }
} else {
    $return .= '<tr><td colspan="2" class="empty">No clips have been added.</td></tr>';
}
Example #9
0
<?php

$result = db_query('SELECT
		id,
		title' . langExt() . ' title,
		is_admin,
		replies
	FROM bb_topics t
	' . getChannelsWhere('bb_topics', 't', 'topic_id') . '
	ORDER BY thread_date DESC', 4);
if (db_found($result)) {
    while ($r = db_fetch($result)) {
        $return .= draw_container('tr', '<td width="90%"><a href="/' . $m["folder"] . '/topic.php?id=' . $r["id"] . '">' . format_string($r["title"], 39) . '</a></td>
			<td width="10%" align="center">' . $r["replies"] . '</td>', $r["is_admin"] == 1 ? array('class' => 'admin') : false);
    }
} else {
    $return .= drawEmptyResult("No topics added yet.", 2);
}
Example #10
0
function bbGetTopics($where = false, $limit = false)
{
    return db_table('SELECT 
			t.id,
			t.title' . langExt() . ' topic,
			t.is_admin,
			t.thread_date last_post,
			t.replies,
			ISNULL(u.nickname, u.firstname) firstname,
			u.lastname
		FROM bb_topics t
		JOIN users u ON u.id = t.created_user' . getChannelsWhere('bb_topics', 't', 'topic_id') . $where . ' ORDER BY t.thread_date DESC', $limit);
}