Добавил namespace и зависимости
This commit is contained in:
parent
e9f7c23990
commit
32ec09a66a
92 changed files with 454 additions and 128 deletions
|
|
@ -1,5 +1,16 @@
|
|||
<?php
|
||||
|
||||
namespace ctiso\Controller;
|
||||
use ctiso\Shortcut,
|
||||
Exception,
|
||||
ctiso\Path,
|
||||
ctiso\View\View,
|
||||
ctiso\Model\Factory,
|
||||
ctiso\HttpRequest,
|
||||
ctiso\Functions,
|
||||
ctiso\Settings,
|
||||
ctiso\Controller\State;
|
||||
|
||||
function forceUrl($name)
|
||||
{
|
||||
if (is_callable($name)) {
|
||||
|
|
@ -11,7 +22,7 @@ function forceUrl($name)
|
|||
/**
|
||||
* Контроллер страниц
|
||||
*/
|
||||
class Controller_Action
|
||||
class Action
|
||||
{
|
||||
|
||||
const TEMPLATE_EXTENSION = ".html"; // Расширение для шаблонов
|
||||
|
|
@ -78,7 +89,7 @@ class Controller_Action
|
|||
return Path::join(CMS_PATH, "modules", $name);
|
||||
}
|
||||
|
||||
public function addSuggest(View_View $view, $name)
|
||||
public function addSuggest(View $view, $name)
|
||||
{
|
||||
$suggest = array();
|
||||
$file = Path::join($this->viewPath, 'help', $name . '.suggest');
|
||||
|
|
@ -141,7 +152,7 @@ class Controller_Action
|
|||
public function getModel($name)
|
||||
{
|
||||
if (!$this->factory) {
|
||||
$this->factory = new Model_Factory($this->db, $this->_registry);
|
||||
$this->factory = new Factory($this->db, $this->_registry);
|
||||
}
|
||||
return $this->factory->getModel($name);
|
||||
}
|
||||
|
|
@ -364,7 +375,7 @@ class Controller_Action
|
|||
|
||||
function _getActionPath()
|
||||
{
|
||||
return new Controller_State('index');
|
||||
return new State('index');
|
||||
}
|
||||
|
||||
// Тоже убрать в метод Controller_Model
|
||||
|
|
|
|||
|
|
@ -1,5 +1,18 @@
|
|||
<?php
|
||||
|
||||
namespace ctiso\Controller;
|
||||
use ctiso\HttpRequest,
|
||||
ctiso\Arr,
|
||||
ctiso\Path,
|
||||
PHPTAL,
|
||||
PHPTAL_PreFilter_Normalize,
|
||||
ctiso\File,
|
||||
ctiso\Form\Form,
|
||||
ctiso\Form\OptionFactory,
|
||||
ctiso\Database,
|
||||
ctiso\Collection,
|
||||
ctiso\Controller\Site;
|
||||
|
||||
function replaceContent($match) {
|
||||
$result = phptal_component(htmlspecialchars_decode($match[3]));
|
||||
return $result;
|
||||
|
|
@ -58,7 +71,7 @@ class FakeTemplate {
|
|||
/**
|
||||
* Класс компонента
|
||||
*/
|
||||
class Controller_Component
|
||||
class Component
|
||||
{
|
||||
public $viewPath = array();
|
||||
public $webPath = array();
|
||||
|
|
@ -210,8 +223,8 @@ class Controller_Component
|
|||
*/
|
||||
public function setParameters(/*.View_Composite.*/$view)
|
||||
{
|
||||
$form = new Form_Form();
|
||||
$options = new Form_OptionFactory($this->db, $this->registry);
|
||||
$form = new Form();
|
||||
$options = new OptionFactory($this->db, $this->registry);
|
||||
|
||||
$settings = $this->getInfo();
|
||||
$form->addFieldList($settings['parameter'], $options);
|
||||
|
|
@ -301,7 +314,7 @@ class Controller_Component
|
|||
$editor = $component->getEditUrl();
|
||||
if ($editor) {
|
||||
if(class_exists("Controller_Site")) { //Если мы в CMS2
|
||||
$instance = Controller_Site::getInstance();
|
||||
$instance = Site::getInstance();
|
||||
$instance->componentsConfig[] = $editor;
|
||||
} else {
|
||||
global $componentsConfig;
|
||||
|
|
@ -356,7 +369,7 @@ class Controller_Component
|
|||
*/
|
||||
|
||||
function addRequireJsPath($name, $path, $shim = null) {
|
||||
Controller_Site::addRequireJsPath($name, $path, $shim);
|
||||
Site::addRequireJsPath($name, $path, $shim);
|
||||
}
|
||||
|
||||
function actionIndex(/*.ComponentRequest.*/ $request) {
|
||||
|
|
|
|||
|
|
@ -4,7 +4,15 @@
|
|||
* Первичный контроллер контроллер страниц
|
||||
* @package system.controller
|
||||
*/
|
||||
class Controller_Front extends Controller_Action
|
||||
namespace ctiso\Controller;
|
||||
use ctiso\Controller\Action,
|
||||
ctiso\Settings,
|
||||
ctiso\Database,
|
||||
ctiso\Collection,
|
||||
ctiso\Shortcut,
|
||||
ctiso\HttpRequest;
|
||||
|
||||
class Front extends Action
|
||||
{
|
||||
|
||||
/** @var Shortcut */
|
||||
|
|
|
|||
|
|
@ -1,6 +1,11 @@
|
|||
<?php
|
||||
|
||||
class Controller_Installer
|
||||
namespace ctiso\Controller;
|
||||
use ctiso\Settings,
|
||||
ctiso\Path,
|
||||
ctiso\Database\JsonInstall;
|
||||
|
||||
class Installer
|
||||
{
|
||||
protected $db_manager;
|
||||
protected $installPath;
|
||||
|
|
@ -44,7 +49,7 @@ class Controller_Installer
|
|||
function installSQL(array $sql, $version_new, $version_old, $name)
|
||||
{
|
||||
$result = [];
|
||||
$json_installer = new Database_JsonInstall($this->db_manager);
|
||||
$json_installer = new JsonInstall($this->db_manager);
|
||||
foreach ($sql as $version => $install) {
|
||||
if (version_compare($version, $version_new, "<=") && version_compare($version, $version_old, ">")) {
|
||||
$file = Path::join(call_user_func($this->installPath, $name), "sql", $install);
|
||||
|
|
@ -58,7 +63,7 @@ class Controller_Installer
|
|||
function uninstall($name){
|
||||
$uninstall = $this->getUninstallFile($name);
|
||||
if (file_exists($uninstall)) {
|
||||
$json_installer = new Database_JsonInstall($this->db_manager);
|
||||
$json_installer = new JsonInstall($this->db_manager);
|
||||
$json_installer->install($uninstall,null);
|
||||
}
|
||||
$this->_registry->removeKey($name);
|
||||
|
|
@ -108,7 +113,7 @@ class Controller_Installer
|
|||
}
|
||||
|
||||
function install($dbinit_path, $dbfill_path = null) {
|
||||
$json_installer = new Database_JsonInstall($this->db_manager);
|
||||
$json_installer = new JsonInstall($this->db_manager);
|
||||
$json_installer->install($dbinit_path, $dbfill_path);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,6 +1,8 @@
|
|||
<?php
|
||||
|
||||
class Controller_Request {
|
||||
namespace ctiso\Controller;
|
||||
|
||||
class Request {
|
||||
public $r;
|
||||
public $id;
|
||||
|
||||
|
|
|
|||
|
|
@ -3,7 +3,10 @@
|
|||
/**
|
||||
* Класс сервиса = Упрощенный компонент
|
||||
*/
|
||||
class Controller_Service
|
||||
namespace ctiso\Controller;
|
||||
use ctiso\Path;
|
||||
|
||||
class Service
|
||||
{
|
||||
public $viewPath = [];
|
||||
public $webPath = [];
|
||||
|
|
|
|||
|
|
@ -1,6 +1,9 @@
|
|||
<?php
|
||||
|
||||
class Controller_State
|
||||
namespace ctiso\Controller;
|
||||
use ctiso\Controller\Action;
|
||||
|
||||
class State
|
||||
{
|
||||
public $action = '';
|
||||
public $states = array();
|
||||
|
|
@ -13,7 +16,7 @@ class Controller_State
|
|||
|
||||
static function make($action)
|
||||
{
|
||||
return new Controller_State($action);
|
||||
return new State($action);
|
||||
}
|
||||
|
||||
public function addTitle($name, $url = array())
|
||||
|
|
@ -22,7 +25,7 @@ class Controller_State
|
|||
return $this;
|
||||
}
|
||||
|
||||
public function addState(Controller_State $state)
|
||||
public function addState(State $state)
|
||||
{
|
||||
$this->states [$state->getAction()] = $state;
|
||||
return $this;
|
||||
|
|
@ -49,7 +52,7 @@ class Controller_State
|
|||
return false;
|
||||
}
|
||||
|
||||
function makeTitle(Controller_Action $module)
|
||||
function makeTitle(Action $module)
|
||||
{
|
||||
foreach ($this->titles as $item) {
|
||||
$module->path->addMenuItem($module->nUrl($this->action, $item[1]), $item[0]);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue