[ 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/ -> graph-statistiques-clients.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: graph-statistiques-clients.php,v 1.9 2005/10/20 19:19:05 rodolphe Exp $
  19   * $Source: /cvsroot/dolibarr/dolibarr/htdocs/telephonie/script/graph-statistiques-clients.php,v $
  20   *
  21   *
  22   * Generation des graphiques clients
  23   *
  24   *
  25   */
  26  require  ("../../master.inc.php");
  27  require_once (DOL_DOCUMENT_ROOT."/telephonie/stats/ProcessGraphClients.class.php");
  28  
  29  $childrenTotal = 5;
  30  $childrenNow = 0;
  31  $clientPerChild = 0;
  32  
  33  $sql = "DELETE FROM ".MAIN_DB_PREFIX."telephonie_client_stats";
  34  
  35  if ($db->query($sql))
  36  {
  37  
  38  }
  39  
  40  $sql = "SELECT max(s.idp)";
  41  $sql .= " FROM ".MAIN_DB_PREFIX."societe as s";
  42  
  43  if ($db->query($sql))
  44  {
  45    $row = $db->fetch_row();
  46    $clientPerChild =  ceil($row[0] / $childrenTotal);
  47    $db->free();
  48  }
  49  else
  50  {
  51    exit("Erreur selection des clients");
  52  }
  53  
  54  while ( $childrenNow < $childrenTotal )
  55  {
  56    $pid = pcntl_fork();
  57    
  58    if ( $pid == -1 )
  59      {
  60        die( "error\n" );
  61      }
  62    elseif ( $pid )
  63      {
  64        $childrenNow++;
  65      }
  66    else
  67      {
  68        $process = new ProcessGraphClients( $childrenNow, $clientPerChild );
  69        $process->go();
  70        die();
  71      }  
  72  }
  73  
  74  ?>


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