Overview

Packages

  • application
    • commands
    • components
      • actions
      • filters
      • leftWidget
      • permissions
      • sortableWidget
      • util
      • webupdater
      • x2flow
        • actions
        • triggers
      • X2GridView
      • X2Settings
    • controllers
    • models
      • embedded
    • modules
      • accounts
        • controllers
        • models
      • actions
        • controllers
        • models
      • calendar
        • controllers
        • models
      • charts
        • models
      • contacts
        • controllers
        • models
      • docs
        • components
        • controllers
        • models
      • groups
        • controllers
        • models
      • marketing
        • components
        • controllers
        • models
      • media
        • controllers
        • models
      • mobile
        • components
      • opportunities
        • controllers
        • models
      • products
        • controllers
        • models
      • quotes
        • controllers
        • models
      • services
        • controllers
        • models
      • template
        • models
      • users
        • controllers
        • models
      • workflow
        • controllers
        • models
      • x2Leads
        • controllers
        • models
  • Net
  • None
  • PHP
  • system
    • base
    • caching
      • dependencies
    • collections
    • console
    • db
      • ar
      • schema
        • cubrid
        • mssql
        • mysql
        • oci
        • pgsql
        • sqlite
    • i18n
      • gettext
    • logging
    • test
    • utils
    • validators
    • web
      • actions
      • auth
      • filters
      • form
      • helpers
      • renderers
      • services
      • widgets
        • captcha
        • pagers
  • Text
    • Highlighter
  • zii
    • behaviors
    • widgets
      • grid
      • jui

Classes

  • ActionFormModelBase
  • CActiveDataProvider
  • CalendarEventFormModel
  • CallFormModel
  • CArrayDataProvider
  • CAssetManager
  • CBaseController
  • CBaseUrlRule
  • CCacheHttpSession
  • CClientScript
  • CController
  • CCookieCollection
  • CDataProvider
  • CDataProviderIterator
  • CDbHttpSession
  • CExtController
  • CFormModel
  • CHttpCookie
  • CHttpRequest
  • CHttpSession
  • CHttpSessionIterator
  • COutputEvent
  • CPagination
  • CreatePageFormModel
  • CSort
  • CSqlDataProvider
  • CTheme
  • CThemeManager
  • CUploadedFile
  • CUrlManager
  • CUrlRule
  • CWebApplication
  • CWebModule
  • CWidgetFactory
  • EditMobileFormsFormModel
  • EventCommentPublisherFormModel
  • EventFormModel
  • EventPublisherFormModel
  • FileSystemObjectDataProvider
  • MassActionFormModel
  • MobilePagination
  • NoteFormModel
  • NotificationsController
  • TimeFormModel
  • UploadLogoFormModel
  • X2FormModel
  • X2HttpRequest

Interfaces

  • IDataProvider
  • IWidgetFactory
  • Overview
  • Package
  • Class
  • Tree

Class CDataProvider

CDataProvider is a base class that implements the IDataProvider interface.

Derived classes mainly need to implement three methods: CDataProvider::fetchData(), CDataProvider::fetchKeys() and CDataProvider::calculateTotalItemCount().

CComponent
Extended by CDataProvider implements IDataProvider

Direct known subclasses

CActiveDataProvider, CArrayDataProvider, CSqlDataProvider

Indirect known subclasses

FileSystemObjectDataProvider, SmartActiveDataProvider
Abstract
Package: system\web
Author: Qiang Xue <qiang.xue@gmail.com>
Since: 1.1
Located at x2engine/framework/web/CDataProvider.php
Methods summary
abstract protected array
# fetchData( )

Fetches the data from the persistent data storage.

Fetches the data from the persistent data storage.

Returns

array
list of data items
abstract protected array
# fetchKeys( )

Fetches the data item keys from the persistent data storage.

Fetches the data item keys from the persistent data storage.

Returns

array
list of data item keys.
abstract protected integer
# calculateTotalItemCount( )

Calculates the total number of data items.

Calculates the total number of data items.

Returns

integer
the total number of data items.
public string
# getId( )

Returns the ID that uniquely identifies the data provider.

Returns the ID that uniquely identifies the data provider.

Returns

string
the unique ID that uniquely identifies the data provider among all data providers.

Implementation of

IDataProvider::getId()
public
# setId( string $value )

Sets the provider ID.

Sets the provider ID.

Parameters

$value
string
$value the unique ID that uniquely identifies the data provider among all data providers.
public CPagination|false
# getPagination( string $className = 'CPagination' )

Returns the pagination object.

Returns the pagination object.

Parameters

$className
string
$className the pagination object class name. Parameter is available since version 1.1.13.

Returns

CPagination|false
the pagination object. If this is false, it means the pagination is disabled.

Implementation of

IDataProvider::getPagination()
public
# setPagination( mixed $value )

Sets the pagination for this data provider.

