Options for the select
* @param $required bool Whether the select is required
* @param $disable_reason string|null Reason for the option to be disabled, if any
*
* @return string
*/
function __PREFIX__makeSelect($label, $name, $options, $required = false, $disable_reason = null) {
$name = htmlentities($name);
ob_start();
?>
>
= $description ?>
$element[$column_name], $array);
}
/**
* Print an ASCII table from the given data
*
* @param $data array[] Data to print
*
* @return void
*/
function __PREFIX__printAsciiTable($data) {
// Get column headers
$headers = array_keys($data[0]);
// Calculate column widths
$columnWidths = [];
foreach ($headers as $header) {
$columnWidths[$header] = max(array_map('strlen', __PREFIX__array_column($data, $header))) + 2;
}
// Print top row
echo "+";
foreach ($headers as $header) {
echo str_repeat("-", $columnWidths[$header]);
echo "+";
}
echo PHP_EOL;
// Print header row
echo "|";
foreach ($headers as $header) {
printf("%-{$columnWidths[$header]}s|", htmlentities($header));
}
echo PHP_EOL;
// Print divider row
echo "+";
foreach ($headers as $header) {
echo str_repeat("-", $columnWidths[$header]);
echo "+";
}
echo PHP_EOL;
// Print table rows
foreach ($data as $row) {
echo "|";
foreach ($row as $key => $value) {
printf("%-{$columnWidths[$key]}s|", htmlentities($value));
}
echo PHP_EOL;
}
// Print bottom row
echo "+";
foreach ($headers as $header) {
echo str_repeat("-", $columnWidths[$header]);
echo "+";
}
echo PHP_EOL;
}
/**
* Create an alert element on the page
*
* @param $title string Title of the alert box
* @param $message string Message of the alert
*
* @return string
*/
function __PREFIX__makeAlert($title, $message) {
ob_start();
?>
= htmlentities($title) ?>
= $message ?>
= $title; ?>
= $description; ?>
$column";
}
?>
";
foreach ($columns as $key => $column) {
if (is_array($row[$key])) {
echo "