Footer link item, blog markup but commented, some search markup
authorLaury GvR <laury@gaslightmedia.com>
Thu, 5 Mar 2015 20:33:57 +0000 (15:33 -0500)
committerLaury GvR <laury@gaslightmedia.com>
Thu, 5 Mar 2015 20:33:57 +0000 (15:33 -0500)
12 files changed:
Toolkit/Blogs/Database/application.sql [new file with mode: 0644]
Toolkit/Blogs/Database/tables/blog.sql [new file with mode: 0644]
Toolkit/Blogs/Database/tables/item.sql [new file with mode: 0644]
Toolkit/Blogs/FeedReader.php [new file with mode: 0644]
Toolkit/Blogs/Models/Blog.php [new file with mode: 0644]
Toolkit/Blogs/Models/BlogMapper.php [new file with mode: 0644]
Toolkit/Blogs/Models/Item.php [new file with mode: 0644]
Toolkit/Blogs/Views/feed.html [new file with mode: 0644]
Toolkit/Blogs/application.ini [new file with mode: 0644]
Toolkit/Page.php
smarty/templates_c/93af1d6e2076f6bcb4591e4d31a39627ed944810.file.default.html.php [new file with mode: 0644]
templates/template.html

diff --git a/Toolkit/Blogs/Database/application.sql b/Toolkit/Blogs/Database/application.sql
new file mode 100644 (file)
index 0000000..8e0f8d7
--- /dev/null
@@ -0,0 +1,7 @@
+CREATE SCHEMA blogs;
+
+GRANT ALL ON SCHEMA blogs TO nobody;
+
+\i ./tables/blog.sql
+\i ./tables/item.sql
+
diff --git a/Toolkit/Blogs/Database/tables/blog.sql b/Toolkit/Blogs/Database/tables/blog.sql
new file mode 100644 (file)
index 0000000..10d64da
--- /dev/null
@@ -0,0 +1,14 @@
+DROP TABLE IF EXISTS blogs.blog;
+
+CREATE TABLE blogs.blog (
+    id SERIAL,
+    title TEXT,
+    url TEXT,
+    description TEXT,
+    build TIMESTAMP with time zone,
+    checkdate TIMESTAMP with time zone,
+    PRIMARY KEY (id)
+);
+
+GRANT ALL ON blogs.blog TO nobody;
+GRANT ALL ON blogs.blog_id_seq TO nobody;
diff --git a/Toolkit/Blogs/Database/tables/item.sql b/Toolkit/Blogs/Database/tables/item.sql
new file mode 100644 (file)
index 0000000..09133f4
--- /dev/null
@@ -0,0 +1,14 @@
+DROP TABLE IF EXISTS blogs.item;
+
+CREATE TABLE blogs.item (
+    id SERIAL,
+    title TEXT,
+    url TEXT,
+    guid TEXT,
+    description TEXT,
+    pubdate TIMESTAMP with time zone,
+    PRIMARY KEY (id)
+);
+
+GRANT ALL ON blogs.item TO nobody;
+GRANT ALL ON blogs.item_id_seq TO nobody;
diff --git a/Toolkit/Blogs/FeedReader.php b/Toolkit/Blogs/FeedReader.php
new file mode 100644 (file)
index 0000000..ac61b5a
--- /dev/null
@@ -0,0 +1,196 @@
+<?php
+
+/**
+ * FeedReader.php
+ *
+ * PHP version 5.3
+ *
+ * @category  Toolkit
+ * @package   PrWeb
+ * @author    Steve Sutton <steve@gaslightmedia.com>
+ * @copyright 2013 Gaslight Media
+ * @license   Gaslight Media
+ * @version   SVN: (0.1)
+ * @link      <>
+ */
+
+/**
+ * Toolkit_PrWeb_FeedReader
+ *
+ * Check the RSS feed on a regular bases to see if there's updates.
+ * If an update is found it removes all items adn creates new ones from the
+ * Feed.
+ *
+ * @category  Toolkit
+ * @package   PrWeb
+ * @author    Steve Sutton <steve@gaslightmedia.com>
+ * @copyright 2013 Gaslight Media
+ * @license   Gaslight Media
+ * @release   Release: (0.1)
+ * @link      <>
+ */
+class Toolkit_Blogs_FeedReader
+{
+
+    /**
+     * PDO Connection to database
+     *
+     * @var PDO
+     */
+    private $_dbh;
+
+    /**
+     *
+     * @var Toolkit_Blogs_Models_BlogMapper
+     */
+    private $_blogMapper;
+
+    /**
+     * PrWeb Record
+     *
+     * @var Toolkit_Blogs_Models_Blog
+     */
+    private $_blog;
+
+    /**
+     * Items from the PrWeb Feed Rss
+     *
+     * @var ArrayObject
+     */
+    private $_items;
+
+
+    /**
+     * time interval to check for new updates from feed
+     * time is in minutes.
+     */
+    const FEED_CHECK_INTERVAL = 5;
+    const FEED_CHECK_PART     = 'hours';
+    //const FEED_RSS_URL        = 'http://michigantrailmaps.com/blog/?feed=rss2';
+    const FEED_RSS_URL        = 'http://michigantrailmaps.wordpress.com/feed/';
+    const HTML_TPL            = 'feed.html';
+
+
+    /**
+     * Creates Object of FeedReader for PrWeb
+     *
+     * @param PDO                              $pdo         Database Connection
+     * @param Toolkit_Blogs_Models_BlogMapper $blogMapper Mapper Object for prWeb
+     */
+    public function __construct(
+        PDO $pdo,
+        Toolkit_Blogs_Models_BlogMapper $blogMapper
+    ) {
+        $this->_dbh        = $pdo;
+        $this->_blogMapper = $blogMapper;
+        $this->_blog       = $this->_blogMapper->fetchBlog();
+        $this->_items      = $this->_blogMapper->fetchAllItems();
+        $this->checkForUpdates();
+    }
+
+    /**
+     * Checks the last build date for prWeb record
+     *
+     * @return boolean
+     */
+    public function checkForUpdates()
+    {
+        if (!$this->_blog) {
+            $prWebRss = $this->fetchRssFeed();
+            if ($prWebRss) {
+                $this->updateFeedData($prWebRss);
+                // if the items are updated then refetch them
+                $this->_blog = $this->_blogMapper->fetchBlog();
+                $this->_items = $this->_blogMapper->fetchAllItems();
+            }
+            return true;
+        }
+        $currentTime = new DateTime();
+        $buildDate = new DateTime($this->_blog->getCheckdate());
+        $buildDate->modify('+' . self::FEED_CHECK_INTERVAL . ' ' . self::FEED_CHECK_PART);
+        if ($currentTime > $buildDate) {
+            $prWebRss = $this->fetchRssFeed();
+            if ($prWebRss) {
+                $this->updateFeedData($prWebRss);
+                // if the items are updated then refetch them
+                $this->_blog = $this->_blogMapper->fetchBlog();
+                $this->_items = $this->_blogMapper->fetchAllItems();
+            } else {
+                // update the check date
+                $this->_blog->setCheckdate(date('Y-m-d H:i:s'));
+                $this->_blogMapper->savePrWeb($this->_blog);
+            }
+        }
+    }
+
+    public function fetchRssFeed()
+    {
+        try {
+            $blogRss = Zend_Feed::import(self::FEED_RSS_URL);
+        } catch (Zend_Feed_Exception $e) {
+            Toolkit_Common::handleError($e);
+            return false;
+        }
+        return $blogRss;
+    }
+
+    public function updateFeedData($blogRss)
+    {
+        if (!$this->_blog) {
+            $this->_blog = Toolkit_Blogs_Models_Blog::createByValues(
+                array(
+                    'title'       => trim($blogRss->title()),
+                    'url'         => $blogRss->link(),
+                    'description' => trim($blogRss->description()),
+                    'build'       => trim($blogRss->lastBuildDate()),
+                    'checkdate'   => date('Y-m-d H:i:s')
+                )
+            );
+        } else {
+            $this->_blog->setBuild(trim($blogRss->lastBuildDate()));
+            $this->_blog->setCheckdate(date('Y-m-d H:i:s'));
+            $this->_blog->setDescription(trim($blogRss->description()));
+            $this->_blog->setTitle(trim($blogRss->title()));
+            $this->_blog->setUrl($blogRss->link());
+        }
+        $this->_blogMapper->savePrWeb($this->_blog);
+        $items = new ArrayObject();
+        // Loop over each channel item and store relevant data
+        $index = 0;
+        foreach ($blogRss as $item) {
+            $items->offsetSet($index, array(
+                'title'       => $item->title(),
+                'link'        => $item->link(),
+                'url'         => $item->link(),
+                'guid'        => $item->guid(),
+                'pubdate'     => $item->pubDate(),
+                'description' => $item->description()
+            ));
+            ++$index;
+        }
+        $this->_blogMapper->saveAllItems($items);
+    }
+
+    public function toHtml(HTML_Template_Flexy $tpl)
+    {
+        $glmBaseUrl = ($_SERVER['HTTPS'] == 'on')
+            ? GLM_APP_BASE_SECURE_URL
+            : GLM_APP_BASE_URL;
+        $GLOBALS['bottomScripts'][] = $glmBaseUrl . 'libjs/external.js';
+        $tpl->compile(self::HTML_TPL);
+        $page        = new stdClass();
+        $page->items = $this->_items;
+        $page->prWeb = $this->_blog;
+        return $tpl->bufferedOutputObject($page);
+    }
+
+    public function fetchMostRecent()
+    {
+        return array(
+            'blog'  => $this->_blog,
+            'items' => $this->_items
+        );
+    }
+
+
+}
diff --git a/Toolkit/Blogs/Models/Blog.php b/Toolkit/Blogs/Models/Blog.php
new file mode 100644 (file)
index 0000000..04c92ef
--- /dev/null
@@ -0,0 +1,133 @@
+<?php
+
+/**
+ * PrWeb.php
+ *
+ * PHP version 5.3
+ *
+ * @category  Toolkit
+ * @package   PrWeb
+ * @author    Steve Sutton <steve@gaslightmedia.com>
+ * @copyright 2013 Gaslight Media
+ * @license   Gaslight Media
+ * @version   SVN: (0.1)
+ * @link      <>
+ */
+
+/**
+ * Toolkit_Blogs_Models_Blog
+ *
+ * Representation of the PrWeb table
+ *
+ * @category  Toolkit
+ * @package   PrWeb
+ * @author    Steve Sutton <steve@gaslightmedia.com>
+ * @copyright 2013 Gaslight Media
+ * @license   Gaslight Media
+ * @release   Release: (0.1)
+ * @link      <>
+ */
+class Toolkit_Blogs_Models_Blog
+{
+    private $_id;
+    private $_title;
+    private $_url;
+    private $_description;
+    private $_build;
+    private $_checkdate;
+
+
+    const TABLE_NAME = 'blogs.blog';
+    const PRI_KEY    = 'id';
+
+
+    private function __construct($values)
+    {
+        extract($values);
+        $this->setBuild($build)
+            ->setCheckdate($checkdate)
+            ->setDescription($description)
+            ->setTitle($title)
+            ->setUrl($url);
+        if ($id = filter_var($id, FILTER_VALIDATE_INT)) {
+            $this->setId($id);
+        }
+    }
+
+    static public function createByValues($values)
+    {
+        if (is_array($values) && !empty($values)) {
+            return new Toolkit_Blogs_Models_Blog($values);
+        } else {
+            return false;
+        }
+    }
+
+    public function getId()
+    {
+        return $this->_id;
+    }
+
+    public function setId($id)
+    {
+        $this->_id = $id;
+        return $this;
+    }
+
+    public function getTitle()
+    {
+        return $this->_title;
+    }
+
+    public function setTitle($title)
+    {
+        $this->_title = $title;
+        return $this;
+    }
+
+    public function getUrl()
+    {
+        return $this->_url;
+    }
+
+    public function setUrl($url)
+    {
+        $this->_url = $url;
+        return $this;
+    }
+
+    public function getDescription()
+    {
+        return $this->_description;
+    }
+
+    public function setDescription($description)
+    {
+        $this->_description = $description;
+        return $this;
+    }
+
+    public function getBuild()
+    {
+        return $this->_build;
+    }
+
+    public function setBuild($build)
+    {
+        $this->_build = $build;
+        return $this;
+    }
+
+    public function getCheckdate()
+    {
+        return $this->_checkdate;
+    }
+
+    public function setCheckdate($checkdate)
+    {
+        $this->_checkdate = $checkdate;
+        return $this;
+    }
+
+
+}
diff --git a/Toolkit/Blogs/Models/BlogMapper.php b/Toolkit/Blogs/Models/BlogMapper.php
new file mode 100644 (file)
index 0000000..6b67a68
--- /dev/null
@@ -0,0 +1,206 @@
+<?php
+
+/**
+ * PrWebMapper.php
+ *
+ * PHP version 5.3
+ *
+ * @category  Toolkit
+ * @package   PrWeb
+ * @author    Steve Sutton <steve@gaslightmedia.com>
+ * @copyright 2013 Gaslight Media
+ * @license   Gaslight Media
+ * @version   SVN: (0.1)
+ * @link      <>
+ */
+
+/**
+ * Toolkit_Blogs_Models_BlogMapper
+ *
+ * Mapper Object for dealing with all database queries for generating
+ * the object for prweb and items.
+ *
+ * @category  Toolkit
+ * @package   PrWeb
+ * @author    Steve Sutton <steve@gaslightmedia.com>
+ * @copyright 2013 Gaslight Media
+ * @license   Gaslight Media
+ * @release   Release: (0.1)
+ * @link      <>
+ */
+class Toolkit_Blogs_Models_BlogMapper
+{
+    /**
+     * PDO Connection to database
+     *
+     * @var PDO
+     */
+    private $_dbh;
+
+    /**
+     * There's only one prWeb record
+     */
+    const PRWEB_ID = 1;
+
+    /**
+     * Creates an object of type PrWebMapper
+     *
+     * @param PDO $pdo Database Connection
+     */
+    public function __construct(PDO $pdo)
+    {
+        $this->_dbh = $pdo;
+    }
+
+    /**
+     * Return the prweb record or false if none exists
+     *
+     * @return boolean | Toolkit_Blogs_Models_Blog
+     */
+    public function fetchBlog()
+    {
+        try {
+            $sql = "
+            SELECT *
+              FROM " . Toolkit_Blogs_Models_Blog::TABLE_NAME ."
+             WHERE " . Toolkit_Blogs_Models_Blog::PRI_KEY . " = "
+                . self::PRWEB_ID;
+            $stmt = $this->_dbh->query($sql);
+            if ($stmt->rowCount() > 0) {
+                return Toolkit_Blogs_Models_Blog::createByValues(
+                    $stmt->fetch(PDO::FETCH_ASSOC)
+                );
+            } else {
+                return false;
+            }
+
+        } catch (PDOException $e) {
+            Toolkit_Common::handleError($e);
+        }
+
+    }
+
+    /**
+     * Return the items record or false if none exists
+     *
+     * @return boolean | Toolkit_Blogs_Models_Blog
+     */
+    public function fetchAllItems()
+    {
+        $items = new ArrayObject();
+        try {
+            $sql = "
+              SELECT *
+                FROM " . Toolkit_Blogs_Models_Item::TABLE_NAME ."
+            ORDER BY " . Toolkit_Blogs_Models_Item::SORT;
+            $stmt = $this->_dbh->query($sql);
+            if ($stmt->rowCount() > 0) {
+                $index = 0;
+                while ($values = $stmt->fetch(PDO::FETCH_ASSOC)) {
+                    $items->offsetSet(
+                        $index,
+                        Toolkit_Blogs_Models_Item::createByValues(
+                            $values
+                        )
+                    );
+                    ++$index;
+                }
+                return $items;
+            } else {
+                return false;
+            }
+
+        } catch (PDOException $e) {
+            Toolkit_Common::handleError($e);
+        }
+
+    }
+
+    public function savePrWeb(
+        Toolkit_Blogs_Models_Blog $prWeb
+    ) {
+        if ($prWeb->getId()) {
+            $sql = "
+            UPDATE " . Toolkit_Blogs_Models_Blog::TABLE_NAME . "
+               SET title = :title,
+                   url = :url,
+                   description = :description,
+                   build = :build,
+                   checkdate = :checkdate
+             WHERE " . Toolkit_Blogs_Models_Blog::PRI_KEY . " = :id";
+        } else {
+            $sql = "
+            INSERT INTO " . Toolkit_Blogs_Models_Blog::TABLE_NAME . "
+            (id, title, url, description, build, checkdate)
+            VALUES
+            (" . self::PRWEB_ID . ", :title, :url, :description, :build, :checkdate)
+            RETURNING " . Toolkit_Blogs_Models_Blog::PRI_KEY;
+        }
+        $stmt = $this->_dbh->prepare($sql);
+        $stmt->bindParam(':title', $prWeb->getTitle());
+        $stmt->bindParam(':url', $prWeb->getUrl());
+        $stmt->bindParam(':description', $prWeb->getDescription());
+        $stmt->bindParam(':build', $prWeb->getBuild());
+        $stmt->bindParam(':checkdate', $prWeb->getCheckdate());
+        if ($prWeb->getId()) {
+            $stmt->bindParam(':id', $prWeb->getId(), PDO::PARAM_INT);
+        }
+        $stmt->execute();
+        if (!$prWeb->getId()) {
+            $prWeb->setId($stmt->fetchColumn());
+        }
+        return $prWeb;
+    }
+
+    public function saveAllItems(ArrayObject $items)
+    {
+        $this->_dbh->beginTransaction();
+        $this->_dbh->query(
+            "DELETE FROM " . Toolkit_Blogs_Models_Item::TABLE_NAME
+        );
+        foreach ($items as $item) {
+            $this->saveItem(
+                Toolkit_Blogs_Models_Item::createByValues($item)
+            );
+        }
+        $this->_dbh->commit();
+    }
+
+    public function saveItem(
+        Toolkit_Blogs_Models_Item $item
+    ) {
+         if ($item->getId()) {
+            $sql = "
+            UPDATE " . Toolkit_Blogs_Models_Item::TABLE_NAME . "
+               SET title = :title,
+                   url = :url,
+                   guid = :guid,
+                   description = :description,
+                   pubdate = :pubdate
+             WHERE " . Toolkit_Blogs_Models_Item::PRI_KEY . " = :id";
+        } else {
+            $sql = "
+            INSERT INTO " . Toolkit_Blogs_Models_Item::TABLE_NAME . "
+            (title, url, guid, description, pubdate)
+            VALUES
+            (:title, :url, :guid, :description, :pubdate)
+            RETURNING " . Toolkit_Blogs_Models_Item::PRI_KEY;
+        }
+        $stmt = $this->_dbh->prepare($sql);
+        $stmt->bindParam(':title', $item->getTitle());
+        $stmt->bindParam(':url', $item->getUrl());
+        $stmt->bindParam(':guid', $item->getGuid());
+        $stmt->bindParam(':description', $item->getDescription());
+        $stmt->bindParam(':pubdate', $item->getPubdate());
+        if ($item->getId()) {
+            $stmt->bindParam(':id', $item->getId(), PDO::PARAM_INT);
+        }
+        $stmt->execute();
+        if (!$item->getId()) {
+            $item->setId($stmt->fetchColumn());
+        }
+        return $item;
+    }
+
+
+}
diff --git a/Toolkit/Blogs/Models/Item.php b/Toolkit/Blogs/Models/Item.php
new file mode 100644 (file)
index 0000000..db8a4e2
--- /dev/null
@@ -0,0 +1,138 @@
+<?php
+
+/**
+ * Item.php
+ *
+ * PHP version 5.3
+ *
+ * @category  Toolkit
+ * @package   PrWeb
+ * @author    Steve Sutton <steve@gaslightmedia.com>
+ * @copyright 2013 Gaslight Media
+ * @license   Gaslight Media
+ * @version   SVN: (0.1)
+ * @link      <>
+ */
+
+/**
+ * Toolkit_Blogs_Models_Item
+ *
+ * Representation of the Item table
+ *
+ * @category  Toolkit
+ * @package   PrWeb
+ * @author    Steve Sutton <steve@gaslightmedia.com>
+ * @copyright 2013 Gaslight Media
+ * @license   Gaslight Media
+ * @release   Release: (0.1)
+ * @link      <>
+ */
+class Toolkit_Blogs_Models_Item
+{
+    private $_id;
+    private $_title;
+    private $_url;
+    private $_guid;
+    private $_description;
+    private $_pubdate;
+
+    const TABLE_NAME = 'blogs.item';
+    const PRI_KEY    = 'id';
+    const SORT       = 'pubdate desc';
+
+    private function __construct($values)
+    {
+        extract($values);
+        $this->setPubdate($pubdate)
+            ->setDescription($description)
+            ->setTitle($title)
+            ->setUrl($url)
+            ->setGuid($guid);
+        if ($id = filter_var($id, FILTER_VALIDATE_INT)) {
+            $this->setId($id);
+        }
+    }
+
+    static public function createByValues($values)
+    {
+        if (is_array($values) && !empty($values)) {
+            return new Toolkit_Blogs_Models_Item($values);
+        } else {
+            return false;
+        }
+    }
+
+    public function getId()
+    {
+        return $this->_id;
+    }
+
+    public function setId($id)
+    {
+        $this->_id = $id;
+        return $this;
+    }
+
+    public function getTitle()
+    {
+        return $this->_title;
+    }
+
+    public function setTitle($title)
+    {
+        $this->_title = $title;
+        return $this;
+    }
+
+    public function getUrl()
+    {
+        return $this->_url;
+    }
+
+    public function setUrl($url)
+    {
+        $this->_url = $url;
+        return $this;
+    }
+
+    public function getGuid()
+    {
+        return $this->_guid;
+    }
+
+    public function setGuid($guid)
+    {
+        $this->_guid = $guid;
+        return $this;
+    }
+
+    public function getDescription()
+    {
+        return $this->_description;
+    }
+
+    public function setDescription($description)
+    {
+        $this->_description = $description;
+        return $this;
+    }
+
+    public function getPubdate()
+    {
+        return $this->_pubdate;
+    }
+
+    public function setPubdate($pubdate)
+    {
+        $this->_pubdate = $pubdate;
+        return $this;
+    }
+
+    public function getPubdateFormated($format)
+    {
+        $time = strtotime($this->getPubdate());
+        return date($format, $time);
+    }
+
+
+}
diff --git a/Toolkit/Blogs/Views/feed.html b/Toolkit/Blogs/Views/feed.html
new file mode 100644 (file)
index 0000000..df3bb30
--- /dev/null
@@ -0,0 +1,52 @@
+<style>
+    #prWeb-feed-rss {
+        width: 600px;
+    }
+    #prWeb-feed-rss header {
+        position: relative;
+        margin: 5 0;
+        height: auto;
+        margin-bottom: 5px;
+    }
+    #prWeb-feed-rss h1 {
+        margin: 1em 0 0.4em;
+        color: black;
+        font-size: 2.0rem;
+        font-weight: normal;
+    }
+    #prWeb-feed-rss h2 {
+        font-size: smaller;
+        font-weight: normal;
+    }
+    #prWeb-feed-rss article {
+        width: 100%;
+    }
+    #prWeb-feed-rss article h1 {
+        font-size: medium;
+        font-weight: normal;
+        color: #00456C;
+    }
+
+</style>
+<section id="prWeb-feed-rss">
+    <header>
+        <hgroup>
+            <h1>{prWeb.getTitle()}</h1>
+            <h2>{prWeb.getDescription()}</h2>
+        </hgroup>
+    </header>
+
+    <article class="prWeb-item" flexy:foreach="items,item">
+        <header>
+            <hgroup>
+                <h1>{item.getTitle()}</h1>
+            </hgroup>
+        </header>
+        <time datetime="{item.getpubDate()}" pubdate>
+            {item.getPubdateFormated(#F j, Y#)}
+        </time>
+        <div>
+            {item.getDescription():h}
+        </div>
+    </article>
+</section>
diff --git a/Toolkit/Blogs/application.ini b/Toolkit/Blogs/application.ini
new file mode 100644 (file)
index 0000000..c053332
--- /dev/null
@@ -0,0 +1,28 @@
+; production server configuration for application
+[production]
+flexyOptions.templateDir     = BASE "Toolkit/Blogs/Views"
+flexyOptions.compileDir      = BASE "Toolkit/Blogs/Views/compiled"
+flexyOptions.url_rewrite     = "baseurl/::" BASE_URL ",basesecureurl/::" BASE_SECURE_URL
+flexyOptions.forceCompile    = Off
+flexyOptions.locale          = "en"
+flexyOptions.debug           = Off
+flexyOptions.allowPHP        = On
+flexyOptions.flexyIgnore     = On
+flexyOptions.globals         = On
+flexyOptions.globalfunctions = On
+flexyOptions.privates        = On
+flexyOptions.compiler        = "Flexy"
+
+; development server configuration inherits from production and
+; overrides values as needed
+[development : production]
+
+; Chuck's server configuration inherits from development and
+; overrides values as needed
+[chuck : development]
+
+; Steve's server configuration inherits from development and
+; overrides values as needed
+[steve : development]
+;flexyOptions.forceCompile = On
+;flexyOptions.strict = On
\ No newline at end of file
index ef98339..27e0767 100755 (executable)
@@ -622,7 +622,11 @@ class Toolkit_Page
         ) {
             $this->_events($this->_toolboxPage, $this->_pageGateway);
         }
-
+        
+        if ($this->_catid == HOME_ID) {
+            $this->_blogReader();
+        }
+        
         if (   defined("GLM_BLOCKS")
             && GLM_BLOCKS
             && !filter_var($_REQUEST[ 'sitemap'], FILTER_VALIDATE_INT)
@@ -1096,6 +1100,16 @@ class Toolkit_Page
         $this->rotatingImages = $decorator->toHtml($is);
     }
 
+    private function _blogReader()
+    {
+        $dbh        = Toolkit_Database::getInstance();
+        $blogMapper = new Toolkit_Blogs_Models_BlogMapper($dbh);
+        $feedReader = new Toolkit_Blogs_FeedReader($dbh, $blogMapper);
+
+        $feed = $feedReader->fetchMostRecent();
+        $this->feed = $feed['items'];
+    }
+    
     /**
      * Add Weather module
      *
diff --git a/smarty/templates_c/93af1d6e2076f6bcb4591e4d31a39627ed944810.file.default.html.php b/smarty/templates_c/93af1d6e2076f6bcb4591e4d31a39627ed944810.file.default.html.php
new file mode 100644 (file)
index 0000000..fcfb17b
--- /dev/null
@@ -0,0 +1,230 @@
+<?php /* Smarty version Smarty-3.1.14, created on 2015-03-05 11:55:01
+         compiled from "/var/www/server/CommonApps/GLMSearch/V1.1/templates/default.html" */ ?>
+<?php /*%%SmartyHeaderCode:100253614654f88a65072fc9-21923999%%*/if(!defined('SMARTY_DIR')) exit('no direct access allowed');
+$_valid = $_smarty_tpl->decodeProperties(array (
+  'file_dependency' => 
+  array (
+    '93af1d6e2076f6bcb4591e4d31a39627ed944810' => 
+    array (
+      0 => '/var/www/server/CommonApps/GLMSearch/V1.1/templates/default.html',
+      1 => 1406920034,
+      2 => 'file',
+    ),
+  ),
+  'nocache_hash' => '100253614654f88a65072fc9-21923999',
+  'function' => 
+  array (
+  ),
+  'variables' => 
+  array (
+    'thisScript' => 0,
+    'query' => 0,
+    'result' => 0,
+    'haveResult' => 0,
+    'matchAll' => 0,
+    'doc' => 0,
+    'snip' => 0,
+  ),
+  'has_nocache_code' => false,
+  'version' => 'Smarty-3.1.14',
+  'unifunc' => 'content_54f88a652fc715_91610787',
+),false); /*/%%SmartyHeaderCode%%*/?>
+<?php if ($_valid && !is_callable('content_54f88a652fc715_91610787')) {function content_54f88a652fc715_91610787($_smarty_tpl) {?><!-- \r
+    GLM OpenSearchServer Default Display Page\r
+-->\r
+       \r
+       <style type="text/css">\r
+           #GLMSearch {\r
+               padding: 1em;\r
+           }\r
+           #GLMSformContainer {}\r
+           #GLMSformContainer input {}\r
+           .GLMSresultsHeader {\r
+               margin-top: 1em;\r
+               margin-bottom: 2em;\r
+           }\r
+           .GLMSresultsSummary {}\r
+           .GLMSresultsNavContainer {}\r
+           .GLMSresultsNavContainer a {}\r
+           .GLMSresultsNavInactive {\r
+               color: lightgray;\r
+           }\r
+           #GLMSresultsContainer {\r
+           }\r
+           .GLMSresultContainer {\r
+               color: #1E130A;\r
+               font-family: Arial,Helvetica,sans-serif;\r
+               font-size: 12px;\r
+               margin-bottom: 2em;\r
+           }\r
+           .GLMSresultTitle {\r
+               color: #0000CC;\r
+               text-decoration: underline;\r
+               font-weight: bold;\r
+               margin-bottom: .3em;\r
+           }\r
+           .GLMSresultText {}\r
+           .GLMSresultSnippets {}\r
+           .GLMSresultSnippets b {\r
+               border: solid lightgray 1px;\r
+               padding: .1em;\r
+           }\r
+           .GLMSresultUrl {\r
+               color: #008000;\r
+               margin-top: .2em;\r
+           }\r
+           #slideshow {\r
+               display: none;\r
+           }\r
+       </style>\r
+\r
+        <div id="GLMSearch">\r
+\r
+               <div id="GLMSformContainer">\r
+                   <h1>Search this Website</h1>\r
+                               <form action="<?php echo $_smarty_tpl->tpl_vars['thisScript']->value;?>
+" name="search" method="get">\r
+                       <input type="hidden" name="GLMSearch" value="true">\r
+                                   <input type="hidden" name="start" value="0">\r
+                                   <input type="hidden" name="rows" value="10">\r
+                                   <input type="text" name="query" value="<?php echo $_smarty_tpl->tpl_vars['query']->value;?>
+">\r
+                                   <input type="checkbox" name="matchAll" <?php if ($_smarty_tpl->tpl_vars['result']->value->operator=='AND'){?>checked<?php }?>> Match all words\r
+                       <input type="submit" id="submit" value="Search">\r
+                               </form>\r
+               </div>\r
+\r
+<?php if ($_smarty_tpl->tpl_vars['haveResult']->value){?>\r
+\r
+  <?php if ($_smarty_tpl->tpl_vars['result']->value->totalResults>0){?>\r
+  \r
+            <!-- Results Header - Top -->\r
+            \r
+            <div class="GLMSresultsHeader">\r
+\r
+                   <div class="GLMSresultsSummary">\r
+                       Showing <?php echo $_smarty_tpl->tpl_vars['result']->value->firstResultOnPage;?>
+ through <?php echo $_smarty_tpl->tpl_vars['result']->value->lastResultOnPage;?>
+ of <?php echo $_smarty_tpl->tpl_vars['result']->value->totalResults;?>
+ results.\r
+                   </div> \r
+                   \r
+                   <!-- Results Navigation -->\r
+                       \r
+                       <div class="GLMSresultsNavContainer">\r
+\r
+           <?php if ($_smarty_tpl->tpl_vars['result']->value->previousPageStartIndex!==false){?> \r
+                       <a href="<?php echo $_smarty_tpl->tpl_vars['thisScript']->value;?>
+?GLMSearch=true&query=<?php echo rawurlencode($_smarty_tpl->tpl_vars['query']->value);?>
+&matchAll=<?php echo $_smarty_tpl->tpl_vars['matchAll']->value;?>
+&start=<?php echo $_smarty_tpl->tpl_vars['result']->value->previousPageStartIndex;?>
+&rows=<?php echo $_smarty_tpl->tpl_vars['result']->value->resultsPerPage;?>
+">Previous Results</a>\r
+           <?php }else{ ?>\r
+                       <span class="GLMSresultsNavInactive">Previous Results</span>\r
+           <?php }?>\r
+                       -\r
+           <?php if ($_smarty_tpl->tpl_vars['result']->value->nextPageStartIndex!==false){?>\r
+                       <a href="<?php echo $_smarty_tpl->tpl_vars['thisScript']->value;?>
+?GLMSearch=true&query=<?php echo rawurlencode($_smarty_tpl->tpl_vars['query']->value);?>
+&matchAll=<?php echo $_smarty_tpl->tpl_vars['matchAll']->value;?>
+&start=<?php echo $_smarty_tpl->tpl_vars['result']->value->nextPageStartIndex;?>
+&rows=<?php echo $_smarty_tpl->tpl_vars['result']->value->resultsPerPage;?>
+">Next Results</a>    \r
+           <?php }else{ ?>\r
+                       <span class="GLMSresultsNavInactive">Next Results</span>\r
+           <?php }?>\r
+                       </div>\r
+       \r
+            </div>\r
+                        \r
+            <!-- Search results -->\r
+            \r
+            <div id="GLMSresultsContainer">\r
+\r
+           <?php  $_smarty_tpl->tpl_vars['doc'] = new Smarty_Variable; $_smarty_tpl->tpl_vars['doc']->_loop = false;
+ $_from = $_smarty_tpl->tpl_vars['result']->value->documents; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array');}
+foreach ($_from as $_smarty_tpl->tpl_vars['doc']->key => $_smarty_tpl->tpl_vars['doc']->value){
+$_smarty_tpl->tpl_vars['doc']->_loop = true;
+?>\r
+                   <div class="GLMSresultContainer">\r
+                   \r
+                       <div class="GLMSresultTitle">\r
+                           <a href="<?php echo $_smarty_tpl->tpl_vars['doc']->value->url->value;?>
+"><?php echo $_smarty_tpl->tpl_vars['doc']->value->title->value;?>
+</a>\r
+                       </div>\r
+                       \r
+                       <div class="GLMSresultSnippets">\r
+            <?php  $_smarty_tpl->tpl_vars["snip"] = new Smarty_Variable; $_smarty_tpl->tpl_vars["snip"]->_loop = false;
+ $_from = $_smarty_tpl->tpl_vars['doc']->value->content->snippets; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array');}
+ $_smarty_tpl->tpl_vars["snip"]->total= $_smarty_tpl->_count($_from);
+ $_smarty_tpl->tpl_vars["snip"]->iteration=0;
+foreach ($_from as $_smarty_tpl->tpl_vars["snip"]->key => $_smarty_tpl->tpl_vars["snip"]->value){
+$_smarty_tpl->tpl_vars["snip"]->_loop = true;
+ $_smarty_tpl->tpl_vars["snip"]->iteration++;
+ $_smarty_tpl->tpl_vars["snip"]->last = $_smarty_tpl->tpl_vars["snip"]->iteration === $_smarty_tpl->tpl_vars["snip"]->total;
+ $_smarty_tpl->tpl_vars['smarty']->value['foreach']["snip"]['last'] = $_smarty_tpl->tpl_vars["snip"]->last;
+?>                     \r
+                           <?php echo $_smarty_tpl->tpl_vars['snip']->value;?>
+\r
+                  <?php if ((!$_smarty_tpl->getVariable('smarty')->value['foreach']['snip']['last'])){?><br>----<br><?php }?> \r
+               <?php } ?>\r
+                       </div>\r
+                       <div class="GLMSresultUrl"><?php echo $_smarty_tpl->tpl_vars['doc']->value->url->value;?>
+</div>\r
+                   </div>                     \r
+           <?php } ?>\r
+                   \r
+               </div>\r
+\r
+            <!-- Results Header - Bottom -->\r
+            \r
+            <div class="GLMSresultsHeader">\r
+\r
+                <div class="GLMSresultsSummary">\r
+                    Showing <?php echo $_smarty_tpl->tpl_vars['result']->value->firstResultOnPage;?>
+ through <?php echo $_smarty_tpl->tpl_vars['result']->value->lastResultOnPage;?>
+ of <?php echo $_smarty_tpl->tpl_vars['result']->value->totalResults;?>
+ results.\r
+                </div> \r
+                \r
+                <!-- Results Navigation -->\r
+                \r
+                <div class="GLMSresultsNavContainer">\r
+\r
+        <?php if ($_smarty_tpl->tpl_vars['result']->value->previousPageStartIndex!==false){?> \r
+                    <a href="<?php echo $_smarty_tpl->tpl_vars['thisScript']->value;?>
+?GLMSearch=true&query=<?php echo rawurlencode($_smarty_tpl->tpl_vars['query']->value);?>
+&matchAll=<?php echo $_smarty_tpl->tpl_vars['matchAll']->value;?>
+&start=<?php echo $_smarty_tpl->tpl_vars['result']->value->previousPageStartIndex;?>
+&rows=<?php echo $_smarty_tpl->tpl_vars['result']->value->resultsPerPage;?>
+">Previous Results</a>\r
+        <?php }else{ ?>\r
+                    <span class="GLMSresultsNavInactive">Previous Results</span>\r
+        <?php }?>\r
+                    -\r
+        <?php if ($_smarty_tpl->tpl_vars['result']->value->nextPageStartIndex!==false){?>\r
+                    <a href="<?php echo $_smarty_tpl->tpl_vars['thisScript']->value;?>
+?GLMSearch=true&query=<?php echo rawurlencode($_smarty_tpl->tpl_vars['query']->value);?>
+&matchAll=<?php echo $_smarty_tpl->tpl_vars['matchAll']->value;?>
+&start=<?php echo $_smarty_tpl->tpl_vars['result']->value->nextPageStartIndex;?>
+&rows=<?php echo $_smarty_tpl->tpl_vars['result']->value->resultsPerPage;?>
+">Next Results</a>    \r
+        <?php }else{ ?>\r
+                    <span class="GLMSresultsNavInactive">Next Results</span>\r
+        <?php }?>\r
+                </div>\r
+    \r
+            </div>\r
+                        \r
+                   \r
+  <?php }else{ ?>\r
+            <h3>No results matching your search.</h3>\r
+  <?php }?>\r
+\r
+<?php }?>\r
+\r
+\r
+        </div> <!-- GLMSearch -->\r
+<?php }} ?>
\ No newline at end of file
index d89d097..a97ab6b 100755 (executable)
                             <a href="{homePageUrl:h}"><img src="{mediaBaseURL:h}assets/logo.png"></a>
                         </div>
                         <div class="medium-4 large-3 columns show-for-medium-up right">
