2017-01-22 23:47:24 +00:00
|
|
|
<?php
|
|
|
|
/**
|
|
|
|
* Created by PhpStorm.
|
|
|
|
* User: Игорь
|
|
|
|
* Date: 23.01.2017
|
|
|
|
* Time: 02:45
|
|
|
|
*/
|
|
|
|
|
2017-01-23 10:25:19 +00:00
|
|
|
namespace PFRM;
|
2017-01-22 23:47:24 +00:00
|
|
|
|
|
|
|
|
|
|
|
class View {
|
2017-01-23 10:25:19 +00:00
|
|
|
public $app;
|
2017-01-22 23:47:24 +00:00
|
|
|
|
2017-01-23 20:33:16 +00:00
|
|
|
private $view_filename;
|
|
|
|
|
|
|
|
public $site_name;
|
|
|
|
|
|
|
|
function __construct( $filename ) {
|
|
|
|
global $app;
|
|
|
|
$this->app = $app;
|
|
|
|
$this->view_filename = $this->app->config->views_dir . $filename . '.php';
|
|
|
|
$this->site_name = $this->app->config->site_name;
|
2017-01-23 10:25:19 +00:00
|
|
|
}
|
|
|
|
|
2017-01-23 20:33:16 +00:00
|
|
|
/**
|
|
|
|
* Установка HTTP-заголовка
|
|
|
|
*
|
|
|
|
* @param string $header http-заголовок
|
|
|
|
*/
|
|
|
|
public function setHTTPHeader( $header ) {
|
|
|
|
header( $header, 1 );
|
|
|
|
}
|
2017-01-23 10:25:19 +00:00
|
|
|
|
2017-01-23 20:33:16 +00:00
|
|
|
/**
|
|
|
|
* Запуск php-шаблона
|
|
|
|
*/
|
|
|
|
public function render( ) {
|
|
|
|
require $this->view_filename;
|
2017-01-23 10:25:19 +00:00
|
|
|
}
|
2017-01-22 23:47:24 +00:00
|
|
|
}
|