|
static | get_form_value ($name, $default='') |
|
static | getDate ($name, $default='', $format='Y-m-d') |
|
static | dateRangePicker ($one='date1', $two='date2', $week_start=1) |
|
static | date_range_picker ($one='date1', $two='date2', $week_start=1) |
|
static | storePicker ($field_name='store', $all=true) |
|
static | dateAndDepartmentForm () |
|
static | standardItemFields () |
|
static | standardDepartmentFields ($super='super', $multi='departments', $start='deptStart', $end='deptEnd', $subs='subdepts') |
|
static | standardDateFields () |
|
static | standardItemFromWhere () |
|
static | extract (\COREPOS\common\mvc\ValueContainer $c, $field, $default='') |
|
static | queryStringToJSON ($str) |
|
static | fieldJSONtoJavascript ($json) |
|
static FormLib::dateAndDepartmentForm |
( |
| ) |
|
|
static |
Generate a very standard form with date and department fields
- Returns
- [string] html form
static FormLib::dateRangePicker |
( |
|
$one = 'date1' , |
|
|
|
$two = 'date2' , |
|
|
|
$week_start = 1 |
|
) |
| |
|
static |
Get a fieldset to select certain date ranges Requires JQquery
- Parameters
-
$one | id for date input (default 'date1') |
$two | id for date input (default 'date2') |
$week_start | day number (default 1/Monday) |
- Returns
- HTML string
calculate all the applicable dates in PHP
static FormLib::extract |
( |
\COREPOS\common\mvc\ValueContainer |
$c, |
|
|
|
$field, |
|
|
|
$default = '' |
|
) |
| |
|
static |
Method gets a value from container or returns a default if the value does not exist
[object] container for values [string] field name [mixed] default value field value OR default value
static FormLib::fieldJSONtoJavascript |
( |
|
$json | ) |
|
|
static |
Generate javascript that will initialize fields based on names and values in the JSON object
static FormLib::getDate |
( |
|
$name, |
|
|
|
$default = '' , |
|
|
|
$format = 'Y-m-d' |
|
) |
| |
|
static |
Get form input as a formatted date
- Parameters
-
$name | [string] form field |
$default | [mixed, optional] default value if form input is omitted or invalid |
$format | [string, optional] date format string. Default is Y-m-d. |
static FormLib::queryStringToJSON |
( |
|
$str | ) |
|
|
static |
Convert a query string to a JSON object representing field names and values
static FormLib::standardDateFields |
( |
| ) |
|
|
static |
Generate standard date fields with date_range_picker
static FormLib::standardDepartmentFields |
( |
|
$super = 'super' , |
|
|
|
$multi = 'departments' , |
|
|
|
$start = 'deptStart' , |
|
|
|
$end = 'deptEnd' , |
|
|
|
$subs = 'subdepts' |
|
) |
| |
|
static |
Draw a standard set of bootstrap'd department fields with javascript chaining as they change
- Parameters
-
$super | [string, default 'super'] name of the super department <select> |
$multi | [string, default 'departments'] name of the department multi <select> |
$start | [string, default 'deptStart'] name of the department start single <select> |
$end | [string, default 'deptEnd'] name of the department end single <select> |
$subs | [string, default 'subdepts'] name of the subdepartment multi <select> |
- Returns
- [string] HTML
Precalculate options for superdept and dept selects
Store javascript chaining function calls in variables the sub chaining one is repeated a bunch. The super chaining one depends which type of department <select>s are shown They're also ridiculously long argument lists.
The rest of this method uses HEREDOC style strings with {{PLACEHOLDERS}} and substitutes PHP variables in after the fact. This is an uncommon coding style in the overall project but the HTML is easier to read
static FormLib::standardItemFields |
( |
| ) |
|
|
static |
Build a standardized set of for querying items Currently includes tabs for: department / superdepartment brand vendor like code
static FormLib::standardItemFromWhere |
( |
| ) |
|
|
static |
Generate FROM and WHERE clauses with appropriate parameters and joins based on the standard form submissions.
- Returns
- [keyed array]
- query [string] from and where clauses
- args [array] corresponding parameters
static FormLib::storePicker |
( |
|
$field_name = 'store' , |
|
|
|
$all = true |
|
) |
| |
|
static |
Get <select> box for the store ID
- Parameters
-
$field_name | [string] select.name (default 'store') $param $all [string] include an "all" option (default true) |
- Returns
- keyed [array]
- html => [string] select box
- names => [array] store names
The documentation for this class was generated from the following file:
- fannie/classlib2.0/lib/FormLib.php