function generateHTMLFromData($data) { $html = ''; $start = $end = ""; $fmt = "\n <div class='order-info'>\n <div class='order-time'>%s</div>\n <div class='order-restaurant'>%s</div>\n <div class='order-name'>%s<br>%s<br>%s</div>\n <div class='order-address'>%s<br>%s<br>%s, %s<br>%s</div>\n <div class='order-items'>%s</div>\n <div class='order-total'><span class='pretotal'>TOTAL </span> %s</div>\n <br><br>\n </div>\n "; $html .= htmlLoop($data, $start, $fmt, $end); return $html; }
</div>'; $html_2 = ' <form class="ulform" enctype="multipart/form-data" id="setting-%s" action="/includes/accounts/exec-admin-change-setting.php" method="POST"> <span class="setting-name">%s:</span> <img height="150px" width="200px" class="setting-value" src="images/%s"> <input type="hidden" name="type" value="2"> <input type="hidden" name="name" value="None"> <input name="userfile" type="file" /> <input type="submit" class="setting-save" value="Upload"> </form>'; $settings_1 = DB::query("SELECT name, display, value FROM settings WHERE type=1"); $settings_1 = refineArray($settings_1, array("name", "display", "value")); echo htmlLoop($settings_1, "", $html_1, ""); $settings_2 = DB::query("SELECT name, display, value FROM settings WHERE type=2"); $settings_2 = refineArray($settings_2, array("name", "display", "value")); echo htmlLoop($settings_2, "", $html_2, ""); ?> <script> // change setting $(".ulform").each(function(i){ var name = $(this).attr("id").split("-")[1] $(this).children('input[name=name]').val(name); }) $(".setting-save-text").on('click', function(e){ var parent = $(this).parent() var name = $(parent).attr("id").split("-")[1] var value = $(parent).children(".setting-value-input").val()
function displayAdminSettingsPage() { $html_1 = ' <div id="setting-%s"> <span class="setting-name">%s:</span> <span class="setting-value">%s</span> <input type="text" class="setting-value-input" placeholder="New Value"> <input type="button" class="setting-save-text" value="Save"> </div>'; $html_2 = ' <form class="ulform" enctype="multipart/form-data" id="setting-%s" action="/includes/accounts/exec-admin-change-setting.php" method="POST"> <span class="setting-name">%s:</span> <img height="150px" width="200px" class="setting-value" src="images/%s"> <input type="hidden" name="type" value="2"> <input type="hidden" name="name" value="None"> <input name="settingsfile" type="file" /> <input type="submit" class="setting-save" value="Upload"> </form>'; $settings_1 = DB::query("SELECT name, display, value FROM settings WHERE type=1"); $settings_1 = refineArray($settings_1, array("name", "display", "value")); echo htmlLoop($settings_1, "", $html_1, ""); $settings_2 = DB::query("SELECT name, display, value FROM settings WHERE type=2"); $settings_2 = refineArray($settings_2, array("name", "display", "value")); echo htmlLoop($settings_2, "", $html_2, ""); }