Add sevral dashboard


(Maxime) #1

Hi,

I want to add at least 2 dashboard in my Piwik.
I already add a dashboard but I can’t save my change

I have done that:

-copy and past plugins\Dashboard in the folder plugin

-renamed the folder in StatsClients and the file Dashboard.php in StatsClients.php

-renamed the classes of StatsClients.php and controller.php

  • in StatsClients.php I had replaced:

public function addMenus()
{
Piwik_AddMenu(‘Dashboard_Dashboard’, ‘’, array(‘module’ => ‘Dashboard’, ‘action’ => ‘embeddedIndex’), true, 5);
}

public function addTopMenu()
{
	Piwik_AddTopMenu('Dashboard_Dashboard', array('module' => 'CoreHome', 'action' => 'index'), true, 1);
}

by

public function addMenus()
{
Piwik_AddMenu(‘StatsClients’, ‘’, array(‘module’ => ‘StatsClients’, ‘action’ => ‘embeddedIndex’), true, 15);
}

public function addTopMenu()
{
	Piwik_AddTopMenu('StatsClients', array('module' => 'CoreHome', 'action' => 'index'), true, 1);
}
  • In controller.php I had replaced

$idDashboard = Piwik_Common::getRequestVar(‘idDashboard’, 1, ‘int’ );

by

$idDashboard = Piwik_Common::getRequestVar(‘idDashboard’, 2, ‘int’ );

In the lines 93 and 113 to save my change in the base

  • I add a new entry in my table piwik_user_dashboard with my login, iddashboard as “2” and a layout empty with this SQL :

INSERT INTO piwik_user_dashboard (login, iddashboard, layout) VALUES
(‘max’, 2, ‘[[],[],[]]’);

My different dashboard load the correspondent layout

But when I modify one of my dashboard the modifications are save in the original dashboard unless I change the lines 93 and 113 of plugins\Dashboard\controller.php

by

$idDashboard = Piwik_Common::getRequestVar(‘idDashboard’, 2, ‘int’ );

but then the change are save in my new dashboard…

I’m almost sure that it’s because my .js files in plugins\StatsClients\templates use the function saveLayoutForUser() of plugins\Dashboard\controller.php instead of plugins\StatsClients\controller.php

I ‘hope I have been clear :-s

Thanks a lot!

Ps: I’m French, sorry for my English ^^


(Maxime) #2

Hi again,

I have finally succeeded to add my new dashboard ^^

But I had to modify the Piwik source code… (Not practical in case of update)

Does anybody have already done a plugin to do the same thing?

Thanks,