$tblFriend->addButton("No More Friends. Take Me Home", "./"); //$tblFriend->turnOffSorting(); //turns off ajax sorting by pressing header links //$tblFriend->disableTableHeaders(); //disables table headers from displaying //$tblFriend->turnOffAjaxEditing(); //turns of ajax editing of all data #some logic if we want to add a field automatically on add $state = ""; if (isset($_REQUEST['state'])) { $state = $_REQUEST['state']; } if ($state) { $tblFriend->addWhereClause("WHERE fldState = \"{$state}\""); $tblFriend->omitAddField("fldState"); $tblFriend->addValueOnInsert("fldState", $state); } echo "<h3>Example3 tests FormatFieldWithFunction, defineRelationship, Multiple Filters, and a Date Picker</h3>\n"; $tblFriend->showTable(); echo "<p>Above is a table of my friends. The javascript masking and validation are in the fields 'phone' and 'zip' (required). There's a datapicker on the 'Date we Met' field.</p>\n"; #self-defined functions used for formatFieldWithFunction function addDollarSign($val) { return "\$" . $val; } function displayImage($val) { return "<img src=\"uploads/{$val}\" width=\"90\">"; } function myFunctionAfterAdd($array) { //print_r($array); } ?>
//$tblDemo->modifyFieldWithClass("fldField2", "phone"); //for testing masked input functionality //$tblDemo->onAddExecuteCallBackFunction("mycallbackfunction"); //uncomment this to try out an ADD ROW callback function $tblDemo->deleteText = "delete"; ?> <div style="float: left"> Total Returned Rows: <b><?php echo $tblDemo->insertRowsReturned(); ?> </b><br /> </div> <div style="clear:both;"></div> <?php #actually show the table $tblDemo->showTable(); #my self-defined functions used for formatFieldWithFunction function makeBold($val) { if ($val == "") { return "no value"; } return "<b>{$val}</b>"; } function makeBlue($val) { return "<span style='color: blue;'>{$val}</span>"; } function myCallBackFunction($array) { echo "THE ADD ROW CALLBACK FUNCTION WAS implemented";
$selected = " selected"; } echo "<option {$selected} value=\"{$thisEventID}\">{$event} ({$thisEventDate})</option>\n"; } ?> </select> </form> </div> <div style="clear: both;"></div><br /> <?php } //endif echo "<p>Who's coming?? If you are, please add yourself to the list by pressing \"Add Person\" below</p>\n"; $tblEventAttendee->showTable(); if ($eventExpired) { displayExpiration(); } include 'footer.php'; function onAddCallBackFunction($array) { global $idsAdded, $report_msg, $error_msg; $newID = $array['pkAttendeeID']; $fkEventID = $array['fkEventID']; $firstName = $array['fldFirstName']; $lastName = $array['fldLastName']; $countMatchingRows = q1("SELECT COUNT(*) FROM tblEventAttendee WHERE fldFirstName = \"{$firstName}\" AND fldLastName = \"{$lastName}\" AND fkEventID = {$fkEventID}"); if ($countMatchingRows > 1) { $success = qr("DELETE FROM tblEventAttendee WHERE pkAttendeeID = {$newID}"); if ($success) {
$tbl->displayAs("status", "狀態"); $tbl->displayAs("ele", "高度"); $tbl->displayAs("comment", "註解"); $tbl->displayAs("mt100", "百岳"); $tbl->displayAs("checked", "檢查"); $tbl->defineCheckbox('checked', '1', '0'); //$tbl->defineCheckbox('mt100',1,0); if ($_GET['x'] && $_GET['y']) { $tbl->setInitialAddFieldValue('x', $_GET['x']); $tbl->setInitialAddFieldValue('y', $_GET['y']); $tbl->displayAddFormTop(); } if ($_GET['name']) { $tbl->setInitialAddFieldValue('name', $_GET['name']); } $tbl->showTable(); function showIcon($val) { return sprintf("%s<img src='http://map.happyman.idv.tw/icon/%s.png'>", $val, urlencode($val)); } ?> <div align=center class="note"> <b>管理者您好</b><br> <p> ps: 大百岳=1 小百岳=2 百名山=4 若兩者皆是 1+4=5 <p> <form action="" method="GET"> 查詢 name <input name=name> 輸入 id <input name="id"> <br> <button>送出</button>
$tblDemo->defineCheckbox("fldCheckbox", "1", "0"); $tblDemo->setLimit(5); $tblDemo->addAjaxFilterBox('fldField1'); $tblDemo->formatFieldWithFunction('fldField1', 'makeBlue'); $tblDemo->formatFieldWithFunction('fldField2', 'makeBold'); echo "<h2>Table tblDemo</h2>\n"; $tblDemo->showTable(); echo "<br /><hr ><br />\n"; $tblDemo2 = new ajaxCRUD("Item", "tblDemo2", "pkID"); $tblDemo2->omitPrimaryKey(); $tblDemo2->displayAs("fldField1", "Field1"); $tblDemo2->displayAs("fldField2", "Field2"); $tblDemo2->displayAs("fldCertainFields", "Color"); $tblDemo2->displayAs("fldLongField", "Long Field"); $allowableValues2 = array("Green", "Blue", "Red", "Periwinkle"); $tblDemo2->defineAllowableValues("fldCertainFields", $allowableValues2); $tblDemo2->setTextareaHeight('fldLongField', 50); $tblDemo2->setLimit(20); $tblDemo2->addAjaxFilterBox('fldField1'); $tblDemo2->formatFieldWithFunction('fldField2', 'makeBlue'); $tblDemo2->formatFieldWithFunction('fldField1', 'makeBold'); echo "<h2>Table tblDemo2</h2>\n"; $tblDemo2->showTable(); function makeBold($val) { return "<b>{$val}</b>"; } function makeBlue($val) { return "<span style='color: blue;'>{$val}</span>"; }
$tblEvent->turnOffAjaxEditing(); } $tblEvent->addButtonToRow($signupText, "index.php"); $tblEvent->setTextareaHeight("fldAdditionalInformation", 70); #set the number of rows to display (per page) //$tblEvent->setLimit(25); $tblEvent->setAddPlaceholderText("fldDate", "YYYY-mm-dd"); $tblEvent->setAddPlaceholderText("fldTime", "7:00pm"); $tblEvent->setAddFieldNote("fldDate", "Make sure to enter in format <b>YYYY-mm-dd</b>."); $tblEvent->setAddFieldNote("fldImage", "If you want to add an image to the event (optional)."); $tblEvent->setAddFieldNote("fldType", "Public means anyone can come; Private means you want this event to be exclusive."); //$tblEvent->addButtonToRowWindowOpen = "same"; //this is default behavior so i have it commented out $tblEvent->formatFieldWithFunction("fldDate", "highlightDate"); $tblEvent->formatFieldWithFunction("fldImage", "showImage"); $tblEvent->modifyFieldWithClass("fldDate", "datepicker"); $tblEvent->showTable(); include 'footer.php'; function highlightDate($date) { if ($date == "0000-00-00") { return "NOT YET SET"; } if ($date == date("Y-m-d")) { return $date . "<br /><b style='font-size:8px;'>(TODAY/TONIGHT!)</b>"; } return $date; } function showImage($image) { if ($image) { return "<img src=\"uploads/{$image}\" width=\"100\" \\>\n";
$messages->showTable(); ?> </div> <div id="roles-div" class="table-div"> <?php $roles->showTable(); ?> </div> <div id="tickets-div" class="table-div"> <?php $tickets->showTable(); ?> </div> <div id="users-div" class="table-div"> <?php $users->showTable(); ?> </div> </div> <div id="Login" align="center"> <div id="LoginWindow" class="rounded"> <h1 align="center"> Login BLAM </h1><br/> <form id="loginForm" method="post" action="" name="loginForm"> <table cellpadding="0" cellspacing="0" border="0" width="100%"> <tr> <td align="center"> <input id="name" name="username" class="rounded" maxlength="16"/> </td>