function showCustomerForm($data, $action, $badFields) { formHeader($action, "<h1>Customer Info Form</h1>", "customerForm", "void"); customerFields($data, $badFields); tableRow(array(tableData(""), tableData(""), tableData(""), tableData(""), tableData(""), tableData(submit("Enter/Edit Customer!"), "right"))); echo getWordpressHiddenFormField(); formFooter("customerForm"); }
function showPackageForm($data, $action, $badFields) { formHeader($action, "Package Form", "packageForm", "void"); packageFields($data, $badFields); tableRow(array(tableData(""), tableData(""), tableData(""), tableData(""), tableData(""), tableData(submit("Submit!")))); echo getWordpressHiddenFormField(); formFooter("packageForm"); }
function showOrderEntryForm($data, $badFields = array()) { formHeader("", "", "orderEntry", "void"); customerFields($data, $badFields); orderFields($data, $badFields); if (inWordPress()) { echo getWordpressHiddenFormField(); } tableRow(array(tableData(""), tableData(""), tableData(""), tableData(""), tableData(""), tableData(submit("Enter Order!"), "right"))); formFooter("orderEntryForm"); }
function showShippingForm($data, $action, $badFields = array()) { prepDatePicker(); formHeader($action, "<h1>Shipping Info Form</h1>", "shippingForm", "void"); shippingFields($data, $badFields); tableRow(array(tableData(""), tableData(""), tableData(""), tableData(""), tableData(""), tableData(submit("Enter Shipping Details!"), "right"))); if (inWordPress()) { echo getWordpressHiddenFormField(); } formFooter("shippingForm"); }
<tr> <td align="left" valign="bottom" class="fibody2" id="bordR">{$pli}.</td> <td align="left" valign="bottom" class="fibody2" id="bordR"><input name="pl_ed_{$pli}" type="text" class="fullin2" value="{$pl_ed}"></td> <td align="left" valign="bottom" class="fibody2" id="bordR"><input name="pl_problem_{$pli}" type="text" class="fullin2" value="{$pl_problem}"></td> <td align="left" valign="bottom" class="fibody2" id="bordR"><input name="pl_onset_{$pli}" type="text" class="fullin2" value="{$pl_onset}"></td> <td align="left" valign="bottom" class="fibody2"><input name="pl_rd_{$pli}" type="text" class="fullin2" value="{$pl_rd}"></td> </tr> EOL; $pli++; } ?> </table> </div> <table width="100%" border="0"> <tr> <td align="left" width="100"> <a href="javascript:top.restoreSession();document.my_form.submit();" class="link_submit">[Save Data]</a> </td> <td align="right"> <a href="<?php echo $GLOBALS['form_exit_url']; ?> " class="link_submit" onclick="top.restoreSession()">[Don't Save]</a> </td> </tr> </table> </form> <?php formFooter(); ?> </body> </html>
<?php $users = $db->users; $user = $users->findOne(array("facebookid" => $_SESSION['user'])); if (isset($_POST['submit'])) { $user['location'] = $_POST['location']; $user['phone'] = $_POST['phone']; $user['description'] = $_POST['description']; $users->update(array("facebookid" => $_SESSION['user']), $user); wallPost($_SESSION['user'], $_SESSION['user'], "editprofile", "?profile/edit"); } $_POST = $user; formHeader("Edit your profile"); formField("User", "user", "disabled", "", "Your user"); formField("Name", "first", "disabled", "", "Your name"); formField("E-mail", "email", "disabled", "", "Your email"); formField("Joined", "date", "disabled", "", ""); formField("Location", "location", "text", "", "Your location (country, city)"); formField("Phone", "phone", "text", "", "Your phone number"); formField("Short description", "description", "textarea"); formFooter("Save changes");
function showOrderForm($data, $action, $badFields = array()) { global $SETTINGS; formHeader($action, "Order Info Form", "orderForm", "void"); orderFields($data, $badFields); echo getWordpressHiddenFormField(); tableRow(array(tableData(""), tableData(""), tableData(""), tableData(""), tableData(""), tableData(submit("Enter Order!"), "right"))); formFooter("orderForm"); }
<?php if (isset($_POST['submit'])) { if (strlen($_POST['feedback']) > 3) { $feedback = $db->feedback; $_POST['user'] = $_SESSION['user']; $_POST['fb_id'] = $_SESSION['fb_id']; $_POST['fb_name'] = $_SESSION['fb_name']; $_POST['date'] = date("Y-m-d H:i:s"); $_POST['update'] = microtime(true); $feedback->insert($_POST); $SUCCESS[] = "Your feedback has been successfully added"; header("Location: ?livefeedback/added"); } else { $ERROR[] = "Messages is too short"; } } if ($ACTION == "added") { $HTML[] = <<<EOF \t\t<h1>Thank you for submitting feedback</h1> \t\t<p><br>Your feedback is valuable for us. <a href="?front_search">Go to search!</a></p> EOF; } else { formHeader("Give us feedback to improve our service"); formField("Your suggestions and feedback", "feedback", "textarea", ""); formFooter("Send feedback"); }
\t\t\t\t\t</div> EOF; } if (isset($_GET['onlychat' . $k])) { for ($i = $ONLYCHAT; $i < count($HTML); $i++) { echo $HTML[$i]; } die; } $HTML[] = '</div><a name="chat' . $k . '"></a>'; formHeader(""); formField("", "user1", "hidden", "{$v['user']}"); formField("", "pos", "hidden", "{$k}"); formField("", "role", "hidden", "traveler"); formField("", "chat", "textarea"); formFooter("Send message"); $HTML[] = <<<EOF \t\t\t<script> \t\t\t\tsetInterval(function(){ \t\t\t\t \$('#chat-box{$k}').load('?product_request/view/{$ID}/&onlychat{$k}'); \t\t\t\t }, 60000); \t\t\t</script> \t\t\t</div> EOF; } else { /*$HTML[] = <<<EOF <div class="content-box medium redback"> <h1>Request has been rejected</h1> </div> EOF;*/ }
\t\t\t<a href="?travel_plan/{$ACTION}/{$ID}/&confirm" class="btn btn-danger">Yes</a> \t\t\t \t\t\t<a href="#" onClick="history.go(-1)">No</a> \t\t</div> EOF; } } if ($ACTION != "delete") { /** add form */ formHeader($ACTION == "add" ? "Add new travel plan" : "Edit existing travel plan"); formField("From", "from", "text", "", "Departure"); formField("To", "to", "text", "", "Arrival"); formField("Date", "date", "text", "", "Date of departure"); // formField("Package size", "size", "text", "", "Package dimensions (WxHxD)"); // formField("Weight", "weight", "text", "", "Maximum lugage weight"); // formField("Hand luggage", "handluggage", "checkbox", "", " Some of the items might be restricted"); formField("Additional informations", "description", "textarea"); formFooter($ACTION == "add" ? "Add new plan" : "Modify plan"); $HTML[] = <<<EOF \t<script> \t\$( "#from" ).autocomplete({ \t\tsource: "ajax/cities.php", \t\tminLength: 2 \t}); \t\$( "#to" ).autocomplete({ \t\tsource: "ajax/cities.php", \t\tminLength: 2 \t}); \t</script> EOF; }
EOF; } } if ($ACTION != "delete") { /** add form */ formHeader($ACTION == "add" ? "Add new product request" : "Edit existing product request"); formField("From", "from", "text", "", "From"); formField("To", "to", "text", "", "To"); formField("Requests ends", "date", "text", "", "When would request end"); // formField("Approximate package size", "size", "text", "", "Package dimensions (WxHxD)"); // formField("Aprroximate Weight", "weight", "text", "", "Maximum lugage weight"); //formField("Hand luggage", "handluggage", "checkbox", "", " Item is allowed"); // formField("", "fragile", "checkbox", "", " Product is fragile, handle with care"); // formField("", "solid", "checkbox", "", " Product is solid"); // formField("", "liquid", "checkbox", "", " Product is liquid"); formField("Description of product(s)", "description", "textarea"); formField("You can add picture of the item", "picture", "file"); formFooter($ACTION == "add" ? "Add new product request" : "Modify existing product request"); $HTML[] = <<<EOF \t<script> \t\$( "#from" ).autocomplete({ \t\tsource: "ajax/cities.php", \t\tminLength: 2 \t}); \t\$( "#to" ).autocomplete({ \t\tsource: "ajax/cities.php", \t\tminLength: 2 \t}); \t</script> EOF; }
function displayForm($data, $badFields) { displayTitle(); echo "<p style=\"text-align:center;margin:auto;width:80%\">"; echo '<b>About SprocketR: </b>SprocketR is a web application to produce custom sprocket pairs based upon the parameters entered. The final output is a zip file of two 3D-printable STL files to download and test. During the process, the application will optimize the sprockets to create an appropriate amount of chain slack. In addition, it will give you the opportunity to change and balance your parameters to get the best sprockets for your application.</p>'; echo '<table style="text-align:center;margin:auto;width:20%"><tr><td style="text-align:left;border:none">'; echo '<a href="?page_id=2065"><button class="sprocketrButton">How It Was Created</button></a>'; echo '</td><td style="text-align:right;border:none">'; echo '<a href="?page_id=2090"><button class="sprocketrButton">How To Use</button></a>'; echo '</td></tr></table>'; echo '<div style="margin:auto;width:35%"><b>Instructions: </b>'; echo '<ul><li>Start by entering the desired "gear ratio" (if necessary) and the center-to-center distance of the two sprockets.</li>'; echo '<li>You may also enter the number of the teeth for one or both of the sprockets if needed.</li>'; echo '<li>Choose the chain type desired.</li>'; echo '<li>Choose the hub mounting holes for the sprockets (if any).</li>'; echo '<li>Click "Generate Sprocket Options".</li>'; echo '<li>The results page will provide the opportunity to change parameters to get the sprockets to best fit your application.</li>'; echo '</ul></div>'; echo "<p style=\"text-align:center;margin:auto;width:80%\">"; //start form and table echo "<form action=\"\" class=\"sprocketrForm\" method=\"get\">\n <table frame=\"void\" border=\"none\" class=\"form\" style=\"width:50%\" align=\"center\">\n "; //add class="form" when ready to remove gridlines //gearRatioField if (array_key_exists("gearRatioField", $data)) { //check if gear ratio entered if so show in field tableRow(array(tableData(promptWithError("gearRatioField", "<b>Gear Ratio*: </b>", $badFields, "Must be in the form of #:#"), "left", "center"), tableData('<input style="text-align: center;" size="5" type="text" placeholder="#:#" name="gearRatioField" value="' . $data["gearRatioField"] . '" title="Gear ratio of your sprockets, must be formatted like #:#" /> ', "left", "center"))); //gear ratio field } else { //if not entered show without data (see above comments, they still apply below) tableRow(array(tableData(promptWithError("gearRatioField", "<b>Gear Ratio*: </b>", $badFields, "Must be in the form of #:#"), "left", "center"), tableDataWidth('<input style="text-align: center;" size="5" type="text" placeholder="#:#" name="gearRatioField" title="Gear ratio of your sprockets, must be formatted like #:#" /> ', "left", "center", 1, "gRatFieldRow"))); } //centerToCenterField tableRow(array(tableData(promptWithError("centerToCenterField", "<b>Center to Center Distance (mm)*:</b>", $badFields, "Must be a number with optional decimal part"), "left", "center", 1), tableData(text($data, "centerToCenterField"), "left", "center", 2))); //chainSizeList tableRow(array(tableData(prompt("<b>Chain Size*: </b>"), "", "", "", "margin:0px"), tableData(dropDown($data, "chainSizeList", array("25" => "chain25", "35" => "chain35")))), "chainSize"); //leftSprocketTeeth#Field tableRow(array(tableData(promptWithError("leftSprocketTeeth#Field", '<b>Number of Teeth on Sprocket 1: </b><span style="color:red"> (optional)</span>', $badFields, "Must be an integer less than " . NUM_TEETH_MAX . " or left blank"), "left", "center", 1), tableData(text($data, "leftSprocketTeeth#Field"), "left", "center", 1)), "leftSprocketTeeth"); //rightSprocketTeeth#Field tableRow(array(tableData(promptWithError("rightSprocketTeeth#Field", '<b>Number of Teeth on Sprocket 2: </b><span style="color:red"> (optional)</span>', $badFields, "Must be an integer less than " . NUM_TEETH_MAX . " divisible by the gear ratio or left blank"), "left", "center", 1), tableData(text($data, "rightSprocketTeeth#Field"), "left", "center", 1)), "rightSprocketTeeth"); //desiredSlackField tableRow(array(tableData(promptWithError("desiredSlackField", "<b>Desired Slack (default 1%): </b>", $badFields, "Must be a decimal or left blank")), tableData(text($data, "desiredSlackField"))), "desiredSlack"); //holeOptionLabels echo "<tr><td class = \"form\"><b>Hub Choices:</b></td><td>"; echo '<table><tr>'; holeCheckBox("Versa Hub (small).png", $data, "holeOption_versaHub", " Versa Hub"); holeCheckBox("Tetrix Hub (small).png", $data, "holeOption_tetrixHub", " Tetrix Hub"); holeCheckBox("Versa Bearing Hole (small).png", $data, "holeOption_versaBearingHole", " Versa Bearing Hole"); echo '</tr></table></td></tr>'; // submit button & hidden field tableRow(array(tableData(hiddenField("page_id", $_GET["page_id"])))); echo '<tr><td class="centerCell" colspan=2 align="center">' . "<input type=\"submit\" class=\"sprocketrButton\" value=\"Generate Sprocket Options\">" . '</td></tr>'; formFooter("sprocketrForm"); }