Ignore:
Timestamp:
Jan 11, 2014, 11:47:57 AM (7 years ago)
Author:
jean-marc.viglino@…
Message:

{BUG} Correction de bug passage SPIP v3

File:
1 edited

Legend:

Unmodified
Added
Removed
  • _plugins_/analyclick/branches/V0.1/exec/statistiques_anaclic_v3.php

    r79856 r79955  
    142142        $duree = intval(_request('duree'));
    143143        if (!$duree) $duree = 90;
     144        $duree_mois = intval(_request('duree_mois'));
     145        if (!$duree_mois) $duree_mois = 12;
    144146        $where = "date > DATE_SUB(".sql_quote(date('Y-m-d H:i:s')).",INTERVAL $duree day)";
    145147        if ($id_document) $where .= " AND id_document=$id_document";
     
    149151        $statj = array();
    150152        while ($row = sql_fetch($result))
    151         {       array_push ($statj, [ $row['date'], $row['total_absolu'] ]);
     153        {       array_push ($statj, array ( $row['date'], $row['total_absolu'] ));
    152154        }
    153155        // Calcul des statistiques / mois
     156        $where = "date > DATE_SUB(".sql_quote(date('Y-m-1')).",INTERVAL $duree_mois month)";
     157        if ($id_document) $where .= " AND id_document=$id_document";
    154158        $result = sql_select("YEAR(date) as year, MONTH(date) as month, SUM(telechargement) AS total_absolu", "spip_doc_compteurs",$where,'year,month','date','','',$serveur);
    155159        $statm = array();
    156160        while ($row = sql_fetch($result))
    157         {       array_push ($statm, [ $row[year]."-".($row['month']<10?'0':'').$row['month'], $row['total_absolu'] ]);
     161        {       array_push ($statm, array ( $row[year]."-".($row['month']<10?'0':'').$row['month'], $row['total_absolu'] ));
    158162        }
    159163        // Affichage
    160164        echo debut_cadre_sous_rub('statistique-24.png',true,'','', 'statistiques');
    161         echo recuperer_fond ('fonds/statistiques_anaclic_v3', array('id_document'=>$id_document, 'duree'=>$duree, 'stat_jour' => json_encode($statj), 'stat_mois' => json_encode($statm) ));
     165        echo recuperer_fond ('fonds/statistiques_anaclic_v3', array('id_document'=>$id_document, 'duree'=>$duree, 'duree_mois'=>$duree_mois, 'stat_jour' => json_encode($statj), 'stat_mois' => json_encode($statm) ));
    162166        echo fin_cadre_relief(true);
    163167
Note: See TracChangeset for help on using the changeset viewer.