Tina4Stack  v1.0.1
The Tina4 Stack
Cody Class Reference

Public Member Functions

 bootStrapTextArea ($name, $caption="Test Input", $placeholder="Type in here", $defaultValue="", $colWidth="col-md-12", $noFormGroup=false)
 
 bootStrapButton ($name="button", $caption="Button", $onclick="", $style="btn btn-primary pull-right", $colWidth="col-md-12", $noFormGroup=false)
 
 bootStrapCheckbox ($name, $elements, $colWidth="col-md-12")
 
 bootStrapInput ($name="text", $caption="Label", $placeHolder="", $defaultValue="", $type="text", $required="required", $colWidth="col-md-12", $options="", $step=1)
 
 getPageTemplate ($title="Default")
 
 getTemplate ($name="", $type="form")
 
 createTableForm ($action, $object, $record, $db="")
 
 __construct ($DEB="")
 
 bootStrapAlert ($alertType="success", $caption="", $content="", $dismissible=false)
 
 bootStrapTable ($sql="select * from user_detail", $buttons="", $hideColumns="", $toolbar="My Grid", $customFields=null, $name="grid", $tableInfo="", $formHideFields="", $events="", $class="table table-striped", $rowLimit=20, $paginate=true, $searchable=true, $checked=false, $selected_page=1, $checkedPostURL="", $checkSingleSelect=true, $checkEvent="", $mobiletooltip="")
 
 populateDropDownItems ($dropDownSql, $onClick, $parent)
 
 bootStrapTabs ($tabs=array())
 
 bootStrapForm ($sql="", $hideColumns="", $custombuttons=null, $customFields=null, $submitAction="", $formId="formId", $prefix="txt", $noForm=false)
 
 getFieldInfo ($sql)
 
 select ($name="txt", $alttext="", $selecttype="array", $lookup="", $value="", $event="", $cssid="", $readonly=false, $nochoose=true)
 
 validateForm ($rules, $messages="", $formId="formInput")
 
 bootStrapPanel ($title, $content, $class="panel panel-default", $footerContent="", $icon="")
 
 bootStrapMessageBox ($title, $linkTitle="Click Here", $url="#", $number="", $panelClass="panel panel-primary", $glyphClass="fa fa-comments fa-5x")
 
 bootStrapModal ($header, $body, $footer, $closeCode="$('.modal').removeClass('show');", $icon="", $modalsize="")
 
 bootStrapView ($sql="", $hideColumns="", $custombuttons=null, $customFields=null, $submitAction="")
 
 codeHandler ($action)
 
 codeBuilder ()
 
 GetCallingMethodName ()
 
 getCodeWindow ($id, $code)
 
 getFileExplorer ()
 
 getFileTree ($path="", $callBack="", $root=false)
 
 getCodeNavigator ()
 
 getParseScript ($name)
 
 ajaxRouter ($responseTarget="", $name="callRouter", $defaultMethod="post")
 
 ajaxHandler ($route="/test_ajax", $target="", $name="callAjax", $fixedValues="", $method="post", $runNow=false)
 
 bootStrapMenuTree ()
 
 bootStrapLookup ($name, $caption, $elements, $value="", $onclick="", $readonly="", $colWidth="col-md-12", $nochoose=false)
 
 IsDate ($Str)
 

Detailed Description

Description of Cody

Cody is a CRUDL generation tool to make coding in Tina4 stack easy and fun

Constructor & Destructor Documentation

Cody::__construct (   $DEB = "")

The constructor for Cody requires a Debby database connection

Parameters
Debby$DEB

Member Function Documentation

Cody::ajaxHandler (   $route = "/test_ajax",
  $target = "",
  $name = "callAjax",
  $fixedValues = "",
  $method = "post",
  $runNow = false 
)

A function which encapulates the passing of form infomation with or without ids to a route and targeting the response to an html element.

