[ 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-makedir.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-makedir.php,v 1.12 2005/07/29 14:20:47 rodolphe Exp $
  19   * $Source: /cvsroot/dolibarr/dolibarr/htdocs/telephonie/script/graph-statistiques-makedir.php,v $
  20   *
  21   * Génération des répertoires
  22   *
  23   *
  24   */
  25  require  ("../../master.inc.php");
  26  
  27  $img_root = DOL_DATA_ROOT."/graph/telephonie/";
  28  
  29  /*
  30   * Création des répertoires
  31   *
  32   */
  33  $dirs[0] = DOL_DATA_ROOT."/graph/";
  34  $dirs[1] = DOL_DATA_ROOT."/graph/telephonie/";
  35  $dirs[2] = DOL_DATA_ROOT."/graph/telephonie/ca/";
  36  $dirs[3] = DOL_DATA_ROOT."/graph/telephonie/client/";
  37  $dirs[4] = DOL_DATA_ROOT."/graph/telephonie/commercials/";
  38  $dirs[5] = DOL_DATA_ROOT."/graph/telephonie/communications/";
  39  $dirs[6] = DOL_DATA_ROOT."/graph/telephonie/contrats/";
  40  $dirs[7] = DOL_DATA_ROOT."/graph/telephonie/factures/";
  41  $dirs[8] = DOL_DATA_ROOT."/graph/telephonie/lignes/";
  42  $dirs[9] = DOL_DATA_ROOT."/graph/telephonie/commerciaux/";
  43  $dirs[10] = DOL_DATA_ROOT."/graph/telephonie/commerciaux/groupes/";
  44  $dirs[11] = DOL_DATA_ROOT."/graph/telephonie/distributeurs/";
  45  
  46  $numdir = (sizeof($dirs) + 2);
  47  $i = $numdir ;
  48  
  49  $sql = "SELECT distinct fk_commercial";
  50  $sql .= " FROM ".MAIN_DB_PREFIX."telephonie_societe_ligne";
  51  
  52  if ($db->query($sql))
  53  {
  54    $num = $db->num_rows();
  55    $j = 0;
  56    
  57    while ($j < $num)
  58      {
  59        $row = $db->fetch_row();    
  60        
  61        $dirs[$i] = DOL_DATA_ROOT."/graph/telephonie/commercials/".$row[0];
  62        
  63        $i++;
  64        $j++;
  65      }
  66  }
  67  
  68  /* Groupes de commerciaux */
  69  
  70  $sql = "SELECT rowid ";
  71  $sql .= " FROM ".MAIN_DB_PREFIX."usergroup";
  72  
  73  if ($db->query($sql))
  74  {
  75    $num = $db->num_rows();
  76    $j = 0;
  77    
  78    while ($j < $num)
  79      {
  80        $row = $db->fetch_row();    
  81        
  82        $dirs[$i] = DOL_DATA_ROOT."/graph/telephonie/commerciaux/groupes/".$row[0];
  83        
  84        $i++;
  85        $j++;
  86      }
  87  }
  88  
  89  /* Distributeurs */
  90  
  91  $sql = "SELECT rowid ";
  92  $sql .= " FROM ".MAIN_DB_PREFIX."telephonie_distributeur";
  93  
  94  if ($db->query($sql))
  95  {
  96    $num = $db->num_rows();
  97    $j = 0;
  98    
  99    while ($j < $num)
 100      {
 101        $row = $db->fetch_row();    
 102        
 103        $dirs[$i] = DOL_DATA_ROOT."/graph/telephonie/distributeurs/".$row[0];
 104        
 105        $i++;
 106        $j++;
 107      }
 108  }
 109  
 110  
 111  /* Clients */
 112  
 113  for ($j = 0 ; $j < 10 ; $j++)
 114  {
 115    $dirs[$i] = DOL_DATA_ROOT."/graph/telephonie/client/".$j;
 116    $i++;
 117  }
 118  
 119  /*
 120   *
 121   */
 122  
 123  for ($j = 0 ; $j < 10 ; $j++)
 124  {
 125    $dirs[$i] = DOL_DATA_ROOT."/graph/".$j."/telephonie";
 126    $i++;
 127  }
 128  
 129  
 130  for ($j = 0 ; $j < 10 ; $j++)
 131  {
 132    $dirs[$i] = DOL_DATA_ROOT."/graph/".$j."/telephonie/client/";
 133    $i++;
 134    $dirs[$i] = DOL_DATA_ROOT."/graph/".$j."/telephonie/ligne/";
 135    $i++;
 136    $dirs[$i] = DOL_DATA_ROOT."/graph/".$j."/telephonie/commercial/";
 137    $i++;
 138    $dirs[$i] = DOL_DATA_ROOT."/graph/".$j."/telephonie/contrat/";
 139    $i++;
 140  }
 141  
 142  /*
 143   *
 144   */
 145  
 146  $sql = "SELECT idp FROM ".MAIN_DB_PREFIX."societe";
 147  
 148  if ($db->query($sql))
 149  {
 150    $num = $db->num_rows();
 151    $j = 0;
 152    
 153    while ($j < $num)
 154      {
 155        $row = $db->fetch_row();    
 156        
 157        $dirs[$i] = DOL_DATA_ROOT."/graph/telephonie/client/".substr($row[0],0,1)."/".$row[0]."/";     
 158        $i++;
 159  
 160        $dirs[$i] = DOL_DATA_ROOT."/graph/".substr($row[0],-1)."/telephonie/client/".$row[0]."/";     
 161        $i++;
 162  
 163        $j++;
 164      }
 165  }
 166  
 167  $sql = "SELECT rowid FROM ".MAIN_DB_PREFIX."telephonie_contrat";
 168  
 169  if ($db->query($sql))
 170  {
 171    $num = $db->num_rows();
 172    $j = 0;
 173    
 174    while ($j < $num)
 175      {
 176        $row = $db->fetch_row();    
 177        
 178        $dirs[$i] = DOL_DATA_ROOT."/graph/".substr($row[0],-1)."/telephonie/contrat/".$row[0]."/";
 179        $i++;
 180  
 181        $j++;
 182      }
 183  }
 184  
 185  /*
 186   *
 187   */ 
 188  $sql = "SELECT rowid FROM ".MAIN_DB_PREFIX."telephonie_societe_ligne";
 189  
 190  if ($db->query($sql))
 191  {
 192    $num = $db->num_rows();
 193    $j = 0;
 194    
 195    while ($j < $num)
 196      {
 197        $row = $db->fetch_row();    
 198        
 199        $dirs[$i] = DOL_DATA_ROOT."/graph/".substr($row[0],-1)."/telephonie/ligne/".$row[0]."/";
 200        $i++;
 201  
 202        $j++;
 203      }
 204  }
 205  /*
 206   *
 207   */
 208  
 209  if (is_array($dirs))
 210  {
 211    foreach ($dirs as $key => $value)
 212      {
 213        $dir = $value;      
 214        create_dir($dir);
 215      }
 216  }
 217  
 218  $base_dir = DOL_DATA_ROOT.'/graph/telephonie/lignes/';
 219  
 220  for ($i = 0 ; $i < 10 ; $i++)
 221  {
 222    $dir = $base_dir . $i . "/";
 223        
 224    create_dir($dir);
 225  
 226    for ($j = 0 ; $j < 10 ; $j++)
 227      {
 228        $dir = $base_dir . $i . "/". $j . "/";
 229        
 230        create_dir($dir);
 231  
 232        for ($k = 0 ; $k < 10 ; $k++)
 233      {
 234        $dir = $base_dir . $i . "/". $j . "/". $k . "/";
 235        
 236        create_dir($dir);
 237      }
 238      }  
 239  }
 240  
 241  function create_dir($dir)
 242  {
 243  
 244    if (! file_exists($dir))
 245      {
 246        umask(0);
 247        if (! @mkdir($dir, 0755))
 248      {
 249        die ("Erreur: Le répertoire ".$dir." n'existe pas et Dolibarr n'a pu le créer.");
 250      }
 251      }
 252  
 253  
 254  }
 255  ?>


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