$errors * @var array $form * @var array $user */ use MintyPHP\Session; $values = $form; $avatarUuid = (string) ($values['uuid'] ?? ''); $userAvatarService = app(\MintyPHP\Service\User\UserAvatarService::class); $hasAvatar = $avatarUuid !== '' && $userAvatarService->hasAvatar($avatarUuid); $currentUserId = (int) ($_SESSION['user']['id'] ?? 0); $isOwnAccount = $currentUserId > 0 && $currentUserId === (int) ($values['id'] ?? 0); $titleText = $isOwnAccount ? t('My account') : t('Edit user'); $canViewUsers = !empty($canViewUsers); $canViewAddressBook = !empty($canViewAddressBook); $canViewUserMeta = !empty($canViewUserMeta); $canViewUserAudit = !empty($canViewUserAudit); $canAccessPdf = !empty($canAccessPdf); $canViewSecurityArtifacts = !empty($canViewSecurityArtifacts); $canViewPermissionsTable = !empty($canViewPermissionsTable); $canEditUser = !empty($canEditUser); $canDeleteUser = !empty($canDeleteUser); $hideNavigation = $isOwnAccount && !$canViewUsers; $lastLoginProvider = strtolower((string) ($values['last_login_provider'] ?? ($user['last_login_provider'] ?? ''))); $lastLoginAt = (string) ($values['last_login_at'] ?? ($user['last_login_at'] ?? '')); $lastLoginProviderLabel = '-'; $lastLoginProviderVariant = 'neutral'; if ($lastLoginAt !== '') { if ($lastLoginProvider === 'microsoft') { $lastLoginProviderLabel = t('Microsoft'); $lastLoginProviderVariant = 'primary'; } elseif ($lastLoginProvider === 'local') { $lastLoginProviderLabel = t('Local'); $lastLoginProviderVariant = 'secondary'; } else { $lastLoginProviderLabel = t('Unknown'); $lastLoginProviderVariant = 'warning'; } } ?>
t('Home'), 'path' => 'admin'], ['label' => t('Users'), 'path' => 'admin/users'], ['label' => $titleText], ]; require templatePath('partials/app-breadcrumb.phtml'); ?> 'link', 'href' => lurl('address-book/view/' . ($values['uuid'] ?? '')), 'label' => t('View in address book'), ]; } if ($canEditUser) { $asideActions[] = [ 'type' => 'form', 'method' => 'post', 'action' => 'admin/users/send-access/' . ($values['uuid'] ?? ''), 'confirm' => t('Send access email to this user?'), 'label' => t('Send access'), ]; } if ($canAccessPdf) { $asideActions[] = [ 'type' => 'form', 'method' => 'post', 'action' => 'admin/users/access-pdf', 'label' => t('Access PDF'), 'target' => '_blank', 'fields' => [ 'uuid' => (string) ($values['uuid'] ?? ''), ], ]; } $titlebarActions = []; if ($canEditUser) { $titlebarActions[] = [ 'form' => 'user-form', 'name' => 'action', 'value' => 'save', 'class' => 'secondary outline', 'label' => t('Save'), ]; if (!$hideNavigation) { $titlebarActions[] = [ 'form' => 'user-form', 'name' => 'action', 'value' => 'save_close', 'class' => 'primary', 'label' => t('Save & close'), ]; } } $titlebar = [ 'title' => $titleText, 'backHref' => $hideNavigation ? '' : 'admin/users', 'backTitle' => t('Cancel'), 'actions' => $titlebarActions, ]; require templatePath('partials/app-details-titlebar.phtml'); ?>