- <?php
- /**
- * <b>Location Class</b><br />
- * This contains utility functions for the Location section.
- * Functions are primarily for display.
- * @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_util
- * @since Build 0.1
- * @version Build 0.7
- * @filesource
- */
- /**
- * Include the constants file and all of the files in the include list
- */
- if(ltrim(dirname($_SERVER['SCRIPT_FILENAME'])) == "" || !file_exists($_SERVER['DOCUMENT_ROOT']."/constants.php")) {
- if(!file_exists("../constants.php")) { require_once("../public_html/constants.php"); }
- else { require_once("../constants.php"); }
- }
- else { require_once($_SERVER['DOCUMENT_ROOT']."/constants.php"); }
- foreach($INCLUDE_LIST as $includefile) { require_once $includefile; }
-
- $db = new Database();
- $db_location = $db->GetClass('location');
-
- /**
- * <b>Location Class</b><br />
- * This contains utility functions for the Location section.
- * Functions are primarily for display.
- * @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_util
- * @since Build 0.1
- * @version Build 0.7
- * @filesource
- */
- class Location {
-
- function &locHeader()
- {
- $sidesection = array();
- $data =& $GLOBALS['db_location']->GetAllLocationData();
- $sidesection['Title'] = $GLOBALS['S_LOCATIONS'];
- foreach ($data as $value) {
- if($value->ShowMain) {
- $sidesection['Links'][] = array(
- 'LinkPath' => $GLOBALS['HTTP_DOCUMENT_ROOT'].$GLOBALS['LOCATION_DIR'].
- $GLOBALS['LOCATION_FILE']."?id=".$value->ID,
- 'LinkText' => $value->Name);
- }
- }
- return $sidesection;
- }
-
- function &LocationData($id)
- {
- $value =& $GLOBALS['db_location']->GetLocationData($id);
-
- $tbldata = array();
- $tblclass = "tbl-listing";
- $tbltdclass = array("tbl-listing-title","tbl-listing-item");
-
- $tblheader = "<h2>".$value->Name."</h2>";
- $locaddress = $value->Address."<br \>";
- if($value->Address2 != null) { $locaddress .= $value->Address2."<br \>"; }
- $locaddress .= $value->City.", ".$value->State." ".$value->Zip;
- array_push($tbldata,array($GLOBALS['S_ADDRESS'],$locaddress));
- if($value->Phone != null) {
- $phone =& $value->Phone;
- array_push($tbldata,array($GLOBALS['S_PHONE'],"(".substr($phone, 0, 3).")".
- substr($phone, 3, 3)."-".substr($phone, 6,9)));
- }
- array_push($tbldata,array($GLOBALS['S_MAP_LINK'],UtilHtml::mapLink($value)));
- if($value->Description != null) {
- array_push($tbldata,array($GLOBALS['S_DESC'],$value->Description));
- }
- return UtilHtml::createTable($tbldata,$tblheader,$tblclass,"","",$tbltdclass);
- }
-
-
- function &AllLocationData($smarty)
- {
- $data =& $GLOBALS['db_location']->GetAllLocationData();
-
- if($data != null) {
- $tbldata = array();
- $tblclass = "tbl-listing";
- $tbltdclass = "tbl-listing-half";
- $tblheader = $GLOBALS['S_LOCATIONS'];
-
- foreach ($data as $value) {
- if($value->ShowMain) {
- $locaddress = $value->Address."<br \>";
- if($value->Address2 != null) {
- $locaddress .= $value->Address2."<br \>";
- }
- $locaddress .= $value->City.", ".$value->State." ".$value->Zip;
- $locphone = "";
- if($value->Phone != null) {
- $phone =& $value->Phone;
- $locphone = "<br />"."(".substr($phone, 0, 3).")".
- substr($phone, 3, 3)."-".substr($phone, 6,9);
- }
- array_push($tbldata,array("<a href=\"".$GLOBALS['LOCATION_FILE']."?id=".
- $value->ID."\">".$value->Name."</a>",
- $locaddress.$locphone));
- }
- }
- $smarty->assign('printtable',
- UtilHtml::createTable($tbldata,$tblheader,$tblclass,"","",$tbltdclass));
- }
- else { $smarty->assign('notice',$GLOBALS['N_LOCS_NONE']); }
- return $smarty;
- }
- }
- ?>