Plugin Directory

Changeset 759708


Ignore:
Timestamp:
08/21/2013 02:48:54 AM (13 years ago)
Author:
wingdspur
Message:

v0.3: added soybean and sunflower harvest loss calcs

Location:
farm-calculators/trunk
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • farm-calculators/trunk/farm-calculators.php

    r759516 r759708  
    77Description: Add farm calculators to your website to help users determine various farming and crop related information.
    88
    9 Version: 0.2
     9Version: 0.3
    1010Author: Bryce Johnston
    1111Author URI: http://www.wingdspur.com
     
    2828*******************************************************************************************/
    2929
    30 $fc_version = '0.2';
     30$fc_version = '0.3';
    3131$fc_dirname = plugin_basename(dirname(__FILE__));
    3232
     
    228228  <label for="kernals_area">Area Kernals were Counted (ft<sup>2</sup>):</label>
    229229  <input name="kernals_area" id="kernals_area" type="number" step="any" class="input-medium" /><br />
    230   <button type="submit" class="btn" name="ccalculateSorghumHarvestYieldLoss" id="calculateSorghumHarvestYieldLoss">Calculate</button>
     230  <button type="submit" class="btn" name="calculateSorghumHarvestYieldLoss" id="calculateSorghumHarvestYieldLoss">Calculate</button>
     231</fieldset>';
     232$code .= '<br />
     233  <label>Estimated Yield Loss (bu/ac):</label>
     234  <input name="yield_loss" type="text" class="input-medium" readonly="readonly" />
     235</form>';
     236$code .= '
     237</div>';
     238
     239   return $code;
     240}
     241
     242function farming_calc_soybean_harvest_yield_loss_shortcode() {
     243   extract( shortcode_atts( array(
     244      'class' => 'farmCalculator',
     245      ), $atts ) );
     246
     247$class = esc_attr($class);
     248
     249$code = '<div class="'.$class.'">
     250<form>
     251<div class="errors"></div>';
     252$code .='
     253  <h4>Soybean Harvest Loss</h4>
     254  <p><i>Also recommended to check standing crop for pre-harvest losses.</i></p>
     255  <p>
     256    <label for="beans_count">Beans Counted on Ground:</label><br />
     257    <input name="beans_count" id="beans_count" type="number" step="any" class="input-medium" />
     258  </p>
     259  <p>
     260    <label for="beans_area">Area Beans were Counted (ft<sup>2</sup>):</label><br />
     261    <input name="beans_area" id="beans_area" type="number" step="any" class="input-medium" />
     262  </p>
     263  <p>
     264    <button type="submit" class="btn" name="calculateSoybeanHarvestYieldLoss" id="calculateSoybeanHarvestYieldLoss">Calculate</button>
     265  </p>
     266  <p>
     267    <label>Estimated Yield Loss (bu/ac):</label><br />
     268    <input name="yield_loss" type="text" class="input-medium" readonly="readonly" />
     269  </p>
     270</form>';
     271$code .= '
     272</div>';
     273
     274   return $code;
     275}
     276
     277function farming_calc_soybean_harvest_yield_loss_bs_shortcode() {
     278   extract( shortcode_atts( array(
     279      'class' => 'farmCalculator',
     280      ), $atts ) );
     281
     282$class = esc_attr($class);
     283
     284$code = '<div class="'.$class.'">
     285<form>
     286<div class="errors"></div>';
     287$code .='<fieldset>
     288<legend>Soybean Harvest Loss</legend>';
     289$code .='
     290  <label for="beans_count">Beans Counted on Ground:</label>
     291  <input name="beans_count" id="beans_count" type="number" step="any" class="input-medium" />
     292  <label for="beans_area">Area Beans were Counted (ft<sup>2</sup>):</label>
     293  <input name="beans_area" id="beans_area" type="number" step="any" class="input-medium" /><br />
     294  <button type="submit" class="btn" name="calculateSoybeanHarvestYieldLoss" id="calculateSoybeanHarvestYieldLoss">Calculate</button>
     295</fieldset>';
     296$code .= '<br />
     297  <label>Estimated Yield Loss (bu/ac):</label>
     298  <input name="yield_loss" type="text" class="input-medium" readonly="readonly" />
     299</form>';
     300$code .= '
     301</div>';
     302
     303   return $code;
     304}
     305
     306function farming_calc_sunflower_harvest_yield_loss_shortcode() {
     307   extract( shortcode_atts( array(
     308      'class' => 'farmCalculator',
     309      ), $atts ) );
     310
     311$class = esc_attr($class);
     312
     313$code = '<div class="'.$class.'">
     314<form>
     315<div class="errors"></div>';
     316$code .='
     317  <h4>Sunflower Harvest Loss</h4>
     318  <p><i>Also recommended to check standing crop for pre-harvest losses.</i></p>
     319  <p>
     320    <label for="seeds_count">Seeds Counted on Ground:</label><br />
     321    <input name="seeds_count" id="seeds_count" type="number" step="any" class="input-medium" />
     322  </p>
     323  <p>
     324    <label for="seeds_area">Area Seeds were Counted (ft<sup>2</sup>):</label><br />
     325    <input name="seeds_area" id="seeds_area" type="number" step="any" class="input-medium" />
     326  </p>
     327  <p>
     328    <button type="submit" class="btn" name="calculateSunflowerHarvestYieldLoss" id="calculateSunflowerHarvestYieldLoss">Calculate</button>
     329  </p>
     330  <p>
     331    <label>Estimated Yield Loss (bu/ac):</label><br />
     332    <input name="yield_loss" type="text" class="input-medium" readonly="readonly" />
     333  </p>
     334</form>';
     335$code .= '
     336</div>';
     337
     338   return $code;
     339}
     340
     341function farming_calc_sunflower_harvest_yield_loss_bs_shortcode() {
     342   extract( shortcode_atts( array(
     343      'class' => 'farmCalculator',
     344      ), $atts ) );
     345
     346$class = esc_attr($class);
     347
     348$code = '<div class="'.$class.'">
     349<form>
     350<div class="errors"></div>';
     351$code .='<fieldset>
     352<legend>Sunflower Harvest Loss</legend>';
     353$code .='
     354  <label for="seeds_count">Seeds Counted on Ground:</label>
     355  <input name="seeds_count" id="beans_count" type="number" step="any" class="input-medium" />
     356  <label for="seeds_area">Area Seeds were Counted (ft<sup>2</sup>):</label>
     357  <input name="seeds_area" id="seeds_area" type="number" step="any" class="input-medium" /><br />
     358  <button type="submit" class="btn" name="calculateSunflowerHarvestYieldLoss" id="calculateSunflowerHarvestYieldLoss">Calculate</button>
    231359</fieldset>';
    232360$code .= '<br />
     
    246374add_shortcode('farming_calc_sorghum_harvest_yield_loss', 'farming_calc_sorghum_harvest_yield_loss_shortcode');
    247375add_shortcode('farming_calc_sorghum_harvest_yield_loss_bs', 'farming_calc_sorghum_harvest_yield_loss_bs_shortcode');
     376add_shortcode('farming_calc_soybean_harvest_yield_loss', 'farming_calc_soybean_harvest_yield_loss_shortcode');
     377add_shortcode('farming_calc_soybean_harvest_yield_loss_bs', 'farming_calc_soybean_harvest_yield_loss_bs_shortcode');
     378add_shortcode('farming_calc_sunflower_harvest_yield_loss', 'farming_calc_sunflower_harvest_yield_loss_shortcode');
     379add_shortcode('farming_calc_sunflower_harvest_yield_loss_bs', 'farming_calc_sunflower_harvest_yield_loss_bs_shortcode');
    248380
    249381?>
  • farm-calculators/trunk/js/calculators.js

    r759516 r759708  
    1313  $("#calculateSorghumHarvestYieldLoss").bind('click submit', function() {
    1414    calculateSorghumHarvestYieldLoss(this.form);
     15    return false;
     16  });
     17
     18  $("#calculateSoybeanHarvestYieldLoss").bind('click submit', function() {
     19    calculateSoybeanHarvestYieldLoss(this.form);
     20    return false;
     21  });
     22
     23  $("#calculateSunflowerHarvestYieldLoss").bind('click submit', function() {
     24    calculateSunflowerHarvestYieldLoss(this.form);
    1525    return false;
    1626  });
     
    4555      return false;
    4656    }
    47    
    4857    var stand_count = form.stand_count.value;
    4958    var row_length = form.row_length.value;
    5059    var row_spacing = form.row_spacing.value;
    5160    var acre_sq_feet = 43560;
    52 
    5361    var population = 0;
    5462    population = stand_count/(row_spacing/12*row_length/acre_sq_feet);
    55    
    5663    form.crop_population.value = roundHundred(population);
    5764  }
     
    6370      return false;
    6471    }
    65    
    6672    var stand_count = form.stand_count.value;
    6773    var hoop_size = form.hoop_size.value;
     
    6975    var pi = 3.14159265358979;
    7076    var base_pow = (hoop_size/12)/2;
    71 
    7277    var population = 0;
    7378    population = stand_count/(3.14159265358979*(Math.pow(base_pow,2))/acre_sq_feet);
    74 
    7579    form.crop_population.value = roundHundred(population);
    7680  }
     
    8286      return false;
    8387    }
    84    
    8588    var kernals_count = form.kernals_count.value;
    8689    var kernals_area = form.kernals_area.value;
    87 
    8890    var yield_loss = 0;
    8991    yield_loss = kernals_count/kernals_area/18.5;
     92    form.yield_loss.value = roundTenth(yield_loss);
     93  }
    9094
     95  function calculateSoybeanHarvestYieldLoss(form) {
     96    if (!isValid(form.beans_count, 0, 1000)) { 
     97      return false;
     98    } else if (!isValid(form.beans_area, 0, 1000)) { 
     99      return false;
     100    }
     101    var beans_count = form.beans_count.value;
     102    var beans_area = form.beans_area.value;
     103    var yield_loss = 0;
     104    yield_loss = beans_count/beans_area/4;
    91105    form.yield_loss.value = roundTenth(yield_loss);
     106  }
    92107
     108  function calculateSunflowerHarvestYieldLoss(form) {
     109    if (!isValid(form.seeds_count, 0, 1000)) { 
     110      return false;
     111    } else if (!isValid(form.seeds_area, 0, 1000)) { 
     112      return false;
     113    }
     114    var seeds_count = form.seeds_count.value;
     115    var seeds_area = form.seeds_area.value;
     116    var yield_loss = 0;
     117    yield_loss = seeds_count/seeds_area/10*100;
     118    form.yield_loss.value = roundTenth(yield_loss);
    93119  }
    94120 
  • farm-calculators/trunk/readme.md

    r759516 r759708  
    22
    33Contributors: wingdspur 
    4 Requires at least: 3.5 
     4Requires at least: 3.0 
    55Tested up to: 3.6 
    6 Stable tag: 0.2 
     6Stable tag: 0.3 
    77Tags: farm, crop, farming, calculator, yield, population, agriculture 
    88License: GPLv3 or later 
     
    1818You can use following shortcodes if activated:
    1919
    20     [farming_calc_crop_population]
     20### Crop Population 
     21    [farming_calc_crop_population] 
     22    [farming_calc_crop_population_bs] (for bootstrap themes) 
    2123Shows a calculator for determing crop population based on stand count, row length, and row spacing. 
    2224
    23     [farming_calc_crop_population_bs]
    24 Same as above but styled for bootstrap themes. 
    25 
    26     [farming_calc_crop_population_hoop]
     25### Crop Population (Hoop Method) 
     26    [farming_calc_crop_population_hoop] 
     27    [farming_calc_crop_population_hoop_bs] (for bootstrap themes) 
    2728Shows a calculator for determing crop population based on stand count and hoop size. 
    2829
    29     [farming_calc_crop_population_hoop_bs]
    30 Same as above but styled for bootstrap themes. 
    31 
     30### Grain Sorghum Harvest Yield Loss 
    3231    [farming_calc_sorghum_harvest_yield_loss]
     32    [farming_calc_sorghum_harvest_yield_loss_bs] (for bootstrap themes) 
    3333Shows a calculator for determing grain sorghum harvest yield loss based on kernels counted on ground and the size of the area they were counted in. 
    3434
    35     [farming_calc_sorghum_harvest_yield_loss_bs]
    36 Same as above but styled for bootstrap themes. 
     35### Soybean Harvest Yield Loss 
     36    [farming_calc_soybean_harvest_yield_loss]
     37    [farming_calc_soybean_harvest_yield_loss_bs] (for bootstrap themes) 
     38Shows a calculator for determing soybean harvest yield loss based on beans counted on ground and the size of the area they were counted in. 
     39
     40### Sunflower Harvest Yield Loss 
     41    [farming_calc_sunflower_harvest_yield_loss]
     42    [farming_calc_sunflower_harvest_yield_loss_bs] (for bootstrap themes) 
     43Shows a calculator for determing sunflower harvest yield loss based on seeds counted on ground and the size of the area they were counted in. 
    3744
    3845More shortcodes will follow soon.
     
    5461## Changelog 
    5562
     63### 0.3 
     64* Added soybean harvest yield loss calculator. 
     65* Added sunflower harvest yield loss calculator. 
     66
    5667### 0.2 
    5768* Added grain sorghum harvest yield loss calculator.   
  • farm-calculators/trunk/readme.txt

    r759516 r759708  
    22
    33Contributors: wingdspur 
    4 Requires at least: 3.5 
     4Requires at least: 3.0 
    55Tested up to: 3.6 
    6 Stable tag: 0.2 
     6Stable tag: 0.3 
    77Tags: farm, crop, farming, calculator, yield, population, agriculture 
    88License: GPLv3 or later 
     
    1818You can use following shortcodes if activated:
    1919
    20     [farming_calc_crop_population]
     20= Crop Population =
     21    [farming_calc_crop_population] 
     22    [farming_calc_crop_population_bs] (for bootstrap themes)
    2123Shows a calculator for determing crop population based on stand count, row length, and row spacing. 
    2224
    23     [farming_calc_crop_population_bs]
    24 Same as above but styled for bootstrap themes. 
    25 
    26     [farming_calc_crop_population_hoop]
     25= Crop Population (Hoop Method) =
     26    [farming_calc_crop_population_hoop] 
     27    [farming_calc_crop_population_hoop_bs] (for bootstrap themes)
    2728Shows a calculator for determing crop population based on stand count and hoop size. 
    2829
    29     [farming_calc_crop_population_hoop_bs]
    30 Same as above but styled for bootstrap themes. 
    31 
     30= Grain Sorghum Harvest Yield Loss =
    3231    [farming_calc_sorghum_harvest_yield_loss]
     32    [farming_calc_sorghum_harvest_yield_loss_bs] (for bootstrap themes)
    3333Shows a calculator for determing grain sorghum harvest yield loss based on kernels counted on ground and the size of the area they were counted in. 
    3434
    35     [farming_calc_sorghum_harvest_yield_loss_bs]
    36 Same as above but styled for bootstrap themes. 
     35= Soybean Harvest Yield Loss =
     36    [farming_calc_soybean_harvest_yield_loss]
     37    [farming_calc_soybean_harvest_yield_loss_bs] (for bootstrap themes) 
     38Shows a calculator for determing soybean harvest yield loss based on beans counted on ground and the size of the area they were counted in. 
     39
     40= Sunflower Harvest Yield Loss =
     41    [farming_calc_sunflower_harvest_yield_loss]
     42    [farming_calc_sunflower_harvest_yield_loss_bs] (for bootstrap themes) 
     43Shows a calculator for determing sunflower harvest yield loss based on seeds counted on ground and the size of the area they were counted in.
    3744
    3845More shortcodes will follow soon.
     
    5461== Changelog == 
    5562
     63= 0.3 = 
     64* Added soybean harvest yield loss calculator. 
     65* Added sunflower harvest yield loss calculator. 
     66
    5667= 0.2 = 
    5768* Added grain sorghum harvest yield loss calculator.   
Note: See TracChangeset for help on using the changeset viewer.