- Add the basics for a science fair "user".

This commit is contained in:
dave 2009-04-12 03:13:09 +00:00
parent 38effb78ee
commit 6bd52d6ff2
7 changed files with 204 additions and 7 deletions

View File

@ -42,8 +42,12 @@
echo "<a href=\"volunteers.php\">".theme_icon("volunteer_management")."<br />".i18n("Volunteer Management")."</a>"; echo "<a href=\"volunteers.php\">".theme_icon("volunteer_management")."<br />".i18n("Volunteer Management")."</a>";
else else
echo theme_icon("volunteer_management")."<br />".i18n("Volunteer Management")."<br /><i>(".i18n("disabled").")</i>"; echo theme_icon("volunteer_management")."<br />".i18n("Volunteer Management")."<br /><i>(".i18n("disabled").")</i>";
echo "</td>"; echo '</td></tr><tr>';
echo " </tr>"; echo " <td><a href=\"sciencefairs.php\">".theme_icon("sciencefair_management")."<br />".i18n("Science Fair Management")."</a></td>";
echo '<td></td>';
echo '<td></td>';
echo '<td></td></tr>';
echo "</table>\n"; echo "</table>\n";
echo "<hr />"; echo "<hr />";
echo "<table class=\"adminconfigtable\">"; echo "<table class=\"adminconfigtable\">";

View File

@ -29,12 +29,12 @@
$tabs = array('personal' => array( $tabs = array('personal' => array(
'name' => 'Personal', 'name' => 'Personal',
'types' => array('student','judge','committee','volunteer','sponsor'), 'types' => array('student','judge','committee','volunteer','sponsor','fair'),
'file' => '../user_personal.php', 'file' => '../user_personal.php',
'enabled' => true), 'enabled' => true),
'roles' => array( 'roles' => array(
'name' => 'Roles/Account', 'name' => 'Roles/Account',
'types' => array('student','judge','committee','volunteer','sponsor'), 'types' => array('student','judge','committee','volunteer','sponsor','fair'),
'file' => '../user_activate.php', 'file' => '../user_activate.php',
'enabled' => true), 'enabled' => true),
'judgeother' => array( 'judgeother' => array(
@ -63,6 +63,12 @@ $tabs = array('personal' => array(
'file' => '../volunteer_position.php', 'file' => '../volunteer_position.php',
'enabled' => true,), 'enabled' => true,),
'fairinfo' => array(
'name' => 'Fair Information',
'types' => array('fair'),
'file' => '../fair_info.php',
'enabled' => true,),
); );
$selected = $_GET['tab']; $selected = $_GET['tab'];

View File

@ -1 +1 @@
124 125

6
db/db.update.125.sql Normal file
View File

@ -0,0 +1,6 @@
DROP TABLE `fairs`;
ALTER TABLE `users_fair` CHANGE `fairs_id` `fair_name` TINYTEXT NOT NULL;
ALTER TABLE `users_fair` ADD `fair_abbrv` VARCHAR( 16 ) NOT NULL AFTER `fair_name` ;

93
fair_info.php Normal file
View File

@ -0,0 +1,93 @@
<?
/*
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();
?>

87
fair_main.php Normal file
View File

@ -0,0 +1,87 @@
<?
/*
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("user_page.inc.php");
require_once("fair.inc.php");
user_auth_required('fair');
$u = user_load($_SESSION['users_id']);
/*
if($u['fair_active'] == 'no') {
message_push(notice(i18n("Your fair role is not active. If you would like to participate as a fair for the %1 %2 please click the '<b>Activate Role</b>' button in the Volunteer section below",array($config['FAIRYEAR'],$config['fairname']))));
header('Location: user_activate.php');
exit;
}
*/
send_header("Science Fair Main", array());
//only display the named greeting if we have their name
echo i18n("Hello <b>%1</b>",array($_SESSION['name']));
echo "<br />";
echo "<br />";
echo i18n("Please use the checklist below to complete your data. Click on an item in the table to edit that information. When you have entered all information, the <b>Status</b> field will change to <b>Complete</b>");
echo "<br />";
echo "<br />";
user_page_summary_begin();
user_page_summary_item("Contact Information",
"user_personal.php", "user_personal_info_status", array($u));
user_page_summary_item("Volunteer Positions",
"fair_info", "fair_status_info", array($u));
$overallstatus = user_page_summary_end(true);
/* Update fair_status */
fair_status_update($u);
echo "<br />";
echo "<br />";
/*
if($overallstatus!='complete')
{
echo error(i18n("You will not be marked as an active fair until your \"Overall Status\" is \"Complete\""));
}
else
{
echo happy(i18n("Thank you for completing the fair registration process. We look forward to seeing you at the fair"));
}
*/
echo "<br />";
echo i18n('Other Options and Things To Do').':<br />';
echo '<ul>';
echo '<li><a href="user_password.php">'.i18n('Change Password').'</a> - '.i18n('Change your password').'</li>';
echo '<li><a href="user_activate.php">'.i18n('Activate/Deactivate Roles').'</a> - '.
i18n('Activate/Deactiate/Remove/Delete roles or your entire account').
'</li>';
echo '<li>'.i18n('To logout, use the [Logout] link in the upper-right of the page').'</li>';
echo '</ul>';
send_footer();
?>

View File

@ -64,7 +64,8 @@ function user_load_fair(&$u)
{ {
$u['fair_active'] = ($u['fair_active'] == 'yes') ? 'yes' : 'no'; $u['fair_active'] = ($u['fair_active'] == 'yes') ? 'yes' : 'no';
$u['fair_complete'] = ($u['fair_complete'] == 'yes') ? 'yes' : 'no'; $u['fair_complete'] = ($u['fair_complete'] == 'yes') ? 'yes' : 'no';
$u['fairs_id'] = intval($u['fairs_id']); // $u['fair_name'] = $u['fair_name'];
// $u['fair_abbrv'] = $u['fair_abbrv'];
return true; return true;
} }
@ -309,7 +310,7 @@ function user_save_student($u)
function user_save_fair($u) function user_save_fair($u)
{ {
$fields = array('fair_active'); $fields = array('fair_active','fair_name','fair_abbrv');
user_save_type_list($u, 'users_fair', $fields); user_save_type_list($u, 'users_fair', $fields);
} }