- <?php
- /**
- * <b>Database Class : Location</b><br />
- * Provides all database access methods for the location section
- * @author Kristen O'Brien <kristen_paristemi-com>
- * @copyright Copyright 2004, Kristen O'Brien
- * @license http://opensource.org/licenses/gpl-license.php GNU Public License
- * @link http://www.paristemi.com Paristemi Main Site
- * @package paristemi
- * @subpackage paristemi_database_layer
- * @since Build 0.5
- * @version Build 0.7
- * @filesource
- */
- /**
- * <b>Database Class : Location</b><br />
- * Provides all database access methods for the location section
- * @author Kristen O'Brien <kristen_paristemi-com>
- * @copyright Copyright 2004, Kristen O'Brien
- * @license http://opensource.org/licenses/gpl-license.php GNU Public License
- * @link http://www.paristemi.com Paristemi Main Site
- * @package paristemi
- * @subpackage paristemi_database_layer
- * @since Build 0.5
- * @version Build 0.7
- * @filesource
- */
- class DB_Location {
-
- function DB_Location() { }
-
- // Get all locations
-
- function &GetAllLocationData() {
- $data = Array();
- $result = mysql_query("select L.ID, L.Name, L.Address, L.Address2,
- L.City, L.State, L.Zip, L.Phone, L.Description, L.ShowMain
- from Location L
- order by L.Name");
-
- //Process each row.
- while ($row = mysql_fetch_array($result, MYSQL_ASSOC)) {
-
- $data[] = new LocationData($row['ID'], $row['Name'], $row['Address'],
- $row['Address2'], $row['City'],
- $row['State'], $row['Zip'], $row['Phone'],
- $row['Description'], $row['ShowMain']);
- }
-
- return $data;
- }
-
- //Pass it the ID.
-
- function &GetLocationData(&$id) {
- $result = mysql_query("select L.ID, L.Name, L.Address, L.Address2, L.City,
- L.State, L.Zip, L.Phone, L.Description, L.ShowMain
- from Location L
- where L.ID = $id
- order by L.Name
- limit 1");
-
- $row = mysql_fetch_array($result, MYSQL_ASSOC);
-
- $data = new LocationData($row['ID'], $row['Name'], $row['Address'],
- $row['Address2'], $row['City'],
- $row['State'], $row['Zip'], $row['Phone'],
- $row['Description'], $row['ShowMain']);
-
- return $data;
- }
- }
-
- /**
- * <b>Database Container Class : Location</b><br />
- * Contains all of the specific data for a location.
- * @author Kristen O'Brien <kristen_paristemi-com>
- * @copyright Copyright 2004, Kristen O'Brien
- * @license http://opensource.org/licenses/gpl-license.php GNU Public License
- * @link http://www.paristemi.com Paristemi Main Site
- * @package paristemi
- * @subpackage paristemi_database_layer
- * @since Build 0.5
- * @version Build 0.7
- * @filesource
- */
- class LocationData {
- var $ID;
- var $Name;
- var $Address;
- var $Address2;
- var $City;
- var $State;
- var $Zip;
- var $Phone;
- var $Description;
- var $ShowMain;
-
- function LocationData($id, $name, $address, $address2, $city, $state, $zip,
- $phone, $description, $showmain) {
- $this->ID = $id;
- $this->Name = $name;
- $this->Address = $address;
- $this->Address2 = $address2;
- $this->City = $city;
- $this->State = $state;
- $this->Zip = $zip;
- $this->Phone = $phone;
- $this->Description = $description;
- $this->ShowMain = $showmain;
- }
- }
-
-
- ?>