paristemi
[ class tree: paristemi ] [ index: paristemi ] [ all elements ]

Source for file db_location.php

Documentation is available at db_location.php

  1. <?php
  2. /**
  3. * <b>Database Class : Location</b><br />
  4. * Provides all database access methods for the location section
  5. * @author Kristen O'Brien <kristen_paristemi-com>
  6. * @copyright Copyright 2004, Kristen O'Brien
  7. * @license http://opensource.org/licenses/gpl-license.php GNU Public License
  8. * @link http://www.paristemi.com Paristemi Main Site
  9. * @package paristemi
  10. * @subpackage paristemi_database_layer
  11. * @since Build 0.5
  12. * @version Build 0.7
  13. * @filesource
  14. */
  15. /**
  16. * <b>Database Class : Location</b><br />
  17. * Provides all database access methods for the location section
  18. * @author Kristen O'Brien <kristen_paristemi-com>
  19. * @copyright Copyright 2004, Kristen O'Brien
  20. * @license http://opensource.org/licenses/gpl-license.php GNU Public License
  21. * @link http://www.paristemi.com Paristemi Main Site
  22. * @package paristemi
  23. * @subpackage paristemi_database_layer
  24. * @since Build 0.5
  25. * @version Build 0.7
  26. * @filesource
  27. */
  28. class DB_Location {
  29. function DB_Location() { }
  30. // Get all locations
  31. function &GetAllLocationData() {
  32. $data = Array();
  33. $result = mysql_query("select L.ID, L.Name, L.Address, L.Address2,
  34. L.City, L.State, L.Zip, L.Phone, L.Description, L.ShowMain
  35. from Location L
  36. order by L.Name");
  37.  
  38. //Process each row.
  39. while ($row = mysql_fetch_array($result, MYSQL_ASSOC)) {
  40.  
  41. $data[] = new LocationData($row['ID'], $row['Name'], $row['Address'],
  42. $row['Address2'], $row['City'],
  43. $row['State'], $row['Zip'], $row['Phone'],
  44. $row['Description'], $row['ShowMain']);
  45. }
  46.  
  47. return $data;
  48. }
  49.  
  50. //Pass it the ID.
  51. function &GetLocationData(&$id) {
  52. $result = mysql_query("select L.ID, L.Name, L.Address, L.Address2, L.City,
  53. L.State, L.Zip, L.Phone, L.Description, L.ShowMain
  54. from Location L
  55. where L.ID = $id
  56. order by L.Name
  57. limit 1");
  58.  
  59. $row = mysql_fetch_array($result, MYSQL_ASSOC);
  60.  
  61. $data = new LocationData($row['ID'], $row['Name'], $row['Address'],
  62. $row['Address2'], $row['City'],
  63. $row['State'], $row['Zip'], $row['Phone'],
  64. $row['Description'], $row['ShowMain']);
  65.  
  66. return $data;
  67. }
  68. }
  69.  
  70. /**
  71. * <b>Database Container Class : Location</b><br />
  72. * Contains all of the specific data for a location.
  73. * @author Kristen O'Brien <kristen_paristemi-com>
  74. * @copyright Copyright 2004, Kristen O'Brien
  75. * @license http://opensource.org/licenses/gpl-license.php GNU Public License
  76. * @link http://www.paristemi.com Paristemi Main Site
  77. * @package paristemi
  78. * @subpackage paristemi_database_layer
  79. * @since Build 0.5
  80. * @version Build 0.7
  81. * @filesource
  82. */
  83. class LocationData {
  84. var $ID;
  85. var $Name;
  86. var $Address;
  87. var $Address2;
  88. var $City;
  89. var $State;
  90. var $Zip;
  91. var $Phone;
  92. var $Description;
  93. var $ShowMain;
  94.  
  95. function LocationData($id, $name, $address, $address2, $city, $state, $zip,
  96. $phone, $description, $showmain) {
  97. $this->ID = $id;
  98. $this->Name = $name;
  99. $this->Address = $address;
  100. $this->Address2 = $address2;
  101. $this->City = $city;
  102. $this->State = $state;
  103. $this->Zip = $zip;
  104. $this->Phone = $phone;
  105. $this->Description = $description;
  106. $this->ShowMain = $showmain;
  107. }
  108. }
  109.  
  110.  
  111. ?>

Documentation generated on Mon, 10 May 2004 12:08:46 -0700 by phpDocumentor 1.3.0RC3