Hello world!
";
echo "Happy coding with Piwik :)
Hello world!
You can output whatever you want in widgets, and put them on dashboard or everywhere on the web (in your blog, website, etc.).
Widgets can include graphs, tables, flash, text, images, etc.
It's very easy to create a new plugin and widgets in Piwik. Have a look at this example file (/plugins/ExamplePlugin/ExamplePlugin.php).
";
}
public function photostreamMatt()
{
echo '';
}
/**
* this widgets shows how to make a remote API request to piwik.org
* you find the main JS code in templates/piwikDownloads.twig
*/
public function piwikDownloads()
{
$view = new View('@ExamplePlugin/piwikDownloads');
$this->setGeneralVariablesView($view);
echo $view->render();
}
/**
* This method displays a text containing an help about "How to build plugins for Piwik".
* This help is then used on http://piwik.org/docs/plugins/functions
*
*/
public function index()
{
$out = '';
$out .= 'This page aims to list the different functions you can use when programming plugins for Piwik.
';
$out .= 'Be careful, the following APIs may change in the near future as Piwik is still in development.
';
$out .= '
$this->date
= current selected Date object (class)$period = Common::getRequestVar("period");
- Get the current selected period$idSite = Common::getRequestVar("idSite");
- Get the selected idSite$site = new Site($idSite);
- Build the Site object (class)$this->str_date
= current selected date in YYYY-MM-DD formatPiwik_AddMenu( $mainMenuName, $subMenuName, $url );
- Adds an entry to the menu in the Piwik interface (See the example in the UserCountry Plugin file)WidgetsList::add( $widgetCategory, $widgetName, $controllerName, $controllerAction, $customParameters = array());
- Adds a widget that users can add in the dashboard, or export using the Widgets link at the top of the screen. See the example in the UserCountry Plugin file or any other plugin)Common::prefixTable("site")
= ' . Common::prefixTable("site") . 'Piwik::getCurrentUserLogin()
= ' . Piwik::getCurrentUserLogin() . 'Piwik::isUserHasSomeAdminAccess()
= ' . self::boolToString(Piwik::isUserHasSomeAdminAccess()) . 'Piwik::isUserHasAdminAccess( array $idSites = array(1,2) )
= ' . self::boolToString(Piwik::isUserHasAdminAccess(array(1, 2))) . 'Piwik::isUserHasViewAccess( array $idSites = array(1) )
= ' . self::boolToString(Piwik::isUserHasViewAccess(array(1))) . 'Piwik::isUserIsSuperUser()
= ' . self::boolToString(Piwik::isUserIsSuperUser()) . 'Db::fetchOne("' . $txtQuery . '", array("anonymous"))
= ' . var_export($result, true) . '$query = Db::query("' . $txtQuery . '", array("anonymous"))
$fetched = $query->fetch();
$fetched[\'token_auth\'] == ' . var_export($token_auth, true) . '
API::getInstance()->getSitesWithViewAccess()
= ' . var_export(API::getInstance()->getSitesWithViewAccess(), true) . '
API::getInstance()->getSitesWithAdminAccess()
= ' . var_export(API::getInstance()->getSitesWithAdminAccess(), true) . '
API::getInstance()->getUsersSitesFromAccess("view");
or API::getInstance()->deleteUser("userToDelete");
$(this).parents(\'[widgetId]\').dashboardWidget(\'reload\');
.';
$out .= '