本文整理汇总了PHP中Piwik\Plugin\Report::factory方法的典型用法代码示例。如果您正苦于以下问题:PHP Report::factory方法的具体用法?PHP Report::factory怎么用?PHP Report::factory使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Piwik\Plugin\Report
的用法示例。
在下文中一共展示了Report::factory方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: __construct
/**
* Constructor.
*/
public function __construct($apiModule, $apiMethod, $request)
{
$this->apiModule = $apiModule;
$this->apiMethod = $apiMethod;
$this->setRequest($request);
$this->report = Report::factory($apiModule, $apiMethod);
$this->apiInconsistencies = new Inconsistencies();
$this->setFormatter(new Formatter());
}
示例2: renderReportWidget
public function renderReportWidget($reportModule = null, $reportAction = null)
{
Piwik::checkUserHasSomeViewAccess();
$this->checkSitePermission();
$report = Report::factory($reportModule, $reportAction);
if (empty($report)) {
throw new Exception(Piwik::translate('General_ExceptionReportNotFound'));
}
$report->checkIsEnabled();
return $report->render();
}
示例3: get
public function get($idSite, $period, $date, $segment = false, $columns = false)
{
Piwik::checkUserHasViewAccess($idSite);
$archive = Archive::build($idSite, $period, $date, $segment);
$requestedColumns = Piwik::getArrayFromApiParameter($columns);
$report = Report::factory("VisitsSummary", "get");
$columns = $report->getMetricsRequiredForReport($this->getCoreColumns($period), $requestedColumns);
$dataTable = $archive->getDataTableFromNumeric($columns);
if (!empty($requestedColumns)) {
$columnsToShow = $requestedColumns ?: $report->getAllMetrics();
$dataTable->queueFilter('ColumnDelete', array($columnsToRemove = array(), $columnsToShow));
}
return $dataTable;
}
示例4: software
public function software()
{
$view = new View('@DevicesDetection/software');
$view->osReport = $this->renderReport('getOsVersions');
$view->browserReport = $this->renderReport('getBrowsers');
$view->browserEngineReport = $this->renderReport('getBrowserEngines');
$isResolutionEnabled = PluginManager::getInstance()->isPluginActivated('Resolution');
if ($isResolutionEnabled) {
$view->configurations = $this->renderReport(Report::factory('Resolution', 'getConfiguration'));
}
$isDevicePluginsEnabled = PluginManager::getInstance()->isPluginActivated('DevicePlugins');
if ($isDevicePluginsEnabled) {
$view->browserPlugins = $this->renderReport(Report::factory('DevicePlugins', 'getPlugin'));
}
return $view->render();
}
示例5: indexSiteSearch
public function indexSiteSearch()
{
$view = new View('@Actions/indexSiteSearch');
$keyword = Report::factory($this->pluginName, 'getSiteSearchKeywords');
$noResult = Report::factory($this->pluginName, 'getSiteSearchNoResultKeywords');
$pageUrls = Report::factory($this->pluginName, 'getPageUrlsFollowingSiteSearch');
$view->keywords = $keyword->render();
$view->noResultKeywords = $noResult->render();
$view->pagesUrlsFollowingSiteSearch = $pageUrls->render();
$categoryTrackingEnabled = Actions::isCustomVariablesPluginsEnabled();
if ($categoryTrackingEnabled) {
$categories = Report::factory($this->pluginName, 'getSiteSearchCategories');
$view->categories = $categories->render();
}
return $view->render();
}
示例6: __construct
public final function __construct($controllerAction, $apiMethodToRequestDataTable, $params = array())
{
$templateFile = static::TEMPLATE_FILE;
if (empty($templateFile)) {
throw new \Exception('You have not defined a constant named TEMPLATE_FILE in your visualization class.');
}
$this->metricsFormatter = new HtmlFormatter();
parent::__construct($controllerAction, $apiMethodToRequestDataTable, $params);
$this->report = Report::factory($this->requestConfig->getApiModuleToRequest(), $this->requestConfig->getApiMethodToRequest());
}
示例7: test_factory_shouldNotFindAReport_IfPluginIsLoadedButNotActivated
public function test_factory_shouldNotFindAReport_IfPluginIsLoadedButNotActivated()
{
PluginManager::getInstance()->loadPlugin('ExampleReport');
$module = 'ExampleReport';
$action = 'getExampleReport';
$report = Report::factory($module, $action);
$this->assertNull($report);
}
示例8: getReport
/**
* Return the report object for the given apiAction
* @param $apiAction
* @return null|Report
*/
private static function getReport($apiAction)
{
list($module, $action) = explode('.', $apiAction);
$report = Report::factory($module, $action);
return $report;
}
示例9: makeController
protected function makeController($module, $action, &$parameters)
{
$controllerClassName = $this->getClassNameController($module);
// TRY TO FIND ACTION IN CONTROLLER
if (class_exists($controllerClassName)) {
$class = $this->getClassNameController($module);
/** @var $controller Controller */
$controller = new $class();
$controllerAction = $action;
if ($controllerAction === false) {
$controllerAction = $controller->getDefaultAction();
}
if (is_callable(array($controller, $controllerAction))) {
return array($controller, $controllerAction);
}
if ($action === false) {
$this->triggerControllerActionNotFoundError($module, $controllerAction);
}
}
// TRY TO FIND ACTION IN WIDGET
$widget = Widgets::factory($module, $action);
if (!empty($widget)) {
$parameters['widgetModule'] = $module;
$parameters['widgetMethod'] = $action;
return array(new CoreHomeController(), 'renderWidget');
}
// TRY TO FIND ACTION IN REPORT
$report = Report::factory($module, $action);
if (!empty($report)) {
$parameters['reportModule'] = $module;
$parameters['reportAction'] = $action;
return array(new CoreHomeController(), 'renderReportWidget');
}
if (!empty($action) && 'menu' === substr($action, 0, 4)) {
$reportAction = lcfirst(substr($action, 4));
// menuGetPageUrls => getPageUrls
$report = Report::factory($module, $reportAction);
if (!empty($report)) {
$parameters['reportModule'] = $module;
$parameters['reportAction'] = $reportAction;
return array(new CoreHomeController(), 'renderReportMenu');
}
}
$this->triggerControllerActionNotFoundError($module, $action);
}
示例10: configureViewDataTable
public function configureViewDataTable(ViewDataTable $view)
{
if ($view->requestConfig->getApiModuleToRequest() != 'Events') {
return;
}
// eg. 'Events.getCategory'
$apiMethod = $view->requestConfig->getApiMethodToRequest();
$secondaryDimension = $this->getSecondaryDimensionFromRequest();
$view->config->subtable_controller_action = API::getInstance()->getActionToLoadSubtables($apiMethod, $secondaryDimension);
if (Common::getRequestVar('pivotBy', false) === false) {
$view->config->columns_to_display = array('label', 'nb_events', 'sum_event_value');
}
$view->config->show_flatten_table = true;
$view->config->show_table_all_columns = false;
$view->requestConfig->filter_sort_column = 'nb_events';
$labelTranslation = $this->getColumnTranslation($apiMethod);
$view->config->addTranslation('label', $labelTranslation);
$view->config->addTranslations($this->getMetricTranslations());
$this->addRelatedReports($view, $secondaryDimension);
$this->addTooltipEventValue($view);
$subtableReport = Report::factory('Events', $view->config->subtable_controller_action);
$view->config->pivot_by_dimension = $subtableReport->getDimension()->getId();
$view->config->pivot_by_column = 'nb_events';
}
示例11: checkisValidCallable
private function checkisValidCallable($module, $action)
{
if (!Development::isEnabled()) {
return;
}
$prefix = 'Menu item added in ' . get_class($this) . ' will fail when being selected. ';
if (!is_string($action)) {
Development::error($prefix . 'No valid action is specified. Make sure the defined action that should be executed is a string.');
}
$reportAction = lcfirst(substr($action, 4));
if (Report::factory($module, $reportAction)) {
return;
}
$controllerClass = '\\Piwik\\Plugins\\' . $module . '\\Controller';
if (!Development::methodExists($controllerClass, $action)) {
Development::error($prefix . 'The defined action "' . $action . '" does not exist in ' . $controllerClass . '". Make sure to define such a method.');
}
if (!Development::isCallableMethod($controllerClass, $action)) {
Development::error($prefix . 'The defined action "' . $action . '" is not callable on "' . $controllerClass . '". Make sure the method is public.');
}
}
示例12: test_getSubtableDimension_ShouldReturnCorrectDimensionIfSubtableActionIsDefinedAndCorrect
public function test_getSubtableDimension_ShouldReturnCorrectDimensionIfSubtableActionIsDefinedAndCorrect()
{
PluginManager::getInstance()->loadPlugins(array('Referrers'));
$report = Report::factory('Referrers', 'getSearchEngines');
$subtableDimension = $report->getSubtableDimension();
$this->assertNotNull($subtableDimension);
$this->assertInstanceOf("Piwik\\Plugins\\Referrers\\Columns\\Keyword", $subtableDimension);
}
示例13: findCurrentReport
private function findCurrentReport()
{
return Report::factory($this->apiModule, $this->apiMethod);
}
示例14: configureViewDataTable
public function configureViewDataTable(ViewDataTable $view)
{
if ($view->requestConfig->getApiModuleToRequest() != 'Events') {
return;
}
// eg. 'Events.getCategory'
$apiMethod = $view->requestConfig->getApiMethodToRequest();
$secondaryDimension = $this->getSecondaryDimensionFromRequest();
$view->config->subtable_controller_action = API::getInstance()->getActionToLoadSubtables($apiMethod, $secondaryDimension);
if (Common::getRequestVar('pivotBy', false) === false) {
$view->config->columns_to_display = array('label', 'nb_events', 'sum_event_value');
}
$view->config->show_flatten_table = true;
$view->requestConfig->filter_sort_column = 'nb_events';
if ($view->isViewDataTableId(AllColumns::ID)) {
$view->config->filters[] = function (DataTable $table) use($view) {
$columsToDisplay = array('label');
$columns = $table->getColumns();
if (in_array('nb_visits', $columns)) {
$columsToDisplay[] = 'nb_visits';
}
if (in_array('nb_uniq_visitors', $columns)) {
$columsToDisplay[] = 'nb_uniq_visitors';
}
$view->config->columns_to_display = array_merge($columsToDisplay, array('nb_events', 'sum_event_value', 'avg_event_value', 'min_event_value', 'max_event_value'));
if (!in_array($view->requestConfig->filter_sort_column, $view->config->columns_to_display)) {
$view->requestConfig->filter_sort_column = 'nb_events';
}
};
$view->config->show_pivot_by_subtable = false;
}
$labelTranslation = $this->getColumnTranslation($apiMethod);
$view->config->addTranslation('label', $labelTranslation);
$view->config->addTranslations($this->getMetricTranslations());
$this->addRelatedReports($view, $secondaryDimension);
$this->addTooltipEventValue($view);
$subtableReport = Report::factory('Events', $view->config->subtable_controller_action);
$view->config->pivot_by_dimension = $subtableReport->getDimension()->getId();
$view->config->pivot_by_column = 'nb_events';
}
示例15: menuGetContentPieces
public function menuGetContentPieces()
{
$report = Report::factory($this->pluginName, 'getContentPieces');
return View::singleReport($report->getName(), $report->render());
}