本文整理汇总了PHP中Piwik_DataTable::getRowsCountBeforeLimitFilter方法的典型用法代码示例。如果您正苦于以下问题:PHP Piwik_DataTable::getRowsCountBeforeLimitFilter方法的具体用法?PHP Piwik_DataTable::getRowsCountBeforeLimitFilter怎么用?PHP Piwik_DataTable::getRowsCountBeforeLimitFilter使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Piwik_DataTable
的用法示例。
在下文中一共展示了Piwik_DataTable::getRowsCountBeforeLimitFilter方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getJavascriptVariablesToSet
/**
* This functions reads the customization values for the DataTable and returns an array (name,value) to be printed in Javascript.
* This array defines things such as:
* - name of the module & action to call to request data for this table
* - optional filters information, eg. filter_limit and filter_offset
* - etc.
*
* The values are loaded:
* - from the generic filters that are applied by default @see Piwik_API_DataTableGenericFilter.php::getGenericFiltersInformation()
* - from the values already available in the GET array
* - from the values set using methods from this class (eg. setSearchPattern(), setLimit(), etc.)
*
* @return array eg. array('show_offset_information' => 0, 'show_...
*/
protected function getJavascriptVariablesToSet()
{
// build javascript variables to set
$javascriptVariablesToSet = array();
$genericFilters = Piwik_API_DataTableGenericFilter::getGenericFiltersInformation();
foreach ($genericFilters as $filter) {
foreach ($filter as $filterVariableName => $filterInfo) {
// if there is a default value for this filter variable we set it
// so that it is propagated to the javascript
if (isset($filterInfo[1])) {
$javascriptVariablesToSet[$filterVariableName] = $filterInfo[1];
// we set the default specified column and Order to sort by
// when this javascript variable is not set already
// for example during an AJAX call this variable will be set in the URL
// so this will not be executed (and the default sorted not be used as the sorted column might have changed in the meanwhile)
if (false !== ($defaultValue = $this->getDefault($filterVariableName))) {
$javascriptVariablesToSet[$filterVariableName] = $defaultValue;
}
}
}
}
foreach ($_GET as $name => $value) {
try {
$requestValue = Piwik_Common::getRequestVar($name);
} catch (Exception $e) {
$requestValue = '';
}
$javascriptVariablesToSet[$name] = $requestValue;
}
// at this point there are some filters values we may have not set,
// case of the filter without default values and parameters set directly in this class
// for example setExcludeLowPopulation
// we go through all the $this->variablesDefault array and set the variables not set yet
foreach ($this->variablesDefault as $name => $value) {
if (!isset($javascriptVariablesToSet[$name])) {
$javascriptVariablesToSet[$name] = $value;
}
}
if ($this->dataTable instanceof Piwik_DataTable) {
// we override the filter_sort_column with the column used for sorting,
// which can be different from the one specified (eg. if the column doesn't exist)
$javascriptVariablesToSet['filter_sort_column'] = $this->dataTable->getSortedByColumnName();
// datatable can return "2" but we want to write "nb_visits" in the js
if (isset(Piwik_Archive::$mappingFromIdToName[$javascriptVariablesToSet['filter_sort_column']])) {
$javascriptVariablesToSet['filter_sort_column'] = Piwik_Archive::$mappingFromIdToName[$javascriptVariablesToSet['filter_sort_column']];
}
}
$javascriptVariablesToSet['module'] = $this->currentControllerName;
$javascriptVariablesToSet['action'] = $this->currentControllerAction;
$javascriptVariablesToSet['viewDataTable'] = $this->getViewDataTableId();
$javascriptVariablesToSet['controllerActionCalledWhenRequestSubTable'] = $this->controllerActionCalledWhenRequestSubTable;
if ($this->dataTable) {
$javascriptVariablesToSet['totalRows'] = $this->dataTable->getRowsCountBeforeLimitFilter();
}
// we escape the values that will be displayed in the javascript footer of each datatable
// to make sure there is malicious code injected (the value are already htmlspecialchar'ed as they
// are loaded with Piwik_Common::getRequestVar()
foreach ($javascriptVariablesToSet as &$value) {
if (is_array($value)) {
$value = array_map('addslashes', $value);
} else {
$value = addslashes($value);
}
}
$deleteFromJavascriptVariables = array('filter_excludelowpop', 'filter_excludelowpop_value');
foreach ($deleteFromJavascriptVariables as $name) {
if (isset($javascriptVariablesToSet[$name])) {
unset($javascriptVariablesToSet[$name]);
}
}
return $javascriptVariablesToSet;
}
示例2: getJavascriptVariablesToSet
/**
* This functions reads the customization values for the DataTable and returns an array (name,value) to be printed in Javascript.
* This array defines things such as:
* - name of the module & action to call to request data for this table
* - display the search box under the table
* - display the links Next & Previous under the table
* - optional filters information, eg. filter_limit and filter_offset
* - etc.
*
* The values are loaded:
* - from the generic filters that are applied by default @see Piwik_API_Request::getGenericFiltersInformation()
* - from the values already available in the GET array
* - from the values set using methods from this class (eg. setSearchPattern(), setLimit(), etc.)
*
* @return array eg. array('show_offset_information' => 0, 'show_
*/
protected function getJavascriptVariablesToSet()
{
// build javascript variables to set
$javascriptVariablesToSet = array();
$genericFilters = Piwik_API_Request::getGenericFiltersInformation();
foreach ($genericFilters as $filter) {
foreach ($filter as $filterVariableName => $filterInfo) {
// if there is a default value for this filter variable we set it
// so that it is propagated to the javascript
if (isset($filterInfo[1])) {
$javascriptVariablesToSet[$filterVariableName] = $filterInfo[1];
// we set the default specified column and Order to sort by
// when this javascript variable is not set already
// for example during an AJAX call this variable will be set in the URL
// so this will not be executed (and the default sorted not be used as the sorted column might have changed in the meanwhile)
if (false !== ($defaultValue = $this->getDefault($filterVariableName))) {
$javascriptVariablesToSet[$filterVariableName] = $defaultValue;
}
}
}
}
// var_dump($javascriptVariablesToSet);exit;
// See
foreach ($_GET as $name => $value) {
try {
$requestValue = Piwik_Common::getRequestVar($name);
} catch (Exception $e) {
$requestValue = '';
}
$javascriptVariablesToSet[$name] = $requestValue;
}
// at this point there are some filters values we may have not set,
// case of the filter without default values and parameters set directly in this class
// for example setExcludeLowPopulation
// we go through all the $this->variablesDefault array and set the variables not set yet
foreach ($this->variablesDefault as $name => $value) {
if (!isset($javascriptVariablesToSet[$name])) {
$javascriptVariablesToSet[$name] = $value;
}
}
$javascriptVariablesToSet['module'] = $this->currentControllerName;
$javascriptVariablesToSet['action'] = $this->currentControllerAction;
if (!is_null($this->actionToLoadTheSubTable)) {
$javascriptVariablesToSet['actionToLoadTheSubTable'] = $this->actionToLoadTheSubTable;
}
// var_dump($this->variablesDefault);
// var_dump($javascriptVariablesToSet); exit;
if ($this->dataTable) {
$javascriptVariablesToSet['totalRows'] = $this->dataTable->getRowsCountBeforeLimitFilter();
}
$javascriptVariablesToSet['show_search'] = $this->getSearchBox();
$javascriptVariablesToSet['show_offset_information'] = $this->getOffsetInformation();
$javascriptVariablesToSet['show_exclude_low_population'] = $this->getExcludeLowPopulation();
// we escape the values that will be displayed in the javascript footer of each datatable
// to make sure there is malicious code injected (the value are already htmlspecialchar'ed as they
// are loaded with Piwik_Common::getRequestVar()
foreach ($javascriptVariablesToSet as &$value) {
$value = addslashes($value);
}
return $javascriptVariablesToSet;
}