Here is the code to show all new reservation in the control panel as opposed to only showing reservations for the current user. Thanks to Nick for the help hacking this one out.
Taken from DBEngine.class.php
function get_user_reservations($id, $order, $vert, $include_participating = false) {
$return = array();
// Clean out the duplicated order so that MSSQL is OK
$orders = trim(preg_replace("/(res|rs).$order,?/", '', 'res.start_date, rs.name, res.starttime'));
if (strrpos($orders, ',') == strlen($orders)-1) {
$orders = substr($orders, 0, strlen($orders)-1);
}
$query = 'SELECT res.*, resusers.*, rs.name, rs.location, rs.rphone FROM '
. $this->get_table('reservations') . ' as res INNER JOIN '
. $this->get_table('resources') . ' as rs ON rs.machid=res.machid INNER JOIN '
. $this->get_table('reservation_users') . ' as resusers ON resusers.resid=res.resid'
. ' WHERE (res.start_date>=? OR (res.start_date<=? AND res.end_date>=?))'
. ' AND res.is_blackout <> 1'
. " ORDER BY $order $vert, res.start_date, rs.name, res.starttime";
$values = array(mktime(0,0,0), mktime(0,0,0), mktime(0,0,0));
// Prepare query
$q = $this->db->prepare($query);
// Execute query
$result = $this->db->execute($q, $values);
// Check if error
$this->check_for_error($result);
if ($result->numRows() <= 0) {
$this->err_msg = translate('You do not have any reservations scheduled.');
return false;
}
while ($rs = $result->fetchRow()) {
$return[] = $this->cleanRow($rs);
}
$result->free();
return $return;
}