|
@@ -23,6 +23,9 @@ Action::register('dashboard_widget_search',function(&$response){
|
|
}
|
|
}
|
|
});
|
|
});
|
|
|
|
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+
|
|
Action::register('dashboard_widget_by_id',function(&$response){
|
|
Action::register('dashboard_widget_by_id',function(&$response){
|
|
global $_;
|
|
global $_;
|
|
User::check_access('dashboard','read');
|
|
User::check_access('dashboard','read');
|
|
@@ -125,6 +128,38 @@ Action::register('dashboard_model_search',function(&$response){
|
|
});
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
+Action::register('dashboard_widget_refresh',function(&$response){
|
|
|
|
+ global $_;
|
|
|
|
+ User::check_access('dashboard','read');
|
|
|
|
+ require_once(__DIR__.SLASH.'Dashboard.class.php');
|
|
|
|
+ require_once(__DIR__.SLASH.'DashboardWidget.class.php');
|
|
|
|
+
|
|
|
|
+ $response['rows'] = array();
|
|
|
|
+ $widgets = array();
|
|
|
|
+
|
|
|
|
+ $filters = array();
|
|
|
|
+ if(empty($_['scope'])) throw new Exception('Portée non spécifiée');
|
|
|
|
+ $filters['scope'] = $_['scope'];
|
|
|
|
+ if(empty($_['uid'])) $filters['uid'] = $_['uid'];
|
|
|
|
+
|
|
|
|
+ $dashboard = Dashboard::load($filters);
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ foreach(DashboardWidget::loadAll(array('dashboard'=>$dashboard->id)) as $widget){
|
|
|
|
+ if(!isset($widgets[$widget->model])) $widgets[$widget->model] = array();
|
|
|
|
+ $widgets[$widget->model][] = $widget;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ foreach(DashboardWidget::model() as $model){
|
|
|
|
+ if(!isset($model->refresh) || !isset($widgets[$model->model]) ) continue;
|
|
|
|
+
|
|
|
|
+ $method = $model->refresh;
|
|
|
|
+ foreach($widgets[$model->model] as $currentWidget)
|
|
|
|
+ $method($currentWidget);
|
|
|
|
+ $response['rows'][] = $currentWidget;
|
|
|
|
+ }
|
|
|
|
+});
|
|
|
|
+
|
|
Action::register('dashboard_widget_configure',function(&$response){
|
|
Action::register('dashboard_widget_configure',function(&$response){
|
|
global $_;
|
|
global $_;
|
|
User::check_access('dashboard','edit');
|
|
User::check_access('dashboard','edit');
|
|
@@ -141,3 +176,5 @@ Action::register('dashboard_widget_configure',function(&$response){
|
|
});
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
+
|
|
|
|
+
|