Town Said "PAVE or VACATE"
We say: FUNDRAISE!
"; print $o; print $count . ' donations, with '. round($total,2) . ' € raised towards our goal of '.$goal.' €'; ?> diff --git a/lm_paypal_meter.info b/lm_paypal_meter.info new file mode 100644 index 0000000..d5dea76 --- /dev/null +++ b/lm_paypal_meter.info @@ -0,0 +1,5 @@ +name = "LM PayPal Meter" +description = "Provides PayPal campaign meter." +package = "LM PayPal" +core = 6.x +dependencies[] = lm_paypal diff --git a/lm_paypal_meter.install b/lm_paypal_meter.install new file mode 100644 index 0000000..51d2056 --- /dev/null +++ b/lm_paypal_meter.install @@ -0,0 +1,14 @@ + t('LM Paypal campaign meter'), + ); + return $blocks; + } + else if ($op == 'configure' && $delta == 0) { + $form['lm_paypal_meter_currency'] = array( + '#type' => 'select', + '#title' => t('Currency'), + '#default_value' => variable_get('lm_paypal_meter_currency', '$'), + '#options' => drupal_map_assoc(array('$', '€', '£')), + ); + $form['lm_paypal_meter_goal'] = array( + '#type' => 'textfield', + '#title' => t('Goal'), + '#default_value' => variable_get('lm_paypal_meter_goal', 0), + ); + $form['lm_paypal_meter_start_date'] = array( + '#type' => 'textfield', + '#title' => t('Campaign start date'), + '#default_value' => variable_get('lm_paypal_meter_start_date', time()), + ); + return $form; + } + else if ($op == 'save' && $delta == 0) { + variable_set('lm_paypal_meter_currency', $edit['lm_paypal_meter_currency']); + variable_set('lm_paypal_meter_goal', $edit['lm_paypal_meter_goal']); + variable_set('lm_paypal_meter_start_date', $edit['lm_paypal_meter_start_date']); + } + else if ($op == 'view') { + switch($delta) { + case 0: + $block = array( + 'subject' => t('Donation meter'), + 'content' => lm_paypal_meter_display() + ); + break; + } + return $block; + } +} + +function lm_paypal_meter_display() { + // your total fundraising goal + $goal = variable_get('lm_paypal_meter_goal', 0); + // since when day the fund raising starts + $start_date = variable_get('lm_paypal_meter_start_date', time()); + + $result = db_query('SELECT d.uid, d.datepaid, d.mc_gross, d.mc_fee, d.mc_currency FROM {lm_paypal_donations} d WHERE datepaid > %d', $start_date); + + $total = $count = 0; + + while ($donation = db_fetch_object($result)) { + $total += $donation->mc_gross - $donation->mc_fee; + $count++; + } + + return theme('lm_paypal_meter_display', $goal, $total, $count); +} + +function theme_lm_paypal_meter_display($goal, $total, $count) { + $output = ''; + + if (!empty($goal) && $goal != 0) { + $progress_pct = 100 * $total/$goal; + } + + $output .= t('!donations received, !amount raised.', + array('!donations' => format_plural($count, '@count donation', '@count donations'), + '!amount' => theme('lm_paypal_meter_currency', round($total,2)))); + + if (isset($progress_pct)) { + $output .= t(' Our goal is !goal', array('!goal' => theme('lm_paypal_meter_currency', $goal))); + $o = "
"; + } + + $output .= $o; + + return $output; +} + +function theme_lm_paypal_meter_currency($value) { + return variable_get('lm_paypal_meter_currency', '$') . sprintf("%0.2f", $value); +} + +function lm_paypal_meter_theme($existing, $type, $theme, $path) { + return array( + 'lm_paypal_meter_currency' => array( + 'arguments' => array('value' => 0), + ), + 'lm_paypal_meter_display' => array( + 'arguments' => array('goal' => 0, 'total' => 0, 'count' => 0), + ), + ); +}
Help Us Raise
$25,000 in 45 days and Get Great Stuff! You could Win an All Expense Paid Trip for Two to France! Seriously! What's a Destination Market?!
![]() From Grass fed Beef to local honey, cheeses and wines, jewelry and crafts ... even a few artists ... We are your One-stop Destination Experience. No gimmicks - just the VERY best the Valley has to offer. Open-Air Market will run from May through October, Wednesdays, 2 PM to 6 PM and Saturdays, 8 AM to 1 PM. Inside Market coming Soon.
| Follow Us
towards our goal!
Be sure to "like" us on Facebook, and follow closely. Daily posts, and all the latest announcements.
www.facebook.com/mjfarmersmarket |
Currently booking local music talent for Saturdays between 11 AM and 1 PM!!! Do you have a bluegrass, "NewGrass, Country, etc. We'll do everything we can to promote your group, and give you a unique setting to play and sell your CD's. Contact us!
|
We Proudly Support the Following
Local Businesses & Organizations: |