PHP Class Piwik\Plugins\Dashboard\Model

Inheritance: implements Piwik\Db\FactoryCreated
Exibir arquivo Open project: piwik/piwik Class Usage Examples

Public Methods

Method 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.

Protected Methods

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

Private Methods

Method Description
getNextIdDashboard ( $login )

Method Details

__construct() public method

public __construct ( )

createNewDashboardForUser() public method

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

createOrUpdateDashboard() public method

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

deleteAllLayoutsForUser() public method

public deleteAllLayoutsForUser ( $userLogin )

deleteDashboardForUser() public method

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

getAllDashboardsForUser() public method

public getAllDashboardsForUser ( $login )

getLayoutForUser() public method

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

install() public static method

public static install ( )

layoutContainsWidget() protected static method

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

replaceDashboardWidgets() public static method

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 method

public static uninstall ( )

updateDashboardName() public method

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

updateLayoutForUser() public method

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