function index() { $view = Piwik_View::factory('index'); $view->availableWidgets = json_encode(Piwik_GetWidgetsList()); $this->setGeneralVariablesView($view); echo $view->render(); }
function index() { $view = new Piwik_View('Widgetize/templates/index.tpl'); $view->availableWidgets = json_encode(Piwik_GetWidgetsList()); $this->setGeneralVariablesView($view); echo $view->render(); }
protected function getDashboardView($template) { $view = new Piwik_View($template); $this->setGeneralVariablesView($view); $layout = html_entity_decode($this->getLayout()); if (!empty($layout) && strstr($layout, '[[') == false) { $layout = "'{$layout}'"; } $view->layout = $layout; $view->availableWidgets = json_encode(Piwik_GetWidgetsList()); return $view; }
protected function getDashboardView($template) { $view = Piwik_View::factory($template); $this->setGeneralVariablesView($view); $view->availableWidgets = json_encode(Piwik_GetWidgetsList()); $layout = $this->getLayout(); if (empty($layout)) { $layout = $this->getDefaultLayout(); } $view->layout = $layout; return $view; }
static function getWidgetsForFlexForm(&$PA, &$fobj) { $PA['items'] = array(); tx_piwikintegration_install::getInstaller()->getConfigObject()->initPiwikDatabase(); $controller = Piwik_FrontController::getInstance()->init(); $_GET['idSite'] = 1; $widgets = Piwik_GetWidgetsList(); foreach ($widgets as $pluginCat => $plugin) { foreach ($plugin as $widget) { $PA['items'][] = array($pluginCat . ' : ' . $widget['name'], base64_encode(json_encode($widget['parameters'])), 'i/catalog.gif'); } } }
protected function getDashboardView($template) { $view = Piwik_View::factory($template); $this->setGeneralVariablesView($view); // layout was JSON.stringified $layout = html_entity_decode($this->getLayout()); $layout = str_replace("\\\"", "\"", $layout); if (!empty($layout) && strstr($layout, '[[') == false) { $layout = "'{$layout}'"; } $view->layout = $layout; $view->availableWidgets = json_encode(Piwik_GetWidgetsList()); return $view; }
<div id="widgetIframe"><iframe width="500" height="350" src="<?php echo $url; ?>" scrolling="no" frameborder="0" marginheight="0" marginwidth="0"></iframe></div> <br/> <?php $_GET['idSite'] = $idSite; define('PIWIK_INCLUDE_PATH', '..'); define('PIWIK_ENABLE_DISPATCH', false); define('PIWIK_ENABLE_ERROR_HANDLER', false); define('PIWIK_ENABLE_SESSION_START', false); require_once PIWIK_INCLUDE_PATH . "/index.php"; require_once PIWIK_INCLUDE_PATH . "/core/API/Request.php"; Piwik_FrontController::getInstance()->init(); $widgets = Piwik_GetWidgetsList(); foreach($widgets as $category => $widgetsInCategory) { echo '<h2>'.$category . '</h2>'; foreach($widgetsInCategory as $widget) { echo '<h3>'.$widget['name'].'</h3>'; $widgetUrl = Piwik_Common::getArrayFromQueryString($url); $widgetUrl['moduleToWidgetize'] = $widget['parameters']['module']; $widgetUrl['actionToWidgetize'] = $widget['parameters']['action']; $parameters = $widget['parameters']; unset($parameters['module']); unset($parameters['action']); foreach($parameters as $name => $value) { if(is_array($value))
public function getAvailableWidgets() { $this->checkTokenInUrl(); echo Piwik_Common::json_encode(Piwik_GetWidgetsList()); }
/** * Returns a list of all available widgets. */ protected function findAllWidgets() { $widgetList = Piwik_GetWidgetsList(); $actions = array(); $customParams = array(); foreach ($widgetList as $widgetCategory => $widgets) { foreach ($widgets as $widgetInfo) { $module = $widgetInfo['parameters']['module']; $moduleAction = $widgetInfo['parameters']['action']; $wholeAction = "{$module}.{$moduleAction}"; // FIXME: can't test Referers.getKeywordsForPage since it tries to make a request to // localhost w/ the wrong url. Piwik_Url::getCurrentUrlWithoutFileName // returns /tests/integration/?... when used within a test. if ($wholeAction == "Referers.getKeywordsForPage") { continue; } // rss widgets depends on feedburner URL. don't test the widget just in case // feedburner is down. if ($module == "ExampleRssWidget" || $module == "ExampleFeedburner") { continue; } unset($widgetInfo['parameters']['module']); unset($widgetInfo['parameters']['action']); $actions[] = $wholeAction; $customParams[$wholeAction] = $widgetInfo['parameters']; } } return array($actions, $customParams); }