Questtype ?Textinput?: add support for field sizes (Issue #252) and general improvements

This commit is contained in:
coderkun 2014-05-19 11:36:36 +02:00
commit 8d903135a5
3476 changed files with 599099 additions and 0 deletions

View file

@ -0,0 +1,66 @@
<?php
/**
* Piwik - Open source web analytics
*
* @link http://piwik.org
* @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later
*
*/
namespace Piwik\Plugins\CoreVisualizations\Visualizations\HtmlTable;
use Piwik\Plugins\CoreVisualizations\Visualizations\HtmlTable;
use Piwik\View;
/**
* DataTable Visualization that derives from HtmlTable and sets show_extra_columns to true.
*/
class AllColumns extends HtmlTable
{
const ID = 'tableAllColumns';
const FOOTER_ICON = 'plugins/Zeitgeist/images/table_more.png';
const FOOTER_ICON_TITLE = 'General_DisplayTableWithMoreMetrics';
public function beforeRender()
{
$this->config->show_extra_columns = true;
$this->config->datatable_css_class = 'dataTableVizAllColumns';
$this->config->show_exclude_low_population = true;
parent::beforeRender();
}
public function beforeGenericFiltersAreAppliedToLoadedDataTable()
{
$this->dataTable->filter('AddColumnsProcessedMetrics');
$properties = $this->config;
$this->dataTable->filter(function ($dataTable) use ($properties) {
$columnsToDisplay = array('label', 'nb_visits');
if (in_array('nb_uniq_visitors', $dataTable->getColumns())) {
$columnsToDisplay[] = 'nb_uniq_visitors';
}
$columnsToDisplay = array_merge(
$columnsToDisplay, array('nb_actions', 'nb_actions_per_visit', 'avg_time_on_site', 'bounce_rate')
);
// only display conversion rate for the plugins that do not provide "per goal" metrics
// otherwise, conversion rate is meaningless as a whole (since we don't process 'cross goals' conversions)
if (!$properties->show_goals) {
$columnsToDisplay[] = 'conversion_rate';
}
$properties->columns_to_display = $columnsToDisplay;
});
}
public function afterGenericFiltersAreAppliedToLoadedDataTable()
{
$prettifyTime = array('\Piwik\MetricsFormatter', 'getPrettyTimeFromSeconds');
$this->dataTable->filter('ColumnCallbackReplace', array('avg_time_on_site', $prettifyTime));
}
}

View file

@ -0,0 +1,119 @@
<?php
/**
* Piwik - Open source web analytics
*
* @link http://piwik.org
* @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later
*
*/
namespace Piwik\Plugins\CoreVisualizations\Visualizations\HtmlTable;
use Piwik\ViewDataTable\Config as VisualizationConfig;
/**
* DataTable Visualization that derives from HtmlTable and sets show_extra_columns to true.
*/
class Config extends VisualizationConfig
{
/**
* If this property is set to true, subtables will be shown as embedded in the original table.
* If false, subtables will be shown as whole tables between rows.
*
* Default value: false
*/
public $show_embedded_subtable = false;
/**
* Controls whether the entire DataTable should be rendered (including subtables) or just one
* specific table in the tree.
*
* Default value: false
*/
public $show_expanded = false;
/**
* When showing an expanded datatable, this property controls whether rows with subtables are
* replaced with their subtables, or if they are shown alongside their subtables.
*
* Default value: false
*/
public $replace_row_with_subtable = false;
/**
* Controls whether any DataTable Row Action icons are shown. If true, no icons are shown.
*
* Default value: false
*/
public $disable_row_actions = false;
/**
* Controls whether the row evolution DataTable Row Action icon is shown or not.
*
* Default value: false
*/
public $disable_row_evolution = false;
/**
* If true, the 'label', 'nb_visits', 'nb_uniq_visitors' (if present), 'nb_actions',
* 'nb_actions_per_visit', 'avg_time_on_site', 'bounce_rate' and 'conversion_rate' (if
* goals view is not allowed) are displayed.
*
* Default value: false
*/
public $show_extra_columns = false;
/**
* If true, conversions for each existing goal will be displayed for the visits in
* each row.
*
* Default value: false
*/
public $show_goals_columns = false;
/**
* If true, subtables will not be loaded when rows are clicked, but only if the
* 'show_goals_columns' property is also true.
*
* Default value: false
*/
public $disable_subtable_when_show_goals = false;
/**
* If true, the summary row will be colored differently than all other DataTable rows.
*
* Default value: false
*/
public $highlight_summary_row = false;
public function __construct()
{
parent::__construct();
$this->enable_sort = true;
$this->datatable_js_type = 'DataTable';
$this->addPropertiesThatShouldBeAvailableClientSide(array(
'show_extra_columns',
'show_goals_columns',
'disable_row_evolution',
'disable_row_actions',
'enable_sort',
'keep_summary_row',
'subtable_controller_action',
));
$this->addPropertiesThatCanBeOverwrittenByQueryParams(array(
'show_expanded',
'disable_row_actions',
'disable_row_evolution',
'show_extra_columns',
'show_goals_columns',
'disable_subtable_when_show_goals',
'keep_summary_row',
'highlight_summary_row',
));
}
}

View file

@ -0,0 +1,54 @@
<?php
/**
* Piwik - Open source web analytics
*
* @link http://piwik.org
* @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later
*
*/
namespace Piwik\Plugins\CoreVisualizations\Visualizations\HtmlTable;
use Piwik\Common;
use Piwik\Config as PiwikConfig;
use Piwik\ViewDataTable\RequestConfig as VisualizationRequestConfig;
/**
* DataTable Visualization that derives from HtmlTable and sets show_extra_columns to true.
*/
class RequestConfig extends VisualizationRequestConfig
{
/**
* Controls whether the summary row is displayed on every page of the datatable view or not.
* If false, the summary row will be treated as the last row of the dataset and will only visible
* when viewing the last rows.
*
* Default value: false
*/
public $keep_summary_row = false;
public function __construct()
{
$this->filter_limit = PiwikConfig::getInstance()->General['datatable_default_limit'];
if (Common::getRequestVar('enable_filter_excludelowpop', false) == '1') {
$this->filter_excludelowpop = 'nb_visits';
$this->filter_excludelowpop_value = false;
}
$this->addPropertiesThatShouldBeAvailableClientSide(array(
'search_recursive',
'filter_limit',
'filter_offset',
'filter_sort_column',
'filter_sort_order',
'keep_summary_row'
));
$this->addPropertiesThatCanBeOverwrittenByQueryParams(array(
'keep_summary_row',
));
}
}