Remake design for plugins buttons

This commit is contained in:
Haitem 2020-10-26 16:45:45 +01:00
parent 7533facf07
commit eba00c2744
3 changed files with 38 additions and 38 deletions

View File

@ -2,13 +2,16 @@
if (!empty ($_POST)){ if (!empty ($_POST)){
if ( if (
isset($_POST['name']) && isset($_POST['name']) &&
$_POST['name'] != '' && $_POST['name'] != ''
isset($_POST['actualStatus'])
){ ){
if ($_POST['actualStatus']) { if ($_POST['status'] == "true") {
rename($_SERVER['DOCUMENT_ROOT'] . BASEDIR . 'app/plugins/' . $_POST['name'] . ".php", $_SERVER['DOCUMENT_ROOT'] . BASEDIR . 'app/plugins/!' . $_POST['name'] . ".php"); if (file_exists ($_SERVER['DOCUMENT_ROOT'] . BASEDIR . 'app/plugins/!' . $_POST['name'] . ".php")) {
rename($_SERVER['DOCUMENT_ROOT'] . BASEDIR . 'app/plugins/!' . $_POST['name'] . ".php", $_SERVER['DOCUMENT_ROOT'] . BASEDIR . 'app/plugins/' . $_POST['name'] . ".php");
}
} else { } else {
rename($_SERVER['DOCUMENT_ROOT'] . BASEDIR . 'app/plugins/!' . $_POST['name'] . ".php", $_SERVER['DOCUMENT_ROOT'] . BASEDIR . 'app/plugins/' . $_POST['name'] . ".php"); if (file_exists ($_SERVER['DOCUMENT_ROOT'] . BASEDIR . 'app/plugins/' . $_POST['name'] . ".php")) {
rename($_SERVER['DOCUMENT_ROOT'] . BASEDIR . 'app/plugins/' . $_POST['name'] . ".php", $_SERVER['DOCUMENT_ROOT'] . BASEDIR . 'app/plugins/!' . $_POST['name'] . ".php");
}
} }
header('Location: ./plugins'); header('Location: ./plugins');
die(); die();

View File

@ -1,21 +1,29 @@
<div class="col-12 col-md-6 col-xl-4 square-wrap"> <div class="col-12 col-md-6 col-xl-4 square-wrap">
<div class="rectangle-2"> <div class="rectangle-2">
<div class="square-content double <?php echo ($PLUGINSTATUS == 0 ? 'is-inactive' : ''); ?>" id="plugin-<?php echo $PLUGINID; ?>"> <div class="square-content double <?php echo ($PLUGINSTATUS == false ? 'is-inactive' : ''); ?>">
<div class="row"> <div class="row">
<div class="col-1"> <div class="col-1">
<h5 class="fa"> <h5 class="fa">
<?php echo $PLUGINNAME ?> <?php echo $PLUGINNAME ?>
</h5> </h5>
</div> </div>
</div> </div>
<div class="row"> <div class="row">
<div class="col"> <div class="col">
<a class="button is-primary m-1" onClick="restartAutomation(<?php echo $PLUGINID; ?>);"><?php $LANGMNG->echo('b_restart')?></a> <form method="post" action="">
</div> <input type="hidden" name="name" value="<?php echo $PLUGINNAME; ?>"/>
<div class="col"> <input type="hidden" name="status" value="true"/>
<a class="button is-primary m-1" onClick="toggleAutomation(<?php echo $PLUGINID; ?>);"><?php $LANGMNG->echo('b_disable')?></a> <a class="button is-primary m-1" onclick="$(this).closest('form').submit();"><?php $LANGMNG->echo('b_approve')?></a>
</div> </form>
</div> </div>
</div> <div class="col">
</div> <form method="post" action="">
<input type="hidden" name="name" value="<?php echo $PLUGINNAME; ?>"/>
<input type="hidden" name="status" value="false"/>
<a class="button is-primary m-1" onclick="$(this).closest('form').submit();"><?php $LANGMNG->echo('b_disable')?></a>
</form>
</div>
</div>
</div>
</div>
</div> </div>

View File

@ -27,27 +27,16 @@
<div class="row mb-4"> <div class="row mb-4">
<?php if ($PLUGINS): ?> <?php if ($PLUGINS): ?>
<?php foreach ($PLUGINS as $plugin): <?php foreach ($PLUGINS as $plugin):
//BUTTON //BUTTON
$partial = new Partial('pluginButton'); $partial = new Partial('pluginButton');
$partial->prepare('langMng',$LANGMNG); $partial->prepare('langMng',$LANGMNG);
$partial->prepare('pluginName',$plugin['name']); $partial->prepare('pluginName',$plugin['name']);
$partial->prepare('pluginStatus',$plugin['status']); $partial->prepare('pluginStatus',$plugin['status']);
$partial->render(); $partial->render();
?> ?>
<div class="content">
<form method="post" action="">
<input type="hidden" name="name" value="<?php echo $plugin['name']; ?>"/>
<input type="hidden" name="actualStatus" value="<?php echo $plugin['status']; ?>"/>
<a onclick="$(this).closest('form').submit();">
<div class="panel box content <?php echo ($plugin['status'] ? '' : 'disabled '); ?>p-4">
<h5><?php echo $plugin['name']; ?></h5>
</div>
</a>
</form>
</div>
<?php endforeach; ?> <?php endforeach; ?>
<?php endif; ?> <?php endif; ?>
</div> </div>