[ 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/ -> interfaces.class.php (source)

   1  <?php
   2  /* Copyright (C) 2005 Laurent Destailleur  <eldy@users.sourceforge.net>
   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: interfaces.class.php,v 1.2 2005/04/27 00:33:48 eldy Exp $
  19   * $Source: /cvsroot/dolibarr/dolibarr/htdocs/interfaces.class.php,v $
  20   *
  21   */
  22  
  23  /**
  24          \file       htdocs/interfaces.class.php
  25          \ingroup    core
  26          \brief      Fichier de la classe de gestion des triggers
  27  */
  28  
  29  
  30  /**
  31          \class      Interfaces
  32          \brief      Classe de la gestion des triggers
  33  */
  34  
  35  class Interfaces
  36  {
  37      var $dir;
  38  
  39      /**
  40       *   \brief      Constructeur.
  41       *   \param      DB      handler d'accès base
  42       */
  43      function Interfaces($DB)
  44      {
  45          $this->db = $DB ;
  46          $this->dir = DOL_DOCUMENT_ROOT . "/includes/triggers";
  47      }
  48      
  49      /**
  50       *   \brief      Fonction appelée lors du déclenchement d'un évènement Dolibarr.
  51       *               Cette fonction déclenche tous les triggers trouvés
  52       *   \param      action      Code de l'evenement
  53       *   \param      object      Objet concern
  54       *   \param      user        Objet user
  55       *   \param      lang        Objet lang
  56       *   \param      conf        Objet conf
  57       *   \return     int         Nbre de triggers déclenchés si pas d'erreurs. Nb en erreur sinon.
  58       */
  59      function run_triggers($action,$object,$user,$lang,$conf)
  60      {
  61      
  62          $handle=opendir($this->dir);
  63          $modules = array();
  64          $nbok = $nbko = 0;
  65      
  66          while (($file = readdir($handle))!==false)
  67          {
  68              if (is_readable($this->dir."/".$file) && eregi('interface_(.*).class.php',$file,$reg))
  69              {
  70                  $modName = "Interface".ucfirst($reg[1]);
  71                  //print "file=$file"; print "modName=$modName"; exit;
  72                  if ($modName)
  73                  {
  74                      include_once($this->dir."/".$file);
  75                      $objMod = new $modName($this->db);
  76                      if ($objMod)
  77                      {
  78                          if ($objMod->run_trigger($action,$object,$user,$lang,$conf) > 0)
  79                          {
  80                              $nbok++;
  81                          }
  82                          else
  83                          {
  84                              $nbko++;
  85                          }
  86                      }
  87                  }
  88              }
  89          }
  90          if ($nbko) return $nbko;
  91          return $nbok;
  92      }
  93  
  94  }
  95  ?>


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