PHP Class Piwik\Plugins\Dashboard\Model

Inheritance: implements Piwik\Db\FactoryCreated
Afficher le fichier Open project: piwik/piwik Class Usage Examples

Méthodes publiques

Méthode Description
__construct ( )
createNewDashboardForUser ( $login, $name, $layout ) Creates a new dashboard for the current user User needs to be logged in
createOrUpdateDashboard ( $login, $idDashboard, $layout ) Saves the layout as default
deleteAllLayoutsForUser ( $userLogin )
deleteDashboardForUser ( $idDashboard, $login ) Removes the dashboard with the given id
getAllDashboardsForUser ( $login )
getLayoutForUser ( string $login, integer $idDashboard ) : boolean | string Returns the layout in the DB for the given user, or false if the layout has not been set yet.
install ( )
replaceDashboardWidgets ( $dashboardLayout, array $oldWidgets, array $newWidgets ) Replaces widgets on the given dashboard layout with other ones
uninstall ( )
updateDashboardName ( string $login, integer $idDashboard, string $name ) Updates the name of a dashboard
updateLayoutForUser ( string $login, integer $idDashboard, string $layout ) Records the layout in the DB for the given user.

Méthodes protégées

Méthode Description
layoutContainsWidget ( $dashboardLayout, $widgetId ) : boolean Checks if a given dashboard layout contains a given widget

Private Methods

Méthode Description
getNextIdDashboard ( $login )

Method Details

__construct() public méthode

public __construct ( )

createNewDashboardForUser() public méthode

Creates a new dashboard for the current user User needs to be logged in
public createNewDashboardForUser ( $login, $name, $layout )

createOrUpdateDashboard() public méthode

Saves the layout as default
public createOrUpdateDashboard ( $login, $idDashboard, $layout )

deleteAllLayoutsForUser() public méthode

public deleteAllLayoutsForUser ( $userLogin )

deleteDashboardForUser() public méthode

Removes the dashboard with the given id
public deleteDashboardForUser ( $idDashboard, $login )

getAllDashboardsForUser() public méthode

public getAllDashboardsForUser ( $login )

getLayoutForUser() public méthode

Parameters must be checked BEFORE this function call
public getLayoutForUser ( string $login, integer $idDashboard ) : boolean | string
$login string
$idDashboard integer
Résultat boolean | string

install() public static méthode

public static install ( )

layoutContainsWidget() protected static méthode

Checks if a given dashboard layout contains a given widget
protected static layoutContainsWidget ( $dashboardLayout, $widgetId ) : boolean
$dashboardLayout
$widgetId
Résultat boolean

replaceDashboardWidgets() public static méthode

It uses the given widget definitions to find the old and to create the new widgets Each widget is defined with an array containing the following information array ( 'module' => string 'action' => string 'params' => array() ) if $newWidget does not contain a widget definition at the current position, the old widget will simply be removed
public static replaceDashboardWidgets ( $dashboardLayout, array $oldWidgets, array $newWidgets )
$oldWidgets array array containing widget definitions
$newWidgets array array containing widget definitions

uninstall() public static méthode

public static uninstall ( )

updateDashboardName() public méthode

Updates the name of a dashboard
public updateDashboardName ( string $login, integer $idDashboard, string $name )
$login string
$idDashboard integer
$name string

updateLayoutForUser() public méthode

Records the layout in the DB for the given user.
public updateLayoutForUser ( string $login, integer $idDashboard, string $layout )
$login string
$idDashboard integer
$layout string