fix pagination and collections
This commit is contained in:
@@ -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']
|
||||
]);
|
||||
|
||||
@@ -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']
|
||||
]);
|
||||
|
||||
@@ -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']
|
||||
|
||||
@@ -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']
|
||||
]);
|
||||
|
||||
@@ -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']
|
||||
]);
|
||||
|
||||
@@ -1,18 +1,20 @@
|
||||
{% macro paging(pagination) %}
|
||||
<div class="card-footer border-top">
|
||||
{% if pagination.current_page >= pagination.last_page %}
|
||||
<a href="?s={{ s }}&page={{ page }}&action={{ action }}&pageno=1">«</a>
|
||||
{% endif %}
|
||||
{% if pagination.current_page >= pagination.last_page %}
|
||||
<a href="?s={{ s }}&page={{ page }}&action={{ action }}&pageno={{ pagination.current_page - 1 }}">‹</a>
|
||||
{% endif %}
|
||||
{% if pagination.current_page < pagination.last_page %}
|
||||
<a href="?s={{ s }}&page={{ page }}&action={{ action }}&pageno={{ pagination.current_page + 1 }}">›</a>
|
||||
{% endif %}
|
||||
{% if pagination.current_page < pagination.last_page %}
|
||||
<a href="?s={{ s }}&page={{ page }}&action={{ action }}&pageno={{ pagination.last_page }}">»</a>
|
||||
{% endif %}
|
||||
</div>
|
||||
{% if pagination.last_page > 1 %}
|
||||
<div class="card-footer border-top">
|
||||
{% if pagination.current_page >= pagination.last_page %}
|
||||
<a href="?s={{ s }}&page={{ page }}&action={{ action }}&pageno=1">«</a>
|
||||
{% endif %}
|
||||
{% if pagination.current_page >= pagination.last_page %}
|
||||
<a href="?s={{ s }}&page={{ page }}&action={{ action }}&pageno={{ pagination.current_page - 1 }}">‹</a>
|
||||
{% endif %}
|
||||
{% if pagination.current_page < pagination.last_page %}
|
||||
<a href="?s={{ s }}&page={{ page }}&action={{ action }}&pageno={{ pagination.current_page + 1 }}">›</a>
|
||||
{% endif %}
|
||||
{% if pagination.current_page < pagination.last_page %}
|
||||
<a href="?s={{ s }}&page={{ page }}&action={{ action }}&pageno={{ pagination.last_page }}">»</a>
|
||||
{% endif %}
|
||||
</div>
|
||||
{% endif %}
|
||||
{% endmacro %}
|
||||
|
||||
{% macro titlesorting(pagination, key, th) %}
|
||||
@@ -25,4 +27,4 @@
|
||||
{% else %}
|
||||
<th class="p-3 {{ th.class }}">{{ th.text }}</th>
|
||||
{% endif %}
|
||||
{% endmacro %}
|
||||
{% endmacro %}
|
||||
|
||||
Reference in New Issue
Block a user