Перенес часть в CMS2

This commit is contained in:
origami11 2017-02-17 18:15:59 +03:00
parent 3defa8f38b
commit a75f450edd
5 changed files with 12 additions and 576 deletions

View file

@ -47,10 +47,14 @@ class Controller_Action
public $_shortcut;
public $modulePrefix = '';
public $iconPath = '';
public $path;
public function __construct () {
$this->path = new Widgets_PathMenu();
// Для Widgets
public $view = null;
public $childNodes = array();
public $ctrlValues = array();
public $childViews = array();
function __construct() {
}
public function setUp() {
@ -149,7 +153,7 @@ class Controller_Action
* 2. Использовать наследование чтобы добавить к старому обработчику новое поведение
* @param $request Обьект запроса
*/
public function execute1(HttpRequest $request)
public function preprocess(HttpRequest $request)
{
$action = self::ACTION_PREFIX . ucfirst($request->getAction());
if (!method_exists($this, $action)) {
@ -165,7 +169,7 @@ class Controller_Action
public function execute(HttpRequest $request)
{
$result = $this->execute1($request);
$result = $this->preprocess($request);
if (!empty($result)) {
$this->view = $result;
}
@ -283,12 +287,6 @@ class Controller_Action
return $result->export();
}
// Для Widgets
public $view = null;
public $childNodes = array();
public $ctrlValues = array();
public $childViews = array();
public function setView($name)
{
$this->view = $this->getView($name);
@ -371,44 +369,4 @@ class Controller_Action
{
$this->_getActionPath()->getPath($this, ($action) ? $action : $request->getAction());
}
function addFilePathToPath($filePath, $type)
{
$pathToItem = $this->directoryPath($filePath, $type, 'default');
$this->path->addMenuItems($pathToItem['path']);
}
function directoryPath($path, $type, $action)
{
$path = empty($path) ? '/' : $path;
$base = new Path($path);
$parts = $base->getParts();
$_path = '/' . implode('/', $parts);
$rs = new Model_Resources($this->db);
$section_path = $rs->getSectionByPath($_path, $type);
$pathMenu = new Widgets_PathMenu();
$pathMenu->addTitle('title');
$modules = ['image' => 'images','page' => 'pages','document' => 'documents','media' => 'videos'];
while ($section_path->id_parent) {
$_path = '/' . implode('/', $parts);
$pathMenu->addMenuItem(
forceUrl($this->nUrl('', array('module'=>$modules[$type],'action' => $action, 'mode' => 'ajax', 'path' => $_path))),
$section_path->title
);
$section_path = $rs->getSectionById($section_path->id_parent);
array_pop($parts);
}
$pathMenu->addMenuItem(
forceUrl($this->nUrl('', array('module'=>$modules[$type],'action' => $action, 'mode' => 'ajax', 'path' => '/'))),
$this->moduleTitle
);
return $pathMenu->getItemsReverse();
}
}