first commit
This commit is contained in:
@@ -0,0 +1,42 @@
|
||||
<?php
|
||||
|
||||
namespace App\Controllers;
|
||||
|
||||
use App\Models\OrganizationModel;
|
||||
use App\Models\OrganizationUserModel;
|
||||
|
||||
class Home extends BaseController
|
||||
{
|
||||
public function index()
|
||||
{
|
||||
//log_message('debug', '[HOME INDEX] START: active_org_id = ' . (session()->get('active_org_id') ?? 'NULL'));
|
||||
|
||||
if (!session()->get('isLoggedIn')) {
|
||||
return $this->renderTwig('landing/index');
|
||||
}
|
||||
// Получаем текущую организацию из сессии
|
||||
$orgId = session()->get('active_org_id');
|
||||
if (empty($orgId)){
|
||||
session()->remove('active_org_id');
|
||||
return redirect()->to('/organizations');
|
||||
}
|
||||
// Загружаем данные организации для шапки (имя, логотип)
|
||||
// $orgModel = new OrganizationModel();
|
||||
// $currentOrg = $orgModel->find($orgId);
|
||||
// // print_r($currentOrg);
|
||||
// // die();
|
||||
// // Если организации нет (сессия слетела), кидаем на выбор
|
||||
// if (!$currentOrg) {
|
||||
// session()->remove('active_org_id');
|
||||
// return redirect()->to('/organizations');
|
||||
// }
|
||||
|
||||
// Передаем данные в шаблон
|
||||
$data = [
|
||||
'title' => 'Рабочий стол',
|
||||
//'currentOrg' => $currentOrg,
|
||||
];
|
||||
|
||||
return $this->renderTwig('dashboard/index', $data);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user