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

Source for file location.php

Documentation is available at location.php

  1. <?php
  2. /**
  3. * <b>Location Class</b><br />
  4. * This contains utility functions for the Location section.
  5. * Functions are primarily for display.
  6. * @author Kristen O'Brien <kristen_paristemi-com>
  7. * @copyright Copyright 2004, Kristen O'Brien
  8. * @license http://opensource.org/licenses/gpl-license.php GNU Public License
  9. * @link http://www.paristemi.com Paristemi Main Site
  10. * @package paristemi
  11. * @subpackage paristemi_util
  12. * @since Build 0.1
  13. * @version Build 0.7
  14. * @filesource
  15. */
  16. /**
  17. * Include the constants file and all of the files in the include list
  18. */
  19. if(ltrim(dirname($_SERVER['SCRIPT_FILENAME'])) == "" || !file_exists($_SERVER['DOCUMENT_ROOT']."/constants.php")) {
  20. if(!file_exists("../constants.php")) { require_once("../public_html/constants.php"); }
  21. else { require_once("../constants.php"); }
  22. }
  23. else { require_once($_SERVER['DOCUMENT_ROOT']."/constants.php"); }
  24. foreach($INCLUDE_LIST as $includefile) { require_once $includefile; }
  25.  
  26. $db = new Database();
  27. $db_location = $db->GetClass('location');
  28.  
  29. /**
  30. * <b>Location Class</b><br />
  31. * This contains utility functions for the Location section.
  32. * Functions are primarily for display.
  33. * @author Kristen O'Brien <kristen_paristemi-com>
  34. * @copyright Copyright 2004, Kristen O'Brien
  35. * @license http://opensource.org/licenses/gpl-license.php GNU Public License
  36. * @link http://www.paristemi.com Paristemi Main Site
  37. * @package paristemi
  38. * @subpackage paristemi_util
  39. * @since Build 0.1
  40. * @version Build 0.7
  41. * @filesource
  42. */
  43. class Location {
  44. function &locHeader()
  45. {
  46. $sidesection = array();
  47. $data =& $GLOBALS['db_location']->GetAllLocationData();
  48. $sidesection['Title'] = $GLOBALS['S_LOCATIONS'];
  49. foreach ($data as $value) {
  50. if($value->ShowMain) {
  51. $sidesection['Links'][] = array(
  52. 'LinkPath' => $GLOBALS['HTTP_DOCUMENT_ROOT'].$GLOBALS['LOCATION_DIR'].
  53. $GLOBALS['LOCATION_FILE']."?id=".$value->ID,
  54. 'LinkText' => $value->Name);
  55. }
  56. }
  57. return $sidesection;
  58. }
  59. function &LocationData($id)
  60. {
  61. $value =& $GLOBALS['db_location']->GetLocationData($id);
  62. $tbldata = array();
  63. $tblclass = "tbl-listing";
  64. $tbltdclass = array("tbl-listing-title","tbl-listing-item");
  65. $tblheader = "<h2>".$value->Name."</h2>";
  66. $locaddress = $value->Address."<br \>";
  67. if($value->Address2 != null) { $locaddress .= $value->Address2."<br \>"; }
  68. $locaddress .= $value->City.", ".$value->State." ".$value->Zip;
  69. array_push($tbldata,array($GLOBALS['S_ADDRESS'],$locaddress));
  70. if($value->Phone != null) {
  71. $phone =& $value->Phone;
  72. array_push($tbldata,array($GLOBALS['S_PHONE'],"(".substr($phone, 0, 3).")".
  73. substr($phone, 3, 3)."-".substr($phone, 6,9)));
  74. }
  75. array_push($tbldata,array($GLOBALS['S_MAP_LINK'],UtilHtml::mapLink($value)));
  76. if($value->Description != null) {
  77. array_push($tbldata,array($GLOBALS['S_DESC'],$value->Description));
  78. }
  79. return UtilHtml::createTable($tbldata,$tblheader,$tblclass,"","",$tbltdclass);
  80. }
  81. function &AllLocationData($smarty)
  82. {
  83. $data =& $GLOBALS['db_location']->GetAllLocationData();
  84. if($data != null) {
  85. $tbldata = array();
  86. $tblclass = "tbl-listing";
  87. $tbltdclass = "tbl-listing-half";
  88. $tblheader = $GLOBALS['S_LOCATIONS'];
  89. foreach ($data as $value) {
  90. if($value->ShowMain) {
  91. $locaddress = $value->Address."<br \>";
  92. if($value->Address2 != null) {
  93. $locaddress .= $value->Address2."<br \>";
  94. }
  95. $locaddress .= $value->City.", ".$value->State." ".$value->Zip;
  96. $locphone = "";
  97. if($value->Phone != null) {
  98. $phone =& $value->Phone;
  99. $locphone = "<br />"."(".substr($phone, 0, 3).")".
  100. substr($phone, 3, 3)."-".substr($phone, 6,9);
  101. }
  102. array_push($tbldata,array("<a href=\"".$GLOBALS['LOCATION_FILE']."?id=".
  103. $value->ID."\">".$value->Name."</a>",
  104. $locaddress.$locphone));
  105. }
  106. }
  107. $smarty->assign('printtable',
  108. UtilHtml::createTable($tbldata,$tblheader,$tblclass,"","",$tbltdclass));
  109. }
  110. else { $smarty->assign('notice',$GLOBALS['N_LOCS_NONE']); }
  111. return $smarty;
  112. }
  113. }
  114. ?>

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