Esempio n. 1
0
function baselineHarvestData($baselineYear)
{
    $season = getSeasonByYear($baselineYear);
    echo "<h1>Remove hunts from report tables for this season.</h1>";
    flush();
    // Get all Hunt report data for this season
    $allHuntReports = getAllHuntReportsForASeason($baselineYear);
    if (isset($allHuntReports)) {
        // Remove all harvest counts for the hunts for this season.
        $numberOfHuntCountsRemoved = removeAllBaselineCounts($allHuntReports);
        echo $numberOfHuntCountsRemoved . " Hunt Counts Removed!<br>";
        // Remove all the hunts for this season.
        $numberOfHuntsRemoved = removeAllHuntReportsForASeason($season);
        echo $numberOfHuntsRemoved . " Hunts Removed!<br>";
    } else {
        echo "<br/><br/>No HuntReports for the Season.</p>";
    }
    echo "<h1>Process hunt versions for this season.</h1>";
    flush();
    $huntsForAYear = getSeasonHunts($season);
    echo count($huntsForAYear) . " Hunts with any hunt date within the season<br>";
    flush();
    // Find the final state of each hunt.
    $currentHuntDetailsList = getCurrentHuntDetailsList($huntsForAYear);
    echo count($currentHuntDetailsList) . " Hunts that are not deleted<br>";
    flush();
    $inSeasonHunts = 0;
    foreach ($currentHuntDetailsList as $oneHuntDetails) {
        if (withinSeason($oneHuntDetails, $season)) {
            $inSeasonHunts++;
            //echo("In Season Hunt Details");
            //print_r($oneHuntDetails);
            //echo("<br>");
            // Insert hunt report
            $newHuntReportId = saveNewHuntReportFromHuntDetails($baselineYear, $oneHuntDetails);
            $countList = getHarvetsListByHuntDetailsId($oneHuntDetails->getId());
            foreach ($countList as $oneCount) {
                saveNewHuntCountReport($newHuntReportId, $oneCount);
            }
        }
    }
    echo $inSeasonHunts . " Hunts that are not deleted and are in season<br>";
    flush();
}
Esempio n. 2
0
redirectIfNotInRole('dev', '../not-allowed.php');
?>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Hunter List</title>
<link href="hunt_harvest.css" rel="stylesheet" type="text/css" />
</head>
<body>

<?php 
$speciesList = getAllSpecies();
$currentUser = getCurrentUser();
$hunter = getHunter($currentUser);
$huntList = getHuntList($hunter);
$huntDetailsList = getCurrentHuntDetailsList($huntList);
?>

<table border='0'>
   <?php 
foreach ($huntDetailsList as $oneHuntDetails) {
    $detailsId = $oneHuntDetails->getId();
    ?>
   <tr>
      <td><?php 
    echo formatDate($oneHuntDetails->getHuntDate(), "m/d/Y");
    ?>
</td>
      <td><a href='edit_hunt.php?hunt_details_id=<?php 
    echo $detailsId;
    ?>