예제 #1
0
#http://ajaxcrud.com/api/index.php?id=disallowAdd
//$tblDemo->disallowAdd();
#i can add a button that performs some action deleting of rows for the entire table
#http://ajaxcrud.com/api/index.php?id=addButtonToRow
//$tblDemo->addButtonToRow("Add", "add_item.php", "all");
#set the number of rows to display (per page)
$tblDemo->setLimit(30);
#set a filter box at the top of the table
//$tblDemo->addAjaxFilterBox('fldField1');
#if really desired, a filter box can be used for all fields
$tblDemo->addAjaxFilterBoxAllFields();
#i can set the size of the filter box
//$tblDemo->setAjaxFilterBoxSize('fldField1', 3);
#i can format the data in cells however I want with formatFieldWithFunction
#this is arguably one of the most important (visual) functions
$tblDemo->formatFieldWithFunction('fldField1', 'makeBlue');
$tblDemo->formatFieldWithFunction('fldField2', 'makeBold');
//$tblDemo->modifyFieldWithClass("fldField1", "zip required"); 	//for testing masked input functionality
//$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>
예제 #2
0
#use if you only want to show a few of the fields (not all)
//$tblFriend->showOnly("fldName, fldAddress, fldState, fldOwes");
#use if you want to rearrange the order your fields display (different from table schema)
//$tblFriend->orderFields("pkFriendID, fldAddress, fldName, fldState");
#set the number of rows to display (per page)
$tblFriend->setLimit(2);
#set a filter box at the top of the table
$tblFriend->addAjaxFilterBox('fldName', 20);
$tblFriend->addAjaxFilterBox('fldDateMet');
$tblFriend->addAjaxFilterBox('fkMarriedTo');
#allow picture to be a file upload
$tblFriend->setFileUpload('fldPicture', 'uploads/', 'uploads/');
//$tblFriend->disallowEdit("fldPicture");
$tblFriend->onAddExecuteCallBackFunction("myFunctionAfterAdd");
#format field output
$tblFriend->formatFieldWithFunction('fldOwes', 'addDollarSign');
$tblFriend->formatFieldWithFunction('fldPicture', 'displayImage');
$tblFriend->defineCheckbox("fldBestFriend", "Y", "N");
#modify field with class
$tblFriend->modifyFieldWithClass("fldDateMet", "datepicker");
$tblFriend->modifyFieldWithClass("fldZip", "zip required");
$tblFriend->modifyFieldWithClass("fldPhone", "phone required");
$tblFriend->modifyFieldWithClass("fldEmail", "email");
#set allowable values for certain fields
$ratingVals = array("0", "1", "2", "3", "4", "5");
$tblFriend->defineAllowableValues("fldFriendRating", $ratingVals);
$states = array(array("AL", "Alabama"), array("AK", "Alaska"), array("AZ", "Arizona"), array("AR", "Arkansas"), array("CA", "California"), array("CO", "Colorado"), array("CT", "Connecticut"), array("DE", "Delaware"), array("DC", "District Of Columbia"), array("FL", "Florida"), array("GA", "Georgia"), array("HI", "Hawaii"), array("ID", "Idaho"), array("IL", "Illinois"), array("IN", "Indiana"), array("IA", "Iowa"), array("KS", "Kansas"), array("KY", "Kentucky"), array("LA", "Louisiana"), array("ME", "Maine"), array("MD", "Maryland"), array("MA", "Massachusetts"), array("MI", "Michigan"), array("MN", "Minnesota"), array("MS", "Mississippi"), array("MO", "Missouri"), array("MT", "Montana"), array("NE", "Nebraska"), array("NV", "Nevada"), array("NH", "New Hampshire"), array("NJ", "New Jersey"), array("NM", "New Mexico"), array("NY", "New York"), array("NC", "North Carolina"), array("ND", "North Dakota"), array("OH", "Ohio"), array("OK", "Oklahoma"), array("OR", "Oregon"), array("PA", "Pennsylvania"), array("RI", "Rhode Island"), array("SC", "South Carolina"), array("SD", "South Dakota"), array("TN", "Tennessee"), array("TX", "Texas"), array("UT", "Utah"), array("VT", "Vermont"), array("VA", "Virginia"), array("WA", "Washington"), array("WV", "West Virginia"), array("WI", "Wisconsin"), array("WY", "Wyoming"));
$tblFriend->defineAllowableValues("fldState", $states);
#show CSV export button
$tblFriend->showCSVExportOption();
#use if you want to move the add form to the top of the page
예제 #3
0
    }
}
$tbl = new ajaxCRUD("點位", "point", "id");
//$tbl->omitPrimaryKey();
$tbl->disallowEdit("id");
//$tbl->turnOffAjaxAdd();
// $tbl->turnOffAjaxEditing();
if (!empty($where)) {
    $tbl->addWhereClause($where);
}
$tbl->setLimit($limit);
$tbl->omitField("owner");
$tbl->displayAs("name", "名稱");
$tbl->displayAs("alias", "別名");
$tbl->displayAs("type", "種類");
$tbl->formatFieldWithFunction('type', 'showIcon');
$tbl->displayAs("class", "等");
$tbl->displayAs("number", "號碼");
$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']) {
예제 #4
0
//using addValueOnInsert to track their IP address
$tblEventAttendee->addValueOnInsert("fldIPAddress", $_SERVER["REMOTE_ADDR"]);
$tblEventAttendee->setTextboxWidth("fldTimeArriving", 8);
$tblEventAttendee->setTextboxWidth("fldLastName", 25);
$tblEventAttendee->setTextareaHeight("fldComments", 70);
//comment field should be a bit wider height
#set the number of rows to display (per page)
$tblEventAttendee->setLimit(25);
//after 25 people, the resultset will paginate
$tblEventAttendee->setAddPlaceholderText("fldTimeArriving", $fldTime);
$tblEventAttendee->setAddFieldNote("fldTimeArriving", "Leave blank if you'll be on time.");
$tblEventAttendee->setAddFieldNote("fldWillBeLate", "If you will be arriving late, please enter the time in the next box.");
$tblEventAttendee->modifyFieldWithClass("fldTimeArriving", "time");
$tblEventAttendee->modifyFieldWithClass("fldLastName", "required");
$tblEventAttendee->modifyFieldWithClass("fldFirstName", "required");
$tblEventAttendee->formatFieldWithFunction("fldWillBeLate", "displayWillBeLate");
$tblEventAttendee->formatFieldWithFunctionAdvanced("fldTimeArriving", "displayArrivalTime");
$tblEventAttendee->emptyTableMessage = "No one has signed up yet! Press the '<b>Add Person</b>' button below to sign up for this event.";
$tblEventAttendee->addMessage = "You have been added to this event.";
$tblEventAttendee->setCSSFile("cuscosky.css");
//i liked this table feel; but any css can be used from http://icant.co.uk/csstablegallery
#implement a callback function on signing up to create cookie
$tblEventAttendee->onAddExecuteCallBackFunction("onAddCallBackFunction");
//if event expired, do not allow people to sign up for it or change who had attended
if ($eventExpired) {
    $tblEventAttendee->disallowAdd();
    $tblEventAttendee->disallowDelete();
    $tblEventAttendee->turnOffAjaxEditing();
    $tblEventAttendee->omitFieldCompletely("fldWillBeLate");
    $tblEventAttendee->omitFieldCompletely("fldTimeArriving");
}
예제 #5
0
    #Add Where clause - only show past events
    $tblEvent->addWhereClause("WHERE (fldDate < \"{$today}\") AND fldDate != \"0000-00-00\"");
    $signupText = "View Who Signed Up";
    $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)