Merge branch '3.8'

Conflicts:
	lib/Alchemy/Phrasea/Authentication/Phrasea/NativeAuthentication.php
	lib/Alchemy/Phrasea/Controller/Report/Root.php
	templates/web/report/ajax_dashboard_content_child.html.twig
	templates/web/report/all_content.html.twig
	templates/web/report/report_layout_child.html.twig
	tests/Alchemy/Tests/Phrasea/Controller/Report/RootTest.php
This commit is contained in:
Nicolas Le Goff
2014-03-23 19:49:12 +01:00
10 changed files with 315 additions and 307 deletions

View File

@@ -125,7 +125,7 @@ class Step31 implements DatasUpgraderInterface
$uuid = Uuid::uuid4();
try {
$media = $this->app['mediavorus']->guess($pathfile);
$collection = \collection::get_from_coll_id($app, $databox, (int) $record['coll_id']);
$collection = \collection::get_from_coll_id($this->$app, $databox, (int) $record['coll_id']);
$file = new File($this->app, $media, $collection);
$uuid = $file->getUUID(true, true);

View File

@@ -68,28 +68,13 @@ class Root implements ControllerProviderInterface
*/
public function getDashboard(Application $app, Request $request)
{
$dashboard = new \module_report_dashboard($app, $app['authentication']->getUser());
if ('json' !== $request->getRequestFormat()) {
\Session_Logger::updateClientInfos($app, 4);
$dashboard->execute();
$dashboard = new \module_report_dashboard($app, $app['authentication']->getUser());
return $app['twig']->render('report/report_layout_child.html.twig', [
'ajax_dash' => true,
'dashboard' => $dashboard,
'home_title' => $app['conf']->get(['registry', 'general', 'title']),
'module' => 'report',
'module_name' => 'Report',
'anonymous' => $app['conf']->get(['registry', 'modules', 'anonymous-report']),
'g_anal' => $app['conf']->get(['registry', 'general', 'analytics']),
'ajax' => false,
'ajax_chart' => false
]);
}
$dmin = $request->request->get('dmin');
$dmax = $request->request->get('dmax');
$dmin = $request->query->get('dmin');
$dmax = $request->query->get('dmax');
if ($dmin && $dmax) {
$dashboard->setDate($dmin, $dmax);
@@ -97,9 +82,40 @@ class Root implements ControllerProviderInterface
$dashboard->execute();
return $app->json(['html' => $app['twig']->render('report/ajax_dashboard_content_child.html.twig', [
return $app->json(array('html' => $app['twig']->render('report/ajax_dashboard_content_child.html.twig', array(
'dashboard' => $dashboard
])]);
))));
}
$granted = array();
foreach($app['acl']->get($app['authentication']->getUser())->get_granted_base(array('canreport')) as $collection) {
if (!isset($granted[$collection->get_sbas_id()])) {
$granted[$collection->get_sbas_id()] = array(
'id' => $collection->get_sbas_id(),
'name' => $collection->get_databox()->get_viewname(),
'collections' => array()
);
}
$granted[$collection->get_sbas_id()]['collections'][] = array(
'id' => $collection->get_coll_id(),
'base_id' => $collection->get_base_id(),
'name' => $collection->get_name()
);
}
return $app['twig']->render('report/report_layout_child.html.twig', array(
'ajax_dash' => true,
'dashboard' => null,
'granted_bases' => $granted,
'home_title' => $app['phraseanet.registry']->get('GV_homeTitle'),
'module' => 'report',
'module_name' => 'Report',
'anonymous' => $app['phraseanet.registry']->get('GV_anonymousReport'),
'g_anal' => $app['phraseanet.registry']->get('GV_googleAnalytics'),
'ajax' => false,
'ajax_chart' => false
));
}
/**
@@ -115,15 +131,15 @@ class Root implements ControllerProviderInterface
$popbases = $request->request->get('popbases', []);
if ('' === $dmin = $request->request->get('dmin', '')) {
$dmin = '01-' . date('m') . '-' . date('Y');
$dmin = date('Y') . '-' . date('m') . '-01';
}
if ('' === $dmax = $request->request->get('dmax', '')) {
$dmax = date('d') . '-' . date('m') . '-' . date('Y');
$dmax = date('Y') . '-' . date('m') . '-' . date('d');
}
$dmin = \DateTime::createFromFormat('d-m-Y H:i:s', sprintf('%s 00:00:00', $dmin));
$dmax = \DateTime::createFromFormat('d-m-Y H:i:s', sprintf('%s 23:59:59', $dmax));
$dmin = \DateTime::createFromFormat('Y-m-d H:i:s', sprintf('%s 00:00:00', $dmin));
$dmax = \DateTime::createFromFormat('Y-m-d H:i:s', sprintf('%s 23:59:59', $dmax));
//get user's sbas & collections selection from popbases
$selection = [];

View File

@@ -1,91 +1,84 @@
{% extends "report/ajax_dashboard_content.html.twig" %}
{% import "report/dashboard_macro.html.twig" as dash %}
{% block currentDashboard %}
{% set item = dashboard.dashboard %}
{% if "activity"|key_exists(item) %}
{% set title = 'report:: activite par heure' | trans %}
{% set title_abscisse = 'report:: Connexion' | trans %}
{{ dash.table_activity("mytablehour", title, title_abscisse, item.activity)}}
{% set title1 = "report:: activite par heure" | trans %}
{% set title2 = "report:: Connexion" | trans %}
{{ dash.table_activity("mytablehour", title1, title2, item.activity)}}
{% endif %}
{% if "activity_day"|key_exists(item) %}
{% set title = 'report:: activite par jour' | trans %}
{% set title_abscisse = 'report:: Connexion' | trans %}
{{dash.table_activity("mytabledaytotal", title , title_abscisse, item.activity_day)}}
{% set title1 = "report:: activite par jour" | trans %}
{% set title2 = "report:: Connexion" | trans %}
{{dash.table_activity("mytabledaytotal", title1, title2, item.activity_day)}}
{%endif%}
{% if "activity_added"|key_exists(item) %}
{% set title = 'report:: activite document ajoute' | trans %}
{{ dash.table_activity("mytableadded", title , "", item.activity_added)}}
{% set title1 = "report:: activite document ajoute" | trans %}
{{ dash.table_activity("mytableadded", title1 , "", item.activity_added)}}
{%endif %}
{% if "activity_edited"|key_exists(item) %}
{% set title = 'report:: activite document edite' | trans %}
{{ dash.table_activity("mytableedited", title , "", item.activity_edited)}}
{% set title1 = "report:: activite document edite" | trans %}
{{ dash.table_activity("mytableedited", title1 , "", item.activity_edited)}}
{% endif %}
{% if "nb_conn"|key_exists(item) and "nb_dl"|key_exists(item)%}
{% set title = 'report:: Cumul telechargements & connexions' | trans %}
{% set title_left = 'report:: telechargements' | trans %}
{% set title_right = 'report::Connexion' | trans %}
{{ dash.connexion_download(title, title_left, title_right, item.nb_dl, item.nb_conn, dashboard.getTitleDate('dmin'),dashboard.getTitleDate('dmax'))}}
{% set title1 = "report:: Cumul telechargements & connexions" | trans %}
{% set title2 = "report:: telechargements" | trans %}
{% set title3 = "report::Connexion" | trans %}
{{ dash.connexion_download(title1, title2, title3, item.nb_dl, item.nb_conn, dashboard.getTitleDate('dmin'),dashboard.getTitleDate('dmax'))}}
{% endif %}
{% if "top_ten_user_doc"|key_exists(item)%}
{% set title = 'report:: Utilisateurs les plus actifs' | trans %}
{% set title_left = 'report:: utilisateurs' | trans %}
{% set title_right = 'report:: telechargements document' | trans %}
{{ dash.table(title, title_left, title_right, item.top_ten_user_doc, dashboard.getTitleDate('dmin'), dashboard.getTitleDate('dmax'), "false", "false") }}
{% set title1 = "report:: Utilisateurs les plus actifs" | trans %}
{% set title2 = "report:: utilisateurs" | trans %}
{% set title3 = "report:: telechargements document" | trans %}
{{ dash.table(title1 , title2, title3, item.top_ten_user_doc, dashboard.getTitleDate('dmin'), dashboard.getTitleDate('dmax'), "false", "false") }}
{% endif %}
{% if "top_ten_user_prev"|key_exists(item) %}
{% set title = 'report:: Utilisateurs les plus actifs' | trans %}
{% set title_left = 'report:: utilisateurs' | trans %}
{% set title_right = 'report:: telechargements preview' | trans %}
{{ dash.table(title, title_left, title_right, item.top_ten_user_prev, dashboard.getTitleDate('dmin'), dashboard.getTitleDate('dmax'), "false", "false") }}
{% set title1 = "report:: Utilisateurs les plus actifs" | trans %}
{% set title2 = "report:: utilisateurs" | trans %}
{% set title3 = "report:: telechargements preview" | trans %}
{{ dash.table(title1 , title2, title3, item.top_ten_user_prev, dashboard.getTitleDate('dmin'), dashboard.getTitleDate('dmax'), "false", "false") }}
{%endif %}
{% if "top_ten_user_poiddoc"|key_exists(item) %}
{% set title = 'report:: Utilisateurs les plus actifs' | trans %}
{% set title_left = 'report:: utilisateurs' | trans %}
{% set title_right = 'report:: poids document' | trans %}
{{ dash.table(title, title_left, title_right, item.top_ten_user_poiddoc, dashboard.getTitleDate('dmin'), dashboard.getTitleDate('dmax'), "true", "false") }}
{% set title1 = "report:: Utilisateurs les plus actifs" | trans %}
{% set title2 = "report:: utilisateurs" | trans %}
{% set title3 = "report:: poids document" | trans %}
{{ dash.table(title1 , title2, title3, item.top_ten_user_poiddoc, dashboard.getTitleDate('dmin'), dashboard.getTitleDate('dmax'), "true", "false") }}
{%endif %}
{% if "top_ten_user_poidprev"|key_exists(item) %}
{% set title = 'report:: Utilisateurs les plus actifs' | trans %}
{% set title_left = 'report:: utilisateurs' | trans %}
{% set title_right = 'report:: poids preview' | trans %}
{{ dash.table(title, title_left, title_right, item.top_ten_user_poidprev, dashboard.getTitleDate('dmin'), dashboard.getTitleDate('dmax'), "true", "false") }}
{% set title1 = "report:: Utilisateurs les plus actifs" | trans %}
{% set title2 = "report:: utilisateurs" | trans %}
{% set title3 = "report:: poids preview" | trans %}
{{ dash.table(title1, title2, title3, item.top_ten_user_poidprev, dashboard.getTitleDate('dmin'), dashboard.getTitleDate('dmax'), "true", "false") }}
{%endif %}
{% if "top_dl_doc"|key_exists(item) %}
{% set title = 'report:: documents les plus telecharges' | trans %}
{% set title_left = 'report:: document' | trans %}
{% set title_right = 'report:: telechargements' | trans %}
{{ dash.table(title, title_left, title_right, item.top_dl_doc, dashboard.getTitleDate('dmin'), dashboard.getTitleDate('dmax'), "false", "true") }}
{% set title1 = "report:: documents les plus telecharges" | trans %}
{% set title2 = "report:: document" | trans %}
{% set title3 = "report:: telechargements" | trans %}
{{ dash.table(title1, title2, title3, item.top_dl_doc, dashboard.getTitleDate('dmin'), dashboard.getTitleDate('dmax'), "false", "true") }}
{%endif %}
{% if "top_dl_preview"|key_exists(item) %}
{% set title = 'report:: preview les plus telecharges' | trans %}
{% set title_left = 'report:: preview' | trans %}
{% set title_right = 'report:: telechargements' | trans %}
{{ dash.table(title, title_left, title_right, item.top_dl_preview, dashboard.getTitleDate('dmin'), dashboard.getTitleDate('dmax'), "false", "true") }}
{% set title1 = "report:: preview les plus telecharges" | trans %}
{% set title2 = "report:: preview" | trans %}
{% set title3 = "report:: telechargements" | trans %}
{{ dash.table(title1, title2, title3, item.top_dl_preview, dashboard.getTitleDate('dmin'), dashboard.getTitleDate('dmax'), "false", "true") }}
{%endif %}
{% if "ask"|key_exists(item) %}
{% set title = 'report:: Les questions les plus posees' | trans %}
{% set title_left = 'report:: utilisateurs' | trans %}
{% set title_right = 'report:: question' | trans %}
{{ dash.table(title, title_left, title_right, item.ask, dashboard.getTitleDate('dmin'), dashboard.getTitleDate('dmax'), "false", "false") }}
{% set title1 = "report:: Les questions les plus posees" | trans %}
{% set title2 = "report:: utilisateurs" | trans %}
{% set title3 = "report:: question" | trans %}
{{ dash.table(title1, title2, title3, item.ask, dashboard.getTitleDate('dmin'), dashboard.getTitleDate('dmax'), "false", "false") }}
{%endif %}
{% if "top_ten_question"|key_exists(item) %}
{% set title = 'report:: question' | trans %}
{% set title_left = 'report:: question' | trans %}
{% set title_right = 'report:: poids preview' | trans %}
{{dash.top_ten_question(app['conf'].get(['registry', 'general', 'title']), title_left, title_right, item.top_ten_question,dashboard.getTitleDate('dmin') , dashboard.getTitleDate('dmax')) }}
{% set title1 = "report:: question" | trans %}
{% set title2 = "report:: poids preview" | trans %}
{{dash.top_ten_question(app['phraseanet.registry'].get('GV_homeTitle'), title1, title2, item.top_ten_question,dashboard.getTitleDate('dmin') , dashboard.getTitleDate('dmax')) }}
{%endif %}
{% if "top_ten_site"|key_exists(item) %}
{% set title_left = 'report:: site' | trans %}
{% set title_right = 'report:: nombre de vue' | trans %}
{% set title = 'report:: site d\'ou les photo sont les plus consultees' | trans %}
{{ dash.table(title , title_left, title_right, item.top_ten_site, dashboard.getTitleDate('dmin'), dashboard.getTitleDate('dmax'), "false", "false") }}
{% set title1 = "report:: site d\'ou les photo sont les plus consultees" | trans %}
{% set title2 = "report:: site" | trans %}
{% set title3 = "report:: nombre de vue" | trans %}
{{ dash.table(title1, title2, title3, item.top_ten_site, dashboard.getTitleDate('dmin'), dashboard.getTitleDate('dmax'), "false", "false") }}
{%endif %}
{%endblock currentDashboard %}
{%endblock currentDashboard %}

View File

@@ -12,20 +12,15 @@
{% block javascript %}
<script type="text/javascript" >
var usrId = '{{ dashboard.usr.getId() }}' ;
var usrId = '{{ app['authentication'].user.get_id }}' ;
var language = {
valider : '{{ "boutton::valider" | trans }}',
choix_collection : '{{ "veuillez choisir au minimum une collection" | trans }}',
annuler : '{{ "boutton::annuler" | trans }}',
fermer : '{{ "boutton::fermer" | trans }}',
connexion : '{{ "report:: Connexion" | trans }}',
heure : '{{ "report::Heures" | trans }}'
};
var date = {
dmin : '{{ dashboard.dmin }}',
dmax : '{{ dashboard.dmax }}'
valider : '{% trans "boutton::valider" %}',
choix_collection : '{% trans "veuillez choisir au minimum une collection" %}',
annuler : '{% trans "boutton::annuler" %}',
fermer : '{% trans "boutton::fermer" %}',
connexion : '{% trans "report:: Connexion" %}',
heure : '{% trans "report::Heures" %}'
};
var dashboard ={
@@ -47,8 +42,7 @@
{% endblock javascript%}
{% block content %}
{% block report_layout %}
{% endblock report_layout %}
{% block report_layout %}{% endblock report_layout %}
<div id="DIALOG" style="color:white;"></div>
{% endblock content %}

View File

@@ -5,17 +5,16 @@
<div class="control-group">
<label for="dmin">{{ "report:: Du (date)" | trans }}</label>
<div class="controls" style="display:inline-block">
<input class= "dmin" name="dmin" type="text" value="{{ dashboard.dmin}}" size="10" style='width:100px'/>
<input class= "dmin" name="dmin" type="text" value="{{ "-1 month"|date("Y-m-d") }}" size="10" style='width:100px'/>
</div>
</div>
<div class="control-group">
<label for="dmax">{{ "report:: Au (date)" | trans }}</label>
<div class="controls" style="display:inline-block">
<input class="dmax" name="dmax" type="text" value="{{dashboard.dmax}}" size="10" style='width:100px'/>
<input class="dmax" name="dmax" type="text" value="{{ "now"|date("Y-m-d") }}" size="10" style='width:100px'/>
</div>
</div>
</div>
{% set all_coll = dashboard.getAllColl() %}
<div class="form2">
<div class="form_titre">{{ "report:: 2 - Bases" | trans }}</div>
<div id="select_one">
@@ -28,14 +27,14 @@
{% trans %}Deselect all{% endtrans %}
</a>
</li>
{% for the_base_coll in all_coll %}
<li><label data-group-id="{{ loop.index }}" class="multiselect-group"><b>{{ the_base_coll.name_sbas }}</b></label></li>
{% for a_coll in the_base_coll.sbas_collections %}
{% for databox in granted_bases %}
<li><label data-group-id="{{ loop.index }}" class="multiselect-group"><b>{{ databox.name }}</b></label></li>
{% for collection in databox.collections %}
<li>
<a href="javascript:void(0);">
<label class="checkbox">
<input name="popbases[]" checked="checked" type="checkbox" class="coll-checkbox checkbox-{{ loop.parent.loop.index }}" value="{{ a_coll.sbas_id}}_{{ a_coll.coll_id }}">
{{ a_coll.name }}
<input name="popbases[]" checked="checked" type="checkbox" class="coll-checkbox checkbox-{{ loop.parent.loop.index }}" value="{{ collection.base_id}}_{{ collection.id }}">
{{ collection.name }}
</label>
</a>
</li>

View File

@@ -2,22 +2,34 @@
{% block report_dashboard_layout %}
<div id="dash" class="inside-container">
<div class="answers">
<div class="answers container-fluid">
<div class="content">
<div id='dashboard'>
<div id="panel" style="height:40px;width:100%;display:none;">
<div style="margin-top:15px;float:left;margin-bottom:20px;">
<div style="float:left;" >
<label for="dmin" class="form_titre">{{ "report:: Du (date)" | trans }}</label>
<input class= "dminDash" name="dmin" type="text" value="{{ dashboard.dmin}}" size="10" />
<div class="row-fluid">
<div class="well-large well" style="background: #313131;margin-top:20px;border:none;">
<form id="dashboard-form" class="form-inline" method="GET" action="{{ path("report_dashboard") }}">
<label for="dminDash" style="color:#eee">{{ "from"|trans|title }}</label>
<div class="input-prepend">
<span class="add-on"><i class="icon icon-calendar"></i></span>
<input id="dminDash" name="dmin" style="font-size: 14px;width:220px;" size="10" type="text" placeholder="{{ "from"|trans }}" value="{{ "-1 month"|date("Y-m-d") }}">
</div>
<div style="float:left;margin-left:15px;">
<label for="dmax" class="form_titre">{{ "report:: Au (date)" | trans }}</label>
<input class="dmaxDash" name="dmax" type="text" value="{{dashboard.dmax}}" size="10" />
<label for="dmaxDash" style="color:#eee">{{ "to"|trans|title }}</label>
<div class="input-prepend">
to
<span class="add-on"><i class="icon icon-calendar"></i></span>
<input id="dmaxDash" name="dmax" style="font-size: 14px;width:220px;" size="10" type="text" placeholder="{{ "to"|trans }}" value="{{ "now"|date("Y-m-d") }}">
</div>
<button class="btn submit-dashboard" type="button">{{ "Generate" | trans }}</button>
</form>
<div>
<span class="text-info" style="font-style: italic">
<i class="icon icon-warning-sign"></i>
{{
"Report generation may take a long time to generate, depending on the number of collections and the period selected." | trans
}}
</span>
</div>
{# <div id="chooose" style="margin-left:15px;float:left;margin-top:15px;"> #}
{# <div class="form_titre">{{ "report:: 2 - Bases" | trans }}</div> #}
{# <div class="form_titre">{% trans "report:: 2 - Bases" %}</div> #}
{# <label for="nameDash"></label> #}
{# <select name="nameDash" style = "background-color:#555;color:orange;border:none;"> #}
{# <option value="all">Global</option> #}
@@ -27,20 +39,22 @@
{#</select> #}
{#</div> #}
</div>
<div class="slide" style="margin-top:-5px;"><a class="btn-slide arrowDown"
style="width:100px;height:20px;padding:5px;float:right; text-align:center;display:block;color:#999;
">options</a></div>
<div id="dashdash" style="float:left;width:100%;">
{% if ajax_dash %}
{% include "report/ajax_dashboard_content_child.html.twig" %}
{% endif %}
</div>
<div id='dashboard' class="well well-large text-center" style="background-color:#696969;border:none;">
<button class="btn btn-primary submit-dashboard" style="
padding: 18px 28px;
font-size: 22px; //change this to your desired size
line-height: normal;
-webkit-border-radius: 8px;
-moz-border-radius: 8px;
border-radius: 8px;"
>
{{ "Generate dashboard" | trans }}
</button>
</div>
</div>
</div>
</div>
</div>
{% endblock report_dashboard_layout %}
{% block report_connexion_layout %}

View File

@@ -28,10 +28,10 @@ class RootTest extends \PhraseanetAuthenticatedWebTestCase
{
$this->authenticate(self::$DI['app']);
$this->XMLHTTPRequest('GET', '/report/dashboard', [
'dmin' => $this->dmin->format('Y-m-d H:i:s'),
'dmax' => $this->dmin->format('Y-m-d H:i:s'),
]);
$this->XMLHTTPRequest('GET', '/report/dashboard', array(
'dmin' => $this->dmin->format('Y-m-d'),
'dmax' => $this->dmin->format('Y-m-d'),
));
$response = self::$DI['client']->getResponse();
@@ -49,9 +49,9 @@ class RootTest extends \PhraseanetAuthenticatedWebTestCase
public function testDoReportConnexions()
{
self::$DI['client']->request('POST', '/report/connexions', [
'dmin' => $this->dmin->format('Y-m-d H:i:s'),
'dmax' => $this->dmax->format('Y-m-d H:i:s'),
self::$DI['client']->request('POST', '/report/connexions', array(
'dmin' => $this->dmin->format('Y-m-d'),
'dmax' => $this->dmax->format('Y-m-d'),
'sbasid' => self::$DI['collection']->get_sbas_id(),
'collection' => self::$DI['collection']->get_coll_id(),
'order' => 'ASC',
@@ -67,9 +67,9 @@ class RootTest extends \PhraseanetAuthenticatedWebTestCase
public function testDoReportConnexionsPrintCSV()
{
self::$DI['client']->request('POST', '/report/connexions', [
'dmin' => $this->dmin->format('Y-m-d H:i:s'),
'dmax' => $this->dmax->format('Y-m-d H:i:s'),
self::$DI['client']->request('POST', '/report/connexions', array(
'dmin' => $this->dmin->format('Y-m-d'),
'dmax' => $this->dmax->format('Y-m-d'),
'sbasid' => self::$DI['collection']->get_sbas_id(),
'collection' => self::$DI['collection']->get_coll_id(),
'printcsv' => 'on',
@@ -82,9 +82,9 @@ class RootTest extends \PhraseanetAuthenticatedWebTestCase
public function testDoReportConnexionsFilterColumns()
{
self::$DI['client']->request('POST', '/report/connexions', [
'dmin' => $this->dmin->format('Y-m-d H:i:s'),
'dmax' => $this->dmax->format('Y-m-d H:i:s'),
self::$DI['client']->request('POST', '/report/connexions', array(
'dmin' => $this->dmin->format('Y-m-d'),
'dmax' => $this->dmax->format('Y-m-d'),
'sbasid' => self::$DI['collection']->get_sbas_id(),
'collection' => self::$DI['collection']->get_coll_id(),
'list_column' => 'user ddate',
@@ -97,9 +97,9 @@ class RootTest extends \PhraseanetAuthenticatedWebTestCase
public function testDoReportConnexionsFilterResultOnOneColumn()
{
self::$DI['client']->request('POST', '/report/connexions', [
'dmin' => $this->dmin->format('Y-m-d H:i:s'),
'dmax' => $this->dmax->format('Y-m-d H:i:s'),
self::$DI['client']->request('POST', '/report/connexions', array(
'dmin' => $this->dmin->format('Y-m-d'),
'dmax' => $this->dmax->format('Y-m-d'),
'sbasid' => self::$DI['collection']->get_sbas_id(),
'collection' => self::$DI['collection']->get_coll_id(),
'filter_column' => 'user',
@@ -114,9 +114,9 @@ class RootTest extends \PhraseanetAuthenticatedWebTestCase
public function testDoReportConnexionsFilterConf()
{
self::$DI['client']->request('POST', '/report/connexions', [
'dmin' => $this->dmin->format('Y-m-d H:i:s'),
'dmax' => $this->dmax->format('Y-m-d H:i:s'),
self::$DI['client']->request('POST', '/report/connexions', array(
'dmin' => $this->dmin->format('Y-m-d'),
'dmax' => $this->dmax->format('Y-m-d'),
'sbasid' => self::$DI['collection']->get_sbas_id(),
'collection' => self::$DI['collection']->get_coll_id(),
'conf' => 'on',
@@ -129,9 +129,9 @@ class RootTest extends \PhraseanetAuthenticatedWebTestCase
public function testDoReportConnexionsGroupBy()
{
self::$DI['client']->request('POST', '/report/connexions', [
'dmin' => $this->dmin->format('Y-m-d H:i:s'),
'dmax' => $this->dmax->format('Y-m-d H:i:s'),
self::$DI['client']->request('POST', '/report/connexions', array(
'dmin' => $this->dmin->format('Y-m-d'),
'dmax' => $this->dmax->format('Y-m-d'),
'sbasid' => self::$DI['collection']->get_sbas_id(),
'collection' => self::$DI['collection']->get_coll_id(),
'groupby' => 'user',
@@ -144,9 +144,9 @@ class RootTest extends \PhraseanetAuthenticatedWebTestCase
public function testDoReportQuestions()
{
self::$DI['client']->request('POST', '/report/questions', [
'dmin' => $this->dmin->format('Y-m-d H:i:s'),
'dmax' => $this->dmax->format('Y-m-d H:i:s'),
self::$DI['client']->request('POST', '/report/questions', array(
'dmin' => $this->dmin->format('Y-m-d'),
'dmax' => $this->dmax->format('Y-m-d'),
'sbasid' => self::$DI['collection']->get_sbas_id(),
'collection' => self::$DI['collection']->get_coll_id(),
'order' => 'ASC',
@@ -162,9 +162,9 @@ class RootTest extends \PhraseanetAuthenticatedWebTestCase
public function testDoReportQuestionsPrintCSV()
{
self::$DI['client']->request('POST', '/report/questions', [
'dmin' => $this->dmin->format('Y-m-d H:i:s'),
'dmax' => $this->dmax->format('Y-m-d H:i:s'),
self::$DI['client']->request('POST', '/report/questions', array(
'dmin' => $this->dmin->format('Y-m-d'),
'dmax' => $this->dmax->format('Y-m-d'),
'sbasid' => self::$DI['collection']->get_sbas_id(),
'collection' => self::$DI['collection']->get_coll_id(),
'printcsv' => 'on',
@@ -177,9 +177,9 @@ class RootTest extends \PhraseanetAuthenticatedWebTestCase
public function testDoReportQuestionsFilterColumns()
{
self::$DI['client']->request('POST', '/report/questions', [
'dmin' => $this->dmin->format('Y-m-d H:i:s'),
'dmax' => $this->dmax->format('Y-m-d H:i:s'),
self::$DI['client']->request('POST', '/report/questions', array(
'dmin' => $this->dmin->format('Y-m-d'),
'dmax' => $this->dmax->format('Y-m-d'),
'sbasid' => self::$DI['collection']->get_sbas_id(),
'collection' => self::$DI['collection']->get_coll_id(),
'list_column' => 'user ddate',
@@ -192,9 +192,9 @@ class RootTest extends \PhraseanetAuthenticatedWebTestCase
public function testDoReportQuestionsFilterResultOnOneColumn()
{
self::$DI['client']->request('POST', '/report/questions', [
'dmin' => $this->dmin->format('Y-m-d H:i:s'),
'dmax' => $this->dmax->format('Y-m-d H:i:s'),
self::$DI['client']->request('POST', '/report/questions', array(
'dmin' => $this->dmin->format('Y-m-d'),
'dmax' => $this->dmax->format('Y-m-d'),
'sbasid' => self::$DI['collection']->get_sbas_id(),
'collection' => self::$DI['collection']->get_coll_id(),
'filter_column' => 'user',
@@ -209,9 +209,9 @@ class RootTest extends \PhraseanetAuthenticatedWebTestCase
public function testDoReportQuestionsFilterConf()
{
self::$DI['client']->request('POST', '/report/questions', [
'dmin' => $this->dmin->format('Y-m-d H:i:s'),
'dmax' => $this->dmax->format('Y-m-d H:i:s'),
self::$DI['client']->request('POST', '/report/questions', array(
'dmin' => $this->dmin->format('Y-m-d'),
'dmax' => $this->dmax->format('Y-m-d'),
'sbasid' => self::$DI['collection']->get_sbas_id(),
'collection' => self::$DI['collection']->get_coll_id(),
'conf' => 'on',
@@ -224,9 +224,9 @@ class RootTest extends \PhraseanetAuthenticatedWebTestCase
public function testDoReportQuestionsGroupBy()
{
self::$DI['client']->request('POST', '/report/questions', [
'dmin' => $this->dmin->format('Y-m-d H:i:s'),
'dmax' => $this->dmax->format('Y-m-d H:i:s'),
self::$DI['client']->request('POST', '/report/questions', array(
'dmin' => $this->dmin->format('Y-m-d'),
'dmax' => $this->dmax->format('Y-m-d'),
'sbasid' => self::$DI['collection']->get_sbas_id(),
'collection' => self::$DI['collection']->get_coll_id(),
'groupby' => 'user',
@@ -239,9 +239,9 @@ class RootTest extends \PhraseanetAuthenticatedWebTestCase
public function testDoReportDownloads()
{
self::$DI['client']->request('POST', '/report/downloads', [
'dmin' => $this->dmin->format('Y-m-d H:i:s'),
'dmax' => $this->dmax->format('Y-m-d H:i:s'),
self::$DI['client']->request('POST', '/report/downloads', array(
'dmin' => $this->dmin->format('Y-m-d'),
'dmax' => $this->dmax->format('Y-m-d'),
'sbasid' => self::$DI['collection']->get_sbas_id(),
'collection' => self::$DI['collection']->get_coll_id(),
'order' => 'ASC',
@@ -257,9 +257,9 @@ class RootTest extends \PhraseanetAuthenticatedWebTestCase
public function testDoReportDownloadsPrintCSV()
{
self::$DI['client']->request('POST', '/report/downloads', [
'dmin' => $this->dmin->format('Y-m-d H:i:s'),
'dmax' => $this->dmax->format('Y-m-d H:i:s'),
self::$DI['client']->request('POST', '/report/downloads', array(
'dmin' => $this->dmin->format('Y-m-d'),
'dmax' => $this->dmax->format('Y-m-d'),
'sbasid' => self::$DI['collection']->get_sbas_id(),
'collection' => self::$DI['collection']->get_coll_id(),
'printcsv' => 'on',
@@ -272,9 +272,9 @@ class RootTest extends \PhraseanetAuthenticatedWebTestCase
public function testDoReportDownloadsFilterColumns()
{
self::$DI['client']->request('POST', '/report/downloads', [
'dmin' => $this->dmin->format('Y-m-d H:i:s'),
'dmax' => $this->dmax->format('Y-m-d H:i:s'),
self::$DI['client']->request('POST', '/report/downloads', array(
'dmin' => $this->dmin->format('Y-m-d'),
'dmax' => $this->dmax->format('Y-m-d'),
'sbasid' => self::$DI['collection']->get_sbas_id(),
'collection' => self::$DI['collection']->get_coll_id(),
'list_column' => 'user ddate',
@@ -287,9 +287,9 @@ class RootTest extends \PhraseanetAuthenticatedWebTestCase
public function testDoReportDownloadsFilterResultOnOneColumn()
{
self::$DI['client']->request('POST', '/report/downloads', [
'dmin' => $this->dmin->format('Y-m-d H:i:s'),
'dmax' => $this->dmax->format('Y-m-d H:i:s'),
self::$DI['client']->request('POST', '/report/downloads', array(
'dmin' => $this->dmin->format('Y-m-d'),
'dmax' => $this->dmax->format('Y-m-d'),
'sbasid' => self::$DI['collection']->get_sbas_id(),
'collection' => self::$DI['collection']->get_coll_id(),
'filter_column' => 'user',
@@ -304,9 +304,9 @@ class RootTest extends \PhraseanetAuthenticatedWebTestCase
public function testDoReportDownloadsFilterConf()
{
self::$DI['client']->request('POST', '/report/downloads', [
'dmin' => $this->dmin->format('Y-m-d H:i:s'),
'dmax' => $this->dmax->format('Y-m-d H:i:s'),
self::$DI['client']->request('POST', '/report/downloads', array(
'dmin' => $this->dmin->format('Y-m-d'),
'dmax' => $this->dmax->format('Y-m-d'),
'sbasid' => self::$DI['collection']->get_sbas_id(),
'collection' => self::$DI['collection']->get_coll_id(),
'conf' => 'on',
@@ -319,9 +319,9 @@ class RootTest extends \PhraseanetAuthenticatedWebTestCase
public function testDoReportDownloadsGroupBy()
{
self::$DI['client']->request('POST', '/report/downloads', [
'dmin' => $this->dmin->format('Y-m-d H:i:s'),
'dmax' => $this->dmax->format('Y-m-d H:i:s'),
self::$DI['client']->request('POST', '/report/downloads', array(
'dmin' => $this->dmin->format('Y-m-d'),
'dmax' => $this->dmax->format('Y-m-d'),
'sbasid' => self::$DI['collection']->get_sbas_id(),
'collection' => self::$DI['collection']->get_coll_id(),
'groupby' => 'user',
@@ -334,9 +334,9 @@ class RootTest extends \PhraseanetAuthenticatedWebTestCase
public function testDoReportDocuments()
{
self::$DI['client']->request('POST', '/report/documents', [
'dmin' => $this->dmin->format('Y-m-d H:i:s'),
'dmax' => $this->dmax->format('Y-m-d H:i:s'),
self::$DI['client']->request('POST', '/report/documents', array(
'dmin' => $this->dmin->format('Y-m-d'),
'dmax' => $this->dmax->format('Y-m-d'),
'sbasid' => self::$DI['collection']->get_sbas_id(),
'collection' => self::$DI['collection']->get_coll_id(),
'order' => 'ASC',
@@ -353,9 +353,9 @@ class RootTest extends \PhraseanetAuthenticatedWebTestCase
public function testDoReportDocumentsPrintCSV()
{
self::$DI['client']->request('POST', '/report/documents', [
'dmin' => $this->dmin->format('Y-m-d H:i:s'),
'dmax' => $this->dmax->format('Y-m-d H:i:s'),
self::$DI['client']->request('POST', '/report/documents', array(
'dmin' => $this->dmin->format('Y-m-d'),
'dmax' => $this->dmax->format('Y-m-d'),
'sbasid' => self::$DI['collection']->get_sbas_id(),
'collection' => self::$DI['collection']->get_coll_id(),
'printcsv' => 'on',
@@ -368,9 +368,9 @@ class RootTest extends \PhraseanetAuthenticatedWebTestCase
public function testDoReportDocumentsFilterColumns()
{
self::$DI['client']->request('POST', '/report/documents', [
'dmin' => $this->dmin->format('Y-m-d H:i:s'),
'dmax' => $this->dmax->format('Y-m-d H:i:s'),
self::$DI['client']->request('POST', '/report/documents', array(
'dmin' => $this->dmin->format('Y-m-d'),
'dmax' => $this->dmax->format('Y-m-d'),
'sbasid' => self::$DI['collection']->get_sbas_id(),
'collection' => self::$DI['collection']->get_coll_id(),
'list_column' => 'file mime',
@@ -383,9 +383,9 @@ class RootTest extends \PhraseanetAuthenticatedWebTestCase
public function testDoReportDocumentsFilterResultOnOneColumn()
{
self::$DI['client']->request('POST', '/report/documents', [
'dmin' => $this->dmin->format('Y-m-d H:i:s'),
'dmax' => $this->dmax->format('Y-m-d H:i:s'),
self::$DI['client']->request('POST', '/report/documents', array(
'dmin' => $this->dmin->format('Y-m-d'),
'dmax' => $this->dmax->format('Y-m-d'),
'sbasid' => self::$DI['collection']->get_sbas_id(),
'collection' => self::$DI['collection']->get_coll_id(),
'filter_column' => 'mime',
@@ -400,9 +400,9 @@ class RootTest extends \PhraseanetAuthenticatedWebTestCase
public function testDoReportDocumentsFilterConf()
{
self::$DI['client']->request('POST', '/report/documents', [
'dmin' => $this->dmin->format('Y-m-d H:i:s'),
'dmax' => $this->dmax->format('Y-m-d H:i:s'),
self::$DI['client']->request('POST', '/report/documents', array(
'dmin' => $this->dmin->format('Y-m-d'),
'dmax' => $this->dmax->format('Y-m-d'),
'sbasid' => self::$DI['collection']->get_sbas_id(),
'collection' => self::$DI['collection']->get_coll_id(),
'conf' => 'on',
@@ -415,9 +415,9 @@ class RootTest extends \PhraseanetAuthenticatedWebTestCase
public function testDoReportDocumentsGroupBy()
{
self::$DI['client']->request('POST', '/report/documents', [
'dmin' => $this->dmin->format('Y-m-d H:i:s'),
'dmax' => $this->dmax->format('Y-m-d H:i:s'),
self::$DI['client']->request('POST', '/report/documents', array(
'dmin' => $this->dmin->format('Y-m-d'),
'dmax' => $this->dmax->format('Y-m-d'),
'sbasid' => self::$DI['collection']->get_sbas_id(),
'collection' => self::$DI['collection']->get_coll_id(),
'groupby' => 'mime',
@@ -430,9 +430,9 @@ class RootTest extends \PhraseanetAuthenticatedWebTestCase
public function testDoReportClients()
{
self::$DI['client']->request('POST', '/report/clients', [
'dmin' => $this->dmin->format('Y-m-d H:i:s'),
'dmax' => $this->dmax->format('Y-m-d H:i:s'),
self::$DI['client']->request('POST', '/report/clients', array(
'dmin' => $this->dmin->format('Y-m-d'),
'dmax' => $this->dmax->format('Y-m-d'),
'sbasid' => self::$DI['collection']->get_sbas_id(),
'collection' => self::$DI['collection']->get_coll_id(),
]);
@@ -444,9 +444,9 @@ class RootTest extends \PhraseanetAuthenticatedWebTestCase
public function testDoReportClientPrintCSV()
{
self::$DI['client']->request('POST', '/report/clients', [
'dmin' => $this->dmin->format('Y-m-d H:i:s'),
'dmax' => $this->dmax->format('Y-m-d H:i:s'),
self::$DI['client']->request('POST', '/report/clients', array(
'dmin' => $this->dmin->format('Y-m-d'),
'dmax' => $this->dmax->format('Y-m-d'),
'sbasid' => self::$DI['collection']->get_sbas_id(),
'collection' => self::$DI['collection']->get_coll_id(),
'printcsv' => 'on',

Binary file not shown.

After

Width:  |  Height:  |  Size: 21 KiB

View File

@@ -218,6 +218,7 @@ iframe{
}
#dash .answers{
background-color:#555555;
min-height: 400px;
}
.spacer{
clear:both;
@@ -273,6 +274,9 @@ table.center{
margin-top:10px;
cursor: pointer;
}
#dashboard.loading {
background:url('dash-ajax-loader.gif') #696969 no-repeat center center;
}
#dashboard-table table {
font:normal 76%/150% "Lucida Grande", "Lucida Sans Unicode", Verdana, Arial, Helvetica, sans-serif;
border:none;

View File

@@ -30,12 +30,10 @@ $(document).ready(function () {
resize();
}
});
resize();
//datepicker
reportDatePicker();
dashboardDatePicker();
//drawCharts from dashboard
drawCharts();
configure_dash();
bindEvents();
$("a.select-all").bind("click", function (e) {
@@ -63,6 +61,17 @@ $(document).ready(function () {
* Tous les binds sur le report
*/
function bindEvents() {
$('#dminDash, #dmaxDash').datepicker({
changeMonth: true,
changeYear: true,
dateFormat: 'dd-mm-yy',
numberOfMonths: 1,
maxDate: "-0d"
});
$(".submit-dashboard").click(function() {
loadDash();
});
//load all the report
$('form .formsubmiter').bind('click', function () {
submiterAction($(this));
@@ -103,11 +112,6 @@ function bindEvents() {
}).unbind("click").bind("click", function () {
showMenu();
});
$("#liste_dash").find("em").unbind("click").bind("click", function () {
id = $(this).attr('id').substr(3);
changeDash(id);
});
}
function reportDatePicker() {
@@ -129,17 +133,12 @@ function reportDatePicker() {
function dashboardDatePicker() {
$(function () {
$('.dminDash, .dmaxDash').datepicker({
defaultDate: -10,
defaultDate: -3,
changeMonth: true,
changeYear: true,
dateFormat: 'dd-mm-yy',
numberOfMonths: 3,
maxDate: "-0d",
onSelect: function (selectedDate, instance) {
var id = $(".selected_em").attr('id').substr(3);
changeDash(id);
$('.btn-slide').trigger('click');
}
maxDate: "-0d"
});
});
}
@@ -185,7 +184,7 @@ function submiterAction(domSubmiter) {
request = $.ajax({
type: "POST",
url: "/report/init",
url: "/index_dev.php/report/init",
data: data,
beforeSend: function () {
container.find('.content').empty();
@@ -379,36 +378,6 @@ function getScrollerStartPosition(selected_tab) {
return right;
}
function changeDash(sbasid) {
var dmin = $(".dminDash").val();
var dmax = $(".dmaxDash").val();
$.ajax({
type: "POST",
dataType: "json",
url: "/report/dashboard",
data: {
sbasid: sbasid,
dmin: dmin,
dmax: dmax
},
beforeSuccess: function () {
$("#dashdash").addClass("gifloader");
},
success: function (data) {
$("#dashdash").removeClass("gifloader").empty().append(data.html);
drawCharts();
$("#liste_dash").find("em").unbind("click").bind("click", function () {
id = $(this).attr('id').substr(3);
changeDash(id);
});
$('td a:visible').bind('click', function () {
tableLinkAction($(this));
});
}
});
}
function drawCharts() {
if ($('#mytabledaytotal').length > 0) {
$('#mytabledaytotal').gvChart({
@@ -438,9 +407,9 @@ function drawCharts() {
},
lineWidth: 1,
pointSize: 2,
backgroundColor: '#555555',
width: 900,
height: 400
backgroundColor: '#696969',
width: 800,
height: 350
}
});
}
@@ -477,9 +446,9 @@ function drawCharts() {
},
lineWidth: 1,
pointSize: 3,
backgroundColor: '#555555',
width: 900,
height: 400
backgroundColor: '#696969',
width: 800,
height: 350
}
});
}
@@ -515,9 +484,9 @@ function drawCharts() {
legend: 'none',
lineWidth: 1,
pointSize: 3,
backgroundColor: '#555555',
width: 900,
height: 400
backgroundColor: '#696969',
width: 800,
height: 350
}
});
}
@@ -553,9 +522,9 @@ function drawCharts() {
legend: 'none',
lineWidth: 1,
pointSize: 3,
backgroundColor: '#555555',
width: 900,
height: 400
backgroundColor: '#696969',
width: 800,
height: 350
}
});
}
@@ -987,6 +956,34 @@ function go(submit, form, f_val, data) {
});
}
function loadDash() {
var $form = $("#dashboard-form");
$.ajax({
url : $form.attr('action'),
type : $form.attr('method'),
dataType: 'json',
data : $form.serializeArray(),
beforeSend: function() {
resize();
$("#dashboard").empty().addClass("loading");
},
success : function( data ) {
$("#dashboard").empty().append(data.html);
drawCharts();
$('td a:visible').bind('click', function () {
tableLinkAction($(this));
});
},
error : function( xhr, err ) {
},
timeout: function(){
},
done: function() {
$("#dashboard").removeClass("loading");
}
});
return false;
}
//submit is the div where we want to load the updated tab
//form is the current form
@@ -1141,13 +1138,4 @@ function sessionactive() {
});
};
function configure_dash() {
$(".btn-slide").click(function () {
$("#panel").slideToggle("slow");
$(this).toggleClass("arrowUp");
return false;
});
}
sessionactive();