- <?php
- /**
- * <b>Events/Studies</b><br />
- * The events section shows all of the details of the events offered.<br />
- * Types are:
- * - Calendar (links to calendar views)
- * - Studies (Series) mapped by Type
- * - Home Groups
- * This section is searchable.
- * @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_business_logic
- * @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; }
- require_once ($SERVER_DIRECTORY.$INCLUDE_PATH.$CALENDAR_INCLUDE);
-
- $arr_list = array();
- function arrSeparate($var) { return(in_array($var->Type,$GLOBALS['arr_list'])); }
-
- $db = new Database();
- $cal = new Calendar;
- $db_studies = $db->GetClass('studies');
- $data =& $db_studies->GetCurrentStudies();
- $smarty = UtilSmarty::createSmarty();
-
- $id="";
- if(getenv("QUERY_STRING")) {
- if(isset($HTTP_GET_VARS['id'])) {$id = $HTTP_GET_VARS['id'];}
- }
-
- if($id != "") {
- $studydata = $db_studies->GetStudyInfo($id);
- $pagesubtitle = $studydata->Title;
- }
- else {
- $pagesubtitle = $S_STUDIES.", ".$S_SERVICES;
- if($SHOW_HOME_GROUP_TABLE) { $pagesubtitle .= ", ".$S_AND." ".$S_HOME_GROUPS; }
- }
-
- require_once $HTTP_DOCUMENT_ROOT.$INCLUDE_PATH.$HEADER.
- "?pagetitle=".str_replace(" ","%20",htmlentities($S_EVENTS)).
- "&pagesubtitle=".str_replace(" ","%20",htmlentities(stripslashes($pagesubtitle))).
- "&pagedesc=".str_replace(" ","%20",htmlentities($CHURCH_NAME." ".$S_DESC_EVENTS));
-
- $sidesections = array();
- $sidecal = $cal->calHeader();
- $sidesections[] = $sidecal['callinks'];
- $smarty = $cal->calSearchForm($smarty);
- foreach($STUDIES_LIST as $studyname => $studylist) {
- $sidesection = array('Title'=>$studyname,'Links'=>array());
- $arr_list = $STUDIES_LIST_MAP[$studylist];
- $arr = array_filter($data,"arrSeparate");
- foreach($arr as $value) {
- $sidesection['Links'][] = array('LinkPath'=>$HTTP_DOCUMENT_ROOT.$STUDIES_DIR.
- $STUDIES_FILE."?id=".$value->ID,'LinkText'=>$value->Title);
- }
- $sidesections[] = $sidesection;
- }
-
- $printtable = array();
- $data =& $db_studies->GetCurrentStudies();
- $tblclass = "tbl-listing";
- if($data != null) {
- if(getenv("QUERY_STRING")) {
- $tblarr = array();
- $tbltdclass = array("tbl-listing-title","tbl-listing-item");
- $value =& $db_studies->GetStudyInfo($id);
- $tblheader = "<h2>".$value->Title."</h2>";
- $meetbymonth = " ";
- if($value->MeetByMonth != 0) {
- $meetbymonth = str_replace(",",", ",str_replace("1",$S_FIRST,str_replace("2",$S_SECOND,
- str_replace("3",$S_THIRD,str_replace("4",$S_FOURTH,$value->MeetByMonth)))));
- }
- array_push($tblarr,array($S_DAY,$S_EVERY." ".$meetbymonth." ".$cal->getWeekday($value->Day)));
- array_push($tblarr,array($S_TIME,$value->Start." - ".$value->Stop));
- if ($value->iStart != null) {
- $istart = getDate($value->iStart);
- array_push($tblarr,array($S_NEXT_EVENT,"<a href=\"".$HTTP_DOCUMENT_ROOT.
- $CALENDAR_PATH.$ITEM_CAL_FILE."?id=".$value->iID."\">".
- $istart['month']." ".$istart['mday'].", ".$istart['year']."</a>"));
- }
- if($value->LocationName != "No Location" && $value->LocationName != "Submit Form For Location Information") {
- array_push($tblarr,array($S_LOCATION,"<a href=\"".$HTTP_DOCUMENT_ROOT.$LOCATION_DIR.
- $LOCATION_FILE."?id=".$value->LocationID."\">".$value->LocationName."</a>"));
- }
- if ($value->Description != null) {
- array_push($tblarr,array($S_DESC,stripslashes($value->Description)));
- }
- $printtable[] = UtilHtml::createTable($tblarr,$tblheader,$tblclass,"","",$tbltdclass);
- }
- else {
- $tblarr = array();
- $tblheader = array($S_STUDIES." & ".$S_SERVICES,array($S_TITLE,$S_DAY,$S_START));
- $tbltdclass = array("tbl-listing-event","tbl-listing-day","tbl-listing-start");
- $homegrouparr = array();
- if(count($data) != 0) {
- foreach ($data as $value) {
- if($value->Type == $S_HOME_GROUP) { $homegrouparr[] = $value; }
- else {
- $meetbymonth = " ";
- if($value->MeetByMonth != 0) {
- $meetbymonth = str_replace(",",", ",str_replace("1",$S_FIRST,str_replace("2",$S_SECOND,
- str_replace("3",$S_THIRD,str_replace("4",$S_FOURTH,$value->MeetByMonth)))));
- }
- array_push($tblarr,array("<a href=\"".$HTTP_DOCUMENT_ROOT.$STUDIES_DIR.
- $STUDIES_FILE."?id=".$value->ID."\">".$value->Title."</a>",
- $S_EVERY." ".$meetbymonth." ".$cal->getWeekday($value->Day),$value->Start));
- }
- }
- $printtable[] = UtilHtml::createTable($tblarr,$tblheader,$tblclass,"","",$tbltdclass);
- }
- else { $smarty->assign('notice',$N_STUDIES_NONE); }
- if($SHOW_HOME_GROUP_TABLE) {
- if(count($homegrouparr) != 0) {
- $tblarr = array();
- $tblheader = array($S_HOME_GROUPS,array($S_TITLE,$S_DAY,$S_START));
- $tbltdclass = array("tbl-listing-event","tbl-listing-day","tbl-listing-start");
- foreach ($homegrouparr as $value) {
- $meetbymonth = " ";
- if($value->MeetByMonth != 0) {
- $meetbymonth = str_replace(",",", ",str_replace("1",$S_FIRST,str_replace("2",$S_SECOND,
- str_replace("3",$S_THIRD,str_replace("4",$S_FOURTH,$value->MeetByMonth)))));
- }
- array_push($tblarr,array("<a href=\"".$HTTP_DOCUMENT_ROOT.$STUDIES_DIR.
- $STUDIES_FILE."?id=".$value->ID."\">".$value->Title."</a>",
- $S_EVERY." ".$meetbymonth." ".$cal->getWeekday($value->Day),$value->Start));
- }
- $printtable[] = UtilHtml::createTable($tblarr,$tblheader,$tblclass,"","",$tbltdclass);
- }
- else { $smarty->assign('notice',$N_HOME_GROUPS_NONE); }
- }
- }
- $smarty->assign('sidesections',$sidesections);
- $smarty->assign('printtable',$printtable);
- UtilSmarty::displaySectionPage($smarty);
- } ?>
- <?php require_once $SERVER_DIRECTORY.$INCLUDE_PATH.$FOOTER; ?>