diff options
Diffstat (limited to 'admin/user/index.php')
-rw-r--r-- | admin/user/index.php | 63 |
1 files changed, 27 insertions, 36 deletions
diff --git a/admin/user/index.php b/admin/user/index.php index 223e83e..7d0cfa8 100644 --- a/admin/user/index.php +++ b/admin/user/index.php @@ -31,44 +31,35 @@ if($currentSite < 1 OR ($currentSite > $lastSite AND $lastSite > 0)) { $execSQL = "SELECT id FROM %s ORDER BY {$site_sort} LIMIT ".(($currentSite-1) * $site_size).", {$site_size}"; $userIDs = $Database->query(sprintf($execSQL, User\Attribute::TABLE))->fetchAll($Database::FETCH_COLUMN); -#=============================================================================== -# TRY: Template\Exception -#=============================================================================== -try { - foreach($userIDs as $userID) { - try { - $User = User\Factory::build($userID); - $ItemTemplate = generateUserItemTemplate($User); - - $users[] = $ItemTemplate; - } catch(User\Exception $Exception){} - } - - $PaginationTemplate = Template\Factory::build('pagination'); - $PaginationTemplate->set('THIS', $currentSite); - $PaginationTemplate->set('LAST', $lastSite); - $PaginationTemplate->set('HREF', Application::getAdminURL('user/?site=%d')); - - $ListTemplate = Template\Factory::build('user/index'); - $ListTemplate->set('LIST', [ - 'USERS' => $users ?? [] - ]); +foreach($userIDs as $userID) { + try { + $User = User\Factory::build($userID); + $ItemTemplate = generateUserItemTemplate($User); - $ListTemplate->set('PAGINATION', [ - 'THIS' => $currentSite, - 'LAST' => $lastSite, - 'HTML' => $PaginationTemplate - ]); - - $MainTemplate = Template\Factory::build('main'); - $MainTemplate->set('NAME', $Language->text('title_user_overview', $currentSite)); - $MainTemplate->set('HTML', $ListTemplate); - echo $MainTemplate; + $users[] = $ItemTemplate; + } catch(User\Exception $Exception){} } #=============================================================================== -# CATCH: Template\Exception +# Build document #=============================================================================== -catch(Template\Exception $Exception) { - Application::exit($Exception->getMessage()); -} +$PaginationTemplate = Template\Factory::build('pagination'); +$PaginationTemplate->set('THIS', $currentSite); +$PaginationTemplate->set('LAST', $lastSite); +$PaginationTemplate->set('HREF', Application::getAdminURL('user/?site=%d')); + +$ListTemplate = Template\Factory::build('user/index'); +$ListTemplate->set('LIST', [ + 'USERS' => $users ?? [] +]); + +$ListTemplate->set('PAGINATION', [ + 'THIS' => $currentSite, + 'LAST' => $lastSite, + 'HTML' => $PaginationTemplate +]); + +$MainTemplate = Template\Factory::build('main'); +$MainTemplate->set('NAME', $Language->text('title_user_overview', $currentSite)); +$MainTemplate->set('HTML', $ListTemplate); +echo $MainTemplate; |