Source for file uars_day_class.php
Documentation is available at uars_day_class.php
* This file contains the uars_day class.
* This file is part of HRDIODB.
* HRDIODB is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
* HRDIODB is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* You should have received a copy of the GNU General Public License
* along with HRDIODB; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
* An object of this class represents one UARS day.
* Any error that gets generated.
* HRDI database instance.
* The day's unix time stamp.
* Newest UARS day in the database.
* Takes a {@link hrdi_db} class instance and a UARS day as arguments and
* populates the object with data for that day.
* @param hrdi_db $hdb The hrdi_db instance
* @param integer $day The UARS day
* @return FALSE if an error is encountered
WHERE UARS_Day = {$this->day}";
$this->data = $this->hdb->get_row($sql);
WHERE UARS_Day = { $this->day}
$this->modes = $this->hdb->get_list($sql);
// Get the newest UARS day from the database
$sql = "SELECT F.Filename, FT.Description
FROM HRDI_Files F, HRDI_FileTypes FT
WHERE F.UARS_Day = { $this->day}
$this->files = $this->hdb->get_list($sql);
WHERE UARS_Day = { $this->day}";
$this->links = $this->hdb->get_list($sql);
// Perform all the UARS day date math
$this->data['Day_Of_Year'] = date('z', $this->day_ts) + 1;
$this->data['Date'] = date('d-M-Y', $this->day_ts);
$this->data['Day_Of_Week'] = date('l', $this->day_ts);
$this->data['DoW_Numeric'] = date('w', $this->day_ts);
switch($this->data['Flight_Direction']){
$this->display_data['Flight_Direction'] = "Forward";
$this->display_data['Flight_Direction'] = "Backward";
$this->display_data['Flight_Direction'] = "Maneuver";
// Populate certain empty field values with the — entity
foreach (array_keys($this->data) as $key) {
if (!strncmp($key, "pcnt_", 5) || !strncmp($key, "cov_", 4)) {
// JMR -- We decided to ignore the 'Data_Valid' field for this display
// if (!$this->data['Data_Valid'] || ($this->data[$key] == -999.00)) {
// $this->data[$key] = ' — ';
if ($this->data[$key] == - 999.00) {
$this->data[$key] = ' — ';
* Save updated UARS Day data.
* This method will save/update a UARS Day with the given data values. It
* does data verification before processing the update.
* @param array $data Associate array of key/value pairs
* @return TRUE|FALSE Status of db update
if (!isset($data['UARS_Day'])) {
$this->error = "Not saved! UARS_Day was missing!";
if (strlen($data['Beta_Angle']) && !is_numeric($data['Beta_Angle'])) {
$this->error = "Not saved! Beta Angle must be a number!";
// More verifications can/should go here
// Done forget to strip slashes
$data['Comments'] = stripslashes($data['Comments']);
if ($data['Data_Valid'] == "NULL") {
$data['Data_Valid'] = NULL;
return $this->hdb->update($data, "HRDI_Days", "UARS_Day");
|