[ Index ]
 

Code source de Dolibarr 2.0.1

Accédez au Source d'autres logiciels libres

Classes | Fonctions | Variables | Constantes | Tables

title

Body

[fermer]

/htdocs/telephonie/script/ -> analyse-traffic.php (source)

   1  <?PHP
   2  /* Copyright (C) 2005 Rodolphe Quiedeville <rodolphe@quiedeville.org>
   3   *
   4   * This program is free software; you can redistribute it and/or modify
   5   * it under the terms of the GNU General Public License as published by
   6   * the Free Software Foundation; either version 2 of the License, or
   7   * (at your option) any later version.
   8   *
   9   * This program is distributed in the hope that it will be useful,
  10   * but WITHOUT ANY WARRANTY; without even the implied warranty of
  11   * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  12   * GNU General Public License for more details.
  13   *
  14   * You should have received a copy of the GNU General Public License
  15   * along with this program; if not, write to the Free Software
  16   * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
  17   *
  18   * $Id: analyse-traffic.php,v 1.1 2005/04/12 12:23:56 rodolphe Exp $
  19   * $Source: /cvsroot/dolibarr/dolibarr/htdocs/telephonie/script/analyse-traffic.php,v $
  20   *
  21   * Recherche les lignes sans traffic
  22   *
  23   */
  24  print "Mem : ".memory_get_usage() ."\n";
  25  require  ("../../master.inc.php");
  26  
  27  require_once (DOL_DOCUMENT_ROOT."/telephonie/lignetel.class.php");
  28  
  29  $error = 0;
  30  
  31  $datetime = time();
  32  $date = strftime("%d%h%Y%Hh%Mm%S",$datetime);
  33  
  34  $month = strftime("%m", $datetime);
  35  $year = strftime("%Y", $datetime);
  36  
  37  if ($month == 1)
  38  {
  39    $month = "12";
  40    $year = $year - 1;
  41  }
  42  else
  43  {
  44    $month = substr("00".($month - 1), -2) ;
  45  }
  46  
  47  
  48  /*
  49   * Lecture des lignes
  50   *
  51   */
  52  $lignes = array();
  53  $lignes_traffic = array();
  54  
  55  $sql = "SELECT rowid, ligne FROM ".MAIN_DB_PREFIX."telephonie_societe_ligne";
  56  $sql .= " WHERE statut = 3";
  57    
  58  $resql = $db->query($sql);
  59  
  60  if ($resql)
  61  {
  62    $nums = $db->num_rows($resql);
  63    $i = 0;
  64    while($i < $nums)
  65      {
  66        $row = $db->fetch_row($resql);
  67        $lignes[$i] = $row;
  68        $i++;
  69      }
  70    $db->free($resql);
  71  }
  72  dolibarr_syslog(sizeof($lignes)." lignes actives");
  73  /*
  74   * Lecture des comms
  75   *
  76   */
  77  $sql = "SELECT distinct(ligne) FROM ".MAIN_DB_PREFIX."telephonie_communications_details";
  78  $sql .= " WHERE date_format(date,'%Y%m') = ".$year.substr("00".$month, -2);
  79  $resql = $db->query($sql);
  80  
  81  if ($resql)
  82  {
  83    $nums = $db->num_rows($resql);
  84    $i = 0;
  85    while($i < $nums)
  86      {
  87        $row = $db->fetch_row($resql);
  88        array_push($lignes_traffic, $row[0]);
  89        $i++;
  90      }
  91    $db->free($resql);
  92  }
  93  dolibarr_syslog(sizeof($lignes_traffic)." lignes avec traffic");
  94  
  95  /*
  96   * Croisement des données
  97   *
  98   */
  99  $j = 0;
 100  for ($i = 0 ; $i < sizeof($lignes) ; $i++)
 101  {
 102    if (in_array($lignes[$i][1], $lignes_traffic))
 103      {
 104  
 105      }
 106    else
 107      {
 108        $j++;
 109        print "$j Pas de traffic en $month/$year sur ".$lignes[$i][1]."\n";
 110      }
 111  }
 112  ?>


Généré le : Mon Nov 26 12:29:37 2007 par Balluche grâce à PHPXref 0.7
  Clicky Web Analytics