Прохождение автризации

This commit is contained in:
CORP\phedor 2018-04-23 11:18:53 +03:00
parent aaa9c2e1bf
commit c2b9254fd0
9 changed files with 16 additions and 14 deletions

View file

@ -110,8 +110,8 @@ class Action
{ {
$file = $name . self::TEMPLATE_EXTENSION; $file = $name . self::TEMPLATE_EXTENSION;
$basePath = $this->config->get('site', 'path'); $basePath = $this->config->get('system', 'path');
$webPath = $this->config->get('site', 'web'); $webPath = $this->config->get('system', 'web');
$list = array( $list = array(
Path::join($this->modulePath, 'templates', $this->viewPathPrefix) => Path::join($webPath, "modules", $this->name, 'templates', $this->viewPathPrefix), Path::join($this->modulePath, 'templates', $this->viewPathPrefix) => Path::join($webPath, "modules", $this->name, 'templates', $this->viewPathPrefix),
@ -125,6 +125,7 @@ class Action
} }
/*.Composite.*/$tpl = new $viewClass($template); /*.Composite.*/$tpl = new $viewClass($template);
$tpl->config = $this->config;
$stylePath = Path::join($webPath, "assets", "css"); $stylePath = Path::join($webPath, "assets", "css");
$iconsPath = Path::join($webPath, 'icons'); $iconsPath = Path::join($webPath, 'icons');

View file

@ -5,7 +5,7 @@ use Exception;
class File { class File {
static function getContents($filename) { static function getContents($filename) {
$buffer = file_get_contents($filename); $buffer = @file_get_contents($filename);
if ($buffer !== false) { if ($buffer !== false) {
return $buffer; return $buffer;
} }

View file

@ -15,6 +15,7 @@ class ActionLogger
function __construct(/*.Filter.*/$processor, $logPath, $user) { function __construct(/*.Filter.*/$processor, $logPath, $user) {
$this->processor = $processor; $this->processor = $processor;
$this->user = $user; $this->user = $user;
$file = fopen($logPath, "a"); $file = fopen($logPath, "a");
if (is_resource($file)) { if (is_resource($file)) {
$this->file = $file; $this->file = $file;

View file

@ -1,19 +1,19 @@
<?php <?php
namespace ctiso\Model; namespace ctiso\Model;
use ctiso\Settings, use ctiso\Registry,
ctiso\Database; ctiso\Database;
class Factory class Factory
{ {
static $shortcut = "model"; static $shortcut = "model";
public $db; public $db;
public $_registry; public $config;
public function __construct (/*.Database.*/ $db, Settings $_registry = null) public function __construct (Database $db, Registry $config = null)
{ {
$this->db = $db; $this->db = $db;
$this->_registry = $_registry; $this->config = $config;
} }
/** /**
@ -27,7 +27,7 @@ class Factory
$model = new $modelName(); $model = new $modelName();
$model->db = $this->db; $model->db = $this->db;
$model->factory = $this; $model->factory = $this;
$model->_registry = $this->_registry; $model->config = $this->config;
$model->setUp(); $model->setUp();
// //
return $model; return $model;

View file

@ -15,7 +15,7 @@ use ctiso\File,
class Settings class Settings
{ {
public $data; public $data = [];
protected $file; protected $file;
protected $format = 'php'; protected $format = 'php';

View file

@ -22,6 +22,6 @@ class Url {
} }
function toString() { function toString() {
return '?' . http_build_query(array_merge($this->parts, $this->parent->parts)); return '?' . http_build_query(array_merge($this->parts, $this->parent ? $this->parent->parts : []));
} }
} }

View file

@ -11,6 +11,7 @@ use ctiso\View\View,
class Composite extends View class Composite extends View
{ {
private $tal; private $tal;
public $config;
function __construct($file) function __construct($file)
{ {
@ -18,7 +19,7 @@ class Composite extends View
$this->tal = new PHPTAL($file); $this->tal = new PHPTAL($file);
$this->tal->setPhpCodeDestination(PHPTAL_PHP_CODE_DESTINATION); $this->tal->setPhpCodeDestination(PHPTAL_PHP_CODE_DESTINATION);
$this->tal->setEncoding(PHPTAL_DEFAULT_ENCODING); // PHPTAL_DEFAULT_ENCODING !! $this->tal->setEncoding(PHPTAL_DEFAULT_ENCODING);
$this->tal->setTemplateRepository(PHPTAL_TEMPLATE_REPOSITORY); $this->tal->setTemplateRepository(PHPTAL_TEMPLATE_REPOSITORY);
$this->tal->setOutputMode(PHPTAL::HTML5); $this->tal->setOutputMode(PHPTAL::HTML5);
$this->tal->stripComments(true); $this->tal->stripComments(true);
@ -39,7 +40,6 @@ class Composite extends View
function execute() function execute()
{ {
parent::execute(); parent::execute();
// postProcess
return $this->tal->execute(); return $this->tal->execute();
} }

View file

@ -120,7 +120,7 @@ class Top extends Composite {
$this->set('deps', implode(",", array_values($this->require))); $this->set('deps', implode(",", array_values($this->require)));
$this->set('title', $this->getTitle()); $this->set('title', $this->getTitle());
$this->set('jspath', enableHttps($this->config->get('system', 'web'))); $this->set('jspath', $this->config->get('system', 'web'));
// //
return $this->execute(); // execute+phptal ?? return $this->execute(); // execute+phptal ??
} }

View file

@ -205,4 +205,4 @@ class View
} }
return $result; return $result;
} }
} }