tablelisting fpmdaemons
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
This commit is contained in:
@@ -183,25 +183,21 @@ if ($page == 'overview') {
|
||||
if ($action == '') {
|
||||
|
||||
try {
|
||||
$json_result = FpmDaemons::getLocal($userinfo)->listing();
|
||||
$fpmconf_list_data = include_once dirname(__FILE__) . '/lib/tablelisting/admin/tablelisting.fpmconfigs.php';
|
||||
$collection = (new \Froxlor\UI\Collection(\Froxlor\Api\Commands\FpmDaemons::class, $userinfo))
|
||||
->withPagination($fpmconf_list_data['fpmconf_list']['columns']);
|
||||
} catch (Exception $e) {
|
||||
\Froxlor\UI\Response::dynamic_error($e->getMessage());
|
||||
}
|
||||
$result = json_decode($json_result, true)['data'];
|
||||
|
||||
$tablecontent = '';
|
||||
$count = 0;
|
||||
if (isset($result['count']) && $result['count'] > 0) {
|
||||
foreach ($result['list'] as $row) {
|
||||
$configs = "";
|
||||
foreach ($row['configs'] as $configused) {
|
||||
$configs .= $configused . "<br>";
|
||||
}
|
||||
$count++;
|
||||
eval("\$tablecontent.=\"" . \Froxlor\UI\Template::getTemplate("phpconfig/fpmdaemons_overview") . "\";");
|
||||
}
|
||||
}
|
||||
eval("echo \"" . \Froxlor\UI\Template::getTemplate("phpconfig/fpmdaemons") . "\";");
|
||||
UI::twigBuffer('user/table.html.twig', [
|
||||
'listing' => \Froxlor\UI\Listing::format($collection, $fpmconf_list_data['fpmconf_list']),
|
||||
'actions_links' => [[
|
||||
'href' => $linker->getLink(['section' => 'phpsettings', 'page' => $page, 'action' => 'add']),
|
||||
'label' => $lng['admin']['fpmsettings']['addnew']
|
||||
]]
|
||||
]);
|
||||
UI::twigOutputBuffer();
|
||||
}
|
||||
|
||||
if ($action == 'add') {
|
||||
|
||||
@@ -38,6 +38,15 @@ class PHPConf
|
||||
return $domains;
|
||||
}
|
||||
|
||||
public static function configsList(array $attributes)
|
||||
{
|
||||
$configs = "";
|
||||
foreach ($attributes['fields']['configs'] as $configused) {
|
||||
$configs .= $configused . "<br>";
|
||||
}
|
||||
return $configs;
|
||||
}
|
||||
|
||||
public static function isNotDefault(array $attributes)
|
||||
{
|
||||
return $attributes['fields']['id'] != 1;
|
||||
|
||||
81
lib/tablelisting/admin/tablelisting.fpmconfigs.php
Normal file
81
lib/tablelisting/admin/tablelisting.fpmconfigs.php
Normal file
@@ -0,0 +1,81 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* This file is part of the Froxlor project.
|
||||
* Copyright (c) 2010 the Froxlor Team (see authors).
|
||||
*
|
||||
* For the full copyright and license information, please view the COPYING
|
||||
* file that was distributed with this source code. You can also view the
|
||||
* COPYING file online at http://files.froxlor.org/misc/COPYING.txt
|
||||
*
|
||||
* @copyright (c) the authors
|
||||
* @author Froxlor team <team@froxlor.org> (2010-)
|
||||
* @author Maurice Preuß <hello@envoyr.com>
|
||||
* @license GPLv2 http://files.froxlor.org/misc/COPYING.txt
|
||||
* @package Tabellisting
|
||||
*
|
||||
*/
|
||||
|
||||
use Froxlor\UI\Callbacks\PHPConf;
|
||||
use Froxlor\UI\Listing;
|
||||
|
||||
return [
|
||||
'fpmconf_list' => [
|
||||
'title' => $lng['menue']['phpsettings']['fpmdaemons'],
|
||||
'icon' => 'fa-brands fa-php',
|
||||
'columns' => [
|
||||
'description' => [
|
||||
'label' => $lng['admin']['phpsettings']['description'],
|
||||
'field' => 'description',
|
||||
],
|
||||
'configs' => [
|
||||
'label' => $lng['admin']['phpsettings']['activephpconfigs'],
|
||||
'field' => 'configs',
|
||||
'text' => [PHPConf::class, 'configsList']
|
||||
],
|
||||
'reload_cmd' => [
|
||||
'label' => $lng['serversettings']['phpfpm_settings']['reload'],
|
||||
'field' => 'reload_cmd'
|
||||
],
|
||||
'config_dir' => [
|
||||
'label' => $lng['serversettings']['phpfpm_settings']['configdir'],
|
||||
'field' => 'config_dir'
|
||||
],
|
||||
'pm' => [
|
||||
'label' => $lng['serversettings']['phpfpm_settings']['configdir'],
|
||||
'field' => 'pm',
|
||||
],
|
||||
],
|
||||
'visible_columns' => Listing::getVisibleColumnsForListing('fpmconf_list', [
|
||||
'description',
|
||||
'configs',
|
||||
'reload_cmd',
|
||||
'config_dir',
|
||||
'pm'
|
||||
]),
|
||||
'actions' => [
|
||||
'edit' => [
|
||||
'icon' => 'fa fa-edit',
|
||||
'title' => $lng['panel']['edit'],
|
||||
'href' => [
|
||||
'section' => 'phpsettings',
|
||||
'page' => 'fpmdaemons',
|
||||
'action' => 'edit',
|
||||
'id' => ':id'
|
||||
],
|
||||
],
|
||||
'delete' => [
|
||||
'icon' => 'fa fa-trash',
|
||||
'title' => $lng['panel']['delete'],
|
||||
'class' => 'text-danger',
|
||||
'href' => [
|
||||
'section' => 'phpsettings',
|
||||
'page' => 'fpmdaemons',
|
||||
'action' => 'delete',
|
||||
'id' => ':id'
|
||||
],
|
||||
'visible' => [PHPConf::class, 'isNotDefault']
|
||||
]
|
||||
]
|
||||
]
|
||||
];
|
||||
Reference in New Issue
Block a user