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

   1  <?php
   2  /* Copyright (C) 2003-2004 Rodolphe Quiedeville <rodolphe@quiedeville.org>
   3   * Copyright (C) 2004-2005 Laurent Destailleur       <eldy@users.sourceforge.net>
   4   * Copyright (C) 2004      Sebastien Di Cintio       <sdicintio@ressource-toi.org>
   5   * Copyright (C) 2004      Benoit Mortier            <benoit.mortier@opensides.be>
   6   * Copyright (C) 2004      Eric Seigne               <eric.seigne@ryxeo.com>
   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: propale.php,v 1.34 2005/10/13 21:40:43 eldy Exp $
  23   * $Source: /cvsroot/dolibarr/dolibarr/htdocs/admin/propale.php,v $
  24   */
  25  
  26  /**
  27          \file       htdocs/admin/propale.php
  28          \ingroup    propale
  29          \brief      Page d'administration/configuration du module Propale
  30          \version    $Revision: 1.34 $
  31  */
  32  
  33  require ("./pre.inc.php");
  34  
  35  $langs->load("admin");
  36  $langs->load("propal");
  37  
  38  if (!$user->admin)
  39    accessforbidden();
  40  
  41  
  42  if ($_POST["action"] == 'nbprod')
  43  {
  44      dolibarr_set_const($db, "PROPALE_NEW_FORM_NB_PRODUCT",$_POST["value"]);
  45      Header("Location: propale.php");
  46      exit;
  47  }
  48  if ($_GET["action"] == 'set')
  49  {
  50      $sql = "INSERT INTO ".MAIN_DB_PREFIX."propal_model_pdf (nom) VALUES ('".$_GET["value"]."')";
  51  
  52      if ($db->query($sql))
  53      {
  54  
  55      }
  56  }
  57  if ($_GET["action"] == 'del')
  58  {
  59      $sql = "DELETE FROM ".MAIN_DB_PREFIX."propal_model_pdf WHERE nom='".$_GET["value"]."'";
  60  
  61      if ($db->query($sql))
  62      {
  63  
  64      }
  65  }
  66  
  67  
  68  $propale_addon_var_pdf = $conf->global->PROPALE_ADDON_PDF;
  69  
  70  if ($_GET["action"] == 'setpdf')
  71  {
  72      if (dolibarr_set_const($db, "PROPALE_ADDON_PDF",$_GET["value"]))
  73      {
  74          // La constante qui a été lue en avant du nouveau set
  75          // on passe donc par une variable pour avoir un affichage cohérent
  76          $propale_addon_var_pdf = $_GET["value"];
  77      }
  78  
  79      // On active le modele
  80      $sql_del = "delete from ".MAIN_DB_PREFIX."propal_model_pdf where nom = '".$_GET["value"]."';";
  81      $db->query($sql_del);
  82  
  83      $sql = "INSERT INTO ".MAIN_DB_PREFIX."propal_model_pdf (nom) VALUES ('".$_GET["value"]."')";
  84      if ($db->query($sql))
  85      {
  86  
  87      }
  88  }
  89  
  90  $propale_addon_var = $conf->global->PROPALE_ADDON;
  91  
  92  if ($_GET["action"] == 'setmod')
  93  {
  94      // \todo Verifier si module numerotation choisi peut etre activé
  95      // par appel methode canBeActivated
  96  
  97  
  98  
  99      if (dolibarr_set_const($db, "PROPALE_ADDON",$_GET["value"]))
 100      {
 101        // la constante qui a été lue en avant du nouveau set
 102        // on passe donc par une variable pour avoir un affichage cohérent
 103        $propale_addon_var = $_GET["value"];
 104      }
 105  }
 106  
 107  
 108  /*
 109   * Affiche page
 110   */
 111  
 112  $dir = "../includes/modules/propale/";
 113  
 114  
 115  llxHeader('',$langs->trans("PropalSetup"));
 116  
 117  print_titre($langs->trans("PropalSetup"));
 118  
 119  
 120  /*
 121   *  Module numérotation
 122   */
 123  print "<br>";
 124  print_titre($langs->trans("ProposalsNumberingModules"));
 125  
 126  print '<table class="noborder" width="100%">';
 127  print '<tr class="liste_titre">';
 128  print '<td>'.$langs->trans("Name")."</td>\n";
 129  print '<td>'.$langs->trans("Description")."</td>\n";
 130  print '<td nowrap>'.$langs->trans("Example")."</td>\n";
 131  print '<td align="center" width="60">'.$langs->trans("Activated").'</td>';
 132  print '</tr>'."\n";
 133  
 134  clearstatcache();
 135  
 136  $handle = opendir($dir);
 137  if ($handle)
 138  {
 139      $var=true;
 140      while (($file = readdir($handle))!==false)
 141      {
 142          if (substr($file, 0, 12) == 'mod_propale_' && substr($file, strlen($file)-3, 3) == 'php')
 143          {
 144              $file = substr($file, 0, strlen($file)-4);
 145  
 146              require_once(DOL_DOCUMENT_ROOT ."/includes/modules/propale/".$file.".php");
 147  
 148              $modPropale = new $file;
 149  
 150              $var=!$var;
 151              print "<tr ".$bc[$var].">\n  <td width=\"140\">".$file."</td>";
 152              print "\n  <td>".$modPropale->info()."</td>\n";
 153              print "\n  <td nowrap>".$modPropale->getExample()."</td>\n";
 154  
 155              print '<td align="center">';
 156              if ($propale_addon_var == "$file")
 157              {
 158                  $title='';
 159                  if ($modPropale->getNextValue() != $langs->trans("NotAvailable"))
 160                  {
 161                      $title=$langs->trans("NextValue").': '.$modPropale->getNextValue();
 162                  }
 163                  print img_tick($title);
 164              }
 165              else
 166              {
 167                  print "<a href=\"propale.php?action=setmod&amp;value=".$file."\">".$langs->trans("Activate")."</a>";
 168              }
 169              print '</td>';
 170  
 171  
 172              print "</tr>\n";
 173          }
 174      }
 175      closedir($handle);
 176  }
 177  print "</table><br>\n";
 178  
 179  
 180  /*
 181   * PDF
 182   */
 183  
 184  print_titre($langs->trans("ProposalsPDFModules"));
 185  
 186  $def = array();
 187  
 188  $sql = "SELECT nom FROM ".MAIN_DB_PREFIX."propal_model_pdf";
 189  $resql=$db->query($sql);
 190  if ($resql)
 191  {
 192    $i = 0;
 193    $num_rows=$db->num_rows($resql);
 194    while ($i < $num_rows)
 195      {
 196        $array = $db->fetch_array($resql);
 197        array_push($def, $array[0]);
 198        $i++;
 199      }
 200  }
 201  else
 202  {
 203    dolibarr_print_error($db);
 204  }
 205  
 206  $dir = "../includes/modules/propale/";
 207  
 208  print "<table class=\"noborder\" width=\"100%\">\n";
 209  print "<tr class=\"liste_titre\">\n";
 210  print "  <td width=\"140\">".$langs->trans("Name")."</td>\n";
 211  print "  <td>".$langs->trans("Description")."</td>\n";
 212  print '  <td align="center" colspan="2">'.$langs->trans("Activated")."</td>\n";
 213  print '  <td align="center">'.$langs->trans("Default")."</td>\n";
 214  print "</tr>\n";
 215  
 216  clearstatcache();
 217  
 218  $handle=opendir($dir);
 219  
 220  $var=true;
 221  while (($file = readdir($handle))!==false)
 222  {
 223    if (substr($file, strlen($file) -12) == '.modules.php' && substr($file,0,12) == 'pdf_propale_')
 224      {
 225        $name = substr($file, 12, strlen($file) - 24);
 226        $classname = substr($file, 0, strlen($file) -12);
 227  
 228        $var=!$var;
 229        print "<tr ".$bc[$var].">\n  <td>";
 230        print "$name";
 231        print "</td>\n  <td>\n";
 232        require_once($dir.$file);
 233        $obj = new $classname($db);
 234        
 235        print $obj->description;
 236  
 237        print "</td>\n  <td align=\"center\">\n";
 238  
 239        if (in_array($name, $def))
 240      {
 241        print img_tick();
 242        print "</td>\n  <td>";
 243        print '<a href="propale.php?action=del&amp;value='.$name.'">'.$langs->trans("Disable").'</a>';
 244      }
 245        else
 246      {
 247        print "&nbsp;";
 248        print "</td>\n  <td>";
 249        print '<a href="propale.php?action=set&amp;value='.$name.'">'.$langs->trans("Activate").'</a>';
 250      }
 251  
 252        print "</td>\n  <td align=\"center\">";
 253  
 254        if ($propale_addon_var_pdf == "$name")
 255      {
 256        print img_tick();
 257      }
 258        else
 259      {
 260        print '<a href="propale.php?action=setpdf&amp;value='.$name.'">'.$langs->trans("Activate").'</a>';
 261      }
 262        print '</td></tr>';
 263      }
 264  }
 265  closedir($handle);
 266  
 267  print '</table>';
 268  
 269  /*
 270   *  Repertoire
 271   */
 272  print '<br>';
 273  print_titre("Chemins d'accés aux documents");
 274  
 275  print "<table class=\"noborder\" width=\"100%\">\n";
 276  print "<tr class=\"liste_titre\">\n";
 277  print "  <td>".$langs->trans("Name")."</td>\n";
 278  print "  <td>".$langs->trans("Value")."</td>\n";
 279  print "</tr>\n";
 280  print "<tr ".$bc[false].">\n  <td width=\"140\">".$langs->trans("Directory")."</td>\n  <td>".$conf->propal->dir_output."</td>\n</tr>\n";
 281  print "</table>\n<br>";
 282  
 283  
 284  
 285  /*
 286   * Formulaire création
 287   *
 288   */
 289  print_titre($langs->trans("CreateForm"));
 290  
 291  print "<form method=\"post\" action=\"propale.php\">";
 292  print "<input type=\"hidden\" name=\"action\" value=\"nbprod\">";
 293  print "<table class=\"noborder\" width=\"100%\">";
 294  print "<tr class=\"liste_titre\">";
 295  print "  <td>".$langs->trans("Name")."</td>\n";
 296  print "  <td align=\"left\">".$langs->trans("Value")."</td>\n";
 297  print "  <td>&nbsp;</td>\n";
 298  print "</tr><tr ".$bc[false].">";
 299  print '<td>'.$langs->trans("NumberOfProductLines").'</td>';
 300  print "<td align=\"left\"><input size=\"3\" class=\"flat\" type=\"text\" name=\"value\" value=\"".PROPALE_NEW_FORM_NB_PRODUCT."\"></td>";
 301  print '<td><input type="submit" class="button" value="'.$langs->trans("Modify").'"></td>';
 302  print '</tr>';
 303  print '</table>';
 304  print '</form>';
 305  
 306  $db->close();
 307  
 308  llxFooter();
 309  ?>


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