[ 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/admin/ -> triggers.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: triggers.php,v 1.4 2005/10/22 13:46:24 eldy Exp $
  19   * $Source: /cvsroot/dolibarr/dolibarr/htdocs/admin/triggers.php,v $
  20   */
  21   
  22  /**
  23          \file       htdocs/admin/triggers.php
  24          \brief      Page de configuration et activation des triggers
  25          \version    $Revision: 1.4 $
  26  */
  27  
  28  require ("./pre.inc.php");
  29  
  30  if (!$user->admin)
  31      accessforbidden();
  32  
  33  
  34  
  35  if ($_GET["action"] == 'set' && $user->admin)
  36  {
  37      Activate($_GET["value"]);
  38  
  39      Header("Location: modules.php?spe=".$_GET["spe"]);
  40  }
  41  
  42  if ($_GET["action"] == 'reset' && $user->admin)
  43  {
  44      UnActivate($_GET["value"]);
  45  
  46      Header("Location: modules.php?spe=".$_GET["spe"]);
  47  }
  48  
  49  
  50  /**     \brief      Active un module
  51          \param      value   Nom du module a activer
  52  */
  53  function Activate($value)
  54  {
  55      global $db, $modules;
  56  
  57      $modName = $value;
  58  
  59      // Activation du module
  60      if ($modName)
  61      {
  62          $file = $modName . ".class.php";
  63          include_once("../includes/modules/$file");
  64          $objMod = new $modName($db);
  65          $objMod->init();
  66      }
  67  
  68      // Activation des modules dont le module dépend
  69      for ($i = 0; $i < sizeof($objMod->depends); $i++)
  70      {
  71          Activate($objMod->depends[$i]);
  72      }
  73  
  74  }
  75  
  76  
  77  /**     \brief      Désactive un module
  78          \param      value   Nom du module a désactiver
  79  */
  80  function UnActivate($value)
  81  {
  82      global $db, $modules;
  83  
  84      $modName = $value;
  85  
  86      // Desactivation du module
  87      if ($modName)
  88      {
  89          $file = $modName . ".class.php";
  90          include_once("../includes/modules/$file");
  91          $objMod = new $modName($db);
  92          $objMod->remove();
  93      }
  94  
  95      // Desactivation des modules qui dependent de lui
  96      for ($i = 0; $i < sizeof($objMod->requiredby); $i++)
  97      {
  98          UnActivate($objMod->requiredby[$i]);
  99      }
 100  
 101      Header("Location: modules.php");
 102  }
 103  
 104  
 105  
 106  llxHeader("","");
 107  
 108  
 109  print_fiche_titre($langs->trans("TriggersAvailable"));
 110  
 111  print $langs->trans("TriggersDesc")."<br>";
 112  print "<br>\n";
 113  
 114  print "<table class=\"noborder\" width=\"100%\">\n";
 115  print "<tr class=\"liste_titre\">\n";
 116  print "  <td colspan=\"2\">".$langs->trans("File")."</td>\n";
 117  print "  <td>".$langs->trans("Description")."</td>\n";
 118  print "  <td align=\"center\">".$langs->trans("Version")."</td>\n";
 119  print "  <td align=\"center\">".$langs->trans("Activated")."</td>\n";
 120  //print "  <td align=\"center\">".$langs->trans("Action")."</td>\n";
 121  print "  <td align=\"center\">&nbsp;</td>\n";
 122  print "</tr>\n";
 123  
 124  
 125  $dir = DOL_DOCUMENT_ROOT . "/includes/triggers/";
 126  
 127  $handle=opendir($dir);
 128  $files = array();
 129  $modules = array();
 130  $orders = array();
 131  $i = 0;
 132  $j = 0;
 133  while (($file = readdir($handle))!==false)
 134  {
 135      if (is_readable($dir.$file) && ereg('^interface_(.*)\.class\.php',$file,$reg))
 136      {
 137          $modName = 'Interface'.ucfirst($reg[1]);
 138          if ($modName)
 139          {
 140              include_once($dir.$file);
 141              $objMod = new $modName($db);
 142  
 143              $modules[$i] = $modName;
 144              $files[$i] = $file;
 145              $orders[$i] = "$objMod->family";   // Tri par famille
 146              $j++;
 147              $i++;
 148          }
 149      }
 150  }
 151  
 152  asort($orders);
 153  $var=True;
 154  
 155  foreach ($orders as $key => $value)
 156  {
 157      $tab=split('_',$value);
 158      $family=$tab[0]; $numero=$tab[1];
 159  
 160      $modName = $modules[$key];
 161      if ($modName)
 162      {
 163          $objMod = new $modName($db);
 164      }
 165  
 166      $const_name = $objMod->const_name;
 167  
 168      $var=!$var;
 169      
 170      print "<tr $bc[$var]>\n";
 171      
 172      print '<td valign="top" width="14" align="center">';
 173      print $objMod->picto?img_object('',$objMod->picto):img_object('','generic');
 174      print '</td><td valign="top">'.$files[$key];
 175      print "</td>\n  <td valign=\"top\">";
 176      print $objMod->getDesc();
 177      print "</td>\n  <td valign=\"top\" align=\"center\">";
 178      print $objMod->getVersion();
 179      print "</td>\n  <td valign=\"top\" align=\"center\">";
 180      
 181      // \todo Activation trigger
 182      $statut_trigger=1;
 183      
 184      if ($statut_trigger == 1)
 185      {
 186          print img_tick();
 187      }
 188      else
 189      {
 190          print "&nbsp;";
 191      }
 192      
 193      print "</td>\n";
 194      
 195  /*
 196          print "<td valign=\"top\" align=\"center\">";
 197          if ($const_value == 1)
 198        {
 199              // Module actif
 200              print "<a href=\"modules.php?id=".$objMod->numero."&amp;action=reset&amp;value=" . $modName . "&amp;spe=" . $_GET["spe"] . "\">" . $langs->trans("Disable") . "</a></td>\n";
 201          }
 202          else
 203        {
 204              // Module non actif
 205              print "<a href=\"modules.php?id=".$objMod->numero."&amp;action=set&amp;value=" . $modName . "&amp;spe=" . $_GET["spe"] . "\">" . $langs->trans("Activate") . "</a></td>\n";
 206        }
 207  */
 208      print "<td>&nbsp;</td>\n";    
 209      print "</tr>\n";
 210      
 211  }
 212  print "</table>\n";
 213  
 214  
 215  llxFooter('$Date: 2005/10/22 13:46:24 $ - $Revision: 1.4 $');
 216  ?>


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