/** * @param $prefix * @param string $default * @return string */ function draw_date_picker($prefix, $default = '') { if (empty($default)) { $default = api_get_local_time(); } $parts = explode(' ', $default); list($d_year, $d_month, $d_day) = explode('-', $parts[0]); list($d_hour, $d_minute) = explode(':', $parts[1]); $minute = range(10, 59); array_unshift($minute, '00', '01', '02', '03', '04', '05', '06', '07', '08', '09'); $date_form = make_select($prefix.'_day', array_combine(range(1, 31), range(1, 31)), $d_day); $date_form .= make_select($prefix.'_month', array_combine(range(1, 12), api_get_months_long()), $d_month); $date_form .= make_select($prefix.'_year', array($d_year => $d_year, $d_year + 1 => $d_year + 1), $d_year).' '; $date_form .= make_select($prefix.'_hour', array_combine(range(0, 23), range(0, 23)), $d_hour).' : '; $date_form .= make_select($prefix.'_minute', $minute, $d_minute); return $date_form; }
<script type="text/javascript"> \$(document).ready(function(){ \tsdate = \$("#sdate").datepicker({altFormat:"yymmdd"}); \tsdate.datepicker('setDate', "{$sdatestr}"); \tedate = \$("#edate").datepicker({altFormat:"yymmdd"});\t \tedate.datepicker('setDate', "{$edatestr}"); \t//Make into more PHP friendly \t\$('#addmapstations').on('click', function(){ \t\t\$('#stations_out').attr('name', 's[]'); \t}); }); </script> EOF; $states = array('IACLIMATE' => 'Iowa', 'ILCLIMATE' => 'Illinois', 'KSCLIMATE' => 'Kansas', 'KYCLIMATE' => 'Kentucky', 'MICLIMATE' => 'Michigan', 'MNCLIMATE' => 'Minnesota', 'MOCLIMATE' => 'Missouri', 'NECLIMATE' => 'Nebraska', 'NDCLIMATE' => 'North Dakota', 'OHCLIMATE' => 'Ohio', 'SDCLIMATE' => 'South Dakota', 'WICLIMATE' => 'Wisconsin'); $sselect = make_select('network', $network, $states); $snice = date("d M Y", $sdate); $today = $edate > time() ? time() : $edate; $enice = date("d M Y", $today); $t->content = <<<EOF <ol class="breadcrumb"> <li><a href="/climodat/">Climodat Reports</a></li> <li class="active">IEM Climodat Station Monitor</li> </ol> <p>The purpose of this page is to provide a one-stop view of summarized IEM Climodat data for a period of your choice. Once you have configured your favorite sites, <strong>please bookmark the page</strong>. There are options presented on this page on how to compute Growing Degree Days. Here is a description of the three options.</p>
$projs = array("KCC" => "init=epsg:26915", "DMX" => "init=epsg:4326", "FSD" => "init=epsg:4326", "ARX" => "init=epsg:4326", "OAX" => "init=epsg:4326", "ABR" => "init=epsg:4326", "DVN" => "init=epsg:4326", "EAX" => "init=epsg:4326", "MPX" => "init=epsg:4326", "UDX" => "init=epsg:4326"); $extents = array("KCCI" => array(176500, 4450000, 710900, 4850000), "KCCIA" => array(276500, 4650000, 610900, 4850000), "KCCIB" => array(276500, 4550000, 610900, 4750000), "KCCIC" => array(276500, 4450000, 610900, 4650000), "DMX" => array(-96.72, 38.72, -90.72, 44.72), "DMXA" => array(-95.0, 41.0, -92.0, 44.0), "DMXB" => array(-95.0, 40.5, -92.0, 43), "DMXC" => array(-95.0, 40, -92.0, 42.5), "ARX" => array(-94.18000000000001, 40.82, -88.18000000000001, 46.82), "DVN" => array(-93.56999999999999, 38.6, -87.56999999999999, 44.6), "OAX" => array(-99.37, 38.32, -93.37, 44.32), "EAX" => array(-97.25, 35.8, -91.25, 41.8), "MPX" => array(-96.55, 41.83, -90.55, 47.83), "FSD" => array(-99.72, 40.58, -93.72, 46.58), "ABR" => array(-101.4, 42.45, -95.40000000000001, 48.45), "UDX" => array(-105.82, 41.12, -99.81999999999999, 47.12)); $wfos = array("DMX" => "Des Moines", "DVN" => "Davenport", "ARX" => "LaCrosse", "MPX" => "Minneapolis", "FSD" => "Sioux Falls", "OAX" => "Omaha", "EAX" => "Pleasant Hill", "ABR" => "Aberdeen", "UDX" => "Rapid City"); $pgconn = iemdb("access"); $rad = isset($_GET['rad']) ? $_GET['rad'] : 'DMX'; $tv = isset($_GET['rad']) ? strtoupper(substr($_GET['tv'], 0, 4)) : 'KCCI'; $station = isset($_GET['station']) ? $_GET['station'] : ''; $sortcol = isset($_GET['sortcol']) ? $_GET['sortcol'] : 'p15m'; $rs = pg_prepare($pgconn, "SELECT", "SELECT * from events WHERE network = \$1\n\tand valid > (now() - '15 minutes'::interval)"); $t->refresh = "<meta http-equiv=\"refresh\" content=\"60\">"; $t->title = "SchoolNet - Where's it raining?"; $t->thispage = "networks-schoolnet"; $ar = array("KCCI" => "KCCI-TV Des Moines", "KELO" => "KELO-TV Sioux Falls", "KIMT" => "KIMT-TV Mason City"); $tvselect = make_select("tv", $tv, $ar); $ar = array("ABR" => "[ABR] Aberdeen, SD", "ARX" => "[ARX] LaCrosse, WI", "DMX" => "[DMX] Des Moines, IA", "DMXA" => "[DMX] Des Moines, IA (North)", "DMXB" => "[DMX] Des Moines, IA (Central)", "DMXC" => "[DMX] Des Moines, IA (South)", "DVN" => "[DVN] Davenport, IA", "EAX" => "[EAX] Pleasant Hill, MO", "FSD" => "[FSD] Sioux Falls, SD", "MPX" => "[MPX] Minneapolis, MN", "OAX" => "[OAX] Omaha, NE", "UDX" => "[UDX] Rapid City, SD"); $radselect = make_select("rad", $rad, $ar); $nt = new NetworkTable($tv); $stbl = $nt->table; $iemdb = new IEMAccess(); $iemdata = $iemdb->getNetwork($tv); $data = array(); while (list($key, $iemob) = each($iemdata)) { $data[$key] = $iemob->db; $data[$key]["p15m"] = 0; } $rs = pg_execute($pgconn, "SELECT", array($tv)); for ($i = 0; $row = @pg_fetch_array($rs, $i); $i++) { $data[$row["station"]]["p15m"] = $row["magnitude"]; } function mktitle($map, $imgObj, $titlet) {
$table .= "</td>"; $table .= "<td>" . $parts["drct"] . "</td>\n\t <td>" . round($parts["peak"], 0) . " @ " . strftime("%I:%M %p", $parts["peak_ts"]) . "</td>\n <td>" . $parts["phour"] . "</td>\n <td>" . $parts["pday"] . "</td>\n\t </tr>\n"; if ($metar == "yes") { $table .= "<tr"; if ($i % 2 == 0) { $table .= " bgcolor='#eeeeee'"; } $table .= ">"; $table .= "<td colspan=14 align=\"CENTER\">\n <font color=\"brown\">" . $parts["raw"] . "</font></td>\n </tr>\n"; } } $uri = "obs.php?wfo={$wfo}&metar={$metar}&sorder={$sorder}&sortcol="; $ar = array("no" => "No", "yes" => "Yes"); $mselect = make_select("metar", $metar, $ar); $ar = array("asc" => "Ascending", "desc" => "Descending"); $sselect = make_select("sorder", $sorder, $ar); $t->content = <<<EOF <p> <form method="GET" action="obs.php" name="work"> <input type="hidden" value="{$sortcol}" name="sortcol"> <table border=1 cellspacing=0 cellpadding=1> <tr> <th>Select WFO: {$wselect}</td> <th>View Options:</th> <td>Include METARS: {$mselect} </td> <td>Sort Order: {$sselect}</td> <td><input type="submit" value="Go!"></form></td> </tr></table> <p>Sorted by column <b>{$vals[$sortcol]}</b>.
$countries_es[$code] = $country['es']; $countries_en[$code] = $country['en']; } } asort($countries_es); asort($countries_en); function make_select($countries) { $out = '<select name="country">'; foreach ($countries as $code => $country) { $out .= sprintf("\t" . '<option value="%s">%s</option>' . "\n", $code, $country); } $out .= '</select>'; return $out; } function make_php_array($countries) { $out = 'array('; foreach ($countries as $code => $country) { $out .= sprintf("\t'%s'\t=>\t'%s',\n", $code, $country); } $out .= ');'; return $out; } //----------------------------- $out_es = make_select($countries_es); $out_en = make_select($countries_en); file_put_contents($select_es, $out_es); file_put_contents($select_en, $out_en); file_put_contents($php_es, make_php_array($countries_es)); file_put_contents($php_en, make_php_array($countries_en));
function turn() { if ($_SESSION['select']) { include 'connection.php'; $req = "SELECT player_1_obj, player_2_obj, player_3_obj, player_4_obj, asteroid FROM party WHERE `id`=" . $_SESSION['id_party'] . ""; $pl = array(); foreach ($bdd->query($req) as $test) { if ($test['player_1_obj'] !== "" && intval($_SESSION['player_id']) === 1) { $_SESSION['player_obj'] = $test['player_1_obj']; } if ($test['player_2_obj'] !== "" && intval($_SESSION['player_id']) === 2) { $_SESSION['player_obj'] = $test['player_2_obj']; } if ($test['player_3_obj'] !== "" && intval($_SESSION['player_id']) === 3) { $_SESSION['player_obj'] = $test['player_3_obj']; } if ($test['player_4_obj'] !== "" && intval($_SESSION['player_id']) === 4) { $_SESSION['player_obj'] = $test['player_4_obj']; } if ($test['asteroid'] !== "") { $_SESSION['asteroid'] = $test['asteroid']; } } make_select(); } else { if ($_SESSION['order']) { // $move = 1; make_order($_POST); } else { if ($_SESSION['mvt']) { // $move = 1; make_mvt($_POST); } else { if ($_SESSION['make_move']) { // $move = 1; make_move($_POST); } else { // $move = 1; make_fire(); } } } } if (kill_ship()) { $_SESSION['select'] = 1; $_SESSION['order'] = 0; $_SESSION['mvt'] = 0; $_SESSION['make_move'] = 0; $_SESSION['fire'] = 0; include 'connection.php'; $req = $bdd->prepare("UPDATE `party` SET turn = (turn % player) + 1 where id=" . $_SESSION['id_party']); $req->execute(); $req->closeCursor(); } }
$year2 = isset($_REQUEST['year2']) ? intval($_REQUEST['year2']) : date("Y", $now); $month2 = isset($_REQUEST['month2']) ? intval($_REQUEST['month2']) : date("m", $now); $day2 = isset($_REQUEST['day2']) ? intval($_REQUEST['day2']) : date("d", $now); $hour2 = isset($_REQUEST['hour2']) ? intval($_REQUEST['hour2']) : date("H", $now); $opt = isset($_REQUEST['opt']) ? $_REQUEST['opt'] : '1'; $sselect = networkSelect("ISUSM", $station); $y1 = yearSelect2(2012, $year1, "year1"); $m1 = monthSelect($month1, "month1"); $d1 = daySelect2($day1, "day1"); $h1 = hourSelect($hour1, "hour1"); $y2 = yearSelect2(2012, $year2, "year2"); $m2 = monthSelect($month2, "month2"); $d2 = daySelect2($day2, "day2"); $h2 = hourSelect($hour2, "hour2"); $ar = array("1" => "3 Panel Plot", "2" => "Just Soil Temps", "3" => "Daily Max/Min 4 Inch Soil Temps", "4" => "Daily Solar Radiation", "5" => "Daily Potential Evapotranspiration"); $oselect = make_select("opt", $opt, $ar); $img = sprintf("smts.py?opt=%s&station=%s&year1=%s&year2=%s" . "&month1=%s&month2=%s&day1=%s&day2=%s&" . "hour1=%s&hour2=%s", $opt, $station, $year1, $year2, $month1, $month2, $day1, $day2, $hour1, $hour2); $t->content = <<<EOF <ol class="breadcrumb"> <li><a href="/agclimate/">AgClimate Network</a></li> <li class="active">Soil Moisture Plots</li> </ol> <h3>Soil Moisture and Precipitation Timeseries</h3> <p>This application plots a timeseries of soil moisture and precipitation from a ISU Soil Moisture station of your choice. Please select a start and end time and click the 'Make Plot' button below. <form name="selector" method="GET" name='getter'>
function view_user_shifts() { global $user, $privileges; global $ical_shifts; $ical_shifts = array(); $days = sql_select_single_col("\n SELECT DISTINCT DATE(FROM_UNIXTIME(`start`)) AS `id`, DATE(FROM_UNIXTIME(`start`)) AS `name` \n FROM `Shifts` \n ORDER BY `start`"); if (count($days) == 0) { error(_("The administration has not configured any shifts yet.")); redirect('?'); } $rooms = sql_select("SELECT `RID` AS `id`, `Name` AS `name` FROM `Room` WHERE `show`='Y' ORDER BY `Name`"); if (count($rooms) == 0) { error(_("The administration has not configured any rooms yet.")); redirect('?'); } if (in_array('user_shifts_admin', $privileges)) { $types = sql_select("SELECT `id`, `name` FROM `AngelTypes` ORDER BY `AngelTypes`.`name`"); } else { $types = sql_select("SELECT `AngelTypes`.`id`, `AngelTypes`.`name`, (`AngelTypes`.`restricted`=0 OR (NOT `UserAngelTypes`.`confirm_user_id` IS NULL OR `UserAngelTypes`.`id` IS NULL)) as `enabled` FROM `AngelTypes` LEFT JOIN `UserAngelTypes` ON (`UserAngelTypes`.`angeltype_id`=`AngelTypes`.`id` AND `UserAngelTypes`.`user_id`='" . sql_escape($user['UID']) . "') ORDER BY `AngelTypes`.`name`"); } if (empty($types)) { $types = sql_select("SELECT `id`, `name` FROM `AngelTypes` WHERE `restricted` = 0"); } $filled = array(array('id' => '1', 'name' => _('occupied')), array('id' => '0', 'name' => _('free'))); if (count($types) == 0) { error(_("The administration has not configured any angeltypes yet - or you are not subscribed to any angeltype.")); redirect('?'); } if (!isset($_SESSION['user_shifts'])) { $_SESSION['user_shifts'] = array(); } if (!isset($_SESSION['user_shifts']['filled'])) { // User shift admins see free and occupied shifts by default $_SESSION['user_shifts']['filled'] = in_array('user_shifts_admin', $privileges) ? [0, 1] : [0]; } foreach (array('rooms', 'types', 'filled') as $key) { if (isset($_REQUEST[$key])) { $filtered = array_filter($_REQUEST[$key], 'is_numeric'); if (!empty($filtered)) { $_SESSION['user_shifts'][$key] = $filtered; } unset($filtered); } if (!isset($_SESSION['user_shifts'][$key])) { $_SESSION['user_shifts'][$key] = array_map('get_ids_from_array', ${$key}); } } if (isset($_REQUEST['rooms'])) { if (isset($_REQUEST['new_style'])) { $_SESSION['user_shifts']['new_style'] = true; } else { $_SESSION['user_shifts']['new_style'] = false; } } if (!isset($_SESSION['user_shifts']['new_style'])) { $_SESSION['user_shifts']['new_style'] = true; } foreach (array('start', 'end') as $key) { if (isset($_REQUEST[$key . '_day']) && in_array($_REQUEST[$key . '_day'], $days)) { $_SESSION['user_shifts'][$key . '_day'] = $_REQUEST[$key . '_day']; } if (isset($_REQUEST[$key . '_time']) && preg_match('#^\\d{1,2}:\\d\\d$#', $_REQUEST[$key . '_time'])) { $_SESSION['user_shifts'][$key . '_time'] = $_REQUEST[$key . '_time']; } if (!isset($_SESSION['user_shifts'][$key . '_day'])) { $time = date('Y-m-d', time() + ($key == 'end' ? 24 * 60 * 60 : 0)); $_SESSION['user_shifts'][$key . '_day'] = in_array($time, $days) ? $time : ($key == 'end' ? max($days) : min($days)); } if (!isset($_SESSION['user_shifts'][$key . '_time'])) { $_SESSION['user_shifts'][$key . '_time'] = date('H:i'); } } if ($_SESSION['user_shifts']['start_day'] > $_SESSION['user_shifts']['end_day']) { $_SESSION['user_shifts']['end_day'] = $_SESSION['user_shifts']['start_day']; } if ($_SESSION['user_shifts']['start_day'] == $_SESSION['user_shifts']['end_day'] && $_SESSION['user_shifts']['start_time'] >= $_SESSION['user_shifts']['end_time']) { $_SESSION['user_shifts']['end_time'] = '23:59'; } if (isset($_SESSION['user_shifts']['start_day'])) { $starttime = DateTime::createFromFormat("Y-m-d H:i", $_SESSION['user_shifts']['start_day'] . $_SESSION['user_shifts']['start_time']); $starttime = $starttime->getTimestamp(); } else { $starttime = now(); } if (isset($_SESSION['user_shifts']['end_day'])) { $endtime = DateTime::createFromFormat("Y-m-d H:i", $_SESSION['user_shifts']['end_day'] . $_SESSION['user_shifts']['end_time']); $endtime = $endtime->getTimestamp(); } else { $endtime = now() + 24 * 60 * 60; } if (!isset($_SESSION['user_shifts']['rooms']) || count($_SESSION['user_shifts']['rooms']) == 0) { $_SESSION['user_shifts']['rooms'] = array(0); } $SQL = "SELECT DISTINCT `Shifts`.*, `ShiftTypes`.`name`, `Room`.`Name` as `room_name`, nat2.`special_needs` > 0 AS 'has_special_needs'\n FROM `Shifts`\n INNER JOIN `Room` USING (`RID`)\n INNER JOIN `ShiftTypes` ON (`ShiftTypes`.`id` = `Shifts`.`shifttype_id`)\n LEFT JOIN (SELECT COUNT(*) AS special_needs , nat3.`shift_id` FROM `NeededAngelTypes` AS nat3 WHERE `shift_id` IS NOT NULL GROUP BY nat3.`shift_id`) AS nat2 ON nat2.`shift_id` = `Shifts`.`SID`\n INNER JOIN `NeededAngelTypes` AS nat ON nat.`count` != 0 AND nat.`angel_type_id` IN (" . implode(',', $_SESSION['user_shifts']['types']) . ") AND ((nat2.`special_needs` > 0 AND nat.`shift_id` = `Shifts`.`SID`) OR ((nat2.`special_needs` = 0 OR nat2.`special_needs` IS NULL) AND nat.`room_id` = `RID`))\n LEFT JOIN (SELECT se.`SID`, se.`TID`, COUNT(*) as count FROM `ShiftEntry` AS se GROUP BY se.`SID`, se.`TID`) AS entries ON entries.`SID` = `Shifts`.`SID` AND entries.`TID` = nat.`angel_type_id`\n WHERE `Shifts`.`RID` IN (" . implode(',', $_SESSION['user_shifts']['rooms']) . ")\n AND `start` BETWEEN " . $starttime . " AND " . $endtime; if (count($_SESSION['user_shifts']['filled']) == 1) { if ($_SESSION['user_shifts']['filled'][0] == 0) { $SQL .= "\n AND (nat.`count` > entries.`count` OR entries.`count` IS NULL OR EXISTS (SELECT `SID` FROM `ShiftEntry` WHERE `UID` = '" . sql_escape($user['UID']) . "' AND `ShiftEntry`.`SID` = `Shifts`.`SID`))"; } elseif ($_SESSION['user_shifts']['filled'][0] == 1) { $SQL .= "\n AND (nat.`count` <= entries.`count` OR EXISTS (SELECT `SID` FROM `ShiftEntry` WHERE `UID` = '" . sql_escape($user['UID']) . "' AND `ShiftEntry`.`SID` = `Shifts`.`SID`))"; } } $SQL .= "\n ORDER BY `start`"; $shifts = sql_select($SQL); $ownshifts_source = sql_select("\n SELECT `ShiftTypes`.`name`, `Shifts`.* \n FROM `Shifts` \n INNER JOIN `ShiftTypes` ON (`ShiftTypes`.`id` = `Shifts`.`shifttype_id`)\n INNER JOIN `ShiftEntry` ON (`Shifts`.`SID` = `ShiftEntry`.`SID` AND `ShiftEntry`.`UID` = '" . sql_escape($user['UID']) . "')\n WHERE `Shifts`.`RID` IN (" . implode(',', $_SESSION['user_shifts']['rooms']) . ")\n AND `start` BETWEEN " . $starttime . " AND " . $endtime); $ownshifts = array(); foreach ($ownshifts_source as $ownshift) { $ownshifts[$ownshift['SID']] = $ownshift; } unset($ownshifts_source); $shifts_table = ""; // qqqq /* * [0] => Array ( [SID] => 1 [start] => 1355958000 [end] => 1355961600 [RID] => 1 [name] => [URL] => [PSID] => [room_name] => test1 [has_special_needs] => 1 [is_full] => 0 ) */ if ($_SESSION['user_shifts']['new_style']) { $first = 15 * 60 * floor($starttime / (15 * 60)); $maxshow = ceil(($endtime - $first) / (60 * 15)); $block = array(); $todo = array(); $myrooms = $rooms; // delete un-selected rooms from array foreach ($myrooms as $k => $v) { if (array_search($v["id"], $_SESSION['user_shifts']['rooms']) === FALSE) { unset($myrooms[$k]); } // initialize $block array $block[$v["id"]] = array_fill(0, $maxshow, 0); } // calculate number of parallel shifts in each timeslot for each room foreach ($shifts as $k => $shift) { $rid = $shift["RID"]; $blocks = ($shift["end"] - $shift["start"]) / (15 * 60); $firstblock = floor(($shift["start"] - $first) / (15 * 60)); for ($i = $firstblock; $i < $blocks + $firstblock && $i < $maxshow; $i++) { $block[$rid][$i]++; } $shifts[$k]['own'] = in_array($shift['SID'], array_keys($ownshifts)); } $shifts_table = '<div class="shifts-table"><table id="shifts" class="table scrollable"><thead><tr><th>-</th>'; foreach ($myrooms as $key => $room) { $rid = $room["id"]; if (array_sum($block[$rid]) == 0) { // do not display columns without entries unset($block[$rid]); unset($myrooms[$key]); continue; } $colspan = call_user_func_array('max', $block[$rid]); if ($colspan == 0) { $colspan = 1; } $todo[$rid] = array_fill(0, $maxshow, $colspan); $shifts_table .= "<th" . ($colspan > 1 ? ' colspan="' . $colspan . '"' : '') . ">" . Room_name_render(['RID' => $room['id'], 'Name' => $room['name']]) . "</th>\n"; } unset($block, $blocks, $firstblock, $colspan, $key, $room); $shifts_table .= "</tr></thead><tbody>"; for ($i = 0; $i < $maxshow; $i++) { $thistime = $first + $i * 15 * 60; if ($thistime % (24 * 60 * 60) == 23 * 60 * 60 && $endtime - $starttime > 24 * 60 * 60) { $shifts_table .= "<tr class=\"row-day\"><th class=\"row-header\">"; $shifts_table .= date('y-m-d<b\\r />H:i', $thistime); } elseif ($thistime % (60 * 60) == 0) { $shifts_table .= "<tr class=\"row-hour\"><th>"; $shifts_table .= date("H:i", $thistime); } else { $shifts_table .= "<tr><th>"; } $shifts_table .= "</th>"; foreach ($myrooms as $room) { $rid = $room["id"]; foreach ($shifts as $shift) { if ($shift["RID"] == $rid) { if (floor($shift["start"] / (15 * 60)) == $thistime / (15 * 60)) { $blocks = ($shift["end"] - $shift["start"]) / (15 * 60); if ($blocks < 1) { $blocks = 1; } $collides = in_array($shift['SID'], array_keys($ownshifts)); if (!$collides) { foreach ($ownshifts as $ownshift) { if ($ownshift['start'] >= $shift['start'] && $ownshift['start'] < $shift['end'] || $ownshift['end'] > $shift['start'] && $ownshift['end'] <= $shift['end'] || $ownshift['start'] < $shift['start'] && $ownshift['end'] > $shift['end']) { $collides = true; break; } } } // qqqqqq $is_free = false; $shifts_row = ''; if (in_array('admin_shifts', $privileges)) { $shifts_row .= '<div class="pull-right">' . table_buttons(array(button(page_link_to('user_shifts') . '&edit_shift=' . $shift['SID'], glyph('edit'), 'btn-xs'), button(page_link_to('user_shifts') . '&delete_shift=' . $shift['SID'], glyph('trash'), 'btn-xs'))) . '</div>'; } $shifts_row .= Room_name_render(['RID' => $room['id'], 'Name' => $room['name']]) . '<br />'; $shifts_row .= '<a href="' . shift_link($shift) . '">' . date('d.m. H:i', $shift['start']); $shifts_row .= " – "; $shifts_row .= date('H:i', $shift['end']); $shifts_row .= "<br /><b>"; $shifts_row .= ShiftType($shift['shifttype_id'])['name']; $shifts_row .= "</b><br />"; if ($shift['title'] != '') { $shifts_row .= $shift['title']; $shifts_row .= "<br />"; } $shifts_row .= '</a>'; $shifts_row .= '<br />'; $query = "SELECT `NeededAngelTypes`.`count`, `AngelTypes`.`id`, `AngelTypes`.`restricted`, `UserAngelTypes`.`confirm_user_id`, `AngelTypes`.`name`, `UserAngelTypes`.`user_id`\n FROM `NeededAngelTypes`\n JOIN `AngelTypes` ON (`NeededAngelTypes`.`angel_type_id` = `AngelTypes`.`id`)\n LEFT JOIN `UserAngelTypes` ON (`NeededAngelTypes`.`angel_type_id` = `UserAngelTypes`.`angeltype_id`AND `UserAngelTypes`.`user_id`='" . sql_escape($user['UID']) . "')\n WHERE\n `count` > 0\n AND "; if ($shift['has_special_needs']) { $query .= "`shift_id` = '" . sql_escape($shift['SID']) . "'"; } else { $query .= "`room_id` = '" . sql_escape($shift['RID']) . "'"; } if (!empty($_SESSION['user_shifts']['types'])) { $query .= " AND `angel_type_id` IN (" . implode(',', $_SESSION['user_shifts']['types']) . ") "; } $query .= " ORDER BY `AngelTypes`.`name`"; $angeltypes = sql_select($query); if (count($angeltypes) > 0) { foreach ($angeltypes as $angeltype) { $entries = sql_select("SELECT * FROM `ShiftEntry` JOIN `User` ON (`ShiftEntry`.`UID` = `User`.`UID`) WHERE `SID`='" . sql_escape($shift['SID']) . "' AND `TID`='" . sql_escape($angeltype['id']) . "' ORDER BY `Nick`"); $entry_list = array(); $freeloader = 0; foreach ($entries as $entry) { $style = ''; if ($entry['freeloaded']) { $freeloader++; $style = " text-decoration: line-through;"; } if (in_array('user_shifts_admin', $privileges)) { $entry_list[] = "<span style=\"{$style}\">" . User_Nick_render($entry) . ' ' . table_buttons(array(button(page_link_to('user_shifts') . '&entry_id=' . $entry['id'], glyph('trash'), 'btn-xs'))) . '</span>'; } else { $entry_list[] = "<span style=\"{$style}\">" . User_Nick_render($entry) . "</span>"; } } if ($angeltype['count'] - count($entries) - $freeloader > 0) { $inner_text = sprintf(ngettext("%d helper needed", "%d helpers needed", $angeltype['count'] - count($entries)), $angeltype['count'] - count($entries)); // is the shift still running or alternatively is the user shift admin? $user_may_join_shift = true; // you cannot join if user alread joined a parallel or this shift $user_may_join_shift &= !$collides; // you cannot join if user is not of this angel type $user_may_join_shift &= isset($angeltype['user_id']); // you cannot join if you are not confirmed if ($angeltype['restricted'] == 1 && isset($angeltype['user_id'])) { $user_may_join_shift &= isset($angeltype['confirm_user_id']); } // you can only join if the shift is in future or running $user_may_join_shift &= time() < $shift['start']; // User shift admins may join anybody in every shift $user_may_join_shift |= in_array('user_shifts_admin', $privileges); if ($user_may_join_shift) { $entry_list[] = '<a href="' . page_link_to('user_shifts') . '&shift_id=' . $shift['SID'] . '&type_id=' . $angeltype['id'] . '">' . $inner_text . '</a> ' . button(page_link_to('user_shifts') . '&shift_id=' . $shift['SID'] . '&type_id=' . $angeltype['id'], _('Sign up'), 'btn-xs'); } else { if (time() > $shift['start']) { $entry_list[] = $inner_text . ' (' . _('ended') . ')'; } elseif ($angeltype['restricted'] == 1 && isset($angeltype['user_id']) && !isset($angeltype['confirm_user_id'])) { $entry_list[] = $inner_text . glyph('lock'); } elseif ($angeltype['restricted'] == 1) { $entry_list[] = $inner_text; } elseif ($collides) { $entry_list[] = $inner_text; } else { $entry_list[] = $inner_text . '<br />' . button(page_link_to('user_angeltypes') . '&action=add&angeltype_id=' . $angeltype['id'], sprintf(_('Become %s'), $angeltype['name']), 'btn-xs'); } } unset($inner_text); $is_free = true; } $shifts_row .= '<strong>' . AngelType_name_render($angeltype) . ':</strong> '; $shifts_row .= join(", ", $entry_list); $shifts_row .= '<br />'; } if (in_array('user_shifts_admin', $privileges)) { $shifts_row .= ' ' . button(page_link_to('user_shifts') . '&shift_id=' . $shift['SID'] . '&type_id=' . $angeltype['id'], _("Add more angels"), 'btn-xs'); } } if ($shift['own'] && !in_array('user_shifts_admin', $privileges)) { $class = 'own'; } elseif ($collides && !in_array('user_shifts_admin', $privileges)) { $class = 'collides'; } elseif ($is_free) { $class = 'free'; } else { $class = 'occupied'; } $shifts_table .= '<td rowspan="' . $blocks . '" class="' . $class . '">'; $shifts_table .= $shifts_row; $shifts_table .= "</td>"; for ($j = 0; $j < $blocks && $i + $j < $maxshow; $j++) { $todo[$rid][$i + $j]--; } } } } // fill up row with empty <td> while ($todo[$rid][$i]-- > 0) { $shifts_table .= '<td class="empty"></td>'; } } $shifts_table .= "</tr>\n"; } $shifts_table .= '</tbody></table></div>'; // qqq } else { $shifts_table = array(); foreach ($shifts as $shift) { $info = array(); if ($_SESSION['user_shifts']['start_day'] != $_SESSION['user_shifts']['end_day']) { $info[] = date("Y-m-d", $shift['start']); } $info[] = date("H:i", $shift['start']) . ' - ' . date("H:i", $shift['end']); if (count($_SESSION['user_shifts']['rooms']) > 1) { $info[] = Room_name_render(['Name' => $shift['room_name'], 'RID' => $shift['RID']]); } $shift_row = array('info' => join('<br />', $info), 'entries' => '<a href="' . shift_link($shift) . '">' . $shift['name'] . '</a>' . ($shift['title'] ? '<br />' . $shift['title'] : '')); if (in_array('admin_shifts', $privileges)) { $shift_row['info'] .= ' ' . table_buttons(array(button(page_link_to('user_shifts') . '&edit_shift=' . $shift['SID'], glyph('edit'), 'btn-xs'), button(page_link_to('user_shifts') . '&delete_shift=' . $shift['SID'], glyph('trash'), 'btn-xs'))); } $shift_row['entries'] .= '<br />'; $is_free = false; $shift_has_special_needs = 0 < sql_num_query("SELECT `id` FROM `NeededAngelTypes` WHERE `shift_id` = " . $shift['SID']); $query = "SELECT `NeededAngelTypes`.`count`, `AngelTypes`.`id`, `AngelTypes`.`restricted`, `UserAngelTypes`.`confirm_user_id`, `AngelTypes`.`name`, `UserAngelTypes`.`user_id`\n FROM `NeededAngelTypes`\n JOIN `AngelTypes` ON (`NeededAngelTypes`.`angel_type_id` = `AngelTypes`.`id`)\n LEFT JOIN `UserAngelTypes` ON (`NeededAngelTypes`.`angel_type_id` = `UserAngelTypes`.`angeltype_id`AND `UserAngelTypes`.`user_id`='" . sql_escape($user['UID']) . "')\n WHERE "; if ($shift_has_special_needs) { $query .= "`shift_id` = '" . sql_escape($shift['SID']) . "'"; } else { $query .= "`room_id` = '" . sql_escape($shift['RID']) . "'"; } $query .= " AND `count` > 0 "; if (!empty($_SESSION['user_shifts']['types'])) { $query .= "AND `angel_type_id` IN (" . implode(',', $_SESSION['user_shifts']['types']) . ") "; } $query .= "ORDER BY `AngelTypes`.`name`"; $angeltypes = sql_select($query); if (count($angeltypes) > 0) { $my_shift = sql_num_query("SELECT * FROM `ShiftEntry` WHERE `SID`='" . sql_escape($shift['SID']) . "' AND `UID`='" . sql_escape($user['UID']) . "' LIMIT 1") > 0; foreach ($angeltypes as &$angeltype) { $entries = sql_select("SELECT * FROM `ShiftEntry` JOIN `User` ON (`ShiftEntry`.`UID` = `User`.`UID`) WHERE `SID`='" . sql_escape($shift['SID']) . "' AND `TID`='" . sql_escape($angeltype['id']) . "' ORDER BY `Nick`"); $entry_list = array(); $entry_nicks = []; $freeloader = 0; foreach ($entries as $entry) { if (in_array('user_shifts_admin', $privileges)) { $member = User_Nick_render($entry) . ' ' . table_buttons(array(button(page_link_to('user_shifts') . '&entry_id=' . $entry['id'], glyph('trash'), 'btn-xs'))); } else { $member = User_Nick_render($entry); } if ($entry['freeloaded']) { $member = '<strike>' . $member . '</strike>'; $freeloader++; } $entry_list[] = $member; $entry_nicks[] = $entry['Nick']; } $angeltype['taken'] = count($entries) - $freeloader; $angeltype['angels'] = $entry_nicks; // do we need more angles of this type? if ($angeltype['count'] - count($entries) + $freeloader > 0) { $inner_text = sprintf(ngettext("%d helper needed", "%d helpers needed", $angeltype['count'] - count($entries) + $freeloader), $angeltype['count'] - count($entries) + $freeloader); // is the shift still running or alternatively is the user shift admin? $user_may_join_shift = true; /* you cannot join if user already joined this shift */ $user_may_join_shift &= !$my_shift; // you cannot join if user is not of this angel type $user_may_join_shift &= isset($angeltype['user_id']); // you cannot join if you are not confirmed if ($angeltype['restricted'] == 1 && isset($angeltype['user_id'])) { $user_may_join_shift &= isset($angeltype['confirm_user_id']); } // you can only join if the shift is in future or running $user_may_join_shift &= time() < $shift['start']; // User shift admins may join anybody in every shift $user_may_join_shift |= in_array('user_shifts_admin', $privileges); if ($user_may_join_shift) { $entry_list[] = '<a href="' . page_link_to('user_shifts') . '&shift_id=' . $shift['SID'] . '&type_id=' . $angeltype['id'] . '">' . $inner_text . ' »</a>'; } else { if (time() > $shift['end']) { $entry_list[] = $inner_text . ' (vorbei)'; } elseif ($angeltype['restricted'] == 1 && isset($angeltype['user_id']) && !isset($angeltype['confirm_user_id'])) { $entry_list[] = $inner_text . glyph("lock"); } else { $entry_list[] = $inner_text . ' <a href="' . page_link_to('user_angeltypes') . '&action=add&angeltype_id=' . $angeltype['id'] . '">' . sprintf(_('Become %s'), $angeltype['name']) . '</a>'; } } unset($inner_text); $is_free = true; } $shift_row['entries'] .= '<b>' . $angeltype['name'] . ':</b> '; $shift_row['entries'] .= join(", ", $entry_list); $shift_row['entries'] .= '<br />'; } if (in_array('user_shifts_admin', $privileges)) { $shift_row['entries'] .= '<a href="' . page_link_to('user_shifts') . '&shift_id=' . $shift['SID'] . '&type_id=' . $angeltype['id'] . '">' . _('Add more angels') . ' »</a>'; } $shifts_table[] = $shift_row; $shift['angeltypes'] = $angeltypes; $ical_shifts[] = $shift; } } $shifts_table = table(array('info' => _("Time") . "/" . _("Room"), 'entries' => _("Entries")), $shifts_table); } if ($user['api_key'] == "") { User_reset_api_key($user, false); } return page(array('<div class="col-md-12">', msg(), template_render('../templates/user_shifts.html', array('title' => shifts_title(), 'room_select' => make_select($rooms, $_SESSION['user_shifts']['rooms'], "rooms", _("Rooms")), 'start_select' => html_select_key("start_day", "start_day", array_combine($days, $days), $_SESSION['user_shifts']['start_day']), 'start_time' => $_SESSION['user_shifts']['start_time'], 'end_select' => html_select_key("end_day", "end_day", array_combine($days, $days), $_SESSION['user_shifts']['end_day']), 'end_time' => $_SESSION['user_shifts']['end_time'], 'type_select' => make_select($types, $_SESSION['user_shifts']['types'], "types", _("Angeltypes") . '<sup>1</sup>'), 'filled_select' => make_select($filled, $_SESSION['user_shifts']['filled'], "filled", _("Occupancy")), 'task_notice' => '<sup>1</sup>' . _("The tasks shown here are influenced by the preferences you defined in your settings!") . " <a href=\"" . page_link_to('angeltypes') . '&action=about' . "\">" . _("Description of the jobs.") . "</a>", 'new_style_checkbox' => '<label><input type="checkbox" name="new_style" value="1" ' . ($_SESSION['user_shifts']['new_style'] ? ' checked' : '') . '> ' . _("Use new style if possible") . '</label>', 'shifts_table' => msg() . $shifts_table, 'ical_text' => '<h2>' . _("iCal export") . '</h2><p>' . sprintf(_("Export of shown shifts. <a href=\"%s\">iCal format</a> or <a href=\"%s\">JSON format</a> available (please keep secret, otherwise <a href=\"%s\">reset the api key</a>)."), page_link_to_absolute('ical') . '&key=' . $user['api_key'], page_link_to_absolute('shifts_json_export') . '&key=' . $user['api_key'], page_link_to('user_myshifts') . '&reset') . '</p>', 'filter' => _("Filter"))), '</div>')); }
/** * Returns a date picker * @todo replace this function with the formvalidator datepicker * */ function draw_date_picker($prefix, $default = '') { if (empty($default)) { $default = date('Y-m-d H:i:s'); } $parts = split(' ', $default); list($d_year, $d_month, $d_day) = split('-', $parts[0]); list($d_hour, $d_minute) = split(':', $parts[1]); $month_list = array(1 => get_lang('JanuaryLong'), 2 => get_lang('FebruaryLong'), 3 => get_lang('MarchLong'), 4 => get_lang('AprilLong'), 5 => get_lang('MayLong'), 6 => get_lang('JuneLong'), 7 => get_lang('JulyLong'), 8 => get_lang('AugustLong'), 9 => get_lang('SeptemberLong'), 10 => get_lang('OctoberLong'), 11 => get_lang('NovemberLong'), 12 => get_lang('DecemberLong')); $minute = range(10, 59); array_unshift($minute, '00', '01', '02', '03', '04', '05', '06', '07', '08', '09'); $date_form = make_select($prefix . '_day', array_combine(range(1, 31), range(1, 31)), $d_day); $date_form .= make_select($prefix . '_month', $month_list, $d_month); $date_form .= make_select($prefix . '_year', array($d_year - 2 => $d_year - 2, $d_year - 1 => $d_year - 1, $d_year => $d_year, $d_year + 1 => $d_year + 1, $d_year + 2 => $d_year + 2), $d_year) . ' '; $date_form .= make_select($prefix . '_hour', array_combine(range(0, 23), range(0, 23)), $d_hour) . ' : '; $date_form .= make_select($prefix . '_minute', $minute, $d_minute); return $date_form; }
$pt = ms_newPointObj(); $pt->setXY($cities[$station]['lon'], $cities[$station]['lat'], 0); $pt->draw($map, $datal, $img, 0, $row["d"]); } $namer->draw($img); $counties->draw($img); $stlayer->draw($img); //$ttt->draw($img); $datal->draw($img); iemmap_title($map, $img, $plotDate . " " . $var[$plot]); $map->drawLabelCache($img); $url = $img->saveWebImage(); $ar = array("all" => "Iowa", "ne" => "NE Iowa", "se" => "SE Iowa", "sw" => "SW Iowa", "nw" => "NW Iowa"); $aselect = make_select("area", $area, $ar); $ar = array("high" => "Average High Temperature", "low" => "Average Low Temperature", "precip" => "Average Precip", "max_high" => "Record High Temperature", "min_low" => "Record Low Temperature", "max_precip" => "Record Precip", "min_high" => "Record Minimum High Temp", "max_low" => "Record Maximum Low Temp"); $pselect = make_select("plot", $plot, $ar); $mselect = monthSelect("month", $month); $dselect = daySelect("day", $day); $t->content = <<<EOF <h3>COOP Climate Data</h3> Using the COOP data archive, daily averages and extremes were calculated. These numbers are <b>not</b> official, but we believe them to be accurate. Please make your form selections on the left hand side and then click the 'Generate Plot' button. <div class="row"> <div class="col-md-7"> <img src="{$url}" class="img img-responsive" /> <br><i>You can right-click on the image to save it.</i>
include "../../include/vtec.php"; include "../../include/network.php"; include "../../include/forms.php"; $nt = new NetworkTable("WFO"); $clobber = isset($_REQUEST["clobber"]); $wfo = isset($_REQUEST["wfo"]) ? strtoupper(substr($_REQUEST["wfo"], 0, 3)) : null; $phenomena = isset($_REQUEST["phenomena"]) ? strtoupper(substr($_REQUEST["phenomena"], 0, 2)) : null; $significance = isset($_REQUEST["significance"]) ? strtoupper(substr($_REQUEST["significance"], 0, 1)) : null; $wfoLimiter = ""; $wfoMsg = "Data for all WFOs shown"; if ($wfo) { $wfoLimiter = " and wfo = '{$wfo}' "; $wfoMsg = "Data for only {$wfo} shown"; } $p1 = make_select("phenomena", $phenomena, $vtec_phenomena); $s1 = make_select("significance", $significance, $vtec_significance); $t = new MyView(); $t->thispage = "severe-main"; $t->title = "VTEC Yearly Event Counts"; function get_data() { global $wfoLimiter; $dbconn = iemdb("postgis"); $rs = pg_query("\n\t\t\tSELECT yr, phenomena, significance, count(*) from\n\t\t\t(SELECT distinct extract(year from issue) as yr, wfo,\n\t\t\tphenomena, significance, eventid from warnings WHERE\n\t\t\tsignificance is not null and phenomena is not null and\n\t\t\tissue > '1980-01-01' {$wfoLimiter}) as foo\n\t\t\tGROUP by yr, phenomena, significance\n\t"); $data = array(); $pcodes = array(); for ($i = 0; $row = @pg_fetch_assoc($rs, $i); $i++) { $yr = $row["yr"]; if (!array_key_exists($yr, $data)) { $data[$yr] = array(); }
} ?> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <head> <title>Selective Memory</title> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> <style type="text/css"> p, label, select, option { font: 12px verdana; color: #66f; } </style> </head> <body> <form action="index.php" method="post"> <p> <?php // en hier simpel de select genereren make_select('hobbies', $hobbies); make_select('maanden', $maanden); make_select('dagen', $dagen); make_select('jaren', $jaren); ?> <input type="submit" value="verzenden"> </p> </form> </body> </html>
<?php include "../../../config/settings.inc.php"; include_once "../../../include/myview.php"; include_once "../../../include/imagemaps.php"; include_once "../../../include/forms.php"; $t = new MyView(); $t->title = "COOP Extremes Plots"; $t->thispage = "networks-coop"; $station = isset($_GET["station"]) ? $_GET["station"] : ""; $var = isset($_GET["var"]) ? $_GET["var"] : ""; $nselect = networkSelect("IACLIMATE", $station); $ar = array("high" => "High Temperature", "low" => "Low Temperature"); $varselect = make_select("var", $var, $ar); $imgurl = ""; if (strlen($station) > 0) { $imgurl = "<img src=\"extremes.php?var=" . $var . "&station=" . $station . "\">\n"; } $t->content = <<<EOF <ol class="breadcrumb"> <li><a href="http://mesonet.agron.iastate.edu/">IEM</a></li> <li><a href="/climate/">Climatology</a></li> <li class="active">COOP Daily Extremes</li> </ol> <BR> <p>Using the NWS COOP dataset, the IEM has calculated daily temperature extremes. You can create a annual plot of this dataset for a station of your choice.</p>
function main_screen($mode = 'reg') { global $INSTALLER09; $page_title = "Statistic Center"; $page_detail = "Please define the date ranges and other options below.<br />Note: The statistics generated are based on the information currently held in the database."; if ($mode == 'reg') { $form_code = 'show_reg'; $table = 'Registration Statistics'; } else { if ($mode == 'topic') { $form_code = 'show_topic'; $table = 'New Topic Statistics'; } else { if ($mode == 'post') { $form_code = 'show_post'; $table = 'Post Statistics'; } else { if ($mode == 'msg') { $form_code = 'show_msg'; $table = 'PM Statistics'; } else { if ($mode == 'views') { $form_code = 'show_views'; $table = 'Topic View Statistics'; } else { if ($mode == 'comms') { $form_code = 'show_comms'; $table = 'Comment Statistics'; } else { if ($mode == 'torrents') { $form_code = 'show_torrents'; $table = 'Torrrents Statistics'; } else { if ($mode == 'reps') { $form_code = 'show_reps'; $table = 'Reputation Statistics'; } } } } } } } } $old_date = getdate(time() - 3600 * 24 * 90); $new_date = getdate(time() + 3600 * 24); $menu = make_side_menu(); $htmlout = "<div>\n <div style='background: grey; height: 25px;'>\n <span style='font-weight: bold; font-size: 12pt;'>Statistics Center</span>\n </div><br />\n {$menu}\n <form action='{$INSTALLER09['baseurl']}/staffpanel.php?tool=stats_extra&action=stats_extra' method='post' name='StatsForm'>\n <input name='mode' value='{$form_code}' type='hidden' />\n\n\t\n <div style='text-align: left; width: 50%; border: 1px solid blue; padding: 5px;'>\n\t\t<div style='background: grey; height: 25px; margin-bottom:20px;'>\n <span style='font-weight: bold; font-size: 12pt;'>{$table}</span>\n </div>\n <fieldset><legend><strong>Info</strong></legend>\n {$page_detail}</fieldset>\n\t\t<fieldset><legend><strong>Date From</strong></legend>"; $htmlout .= make_select('from_month', make_month(), $old_date['mon']) . ' '; $htmlout .= make_select('from_day', make_day(), $old_date['mday']) . ' '; $htmlout .= make_select('from_year', make_year(), $old_date['year']) . '</fieldset>'; $htmlout .= "<fieldset><legend><strong>Date To</strong></legend>"; $htmlout .= make_select('to_month', make_month(), $new_date['mon']) . ' '; $htmlout .= make_select('to_day', make_day(), $new_date['mday']) . ' '; $htmlout .= make_select('to_year', make_year(), $new_date['year']) . '</fieldset>'; if ($mode != 'views') { $htmlout .= "<fieldset><legend><strong>Time scale</strong></legend>"; $htmlout .= make_select('timescale', array(0 => array('daily', 'Daily'), 1 => array('weekly', 'Weekly'), 2 => array('monthly', 'Monthly'))) . '</fieldset>'; } $htmlout .= "<fieldset><legend><strong>Result Sorting</strong></legend>"; $htmlout .= make_select('sortby', array(0 => array('asc', 'Ascending - Oldest dates first'), 1 => array('desc', 'Descending - Newest dates first')), 'desc') . '</fieldset>'; $htmlout .= "<fieldset><legend><strong>Submit it!</strong></legend>\n\t\t\t\t<input value='Show' class='btn' accesskey='s' type='submit' />\n\t\t\t</fieldset>\n\n\t\t</div>\n\t\n </form></div>"; echo stdhead($page_title) . $htmlout . stdfoot(); }
$s1 .= " SELECTED "; } $s1 .= ">" . $cities[$key]["name"] . "\n"; } $s2 = ""; for (reset($cities); $key = key($cities); next($cities)) { $s2 .= "<option value=\"" . $cities[$key]["id"] . "\""; if ($cities[$key]["id"] == $station2) { $s2 .= " SELECTED "; } $s2 .= ">" . $cities[$key]["name"] . "\n"; } $ar = array("o" => "One Station", "c" => "Compare Two"); $modeselect = make_select("mode", $mode, $ar); $ar = array("all" => "All", "winter" => "Winter (DJF)", "spring" => "Spring (NAM)", "summer" => "Summer (JJA)", "fall" => "Fall (SON)"); $seasonselect = make_select("season", $season, $ar); if ($mode == "c") { $im = "<img src=\"yearly_diff.php?station1=" . $station1 . "&station2=" . $station2 . "&season=" . $season . "\">\n"; } else { if (strlen($station1) > 0) { $im = "<img src=\"yearly.php?station=" . $station1 . "&season=" . $season . "\">\n"; } else { $im = "<p>Please make plot selections above.\n"; } } $t->content = <<<EOF <ol class="breadcrumb"> <li><a href="http://mesonet.agron.iastate.edu/">IEM</a></li> <li><a href="/climate/">Climatology</a></li> <li class="active">COOP Yearly Averages</li> </ol>
} if ($enabled4) { $imgurl .= sprintf("phenomena4=%s&significance4=%s&", $phenomena4, $significance4); } $imgurl .= sprintf("sts=%s&ets=%s", gmdate("YmdH", $ts1), gmdate("YmdH", $ts2)); $t->title = "NWS WWA Product Counts"; include "../../include/vtec.php"; include "../../include/forms.php"; $p1 = make_select("phenomena", $phenomena, $vtec_phenomena); $s1 = make_select("significance", $significance, $vtec_significance); $p2 = make_select("phenomena2", $phenomena2, $vtec_phenomena); $s2 = make_select("significance2", $significance2, $vtec_significance); $p3 = make_select("phenomena3", $phenomena3, $vtec_phenomena); $s3 = make_select("significance3", $significance3, $vtec_significance); $p4 = make_select("phenomena4", $phenomena4, $vtec_phenomena); $s4 = make_select("significance4", $significance4, $vtec_significance); $e2 = sprintf("<input type='checkbox' name='enabled2'%s>Include</input>", $enabled2 ? " checked='checked'" : ""); $e3 = sprintf("<input type='checkbox' name='enabled3'%s>Include</input>", $enabled3 ? " checked='checked'" : ""); $e4 = sprintf("<input type='checkbox' name='enabled4'%s>Include</input>", $enabled4 ? " checked='checked'" : ""); $y1 = yearSelect2(2005, $year1, 'year1'); $m1 = monthSelect2($month1, 'month1'); $d1 = daySelect2($day1, 'day1'); $h1 = gmtHourSelect($hour1, 'hour1'); $y2 = yearSelect2(2005, $year2, 'year2'); $m2 = monthSelect2($month2, 'month2'); $d2 = daySelect2($day2, 'day2'); $h2 = gmtHourSelect($hour2, 'hour2'); $t->content = <<<EOF <ol class="breadcrumb"> <li><a href="/nws/">NWS Resources</a></li> <li>WWA Product Counts by WFO</li>
$sorted_data = sortBySecondIndex($data, $sortcol); } else { $sorted_data = aSortBySecondIndex($data, $sortcol); } while (list($key, $val) = each($sorted_data)) { $link = sprintf("extremes.php?station=%s&network=%s&tbl=%s", $val["station"], $network, $tbl); $table .= sprintf("<tr><td><a href=\"%s\">%s</a> (%s)</td><td>%s</td>\n \t\t\t\t<td>%.1f</td><td>%s</td><td>%s</td><td>%s</td><td>%s</td>\n \t\t\t\t<td></td>\n \t\t\t\t<td>%.1f</td><td>%s</td><td>%s</td><td>%s</td><td>%s</td>\n \t\t\t\t<td></td>\n \t\t\t\t<td>%.2f</td><td>%.2f</td><td>%s</td>\n \t\t\t\t</tr>", $link, $cities[$val["station"]]['name'], $val["station"], $val["years"], $val["avg_high"], $val["max_high"], implode(", ", $val["max_high_years"]), $val["min_high"], implode(", ", $val["min_high_years"]), $val["avg_low"], $val["max_low"], implode(", ", $val["max_low_years"]), $val["min_low"], implode(", ", $val["min_low_years"]), $val["avg_precip"], $val["max_precip"], implode(", ", $val["max_precip_years"])); } $h3 = "<h3>NWS COOP Climatology for " . date("d F", $valid) . "</h3>"; } $ar = array("ILCLIMATE" => "Illinois", "INCLIMATE" => "Indiana", "IACLIMATE" => "Iowa", "KSCLIMATE" => "Kansas", "KYCLIMATE" => "Kentucky", "MICLIMATE" => "Michigan", "MNCLIMATE" => "Minnesota", "MOCLIMATE" => "Missouri", "NECLIMATE" => "Nebraska", "NDCLIMATE" => "North Dakota", "OHCLIMATE" => "Ohio", "SDCLIMATE" => "South Dakota", "WICLIMATE" => "Wisconsin"); $netselect = make_select("network", $network, $ar); $mselect = monthSelect($month, "month"); $dselect = daySelect($day, "day"); $ar = array("climate" => "All Available", "climate51" => "Since 1951", "climate71" => "1971-2000", "climate81" => "1981-2010"); $tblselect = make_select("tbl", $tbl, $ar); $sortdir2 = $sortdir == 'ASC' ? 'DESC' : 'ASC'; if ($station != null) { $uribase = sprintf("&station=%s&network=%s&tbl=%s&sortdir=%s", $station, $network, $tbl, $sortdir2); $h4 = "<a href='extremes.php?sortcol=valid" . $uribase . "'>Date</a>"; } else { $uribase = sprintf("&day=%s&month=%s&network=%s&tbl=%s&sortdir=%s", $day, $month, $network, $tbl, $sortdir2); $h4 = "<a href='extremes.php?sortcol=station&day=" . $day . "&month=" . $month . "'>Station</a>"; } $t->content = <<<EOF {$h3} <p>This table gives a listing of <b>unofficial</b> daily records for NWS COOP stations. Some records may have occured on multiple years, only one is listed here. You may click on a column to sort it. You can click on the station
} } if (!$nohtml || $format == 'shapefile') { $t = new MyView(); $t->title = "Network Station Tables"; $t->thispage = "iem-networks"; $page = 'single.phtml'; $sextra = ""; if (isset($_REQUEST['station'])) { $t->sites_current = "tables"; include "setup.php"; $page = 'sites.phtml'; $sextra = sprintf("<input type=\"hidden\" value=\"%s\" name=\"station\">", $_REQUEST["station"]); } $ar = array("html" => "HTML Table", "csv" => "Comma Delimited", "shapefile" => "ESRI Shapefile", "gempak" => "GEMPAK Station Table", "awips" => "AWIPS Station Table", "madis" => "MADIS Station Table"); $fselect = make_select("format", $format, $ar); $nselect = selectNetwork($network, array("_ALL_" => "All Networks")); $t->content = <<<EOF <h3>Network Location Tables</h3> <div class="well pull-right"> <a href="new-rss.php"><img src="/images/rss.gif" style="border: 0px;" alt="RSS" /></a> Feed of newly added stations. <br /><strong>Special Table Requests</strong> <ul> <li><a href="networks.php?special=allasos&format=gempak&nohtml">Global METAR in GEMPAK Format</a></li> </ul> </div>
include "../../../config/settings.inc.php"; include "../../../include/imagemaps.php"; include_once "../../../include/forms.php"; include_once "../../../include/myview.php"; $t = new MyView(); $t->title = "COOP Climate Plots"; $station1 = isset($_GET["station1"]) ? $_GET["station1"] : "IA0000"; $station2 = isset($_GET["station2"]) ? $_GET["station2"] : null; $mode = isset($_GET["mode"]) ? $_GET["mode"] : ""; $t->thispage = "networks-coop"; $imgurl = sprintf("/cgi-bin/climate/daily.py?p=daily&station1=%s", $station1); if ($mode == 'c') { $imgurl .= sprintf("&station2=%s", $station2); } $ar = array("o" => "One Station", "c" => "Compare Two"); $modeselect = make_select("mode", $mode, $ar); $s1 = networkSelect("IACLIMATE", $station1, array(), "station1"); $s2 = networkSelect("IACLIMATE", $station2, array(), "station2"); $t->content = <<<EOF <h3>Daily Climatology</h3> <p>This application dynamically generates plots of the daily average high and low temperature for climate locations tracked by the IEM. You can optionally plot two stations at once for a visual comparison.</p> <b>Make Plot Selections:</b> <form method="GET" action="climate_fe.php">
function main_screen($mode = 'reg') { global $INSTALLER09, $lang; $page_title = $lang['stats_ex_center']; $page_detail = "{$lang['stats_ex_details_main']}<br />{$lang['stats_ex_details_main1']}"; if ($mode == 'reg') { $form_code = 'show_reg'; $table = "<div class='row'><div class='col-md-12'>{$lang['stats_ex_registr']}</div></div>"; } else { if ($mode == 'topic') { $form_code = 'show_topic'; $table = $lang['stats_ex_newtopicst']; } else { if ($mode == 'post') { $form_code = 'show_post'; $table = "<div class='row'><div class='col-md-12'>{$lang['stats_ex_poststs']}</div></div>"; } else { if ($mode == 'msg') { $form_code = 'show_msg'; $table = "<div class='row'><div class='col-md-12'>{$lang['stats_ex_pmsts']}</div></div>"; } else { if ($mode == 'views') { $form_code = 'show_views'; $table = "<div class='row'><div class='col-md-12'>{$lang['stats_ex_topicviewsts']}</div></div>"; } else { if ($mode == 'comms') { $form_code = 'show_comms'; $table = "<div class='row'><div class='col-md-12'>{$lang['stats_ex_comsts']}</div></div>"; } else { if ($mode == 'torrents') { $form_code = 'show_torrents'; $table = "<div class='row'><div class='col-md-12'>{$lang['stats_ex_torrsts']}</div></div>"; } else { if ($mode == 'reps') { $form_code = 'show_reps'; $table = "<div class='row'><div class='col-md-12'>{$lang['stats_ex_repsts']}</div></div>"; } } } } } } } } $old_date = getdate(time() - 3600 * 24 * 90); $new_date = getdate(time() + 3600 * 24); $menu = make_side_menu(); $htmlout = "\n <div class='well'><div class='row'><div class='col-md-12'><h2 class='text-center'>{$lang['stats_ex_center']}</h2></div></div><br><div class='row'><div class='col-md-12'>{$menu}</div></div><br><div class='row'><div class='col-md-12'>\n <form action='{$INSTALLER09['baseurl']}/staffpanel.php?tool=stats_extra&action=stats_extra' method='post' name='StatsForm'>\n <input name='mode' value='{$form_code}' type='hidden'>\n <div class='row'><div class='col-md-12'><h4 class='text-center'>{$table}</h4></div></div>\n <div class='row well'><div class='col-md-12'><fieldset><legend><strong>{$lang['stats_ex_infor']}</strong></legend>{$page_detail}</fieldset></div></div>\n <div class='row well'><div class='col-md-12'><fieldset><legend><strong>{$lang['stats_ex_datefrom']}</strong></legend>"; $htmlout .= make_select('from_month', make_month(), $old_date['mon']) . ' '; $htmlout .= make_select('from_day', make_day(), $old_date['mday']) . ' '; $htmlout .= make_select('from_year', make_year(), $old_date['year']) . '</fieldset><br>'; $htmlout .= "<fieldset><legend><strong>{$lang['stats_ex_dateto']}</strong></legend>"; $htmlout .= make_select('to_month', make_month(), $new_date['mon']) . ' '; $htmlout .= make_select('to_day', make_day(), $new_date['mday']) . ' '; $htmlout .= make_select('to_year', make_year(), $new_date['year']) . '</fieldset>'; $htmlout .= "</div></div>"; if ($mode != 'views') { $htmlout .= "<div class='row'><div class='col-md-12'></div></div><div class='row well'><div class='col-md-12'><fieldset><legend><strong>{$lang['stats_ex_timescale']}</strong></legend>"; $htmlout .= make_select('timescale', array(0 => array('daily', $lang['stats_ex_daily']), 1 => array('weekly', $lang['stats_ex_weekly']), 2 => array('monthly', $lang['stats_ex_monthly']))) . '</fieldset>'; } $htmlout .= "<br><fieldset><legend><strong>{$lang['stats_ex_ressort']}</strong></legend>"; $htmlout .= make_select('sortby', array(0 => array('asc', $lang['stats_ex_asc']), 1 => array('desc', $lang['stats_ex_desc'])), 'desc') . '</fieldset>'; $htmlout .= "</div></div></div>"; $htmlout .= "<br><fieldset class='text-center'><legend><strong>{$lang['stats_ex_submit']}</strong></legend>\n\t\t<input value='{$lang['stats_ex_show']}' class='btn btn-default' accesskey='s' type='submit'></fieldset></form></div></div>"; echo stdhead($page_title) . $htmlout . stdfoot(); }
function main_screen($mode = 'reg') { global $INSTALLER09, $lang; $page_title = $lang['stats_ex_center']; $page_detail = "{$lang['stats_ex_details_main']}<br />{$lang['stats_ex_details_main1']}"; if ($mode == 'reg') { $form_code = 'show_reg'; $table = $lang['stats_ex_registr']; } else { if ($mode == 'topic') { $form_code = 'show_topic'; $table = $lang['stats_ex_newtopicst']; } else { if ($mode == 'post') { $form_code = 'show_post'; $table = $lang['stats_ex_poststs']; } else { if ($mode == 'msg') { $form_code = 'show_msg'; $table = $lang['stats_ex_pmsts']; } else { if ($mode == 'views') { $form_code = 'show_views'; $table = $lang['stats_ex_topicviewsts']; } else { if ($mode == 'comms') { $form_code = 'show_comms'; $table = $lang['stats_ex_comsts']; } else { if ($mode == 'torrents') { $form_code = 'show_torrents'; $table = $lang['stats_ex_torrsts']; } else { if ($mode == 'reps') { $form_code = 'show_reps'; $table = $lang['stats_ex_repsts']; } } } } } } } } $old_date = getdate(time() - 3600 * 24 * 90); $new_date = getdate(time() + 3600 * 24); $menu = make_side_menu(); $htmlout = "<div>\n <div style='background: grey; height: 25px;'>\n <span style='font-weight: bold; font-size: 12pt;'>{$lang['stats_ex_center']}</span>\n </div><br />\n {$menu}\n <form action='{$INSTALLER09['baseurl']}/staffpanel.php?tool=stats_extra&action=stats_extra' method='post' name='StatsForm'>\n <input name='mode' value='{$form_code}' type='hidden' />\n\n\t\n <div style='text-align: left; width: 50%; border: 1px solid blue; padding: 5px;'>\n\t\t<div style='background: grey; height: 25px; margin-bottom:20px;'>\n <span style='font-weight: bold; font-size: 12pt;'>{$table}</span>\n </div>\n <fieldset><legend><strong>{$lang['stats_ex_infor']}</strong></legend>\n {$page_detail}</fieldset>\n\t\t<fieldset><legend><strong>{$lang['stats_ex_datefrom']}</strong></legend>"; $htmlout .= make_select('from_month', make_month(), $old_date['mon']) . ' '; $htmlout .= make_select('from_day', make_day(), $old_date['mday']) . ' '; $htmlout .= make_select('from_year', make_year(), $old_date['year']) . '</fieldset>'; $htmlout .= "<fieldset><legend><strong>{$lang['stats_ex_dateto']}</strong></legend>"; $htmlout .= make_select('to_month', make_month(), $new_date['mon']) . ' '; $htmlout .= make_select('to_day', make_day(), $new_date['mday']) . ' '; $htmlout .= make_select('to_year', make_year(), $new_date['year']) . '</fieldset>'; if ($mode != 'views') { $htmlout .= "<fieldset><legend><strong>{$lang['stats_ex_timescale']}</strong></legend>"; $htmlout .= make_select('timescale', array(0 => array('daily', $lang['stats_ex_daily']), 1 => array('weekly', $lang['stats_ex_weekly']), 2 => array('monthly', $lang['stats_ex_monthly']))) . '</fieldset>'; } $htmlout .= "<fieldset><legend><strong>{$lang['stats_ex_ressort']}</strong></legend>"; $htmlout .= make_select('sortby', array(0 => array('asc', $lang['stats_ex_asc']), 1 => array('desc', $lang['stats_ex_desc'])), 'desc') . '</fieldset>'; $htmlout .= "<fieldset><legend><strong>{$lang['stats_ex_submit']}</strong></legend>\n\t\t\t\t<input value='{$lang['stats_ex_show']}' class='btn' accesskey='s' type='submit' />\n\t\t\t</fieldset>\n\n\t\t</div>\n\t\n </form></div>"; echo stdhead($page_title) . $htmlout . stdfoot(); }