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

Source for file index.php

Documentation is available at index.php

  1. <?php
  2. /**
  3. * <b>Events/Studies</b><br />
  4. * The events section shows all of the details of the events offered.<br />
  5. * Types are:
  6. * - Calendar (links to calendar views)
  7. * - Studies (Series) mapped by Type
  8. * - Home Groups
  9. * This section is searchable.
  10. * @author Kristen O'Brien <kristen_paristemi-com>
  11. * @copyright Copyright &copy; 2004, Kristen O'Brien
  12. * @license http://opensource.org/licenses/gpl-license.php GNU Public License
  13. * @link http://www.paristemi.com Paristemi Main Site
  14. * @package paristemi
  15. * @subpackage paristemi_business_logic
  16. * @since Build 0.1
  17. * @version Build 0.7
  18. * @filesource
  19. */
  20. /**
  21. * Include the constants file and all of the files in the include list
  22. */
  23. if(ltrim(dirname($_SERVER['SCRIPT_FILENAME'])) == "" || !file_exists($_SERVER['DOCUMENT_ROOT']."/constants.php")) {
  24. if(!file_exists("../constants.php")) { require_once("../public_html/constants.php"); }
  25. else { require_once("../constants.php"); }
  26. }
  27. else { require_once($_SERVER['DOCUMENT_ROOT']."/constants.php"); }
  28. foreach($INCLUDE_LIST as $includefile) { require_once $includefile; }
  29. require_once ($SERVER_DIRECTORY.$INCLUDE_PATH.$CALENDAR_INCLUDE);
  30.  
  31. $arr_list = array();
  32. function arrSeparate($var) { return(in_array($var->Type,$GLOBALS['arr_list'])); }
  33.  
  34. $db = new Database();
  35. $cal = new Calendar;
  36. $db_studies = $db->GetClass('studies');
  37. $data =& $db_studies->GetCurrentStudies();
  38. $smarty = UtilSmarty::createSmarty();
  39. $id="";
  40. if(getenv("QUERY_STRING")) {
  41. if(isset($HTTP_GET_VARS['id'])) {$id = $HTTP_GET_VARS['id'];}
  42. }
  43. if($id != "") {
  44. $studydata = $db_studies->GetStudyInfo($id);
  45. $pagesubtitle = $studydata->Title;
  46. }
  47. else {
  48. $pagesubtitle = $S_STUDIES.", ".$S_SERVICES;
  49. if($SHOW_HOME_GROUP_TABLE) { $pagesubtitle .= ", ".$S_AND." ".$S_HOME_GROUPS; }
  50. }
  51. require_once $HTTP_DOCUMENT_ROOT.$INCLUDE_PATH.$HEADER.
  52. "?pagetitle=".str_replace(" ","%20",htmlentities($S_EVENTS)).
  53. "&pagesubtitle=".str_replace(" ","%20",htmlentities(stripslashes($pagesubtitle))).
  54. "&pagedesc=".str_replace(" ","%20",htmlentities($CHURCH_NAME." ".$S_DESC_EVENTS));
  55.  
  56. $sidesections = array();
  57. $sidecal = $cal->calHeader();
  58. $sidesections[] = $sidecal['callinks'];
  59. $smarty = $cal->calSearchForm($smarty);
  60. foreach($STUDIES_LIST as $studyname => $studylist) {
  61. $sidesection = array('Title'=>$studyname,'Links'=>array());
  62. $arr_list = $STUDIES_LIST_MAP[$studylist];
  63. $arr = array_filter($data,"arrSeparate");
  64. foreach($arr as $value) {
  65. $sidesection['Links'][] = array('LinkPath'=>$HTTP_DOCUMENT_ROOT.$STUDIES_DIR.
  66. $STUDIES_FILE."?id=".$value->ID,'LinkText'=>$value->Title);
  67. }
  68. $sidesections[] = $sidesection;
  69. }
  70. $printtable = array();
  71. $data =& $db_studies->GetCurrentStudies();
  72. $tblclass = "tbl-listing";
  73. if($data != null) {
  74. if(getenv("QUERY_STRING")) {
  75. $tblarr = array();
  76. $tbltdclass = array("tbl-listing-title","tbl-listing-item");
  77. $value =& $db_studies->GetStudyInfo($id);
  78. $tblheader = "<h2>".$value->Title."</h2>";
  79. $meetbymonth = " ";
  80. if($value->MeetByMonth != 0) {
  81. $meetbymonth = str_replace(",",", ",str_replace("1",$S_FIRST,str_replace("2",$S_SECOND,
  82. str_replace("3",$S_THIRD,str_replace("4",$S_FOURTH,$value->MeetByMonth)))));
  83. }
  84. array_push($tblarr,array($S_DAY,$S_EVERY." ".$meetbymonth." ".$cal->getWeekday($value->Day)));
  85. array_push($tblarr,array($S_TIME,$value->Start." - ".$value->Stop));
  86. if ($value->iStart != null) {
  87. $istart = getDate($value->iStart);
  88. array_push($tblarr,array($S_NEXT_EVENT,"<a href=\"".$HTTP_DOCUMENT_ROOT.
  89. $CALENDAR_PATH.$ITEM_CAL_FILE."?id=".$value->iID."\">".
  90. $istart['month']." ".$istart['mday'].", ".$istart['year']."</a>"));
  91. }
  92. if($value->LocationName != "No Location" && $value->LocationName != "Submit Form For Location Information") {
  93. array_push($tblarr,array($S_LOCATION,"<a href=\"".$HTTP_DOCUMENT_ROOT.$LOCATION_DIR.
  94. $LOCATION_FILE."?id=".$value->LocationID."\">".$value->LocationName."</a>"));
  95. }
  96. if ($value->Description != null) {
  97. array_push($tblarr,array($S_DESC,stripslashes($value->Description)));
  98. }
  99. $printtable[] = UtilHtml::createTable($tblarr,$tblheader,$tblclass,"","",$tbltdclass);
  100. }
  101. else {
  102. $tblarr = array();
  103. $tblheader = array($S_STUDIES." &amp; ".$S_SERVICES,array($S_TITLE,$S_DAY,$S_START));
  104. $tbltdclass = array("tbl-listing-event","tbl-listing-day","tbl-listing-start");
  105. $homegrouparr = array();
  106. if(count($data) != 0) {
  107. foreach ($data as $value) {
  108. if($value->Type == $S_HOME_GROUP) { $homegrouparr[] = $value; }
  109. else {
  110. $meetbymonth = " ";
  111. if($value->MeetByMonth != 0) {
  112. $meetbymonth = str_replace(",",", ",str_replace("1",$S_FIRST,str_replace("2",$S_SECOND,
  113. str_replace("3",$S_THIRD,str_replace("4",$S_FOURTH,$value->MeetByMonth)))));
  114. }
  115. array_push($tblarr,array("<a href=\"".$HTTP_DOCUMENT_ROOT.$STUDIES_DIR.
  116. $STUDIES_FILE."?id=".$value->ID."\">".$value->Title."</a>",
  117. $S_EVERY." ".$meetbymonth." ".$cal->getWeekday($value->Day),$value->Start));
  118. }
  119. }
  120. $printtable[] = UtilHtml::createTable($tblarr,$tblheader,$tblclass,"","",$tbltdclass);
  121. }
  122. else { $smarty->assign('notice',$N_STUDIES_NONE); }
  123. if($SHOW_HOME_GROUP_TABLE) {
  124. if(count($homegrouparr) != 0) {
  125. $tblarr = array();
  126. $tblheader = array($S_HOME_GROUPS,array($S_TITLE,$S_DAY,$S_START));
  127. $tbltdclass = array("tbl-listing-event","tbl-listing-day","tbl-listing-start");
  128. foreach ($homegrouparr as $value) {
  129. $meetbymonth = " ";
  130. if($value->MeetByMonth != 0) {
  131. $meetbymonth = str_replace(",",", ",str_replace("1",$S_FIRST,str_replace("2",$S_SECOND,
  132. str_replace("3",$S_THIRD,str_replace("4",$S_FOURTH,$value->MeetByMonth)))));
  133. }
  134. array_push($tblarr,array("<a href=\"".$HTTP_DOCUMENT_ROOT.$STUDIES_DIR.
  135. $STUDIES_FILE."?id=".$value->ID."\">".$value->Title."</a>",
  136. $S_EVERY." ".$meetbymonth." ".$cal->getWeekday($value->Day),$value->Start));
  137. }
  138. $printtable[] = UtilHtml::createTable($tblarr,$tblheader,$tblclass,"","",$tbltdclass);
  139. }
  140. else { $smarty->assign('notice',$N_HOME_GROUPS_NONE); }
  141. }
  142. }
  143. $smarty->assign('sidesections',$sidesections);
  144. $smarty->assign('printtable',$printtable);
  145. UtilSmarty::displaySectionPage($smarty);
  146. } ?>
  147. <?php require_once $SERVER_DIRECTORY.$INCLUDE_PATH.$FOOTER; ?>

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