Вид модуля не найден

У меня проблема с использованием реализации Codeigniter в HMVC с модулями.

Я создал модуль аутентификации под названием autenticacion, который, по понятным причинам, для проверки действительности и истечения сеанса всегда используется в MX_Controller, сюда:

Modules::run('autenticacion/logout', $user, true);

или же

Modules::run('autenticacion/update', $user);

в зависимости от определенных условий.

С тех пор как я добавил эту реализацию аутентификации, нормальный доступ к другим модулям был нарушен.

Теперь, если я попытаюсь, например, получить доступ

www.domain.com/items

Имея это, я закодировал файлы этого модуля:

modules/items/controllers/Items.php (это расширяет MX_Controller)
и вид:

modules/items/views/items_view.php

Представление не будет найдено, несмотря на то, что оно загружено в контроллер Items.

Если я распечатываю $ this в конструкторе Items, MY_Loader Экземпляр отображает это свойство:

[_module: protected] => аутентификация

Я понимаю это значит Предметы модуль не загружается в загрузчик, несмотря на то, что я могу добраться до его контроллера. Другой модуль (autenticacionКажется, что это все портит.

Как я мог это исправить?

РЕДАКТИРОВАТЬ:

Это то, что я изменил в MX_Controller для обработки сеансовых проверок и обновлений:

<?

class MX_Controller
{
public $autoload = array();

public function __construct()
{
// Validación de la autenticación/caducidad de la sesión
$this->_validar_sesion();

// Original actions
//....
}


//... method __get()


/**
* Checks whether the user has not yet created a valid authenticated user session, or if it has expired.
* In both cases, it redirects to the authentication page, deleting the expired session if it was already created.
*/
private function _validar_sesion()
{
if (stristr(get_class($this), 'autenticacion')) return;

require_once APPPATH . 'third_party/usuarios/Usuario.php';
$this->load->model('autenticacion/autenticacion_model');

// Get user instance from session
$usuario = unserialize($this->session->userdata('usuario'));

// No authenticated session yet: redirecting to the authentication page
if (!stristr(current_url(), 'autenticacion') && ! $this->session->logged_in) {

$this->load->library('uri');
$uri = $this->uri->uri_string();

redirect(base_url() . 'autenticacion' . ($uri ? '?redirect=' . $uri : ''));
}

// There is already an authenticated session, and the request is not coming from the authentication page
elseif (!stristr(current_url(), 'autenticacion')) {

// Check session expiration, in which case, we do logout
if ($this->autenticacion_model->sesion_caducada($usuario, config_item('sess_companyname_expiration'))) {

// This will delete the session from DB, destroy it, and redirect to the authentication page
Modules::run('autenticacion/logout', $usuario, true);

}
// Session has not expired yet: we update the session timestamp in DB to extend the expiration time
else {

Modules::run('autenticacion/update', $usuario);

}

}

}
}

0

Решение

Задача ещё не решена.

Другие решения

Других решений пока нет …

По вопросам рекламы ammmcru@yandex.ru
Adblock
detector