- <?php
- /**
- * <b>Database Class : About</b><br />
- * Provides all database access methods for the about 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 : About</b><br />
- * Provides all database access methods for the about 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_About {
-
- function DB_About() { }
-
- // Get all ministries
-
- function &GetAllMinistries() {
- $data = Array();
- $result = mysql_query("select M.ID, M.Title, M.ContactID, M.Description,
- M.Services, M.Notes, C.Email, C.First, C.Last,
- C.Title as CTitle, C.ShowMainTitle, C.ID as CID,
- C.ShowMainFirstName
- from Ministry M, Contact C
- where C.ID = M.ContactID AND
- M.ShowItem > 0
- order by M.Title");
-
- //Process each row.
- while ($row = mysql_fetch_array($result, MYSQL_ASSOC)) {
-
- $fullname = "";
- if($row['ShowMainTitle']) { $fullname .= $row['CTitle']." "; }
- if($row['ShowMainFirstName']) { $fullname .= $row['First']." ".$row['Last']; }
-
- $data[] = new MinistryData($row['ID'], $row['Title'], $fullname,
- $row['Email'], $row['CID'],$row['Description'], $row['Notes'],
- $row['Services']);
- }
-
- return $data;
- }
-
- // Get a ministry
- // Pass it the ID
-
- function &GetMinistryData(&$id) {
- $result = mysql_query("select M.ID, M.Title, M.ContactID, M.Description,
- M.Services, M.Notes, C.Email, C.First, C.Last,
- C.Title as CTitle, C.ShowMainTitle, C.ID as CID,
- C.ShowMainFirstName
- from Ministry M, Contact C
- where M.ID = $id AND
- C.ID = M.ContactID
- order by M.Title
- limit 1");
-
- $row = mysql_fetch_array($result, MYSQL_ASSOC);
-
- $fullname = "";
- if($row['ShowMainTitle']) { $fullname .= $row['CTitle']." "; }
- if($row['ShowMainFirstName']) { $fullname .= $row['First']." ".$row['Last']; }
-
- $data = new MinistryData($row['ID'], $row['Title'], $fullname,
- $row['Email'], $row['CID'], $row['Description'], $row['Notes'],
- $row['Services']);
-
- return $data;
- }
- }
-
- /**
- * <b>Database Container Class : Ministry</b><br />
- * Contains all of the specific data for a ministry.
- * @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 MinistryData {
- var $ID;
- var $Title;
- var $CName;
- var $Email;
- var $CID;
- var $Description;
- var $Notes;
- var $Services;
-
- function MinistryData($id, $title, $cname, $email, $cid, $desc, $notes, $services) {
- $this->ID = $id;
- $this->Title = $title;
- $this->CName = $cname;
- $this->Email = $email;
- $this->CID = $cid;
- $this->Description = $desc;
- $this->Notes = $notes;
- $this->Services = $services;
- }
- }
-
- ?>