示例#1
0
 /**
  * Display informations about client (browser, resolution etc ...)
  *
  * @param  Application  $app
  * @param  Request      $request
  * @return JsonResponse
  */
 public function doReportClients(Application $app, Request $request)
 {
     $nav = new \module_report_nav($app, $request->request->get('dmin'), $request->request->get('dmax'), $request->request->get('sbasid'), $request->request->get('collection'));
     $conf_nav = ['nav' => [$app->trans('report:: navigateur'), 0, 1, 0, 0], 'nb' => [$app->trans('report:: nombre'), 0, 0, 0, 0], 'pourcent' => [$app->trans('report:: pourcentage'), 0, 0, 0, 0]];
     $conf_combo = ['combo' => [$app->trans('report:: navigateurs et plateforme'), 0, 0, 0, 0], 'nb' => [$app->trans('report:: nombre'), 0, 0, 0, 0], 'pourcent' => [$app->trans('report:: pourcentage'), 0, 0, 0, 0]];
     $conf_os = ['os' => [$app->trans('report:: plateforme'), 0, 0, 0, 0], 'nb' => [$app->trans('report:: nombre'), 0, 0, 0, 0], 'pourcent' => [$app->trans('report:: pourcentage'), 0, 0, 0, 0]];
     $conf_res = ['res' => [$app->trans('report:: resolution'), 0, 0, 0, 0], 'nb' => [$app->trans('report:: nombre'), 0, 0, 0, 0], 'pourcent' => [$app->trans('report:: pourcentage'), 0, 0, 0, 0]];
     $conf_mod = ['appli' => [$app->trans('report:: module'), 0, 0, 0, 0], 'nb' => [$app->trans('report:: nombre'), 0, 0, 0, 0], 'pourcent' => [$app->trans('report:: pourcentage'), 0, 0, 0, 0]];
     $report = ['nav' => $nav->buildTabNav($conf_nav), 'os' => $nav->buildTabOs($conf_os), 'res' => $nav->buildTabRes($conf_res), 'mod' => $nav->buildTabModule($conf_mod), 'combo' => $nav->buildTabCombo($conf_combo)];
     if ($request->request->get('printcsv') == 'on') {
         $result = [];
         $result[] = array_keys($conf_nav);
         foreach ($report['nav']['result'] as $row) {
             $result[] = array_values($row);
         }
         $result[] = array_keys($conf_os);
         foreach ($report['os']['result'] as $row) {
             $result[] = array_values($row);
         }
         $result[] = array_keys($conf_res);
         foreach ($report['res']['result'] as $row) {
             $result[] = array_values($row);
         }
         $result[] = array_keys($conf_mod);
         foreach ($report['mod']['result'] as $row) {
             $result[] = array_values($row);
         }
         $result[] = array_keys($conf_combo);
         foreach ($report['combo']['result'] as $row) {
             $result[] = array_values($row);
         }
         $filename = sprintf('report_export_info_%s.csv', date('Ymd'));
         $response = new CSVFileResponse($filename, function () use($app, $result) {
             $app['csv.exporter']->export('php://output', $result);
         });
         return $response;
     }
     return $app->json(['rs' => $app['twig']->render('report/ajax_data_content.html.twig', ['result' => isset($report['report']) ? $report['report'] : $report, 'is_infouser' => false, 'is_nav' => true, 'is_groupby' => false, 'is_plot' => false, 'is_doc' => false]), 'display_nav' => false, 'title' => false]);
 }
示例#2
0
 /**
  * Display informations about client (browser, resolution etc ...)
  *
  * @param  Application  $app
  * @param  Request      $request
  * @return JsonResponse
  */
 public function doReportClients(Application $app, Request $request)
 {
     $nav = new \module_report_nav($app, $request->request->get('dmin'), $request->request->get('dmax'), $request->request->get('sbasid'), $request->request->get('collection'));
     $conf_nav = ['nav' => [$app->trans('report:: navigateur'), 0, 1, 0, 0], 'nb' => [$app->trans('report:: nombre'), 0, 0, 0, 0], 'pourcent' => [$app->trans('report:: pourcentage'), 0, 0, 0, 0]];
     $conf_combo = ['combo' => [$app->trans('report:: navigateurs et plateforme'), 0, 0, 0, 0], 'nb' => [$app->trans('report:: nombre'), 0, 0, 0, 0], 'pourcent' => [$app->trans('report:: pourcentage'), 0, 0, 0, 0]];
     $conf_os = ['os' => [$app->trans('report:: plateforme'), 0, 0, 0, 0], 'nb' => [$app->trans('report:: nombre'), 0, 0, 0, 0], 'pourcent' => [$app->trans('report:: pourcentage'), 0, 0, 0, 0]];
     $conf_res = ['res' => [$app->trans('report:: resolution'), 0, 0, 0, 0], 'nb' => [$app->trans('report:: nombre'), 0, 0, 0, 0], 'pourcent' => [$app->trans('report:: pourcentage'), 0, 0, 0, 0]];
     $conf_mod = ['appli' => [$app->trans('report:: module'), 0, 0, 0, 0], 'nb' => [$app->trans('report:: nombre'), 0, 0, 0, 0], 'pourcent' => [$app->trans('report:: pourcentage'), 0, 0, 0, 0]];
     $report = ['nav' => $nav->buildTabNav($conf_nav), 'os' => $nav->buildTabOs($conf_os), 'res' => $nav->buildTabRes($conf_res), 'mod' => $nav->buildTabModule($conf_mod), 'combo' => $nav->buildTabCombo($conf_combo)];
     if ($request->request->get('printcsv') == 'on') {
         return $app->json(['nav' => \format::arr_to_csv($report['nav']['result'], $conf_nav), 'os' => \format::arr_to_csv($report['os']['result'], $conf_os), 'res' => \format::arr_to_csv($report['res']['result'], $conf_res), 'mod' => \format::arr_to_csv($report['mod']['result'], $conf_mod), 'combo' => \format::arr_to_csv($report['combo']['result'], $conf_combo)]);
     }
     return $app->json(['rs' => $app['twig']->render('report/ajax_data_content.html.twig', ['result' => isset($report['report']) ? $report['report'] : $report, 'is_infouser' => false, 'is_nav' => true, 'is_groupby' => false, 'is_plot' => false, 'is_doc' => false]), 'display_nav' => false, 'title' => false]);
 }