public function setUp() { parent::setUp(); $date = new Datetime(); $dmax = $date->format("Y-m-d H:i:s"); $date->modify('-6 month'); $dmin = $date->format("Y-m-d H:i:s"); $databoxes = self::$DI['app']->getDataboxes(); $ret = []; foreach ($databoxes as $databox) { $colls = $databox->get_collections(); $rett = []; foreach ($colls as $coll) { $rett[$coll->get_coll_id()] = $coll->get_coll_id(); } $ret[$databox->get_sbas_id()] = implode(',', $rett); } foreach ($ret as $sbasid => $collections) { $report = new module_report_connexion(self::$DI['app'], $dmin, $dmax, $sbasid, $collections); if (!$this->report instanceof module_report) { $this->report = $report; } elseif ($report->getTotal() > $this->report->getTotal()) { $this->report = $report; } } $this->report->setFilter([['f' => 'user', 'o' => '=', 'v' => 'admin'], ['f' => 'ddate', 'o' => 'LIKE', 'v' => '*'], ['f' => '1', 'o' => 'OR', 'v' => '1']]); $this->report->setUser_id(self::$DI['user']->getId()); $this->report->setOrder('user', 'ASC'); $this->filter = new module_report_sqlfilter(self::$DI['app'], $this->report); }
/** * Display instance connexion report * * @param Application $app * @param Request $request * @return JsonResponse */ public function doReportConnexions(Application $app, Request $request) { $cnx = new \module_report_connexion($app, $request->request->get('dmin'), $request->request->get('dmax'), $request->request->get('sbasid'), $request->request->get('collection')); $conf = ['user' => [$app->trans('phraseanet::utilisateurs'), 1, 1, 1, 1], 'ddate' => [$app->trans('report:: date'), 1, 0, 1, 1], 'ip' => [$app->trans('report:: IP'), 1, 0, 0, 0], 'appli' => [$app->trans('report:: modules'), 1, 0, 0, 0], 'fonction' => [$app->trans('report::fonction'), 1, 1, 1, 1], 'activite' => [$app->trans('report::activite'), 1, 1, 1, 1], 'pays' => [$app->trans('report::pays'), 1, 1, 1, 1], 'societe' => [$app->trans('report::societe'), 1, 1, 1, 1]]; if ($request->request->get('printcsv') == 'on') { $cnx->setHasLimit(false); $cnx->setPrettyString(false); $this->doReport($app, $request, $cnx, $conf); return $this->getCSVResponse($app, $cnx, 'connections'); } $report = $this->doReport($app, $request, $cnx, $conf); if ($report instanceof Response) { return $report; } 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' => false, 'is_groupby' => false, 'is_plot' => false, 'is_doc' => false]), 'display_nav' => $report['display_nav'], 'next' => $report['next_page'], 'prev' => $report['previous_page'], 'page' => $report['page'], 'filter' => sizeof($report['filter']) > 0 ? serialize($report['filter']) : '', 'col' => $report['active_column'], 'limit' => $report['nb_record']]); }
/** * @desc fill the dash results for the current sbas * @return <void> */ public function process() { try { //Get number of DLs $this->report['nb_dl'] = module_report_download::getNbDl($this->app, $this->dminsql, $this->dmaxsql, $this->sbasid, $this->collection); //Get Number of connexions $this->report['nb_conn'] = module_report_connexion::getNbConn($this->app, $this->dminsql, $this->dmaxsql, $this->sbasid, $this->collection); if ($this->app['conf']->get(['registry', 'modules', 'anonymous-report']) == false) { /** * get Top ten user of * number of dl doc, prev * number of weight dl by doc, prev */ $top = module_report_activity::topTenUser($this->app, $this->dminsql, $this->dmaxsql, $this->sbasid, $this->collection); $this->report['top_ten_user_doc'] = $top['top_ten_doc']; $this->report['top_ten_user_prev'] = $top['top_ten_prev']; $this->report['top_ten_user_poiddoc'] = $top['top_ten_poiddoc']; $this->report['top_ten_user_poidprev'] = $top['top_ten_poidprev']; } /** * get avtivity by hour */ $this->report['activity'] = module_report_activity::activity($this->app, $this->dminsql, $this->dmaxsql, $this->sbasid, $this->collection); // get activty by day $this->report['activity_day'] = module_report_activity::activityDay($this->app, $this->dminsql, $this->dmaxsql, $this->sbasid, $this->collection); // get Most document and preview DL $topdl = module_report_download::getTopDl($this->app, $this->dminsql, $this->dmaxsql, $this->sbasid, $this->collection); $this->report['top_dl_preview'] = $topdl['preview']; $this->report['top_dl_document'] = $topdl['document']; if ($this->app['conf']->get(['registry', 'modules', 'anonymous-report']) == false) { // get users that ask the most questions $this->report['ask'] = module_report_activity::activityQuestion($this->app, $this->dminsql, $this->dmaxsql, $this->sbasid, $this->collection); } //get the refferer $this->report['top_ten_site'] = module_report_activity::activiteTopTenSiteView($this->app, $this->dminsql, $this->dmaxsql, $this->sbasid, $this->collection); //Get the most asked questions $this->report['top_ten_question'] = module_report_activity::activiteTopQuestion($this->app, $this->dminsql, $this->dmaxsql, $this->sbasid, $this->collection); //get the number of added docuùments $this->report['activity_added'] = module_report_activity::activiteAddedDocument($this->app, $this->dminsql, $this->dmaxsql, $this->sbasid, $this->collection); //get number of edited document $this->report['activity_edited'] = module_report_activity::activiteEditedDocument($this->app, $this->dminsql, $this->dmaxsql, $this->sbasid, $this->collection); if ($this->app['conf']->get(['registry', 'modules', 'anonymous-report']) == false) { //get users that add the most documents $this->report['top_ten_added'] = module_report_activity::activiteAddedTopTenUser($this->app, $this->dminsql, $this->dmaxsql, $this->sbasid, $this->collection); } } catch (DBALException $e) { } return; }