- <?php
- /**
- * <b>Resources</b><br />
- * The resources section shows all of the suggested website links by category.
- * @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.4
- * @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_main = $db->GetClass('main');
- $smarty = UtilSmarty::createSmarty();
-
- $cat="";
- if($HTTP_GET_VARS) {
- if(isset($HTTP_GET_VARS['category'])) {$cat = $HTTP_GET_VARS['category'];}
- }
-
- if($cat != "") { $pagesubtitle = $cat; }
- else { $pagesubtitle = ""; }
-
- require_once $HTTP_DOCUMENT_ROOT.$INCLUDE_PATH.$HEADER.
- "?pagetitle=".str_replace(" ","%20",htmlentities($S_RESOURCES)).
- "&pagesubtitle=".str_replace(" ","%20",htmlentities(stripslashes($pagesubtitle))).
- "&pagedesc=".str_replace(" ","%20",htmlentities($CHURCH_NAME." ".$S_DESC_RESOURCES));
-
- $sidesection = array('Title'=>$S_RESOURCES,'Links'=>array());
- $categories = $db_main->GetResourceCategories();
- foreach($categories as $category) {
- $sidesection['Links'][] = array('LinkPath'=>$HTTP_DOCUMENT_ROOT.
- $RESOURCE_FILE."?category=".$category,'LinkText'=>$category);
- }
- $smarty->assign('sidesections',array($sidesection));
-
- if($HTTP_GET_VARS) {
- $resources = $db_main->GetResourcesByCategory($cat);
- $smarty->assign('heading',$cat);
- $listelements = array();
- foreach($resources as $resource) {
- $listelements[] = array('LinkPath'=>$resource->Link,'Title'=>$resource->Title,
- 'SubText'=>$resource->Description);
- }
- $smarty->assign('listelements',$listelements);
- }
- else {
- $smarty->assign('introstatements',array(array('Title'=>$S_RESOURCES,'Text'=>$RESOURCE_INTRO)));
- }
- UtilSmarty::displaySectionPage($smarty);
- ?>
- <?php require_once $SERVER_DIRECTORY.$INCLUDE_PATH.$FOOTER; ?>