<?php //Get functions require_once 'function.php'; //Initlize Input String $input = ""; //Decode JSON data $array = json_decode($_POST['jsonValue']); $input .= '<form class="autoGenForm" action="##PATH OF PHP FILE##" method="post">' . "\n"; $x = 0; //Foreach array item, create inputs foreach ($array as $theArray) { //if is textarea, generate textarea if ($theArray->field == "textarea") { $input .= generateTextArea($x, $theArray->label, $theArray->field, $theArray->required); } elseif ($theArray->field == "radio") { $input .= generateRadio($x, $theArray, $theArray->required); } elseif ($theArray->field == "checkbox") { $input .= generateCheckbox($x, $theArray); } elseif ($theArray->field == "select") { $input .= generateSelect($x, $theArray, $theArray->required); } else { $input .= generateRegular($x, $theArray->label, $theArray->field, $theArray->required); } $x++; } //Create submit buttom $input .= '<div class="inputContainer">' . "\n"; $input .= '<input type="submit" id="submit" value="submit">' . "\n"; $input .= '</div>' . "\n"; //End Form
// because it is very confusing! $target_id = $series ? $repeat_id : $id; $info_time = $series ? $repeat_info_time : $entry_info_time; $info_user = $series ? $repeat_info_user : $entry_info_user; $info_text = $series ? $repeat_info_text : $entry_info_text; if (empty($info_time)) { $value = ''; } else { $value = get_vocab("sent_at") . time_date_string($info_time); if (!empty($info_user)) { $value .= "\n" . get_vocab("by") . " {$info_user}"; } $value .= "\n----\n"; $value .= $info_text; } generateTextArea("approve_entry_handler.php", $target_id, $series, "more_info", $returl, get_vocab("send"), get_vocab("request_more_info"), $value); } else { // Buttons for those who are allowed to approve this booking if (auth_book_admin($user, $row['room_id'])) { if (!$series) { generateApproveButtons($id, FALSE); } if (!empty($repeat_id) || $series) { generateApproveButtons($repeat_id, TRUE); } } elseif ($user == $create_by) { generateOwnerButtons($id, $series); } else { // But valid HTML requires that there's something inside the <tfoot></tfoot> echo "<tr><td></td><td></td></tr>\n"; }
// If we're using provisional bookings, put the buttons to do with managing // the bookings in the footer if ($provisional_enabled && $status == STATUS_PROVISIONAL) { echo "<tfoot id=\"confirm_buttons\">\n"; // PHASE 2 - REJECT if (isset($action) && $action == "reject") { // del_entry expects the id of a member of a series // when deleting a series and not the repeat_id generateTextArea("del_entry.php", $id, $series, "reject", $returl, get_vocab("reject"), get_vocab("reject_reason")); } elseif (isset($action) && $action == "more_info") { // but confirm_entry_handler expects the id to be a repeat_id // if $series is true (ie behaves like the rest of MRBS). // Sometime this difference in behaviour should be rationalised // because it is very confusing! $target_id = $series ? $repeat_id : $id; generateTextArea("confirm_entry_handler.php", $target_id, $series, "more_info", $returl, get_vocab("send"), get_vocab("request_more_info")); } else { // Buttons for those who are allowed to confirm this booking if (auth_book_admin($user, $room_id)) { if (!$series) { generateConfirmButtons($id, FALSE); } if (!empty($repeat_id) || $series) { generateConfirmButtons($repeat_id, TRUE); } } elseif ($user == $create_by) { generateOwnerButtons($id, $series); } else { // But valid HTML requires that there's something inside the <tfoot></tfoot> echo "<tr><td></td><td></td></tr>\n"; }