Lists
class Lists extends BaseWidget
Traits
Widget Maker Trait Class
Adds event related features to any class.
Extendable Trait Allows for "Private traits"
Properties
protected array | $extensionData | from ExtendableTrait | |
static protected array | $extendableCallbacks | from ExtendableTrait | |
static protected array | $extendableStaticMethods | from ExtendableTrait | |
static protected bool | $extendableGuardProperties | from ExtendableTrait | |
static protected ClassLoader | $extendableClassLoader | from ExtendableTrait | |
$implement | from Extendable | ||
array | $vars | from ViewMaker | |
array | $viewPath | from ViewMaker | |
array | $layoutPath | from ViewMaker | |
array | $partialPath | from ViewMaker | |
string | $layout | from ViewMaker | |
bool | $suppressLayout | from ViewMaker | |
protected | $viewFileExtension | from ViewMaker | |
array | $assetPath | from AssetMaker | |
string | $configPath | from ConfigMaker | |
protected | $configFileExtension | from ConfigMaker | |
protected array | $emitterSingleEvents | from EventEmitter | |
protected array | $emitterEvents | from EventEmitter | |
protected array | $emitterEventSorted | from EventEmitter | |
protected AdminController | $controller | from BaseWidget | |
object | $config | from BaseWidget | |
string | $alias | from BaseWidget | |
protected | $defaultAlias | ||
array | $bulkActions | ||
array | $columns | ||
Model | $model | ||
string | $emptyMessage | ||
int | $pageLimit | ||
bool | $showCheckboxes | ||
bool | $showSetup | ||
bool|string | $showPagination | ||
bool | $showPageNumbers | ||
bool | $showDragHandle | ||
bool | $showSorting | ||
mixed | $defaultSort | ||
protected array | $allColumns | ||
protected array | $columnOverride | ||
protected array | $visibleColumns | ||
protected array | $records | ||
protected int | $currentPageNumber | ||
protected string | $searchTerm | ||
protected string | $searchMode | ||
protected string | $searchScope | ||
protected array | $filterCallbacks | ||
protected array | $sortableColumns | ||
protected string | $sortColumn | ||
protected string | $sortDirection | ||
protected | $allBulkActions | ||
protected | $availableBulkActions | ||
protected | $bulkActionWidgets |
Methods
Helper method for ::extend() static method
Clear the list of extended classes so they will be re-extended.
Normalizes the provided extension name allowing for the ClassLoader to inject aliased classes
Dynamically extend a class with a specified behavior
Extracts the available methods from a behavior and adds it to the list of callable methods.
Programmatically adds a method to the extendable class
Programatically adds a property to the extendable class
Check if extendable class is extended with a behavior object
Returns a behavior object from an extendable class, example:
Short hand for getClassExtension() method, except takes the short extension name, example:
Checks if a method exists, extension equivalent of method_exists()
Get a list of class methods, extension equivalent of get_class_methods()
Checks if a property exists, extension equivalent of property_exists()
Checks if a property is accessible, property equivalent of is_callabe()
Magic method for __call()
Magic method for __callStatic()
Makes a widget object with the supplied configuration ex. model config
Makes a form widget object with the supplied form field and widget configuration.
Retrieves key/value pair from session data.
Saves key/value pair in to session data.
Retrieves key/value pair from session temporary data.
Saves key/value pair in to session temporary data.
Guess the package path from a specified class.
Render a layout.
Render a partial file contents located in the views or partial folder.
Includes a file path using output buffering.
Locates a file based on it's definition. If the file starts with a forward slash, it will be returned in context of the application public path, otherwise it will be returned in context of the asset path.
Reads the contents of the supplied file and applies it to this object.
Reads the contents of the supplied file and applies it to this object.
Merges two configuration sources, either prepared or not, and returns them as a single configuration object.
Locates a file based on it's definition. If the file starts with the ~ symbol it will be returned in context of the application base path, otherwise it will be returned in context of the config path.
Guess the package path for the called class.
Guess the package path from a specified class.
Create a new event binding.
Create a new event binding that fires once only
Sort the listeners for a given event by priority.
Fire an event and call the listeners.
Fires a combination of local and global events. The first segment is removed from the event name locally and the local object is passed as the first argument to the event globally. Halting is also enabled by default.
Initialize the widget called by the constructor.
Renders the widgets primary contents.
Transfers config values stored inside the $config property directly on to the root object properties.
Returns a unique ID for this widget. Useful in creating HTML markup.
Returns a fully qualified event handler name for this widget.
Get the widget configuration values.
Adds widget specific asset files.
No description
Event handler for refreshing the list.
Event handler for switching the page number.
No description
Replaces the @ symbol with a table name in a model
Applies any filters to the model.
Returns all the records from the supplied model, after filtering.
Get all the registered columns for the instance.
Get a specified column object
Returns the list columns that are visible by list settings or default
Builds an array of list columns with keys as the column name and values as a ListColumn object.
Allow the model to filter columns.
Programatically add columns, used internally and for extensibility.
No description
Creates a list column object from it's name and configuration.
No description
Calculates the total columns used in the list, including checkboxes and other additions.
Looks up the column header
Looks up the column value
No description
No description
Process as text, escape the value
Process as partial reference
Process as partial reference
Process as boolean control
Process as a datetime value
Process as a time value
Process as a date value
Process as diff for humans (1 min ago)
Process as diff for humans (today)
Process as time as current tense (Today at 0:00)
Process as partial reference
Validates a column type as a date
No description
Applies a search term to the list results, searching will disable tree view if a value is supplied.
Applies a search options to the list search.
Returns a collection of columns which can be searched.
Applies the search constraint to a query.
Event handler for sorting the list.
Returns the current sorting column, saved in a session or cached.
Returns true if the column can be sorted.
Returns a collection of columns which are sortable.
Event handler to display the list set up.
Event handler to apply the list set up.
Event handler to reset the list set up.
Returns all the list columns used for list set up.
Returns an array of allowable records per page.
No description
No description
No description
No description
No description
No description
Check if column refers to a relation of the model
Details
in
ExtendableTrait at line 55
extendableConstruct()
Constructor.
in
ExtendableTrait at line 103
static void
extendableExtendCallback(callable $callback)
Helper method for ::extend() static method
in
ExtendableTrait at line 120
static void
clearExtendedClasses()
Clear the list of extended classes so they will be re-extended.
in
ExtendableTrait at line 131
protected string
extensionNormalizeClassName(string $name)
Normalizes the provided extension name allowing for the ClassLoader to inject aliased classes
in
ExtendableTrait at line 149
void|ExtendableTrait
extendClassWith(string $extensionName)
Dynamically extend a class with a specified behavior
in
ExtendableTrait at line 178
protected void
extensionExtractMethods(string $extensionName, object $extensionObject)
Extracts the available methods from a behavior and adds it to the list of callable methods.
in
ExtendableTrait at line 206
addDynamicMethod(string $dynamicName, callable $method, string $extension = null)
Programmatically adds a method to the extendable class
in
ExtendableTrait at line 225
addDynamicProperty(string $dynamicName, string $value = null)
Programatically adds a property to the extendable class
in
ExtendableTrait at line 249
bool
isClassExtendedWith(string $name)
Check if extendable class is extended with a behavior object
in
ExtendableTrait at line 265
mixed
getClassExtension(string $name)
Returns a behavior object from an extendable class, example:
$this->getClassExtension('Admin.Actions.FormController')
in
ExtendableTrait at line 280
mixed
asExtension(string $shortName)
Short hand for getClassExtension() method, except takes the short extension name, example:
$this->asExtension('FormController')
in
ExtendableTrait at line 301
bool
methodExists(string $name)
Checks if a method exists, extension equivalent of method_exists()
in
ExtendableTrait at line 313
array
getClassMethods()
Get a list of class methods, extension equivalent of get_class_methods()
in
ExtendableTrait at line 326
array
getDynamicProperties()
Returns all dynamic properties and their values
in
ExtendableTrait at line 344
bool
propertyExists(string $name)
Checks if a property exists, extension equivalent of property_exists()
in
ExtendableTrait at line 370
protected bool
extendableIsAccessible(mixed $class, string $propertyName)
Checks if a property is accessible, property equivalent of is_callabe()
in
ExtendableTrait at line 385
string
extendableGet(string $name)
Magic method for __get()
in
ExtendableTrait at line 410
string
extendableSet(string $name, string $value)
Magic method for __set()
in
ExtendableTrait at line 444
mixed
extendableCall(string $name, array $params = null)
Magic method for __call()
in
ExtendableTrait at line 483
static mixed
extendableCallStatic(string $name, array $params = null)
Magic method for __callStatic()
in
ExtendableTrait at line 552
protected ClassLoader|null
extensionGetClassLoader()
Gets the class loader
in
BaseWidget at line 54
__construct(Controller $controller, array $config = [])
Constructor
in
Extendable at line 30
__get($name)
No description
in
Extendable at line 35
__set($name, $value)
No description
in
Extendable at line 40
__call($name, $params)
No description
in
Extendable at line 45
static
__callStatic($name, $params)
No description
in
Extendable at line 50
static
extend(callable $callback)
No description
in
WidgetMaker at line 24
BaseWidget
makeWidget(string $class, array $widgetConfig = [])
Makes a widget object with the supplied configuration ex. model config
in
WidgetMaker at line 47
BaseFormWidget
makeFormWidget(string $class, mixed $fieldConfig = [], array $widgetConfig = [])
Makes a form widget object with the supplied form field and widget configuration.
in
SessionMaker at line 17
mixed
getSession(string $key = null, string $default = null)
Retrieves key/value pair from session data.
in
SessionMaker at line 37
void
putSession(string $key, mixed $value)
Saves key/value pair in to session data.
in
SessionMaker at line 47
hasSession($key)
No description
in
SessionMaker at line 62
mixed
getTempSession(string $key = null, string $default = null)
Retrieves key/value pair from session temporary data.
in
SessionMaker at line 82
void
putTempSession(string $key, mixed $value)
Saves key/value pair in to session temporary data.
in
SessionMaker at line 92
forgetSession($key)
No description
in
SessionMaker at line 101
resetSession()
No description
in
SessionMaker at line 111
protected string
makeSessionKey()
Returns a unique session identifier for this location.
in
SessionMaker at line 119
protected
encodeSessionData($data)
No description
in
SessionMaker at line 130
protected
decodeSessionData($data)
No description
in
ViewMaker at line 50
getViewPath($view, $viewPath = null)
No description
in
ViewMaker at line 78
guessViewFileExtension($path)
No description
in
ViewMaker at line 98
string
guessViewPath(string $suffix = '', bool $isPublic = false)
Guess the package path from a specified class.
in
ViewMaker at line 119
mixed
makeLayout(string $name = null, array $vars = [], bool $throwException = true)
Render a layout.
in
ViewMaker at line 147
string
makeView(string $view)
Loads a view with the name specified.
Applies layout if its name is provided by the parent object. The view file must be situated in the views directory, and has the extension "htm" or "php".
in
ViewMaker at line 171
mixed
makePartial(string $partial, array $vars = [], bool $throwException = true)
Render a partial file contents located in the views or partial folder.
in
ViewMaker at line 199
string
makeFileContent(string $filePath, array $extraParams = [])
Includes a file path using output buffering.
Ensures that vars are available.
in
ViewMaker at line 235
compileFileContent($filePath)
No description
in
ViewMaker at line 256
protected void
handleViewException(Exception $e, int $obLevel)
Handle a view exception.
in
ViewMaker at line 271
protected array
gatherViewData($data)
Get the data bound to the view instance.
in
AssetMaker at line 15
flushAssets()
No description
in
AssetMaker at line 30
string
getAssetPath(string $fileName, string $assetPath = null)
Locates a file based on it's definition. If the file starts with a forward slash, it will be returned in context of the application public path, otherwise it will be returned in context of the asset path.
in
AssetMaker at line 55
addMeta($meta)
No description
in
AssetMaker at line 60
addJs($href, $attributes = null)
No description
in
AssetMaker at line 65
addCss($href, $attributes = null)
No description
in
ConfigMaker at line 27
array
loadConfig(array $configFile = [], array $requiredConfig = [], null $index = null)
Reads the contents of the supplied file and applies it to this object.
in
ConfigMaker at line 46
array
makeConfig(string|array $configFile, array $requiredConfig = [])
Reads the contents of the supplied file and applies it to this object.
in
ConfigMaker at line 97
array
mergeConfig($configLeft, $configRight)
Merges two configuration sources, either prepared or not, and returns them as a single configuration object.
in
ConfigMaker at line 116
string
getConfigPath(string $fileName, mixed $configPath = null)
Locates a file based on it's definition. If the file starts with the ~ symbol it will be returned in context of the application base path, otherwise it will be returned in context of the config path.
in
ConfigMaker at line 154
string
guessConfigPath(string $suffix = '')
Guess the package path for the called class.
in
ConfigMaker at line 169
string
guessConfigPathFrom(string $class, string $suffix = '')
Guess the package path from a specified class.
in
EventEmitter at line 36
EventEmitter
bindEvent(string $event, callable $callback, int $priority = 0)
Create a new event binding.
in
EventEmitter at line 52
EventEmitter
bindEventOnce(string $event, callable $callback)
Create a new event binding that fires once only
in
EventEmitter at line 66
protected void
emitterEventSortEvents(string $eventName)
Sort the listeners for a given event by priority.
in
EventEmitter at line 84
EventEmitter
unbindEvent(string $event = null)
Destroys an event binding.
in
EventEmitter at line 124
string|array
fireEvent(string $event, array $params = [], bool $halt = false)
Fire an event and call the listeners.
in
EventEmitter at line 178
mixed
fireSystemEvent(string $event, array $params = [], bool $halt = true)
Fires a combination of local and global events. The first segment is removed from the event name locally and the local object is passed as the first argument to the event globally. Halting is also enabled by default.
For example:
$this->fireSystemEvent('admin.form.myEvent', ['my value']);
Is equivalent to:
$this->fireEvent('form.myEvent', ['myvalue'], true);
Event::fire('admin.form.myEvent', [$this, 'myvalue'], true);
in
LocationAwareWidget at line 10
protected
isLocationAware($config)
No description
in
LocationAwareWidget at line 20
protected
locationApplyScope($query)
Apply location scope where required
at line 157
void
initialize()
Initialize the widget called by the constructor.
at line 191
string
render()
Renders the widgets primary contents.
in
BaseWidget at line 107
void
bindToController()
Binds a widget to the controller for safe use.
in
BaseWidget at line 120
protected void
fillFromConfig(array $properties = null)
Transfers config values stored inside the $config property directly on to the root object properties.
in
BaseWidget at line 140
string
getId(string $suffix = null)
Returns a unique ID for this widget. Useful in creating HTML markup.
in
BaseWidget at line 162
string
getEventHandler(string $name)
Returns a fully qualified event handler name for this widget.
in
BaseWidget at line 170
getController()
Returns the controller using this widget.
in
BaseWidget at line 181
setConfig(array $config, array $required = [])
Sets the widget configuration values
in
BaseWidget at line 194
mixed
getConfig(string $name = null, mixed $default = null)
Get the widget configuration values.
at line 184
void
loadAssets()
Adds widget specific asset files.
use $this->addCss or $this->addJs
at line 198
prepareVars()
No description
at line 220
onRefresh()
Event handler for refreshing the list.
at line 230
onPaginate()
Event handler for switching the page number.
at line 237
protected
validateModel()
No description
at line 254
protected string
parseTableName(string $sql, string $table)
Replaces the @ symbol with a table name in a model
at line 262
prepareModel()
Applies any filters to the model.
at line 399
protected Collection
getRecords()
Returns all the records from the supplied model, after filtering.
at line 424
array
getColumns()
Get all the registered columns for the instance.
at line 436
mixed
getColumn(string $column)
Get a specified column object
at line 444
getVisibleColumns()
Returns the list columns that are visible by list settings or default
at line 481
protected
defineListColumns()
Builds an array of list columns with keys as the column name and values as a ListColumn object.
at line 512
protected
applyFiltersFromModel()
Allow the model to filter columns.
at line 524
addColumns(array $columns)
Programatically add columns, used internally and for extensibility.
at line 540
removeColumn($columnName)
No description
at line 555
ListColumn
makeListColumn($name, array $config)
Creates a list column object from it's name and configuration.
at line 587
protected
makePagination()
No description
at line 605
protected
getTotalColumns()
Calculates the total columns used in the list, including checkboxes and other additions.
at line 628
getHeaderValue($column)
Looks up the column header
at line 648
null|string
getColumnValue($record, $column)
Looks up the column value
at line 675
getButtonAttributes($record, $column)
No description
at line 712
getValueFromData($record, $column, $columnName)
No description
at line 751
protected
evalTextTypeValue($record, $column, $value)
Process as text, escape the value
at line 759
protected
evalPartialTypeValue($record, $column, $value)
Process as partial reference
at line 776
protected
evalMoneyTypeValue($record, $column, $value)
Process as partial reference
at line 784
protected
evalSwitchTypeValue($record, $column, $value)
Process as boolean control
at line 795
protected
evalDatetimeTypeValue($record, $column, $value)
Process as a datetime value
at line 812
protected
evalTimeTypeValue($record, $column, $value)
Process as a time value
at line 829
protected
evalDateTypeValue($record, $column, $value)
Process as a date value
at line 846
protected
evalTimesinceTypeValue($record, $column, $value)
Process as diff for humans (1 min ago)
at line 860
protected
evalDatesinceTypeValue($record, $column, $value)
Process as diff for humans (today)
at line 874
protected
evalTimetenseTypeValue($record, $column, $value)
Process as time as current tense (Today at 0:00)
at line 887
protected
evalCurrencyTypeValue($record, $column, $value)
Process as partial reference
at line 895
protected
validateDateTimeValue($value, $column)
Validates a column type as a date
at line 912
addFilter(callable $filter)
No description
at line 927
setSearchTerm(string $term)
Applies a search term to the list results, searching will disable tree view if a value is supplied.
at line 937
setSearchOptions(array $options = [])
Applies a search options to the list search.
at line 952
protected array
getSearchableColumns()
Returns a collection of columns which can be searched.
at line 971
protected
applySearchToQuery($query, $columns, $boolean = 'and')
Applies the search constraint to a query.
at line 994
onSort()
Event handler for sorting the list.
at line 1021
protected
getSortColumn()
Returns the current sorting column, saved in a session or cached.
at line 1065
protected bool
isSortable(null $column = null)
Returns true if the column can be sorted.
at line 1078
protected
getSortableColumns()
Returns a collection of columns which are sortable.
at line 1099
onLoadSetup()
Event handler to display the list set up.
at line 1113
onApplySetup()
Event handler to apply the list set up.
at line 1131
onResetSetup()
Event handler to reset the list set up.
at line 1141
protected
getSetupListColumns()
Returns all the list columns used for list set up.
at line 1154
protected
getSetupPerPageOptions()
Returns an array of allowable records per page.
at line 1168
onBulkAction()
No description
at line 1196
renderBulkActionButton($buttonObj)
No description
at line 1210
protected
getAvailableBulkActions()
No description
at line 1224
protected
makeBulkActionButtons($bulkActions, $parentActionCode = null)
No description
at line 1247
protected
makeBulkActionButton($actionCode, $config)
No description
at line 1261
protected
makeBulkActionWidget($actionButton)
No description
at line 1293
protected bool
isColumnRelated(ListColumn $column, bool $multi = false)
Check if column refers to a relation of the model
at line 1327
protected bool
isColumnPivot(ListColumn $column)
Checks if a column refers to a pivot model specifically.