From: Steve Sutton Date: Thu, 27 Jun 2013 14:44:28 +0000 (+0000) Subject: Setting up both Horizontal and Verticle Banners X-Git-Tag: v1.0~106 X-Git-Url: http://cvs2.gaslightmedia.com/gitweb/?a=commitdiff_plain;h=5a1edf3b923c540a09f78ed6fe1723a435c03315;p=web%2FMichiganTrailMaps.git Setting up both Horizontal and Verticle Banners Adding them into Toolkit_Page and the template. They are commented out so leif can move --- diff --git a/Toolkit/Banners/config.ini b/Toolkit/Banners/config.ini index aa00acc..0152cdb 100644 --- a/Toolkit/Banners/config.ini +++ b/Toolkit/Banners/config.ini @@ -17,8 +17,8 @@ monthly = "Monthly" ; Available banner positions [positions] -bottom = "Bottom" -side = "Side" +bottom = "Horizontal" +side = "Vertical" ; Thumbnails to use for each position [thumbnails] diff --git a/Toolkit/Page.php b/Toolkit/Page.php index b26921f..64830bc 100755 --- a/Toolkit/Page.php +++ b/Toolkit/Page.php @@ -163,6 +163,12 @@ class Toolkit_Page * @access public */ public function banners(array $page) + { + $this->getHorizontalBanners($page); + $this->getVerticalBanners($page); + } + + function getHorizontalBanners(array $page) { $bannerConf = new Config; $bannerRoot = & $bannerConf->parseConfig( @@ -170,7 +176,8 @@ class Toolkit_Page ); $dbh = Toolkit_Database::getInstance(); - $banners = & Toolkit_Banners_BannersIterator::create('Bottom'); + + $banners = & Toolkit_Banners_BannersIterator::create('Horizontal'); if (defined('MEMBERS_DB') && MEMBERS_DB) { $categoriesIterator = Toolkit_Members_CategoriesIterator::create(); $banners->fetchAllAvailable( @@ -198,8 +205,62 @@ class Toolkit_Page BASE . 'Toolkit/Banners/config.ini', 'IniFile' ); - $this->hasBanner = count($decorators->getIterator()); - if ($this->hasBanner) { + $this->hasHorizontalBanners = count($decorators->getIterator()); + if ($this->hasHorizontalBanners) { + + $mailerFactory = new Toolkit_Banners_MailerFactory( + $bannersRoot, + $GLOBALS['flexyOptions'] + ); + + $notifier = new Toolkit_Banners_Notifier($mailerFactory, $dbh); + + $this->horizontalBannerAds = $decorators->toHtml( + $dbh, new Toolkit_Image_Server(), $notifier, $page['id'] + ); + } + } + } + + function getVerticalBanners(array $page) + { + $bannerConf = new Config; + $bannerRoot = & $bannerConf->parseConfig( + BASE . 'Toolkit/Banners/config.ini', 'IniFile' + ); + + $dbh = Toolkit_Database::getInstance(); + + $banners = & Toolkit_Banners_BannersIterator::create('Vertical'); + if (defined('MEMBERS_DB') && MEMBERS_DB) { + $categoriesIterator = Toolkit_Members_CategoriesIterator::create(); + $banners->fetchAllAvailable( + $dbh, $bannerRoot, $categoriesIterator, $page['id'] + ); + } else { + $banners->fetchAllAssignedToPage($dbh, $bannerRoot, $page['id']); + } + + $availableBanners = $banners->getAvailable(); + + // Are there any banners even available + if (count($availableBanners)) { + $GLOBALS['bottomScripts'][] + = $this->glmAppBaseURL . 'libjs/banner-link.js'; + $decorators = Toolkit_Banners_StaticBannersDecorator::create(); + foreach ($availableBanners as $i) { + $decorator = Toolkit_Banners_VerticalDecorator::create($i); + $decorators->add($decorator); + } + + // application configuration + $conf = new Config; + $bannersRoot = & $conf->parseConfig( + BASE . 'Toolkit/Banners/config.ini', 'IniFile' + ); + + $this->hasVerticleBanners = count($decorators->getIterator()); + if ($this->hasVerticleBanners) { $mailerFactory = new Toolkit_Banners_MailerFactory( $bannersRoot, @@ -208,7 +269,7 @@ class Toolkit_Page $notifier = new Toolkit_Banners_Notifier($mailerFactory, $dbh); - $this->bannerAds = $decorators->toHtml( + $this->verticleBannerAds = $decorators->toHtml( $dbh, new Toolkit_Image_Server(), $notifier, $page['id'] ); } @@ -366,12 +427,12 @@ class Toolkit_Page } else { $this->isHomePage = false; } - + if($this->isHomePage) { $GLOBALS['bottomScripts'][] = $this->glmAppBaseURL . "libjs/plugins/cycle/2.73/jquery.cycle.all.min.js"; $GLOBALS['bottomScripts'][] = $this->baseURL . "libjs/blogRotate.js"; } - + if ($this->_catid != HOME_ID) { $this->parentPageId = $this->_pageGateway->findTopParent($this->_catid); $this->pageId = $this->_catid; diff --git a/templates/template.html b/templates/template.html index 1d18e7d..29dfd77 100755 --- a/templates/template.html +++ b/templates/template.html @@ -30,6 +30,9 @@
+