mirror of
https://github.com/ShaYmez/FreeSTAR-Status-Engine.git
synced 2026-06-01 13:46:46 -04:00
files reformatted
for better readability
This commit is contained in:
+32
-40
@@ -1,11 +1,9 @@
|
||||
<?php
|
||||
if (isset($_GET['new']))
|
||||
{
|
||||
if (isset($_GET['new'])) {
|
||||
Service::add();
|
||||
}
|
||||
|
||||
if (isset($_GET['edit']))
|
||||
{
|
||||
if (isset($_GET['edit'])) {
|
||||
Service::edit();
|
||||
}
|
||||
|
||||
@@ -19,7 +17,7 @@ $service_value = isset($_POST['service']) ? $_POST['service'] : '';
|
||||
$description_value = isset($_POST['description']) ? $_POST['description'] : '';
|
||||
$group_id_value = isset($_POST['group_id']) ? $_POST['group_id'] : '';
|
||||
|
||||
if ( isset($_GET['id']) && !isset($_POST['id']) ) {
|
||||
if (isset($_GET['id']) && !isset($_POST['id'])) {
|
||||
$service_id = (int) $_GET['id'];
|
||||
$boolEdit = true;
|
||||
$stmt = $mysqli->prepare("SELECT * FROM services WHERE id LIKE ?");
|
||||
@@ -28,7 +26,7 @@ if ( isset($_GET['id']) && !isset($_POST['id']) ) {
|
||||
$query = $stmt->get_result();
|
||||
$data = $query->fetch_assoc();
|
||||
//print_r($data);
|
||||
$service_value = $data['name'];
|
||||
$service_value = $data['name'];
|
||||
$description_value = $data['description'];
|
||||
$group_id_value = $data['group_id'];
|
||||
}
|
||||
@@ -36,52 +34,46 @@ if ( isset($_GET['id']) && !isset($_POST['id']) ) {
|
||||
|
||||
if (!$boolEdit) {
|
||||
|
||||
Template::render_header(_("New service"), true); ?>
|
||||
<div class="text-center">
|
||||
<h2><?php echo _("Add new service");?></h2>
|
||||
</div>
|
||||
Template::render_header(_("New service"), true); ?>
|
||||
<div class="text-center">
|
||||
<h2><?php echo _("Add new service"); ?></h2>
|
||||
</div>
|
||||
<?php
|
||||
$form_url = WEB_URL . '/admin/?do=new-service&new=service';
|
||||
$form_url = WEB_URL . '/admin/?do=new-service&new=service';
|
||||
} else {
|
||||
Template::render_header(_("New service"), true); ?>
|
||||
<div class="text-center">
|
||||
<h2><?php echo _("Add new service");?></h2>
|
||||
<h2><?php echo _("Add new service"); ?></h2>
|
||||
</div>
|
||||
<?php
|
||||
$form_url = WEB_URL . '/admin/?do=edit-service&edit&id='.$service_id;
|
||||
<?php
|
||||
$form_url = WEB_URL . '/admin/?do=edit-service&edit&id=' . $service_id;
|
||||
}
|
||||
?>
|
||||
<form action="<?php echo $form_url;?>" method="POST" class="form-horizontal">
|
||||
<?php if (isset($message))
|
||||
{?>
|
||||
<p class="alert alert-danger"><?php echo $message?></p>
|
||||
<?php
|
||||
} ?>
|
||||
<form action="<?php echo $form_url; ?>" method="POST" class="form-horizontal">
|
||||
<?php if (isset($message)) { ?>
|
||||
<p class="alert alert-danger"><?php echo $message ?></p>
|
||||
<?php
|
||||
} ?>
|
||||
<div class="form-group">
|
||||
<div class="col-sm-6"><label for="service"><?php echo _("Service");?>: </label><input type="text" maxlength="50" name="service" value="<?php echo ((isset($_POST['service']))?htmlspecialchars($_POST['service'],ENT_QUOTES):$service_value);?>" id="service" placeholder="<?php echo _("service");?>" class="form-control" required></div>
|
||||
<div class="col-sm-6"><label for="description"><?php echo _("Description");?>: </label><input type="text" maxlength="200" name="description" value="<?php echo ((isset($_POST['description']))?htmlspecialchars($_POST['description'],ENT_QUOTES):$description_value);?>" id="description" placeholder="<?php echo _("Description");?>" class="form-control"></div>
|
||||
<div class="col-sm-6"><label for="service"><?php echo _("Service"); ?>: </label><input type="text" maxlength="50" name="service" value="<?php echo ((isset($_POST['service'])) ? htmlspecialchars($_POST['service'], ENT_QUOTES) : $service_value); ?>" id="service" placeholder="<?php echo _("service"); ?>" class="form-control" required></div>
|
||||
<div class="col-sm-6"><label for="description"><?php echo _("Description"); ?>: </label><input type="text" maxlength="200" name="description" value="<?php echo ((isset($_POST['description'])) ? htmlspecialchars($_POST['description'], ENT_QUOTES) : $description_value); ?>" id="description" placeholder="<?php echo _("Description"); ?>" class="form-control"></div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<div class="col-sm-6">
|
||||
<label for="group_id"><?php echo _("Service Group");?>: </label>
|
||||
<label for="group_id"><?php echo _("Service Group"); ?>: </label>
|
||||
<select name="group_id" id="group_id" class="form-control">
|
||||
<?php
|
||||
if (!empty($group_id_value))
|
||||
{
|
||||
if (!empty($group_id_value)) {
|
||||
$group_id = $group_id_value;
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
$group_id = null;
|
||||
}
|
||||
$groups = ServiceGroup::get_groups();
|
||||
foreach ($groups as $key => $value) {
|
||||
if ($group_id == $key)
|
||||
{
|
||||
echo '<option value="'.$key.'" selected>'.$value.'</option>';
|
||||
}
|
||||
else{
|
||||
echo '<option value="'.$key.'">'.$value.'</option>';
|
||||
if ($group_id == $key) {
|
||||
echo '<option value="' . $key . '" selected>' . $value . '</option>';
|
||||
} else {
|
||||
echo '<option value="' . $key . '">' . $value . '</option>';
|
||||
}
|
||||
}
|
||||
?>
|
||||
@@ -89,9 +81,9 @@ $form_url = WEB_URL . '/admin/?do=new-service&new=service';
|
||||
</div>
|
||||
</div>
|
||||
<?php
|
||||
if ( $boolEdit ) {
|
||||
echo '<input type="hidden" id="id" name="id" value="'.$service_id.'">';
|
||||
}
|
||||
?>
|
||||
<button type="submit" class="btn btn-primary pull-right"><?php echo _("Submit");?></button>
|
||||
</form>
|
||||
if ($boolEdit) {
|
||||
echo '<input type="hidden" id="id" name="id" value="' . $service_id . '">';
|
||||
}
|
||||
?>
|
||||
<button type="submit" class="btn btn-primary pull-right"><?php echo _("Submit"); ?></button>
|
||||
</form>
|
||||
Reference in New Issue
Block a user