From 86de06cd0f13f095eed43f81280bdbe35cb528c1 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 20 Feb 2006 23:43:46 +0000 Subject: [PATCH] Look: Uniformisation du code --- htdocs/categories/create.php | 19 ++++++-- htdocs/categories/index.php | 28 +++++++---- htdocs/categories/liste.php | 24 +++++++--- .../menus/barre_left/eldy_backoffice.php | 6 +-- .../includes/modules/modCategorie.class.php | 47 +++++++++++-------- 5 files changed, 82 insertions(+), 42 deletions(-) diff --git a/htdocs/categories/create.php b/htdocs/categories/create.php index 030d784859c..103b67819d3 100644 --- a/htdocs/categories/create.php +++ b/htdocs/categories/create.php @@ -1,5 +1,6 @@ +/* Copyright (C) 2005 Matthieu Valleton + * Copyright (C) 2006 Laurent Destailleur * * 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 ''; +print '
'; + +print '
'; -print '
'; ?>
diff --git a/htdocs/categories/index.php b/htdocs/categories/index.php index 96827faac7d..134592b4efa 100644 --- a/htdocs/categories/index.php +++ b/htdocs/categories/index.php @@ -1,6 +1,7 @@ - * Copyright (C) 2005 Éric Seigne +/* Copyright (C) 2005 Matthieu Valleton + * Copyright (C) 2005 Éric Seigne + * Copyright (C) 2006 Laurent Destailleur * * 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 '
'; +print '
'; -print ''; print ''; print ''; print ''; +print $langs->trans("Name").':'; print ''; +print ''; print '
'; +print '
'; $c = new Categorie ($db); @@ -43,9 +55,9 @@ print '
'.$langs->trans("Search").'
'; -print $langs->trans("Name").' :
'; -print $langs->trans("SubCatOf").' :
'; print '
'; diff --git a/htdocs/categories/liste.php b/htdocs/categories/liste.php index c754cc8f3c4..3e7b587e951 100644 --- a/htdocs/categories/liste.php +++ b/htdocs/categories/liste.php @@ -1,5 +1,6 @@ +/* Copyright (C) 2005 Matthieu Valleton + * Copyright (C) 2006 Laurent Destailleur * * 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")); -?> - -
-trans ("CatList")); + +print ''; + +print '
'; + $c = new Categorie ($db); $cats = $c->get_all_categories (); diff --git a/htdocs/includes/menus/barre_left/eldy_backoffice.php b/htdocs/includes/menus/barre_left/eldy_backoffice.php index 1cd462dde14..906dce62f6e 100644 --- a/htdocs/includes/menus/barre_left/eldy_backoffice.php +++ b/htdocs/includes/menus/barre_left/eldy_backoffice.php @@ -1,5 +1,5 @@ +/* Copyright (C) 2005-2006 Laurent Destailleur * * 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); } } diff --git a/htdocs/includes/modules/modCategorie.class.php b/htdocs/includes/modules/modCategorie.class.php index 237ce0fd4b9..21689c959ec 100644 --- a/htdocs/includes/modules/modCategorie.class.php +++ b/htdocs/includes/modules/modCategorie.class.php @@ -1,6 +1,6 @@ - * Copyright (C) 2005 Laurent Destailleur +/* Copyright (C) 2005 Matthieu Valleton + * Copyright (C) 2005-2006 Laurent Destailleur * * 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++; }