$vizClass) { if (false === strpos($vizClass, 'Piwik\\Plugins\\CoreVisualizations') && false === strpos($vizClass, 'Piwik\\Plugins\\Goals\\Visualizations\\Goals')) { $result[$vizId] = $vizClass; } } return $result; } /** * This method determines the default set of footer icons to display below a report. * * $result has the following format: * * ``` * array( * array( // footer icon group 1 * 'class' => 'footerIconGroup1CssClass', * 'buttons' => array( * 'id' => 'myid', * 'title' => 'My Tooltip', * 'icon' => 'path/to/my/icon.png' * ) * ), * array( // footer icon group 2 * 'class' => 'footerIconGroup2CssClass', * 'buttons' => array(...) * ), * ... * ) * ``` */ public static function configureFooterIcons(ViewDataTable $view) { $result = array(); // add normal view icons (eg, normal table, all columns, goals) $normalViewIcons = array( 'class' => 'tableAllColumnsSwitch', 'buttons' => array(), ); if ($view->config->show_table) { $normalViewIcons['buttons'][] = static::getFooterIconFor(HtmlTable::ID); } if ($view->config->show_table_all_columns) { $normalViewIcons['buttons'][] = static::getFooterIconFor(HtmlTable\AllColumns::ID); } if ($view->config->show_goals) { $goalButton = static::getFooterIconFor(Goals::ID); if (Common::getRequestVar('idGoal', false) == 'ecommerceOrder') { $goalButton['icon'] = 'plugins/Zeitgeist/images/ecommerceOrder.gif'; } $normalViewIcons['buttons'][] = $goalButton; } if ($view->config->show_ecommerce) { $normalViewIcons['buttons'][] = array( 'id' => 'ecommerceOrder', 'title' => Piwik::translate('General_EcommerceOrders'), 'icon' => 'plugins/Zeitgeist/images/ecommerceOrder.gif', 'text' => Piwik::translate('General_EcommerceOrders') ); $normalViewIcons['buttons'][] = array( 'id' => 'ecommerceAbandonedCart', 'title' => Piwik::translate('General_AbandonedCarts'), 'icon' => 'plugins/Zeitgeist/images/ecommerceAbandonedCart.gif', 'text' => Piwik::translate('General_AbandonedCarts') ); } $normalViewIcons['buttons'] = array_filter($normalViewIcons['buttons']); if (!empty($normalViewIcons['buttons'])) { $result[] = $normalViewIcons; } // add insight views $insightsViewIcons = array( 'class' => 'tableInsightViews', 'buttons' => array(), ); // add graph views $graphViewIcons = array( 'class' => 'tableGraphViews tableGraphCollapsed', 'buttons' => array(), ); if ($view->config->show_all_views_icons) { if ($view->config->show_bar_chart) { $graphViewIcons['buttons'][] = static::getFooterIconFor(Bar::ID); } if ($view->config->show_pie_chart) { $graphViewIcons['buttons'][] = static::getFooterIconFor(Pie::ID); } if ($view->config->show_tag_cloud) { $graphViewIcons['buttons'][] = static::getFooterIconFor(Cloud::ID); } } $nonCoreVisualizations = static::getNonCoreViewDataTables(); foreach ($nonCoreVisualizations as $id => $klass) { if ($klass::canDisplayViewDataTable($view)) { $footerIcon = static::getFooterIconFor($id); if (Insight::ID == $footerIcon['id']) { $insightsViewIcons['buttons'][] = static::getFooterIconFor($id); } else { $graphViewIcons['buttons'][] = static::getFooterIconFor($id); } } } $graphViewIcons['buttons'] = array_filter($graphViewIcons['buttons']); if (!empty($insightsViewIcons['buttons'])) { $result[] = $insightsViewIcons; } if (!empty($graphViewIcons['buttons'])) { $result[] = $graphViewIcons; } return $result; } /** * Returns an array with information necessary for adding the viewDataTable to the footer. * * @param string $viewDataTableId * * @return array */ private static function getFooterIconFor($viewDataTableId) { $tables = static::getAvailableViewDataTables(); if (!array_key_exists($viewDataTableId, $tables)) { return; } $klass = $tables[$viewDataTableId]; return array( 'id' => $klass::getViewDataTableId(), 'title' => Piwik::translate($klass::FOOTER_ICON_TITLE), 'icon' => $klass::FOOTER_ICON, ); } }