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