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

Source for file db_about.php

Documentation is available at db_about.php

  1. <?php
  2. /**
  3. * <b>Database Class : About</b><br />
  4. * Provides all database access methods for the about 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 : About</b><br />
  17. * Provides all database access methods for the about 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_About {
  29. function DB_About() { }
  30. // Get all ministries
  31. function &GetAllMinistries() {
  32. $data = Array();
  33. $result = mysql_query("select M.ID, M.Title, M.ContactID, M.Description,
  34. M.Services, M.Notes, C.Email, C.First, C.Last,
  35. C.Title as CTitle, C.ShowMainTitle, C.ID as CID,
  36. C.ShowMainFirstName
  37. from Ministry M, Contact C
  38. where C.ID = M.ContactID AND
  39. M.ShowItem > 0
  40. order by M.Title");
  41.  
  42. //Process each row.
  43. while ($row = mysql_fetch_array($result, MYSQL_ASSOC)) {
  44. $fullname = "";
  45. if($row['ShowMainTitle']) { $fullname .= $row['CTitle']." "; }
  46. if($row['ShowMainFirstName']) { $fullname .= $row['First']." ".$row['Last']; }
  47.  
  48. $data[] = new MinistryData($row['ID'], $row['Title'], $fullname,
  49. $row['Email'], $row['CID'],$row['Description'], $row['Notes'],
  50. $row['Services']);
  51. }
  52.  
  53. return $data;
  54. }
  55. // Get a ministry
  56. // Pass it the ID
  57. function &GetMinistryData(&$id) {
  58. $result = mysql_query("select M.ID, M.Title, M.ContactID, M.Description,
  59. M.Services, M.Notes, C.Email, C.First, C.Last,
  60. C.Title as CTitle, C.ShowMainTitle, C.ID as CID,
  61. C.ShowMainFirstName
  62. from Ministry M, Contact C
  63. where M.ID = $id AND
  64. C.ID = M.ContactID
  65. order by M.Title
  66. limit 1");
  67. $row = mysql_fetch_array($result, MYSQL_ASSOC);
  68. $fullname = "";
  69. if($row['ShowMainTitle']) { $fullname .= $row['CTitle']." "; }
  70. if($row['ShowMainFirstName']) { $fullname .= $row['First']." ".$row['Last']; }
  71.  
  72. $data = new MinistryData($row['ID'], $row['Title'], $fullname,
  73. $row['Email'], $row['CID'], $row['Description'], $row['Notes'],
  74. $row['Services']);
  75.  
  76. return $data;
  77. }
  78. }
  79.  
  80. /**
  81. * <b>Database Container Class : Ministry</b><br />
  82. * Contains all of the specific data for a ministry.
  83. * @author Kristen O'Brien <kristen_paristemi-com>
  84. * @copyright Copyright 2004, Kristen O'Brien
  85. * @license http://opensource.org/licenses/gpl-license.php GNU Public License
  86. * @link http://www.paristemi.com Paristemi Main Site
  87. * @package paristemi
  88. * @subpackage paristemi_database_layer
  89. * @since Build 0.5
  90. * @version Build 0.7
  91. * @filesource
  92. */
  93. class MinistryData {
  94. var $ID;
  95. var $Title;
  96. var $CName;
  97. var $Email;
  98. var $CID;
  99. var $Description;
  100. var $Notes;
  101. var $Services;
  102.  
  103. function MinistryData($id, $title, $cname, $email, $cid, $desc, $notes, $services) {
  104. $this->ID = $id;
  105. $this->Title = $title;
  106. $this->CName = $cname;
  107. $this->Email = $email;
  108. $this->CID = $cid;
  109. $this->Description = $desc;
  110. $this->Notes = $notes;
  111. $this->Services = $services;
  112. }
  113. }
  114.  
  115. ?>

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