Sets the pagination for this data provider.

Parameters

$value
mixed
$value the pagination to be used by this data provider. This could be a CPagination object or an array used to configure the pagination object. If this is false, it means the pagination should be disabled. You can configure this property same way as a component: <pre> array( 'class' => 'MyPagination', 'pageSize' => 20, ), </pre>
public CSort|false
# getSort( string $className = 'CSort' )

Returns the sort object.

Returns the sort object.

Parameters

$className
string
$className the sorting object class name. Parameter is available since version 1.1.13.

Returns

CSort|false
the sorting object. If this is false, it means the sorting is disabled.

Implementation of

IDataProvider::getSort()
public
# setSort( mixed $value )

Sets the sorting for this data provider.

Sets the sorting for this data provider.

Parameters

$value
mixed
$value the sorting to be used by this data provider. This could be a CSort object or an array used to configure the sorting object. If this is false, it means the sorting should be disabled. You can configure this property same way as a component: <pre> array( 'class' => 'MySort', 'attributes' => array('name', 'weight'), ), </pre>
public array
# getData( boolean $refresh = false )

Returns the data items currently available.

Returns the data items currently available.

Parameters

$refresh
boolean
$refresh whether the data should be re-fetched from persistent storage.

Returns

array
the list of data items currently available in this data provider.

Implementation of

IDataProvider::getData()
public
# setData( array $value )

Sets the data items for this provider.

Sets the data items for this provider.

Parameters

$value
array
$value put the data items into this provider.
public array
# getKeys( boolean $refresh = false )

Returns the key values associated with the data items.

Returns the key values associated with the data items.

Parameters

$refresh
boolean
$refresh whether the keys should be re-calculated.

Returns

array
the list of key values corresponding to data. Each data item in data is uniquely identified by the corresponding key value in this array.

Implementation of

IDataProvider::getKeys()
public
# setKeys( array $value )

Sets the data item keys for this provider.

Sets the data item keys for this provider.

Parameters

$value
array
$value put the data item keys into this provider.
public integer
# getItemCount( boolean $refresh = false )

Returns the number of data items in the current page. This is equivalent to <span class="php-keyword2">count</span>(<span class="php-var">$provider</span>->getData()). When pagination is set false, this returns the same value as totalItemCount.

Returns the number of data items in the current page. This is equivalent to <span class="php-keyword2">count</span>(<span class="php-var">$provider</span>->getData()). When pagination is set false, this returns the same value as totalItemCount.

Parameters

$refresh
boolean
$refresh whether the number of data items should be re-calculated.

Returns

integer
the number of data items in the current page.

Implementation of

IDataProvider::getItemCount()
public integer
# getTotalItemCount( boolean $refresh = false )

Returns the total number of data items. When pagination is set false, this returns the same value as itemCount.

Returns the total number of data items. When pagination is set false, this returns the same value as itemCount.

Parameters

$refresh
boolean
$refresh whether the total number of data items should be re-calculated.

Returns

integer
total number of possible data items.

Implementation of

IDataProvider::getTotalItemCount()
public
# setTotalItemCount( integer $value )

Sets the total number of data items. This method is provided in case when the total number cannot be determined by CDataProvider::calculateTotalItemCount().

Sets the total number of data items. This method is provided in case when the total number cannot be determined by CDataProvider::calculateTotalItemCount().

Parameters

$value
integer
$value the total number of data items.

Since

1.1.1
Methods inherited from CComponent
__call(), __get(), __isset(), __set(), __unset(), asa(), attachBehavior(), attachBehaviors(), attachEventHandler(), canGetProperty(), canSetProperty(), detachBehavior(), detachBehaviors(), detachEventHandler(), disableBehavior(), disableBehaviors(), enableBehavior(), enableBehaviors(), evaluateExpression(), getEventHandlers(), hasEvent(), hasEventHandler(), hasProperty(), raiseEvent()
Magic properties summary
public string $id
#

The unique ID that uniquely identifies the data provider among all data providers.

The unique ID that uniquely identifies the data provider among all data providers.

public CPagination $pagination
#

The pagination object. If this is false, it means the pagination is disabled.

The pagination object. If this is false, it means the pagination is disabled.

public CSort $sort
#

The sorting object. If this is false, it means the sorting is disabled.

The sorting object. If this is false, it means the sorting is disabled.

public array $data
#

The list of data items currently available in this data provider.

The list of data items currently available in this data provider.

public array $keys
#

The list of key values corresponding to data. Each data item in data is uniquely identified by the corresponding key value in this array.

The list of key values corresponding to data. Each data item in data is uniquely identified by the corresponding key value in this array.

public integer $itemCount
#

The number of data items in the current page.

The number of data items in the current page.

public integer $totalItemCount
#

Total number of possible data items.

Total number of possible data items.

API documentation generated by ApiGen 2.8.0