Exemple #1
0
#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
//$tblFriend->displayAddFormTop();
#order the table by any field you want
$tblFriend->addOrderBy("ORDER BY fldName");
#add a button at the bottom of the table which simply goes to another page
$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 = "";
Exemple #2
0
#i could omit a field from being on the add form if I wanted
//$tblDemo->omitAddField("fldField2");
#i could disallow editing for certain, individual fields
//$tblDemo->disallowEdit('fldField2');
#i could set a field to accept file uploads (the filename is stored) if wanted
//$tblDemo->setFileUpload("fldField2", "uploads/");
#i can have a field automatically populate with a certain value (eg the current timestamp)
//$tblDemo->addValueOnInsert("fldField1", "NOW()");
#i can use a where field to better-filter my table
//$tblDemo->addWhereClause("WHERE (fldField1 = 'test')");
#i can order my table by whatever i want
//$tblDemo->addOrderBy("ORDER BY fldField1 ASC");
#i can set certain fields to only allow certain values
#http://ajaxcrud.com/api/index.php?id=defineAllowableValues
$allowableValues = array("Allowable Value1", "Allowable Value2", "Dropdown Value", "CRUD");
$tblDemo->defineAllowableValues("fldCertainFields", $allowableValues);
//set field fldCheckbox to be a checkbox
$tblDemo->defineCheckbox("fldCheckbox");
#i can disallow deleting of rows from the table
#http://ajaxcrud.com/api/index.php?id=disallowDelete
//$tblDemo->disallowDelete();
#i can disallow adding rows to the table
#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');
Exemple #3
0
	<div style="clear: both;"></div><br />

<?php 
//$tblEvent->omitPrimaryKey();
#Create custom display fields
$tblEvent->displayAs("pkEventID", "Event ID");
$tblEvent->displayAs("fldTitle", "Title");
$tblEvent->displayAs("fldDate", "Date");
$tblEvent->displayAs("fldTime", "Time");
$tblEvent->displayAs("fldLocation", "Location");
$tblEvent->displayAs("fldAdditionalInformation", "Additional Information");
$tblEvent->displayAs("fldImage", "Image");
$tblEvent->displayAs("fldType", "Public/Private?");
$tblEvent->disallowDelete();
$validValues = array("Public", "Private");
$tblEvent->defineAllowableValues("fldType", $validValues);
//$tblEvent->category_required['fldType'] = FALSE;
$tblEvent->addOrderBy("ORDER BY fldDate ASC");
#Add filter boxes (if i wanted them)
//$tblEvent->addAjaxFilterBox("fldFirstName");
//$tblEvent->addAjaxFilterBox("fldLastName");
//$tblEvent->addAjaxFilterBox("fldAttending");
$today = date("Y-m-d");
if (!$viewPastEvents) {
    #Add Where clause - only show future events
    $tblEvent->addWhereClause("WHERE (fldDate >= \"{$today}\") OR fldDate = \"0000-00-00\"");
    $signupText = "Sign up for Event";
    $tblEvent->setFileUpload("fldImage", "uploads/", "uploads/");
} else {
    #Add Where clause - only show past events
    $tblEvent->addWhereClause("WHERE (fldDate < \"{$today}\") AND fldDate != \"0000-00-00\"");