Only show fair projects if a fair logs in and uses the reg list

This commit is contained in:
dave 2010-01-24 06:47:11 +00:00
parent ed6879754d
commit 8b3cd2a289

View File

@ -24,8 +24,10 @@
<? <?
require_once('../common.inc.php'); require_once('../common.inc.php');
require_once('../user.inc.php'); require_once('../user.inc.php');
user_auth_required('committee', 'admin');
require_once('../register_participants.inc.php'); $auth_type = user_auth_required(array('fair','committee'), 'admin');
//require_once('../register_participants.inc.php');
if($_GET['year']) $year=$_GET['year']; if($_GET['year']) $year=$_GET['year'];
else $year=$config['FAIRYEAR']; else $year=$config['FAIRYEAR'];
@ -60,12 +62,17 @@ case 'delete':
exit; exit;
} }
if($auth_type == 'committee') {
send_header("Registration Management", send_header("Registration Management",
array('Committee Main' => 'committee_main.php', array('Committee Main' => 'committee_main.php',
'Administration' => 'admin/index.php', 'Administration' => 'admin/index.php',
'Participant Registration' => 'admin/registration.php') 'Participant Registration' => 'admin/registration.php')
); );
} else {
send_header("Registration Management",
array('Fair Main' => 'fair_main.php') );
}
?> ?>
<div id="student_editor" title="Student/Project Editor" style="display: none"> <div id="student_editor" title="Student/Project Editor" style="display: none">
@ -86,6 +93,7 @@ case 'delete':
var registrations_id = 0; var registrations_id = 0;
var registrations_new = 0; var registrations_new = 0;
function popup_editor(id, open_tab) function popup_editor(id, open_tab)
{ {
var w = (document.documentElement.clientWidth * 0.9); var w = (document.documentElement.clientWidth * 0.9);
@ -284,7 +292,7 @@ $(document).ready(function() {
break; break;
} }
}, },
selected: 0 selected: -1
}); });
$("#newproject").click(function() { $("#newproject").click(function() {
@ -356,10 +364,16 @@ send_footer();
/* Now some helper fucntions we call more than once */ /* Now some helper fucntions we call more than once */
function list_query($year, $wherestatus, $sort, $reg_id) function list_query($year, $wherestatus, $sort, $reg_id)
{ {
global $auth_type;
$reg = '';
if($reg_id != false) if($reg_id != false)
$reg = "AND registrations.id='$reg_id'"; $reg = "AND registrations.id='$reg_id'";
else
$reg = ''; $fair = '';
if($auth_type == 'fair') {
$fairs_id = "AND projects.fairs_id='{$_SESSION['fairs_id']}'";
}
switch($sort) { switch($sort) {
case 'status': $ORDERBY="registrations.status DESC, projects.title"; break; case 'status': $ORDERBY="registrations.status DESC, projects.title"; break;
@ -386,7 +400,7 @@ function list_query($year, $wherestatus, $sort, $reg_id)
1 1
AND registrations.year='$year' AND registrations.year='$year'
$wherestatus $wherestatus
$reg $reg $fair
ORDER BY ORDER BY
$ORDERBY $ORDERBY
"); ");