2009-09-09 00:26:12 +00:00
|
|
|
<?
|
|
|
|
/*
|
|
|
|
This file is part of the 'Science Fair In A Box' project
|
|
|
|
SFIAB Website: http://www.sfiab.ca
|
|
|
|
|
|
|
|
Copyright (C) 2005 Sci-Tech Ontario Inc <info@scitechontario.org>
|
|
|
|
Copyright (C) 2005 James Grant <james@lightbox.org>
|
|
|
|
|
|
|
|
This program is free software; you can redistribute it and/or
|
|
|
|
modify it under the terms of the GNU General Public
|
|
|
|
License as published by the Free Software Foundation, version 2.
|
|
|
|
|
|
|
|
This program is distributed in the hope that it will be useful,
|
|
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
General Public License for more details.
|
|
|
|
|
|
|
|
You should have received a copy of the GNU General Public License
|
|
|
|
along with this program; see the file COPYING. If not, write to
|
|
|
|
the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
|
|
|
Boston, MA 02111-1307, USA.
|
|
|
|
*/
|
|
|
|
?>
|
|
|
|
<?
|
2009-09-11 06:01:01 +00:00
|
|
|
require_once('../common.inc.php');
|
|
|
|
require_once('../user.inc.php');
|
2009-09-09 00:26:12 +00:00
|
|
|
user_auth_required('committee', 'admin');
|
|
|
|
|
|
|
|
|
|
|
|
$tabs = array( 'fairinfo' => array(
|
|
|
|
'label' => 'Fair Information',
|
|
|
|
'types' => array('fair'),
|
|
|
|
'file' => '../fair_info.php',
|
|
|
|
'enabled' => true,),
|
2009-09-17 07:00:09 +00:00
|
|
|
'fairstats' => array(
|
|
|
|
'label' => 'Fair Stats Gathering',
|
|
|
|
'types' => array('fair'),
|
|
|
|
'file' => 'fair_stats_select.php',
|
|
|
|
'enabled' => true,),
|
2009-09-09 00:26:12 +00:00
|
|
|
'personal' => array(
|
|
|
|
'label' => 'Personal',
|
|
|
|
'types' => array('student','judge','committee','volunteer','sponsor','fair'),
|
|
|
|
'file' => '../user_personal.php',
|
|
|
|
'enabled' => true),
|
|
|
|
'roles' => array(
|
|
|
|
'label' => 'Roles/Account',
|
|
|
|
'types' => array('student','judge','committee','volunteer','sponsor','fair'),
|
|
|
|
'file' => '../user_activate.php',
|
|
|
|
'enabled' => true),
|
|
|
|
'judgeother' => array(
|
|
|
|
'label' => 'Judge Other',
|
|
|
|
'types' => array('judge'),
|
|
|
|
'file' => '../judge_other.php',
|
|
|
|
'enabled' => true),
|
|
|
|
'judgeexpertise' => array(
|
|
|
|
'label' => 'Expertise',
|
|
|
|
'types' => array('judge'),
|
|
|
|
'file' => '../judge_expertise.php',
|
|
|
|
'enabled' => true),
|
|
|
|
'judgeavailability' => array(
|
|
|
|
'label' => 'Time Avail.',
|
|
|
|
'types' => array('judge'),
|
|
|
|
'file' => '../judge_availability.php',
|
|
|
|
'enabled' => $config['judges_availability_enable'] == 'yes' ? true : false),
|
|
|
|
'judgesa' => array(
|
|
|
|
'label' => 'Special Awards',
|
|
|
|
'types' => array('judge'),
|
|
|
|
'file' => '../judge_special_awards.php',
|
|
|
|
'enabled' => true,),
|
|
|
|
'volunteerpos' => array(
|
|
|
|
'label' => 'Volunteer Positions',
|
|
|
|
'types' => array('volunteer'),
|
|
|
|
'file' => '../volunteer_position.php',
|
|
|
|
'enabled' => true,),
|
|
|
|
|
|
|
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
|
|
if(array_key_exists('username',$_GET)) {
|
|
|
|
$username = $_GET['username'];
|
|
|
|
$type = $_GET['type'];
|
|
|
|
$un = mysql_escape_string($username);
|
|
|
|
$q = mysql_query("SELECT id,MAX(year),deleted FROM users WHERE username='$un' GROUP BY uid");
|
|
|
|
echo mysql_error();
|
|
|
|
|
|
|
|
if(mysql_num_rows($q)) {
|
|
|
|
$r = mysql_fetch_object($q);
|
|
|
|
if($r->deleted == 'no') {
|
|
|
|
echo "Username already exists.";
|
|
|
|
exit;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
$u = user_create($type, $username);
|
|
|
|
$u['email'] = $username;
|
|
|
|
user_save($u);
|
|
|
|
$id = $u['id'];
|
|
|
|
} else {
|
|
|
|
$id = $_GET['id'];
|
|
|
|
}
|
|
|
|
|
|
|
|
$u = user_load($id);
|
|
|
|
|
|
|
|
$selected = $_GET['tab'];
|
|
|
|
if(!array_key_exists($selected, $tabs)) {
|
|
|
|
if(in_array('fair', $u['types']) )
|
|
|
|
$selected = 'fairinfo';
|
|
|
|
else
|
|
|
|
$selected = 'personal';
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2009-09-11 06:01:01 +00:00
|
|
|
if($_GET['sub'] == 1) {
|
|
|
|
$_SESSION['embed'] = true;
|
|
|
|
$_SESSION['embed_submit_url'] = "{$_SERVER['PHP_SELF']}?id=$id&tab=$selected";
|
|
|
|
$_SESSION['embed_edit_id'] = $id;
|
|
|
|
$t = $tabs[$selected];
|
|
|
|
include("{$t['file']}");
|
|
|
|
|
|
|
|
unset($_SESSION['embed']);
|
|
|
|
unset($_SESSION['embed_edit_id']);
|
|
|
|
unset($_SESSION['embed_submit_url']);
|
|
|
|
exit;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
2009-09-09 00:26:12 +00:00
|
|
|
send_popup_header(i18n("User Editor").": {$u['name']}");
|
|
|
|
|
2009-09-11 06:01:01 +00:00
|
|
|
?>
|
|
|
|
<script type="text/javascript">
|
|
|
|
|
|
|
|
$(document).ready(function() {
|
|
|
|
$("#tabs").tabs();
|
2009-10-29 17:05:15 +00:00
|
|
|
window.focus();
|
2009-09-11 06:01:01 +00:00
|
|
|
});
|
|
|
|
|
|
|
|
</script>
|
|
|
|
|
|
|
|
<?
|
|
|
|
|
|
|
|
/* Setup some things */
|
2009-09-09 00:26:12 +00:00
|
|
|
|
2009-09-11 06:01:01 +00:00
|
|
|
|
|
|
|
echo '<div id="tabs">';
|
|
|
|
echo '<ul>';
|
2009-09-09 00:26:12 +00:00
|
|
|
foreach($tabs as $k=>$t) {
|
|
|
|
/* Make sure the tab is enabled */
|
|
|
|
if($t['enabled'] == false) continue;
|
|
|
|
/* Make sure the user has the right type to see the tab */
|
|
|
|
$i = array_intersect($t['types'], $u['types']);
|
|
|
|
if(count($i) == 0) continue;
|
|
|
|
/* Show the tab */
|
2009-09-11 06:01:01 +00:00
|
|
|
$href = "{$_SERVER['PHP_SELF']}?id=$id&tab=$k&sub=1";
|
2009-09-11 06:03:00 +00:00
|
|
|
echo "<li><a href=\"$href\"><span>".i18n($t['label'])."</span></a></li>";
|
2009-09-09 00:26:12 +00:00
|
|
|
}
|
|
|
|
echo '</ul>';
|
|
|
|
|
|
|
|
|
|
|
|
$icon_path = $config['SFIABDIRECTORY']."/images/16/";
|
|
|
|
$icon_exitension = $config['icon_extension'];
|
|
|
|
|
|
|
|
|
|
|
|
send_popup_footer();
|
|
|
|
?>
|