Look: Uniformisation du code

This commit is contained in:
Laurent Destailleur 2006-02-20 23:43:46 +00:00
parent 8b88e72fb2
commit 86de06cd0f
5 changed files with 82 additions and 42 deletions

View File

@ -1,5 +1,6 @@
<?php
/* Copyright (C) 2005 Matthieu Valleton <mv@seeschloss.org>
/* Copyright (C) 2005 Matthieu Valleton <mv@seeschloss.org>
* Copyright (C) 2006 Laurent Destailleur <eldy@users.sourceforge.net>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@ -19,6 +20,12 @@
* $Source$
*/
/**
\file htdocs/categories/create.php
\ingroup categorie
\brief Page creation nouvelle categorie
*/
require "./pre.inc.php";
if (!$user->rights->categorie->creer) accessforbidden();
@ -32,13 +39,17 @@ else
$nbcats = 1;
}
llxHeader("","",$langs->trans("Categories"));
print_titre($langs->trans("CreateCat"));
print_fiche_titre($langs->trans("CreateCat"));
print '<table border="0" width="100%">';
print '<table border="0" width="100%" class="notopnoleftnoright">';
print '<tr><td valign="top" width="30%" class="notopnoleft">';
print '<tr><td valign="top" width="30%">';
?>
<form method="post" action="<?php print $_SERVER['REQUEST_URI']; ?>">
<table class="border">

View File

@ -1,6 +1,7 @@
<?php
/* Copyright (C) 2005 Matthieu Valleton <mv@seeschloss.org>
* Copyright (C) 2005 Éric Seigne <eric.seigne@ryxeo.com>
/* Copyright (C) 2005 Matthieu Valleton <mv@seeschloss.org>
* Copyright (C) 2005 Éric Seigne <eric.seigne@ryxeo.com>
* Copyright (C) 2006 Laurent Destailleur <eldy@users.sourceforge.net>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@ -15,22 +16,33 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*
* $Id$
* $Source$
*/
/**
\file htdocs/categories/index.php
\ingroup categorie
\brief Page accueil espace categories
*/
require "./pre.inc.php";
if (!$user->rights->categorie->lire) accessforbidden();
/**
* Affichage page accueil
*/
llxHeader("","",$langs->trans("Categories"));
print_titre($langs->trans("CategoriesArea"));
print_fiche_titre($langs->trans("CategoriesArea"));
print '<table border="0" width="100%">';
print '<table border="0" width="100%" class="notopnoleftnoright">';
print '<tr><td valign="top" width="30%">';
print '<tr><td valign="top" width="30%" class="notopnoleft">';
$c = new Categorie ($db);
@ -43,9 +55,9 @@ print '<tr class="liste_titre">';
print '<td colspan="3">'.$langs->trans("Search").'</td>';
print '</tr>';
print '<tr '.$bc[0].'><td>';
print $langs->trans("Name").'&nbsp;:</td><td><input class="flat" type="text" size="20" name="catname" value="' . $_POST['catname'] . '"/></td><td><input type="submit" value="'.$langs->trans ("Search").'"></td></tr>';
print $langs->trans("Name").':</td><td><input class="flat" type="text" size="20" name="catname" value="' . $_POST['catname'] . '"/></td><td><input type="submit" class="button" value="'.$langs->trans ("Search").'"></td></tr>';
print '<tr '.$bc[0].'><td>';
print $langs->trans("SubCatOf").'&nbsp;:</td><td><select class="flat" name="subcatof" />';
print $langs->trans("SubCatOf").':</td><td><select class="flat" name="subcatof" />';
print '<option value="-1">'.$langs->trans("Choose").'</option>';
$cats = $c->get_all_meres ();
@ -55,7 +67,7 @@ foreach ($cats as $cat)
print "<option value='".$cat->id."'>".htmlentities ($cat->label, ENT_QUOTES)."</option>\n";
}
print '</select></td><td><input type="submit" value="'.$langs->trans ("Search").'"></td></tr>';
print '</select></td><td><input type="submit" class="button" value="'.$langs->trans ("Search").'"></td></tr>';
print '</table></form>';
print '</td><td valign="top" width="70%">';

View File

@ -1,5 +1,6 @@
<?php
/* Copyright (C) 2005 Matthieu Valleton <mv@seeschloss.org>
/* Copyright (C) 2005 Matthieu Valleton <mv@seeschloss.org>
* Copyright (C) 2006 Laurent Destailleur <eldy@users.sourceforge.net>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@ -14,18 +15,29 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*
* $Id$
* $Source$
*/
/**
\file htdocs/categories/liste.php
\ingroup categorie
\brief Page liste des categories
*/
require "./pre.inc.php";
llxHeader ("","",$langs->trans("Categories"));
print_titre ($langs->trans ("CatList"));
?>
<table border="0" width="100%">
<tr><td valign="top" width="30%">
<?php
print_fiche_titre ($langs->trans ("CatList"));
print '<table border="0" width="100%" class="notopnoleftnoright">';
print '<tr><td valign="top" width="30%" class="notopnoleft">';
$c = new Categorie ($db);
$cats = $c->get_all_categories ();

