RUSSYSDEV: eiseIntra
Instant administrative backend for your application

class eiseList

eiseList

Data listing and filtering class with support of autoloading on scroll event, Excel output, Ajax cell update, column chooser, tabs filter.

Version 1.5 (4.5)

Formerly known as ‘phpList’ (c)2005-2025 Eliseev Ilya https://russysdev.github.io/eiseIntra/

Authors: Ilya Eliseev, Pencho Belneiski, Dmitry Zakharov, Igor Zhuravlev License: MIT

sponsored: Yusen Logistics Rus LLC

public property $conf

Configuration array with default settings. You can override them in constructor.

public $conf = Array(
    'includePath' => '../'
    , 'dateFormat' => "d.m.Y" // 
    , 'timeFormat' => "H:i" // 
    , 'decimalPlaces' => "2"
    , 'decimalSeparator' => "."
    , 'thousandsSeparator' => ","
    , 'titleTotals' => 'Totals'
    , 'titlePleaseWait' => 'Please wait...'
    , 'titleNothingFound' => 'Nothing found'
    , 'titleERRORBadResponse' => 'ERROR: bad response'
    , 'titleTryReload' => 'try to reload this page'
    , 'titleFilterDateFrom' => 'Period Start'
    , 'titleFilterDateTill' => 'Period End'
    , 'titleFilterApply' => 'Apply'
    , 'titleFilterClear' => 'Clear'
    , 'titleFilterClose' => 'Close'
    , 'titleTabAny' => 'Any %s'
    
    , 'controlBarButtons' => 'btnSearch|btnFieldChooser|btnOpenInExcel|btnReset'

    , 'exactMatch' => false
    
    , 'dataSource' => "" //$_SERVER["PHP_SELF"]
    
    , 'rowsFirstPage' => 100
    , 'rowsPerPage' => 100
    , 'maxRowsForSelection' => 5000
    , 'calcFoundRows' => true
    , 'cacheSQL' => true
    , 'doNotSubmitForm' => true

    , 'isNullFilterValue' => 'n/a'
    
    , 'cookieExpire' => 0 

    , 'hiddenColsExcel' =>  array() // array of columns to be hidden on Excel output
    , 'flagNoExcel' => false

    , 'debug' => false

    , 'tabsFilterColumn' => null // if set, list will try to breakdown data into tabs with titles from column source
);

Category: List Configuration

static property $col_default

Default column settings

private static $col_default = Array(
    'title' => ''
    , 'type' => 'text' // text, integer, date, datetime, select, combobox, ajax_dropdown, checkbox, row_id, order 
    , 'PK' => false // if true, column is a primary key, it will be used to update data
    , 'phpLNums' => null // if true, column will be rendered as row number, it will be used to update data
    , 'sql' => null // SQL expression, if empty, field is used
    , 'source' => null // source for select, combobox, ajax_dropdown
    , 'source_prefix' => null // source for select, combobox, ajax_dropdown, if empty, field is used 
    , 'order_field' => null // field name to order by, if empty, field is used
    , 'filter' => null
    , 'filterValue' => null // value to filter by, if empty, no filter is applied
    , 'exactMatch' => false // if true, filter will be exact match, otherwise LIKE '%filterValue%'
    , 'group' => null // field name to group by, if empty, no grouping is applied
    , 'aggregate' => null // aggregate function to apply, if empty, no aggregate is applied
    , 'flagNoExcel' => false // if true, column will not be shown in Excel output
    , 'checkbox' => false // if true, column will be rendered as checkbox
    , 'class' => '' // CSS class to apply to the column
    , 'width' => '' // CSS width to apply to the column
    , 'href' => null // if set, column will be rendered as link with this href
    , 'nourlencode' => false // if true, href will not be urlencoded
    , 'limitOutput' => 0 // if set, column will be limited to this number of characters
);

Category: List Configuration

public function __construct()

Class constructor. Intra object can be passed as part of $arrConfig array with ‘intra’ key to inherit some settings from eiseIntra.

Parameters:

  • $oSQL (object) - SQL object
  • $strName (string) - List name
  • $arrConfig (array) - Configuration array (see eiseList::$conf for possible settings)

Category: List Configuration

public function addColumn($arrCol)

This method adds columns to $Columns property.

Parameters:

  • $arrCol - associative array with column properties. See description of $Columns property.
  • $arrCol[‘field’] - is mandatory
  • $arrCol[‘fieldInsertBefore’] - field name to insert before
  • $arrCol[‘fieldInsertAfter’] - field name to insert after

Category: List Configuration

public function setColumnProperty()

This method changes column property to defined values and returns its previous value.

Parameters:

  • $field (string) - field name, ‘field’ property of column, the search key
  • $property (string) - property name to change
  • $value (variant) - value to be set. If NULL, $property become unset from this column

Returns: variant - previous property value. If property ot column is not found , it returns NULL

Category: List Configuration

public function setColumnOrder($arrColFields)

This method filters columns according to supplied array and put it in specified order

Parameters:

  • $arrColFields (array) - array of field names to be kept and their order

Category: List Configuration

public function getColumn($field, &$key=’‘)

This function returns column array and updates the key it could be accessed from $lst->Columns list

Parameters:

  • $field
  • $key=’’

Category: List Configuration

public function removeColumn($field)

This function removes column by field name.

Parameters:

  • $field

