Location: PHPKode > projects > DIY Blog > diy-blog/classes/diy-blog/backend/view/BackEndView.class.php
<?php

/**
 * A general backend XHTML view, sub-classed by specific Views.
 * @package diy-blog.backend.view
 * @author	Martynas Jusevicius <hide@address.com>
 * @link	http://www.xml.lt
 */

abstract class BackEndView extends XSLTView
{
	protected static $outputType = ContentType::XHTML_XML;

/**
 * Constructs View from Resource, initializes XSLT processor and creates URI resolver.
 * @param Resource $resource Resource
 */

	public function __construct(Resource $resource = null)
	{
		parent::__construct($resource);
		$this->resolver = new URIResolver("arg");
	}

/**
 * Sets common parameters and arguments for all XSLT views and displays this view.
 * @param Request $request Request
 * @param Response $response Response
 */

	public function display(Request $request, Response $response)
	{

		$this->proc->setParameter("", "uri", $request->getAttribute("URI"));
		$this->proc->setParameter("", "host-uri", BackEndMapping::getHost()); // QUIRK
		$this->proc->setParameter("", "frontend-host-uri", FrontEndMapping::getHost());

		$this->resolver->setArgument("session-user", XMLSerializer::serialize($request->getSession()->getAttribute("user")));

		parent::display($request, $response);

		$response->setCharacterEncoding("UTF-8");
		if (strstr($request->getHeader("HTTP_ACCEPT"), ContentType::XHTML_XML)) $response->setContentType(ContentType::XHTML_XML);
		else $response->setContentType(ContentType::TEXT_HTML);
	}
}

?>
Return current item: DIY Blog