PhpViewResolver.class.php

Go to the documentation of this file.
00001 <?php
00002 /***************************************************************************
00003  *   Copyright (C) 2006-2007 by Anton E. Lebedevich                        *
00004  *                                                                         *
00005  *   This program is free software; you can redistribute it and/or modify  *
00006  *   it under the terms of the GNU Lesser General Public License as        *
00007  *   published by the Free Software Foundation; either version 3 of the    *
00008  *   License, or (at your option) any later version.                       *
00009  *                                                                         *
00010  ***************************************************************************/
00011 /* $Id: PhpViewResolver.class.php 4687 2007-12-09 18:57:18Z voxus $ */
00012 
00016     class PhpViewResolver implements ViewResolver
00017     {
00018         private $prefix     = null;
00019         private $postfix    = null;
00020         
00021         public function __construct($prefix = null, $postfix = null)
00022         {
00023             $this->prefix   = $prefix;
00024             $this->postfix  = $postfix;
00025         }
00026         
00030         public static function create($prefix = null, $postfix = null)
00031         {
00032             return new self($prefix, $postfix);
00033         }
00034         
00038         public function resolveViewName($viewName)
00039         {
00040             return
00041                 new SimplePhpView(
00042                     $this->prefix.$viewName.$this->postfix,
00043                     $this
00044                 );
00045         }
00046         
00047         public function viewExists($viewName)
00048         {
00049             return is_readable($this->prefix.$viewName.$this->postfix);
00050         }
00051         
00052         public function getPrefix()
00053         {
00054             return $this->prefix;
00055         }
00056         
00060         public function setPrefix($prefix)
00061         {
00062             $this->prefix = $prefix;
00063             
00064             return $this;
00065         }
00066         
00067         public function getPostfix()
00068         {
00069             return $this->postfix;
00070         }
00071         
00075         public function setPostfix($postfix)
00076         {
00077             $this->postfix = $postfix;
00078             
00079             return $this;
00080         }
00081     }
00082 ?>

Generated on Sun Dec 9 21:56:24 2007 for onPHP by  doxygen 1.5.4