Изменен механизм расширения ссылок. Избавление от глобальных переменных
This commit is contained in:
parent
524b27936a
commit
40fad0e75b
11 changed files with 77 additions and 61 deletions
|
|
@ -5,12 +5,12 @@ use ctiso\Shortcut,
|
|||
Exception,
|
||||
ctiso\Path,
|
||||
ctiso\Url,
|
||||
ctiso\View\View,
|
||||
ctiso\Model\Factory,
|
||||
ctiso\HttpRequest,
|
||||
ctiso\Functions,
|
||||
ctiso\Settings,
|
||||
ctiso\View\Composite,
|
||||
ctiso\Filter\ActionAccess,
|
||||
ctiso\View\View,
|
||||
ctiso\Controller\State;
|
||||
|
||||
|
|
@ -43,7 +43,7 @@ class Action
|
|||
|
||||
private $factory = null; // Ссылка на обьект создания модели
|
||||
private $helpers = array(); // Помошники для действий
|
||||
public $param = array(); // Параметры для ссылки
|
||||
public $part = null; // Параметры для ссылки
|
||||
|
||||
public /*.Settings.*/$settings; // Ссылка на настройки
|
||||
public $user; // Обьект пользователя
|
||||
|
|
@ -55,6 +55,7 @@ class Action
|
|||
public $childViews = array();
|
||||
|
||||
function __construct() {
|
||||
$this->part = new Url();
|
||||
}
|
||||
|
||||
public function setUp() {
|
||||
|
|
@ -198,6 +199,10 @@ class Action
|
|||
return "";
|
||||
}
|
||||
|
||||
public function addUrlPart($key, $value) {
|
||||
$this->part->addQueryParam($key, $value);
|
||||
}
|
||||
|
||||
/**
|
||||
* Генерация ссылки c учетом прав пользователя на ссылки
|
||||
* @param string $name Действие
|
||||
|
|
@ -208,16 +213,20 @@ class Action
|
|||
public function nUrl($name, array $param = array())
|
||||
{
|
||||
/*.ActionAccess.*/$access = $this->access;
|
||||
$url = new Url();
|
||||
|
||||
if ($access == null || $access->checkAction($name)) {
|
||||
$param = array_merge(array(
|
||||
'module' => strtr($this->modulePrefix . strtolower(get_class($this)), array('module_' => '')),
|
||||
"action" => $name
|
||||
|
||||
), $param);
|
||||
|
||||
return new Url($param);
|
||||
$url->setParent($this->part);
|
||||
$url->setQuery($param);
|
||||
}
|
||||
return new Url();
|
||||
|
||||
return $url;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -318,7 +327,7 @@ class Action
|
|||
*/
|
||||
public function render()
|
||||
{
|
||||
if ($this->view instanceof View_View) {
|
||||
if ($this->view instanceof View) {
|
||||
$this->view->assignValues($this->ctrlValues);
|
||||
|
||||
/*.Composite.*/$node = null;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue