Example #1
0
<?php

$root = realpath($_SERVER["DOCUMENT_ROOT"]);
require_once "{$root}/shared/header.php";
$editable_fields = array("id" => array("type" => "hidden"), "fullname" => array("type" => "text", "label" => "Title"), "appname" => array("type" => "text", "label" => "Nickname"), "appurl" => array("type" => "text", "label" => "URL"), "app_category" => array("type" => "text", "label" => "Category"), "allow_all" => array("type" => "checkbox", "label" => "Allow All Users"), "hide_app" => array("type" => "checkbox", "label" => "Hide from Menu"));
$table = "login_app";
// Process submission if any
if (isset($_REQUEST["submitted"]) && $_REQUEST["submitted"] == "true") {
    $submitForm = new Form();
    $submitForm->table = $table;
    $submitForm->addElements($editable_fields);
    $submitForm->setValues($_REQUEST);
    $submitForm->updateOrAddTableRow(array("id"));
}
$applist = db_get("SELECT * FROM login_app", "row");
echo printHeader();
?>

<div class='container'>

	<div class="panel-group" id="accordion" role="tablist" aria-multiselectable="true">

		<?php 
foreach ($applist as $appinfo) {
    $miniform = new Form();
    $miniform->table = $table;
    $miniform->horizontal = true;
    $miniform->addElements($editable_fields);
    $miniform->setValues($appinfo);
    echo $miniform->panel($appinfo["ID"], $appinfo["FULLNAME"]);
}