Exemple #1
0
$tblFriend->displayAs("fldPicture", "Image");
$tblFriend->displayAs("fkMarriedTo", "Married To");
#disallow new friends to be added (removes the add button)
//$tblFriend->disallowAdd();
#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"));
Exemple #2
0
$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\"");
    $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.");
Exemple #3
0
$tblDemo->displayAs("sh_age", "Age");
$tblDemo->displayAs("sh_ticketdesc", "Ticket Info");
$tblDemo->displayAs("poster", "Poster");
$tblDemo->displayAs("sh_published", "Published");
#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
//$tblDemo->disallowEdit('fldField2');
#i could set a field to accept file uploads (the filename is stored) if wanted
$tblDemo->setFileUpload("poster", "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();
<?php

require_once 'include/preheader.php';
// <-- this include file MUST go first before any HTML/output
include 'include/ajaxCRUD.class.php';
// <-- this include file MUST go first before any HTML/output
$tblDemo = new ajaxCRUD("Modelos", "modelo", "id_modelo", "");
//  $tblDemo->omitPrimaryKey();
$tblDemo->displayAs("id_modelo", "Numero de Modelo");
$tblDemo->displayAs("desc_modelo", "Descripcion");
$tblDemo->displayAs("img_modelo", "Imagen del Modelo");
$tblDemo->setFileUpload("img_modelo", "");
$tblDemo->showTable();