Merge branch 'master' of http://gitlab.edu.yar.ru/composer/PHP_Library into dev
This commit is contained in:
commit
f33afc2861
18 changed files with 240 additions and 48 deletions
|
|
@ -66,7 +66,13 @@ class Controller_Component
|
|||
|
||||
function execute(HttpRequest $request, $has_id = true) {
|
||||
$crequest = new ComponentRequest($this->component_id, $request);
|
||||
$action = 'action' . ucfirst($request->get('action', 'index'));
|
||||
|
||||
$_action = $request->get('action', 'index');
|
||||
if (is_array($_action)) {
|
||||
$action = 'action' . ucfirst(Arr::get($_action, $this->component_id, 'index'));
|
||||
} else {
|
||||
$action = 'action' . ucfirst($_action);
|
||||
}
|
||||
|
||||
$this->before();
|
||||
if (method_exists($this, $action)) {
|
||||
|
|
@ -106,7 +112,9 @@ class Controller_Component
|
|||
$tpl->set('common', Path::join(WWW_PATH, '../', 'common'));
|
||||
$tpl->set('script', Path::join(WWW_PATH, 'js'));
|
||||
$tpl->set('media', Path::join(TEMPLATE_WEB, $template));
|
||||
$tpl->set('site_template', SITE_WWW_PATH . '/templates' . $registry->readKey(array('system', 'template')));
|
||||
if ($registry) {
|
||||
$tpl->set('site_template', SITE_WWW_PATH . '/templates' . $registry->readKey(array('system', 'template')));
|
||||
}
|
||||
$tpl->set('base', SITE_WWW_PATH);
|
||||
|
||||
$tpl->set('component_base', $this->webPath[$selected]);
|
||||
|
|
@ -125,14 +133,6 @@ class Controller_Component
|
|||
return Path::join($this->webPath[0], 'templates', 'modern');
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $name Имя модели
|
||||
*/
|
||||
private function getModelPath($name)
|
||||
{
|
||||
return Path::join (CMS_PATH, "model", $name . ".php");
|
||||
}
|
||||
|
||||
/**
|
||||
* Создает модель
|
||||
* @param string $name
|
||||
|
|
@ -140,9 +140,8 @@ class Controller_Component
|
|||
*/
|
||||
public function getModel($name)
|
||||
{
|
||||
require_once ($this->getModelPath ($name));
|
||||
$modelName = $name . "Mapper";
|
||||
$model = new $modelName ();
|
||||
$modelName = "Mapper_" . $name;
|
||||
$model = new $modelName();
|
||||
$model->db = $this->db;
|
||||
return $model;
|
||||
}
|
||||
|
|
@ -188,7 +187,7 @@ class Controller_Component
|
|||
$view->component_title = $settings['title'];
|
||||
}
|
||||
|
||||
static function loadComponent($expression, Database $db, Settings $registry)
|
||||
static function loadComponent($expression, Database $db, /*.Settings.*/ $registry)
|
||||
{
|
||||
|
||||
$expression = htmlspecialchars_decode($expression);
|
||||
|
|
@ -322,11 +321,7 @@ class Controller_Component
|
|||
*/
|
||||
|
||||
function addRequireJsPath($name, $path, $shim = null) {
|
||||
global $requireJsConfig;
|
||||
$requireJsConfig['paths'][$name] = $path;
|
||||
if ($shim) {
|
||||
$requireJsConfig['shim'][$name] = $shim;
|
||||
}
|
||||
Controller_Site::addRequireJsPath($name, $path, $shim);
|
||||
}
|
||||
|
||||
function actionIndex(/*.ComponentRequest.*/ $request) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue