koblog/bl-kernel/admin/views/plugins.php

134 lines
3.4 KiB
PHP
Raw Normal View History

2015-06-11 04:27:04 +02:00
<?php
2015-10-19 00:45:58 +02:00
2025-01-18 16:28:15 +01:00
echo "<div class='d-flex justify-content-between align-content-center'>";
2023-07-15 15:58:33 +02:00
echo Bootstrap::pageTitle(array('title' => $L->g('Plugins'), 'icon' => 'puzzle-piece'));
2015-10-19 00:45:58 +02:00
2025-01-18 16:28:15 +01:00
echo "<div>";
echo Bootstrap::link(array(
2023-07-15 15:58:33 +02:00
'title' => $L->g('Change the position of the plugins'),
'href' => HTML_PATH_ADMIN_ROOT . 'plugins-position',
2025-01-18 16:28:15 +01:00
'icon' => 'arrows',
'class' => 'btn btn-outline-secondary'
));
2018-02-06 18:26:59 +01:00
2025-01-18 16:28:15 +01:00
echo "</div></div>";
2023-07-15 15:58:33 +02:00
echo Bootstrap::formTitle(array('title' => $L->g('Search plugins')));
?>
2025-01-18 16:28:15 +01:00
<input type="text" dir="auto" class="form-control mb-3" id="search" placeholder="<?php $L->p('Search') ?>">
<script>
2023-07-15 15:58:33 +02:00
$(document).ready(function() {
$("#search").on("keyup", function() {
var textToSearch = $(this).val().toLowerCase();
$(".searchItem").each(function() {
var item = $(this);
item.hide();
item.find(".searchText").each(function() {
var element = $(this).text().toLowerCase();
if (element.indexOf(textToSearch) != -1) {
item.show();
}
});
});
});
});
</script>
<?php
2025-01-18 16:28:15 +01:00
echo '<div class="card mb-3"><h6 class="card-header">';
echo $L->g('Enabled plugins');
echo ' </h6><table class="table m-0">
<tbody>
2015-10-19 00:45:58 +02:00
';
// Show installed plugins
foreach ($pluginsInstalled as $plugin) {
2023-07-15 15:58:33 +02:00
if ($plugin->type() == 'theme') {
// Do not display theme's plugins
continue;
}
2025-01-18 16:28:15 +01:00
echo '<tr id="' . $plugin->className() . '" class="searchItem card-tablebody">';
2015-06-12 06:00:04 +02:00
echo '<td class="align-middle pt-3 pb-3 w-25">
2023-07-15 15:58:33 +02:00
<div class="searchText">' . $plugin->name() . '</div>
<div class="mt-1">';
2023-07-15 15:58:33 +02:00
if (method_exists($plugin, 'form')) {
2025-01-18 16:28:15 +01:00
echo '<a class="me-3" href="' . HTML_PATH_ADMIN_ROOT . 'configure-plugin/' . $plugin->className() . '">' . $L->g('Settings') . '</a>';
2023-07-15 15:58:33 +02:00
}
echo '<a href="' . HTML_PATH_ADMIN_ROOT . 'uninstall-plugin/' . $plugin->className() . '">' . $L->g('Deactivate') . '</a>';
echo '</div>';
echo '</td>';
echo '<td class="searchText align-middle d-none d-sm-table-cell">';
2023-07-15 15:58:33 +02:00
echo $plugin->description();
echo '</td>';
echo '<td class="text-center align-middle d-none d-lg-table-cell">';
2023-07-15 15:58:33 +02:00
echo '<span>' . $plugin->version() . '</span>';
echo '</td>';
echo '<td class="text-center align-middle d-none d-lg-table-cell">
2023-07-15 15:58:33 +02:00
<a target="_blank" href="' . $plugin->website() . '">' . $plugin->author() . '</a>
</td>';
echo '</tr>';
}
echo '
2025-01-18 16:28:15 +01:00
</tbody>
</table>
</div>
';
2025-01-18 16:28:15 +01:00
echo '<div class="card mb-3"><h6 class="card-header">';
echo $L->g('Disabled plugins');
echo ' </h6><table class="table m-0">
<tbody>
';
// Plugins not installed
$pluginsNotInstalled = array_diff_key($plugins['all'], $pluginsInstalled);
foreach ($pluginsNotInstalled as $plugin) {
2023-07-15 15:58:33 +02:00
if ($plugin->type() == 'theme') {
// Do not display theme's plugins
continue;
}
echo '<tr id="' . $plugin->className() . '" class="searchItem">';
echo '<td class="align-middle pt-3 pb-3 w-25">
2023-07-15 15:58:33 +02:00
<div class="searchText">' . $plugin->name() . '</div>
<div class="mt-1">
2023-07-15 15:58:33 +02:00
<a href="' . HTML_PATH_ADMIN_ROOT . 'install-plugin/' . $plugin->className() . '">' . $L->g('Activate') . '</a>
</div>
</td>';
echo '<td class="searchText align-middle d-none d-sm-table-cell">';
2023-07-15 15:58:33 +02:00
echo $plugin->description();
echo '</td>';
echo '<td class="text-center align-middle d-none d-lg-table-cell">';
2023-07-15 15:58:33 +02:00
echo '<span>' . $plugin->version() . '</span>';
echo '</td>';
2017-04-26 20:16:34 +02:00
echo '<td class="text-center align-middle d-none d-lg-table-cell">
2023-07-15 15:58:33 +02:00
<a target="_blank" href="' . $plugin->website() . '">' . $plugin->author() . '</a>
</td>';
2015-10-19 00:45:58 +02:00
2015-11-30 01:45:30 +01:00
echo '</tr>';
}
2015-10-19 00:45:58 +02:00
echo '
2025-01-18 16:28:15 +01:00
</tbody>
</table>
</div>
2023-07-15 15:58:33 +02:00
';