fetchFirst(" select c.ID , c.user_mail_contact , c.P_NAME, c.P_NAME_SECOND from COMPANIES c where c.ID = :id ", [ ':id' => $id ]); if (!$company) throw new Exception("Company not exists! Nr {$id}."); if (!User::isAdmin()) throw new Exception("Access Denied"); $email = $company['user_mail_contact']; $postTask = V::get('_postTask', '', $_POST); $_testUserInfo = null; switch ($postTask) { // case 'makeAccounts': { // Theme_Auth_panel_biall_net::makeActiveUsers($email); // } break; // case 'resetPasswd': { // Theme_Auth_panel_biall_net::makeActiveUsers($email); // $remindKey = Theme_Auth_panel_biall_net::generateRemindKey($email); // $resetLink = Router::getRoute('UrlAction_RemindPasswd')->getLink('rp', [ 'login' => $email, 'key' => $remindKey ]); // Theme_Auth_panel_biall_net::sendRemindPasswd($email, $resetLink, $recipient = "piotrl86+bn-test-remind@gmail.com"); // } break; case 'testAuth': { $passwd = V::get('passwd', '', $_POST); $_testUserInfo = Theme_Auth_panel_biall_net::testAuth($email, $passwd); } break; } $activeUsers = Theme_Auth_panel_biall_net::makeActiveUsers($company['user_mail_contact']); echo UI::h('div', [ 'style' => "margin-top:24px" ], [ UI::h('h3', [], "Klient: [{$company['ID']}] {$company['P_NAME']} {$company['P_NAME_SECOND']}"), UI::h('a', [ 'href' => $panelUrl, 'target' => "_blank", 'class' => "btn btn-primary" ], "Zobacz panel klienta"), ($devPrefix === substr(Request::getScriptUri(), 0, strlen($devPrefix))) ? UI::h('a', [ 'href' => $devPanelUrl, 'target' => "_blank", 'class' => "btn btn-warning" ], "DEV: panel klienta") : "", UI::h('form', [ 'method' => "POST", 'class' => "form-horizontal", 'style' => "margin:24px 0; padding: 24px; border:1px solid #eee" ], [ UI::h('input', [ 'type' => "hidden", 'name' => "email", 'value' => $email ]), UI::h('label', [ 'class' => "col-md-1 control-label" ], "Hasło:"), UI::h('div', [ 'method' => "POST", 'class' => "col-md-4" ], [ UI::h('input', [ 'type' => "text", 'name' => "passwd", 'value' => '', 'class' => "form-control" ]), ]), UI::h('input', [ 'type' => "hidden", 'name' => "_postTask", 'value' => 'testAuth' ]), UI::h('input', [ 'type' => "submit", 'value' => "Testuj logowanie do panelu klienta", 'class' => "btn btn-default" ]), ($_testUserInfo) ? UI::h('div', [ 'class' => "alert alert-success" ], [ UI::h('p', [], "Klient: [{$_testUserInfo['ID']}] '{$_testUserInfo['P_NAME']} {$_testUserInfo['P_NAME_SECOND']}'"), ]) : UI::h('div', [], "..."), ]), UI::h('p', [], "All users:"), UI::hTable([ 'rows' => array_map(function ($item) { return array_merge([ 'ID' => $item['ID'], 'Akcja' => UI::h('a', [ 'href' => $this->getLink('', [ 'id' => $item['ID'] ]) ], "wybierz"), ], $item); }, Theme_Auth_panel_biall_net::test_fetchAllUsers($email)) ]), UI::h('p', [], "Active BIALL-NET users (BILLING_OWNER: 1 BN, 3 NETDAY):"), UI::hTable([ 'rows' => Theme_Auth_panel_biall_net::fetchActiveUsers($email) ]), ]); } }