Parameters
string$route- Path to the route which must be called - default is post request
string$target- target of the HTML element which receives the ajax response, if null then nothing will be passed back
string$name- Name you want the AJAX method to be called
string$fixedValues- A json string of values you want to be passed each time to the
string$method- POST or GET
bool$runNow- false or true - immediately execute the AJAX call as well
Returns
string - Code for the AJAX method to run
Cody::ajaxRouter (   $responseTarget = "",
  $name = "callRouter",
  $defaultMethod = "post" 
)

Ajax Router for directing form inputs and general things from an html segment.

Parameters
string$responseTargetThis is the targetted HTML Tag or element
Returns
string The script needed to run the router
Cody::bootStrapAlert (   $alertType = "success",
  $caption = "",
  $content = "",
  $dismissible = false 
)
Parameters
string$alertTypeuses "success","info","warning","danger"
string$captionthis is the text that will be displayed before the message is "WARNING!..."
string$contentthis is the content of the message to be displayed
bool$dismissibletrue/false. this will set the alert to be dismissable
Returns
shape
Cody::bootStrapButton (   $name = "button",
  $caption = "Button",
  $onclick = "",
  $style = "btn btn-primary pull-right",
  $colWidth = "col-md-12",
  $noFormGroup = false 
)
Cody::bootStrapCheckbox (   $name,
  $elements,
  $colWidth = "col-md-12" 
)
Cody::bootStrapForm (   $sql = "",
  $hideColumns = "",
  $custombuttons = null,
  $customFields = null,
  $submitAction = "",
  $formId = "formId",
  $prefix = "txt",
  $noForm = false 
)

A function to create a valid Bootstrap Form

Parameters
String$sqlA valid SQL statement for the selected database
Returns
type
Cody::bootStrapInput (   $name = "text",
  $caption = "Label",
  $placeHolder = "",
  $defaultValue = "",
  $type = "text",
  $required = "required",
  $colWidth = "col-md-12",
  $options = "",
  $step = 1 
)
Cody::bootStrapLookup (   $name,
  $caption,
  $elements,
  $value = "",
  $onclick = "",
  $readonly = "",
  $colWidth = "col-md-12",
  $nochoose = false 
)
Cody::bootStrapMenuTree ( )
Cody::bootStrapMessageBox (   $title,
  $linkTitle = "Click Here",
  $url = "#",
  $number = "",
  $panelClass = "panel panel-primary",
  $glyphClass = "fa fa-comments fa-5x" 
)

This is a function to create a dashboard type message box

Parameters
String$titleMain title of the message box
String$linkTitleTitle of the link
String$urlThe url/href of the link
String$numbervalue for the amount of comments or etc..
type$panelClassClass for the panel to determine the color or style
type$glyphClassClass for the glyph to determine which glyph and size
Returns
$html return
Cody::bootStrapModal (   $header,
  $body,
  $footer,
  $closeCode = "$('.modal').removeClass('show');",
  $icon = "",
  $modalsize = "" 
)
Cody::bootStrapPanel (   $title,
  $content,
  $class = "panel panel-default",
  $footerContent = "",
  $icon = "" 
)

Boot strap panel formatter

Parameters
String$title
String$content
String$class
Cody::bootStrapTable (   $sql = "select * from user_detail",
  $buttons = "",
  $hideColumns = "",
  $toolbar = "My Grid",
  $customFields = null,
  $name = "grid",
  $tableInfo = "",
  $formHideFields = "",
  $events = "",
  $class = "table table-striped",
  $rowLimit = 20,
  $paginate = true,
  $searchable = true,
  $checked = false,
  $selected_page = 1,
  $checkedPostURL = "",
  $checkSingleSelect = true,
  $checkEvent = "",
  $mobiletooltip = "" 
)

An easy way to make a paginated bootStrapTable