-                            <div class="small-12 columns">
-                                <input type="text" placeholder="Search"><img class="right" src="{mediaBaseURL:h}assets/search-icon.png">
-                            </div>
+                            <div id="search_wrapper" class="small-12 columns">
+                                <form action="#" id="searchForm" name="searchForm" method="get" flexy:ignore="yes">
+                                    <input type="hidden" name="GLMSearch" value="true">
+                                    <input type="hidden" name="start" value="0">
+                                    <input type="hidden" name="rows" value="10">
+                                    <input type="text" id="searchInput" name="query" placeholder="Search" value=""><img class="right" src="{mediaBaseURL:h}assets/search-icon.png">
+<!--                                    <input id="searchInput" type="search" name="query" value="" placeholder="Search">-->
+                                    <input id="searchSubmit" type="submit" value="">
+                                </form>
+                            </div><!--/#search_wrapper-->
                             <div id="social" class="small-12 columns">
                                 <a href="http://pinterest.com/gaylordmichigan/"><img src="{mediaBaseURL:h}assets/pin-icon.png"></a>
                                 <a href="http://www.youtube.com/GaylordTourism"><img src="{mediaBaseURL:h}assets/youtube-icon.png"></a>
                     </div>
                     <div class="row" flexy:if="isHomePage">
                         <div id="blog" class="small-12 large-8 columns">
+<!--                            <h2>Blog Feed</h2>
+                            <div id="blog_wrapper_outer">
+                                    <div id="blog_wrapper">
+                                            <article flexy:foreach="feed,item">
+                                                    <p class="blog_date">{item.getPubdateFormated(#D, F j, Y g:iA#)}</p>
+                                                    <a class="blog_link" href="{item.getUrl():h}">{item.getTitle()}</a>
+                                                    <p class="blog_desc">{item.getDescription():h}</p>
+                                            </article>
+                                    </div>/#blog_wrapper
+                                    <div id="prev-blog">Prev</div>
+                                    <div id="next-blog">Next</div>
+                            </div>-->
                             <div class="top min-left chip"></div>
                             <div class="top min-right chip"></div>
                                 <h1 class="small-only-text-center">Latest News</h1>
                         </ul>
                     </div>
                     <div class="medium-2 columns show-for-medium-up right">
-                        <a class="right" href="#"><img src="{mediaBaseURL:h}assets/pure-m.png"></a>
+                        <a class="right" target="_blank" href="http://www.michigan.org/"><img src="{mediaBaseURL:h}assets/pure-m.png"></a>
                     </div>
                 </div>
                 <div id="copyright" class="text-center">