Files
portal-legacy/lib/symfony/view/sfPartialView.class.php

77 lines
1.8 KiB
PHP
Raw Permalink Normal View History

2012-11-28 03:55:08 -05:00
<?php
/*
* This file is part of the symfony package.
* (c) 2004-2006 Fabien Potencier <fabien.potencier@symfony-project.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
/**
*
* @package symfony
* @subpackage view
* @author Fabien Potencier <fabien.potencier@symfony-project.com>
* @version SVN: $Id: sfPartialView.class.php 3232 2007-01-11 20:51:54Z fabien $
*/
class sfPartialView extends sfPHPView
{
/**
* Executes any presentation logic for this view.
*/
public function execute()
{
}
/**
* Configures template for this view.
*/
public function configure()
{
$this->setDecorator(false);
$this->setTemplate($this->actionName.$this->getExtension());
if ('global' == $this->moduleName)
{
$this->setDirectory(sfConfig::get('sf_app_template_dir'));
}
else
{
$this->setDirectory(sfLoader::getTemplateDir($this->moduleName, $this->getTemplate()));
}
}
/**
* Renders the presentation.
*
* @param array Template attributes
*
* @return string Current template content
*/
public function render($templateVars = array())
{
if (sfConfig::get('sf_debug') && sfConfig::get('sf_logging_enabled'))
{
$timer = sfTimerManager::getTimer(sprintf('Partial "%s/%s"', $this->moduleName, $this->actionName));
}
// execute pre-render check
$this->preRenderCheck();
// assigns some variables to the template
$this->attributeHolder->add($this->getGlobalVars());
$this->attributeHolder->add($templateVars);
// render template
$retval = $this->renderFile($this->getDirectory().'/'.$this->getTemplate());
if (sfConfig::get('sf_debug') && sfConfig::get('sf_logging_enabled'))
{
$timer->addTime();
}
return $retval;
}
}