// <-- this include file MUST go first before any HTML/output #this one line of code is how you implement the class ######################################################## ## $tblDemo = new ajaxCRUD("Item", "tblDemo", "pkID", "../"); ## ######################################################## ## all that follows is setup configuration for your fields.... ## full API reference material for all functions can be found here - http://ajaxcrud.com/api/ ## note: many functions below are commented out (with //). note which ones are and which are not #i can define a relationship to another table #the 1st field is the fk in the table, the 2nd is the second table, the 3rd is the pk in the second table, the 4th is field i want to retrieve as the dropdown value #http://ajaxcrud.com/api/index.php?id=defineRelationship //$tblDemo->defineRelationship("fkID", "tblDemoRelationship", "pkID", "fldName", "fldSort DESC"); //use your own table - this table (tblDemoRelationship) not included in the installation script #i don't want to visually show the primary key in the table $tblDemo->omitPrimaryKey(); #the table fields have prefixes; i want to give the heading titles something more meaningful $tblDemo->displayAs("fldField1", "Field1"); $tblDemo->displayAs("fldField2", "Field2"); $tblDemo->displayAs("fldCertainFields", "Valid Value Field"); $tblDemo->displayAs("fldLongField", "Long Field"); $tblDemo->displayAs("fldCheckbox", "Is Selected?"); #set the textarea height of the longer field (for editing/adding) #http://ajaxcrud.com/api/index.php?id=setTextareaHeight $tblDemo->setTextareaHeight('fldLongField', 150); #i could omit a field if I wanted #http://ajaxcrud.com/api/index.php?id=omitField //$tblDemo->omitField("fldField2"); #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
} } else { header("Location: events.php"); } } $page_title = "Signup for Event: {$fldTitle} @ {$fldLocation}"; #the code for the class include '../../ajaxCRUD.class.php'; if (!$eventID) { header("Location: events.php"); } #Create an instance of the class $tblEventAttendee = new ajaxCRUD("Person", "tblEventAttendee", "pkAttendeeID", "../ajaxcrud/"); $tblEventAttendee->doActionOnShowTable = false; //this ensures showTable() does not call doAction; i do not want to do this because my onAdd callback function creates a cookie $tblEventAttendee->omitPrimaryKey(); #Create custom display fields //$tblEventAttendee->displayAs("pkAttendeeID","User ID"); $tblEventAttendee->displayAs("fldFirstName", "First Name"); $tblEventAttendee->displayAs("fldLastName", "Last Name"); $tblEventAttendee->displayAs("fldPhone", "Phone #"); $tblEventAttendee->displayAs("fldWillBeLate", "Will You Be Late?"); $tblEventAttendee->displayAs("fldTimeArriving", "Arrival Time"); $tblEventAttendee->displayAs("fldComments", "Comments/Other"); $tblEventAttendee->displayAs("fldIPAddress", "IPAddress"); $tblEventAttendee->omitFieldCompletely("fldIPAddress"); $tblEventAttendee->omitFieldCompletely("fkEventID"); $tblEventAttendee->omitFieldCompletely("fldPhone"); $tblEventAttendee->omitFieldCompletely("fldAttending"); $tblEventAttendee->validateDeleteWithFunction("canRowBeModifiedOrDeleted"); $tblEventAttendee->validateUpdateWithFunction("canRowBeModifiedOrDeleted");