AutoFilterComponent

class AutoFilterComponent
addNumericRangeFilter($caption, $expression, $options)

Add a numeric range filter.

A numeric range filter is useful when you want your users to see only data with a particular expression evaluating to a value which is between two numbers specified in the filter form.

Parameters:
  • $caption (string) –
  • $expression (DBExpression) –
  • $options (FilterItemOptions|array) –
addTimeRangeFilter($caption, $expression, $options)

Add a time range filter

A time range filter is useful when you want your users to see only data with a particular expression evaluating to a timestamp value is between two dates specified on the filter form.

Parameters:
  • $caption (string) –
  • $expression (DBExpression) –
  • $options (FilterItemOptions|array) –
addTextFilter($caption, $expression, $options)

Add a text filter.

A text filter is useful when you want your users to see only data with a particular expression evaluating to a text value is equal to the value specified by the user.

Parameters:
  • $caption (string) –
  • $expression (DBExpression) –
  • $options (FilterItemOptions|array) –
addMultiSelectFilter($caption, $expression, $options)

Add a multi select filter.

Your users are given a list of options to choose one or more from, and records matching the items they have selected are displayed. TODO: improve the docs.

Parameters:
  • $caption (string) –
  • $expression (DBExpression) –
  • $options (FilterItemOptions|array) –
addSelectFilter($caption, $expression, $options)

Add a multi select filter.

Your users are given a list of options to choose a single one from, and records matching the items they have selected are displayed.

Parameters:
  • $caption (string) –
  • $expression (DBExpression) –
  • $options (FilterItemOptions|array) –
filterLinkedDataSource($filterOptions)

Filter the datasource that is linked to this component. Thus, every component linked to that datasource is also filtered.

Parameters:
  • $filterOptions (array) –
addFilterTo(Component, $filterOptions)

Apply the user filters on a component. Note that the component being filtered to has to be linked to the same datasource as this filter.

Parameters:
  • Component ($component) –
  • $filterOptions (array) –
initialize()
onActionTriggered()
onFilterApplied()
getObjectType()
addSQLWhere($exp, $boolOperand)

Add a SQL WHERE clause to this component.

1. The contents of the expression are not Escaped or binded to prepared queries. Using this function in a non-secure manner may open up your dashboard to SQL Injection vulnerabilities. 2. This condition is only applied to this specific component, not to other components.

Parameters:
  • $exp (string) – The expression to add to the SQL Queries
  • $boolOperand (string) – The boolean operand for the condition. (“AND”/”OR)
sortOn($exp, $sortOrder)

Sort the data in the component based on a particular expression. This is equivalent to having an “ORDER BY” clause in your SQL Queries.

However, this function might not work as expected in components which have data aggregated and grouped by another column. If this is the case, you should use the in-built sorting functionality of the component itself.

1. The contents of the expression are not Escaped or binded to prepared queries. Using this function in a non-secure manner may open up your dashboard to SQL Injection vulnerabilities. 2. This condition is only applied to this specific component, not to other components.

Parameters:
  • $exp (string) – The expression to sort by
  • $sortOrder (string) – The Sort order (“ASC”/”DESC”)
limitTo($exp, $sortOrder)

Limit the data in the component based on a particular expression. This is equivalent to having an “LIMIT” clause in your SQL Queries.

Parameters:
  • $exp (int) – The number of records to take
  • $sortOrder (int) – The number of records to skip
addCondition($expression, $comparison, $value, $boolOperand)

Add a condition to the component. This is similar to having a “WHERE” clause in your SQL Query, but there are a few differences:

1. The $value parameter is protected against SQL Injection attacks so you do not need to worry about escaping the value. 2. There are specific comparisons that you can perform

The comparison operators you can use are:

  • Equality: “eq”, “==”, “isequalto”, “equals”, “equalto”, “equal”
  • Inequality: “neq”, ”!=”, “isnotequalto”, “notequals”, “notequalto”, “notequal”, “ne”
  • Less than: “lt”, “<”, “islessthan”, “lessthan”, “less”
  • Less than or equal to: “lte”, “<=”, “islessthanorequalto”, “lessthanequal”, “le”
  • Greater Than: “gt”, “>”, “isgreaterthan”, “greaterthan”, “greater”
  • Greater Than or Equal To: “gte”, “>=”, “isgreaterthanorequalto”, “greaterthanequal”, “ge”
  • Starts with: “startswith”
  • Ends wit: “endswith”
  • Contains: “contains”
Parameters:
  • $expression (string) – The column or expression to filter
  • $comparison (string) – The comparison operator
  • $value (mixed) – The value to compare against
  • $boolOperand (string) – The boolean operand (AND/OR)
addInitialCondition($expression, $comparison, $value, $boolOperand)

Add a condition which is only applied if there isn’t a drilldown.

Identical behavior to Component::addCondition

Parameters:
  • $expression (string) – The column or expression to filter
  • $comparison (string) – The comparison operator
  • $value (mixed) – The value to compare against
  • $boolOperand (string) – The boolean operand (AND/OR)
setDataSource($datasource)

Set the DataSource for this component.

The DataSource contains information on where to access the data to display in the component.

Parameters:
setCaching()

This function is Not Supported currently

addPostProcessRowCallback($callback)

After processing data (querying, fetching, filtering, etc), you can register a callback to be called with each row. Note that the callback can modify any row and return the final row.

Let’s say that you have a pie chart, but your database has values 0 and 1. You want to rewrite labels 0 => “Not Available” and 1 => “Available” you can add a callback like this

$pieChart->addPostProcessCallback('rewrite_labels');

function rewrite_labels ($row, $sourceComponent) { if($row[‘rfLabels’] === ‘0’) { $row[‘rfLabels’] = “Not Available”; } else if($row[‘rfLabels’] === ‘1’) { $row[‘rfLabels’] = “Available”; } return $row; // Don’t forget this }

Parameters:
  • $callback (function) – A function or name of function to execute
log($message)
Parameters:
  • $message (string) – The message to log
setOption()

Sets one or more options for this component.

You can call setOption in the following ways:

  1. With two params:

$component->setOption(‘caption’, “Hello!”);

  1. As an array of key-value pairs

$component->setOption (array( ‘caption’ => “Hello”, ‘numberPrefix’ => ‘$’ ));

3. As an object of the Options class for the component you’re using. for example, if you’re using it to configure a chart component, you can say

$opt = new ChartOptions();
$opt->caption = "hello";
$opt->numberPrefix = "$";
$component->setOption($opt);
setCaption($caption)

Set the caption for this component.

Parameters:
  • $caption (string) –
setPlaceholder(string)
Parameters:
  • string ($caption) – caption
setWidth($width)

Set the width class for this component.

The width can be 1 to 4.

See dimensions for more information on this

Parameters:
  • $width (int) – The width in Units of 1 to 4
setHeight($width)

Set the height class for this component.

See dimensions for more information on this

Parameters:
  • $width (int) – The height in Units
setDimensions($width, $height)

Set the dimensions for this component

The width can be between 1 to 4.

See dimensions for more information.

Parameters:
  • $width (int) – The width
  • $height (int) – The height
getID()
property ID

The ID of the object.

Every instance of the inherited cass created in a request will have a different ID

However, IDs are sequentially generated. So It’s certain that a script with multiple instances of a class

Type: string
Default: “(unset)”

Start building interactive, mobile-friendly Dashboards in PHP. See DemosDownload