<?php
/*
 * The IEM homepage!
 */
require_once '../config/settings.inc.php';
define("IEM_APPID", 1);
require_once '../include/mlib.php';
force_https();
require_once '../include/myview.php';
require_once '../include/generators.php';
require_once '../include/iemprop.php';
require_once '../include/cameras.inc.php';

$t = new MyView();
$t->headextra = <<<EOM
<link rel="alternate" type="application/rss+xml"
  title="IEM News + Notes Feed"
  href="/rss.php" />
<link rel="stylesheet" href="index.css" />
EOM;
if (date("md") == "0911" || isset($_GET["911"])){
    $feature = <<<EOM
<h1 class="text-center">Remembering 9/11</h1>

<div class="row">
<div class="col-md-6">
<p class="lead">The fateful day of September 11th, 2001 is a distant memory for some, a
constant nightmare for others and an unexperienced event for most college age
students and younger.  May we all not forget the ultimate sacrifice many made
that day and the years that followed.</p>
</div>
<div class="col-md-6">
<img src="/images/911.jpg" class="img-fluid">
<br />&copy; Gordon Donovan/Yahoo News
</div>
</div>

EOM;
} else {
    $feature = gen_feature($t);
}
$iemperf = $get_website_stats();
$lsr_snow = get_iemprop("homepage.lsrmap.on");

$rancam = "";
$loop = 0;
while ($rancam == "" && $loop < 20)
{
    $cam = array_rand($cameras);
    $camfn = "/mesonet/ldmdata/camera/stills/{$cam}.jpg";
    if (is_file($camfn) && filemtime($camfn) > (time() - 1200))
    {
        $rancam = $cam;
    }
    $loop += 1;
}
if ($rancam == ""){ $rancam = "ISUC-006";}

$lsrsnow = "";
$nunce = time();
if ($lsr_snow == 'true'){
    $lsrsnow =  <<<EOM
<div class="card mb-3">
<div class="card-header">NWS Snowfall Reports:</div>
  <div class="card-body">
<a href="/data/lsr_snowfall.png">
<img src="/data/lsr_snowfall.png?{$nunce}" border="0" alt="LSR Snowfall" class="img-fluid"/></a>
  <a href="/lsr/?by=wfo&wfo=DMX,DVN,ARX,FSD,OAX&seconds=43200">View Snowfall Reports on Map</a>
  </div>
</div>
EOM;
}

$news = $get_recent_news();

$nounce = time();
$t->content = <<<EOM
      <div class="row">

        <div class="col-md-9">

 <p>The Iowa Environmental Mesonet (IEM) collects environmental data from
 cooperating members with observing networks. The data are stored and made
 available on this website.</p>


<div class="row">
<div class="col-12 col-md-4 mb-2">
<a href="/agweather/" class="btn btn-outline-secondary w-100 agweather">Ag Weather</a>
</div>
<div class="col-12 col-md-4 mb-2">
<a href="/nws/" class="btn btn-outline-secondary w-100 nws">NWS Users</a>
</div>
<div class="col-12 col-md-4 mb-2">
<a href="/archive/" class="btn btn-outline-secondary w-100 book">Researchers</a>
</div>
</div>

{$feature}
        </div><!--/col-md-9-->
        <div class="col-md-3">

{$lsrsnow}

<div class="card mb-3">
  <div class="card-header">{$cameras[$rancam]["name"]}, {$cameras[$rancam]["state"]} Webcam:</div>
  <div class="card-body">
<a href="/current/webcam.php#{$cameras[$rancam]["network"]}-0"><img src="/data/camera/stills/{$rancam}.jpg?{$nunce}" border="0" alt="Webcam" class="img-fluid"/></a>
<div class="mt-2">
<a href="/current/webcam.php#{$cameras[$rancam]["network"]}-0">View other webcams</a>
</div>
  </div>
</div>

<div class="card mb-3">
  <div class="card-header">Most Popular (<a href="/apps.php">List Apps</a>)</div>
  <div class="card-body">
<div class="list-group list-group-flush">
<a href="/plotting/auto/" class="list-group-item list-group-item-action">Automated Data Plotting</a>
<a href="/climodat/" class="list-group-item list-group-item-action">Climodat Reports</a>
<a href="/timemachine/?product=1" class="list-group-item list-group-item-action">Iowa Mesonet Plot</a>
<a href="/one/" class="list-group-item list-group-item-action">IEM One <small class="text-muted">(RADAR + Warnings)</small></a>
<a href="/rainfall/" class="list-group-item list-group-item-action">IEM GIS Rainfall</a>
<a href="/my/current.phtml" class="list-group-item list-group-item-action">Sortable Currents</a>
<a href="/onsite/features/tags/winter2526.html" class="list-group-item list-group-item-action">Winter Storms of 2025-2026</a>
</div>
    </div>
</div>

<div class="card mb-3">
  <div class="card-header">News Items &nbsp; <a href="/rss.php"><img src="/images/rss.gif" /></a></div>
  <div class="card-body">

{$news}

<p><i class="bi bi-envelope"></i>
<a href="https://groups.google.com/g/iem-dailyb">Sign up</a> for the
<a href="/data/iemdb.html">Daily Bulletin</a></p>

  </div>
</div>

{$iemperf}

        </div><!--/span-->
      </div><!--/row-->

<div class="row g-4 mt-4">
    <div class="col-md-4">
        <div class="text-center">
            <h3>Soil Temperatures</h3>
            <a href="/agclimate/soilt.php"><img src="/data/soilt_day1.png?{$nounce}" class="img-fluid rounded shadow-sm" /></a>
            <p class="mt-3">Data from the <a href="/agclimate">Iowa State Soil Moisture Network</a>
            is found on this website
            and daily soil temperature averages are used to produce the highlighted
            analysis.</p>
        </div>
    </div>
    <div class="col-md-4">
        <div class="text-center">
            <h3>Precipitation</h3>
            <a href="/timemachine/?product=45">
            <img src="/data/iowa_q2_1d.png?{$nounce}" class="img-fluid rounded shadow-sm" /></a>
            <p class="mt-3"><a href="/current/index.phtml/precipitation">More Precipitation Maps</a></p>
        </div>
    </div>
    <div class="col-md-4">
        <div class="text-center">
            <h3>Current Data</h3>
            <a href="/timemachine/?product=1"><img src="/data/mesonet.gif" class="img-fluid rounded shadow-sm" /></a>
            <p class="mt-3">The IEM combines data from participating networks into products
            like maps shown above and web applications to analyze the data.</p>
            <p><a href="/current/">More current products &raquo;</a></p>
        </div>
    </div>
</div><!--/row-->

EOM;

$t->render('full.phtml');
