[Piwik-svn] r377 - trunk/plugins/ExamplePlugin

svnmaster at piwik.org svnmaster at piwik.org
Fri Mar 14 23:36:47 CET 2008


Author: matt
Date: 2008-03-14 23:36:46 +0100 (Fri, 14 Mar 2008)
New Revision: 377

Modified:
   trunk/plugins/ExamplePlugin/ExamplePlugin.php
Log:
- - Fix documentation


Modified: trunk/plugins/ExamplePlugin/ExamplePlugin.php
===================================================================
--- trunk/plugins/ExamplePlugin/ExamplePlugin.php	2008-03-14 21:55:04 UTC (rev 376)
+++ trunk/plugins/ExamplePlugin/ExamplePlugin.php	2008-03-14 22:36:46 UTC (rev 377)
@@ -37,15 +37,24 @@
 
 class Piwik_ExamplePlugin_Controller extends Piwik_Controller
 {	
+	/**
+	 * Go to /piwik/?module=ExamplePlugin&action=helloWorld to execute this method
+	 *
+	 */
+	function helloWorld()
+	{
+		echo "Hello world! <br />";
+		echo "Happy coding with Piwik :)";
+	}
+	
+	/**
+	 * This method displays a text containing an help about "How to build plugins for Piwik".
+	 * This help is then used on http://dev.piwik.org
+	 *
+	 */
 	function index()
 	{
 		$out = '';
-		// get the date
-		// get the period
-		// get the idSite
-		// execute SQL query FetchAll
-		// execute SQL query FetchOne
-
 		$out .= '<i>This page aims to list the different functions you can use when programming plugins for Piwik.</i><br>';
 		$out .= '<b>Be careful, the following APIs may change in the near future as Piwik is still in development.</b><br>';
 		
@@ -68,8 +77,8 @@
 		$out .= '<code>Piwik::getCurrentUserLogin()</code> = <b>' . Piwik::getCurrentUserLogin() . '</b><br/>';
 		$out .= '<code>Piwik::isUserHasSomeAdminAccess()</code> = <b>' . self::boolToString(Piwik::isUserHasSomeAdminAccess()) . '</b><br/>';
 		$out .= '<code>Piwik::isUserHasAdminAccess( array $idSites = array(1,2) )</code> = <b>' . self::boolToString(Piwik::isUserHasAdminAccess(array(1,2) )) . '</b><br/>';
-		$out .= '<code>Piwik::isUserHasViewAccess( array $idSites = array(1) ) </code> = <b>' . self::boolToString(Piwik::isUserHasSomeAdminAccess(array(1))) . '</b><br/>';
-		$out .= '<code>Piwik::isUserIsSuperUser()</code> = <b>' . self::boolToString(Piwik::isUserHasSomeAdminAccess()) . '</b><br/>';
+		$out .= '<code>Piwik::isUserHasViewAccess( array $idSites = array(1) ) </code> = <b>' . self::boolToString(Piwik::isUserHasViewAccess(array(1))) . '</b><br/>';
+		$out .= '<code>Piwik::isUserIsSuperUser()</code> = <b>' . self::boolToString(Piwik::isUserIsSuperUser()) . '</b><br/>';
 		
 		$out .= '<h2>Execute SQL queries</h2>';
 		$query = "SELECT token_auth FROM ".Piwik::prefixTable('user')." WHERE login = ?";
@@ -103,7 +112,7 @@
 			return "false";
 		}
 	}
-
+	
 	/**
 	 * See the result on piwik/?module=ExamplePlugin&action=exampleWidget
 	 * or in the dashboard > Add a new widget 



More information about the Piwik-svn mailing list