View File

@ -1,5 +1,5 @@
<?php
/* Copyright (C) 2005 Laurent Destailleur <eldy@users.sourceforge.net>
/* Copyright (C) 2005-2006 Laurent Destailleur <eldy@users.sourceforge.net>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@ -467,7 +467,6 @@ class MenuLeft {
if ($conf->stock->enabled)
{
// \todo mettre droits pour module stock
$newmenu->add(DOL_URL_ROOT."/product/stock/index.php?leftmenu=stock", $langs->trans("Stock"), 0, $user->rights->stock->lire);
if ($leftmenu=="stock") $newmenu->add_submenu(DOL_URL_ROOT."/product/stock/fiche.php?action=create", $langs->trans("NewWarehouse"), 1, $user->rights->stock->creer);
if ($leftmenu=="stock") $newmenu->add_submenu(DOL_URL_ROOT."/product/stock/liste.php", $langs->trans("List"), 1, $user->rights->stock->lire);
@ -478,12 +477,11 @@ class MenuLeft {
$langs->load("categories");
{
$newmenu->add(DOL_URL_ROOT."/categories/index.php?leftmenu=cat", $langs->trans("Categories"), 0, $user->rights->categorie->lire);
if ($leftmenu=="cat") $newmenu->add_submenu(DOL_URL_ROOT."/categories/liste.php", $langs->trans("List"), 1, $user->rights->categorie->lire);
if ($user->societe_id == 0)
{
if ($leftmenu=="cat") $newmenu->add_submenu(DOL_URL_ROOT."/categories/create.php", $langs->trans("NewCat"), 1, $user->rights->categorie->creer);
}
if ($leftmenu=="cat") $newmenu->add_submenu(DOL_URL_ROOT."/categories/liste.php", $langs->trans("List"), 1, $user->rights->categorie->lire);
}
}

View File

@ -1,6 +1,6 @@
<?php
/* Copyright (C) 2005 Matthieu Valleton <mv@seeschloss.org>
* Copyright (C) 2005 Laurent Destailleur <eldy@users.sourceforge.net>
/* Copyright (C) 2005 Matthieu Valleton <mv@seeschloss.org>
* Copyright (C) 2005-2006 Laurent Destailleur <eldy@users.sourceforge.net>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@ -15,6 +15,9 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*
* $Id$
* $Source$
*/
/**
@ -50,8 +53,8 @@ class modCategorie extends DolibarrModules
$this->family = "products";
$this->name = "Catégorie";
$this->description = "Gestion des catégories";
$this->version = 'experimental'; // 'experimental' or 'dolibarr' or version
$this->description = "Gestion des catégories de produits";
$this->version = 'experimental'; // 'development' or 'experimental' or 'dolibarr' or version
$this->const_name = 'MAIN_MODULE_CATEGORIE';
$this->special = 0;
$this->picto = '';
@ -72,24 +75,28 @@ class modCategorie extends DolibarrModules
$this->rights = array();
$this->rights_class = 'categorie';
$this->rights[0][0] = 241; // id de la permission
$this->rights[0][1] = 'Lire les catégories'; // libelle de la permission
$this->rights[0][2] = 'r'; // type de la permission (déprécié à ce jour)
$this->rights[0][3] = 1; // La permission est-elle une permission par défaut
$this->rights[0][4] = 'lire';
$r=0;
$this->rights[1][0] = 242; // id de la permission
$this->rights[1][1] = 'Créer/modifier les catégories'; // libelle de la permission
$this->rights[1][2] = 'w'; // type de la permission (déprécié à ce jour)
$this->rights[1][3] = 0; // La permission est-elle une permission par défaut
$this->rights[1][4] = 'creer';
$this->rights[2][0] = 243; // id de la permission
$this->rights[2][1] = 'Supprimer les catégories'; // libelle de la permission
$this->rights[2][2] = 'd'; // type de la permission (déprécié à ce jour)
$this->rights[2][3] = 0; // La permission est-elle une permission par défaut
$this->rights[2][4] = 'supprimer';
$this->rights[$r][0] = 241; // id de la permission
$this->rights[$r][1] = 'Lire les catégories'; // libelle de la permission
$this->rights[$r][2] = 'r'; // type de la permission (déprécié à ce jour)
$this->rights[$r][3] = 1; // La permission est-elle une permission par défaut
$this->rights[$r][4] = 'lire';
$r++;
$this->rights[$r][0] = 242; // id de la permission
$this->rights[$r][1] = 'Créer/modifier les catégories'; // libelle de la permission
$this->rights[$r][2] = 'w'; // type de la permission (déprécié à ce jour)
$this->rights[$r][3] = 0; // La permission est-elle une permission par défaut
$this->rights[$r][4] = 'creer';
$r++;
$this->rights[$r][0] = 243; // id de la permission
$this->rights[$r][1] = 'Supprimer les catégories'; // libelle de la permission
$this->rights[$r][2] = 'd'; // type de la permission (déprécié à ce jour)
$this->rights[$r][3] = 0; // La permission est-elle une permission par défaut
$this->rights[$r][4] = 'supprimer';
$r++;
}