######################################################## ## $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 //$tblDemo->disallowEdit('fldField2'); #i could set a field to accept file uploads (the filename is stored) if wanted
#this one line of code is how you implement the class ######################################################## ## $tblDemo = new ajaxCRUD("podatke", "podaci", "id", ""); ## ######################################################## ## 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(); $tblDemo->displayAs("stupac_x", "stupac x"); $tblDemo->displayAs("stupac_y", "stupac y"); $tblDemo->deleteText = "obrisi"; ?> <!DOCTYPE html> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta charset="utf-8" /> <meta name="viewport" content="width=device-width, initial-scale=1.0" /> <title>Metoda najmanjih kvadrata</title> <!-- BOOTSTRAP STYLES--> <link href="assets/css/bootstrap.css" rel="stylesheet" /> <!-- FONTAWESOME STYLES--> <link href="assets/css/font-awesome.css" rel="stylesheet" />
<link rel="stylesheet" href="includes/jquery.ui.all.css"> <script src="includes/jquery.ui.core.js"></script> <!--script src="includes/jquery.ui.widget.js"></script--> <script src="includes/jquery.ui.datepicker.js"></script> </head> <?php #change orientation (if desired/needed for large number of fields in a table) //$tblFriend->setOrientation("vertical"); //if you want the table to arrange vertically #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 $tblFriend->defineRelationship("fkMarriedTo", "tblLadies", "pkLadyID", "fldName", "fldSort DESC"); //last var (sorting) is optional; see reference documentation #how you want the fields to visually display in the table header $tblFriend->displayAs("pkFriendID", "ID"); $tblFriend->displayAs("fldName", "Name"); $tblFriend->displayAs("fldAddress", "Address"); $tblFriend->displayAs("fldCity", "City"); $tblFriend->displayAs("fldState", "State"); $tblFriend->displayAs("fldZip", "Zip"); $tblFriend->displayAs("fldPhone", "Phone"); $tblFriend->displayAs("fldEmail", "Email"); $tblFriend->displayAs("fldBestFriend", "Best Friend?"); $tblFriend->displayAs("fldDateMet", "Date We Met"); $tblFriend->displayAs("fldFriendRating", "Rating"); $tblFriend->displayAs("fldOwes", "Owes Me How Much?"); $tblFriend->displayAs("fldPicture", "Image"); $tblFriend->displayAs("fkMarriedTo", "Married To"); #disallow new friends to be added (removes the add button) //$tblFriend->disallowAdd();
} } $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"); $tblEventAttendee->defineCheckbox("fldWillBeLate"); $tblEventAttendee->addOrderBy("ORDER BY fldFirstName ASC"); #Add WHERE clause so we only display information specific to the event that was selected
######################################################## ## $tblDemo = new ajaxCRUD("Show", "st_shows", "sh_id", "/"); ## ######################################################## ## 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("sh_title", "Show"); $tblDemo->displayAs("sh_venue", "Venue"); $tblDemo->displayAs("sh_time", "Time"); $tblDemo->displayAs("sh_price", "Price"); $tblDemo->displayAs("sh_desc", "Description"); $tblDemo->displayAs("sh_contact", "Contact Info"); $tblDemo->displayAs("sh_date", "Date"); $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
$where = ""; $limit = 10; } } } $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']);
<?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("Autos", "autos", "id_autos", ""); $tblDemo->defineRelationship("id_tipo", "tipo", "id_tipo", "desc_tipo"); $tblDemo->defineRelationship("id_modelo", "modelo", "id_modelo", "desc_modelo"); $tblDemo->defineRelationship("id_marca", "marca", "id_marca", "desc_marca"); $tblDemo->omitPrimaryKey(); $tblDemo->displayAs("nombre_autos", "Nombre"); $tblDemo->displayAs("desc_autos", "Descripcion"); $tblDemo->displayAs("detalle_autos", "Especificaciones"); $tblDemo->displayAs("precio_autos", "Precio"); $tblDemo->displayAs("id_marca", "Marca"); $tblDemo->displayAs("id_tipo", "Tipo"); $tblDemo->displayAs("id_modelo", "Modelo"); $tblDemo->setTextareaHeight('detalle_autos', 150); $tblDemo->addWhereClause("WHERE id_marca = 2 and id_tipo = 41"); $tblDemo->setLimit(30); $tblDemo->showTable();
$tblDemo->displayAs("fldCheckbox", "Is Selected?"); $tblDemo->setTextareaHeight('fldLongField', 100); $allowableValues = array("Allowable Value1", "Allowable Value2", "Dropdown Value", "CRUD"); $tblDemo->defineAllowableValues("fldCertainFields", $allowableValues); //set field fldCheckbox to be a checkbox $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>";
<?php require_once 'include/preheader.php'; include 'include/ajaxCRUD.class.php'; $tblDemo = new ajaxCRUD("Marcas", "marca", "id_marca", ""); $tblDemo->omitPrimaryKey(); $tblDemo->displayAs("desc_marca", "Descripcion"); $tblDemo->setLimit(30); $tblDemo->addAjaxFilterBoxAllFields(); $tblDemo->showTable();
<?php require_once 'include/preheader.php'; include 'include/ajaxCRUD.class.php'; $tblDemo = new ajaxCRUD("Tipo", "tipo", "id_tipo", ""); $tblDemo->omitPrimaryKey(); $tblDemo->displayAs("desc_tipo", "Descripcion"); $tblDemo->showTable();
>Past/Previous Events</option> <option value="" <?php if (!$viewPastEvents) { echo "selected"; } ?> >Upcoming Events</option> </select> </form> </div> <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");
######################################################## ## $tblDemo = new ajaxCRUD("Item", "st_pagedata", "pd_id", "/"); ## ######################################################## ## 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("pd_id", "Row"); $tblDemo->displayAs("pd_data", "Page Item"); #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()");
<?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();
## $tblDemo = new ajaxCRUD("Item", "st_questions", "question_id", "../"); ## ######################################################## ## 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("test_questions", "st_questions", "question_test", "question_question"); //use your own table - this table (tblDemoRelationship) not included in the installation script //$tblDemo->defineRelationship("question_answer", "st_questions", "question_id", "question_answer"); #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("question_question", "Question to Ask"); $tblDemo->displayAs("question_answer", "Display Answer"); $tblDemo->displayAs("question_video", "Occluded Video"); $tblDemo->displayAs("question_test_num", "Question_Order"); $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 //$tblDemo->disallowEdit('fldField2'); #i could set a field to accept file uploads (the filename is stored) if wanted