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

   1  <?php
   2  /* Copyright (C) 2003 Rodolphe Quiedeville <rodolphe@quiedeville.org>
   3   * Copyright (C) 2003 Jean-Louis Bergamo   <jlb@j1b.org>
   4   * Copyright (C) 2004 Laurent Destailleur  <eldy@users.sourceforge.net>
   5   * Copyright (C) 2004 Sebastien Di Cintio  <sdicintio@ressource-toi.org>
   6   * Copyright (C) 2004 Benoit Mortier              <benoit.mortier@opensides.be>
   7   *
   8   * This program is free software; you can redistribute it and/or modify
   9   * it under the terms of the GNU General Public License as published by
  10   * the Free Software Foundation; either version 2 of the License, or
  11   * (at your option) any later version.
  12   *
  13   * This program is distributed in the hope that it will be useful,
  14   * but WITHOUT ANY WARRANTY; without even the implied warranty of
  15   * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  16   * GNU General Public License for more details.
  17   *
  18   * You should have received a copy of the GNU General Public License
  19   * along with this program; if not, write to the Free Software
  20   * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
  21   *
  22   * $Id: adherent.php,v 1.27 2005/08/11 18:51:38 eldy Exp $
  23   * $Source: /cvsroot/dolibarr/dolibarr/htdocs/admin/adherent.php,v $
  24   */
  25  
  26  /**
  27          \file       htdocs/admin/adherent.php
  28          \ingroup    adherent
  29          \brief      Page d'administration/configuration du module Adherent
  30          \version    $Revision: 1.27 $
  31  */
  32  
  33  require ("./pre.inc.php");
  34  
  35  $langs->load("admin");
  36  $langs->load("members");
  37  
  38  if (!$user->admin)
  39    accessforbidden();
  40  
  41  
  42  // positionne la variable pour le test d'affichage de l'icone
  43  
  44  $main_use_mailman = ADHERENT_USE_MAILMAN;
  45  $main_use_glasnost = ADHERENT_USE_GLASNOST;
  46  $main_use_glasnost_auto = ADHERENT_USE_GLASNOST_AUTO;
  47  $main_use_spip = ADHERENT_USE_SPIP;
  48  $main_use_spip_auto = ADHERENT_USE_SPIP_AUTO;
  49  
  50  $typeconst=array('yesno','texte','chaine');
  51  $var=True;
  52  
  53  
  54  // Action mise a jour ou ajout d'une constante
  55  if ($_POST["action"] == 'update' || $_POST["action"] == 'add')
  56  {
  57    if (isset($_POST["consttype"]) && $_POST["consttype"] != '')
  58      {
  59          $sql = "DELETE FROM ".MAIN_DB_PREFIX."const WHERE name = '".$_POST["constname"]."';";
  60          $db->query($sql);
  61          $sql = '';
  62          $sql = "INSERT INTO ".MAIN_DB_PREFIX."const (name,value,type,visible,note) VALUES ('".$_POST["constname"]."','".$_POST["constvalue"]."','".$typeconst[$_POST["consttype"]]."',0,'".$_POST["constnote"]."') ;";
  63  
  64    }
  65      else
  66      {
  67          $sql = "DELETE FROM ".MAIN_DB_PREFIX."const WHERE name = '".$_POST["constname"]."';";
  68          $db->query($sql);
  69          $sql ='';
  70          $sql = "INSERT INTO ".MAIN_DB_PREFIX."const (name,value,visible,note) VALUES ('".$_POST["constname"]."','".$_POST["constvalue"]."',0,'".$_POST["constnote"]."') ;";
  71    }
  72    
  73    if ($db->query($sql))
  74      {
  75        Header("Location: adherent.php");
  76      }
  77    
  78  }
  79  
  80  // Action activation d'un sous module du module adhérent
  81  if ($_GET["action"] == 'set')
  82  {
  83      $sql = "DELETE FROM ".MAIN_DB_PREFIX."const WHERE name = '".$_GET["name"]."' ;";
  84      $result=$db->query($sql);
  85      if (! $result) {
  86          dolibarr_print_error($db);
  87          exit;
  88      }
  89      
  90      $sql ='';
  91      $sql = "INSERT INTO ".MAIN_DB_PREFIX."const(name,value,visible) values ('".$_GET["name"]."','".$_GET["value"]."', 0);";
  92      
  93      $result=$db->query($sql);
  94      if ($result)
  95      {
  96          Header("Location: adherent.php");
  97      }
  98      else {
  99          dolibarr_print_error($db);   
 100          exit;
 101      }
 102  }
 103  
 104  // Action désactivation d'un sous module du module adhérent
 105  if ($_GET["action"] == 'unset')
 106  {
 107    $sql = "DELETE FROM ".MAIN_DB_PREFIX."const WHERE name = '".$_GET["name"]."'";
 108  
 109    if ($db->query($sql))
 110      {
 111        Header("Location: adherent.php");
 112      }
 113  }
 114  
 115  llxHeader();
 116  
 117  /*
 118   * Interface de configuration de certaines variables de la partie adherent
 119   */
 120  
 121  print_titre($langs->trans("MembersSetup"));
 122  print "<br>";
 123  
 124  
 125  print_fiche_titre($langs->trans("MemberMainOptions"));
 126  print '<table class="noborder" width="100%">';
 127  print '<tr class="liste_titre">';
 128  print '<td>'.$langs->trans("Description").'</td>';
 129  print '<td>'.$langs->trans("Value").'</td>';
 130  print '<td align="center">'.$langs->trans("Action").'</td>';
 131  print "</tr>\n";
 132  $var=true;
 133  $form = new Form($db);
 134  
 135  // Mail obligatoire
 136  $var=!$var;
 137  print '<form action="adherent.php" method="POST">';
 138  print '<input type="hidden" name="action" value="update">';
 139  print '<input type="hidden" name="rowid" value="'.$rowid.'">';
 140  print '<input type="hidden" name="constname" value="ADHERENT_MAIL_REQUIRED">';
 141  print "<tr $bc[$var] class=value><td>".$langs->trans("AdherentMailRequired").'</td><td>';
 142  $form->selectyesnonum('constvalue',ADHERENT_MAIL_REQUIRED);
 143  print '</td><td align="center" width="80">';
 144  print '<input type="Submit" value="'.$langs->trans("Update").'" name="Button">';
 145  print "</td></tr>\n";
 146  print '</form>';
 147  
 148  // Insertion cotisations dans compte financier
 149  if ($conf->banque->enabled)
 150  {
 151      $var=!$var;
 152      print '<form action="adherent.php" method="POST">';
 153      print '<input type="hidden" name="action" value="update">';
 154      print '<input type="hidden" name="rowid" value="'.$rowid.'">';
 155      print '<input type="hidden" name="constname" value="ADHERENT_BANK_USE">';
 156      print "<tr $bc[$var] class=value><td>".$langs->trans("AddSubscriptionIntoAccount").'</td><td>';
 157      $form->selectyesnonum('constvalue',ADHERENT_BANK_USE);
 158      print '</td><td align="center" width="80">';
 159      print '<input type="Submit" value="'.$langs->trans("Update").'" name="Button">';
 160      print "</td></tr>\n";
 161      print '</form>';
 162  }
 163  print '</table>';
 164  print '<br>';
 165  
 166  /*
 167   * Mailman
 168   */
 169  if (defined("ADHERENT_USE_MAILMAN") && ADHERENT_USE_MAILMAN == 1)
 170  {
 171    $lien=img_tick().' ';
 172    $lien.='<a href="adherent.php?action=unset&value=0&name=ADHERENT_USE_MAILMAN">'.$langs->trans("Disable").'</a>';
 173    // Edition des varibales globales rattache au theme Mailman 
 174    $constantes=array('ADHERENT_MAILMAN_LISTS',
 175              'ADHERENT_MAILMAN_LISTS_COTISANT',
 176              'ADHERENT_MAILMAN_ADMINPW',
 177              'ADHERENT_MAILMAN_SERVER',
 178              'ADHERENT_MAILMAN_UNSUB_URL',
 179              'ADHERENT_MAILMAN_URL'
 180              );
 181    print_fiche_titre("Mailman - Système de mailing listes",$lien);
 182    form_constantes($constantes);
 183  }
 184  else
 185  {
 186    $lien='<a href="adherent.php?action=set&value=1&name=ADHERENT_USE_MAILMAN">'.$langs->trans("Activate").'</a>';
 187    print_fiche_titre("Mailman - Système de mailing listes",$lien);
 188  }
 189  
 190  print "<hr>\n";
 191  
 192  /*
 193   * Spip
 194   */
 195  $var=!$var;
 196  if (defined("ADHERENT_USE_SPIP") && ADHERENT_USE_SPIP == 1)
 197  {
 198    $lien=img_tick().' ';
 199    $lien.='<a href="adherent.php?action=unset&value=0&name=ADHERENT_USE_SPIP">'.$langs->trans("Disable").'</a>';
 200    // Edition des varibales globales rattache au theme Mailman 
 201    $constantes=array('ADHERENT_USE_SPIP_AUTO',
 202              'ADHERENT_SPIP_SERVEUR',
 203              'ADHERENT_SPIP_DB',
 204              'ADHERENT_SPIP_USER',
 205              'ADHERENT_SPIP_PASS'
 206              );
 207    print_fiche_titre("SPIP - Système de publication en ligne",$lien);
 208    form_constantes($constantes);
 209  }
 210  else
 211  {
 212    $lien='<a href="adherent.php?action=set&value=1&name=ADHERENT_USE_SPIP">'.$langs->trans("Activate").'</a>';
 213    print_fiche_titre("SPIP - Système de publication en ligne",$lien);
 214  }
 215  
 216  print "<hr>\n";
 217  
 218  /*
 219   * Glasnost
 220   */
 221  $var=!$var;
 222  if (defined("ADHERENT_USE_GLASNOST") && ADHERENT_USE_GLASNOST == 1)
 223  {
 224    $lien=img_tick().' ';
 225    $lien.='<a href="adherent.php?action=unset&value=0&name=ADHERENT_USE_GLASNOST">'.$langs->trans("Disable").'</a>';
 226    // Edition des varibales globales rattache au theme Mailman 
 227    $constantes=array('ADHERENT_USE_GLASNOST_AUTO',
 228              'ADHERENT_GLASNOST_SERVEUR',
 229              'ADHERENT_GLASNOST_USER',
 230              'ADHERENT_GLASNOST_PASS'
 231              );
 232    print_fiche_titre("Glasnost - Système de vote en ligne",$lien);
 233    form_constantes($constantes);
 234  }
 235  else
 236  {
 237    $lien='<a href="adherent.php?action=set&value=1&name=ADHERENT_USE_GLASNOST">'.$langs->trans("Activate").'</a>';
 238    print_fiche_titre("Glasnost - Système de vote en ligne",$lien);
 239  }
 240  
 241  print "<hr>\n";
 242  
 243  /*
 244   * Edition des varibales globales non rattache a un theme specifique 
 245   */
 246  $constantes=array(
 247            'ADHERENT_TEXT_NEW_ADH',
 248            'ADHERENT_MAIL_COTIS_SUBJECT',
 249            'ADHERENT_MAIL_COTIS',
 250            'ADHERENT_MAIL_EDIT_SUBJECT',
 251            'ADHERENT_MAIL_EDIT',
 252            'ADHERENT_MAIL_NEW_SUBJECT',
 253            'ADHERENT_MAIL_NEW',
 254            'ADHERENT_MAIL_RESIL_SUBJECT',
 255            'ADHERENT_MAIL_RESIL',
 256            'ADHERENT_MAIL_VALID_SUBJECT',
 257            'ADHERENT_MAIL_VALID',
 258            'ADHERENT_MAIL_FROM',
 259            'ADHERENT_CARD_HEADER_TEXT',
 260            'ADHERENT_CARD_TEXT',
 261            'ADHERENT_CARD_FOOTER_TEXT',
 262            'ADHERENT_ETIQUETTE_TYPE'
 263            );
 264  print_fiche_titre("Autres variables globales");
 265  form_constantes($constantes);
 266  
 267  
 268  $db->close();
 269  
 270  print '<br>';
 271  
 272  
 273  llxFooter();
 274  
 275  
 276  function form_constantes($tableau){
 277    // Variables globales
 278    global $db,$bc,$langs;
 279    $form = new Form($db);
 280    print '<table class="noborder" width="100%">';
 281    print '<tr class="liste_titre">';
 282    print '<td>'.$langs->trans("Description").'</td>';
 283    print '<td>'.$langs->trans("Value").'</td>';
 284    print '<td>'.$langs->trans("Type").'</td>';
 285    print '<td align="center" width="80">'.$langs->trans("Action").'</td>';
 286    print "</tr>\n";
 287    $var=true;
 288    
 289    foreach($tableau as $const){
 290      $sql = "SELECT rowid, name, value, type, note FROM ".MAIN_DB_PREFIX."const WHERE name='$const'";
 291      $result = $db->query($sql);
 292      if ($result && ($db->num_rows() == 1)) {
 293        $obj = $db->fetch_object($result);
 294        $var=!$var;
 295        print '<form action="adherent.php" method="POST">';
 296        print '<input type="hidden" name="action" value="update">';
 297        print '<input type="hidden" name="rowid" value="'.$rowid.'">';
 298        print '<input type="hidden" name="constname" value="'.$obj->name.'">';
 299        print '<input type="hidden" name="constnote" value="'.stripslashes(nl2br($obj->note)).'">';
 300        
 301        print "<tr $bc[$var] class=value><td>".stripslashes(nl2br($obj->note))."</td>\n";
 302        
 303        print '<td>';
 304        if ($obj->type == 'yesno')
 305      {
 306        $form->selectyesnonum('constvalue',$obj->value);
 307        print '</td><td>';
 308        $form->select_array('consttype',array('yesno','texte','chaine'),0);
 309      }
 310        elseif ($obj->type == 'texte')
 311      {
 312        print '<textarea name="constvalue" cols="35" rows="5"wrap="soft">';
 313        print $obj->value;
 314        print "</textarea>\n";
 315        print '</td><td>';
 316        $form->select_array('consttype',array('yesno','texte','chaine'),1);
 317      }
 318        else
 319      {
 320        print '<input type="text" size="30" name="constvalue" value="'.stripslashes($obj->value).'">';
 321        print '</td><td>';
 322        $form->select_array('consttype',array('yesno','texte','chaine'),2);
 323      }
 324        print '</td><td align="center">';
 325        
 326        print '<input type="Submit" value="'.$langs->trans("Update").'" name="Button"> &nbsp;';
 327  //      print '<a href="adherent.php?name='.$const.'&action=unset">'.img_delete().'</a>';
 328        print "</td></tr>\n";
 329        
 330        print '</form>';
 331        $i++;
 332      }    
 333    }
 334    print '</table>';
 335  }
 336  
 337  ?>


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