Fix #1624 : Some report locales might be broken

This commit is contained in:
Romain Neutron
2013-12-17 18:22:03 +01:00
parent c788daa1e9
commit 1cc3885656
3 changed files with 78 additions and 42 deletions

View File

@@ -17,21 +17,6 @@ class module_report_filter
private $posting_filter = array(); private $posting_filter = array();
private $cor_query = array(); private $cor_query = array();
private $active_column = array(); private $active_column = array();
private $trans = array(
'user' => 'phraseanet::utilisateurs',
'ddate' => 'report:: date',
'ip' => 'report:: IP',
'appli' => 'report:: modules',
'fonction' => 'report::fonction',
'activite' => 'report::activite',
'pays' => 'report::pays',
'societe' => 'report::societe',
'record_id' => 'report:: record id',
'final' => 'phraseanet:: sous definition',
'coll_id' => 'report:: collections',
'comment' => 'report:: commentaire',
'search' => 'report:: question',
);
public function __construct(Application $app, $current_filter, $correspondance) public function __construct(Application $app, $current_filter, $correspondance)
{ {
@@ -69,6 +54,22 @@ class module_report_filter
public function getPostingFilter() public function getPostingFilter()
{ {
$trans = array(
'user' => _('phraseanet::utilisateurs'),
'ddate' => _('report:: date'),
'ip' => _('report:: IP'),
'appli' => _('report:: modules'),
'fonction' => _('report::fonction'),
'activite' => _('report::activite'),
'pays' => _('report::pays'),
'societe' => _('report::societe'),
'record_id' => _('report:: record id'),
'final' => _('phraseanet:: sous definition'),
'coll_id' => _('report:: collections'),
'comment' => _('report:: commentaire'),
'search' => _('report:: question'),
);
if (sizeof($this->tab_filter) > 0) { if (sizeof($this->tab_filter) > 0) {
foreach ($this->tab_filter as $key => $filter) { foreach ($this->tab_filter as $key => $filter) {
if (empty($filter['v'])) if (empty($filter['v']))
@@ -76,8 +77,8 @@ class module_report_filter
else else
$value = $filter['v']; $value = $filter['v'];
if (array_key_exists($filter['f'], $this->trans)) if (array_key_exists($filter['f'], $trans))
$field = _($this->trans[$filter['f']]); $field = _($trans[$filter['f']]);
else else
$field = $filter['f']; $field = $filter['f'];

View File

@@ -9,46 +9,81 @@
{% if "activity"|key_exists(item) %} {% if "activity"|key_exists(item) %}
{{ dash.table_activity("mytablehour", "report:: activite par heure", "report:: Connexion", item.activity)}} {% set title1 = "report:: activite par heure" | trans %}
{% set title2 = "report:: Connexion" | trans %}
{{ dash.table_activity("mytablehour", title1, title2, item.activity)}}
{% endif %} {% endif %}
{% if "activity_day"|key_exists(item) %} {% if "activity_day"|key_exists(item) %}
{{dash.table_activity("mytabledaytotal", "report:: activite par jour" , "report:: Connexion", 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%} {%endif%}
{% if "activity_added"|key_exists(item) %} {% if "activity_added"|key_exists(item) %}
{{ dash.table_activity("mytableadded", "report:: activite document ajoute" , "", item.activity_added)}} {% set title1 = "report:: activite document ajoute" | trans %}
{{ dash.table_activity("mytableadded", title1 , "", item.activity_added)}}
{%endif %} {%endif %}
{% if "activity_edited"|key_exists(item) %} {% if "activity_edited"|key_exists(item) %}
{{ dash.table_activity("mytableedited", "report:: activite document edite" , "", item.activity_edited)}} {% set title1 = "report:: activite document edite" | trans %}
{{ dash.table_activity("mytableedited", title1 , "", item.activity_edited)}}
{% endif %} {% endif %}
{% if "nb_conn"|key_exists(item) and "nb_dl"|key_exists(item)%} {% if "nb_conn"|key_exists(item) and "nb_dl"|key_exists(item)%}
{{ dash.connexion_download("report:: Cumul telechargements & connexions", "report:: telechargements", "report::Connexion", 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 %} {% endif %}
{% if "top_ten_user_doc"|key_exists(item)%} {% if "top_ten_user_doc"|key_exists(item)%}
{{ dash.table('report:: Utilisateurs les plus actifs' , 'report:: utilisateurs' , 'report:: telechargements document', 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 %} {% endif %}
{% if "top_ten_user_prev"|key_exists(item) %} {% if "top_ten_user_prev"|key_exists(item) %}
{{ dash.table('report:: Utilisateurs les plus actifs' , 'report:: utilisateurs' , 'report:: telechargements preview', 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 %} {%endif %}
{% if "top_ten_user_poiddoc"|key_exists(item) %} {% if "top_ten_user_poiddoc"|key_exists(item) %}
{{ dash.table('report:: Utilisateurs les plus actifs' , 'report:: utilisateurs' , 'report:: poids document', 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 %} {%endif %}
{% if "top_ten_user_poidprev"|key_exists(item) %} {% if "top_ten_user_poidprev"|key_exists(item) %}
{{ dash.table('report:: Utilisateurs les plus actifs' , 'report:: utilisateurs' , 'report:: poids preview', 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 %} {%endif %}
{% if "top_dl_doc"|key_exists(item) %} {% if "top_dl_doc"|key_exists(item) %}
{{ dash.table('report:: documents les plus telecharges' , 'report:: document' , 'report:: telechargements', 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 %} {%endif %}
{% if "top_dl_preview"|key_exists(item) %} {% if "top_dl_preview"|key_exists(item) %}
{{ dash.table('report:: preview les plus telecharges' , 'report:: preview' , 'report:: telechargements', 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 %} {%endif %}
{% if "ask"|key_exists(item) %} {% if "ask"|key_exists(item) %}
{{ dash.table('report:: Les questions les plus posees' , 'report:: utilisateurs' , 'report:: question', 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 %} {%endif %}
{% if "top_ten_question"|key_exists(item) %} {% if "top_ten_question"|key_exists(item) %}
{{dash.top_ten_question(app['phraseanet.registry'].get('GV_homeTitle'), "report:: question", "report:: poids preview" , 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 %} {%endif %}
{% if "top_ten_site"|key_exists(item) %} {% if "top_ten_site"|key_exists(item) %}
{{ dash.table('report:: site d\'ou les photo sont les plus consultees' , 'report:: site' , 'report:: nombre de vue', 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 %} {%endif %}
{%endblock currentDashboard %} {%endblock currentDashboard %}

View File

@@ -2,11 +2,11 @@
{% macro table(title, titleLeft, titleRight, object, dmin, dmax, unite, sbasid) %} {% macro table(title, titleLeft, titleRight, object, dmin, dmax, unite, sbasid) %}
{% if object|length > 0 %} {% if object|length > 0 %}
<table style="margin:0 auto; margin-bottom:30px;"> <table style="margin:0 auto; margin-bottom:30px;">
<caption>{% trans title %}</caption> <caption>{{ title }}</caption>
<thead> <thead>
<tr> <tr>
<th>{% trans titleLeft %}</th> <th>{{ titleLeft }}</th>
<th>{% trans titleRight %}</th> <th>{{ titleRight }}</th>
</tr> </tr>
</thead> </thead>
<tbody> <tbody>
@@ -41,8 +41,8 @@
<caption>{% trans %} report:: Volumetrie des questions posees sur {{home_title}} {% endtrans %}</caption> <caption>{% trans %} report:: Volumetrie des questions posees sur {{home_title}} {% endtrans %}</caption>
<thead> <thead>
<tr> <tr>
<th>{% trans title_left %}</th> <th>{{ title_left }}</th>
<th>{% trans title_right %}</th> <th>{{ title_right }}</th>
</tr> </tr>
</thead> </thead>
<tbody> <tbody>
@@ -64,11 +64,11 @@
{% macro connexion_download(title, title_left, title_right, itemco, itemdl, dmin, dmax ) %} {% macro connexion_download(title, title_left, title_right, itemco, itemdl, dmin, dmax ) %}
<table style="margin:0 auto; margin-bottom:30px;"> <table style="margin:0 auto; margin-bottom:30px;">
<caption>{% trans title %}</caption> <caption>{{ title }}</caption>
<thead> <thead>
<tr> <tr>
<th>{% trans title_left %}</th> <th>{{ title_left }}</th>
<th>{% trans title_right %}</th> <th>{{ title_right }}</th>
</tr> </tr>
</thead> </thead>
<tbody> <tbody>
@@ -88,7 +88,7 @@
{% macro table_activity( id, title, title_abscisse, item) %} {% macro table_activity( id, title, title_abscisse, item) %}
{% if item|length > 0 %} {% if item|length > 0 %}
<table border='1' class="center imgdash" id = "{{id}}"> <table border='1' class="center imgdash" id = "{{id}}">
<caption>{% trans title %}</caption> <caption>{{ title }}</caption>
<thead> <thead>
<tr> <tr>
<th></th> <th></th>
@@ -101,7 +101,7 @@
<tr> <tr>
<th> <th>
{% if title_abscisse|length > 0 %} {% if title_abscisse|length > 0 %}
{% trans title_abscisse%} {{ title_abscisse }}
{% endif %} {% endif %}
</th> </th>
{% for value in item %} {% for value in item %}