Skip to content
Extraits de code Groupes Projets
Valider d56b1384 rédigé par Thomas Steur's avatar Thomas Steur
Parcourir les fichiers

added hooks for before and after load data table

parent 2cb1359e
Branches
Aucune étiquette associée trouvée
Aucune requête de fusion associée trouvée
...@@ -1110,9 +1110,15 @@ class ViewDataTable ...@@ -1110,9 +1110,15 @@ class ViewDataTable
$this->overrideViewProperties(); $this->overrideViewProperties();
try { try {
$visualization->beforeLoadDataTable();
$this->loadDataTableFromAPI(); $this->loadDataTableFromAPI();
$this->postDataTableLoadedFromAPI(); $this->postDataTableLoadedFromAPI();
$this->executeAfterDataLoadedCallbacks(); $this->executeAfterDataLoadedCallbacks();
$visualization->afterLoadDataTable();
} catch (NoAccessException $e) { } catch (NoAccessException $e) {
throw $e; throw $e;
} catch (\Exception $e) { } catch (\Exception $e) {
......
...@@ -14,6 +14,7 @@ namespace Piwik\ViewDataTable; ...@@ -14,6 +14,7 @@ namespace Piwik\ViewDataTable;
use Piwik\DataTable; use Piwik\DataTable;
use Piwik\Piwik; use Piwik\Piwik;
use Piwik\View; use Piwik\View;
use Piwik\ViewDataTable;
/** /**
* Base class for all DataTable visualizations. Different visualizations are used to * Base class for all DataTable visualizations. Different visualizations are used to
...@@ -29,10 +30,16 @@ abstract class Visualization extends View ...@@ -29,10 +30,16 @@ abstract class Visualization extends View
protected $templateFile = ''; protected $templateFile = '';
/**
* @var ViewDataTable
*/
protected $viewDataTable;
public function __construct($view) public function __construct($view)
{ {
parent::__construct($this->templateFile); parent::__construct($this->templateFile);
$this->viewDataTable = $view;
$this->init($view); $this->init($view);
} }
...@@ -41,6 +48,16 @@ abstract class Visualization extends View ...@@ -41,6 +48,16 @@ abstract class Visualization extends View
// do your stuff here, do not overwrite constructor // do your stuff here, do not overwrite constructor
} }
public function beforeLoadDataTable()
{
}
public function afterLoadDataTable()
{
}
/** /**
* Default implementation of getDefaultPropertyValues static function. * Default implementation of getDefaultPropertyValues static function.
* *
......
0% Chargement en cours ou .
You are about to add 0 people to the discussion. Proceed with caution.
Veuillez vous inscrire ou vous pour commenter