diff --git a/customer_domains.php b/customer_domains.php index 2091f961..a3704583 100644 --- a/customer_domains.php +++ b/customer_domains.php @@ -41,20 +41,16 @@ if ($page == 'overview' || $page == 'domains') { try { $domain_list_data = include_once dirname(__FILE__) . '/lib/tablelisting/customer/tablelisting.domains.php'; - $list = (new \Froxlor\UI\Collection(\Froxlor\Api\Commands\SubDomains::class, $userinfo)) + $collection = (new \Froxlor\UI\Collection(\Froxlor\Api\Commands\SubDomains::class, $userinfo)) //->addParam(['sql_search' => ['d.parentdomainid' => $parentdomain_id]]) - ->withPagination($domain_list_data['domain_list']['columns']) - ->getList(); + ->withPagination($domain_list_data['domain_list']['columns']); + $parentDomainCollection = (new \Froxlor\UI\Collection(SubDomains::class, $userinfo, ['sql_search' => ['d.parentdomainid' => 0]])); } catch (Exception $e) { \Froxlor\UI\Response::dynamic_error($e->getMessage()); } - $json_result = SubDomains::getLocal($userinfo, ['sql_search' => ['d.parentdomainid' => 0]])->listing(); - $result = json_decode($json_result, true)['data']; - $parentdomains_count = $result['count']; - $actions_links = false; - if (($userinfo['subdomains_used'] < $userinfo['subdomains'] || $userinfo['subdomains'] == '-1') && $parentdomains_count != 0) { + if (($userinfo['subdomains_used'] < $userinfo['subdomains'] || $userinfo['subdomains'] == '-1') && $parentDomainCollection->count() != 0) { $actions_links = [[ 'href' => $linker->getLink(['section' => 'domains', 'page' => 'domains', 'action' => 'add']), 'label' => $lng['domains']['subdomain_add'] @@ -62,7 +58,7 @@ if ($page == 'overview' || $page == 'domains') { } UI::twigBuffer('user/table.html.twig', [ - 'listing' => \Froxlor\UI\Listing::format($list, $domain_list_data['domain_list']), + 'listing' => \Froxlor\UI\Listing::format($collection, $domain_list_data['domain_list']), 'actions_links' => $actions_links, 'entity_info' => $lng['domains']['description'] ]); diff --git a/customer_email.php b/customer_email.php index 2f1d590d..c2bb168a 100644 --- a/customer_email.php +++ b/customer_email.php @@ -40,9 +40,8 @@ if ($page == 'overview' || $page == 'emails') { try { $email_list_data = include_once dirname(__FILE__) . '/lib/tablelisting/customer/tablelisting.emails.php'; - $list = (new \Froxlor\UI\Collection(\Froxlor\Api\Commands\Emails::class, $userinfo)) - ->withPagination($email_list_data['email_list']['columns']) - ->getList(); + $collection = (new \Froxlor\UI\Collection(\Froxlor\Api\Commands\Emails::class, $userinfo)) + ->withPagination($email_list_data['email_list']['columns']); } catch (Exception $e) { \Froxlor\UI\Response::dynamic_error($e->getMessage()); } @@ -58,7 +57,7 @@ if ($page == 'overview' || $page == 'emails') { $emaildomains_count = $result2['emaildomains']; $actions_links = false; - if (($userinfo['emails_used'] < $userinfo['emails'] || $userinfo['emails'] == '-1') && $emaildomains_count !=0) { + if (($userinfo['emails_used'] < $userinfo['emails'] || $userinfo['emails'] == '-1') && $emaildomains_count != 0) { $actions_links = [[ 'href' => $linker->getLink(['section' => 'email', 'page' => $page, 'action' => 'add']), 'label' => $lng['emails']['emails_add'] @@ -66,7 +65,7 @@ if ($page == 'overview' || $page == 'emails') { } UI::twigBuffer('user/table.html.twig', [ - 'listing' => \Froxlor\UI\Listing::format($list, $email_list_data['email_list']), + 'listing' => \Froxlor\UI\Listing::format($collection, $email_list_data['email_list']), 'actions_links' => $actions_links, 'entity_info' => $lng['emails']['description'] ]); diff --git a/customer_extras.php b/customer_extras.php index 5ea69bd5..7c119132 100644 --- a/customer_extras.php +++ b/customer_extras.php @@ -48,15 +48,14 @@ if ($page == 'overview' || $page == 'htpasswds') { ); try { $htpasswd_list_data = include_once dirname(__FILE__) . '/lib/tablelisting/customer/tablelisting.htpasswd.php'; - $list = (new \Froxlor\UI\Collection(\Froxlor\Api\Commands\DirProtections::class, $userinfo)) - ->withPagination($htpasswd_list_data['htpasswd_list']['columns']) - ->getList(); + $collection = (new \Froxlor\UI\Collection(\Froxlor\Api\Commands\DirProtections::class, $userinfo)) + ->withPagination($htpasswd_list_data['htpasswd_list']['columns']); } catch (Exception $e) { \Froxlor\UI\Response::dynamic_error($e->getMessage()); } UI::twigBuffer('user/table.html.twig', [ - 'listing' => \Froxlor\UI\Listing::format($list, $htpasswd_list_data['htpasswd_list']), + 'listing' => \Froxlor\UI\Listing::format($collection, $htpasswd_list_data['htpasswd_list']), 'actions_links' => [[ 'href' => $linker->getLink(['section' => 'extras', 'page' => 'htpasswds', 'action' => 'add']), 'label' => $lng['extras']['directoryprotection_add'] @@ -170,15 +169,14 @@ if ($page == 'overview' || $page == 'htpasswds') { try { $htaccess_list_data = include_once dirname(__FILE__) . '/lib/tablelisting/customer/tablelisting.htaccess.php'; - $list = (new \Froxlor\UI\Collection(\Froxlor\Api\Commands\DirOptions::class, $userinfo)) - ->withPagination($htaccess_list_data['htaccess_list']['columns']) - ->getList(); + $collection = (new \Froxlor\UI\Collection(\Froxlor\Api\Commands\DirOptions::class, $userinfo)) + ->withPagination($htaccess_list_data['htaccess_list']['columns']); } catch (Exception $e) { \Froxlor\UI\Response::dynamic_error($e->getMessage()); } UI::twigBuffer('user/table.html.twig', [ - 'listing' => \Froxlor\UI\Listing::format($list, $htaccess_list_data['htaccess_list']), + 'listing' => \Froxlor\UI\Listing::format($collection, $htaccess_list_data['htaccess_list']), 'add_link' => [ 'href' => $linker->getLink(['section' => 'extras', 'page' => 'htaccess', 'action' => 'add']), 'label' => $lng['extras']['pathoptions_add'] diff --git a/customer_ftp.php b/customer_ftp.php index ce3bde10..8594bf1e 100644 --- a/customer_ftp.php +++ b/customer_ftp.php @@ -37,9 +37,8 @@ if ($page == 'overview' || $page == 'accounts') { $log->logAction(\Froxlor\FroxlorLogger::USR_ACTION, LOG_NOTICE, "viewed customer_ftp::accounts"); try { $ftp_list_data = include_once dirname(__FILE__) . '/lib/tablelisting/customer/tablelisting.ftps.php'; - $list = (new \Froxlor\UI\Collection(\Froxlor\Api\Commands\Ftps::class, $userinfo)) - ->withPagination($ftp_list_data['ftp_list']['columns']) - ->getList(); + $collection = (new \Froxlor\UI\Collection(\Froxlor\Api\Commands\Ftps::class, $userinfo)) + ->withPagination($ftp_list_data['ftp_list']['columns']); } catch (Exception $e) { \Froxlor\UI\Response::dynamic_error($e->getMessage()); } @@ -53,7 +52,7 @@ if ($page == 'overview' || $page == 'accounts') { } UI::twigBuffer('user/table.html.twig', [ - 'listing' => \Froxlor\UI\Listing::format($list, $ftp_list_data['ftp_list']), + 'listing' => \Froxlor\UI\Listing::format($collection, $ftp_list_data['ftp_list']), 'actions_links' => $actions_links, 'entity_info' => $lng['ftp']['description'] ]); diff --git a/customer_mysql.php b/customer_mysql.php index 4985e0f3..5d815b69 100644 --- a/customer_mysql.php +++ b/customer_mysql.php @@ -48,9 +48,8 @@ if ($page == 'overview' || $page == 'mysqls') { try { $mysql_list_data = include_once dirname(__FILE__) . '/lib/tablelisting/customer/tablelisting.mysqls.php'; - $list = (new \Froxlor\UI\Collection(\Froxlor\Api\Commands\Mysqls::class, $userinfo)) - ->withPagination($mysql_list_data['mysql_list']['columns']) - ->getList(); + $collection = (new \Froxlor\UI\Collection(\Froxlor\Api\Commands\Mysqls::class, $userinfo)) + ->withPagination($mysql_list_data['mysql_list']['columns']); } catch (Exception $e) { \Froxlor\UI\Response::dynamic_error($e->getMessage()); } @@ -68,7 +67,7 @@ if ($page == 'overview' || $page == 'mysqls') { } UI::twigBuffer('user/table.html.twig', [ - 'listing' => \Froxlor\UI\Listing::format($list, $mysql_list_data['mysql_list']), + 'listing' => \Froxlor\UI\Listing::format($collection, $mysql_list_data['mysql_list']), 'actions_links' => $actions_links, 'entity_info' => $lng['mysql']['description'] ]); diff --git a/templates/Froxlor/table/pagination.html.twig b/templates/Froxlor/table/pagination.html.twig index c3a9b570..3ea1cb7f 100644 --- a/templates/Froxlor/table/pagination.html.twig +++ b/templates/Froxlor/table/pagination.html.twig @@ -1,18 +1,20 @@ {% macro paging(pagination) %} - + {% if pagination.last_page > 1 %} + + {% endif %} {% endmacro %} {% macro titlesorting(pagination, key, th) %} @@ -25,4 +27,4 @@ {% else %} {{ th.text }} {% endif %} -{% endmacro %} \ No newline at end of file +{% endmacro %}