Source for file mode_class.php
Documentation is available at mode_class.php
* This file contains the {@link mode} class, which represents a specific
* 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
* The mode class represents a single UARS Day mode. Each mode has a set of
* data values, as well as a list of all possible Pids.
* HRDI database instance.
* Mode data, pulled from the database.
* Internal fields which must be present during submission verification.
"Process_ID" => "Process ID",
* Fields which must contain valid numbers during submission verification.
"Azimuth2" => "Azimuth 2",
"Azimuth3" => "Azimuth 3",
"Azimuth4" => "Azimuth 4",
"Planned" => "Planned flag");
* The mode class constructor. It pulls data for the specific mode out of
* the database, as well as a list of all possible Pids.
* @param hrdi_db $hdb Instance of the hrdi_db class
* @param integer $id Mode id
function mode (&$hdb, $id = 0) {
// Pull in the mode data if we have a valid mode id
$this->data = $this->hdb->get_row($sql);
// Pull in the list of valid Pids
$this->pids = $this->hdb->get_list($sql);
* The verify function verifies mode data to make sure it's ok to insert
* a new mode or update an existing mode.
* @param array $data Mode data
* @return TRUE|FALSETRUE if verification succeeds, FALSE otherwise
// Verify internal field presence and format
* The add function adds a new mode for a given UARS Day.
* @param array $data Mode data
// Get the description for the mode from the current Pid table.
return $this->hdb->add($data, "HRDI_Modes");
* The update function updates a given mode for a given UARS Day.
* @param array $data Mode data
// Get the description for the mode from the current Pid table.
return $this->hdb->update($data, "HRDI_Modes", "ID");
* The delete function deletes a given mode for a given UARS Day.
* @param array $data Mode data
return $this->hdb->delete($data, "HRDI_Modes", "ID");
* Returns a Pid description.
* The function returns the description for a given Pid. The list of Pids
* and descriptions is pulled from the database by the mode class
* @param integer $p Pid number
* @return string Pid description
foreach ($this->pids as $pid) {
return $pid['Description'];
|