Source for file week_class.php
Documentation is available at week_class.php
* This file contains the week class, which represents a week of UARS Days.
* 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
require_once('uars_day_class.php');
* The week class contains the 7 UARS Days that make up a given week. Each
* UARS Day is represented by a uars_day object.
* The hrdi_db class instance.
* Array of uars_day objects.
* Day of week of the day passed in.
* Newest UARS day in the database.
* The week class constructor. The constructor populates the $days array,
* which will contain up to 7 {@link uars_day} objects, one for each UARS
* @param hrdi_db $hdb The hrdi_db instance
* @param integer $uars_day UARS Day which is part of this week
function week (&$hdb, $uars_day) {
// Get the newest UARS day from the database
// Create a uars_day object for the passed in day
// The day of the week for the passed in day
$this->dow = $day->data['DoW_Numeric'];
// For each of the 7 days in a week
for ($i = 0; $i < 7; $i++ ) {
// We're looking at a day before the one passed in
$ud = $uars_day - ($this->dow - $i);
// Check to see if we're looking at day after UARS day 1
if (($ud > 0) && ($ud <= $this->newest)) {
} else if ($i > $this->dow) {
// We're looking at a day after the one passed in
$ud = $uars_day + ($i - $this->dow);
// Check to see that the day is not after the newest day in the database
} else if ($i == $this->dow) {
// We're looking at the day that was passed in
if (($ud <= $this->newest) && ($ud > 0)) {
|