Parameters
String$sql
Array$buttons
String$hideColumns
String$toolbar
Integer$rowLimit
Integer$selected_page
Array$customFields
String$name
String$tableInfo- Array of information about the table ["table" => "tablename", "primarykey" => "field1,field2[,...]", "fields" => "field1,field2[,...]"]
String$formHideFieldsfield1,field2[,...]
String$eventsArray on events that could happen ["onupdate" => "javascript", "oninsert" => "javascript", "ondelete" => "javascript", "beforeinsert" => "javascript", "beforeupdate" => "javascript", "beforedelete" => "javascript"]
String$class
Boolean$paginate
Boolean$searchable
Boolean$checked
String$checkPostURL
Returns
type
Cody::bootStrapTabs (   $tabs = array())
Todo:
generate unique id identifier for tab ids
Parameters
array$tabs
Returns
string

USAGE $tabs = array( "Tab 1" => div("HTML/Shape tags", p("paragraph content")), "Tab 2" => "Any Content", "Tab 3" => "Tab 3 Content", ); echo (new Cody($this->DEB))->bootStrapTabs($tabs);

Filter through tabs, creating additional values

Cody::bootStrapTextArea (   $name,
  $caption = "Test Input",
  $placeholder = "Type in here",
  $defaultValue = "",
  $colWidth = "col-md-12",
  $noFormGroup = false 
)
Cody::bootStrapView (   $sql = "",
  $hideColumns = "",
  $custombuttons = null,
  $customFields = null,
  $submitAction = "" 
)
Parameters
type$sql
type$hideColumns
type$custombuttons
type$customFields
type$submitAction
Returns
type
Cody::codeBuilder ( )
Cody::codeHandler (   $action)
Cody::createTableForm (   $action,
  $object,
  $record,
  $db = "" 
)
Cody::GetCallingMethodName ( )
Cody::getCodeNavigator ( )
Cody::getCodeWindow (   $id,
  $code 
)
Cody::getFieldInfo (   $sql)

This function gets the fields from an SQL statement

Parameters
String$sqlA valid SQL statement for the selected database
Returns
FieldInfo An Array of Field Objects
Cody::getFileExplorer ( )
Cody::getFileTree (   $path = "",
  $callBack = "",
  $root = false 
)
Cody::getPageTemplate (   $title = "Default")

The default page template for maggy

Parameters
type$titleString A title to name the page by
Returns
type Shape A page template with default bootstrap
Cody::getParseScript (   $name)
Cody::getTemplate (   $name = "",
  $type = "form" 
)
Cody::IsDate (   $Str)
Cody::populateDropDownItems (   $dropDownSql,
  $onClick,
  $parent 
)

Helper function to populate the li of the dropdown items

Parameters
type$dropDownSql
Returns
type
Cody::select (   $name = "txt",
  $alttext = "",
  $selecttype = "array",
  $lookup = "",
  $value = "",
  $event = "",
  $cssid = "",
  $readonly = false,
  $nochoose = true 
)

The select tag creator

Parameters
String$nameThe name of the select drop down
String$alttextThe hover text to be displayed
String$selecttypeCan be array, sql, multiarray, multisql
String$lookupAn SQL statement or pipe delimited key value set - eg 0,None|1,Yes|2,No
String$valueA value key to be set as the default in the drop down
String$eventAn event for the select box - eg onchange="window.alert('hello');"
String$cssidThe name of the id for styling purposes
Boolean$readonlyIs the component readonly
Boolean$nochooseRemoves a dummy choose from option
Returns
String The resulting html for the select
Cody::validateForm (   $rules,
  $messages = "",
  $formId = "formInput" 
)

The Validation of forms

The form validator is an easy way to validate forms in the system using jQuery

See also
http://jqueryvalidation.org/files/demo/
Parameters
String$rulesA JSON object which matches the form inputs we need to use
String$messagesA JSON object which matches the form inputs for the messaging
Returns
String An HTML javascript output

The documentation for this class was generated from the following file: