Files
namaste/utilities/admin/loadConstants.php
gramps 373ebc8c93 Archive: Namaste PHP AMQP framework v1.0 (2017-2020)
952 days continuous production uptime, 40k+ tp/s single node.
Original corpo Bitbucket history not included — clean archive commit.
2026-04-05 09:49:30 -07:00

82 lines
3.0 KiB
PHP

<?php
/**
* loadConstants.php
*
* This stub is called when a user selects the option to edit the state or status constants in namaste.
*
* We call this stub to generate the main panel (HTML) which is an editable table containing the data pulled from
* the systemData collection -- depending on which link was clicked on the main page, we'll load either state or
* status constants into the table.
*
* If there is no data in the system table, the system message will display that fact and we'll proc an empty table
* for the user to begin population.
*/
// state constants == 1
// status constants == 2
if (intval($data['c']) == 1) {
$whichConstant = VALID_STATES;
$constantTitle = 'States';
} elseif (intval($data['c']) == 2) {
$whichConstant = VALID_STATUS;
$constantTitle = 'Status';
} else {
$systemMessage = 'Invalid data (status) choice!';
return;
}
$htmlMain = '
<div class="col-md-5">
<!-- Panel Header -->
<div class="view view-cascade py-3 gradient-card-header info-color-dark">
<h5>' . $whichConstant . '</h5>
</div>
<!-- Panel Content -->
<div class="card-body card-body-cascade">
<!-- Grid Row -->
<div class="row">
<!-- Grid Column -->
<div class="col-md-auto mb-4">
<!-- Editable Table -->
<div class="card">
<h3 class="card-header text-center font-weight-bold text-uppercase py-4">' . $constantTitle . '</h3>
<div class="card-body">
<div id="constantTable" class="table-editable">
<span class="table-add float-right mb-3 mr-2"><a href="#!" class="text-success">
<i class="fa fa-plus fa-2x" aria-hidden="true"></i></a>
</span>
<table class="table table-bordered table-responsive-md table-striped text-center">
<tr>
<th class="text-center">Constant Key</th>
<th class="text-center">Constant Value</th>
<th class="text-center">Remove</th>
</tr>
';
if (isset($systemData) and is_array($systemData)) {
foreach ($systemData[$whichConstant] as $key => $value) {
$htmlMain .= '<tr>';
$htmlMain .= '<td class="pt-3-half" contenteditable="true">' . $key . '</td>';
$htmlMain .= '<td class="pt-3-half" contenteditable="true">' . $value . '</td>';
$htmlMain .= '<td><span class="table-remove"><button type="button" class="btn btn-danger btn-rounded btn-sm my-0">Remove</button></span></td>';
$htmlMain .= '</tr>';
}
}
$htmlMain .= '
</table>
</div>
</div>
</div>
<!-- !Editable Table -->
</div>
<!-- !Grid Column -->
</div>
<!-- !Grid Row -->
</div>
<!-- !Panel Content -->
';
?>