science-ation/fair_info.php

94 lines
2.7 KiB
PHP

<?
/*
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>
Copyright (C) 2007 David Grant <dave@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.
*/
?>
<?
require_once("common.inc.php");
require_once("user.inc.php");
require_once("fair.inc.php");
if($_SESSION['embed'] == true) {
$u = user_load($_SESSION['embed_edit_id']);
} else {
user_auth_required('fair');
$u = user_load($_SESSION['users_id']);
}
if($_POST['action']=="save")
{
$fair_name = $_POST['fair_name'];
$fair_abbrv = $_POST['fair_abbrv'];
$u['fair_name'] = $fair_name;
$u['fair_abbrv'] = $fair_abbrv;
user_save($u);
message_push(notice(i18n("Fair Informaiton successfully updated")));
}
/* update overall status */
fair_status_update($u);
if($_SESSION['embed'] != true) {
//output the current status
$newstatus=fair_status_info($u);
if($newstatus!='complete')
message_push(error(i18n("Fair Information Incomplete")));
else
message_push(happy(i18n("Fair Information Complete")));
}
if($_SESSION['embed'] == true) {
echo "<br />";
display_messages();
echo "<h3>".i18n('Fair Information')."</h3>";
echo "<br />";
} else {
//send the header
send_header("Fair Information",
array("Science Fair Main" => "fair_main.php")
);
}
$s = ($_SESSION['embed'] == true) ? $_SESSION['embed_submit_url'] : 'fair_info.php';
echo "<form name=\"personalform\" method=\"post\" action=\"$s\">\n";
echo "<input type=\"hidden\" name=\"action\" value=\"save\" />\n";
echo "<table>\n";
echo '<tr><td>'.i18n('Fair Name').'</td><td>';
echo "<input type=\"text\" name=\"fair_name\" value=\"{$u['fair_name']}\" size=\"40\" />";
echo '<tr><td>'.i18n('Fair Abbreviation').'</td><td>';
echo "<input type=\"text\" name=\"fair_abbrv\" value=\"{$u['fair_abbrv']}\" size=\"7\" />";
echo '</td><td>';
echo "</table>";
echo "<br />";
echo "<input type=\"submit\" value=\"".i18n("Save Fair Information")."\" />\n";
echo "</form>";
echo "<br />";
if($_SESSION['embed'] != true) send_footer();
?>