core/api/modules/lk-my-orgs/index.php

44 lines
1.9 KiB
PHP
Executable File

<?php
ini_set('display_errors', 0);
require_once MYDIR . '/api/php/db.php';
require_once MYDIR . '/api/php/clean.php';
/* ----------------------------------------------------------------------
14.10.2022
Меню личного кабинета
---------------------------------------------------------------------- */
$smarty -> assign ( 'mnulk', MYDIR . '/skin/inc/mnulk.html');
/* ----------------------------------------------------------------------
01.05.2021
Выгонялка
---------------------------------------------------------------------- */
if ( !$_SESSION['user_id'] && !ID ) header ( 'Location: /login/' );
/* ----------------------------------------------------------------------
06.11.2022
Получаем опции пользователя для меню
---------------------------------------------------------------------- */
$userOption = DB::getAll('SELECT * FROM `userOption` WHERE `user_id` = ' . Clean::str($_SESSION['user_id']) . ' LIMIT 1');
$smarty -> assign( 'userOption', $userOption );
/* ----------------------------------------------------------------------
06.11.2022
Получаем список своих организаций
---------------------------------------------------------------------- */
$myOrgsOnCheck = DB::getAll('SELECT * FROM `org` WHERE `id` IN (SELECT `org_id` FROM `multiOrg` WHERE `user_id`=' . $_SESSION['user_id'] . ' AND `status`<>1 )');
for ($i=0; $i<count($myOrgsOnCheck); $i++){
$myOrgsOnCheck[$i]['status'] = DB::getValue("SELECT `status` FROM `multiOrg` WHERE `org_id` = " . $myOrgsOnCheck[$i]['id']);
}
$smarty -> assign( 'myOrgsOnCheck', $myOrgsOnCheck );
$myOrgs = DB::getAll('SELECT * FROM `org` WHERE `id` IN (SELECT `org_id` FROM `multiOrg` WHERE `user_id`=' . $_SESSION['user_id'] . ' AND `status`=1 )');
$smarty -> assign( 'myOrgs', $myOrgs );
?>