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


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