mirror of
https://github.com/fspc/Yellow-Bike-Database.git
synced 2025-02-22 08:53:23 -05:00
Interests now populate the database as defined in the configurations.
1). Directions are in database_functions. 2). Initial population occurs on first submit. 3). Interests can be changed or deleted 4). It isn't a GUI interface, but it is useful for those without a MySQL understanding.
This commit is contained in:
parent
6bbf55a25e
commit
e33531303f
@ -67,27 +67,35 @@ $volunteer_interests = array(
|
||||
"Publicizing/Outreach", "Graphic Design", "Greeter at the Front Desk",
|
||||
"Accounting/Record Keeping", "Ordering parts/supplies", "Picking up Donated Bikes/Parts",
|
||||
"Teaching classes", "League Certified Instructor", "Pricing bikes",
|
||||
"Fabricating", "Open Source Programming", "Other/Contact me for general help",
|
||||
"Fabricating", "Open Source Programming", "Other/Contact me for general help"
|
||||
);
|
||||
|
||||
// Provide a comment box - true of false
|
||||
define("VOLUNTEER_INTEREST_COMMENTS", true);
|
||||
|
||||
// NOTE: The 2 variables ($volunteer_interest_changename & $volunteer_interests_deletename)
|
||||
// below allow you to change or delete an interest.
|
||||
// Only uncomment one variable at a time, and follow the directions.
|
||||
|
||||
// Change an interest(s) name:
|
||||
//
|
||||
// 1. Associate the name you want to change with a different name to the right as show below.
|
||||
// In this example "League Certified Instructor" will become "LCI".
|
||||
// 2. Visit contact_add_edit_select.php, reload the page and you are good to go
|
||||
// In this example "League Certified Instructor" will become "LCI".
|
||||
// 2. Change the interests name in $volunteer_interests above at the same time.
|
||||
// 3. Visit your own contact, e.g. contact_add_edit.php?contact_id=1 and click on the Submit button,
|
||||
// and the database will be updated.
|
||||
// 4. Comment out //$volunteer_interests_changename
|
||||
//
|
||||
//$volunteer_interests_changename = array("League Certified Instructor" => "LCI");
|
||||
// $volunteer_interests_changename = array("League Certified Instructor" => "LCI");
|
||||
|
||||
// Delete an interest(s) name.
|
||||
//
|
||||
// 1. Add the interest(s) you want to delete. Please understand
|
||||
// that by doing this you will delete the interest and all associated data.
|
||||
// 2. Remove the interest from $volunteer_interests at the same time before saving this page,
|
||||
// 2. Remove the interest from $volunteer_interests above at the same time before saving this page,
|
||||
// or it will be recreated.
|
||||
// 3. Visit contact_add_edit_select.php, reload the page and you are good to go
|
||||
// 3. Visit your own contact, e.g. contact_add_edit.php?contact_id=1 and click on the Submit button,
|
||||
// and the database will be updated.
|
||||
//
|
||||
//$volunteer_interests_deletename = array("LCI");
|
||||
|
||||
|
@ -15,6 +15,7 @@ if($_GET['shop_id']>0){
|
||||
$shop_id = current_shop_by_ip();
|
||||
}
|
||||
|
||||
|
||||
switch ($_GET['error']) {
|
||||
case 'new_error_message': //this is a sample error message. insert error case here
|
||||
$error_message = '';
|
||||
@ -27,6 +28,7 @@ default:
|
||||
|
||||
$page_shop_log = PAGE_SHOP_LOG . "?shop_id=$shop_id";
|
||||
|
||||
|
||||
if($_GET['contact_id'] == 'new_contact'){
|
||||
|
||||
|
||||
@ -84,6 +86,10 @@ if($_GET['contact_id'] == 'new_contact'){
|
||||
|
||||
$editFormAction = "?contact_id={$contact_id}&shop_id={$shop_id}";
|
||||
|
||||
require_once('php-console/src/PhpConsole/__autoload.php');
|
||||
$handler = PhpConsole\Handler::getInstance();
|
||||
$handler->start();
|
||||
|
||||
if ((isset($_POST["MM_insert"])) && ($_POST["MM_insert"] == "form1")) {
|
||||
|
||||
$updateSQL = sprintf("UPDATE contacts SET first_name=%s, middle_initial=%s, last_name=%s, email=%s,
|
||||
@ -105,7 +111,45 @@ if ((isset($_POST["MM_insert"])) && ($_POST["MM_insert"] == "form1")) {
|
||||
|
||||
mysql_select_db($database_YBDB, $YBDB);
|
||||
$Result1 = mysql_query($updateSQL, $YBDB) or die(mysql_error());
|
||||
|
||||
|
||||
// Are there any interests in the datatbase?
|
||||
$sql = "SELECT option_name FROM options;";
|
||||
$query = mysql_query($sql, $YBDB) or die(mysql_error());
|
||||
while ($result = mysql_fetch_assoc($query)) {
|
||||
$interests[] = $result["option_name"];
|
||||
}
|
||||
$interests = array_combine($interests,$interests);
|
||||
|
||||
if ($volunteer_interest_form && !isset($volunteer_interests_changename)) {
|
||||
|
||||
// populate database with user defined interests if they do not exist
|
||||
$volunteer_interest = array_combine($volunteer_interests,$volunteer_interests);
|
||||
|
||||
foreach ($volunteer_interest as $interest) {
|
||||
// Insert new interest
|
||||
if ( !$interests[$interest] ) {
|
||||
$query = "INSERT INTO options (id, option_name, option_value) VALUES (" .
|
||||
$_POST['contact_id'] . ",'" . $interest . "',0);";
|
||||
$result = mysql_query($query, $YBDB) or die(mysql_error());
|
||||
}
|
||||
}
|
||||
|
||||
} // end volunteer_interest_form populate and/or delete
|
||||
|
||||
// Change or delete an interest(s) name
|
||||
if( isset($volunteer_interests_changename) ) {
|
||||
foreach ($volunteer_interests_changename as $key => $interest) {
|
||||
$sql = "UPDATE options SET option_name='" . $interest .
|
||||
"' WHERE option_name='" . $interests[$key] . "';";
|
||||
$query = mysql_query($sql, $YBDB) or die(mysql_error());
|
||||
}
|
||||
} else if( isset($volunteer_interests_deletename) ) {
|
||||
foreach ($volunteer_interests_deletename as $interest) {
|
||||
$sql = "DELETE FROM options WHERE option_name='" . $interest . "';";
|
||||
$query = mysql_query($sql, $YBDB) or die(mysql_error());
|
||||
}
|
||||
}
|
||||
|
||||
if ($_POST['contact_id_entry'] == 'new_contact'){
|
||||
|
||||
//navigate back to shop that it came from
|
||||
@ -223,6 +267,7 @@ $totalRows_Recordset1 = mysql_num_rows($Recordset1);
|
||||
<?php
|
||||
$columns = 3;
|
||||
$c = 0;
|
||||
$rows = 0;
|
||||
$interest_count = count($volunteer_interests);
|
||||
while($rows < $interest_count + 3) {
|
||||
echo "<tr>";
|
||||
|
@ -13,7 +13,9 @@ require_once('Connections/database_functions.php');
|
||||
</ul>
|
||||
<ul>
|
||||
<li>Positive Spin is an all-volunteer non-profit organization
|
||||
<span class="yb_heading3red">entirely supported by volunteer time, part donations, and money donations</span>. </li>
|
||||
<span class="yb_heading3red">entirely supported by volunteer time, bike, part and tool donations,
|
||||
the purchase of reused bikes and parts, trade-ups, memberships
|
||||
and financial donations</span>. </li>
|
||||
</ul>
|
||||
<ul>
|
||||
<li><span class="yb_heading3red">We expect that you volunteer time back to the project</span>
|
||||
@ -21,7 +23,7 @@ require_once('Connections/database_functions.php');
|
||||
</ul>
|
||||
<ul>
|
||||
<li>If you are unable to contribute time to the project <span class="yb_heading3red">
|
||||
we suggest a $5 donation for personal use of the shop</span> in addition to any donations made for parts. </li>
|
||||
we suggest a $5 donation for personal use of the shop</span> in addition to any other donations. </li>
|
||||
</ul>
|
||||
<ul>
|
||||
<li><span class="yb_heading3red">Donations go towards</span>
|
||||
@ -49,10 +51,22 @@ require_once('Connections/database_functions.php');
|
||||
<a href="http://positivespin.org/home2/content/view/34/71/" target="_blank">About PS</a> |
|
||||
<a href="http://positivespin.org/home2/content/view/94/80/" target="_blank">Shop Schedule </a> |
|
||||
<a href="http://positivespin.org/home2/content/view/13/14/" target="_blank">Shop Services</a><span class="yb_heading3red"><br />
|
||||
Giving Back:</span> <a href="" target="_blank">Volunteering at YBP</a> |
|
||||
Giving Back:</span> <a href="" target="_blank">Volunteering at PS</a> |
|
||||
<a href="http://positivespin.org/home2/content/view/94/80/" target="_blank">Volunteer Shops</a> |
|
||||
<a href="http://positivespin.org/home2/content/view/92/79/" target="_blank">Projects</a> |
|
||||
<a href="" target="_blank">Earn-A-Bike</a> |
|
||||
<a href="" target="_blank">Donating Online</a><br />
|
||||
</p>
|
||||
<span class="yb_pagetitle">Repairs Policy</span>:<br />
|
||||
<blockquote style="height: 0px; width: 600px;">
|
||||
<p>We are all volunteers, and<strong> </strong>during shop hours open to repairs <strong>
|
||||
we will not repair your bike for you or schedule repairs</strong>,
|
||||
but rather we will help you do-it-yourself. At Positive Spin you can find work stations with tools,
|
||||
bicycle repair stands, repair manuals, reasonably priced bicycle parts, and volunteers with varying levels of
|
||||
experience in various areas of bicycle maintenance and repair. Volunteers may help you diagnose, repair and
|
||||
provide instruction about your bicycle. You may discover that at the Spin even highly experienced volunteers learn
|
||||
new skills from others! If you have a physical issue or handicap preventing you from physically
|
||||
repairing your bicycle, we still want you to be part of the process in whatever way you are able,
|
||||
and we will gladly help facilitate the repair of your bicycle. </p>
|
||||
</blockquote>
|
||||
<?php include("include_footer.html"); ?>
|
||||
|
Loading…
x
Reference in New Issue
Block a user