Problem of inheritance

Hello,

I’m working on writing a plugin which is composed of Admin interface and a widget.

My Controller.php file inherits from Piwik_Controller_Admin which itself inherits Piwik_Controller.

I create my job for Admin interface:


public function manage_kpi_criteria(){
		
		Piwik::checkUserIsSuperUser();
		$view = Piwik_View::factory('kpiCriteriaManager');
		
		$this->setBasicVariablesView($view);
		$view->menu = Piwik_GetAdminMenu();
		
		echo $view->render();
}

and my function for the widget:


public function display_kpi_criteria(){
		$view = Piwik_View::factory('widgetKpiCriteria');
		$this->setGeneralVariablesView($view);

		echo $view->render();
		}

When I add the widget in the dashboard, I have the following error message:

The requested website idSite is not found in the request, or is invalid. Please check that you are logged in Piwik and have permission to access the specified website.

The program throws me because of the line ’


'$this->setGeneralVariablesView($view)

‘’ Why?

Thank you for your help

Make sure you have a &idsite= in the URL

Yes id is specified in the URL.
Expect to understand and solve my problem of access to the function, I use $ _GET [‘idsite’] for an entry point to the data.

After I develop on piwik 1.9.1. Is this a bug that has been fixed on newer versions?

I’ve found.

Made in the body in the Controller plugin, I appeal to different personal class. So in each function, I instantiate my objects to use them.

Given that many view uses the same classes, I wanted to centralize the instantiation of my classes. So in my code:


Piwik_Owp_Controller class extends {Piwik_Controller

private $ process;


public function __ construct () {
$this-> process = new Process ();

} 

my_fonction public function () {
echo $ this-> process;
}

If I use of’’ $this-> process’’ gives $this-> idSite = NULL else it works. Why?