Region.php #1

  • //
  • guest/
  • perforce_software/
  • chronicle/
  • main/
  • application/
  • widget/
  • views/
  • helpers/
  • Region.php
  • View
  • Commits
  • Open Download .zip Download (1 KB)
<?php
/**
 * View helper that renders a region using a specified template.
 *
 * @copyright   2011 Perforce Software. All rights reserved.
 * @license     Please see LICENSE.txt in top-level folder of this distribution.
 * @version     <release>/<patch>
 */
class Widget_View_Helper_Region extends Zend_View_Helper_Action
{
    /**
     * Render the named/given region.
     *
     * @param   string  $region     the id of a region to render.
     * @param   string  $template   the template to use.
     * @return  string  the rendered region output.
     */
    public function region($region, $template = 'region.phtml')
    {
        $view          = $this->view;
        $view->region  = $region;
        $view->widgets = P4Cms_Widget::fetchByRegion($region);

        // tag the page cache so it can be appropriately cleared later
        if (P4Cms_Cache::canCache('page')) {
            P4Cms_Cache::getCache('page')->addTag('p4cms_region_'      . bin2hex($region));
        }

        // make the widget context available to the view
        $widgetContext = new P4Cms_Controller_Action_Helper_WidgetContext;
        $view->widgetContext = $widgetContext->getEncodedValues();

        return $view->render($template);
    }
}
# Change User Description Committed
#1 16170 perforce_software Move Chronicle files to follow new path scheme for branching.
//guest/perforce_software/chronicle/application/widget/views/helpers/Region.php
#1 8972 Matt Attaway Initial add of the Chronicle source code