Category: List Configuration

public function handleDataRequest()

This function handles data requests and returns them in requested format: JSON, Aggregate data JSON or Excel XML.

It caches SQL query and columns configuration for faster response on next requests.

Category: List Data Handling

public function show()

This function directly outputs list contents in HTML.

Category: List Display

public function updateCell()

This function updates a particular field in eiseList with DataAction=updateCell. If there’s no $intra and user isn’t granted to update or write on the script below, it doesn’t work. Otherwise it updates a field in the table specified in sqlFrom basing on primary key value. AFter update it generates json with intra and dies.

In currenct version it works only with string and int values. NULL cannot be transferred.

Parameters:

  • $newData (array) - data necesasry fo update, as associative array:
    • pk (string) - primary key value
    • field (string) - field name
    • value (string) - field value

Category: List Data Handling

public function getCookie()

This function returns cookie array.

Returns: array of cookie data for given list. If there’re no cookie set, it returns null.

public function getFilterValue( $field )

This function obtains filter value for $field parameter from $_GET.

Parameters:

  • $field string - field name to get filter value for.

Returns: string - filter value. If filter’s not set, it returns NULL.

Category: List Data Handling

private function handleInput()

This method handles eiseList input: $_GET, $_COOKIE and session parameters. What can be set to the list via input:

  • hidden columns
  • maximum row number to obtain during the query
  • sort order field (list should have the column with ‘order_field’ parameter with this field name)
  • sort order direction
  • filter values

The list gets search parameters from cookie or session, but if there’s something set with $_GET, this data overrides cookie settings. What parameters can be set with $_GET:

  • <list name>HiddenCols - comma-separated list of hidden columns
  • <list name>MaxRows - maximum row number to obtain during the query
  • <list name>OB - field name to order by
  • <list name>ASC_DESC - direction field, can be ‘ASC’ or ‘DESC’
  • <list name>_<field name> - filter value(s).

Parameters that saved with cookies are stored as serialized array under key $this->conf['cookieName']. Cookie array member keys are:

  • HiddenCols - comma-separated string with columns names to be hidden
  • MaxRows - maximum row number to obtain
  • OB - order by field name
  • ASC_DESC - ordering direction (ascending/descending)
  • <filter values> - are stored under keys consists of $this->name.'_'.$col['filter'] .

Filter values for columns with 'filterType'=>'multiline' are stored into $_SESSION variable as array member under $this->conf['cookieName'] key.

Hidden columns array, maximum row number, sort ordering parameters are being set to the corresponding list variables. Filter values are assigned to $this->Columns array members as ‘filterValue’ array member. Afterwards it sets cookie with specified parameters and saves correspoding data into the session.

Category: List Data Handling

private function composeSQL()

This function composes SQL query for the list basing on list columns, filters, sorting and grouping settings.

Category: List Data Handling

private function getSearchCondition(&$col)

This method returns SQL search expression for given column as string that looks like myColumn='my filter value'. In common case: <searchSubject> <searchOperator> <searchCriteria>

<searchSubject> is column name or SQL expression that would be tested on match with supplied filter value.

<searchOperator> and <searchCriteria> are defined basing on column type, filter value and other factors.

For text, it searches for partial match by default (expression is myColumn LIKE '%my filter value%')

In case when column has ‘exactMatch’ property set to TRUE or filter value is encolsed into double or single quotes (“’” or “””), it returns expression for direct match: myColumn='my filter value'

For numeric values it allows to use comparison operators, like =, ,, <, >= or <= before the number in filter value. Same is for date/datetime values. For these types it also allows logical “&” (“and”) operator.

If filter value is empty, it returns empty string (only if exact match option is not set for this column). If filter value matches matches isNullFilterValue from configuration we return <searchExpression> IS NULL.

Parameters:

  • $col (array) - column, a single member of eiseList::Columns property.

Returns: string

Category: List Data Handling

class phpLister

phpLister class extends eiseList class to provide backward compatibility with phpLister library. It has the same constructor as phpLister class had and an Execute method that sets main SQL parameters.

Category: List Backward Compatibility

jquery_plugin eiseList

eiseList jQuery wrapper

requires jQuery UI 1.8: http://ajax.googleapis.com/ajax/libs/jqueryui/1.8/jquery-ui.min.js

Published under GPL version 2 license (c)2005-2025 Ilya S. Eliseev ie@e-ise.com, easyise@gmail.com

Contributors:

  • Pencho Belneiski
  • Alexander Demidov
  • Dmitry Zakharov
  • Igor Zhuravlev

eiseList reference http://russysdev.github.io/eiseIntra/gridlist

public function init(conf)

This function initializes eiseList plugin on specified element. This element is formed with eiseList PHP class. It craetes eiseList object and associates it with the element.

Parameters:

  • {*} conf - Configuration object that overrides default settings. See eiseList.defaults for available settings and their default values.

Category: List Configuration
Returns:

public function refresh()

Refreshes the eiseList contents according to existing filters and sort order.

Category: List Data Handling
Returns:

public function getListObject()

eiseList('getListObject') returns eiseList object associated with the element.

Category: List Configuration
Returns: eiseList object

public function getRowSelection()

This method returns array or string of selected row IDs - in other words, rows marked with checkboxes in fields that match the selectorinput[name='sel_"+list.id+"[]'].

Returns: array of row IDs