From 5de40f70bcf0be5f6faa7a365c01be6de09e9889 Mon Sep 17 00:00:00 2001 From: Rodolphe Quiedeville Date: Sat, 15 Nov 2003 17:42:11 +0000 Subject: [PATCH] Nouvelle syntaxe --- htdocs/includes/modules/modAdherent.class.php | 11 +- htdocs/includes/modules/modBoutique.class.php | 34 ++-- .../modules/modDolibarrModules.class.php | 174 ------------------ htdocs/includes/modules/modDon.class.php | 27 ++- .../includes/modules/modExternalRss.class.php | 1 + htdocs/includes/modules/modPostnuke.class.php | 3 + htdocs/includes/modules/modSociete.class.php | 2 - 7 files changed, 53 insertions(+), 199 deletions(-) delete mode 100644 htdocs/includes/modules/modDolibarrModules.class.php diff --git a/htdocs/includes/modules/modAdherent.class.php b/htdocs/includes/modules/modAdherent.class.php index bda4b8f4f12..bd2e8d48f61 100644 --- a/htdocs/includes/modules/modAdherent.class.php +++ b/htdocs/includes/modules/modAdherent.class.php @@ -21,9 +21,9 @@ * */ -include_once "modDolibarrModules.class.php"; +include_once "DolibarrModules.class.php"; -class modAdherent extends modDolibarrModules +class modAdherent extends DolibarrModules { /* @@ -36,6 +36,13 @@ class modAdherent extends modDolibarrModules $this->db = $DB ; $this->depends = array(); + $this->name = "Adhérents"; + $this->description = "Gestion des adhérents d'une association"; + $this->const_name = "MAIN_MODULE_ADHERENT"; + $this->const_config = MAIN_MODULE_ADHERENT; + + $this->config_page_url = "adherent.php"; + $this->const = array(); $this->boxes = array(); diff --git a/htdocs/includes/modules/modBoutique.class.php b/htdocs/includes/modules/modBoutique.class.php index 0a935b12a00..5bbcf67f768 100644 --- a/htdocs/includes/modules/modBoutique.class.php +++ b/htdocs/includes/modules/modBoutique.class.php @@ -20,7 +20,9 @@ * */ -class modBoutique +include_once "DolibarrModules.class.php"; + +class modBoutique extends DolibarrModules { /* @@ -31,27 +33,36 @@ class modBoutique Function modBoutique($DB) { $this->db = $DB ; + + $this->name = "Boutique"; + $this->description = "Gestion des boutiques"; + $this->const_name = "MAIN_MODULE_BOUTIQUE"; + $this->const_config = MAIN_MODULE_BOUTIQUE; + + $this->depends = array(); + + $this->const = array(); + $this->boxes = array(); + /* + * Boites + */ + $this->boxes[0][0] = "Livres"; + $this->boxes[0][1] = "box_boutique_livre.php"; } /* * * * */ - Function init() { /* * Activation du module */ - $sql = array( - "REPLACE INTO llx_boxes_def (name,file) VALUES('Livres', 'box_boutique_livre.php');" - ); + $sql = array(); - for ($i = 0 ; $i < sizeof($sql) ; $i++) - { - $this->db->query($sql[$i]); - } + return $this->_init($sql); } /* * @@ -59,8 +70,9 @@ class modBoutique */ Function remove() { - $sql = "DELETE FROM llx_boxes_def WHERE file = 'box_boutique_livre.php';"; - $this->db->query($sql); + $sql = array(); + + return $this->_remove($sql); } } ?> diff --git a/htdocs/includes/modules/modDolibarrModules.class.php b/htdocs/includes/modules/modDolibarrModules.class.php deleted file mode 100644 index c7363f8b92f..00000000000 --- a/htdocs/includes/modules/modDolibarrModules.class.php +++ /dev/null @@ -1,174 +0,0 @@ - - * - * 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 - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * 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$ - * - */ - -class modDolibarrModules -{ - - /* - * Initialisation - * - */ - - Function modDolibarrModules($DB) - { - $this->db = $DB ; - } - /* - * - * - * - */ - - Function _init($array_sql) - { - /* - * Activation du module - */ - $err = 0; - - foreach ($this->boxes as $key => $value) - { - $titre = $this->boxes[$key][0]; - $file = $this->boxes[$key][1]; - - $sql = "SELECT count(*) FROM llx_boxes_def WHERE name ='".$titre."'"; - - if ( $this->db->query($sql) ) - { - $row = $this->db->fetch_row($sql); - if ($row[0] == 0) - { - $sql = "insert into llx_boxes_def (name, file) values ('".$titre."','".$file."')"; - if (! $this->db->query($sql) ) - { - $err++; - } - } - } - else - { - $err++; - } - } - - foreach ($this->const as $key => $value) - { - $name = $this->const[$key][0]; - $type = $this->const[$key][1]; - $val = $this->const[$key][2]; - $note = $this->const[$key][3]; - - $sql = "SELECT count(*) FROM llx_const WHERE name ='".$name."'"; - - if ( $this->db->query($sql) ) - { - $row = $this->db->fetch_row($sql); - - if ($row[0] == 0) - { - if (strlen($note)){ - $sql = "INSERT INTO llx_const (name,type,value,note) VALUES ('".$name."','".$type."','".$val."','$note')"; - }elseif (strlen($val)) - { - $sql = "INSERT INTO llx_const (name,type,value) VALUES ('".$name."','".$type."','".$val."')"; - } - else - { - $sql = "INSERT INTO llx_const (name,type) VALUES ('".$name."','".$type."')"; - } - - if (! $this->db->query($sql) ) - { - $err++; - } - } - } - else - { - $err++; - } - } - - - /* - * - */ - - for ($i = 0 ; $i < sizeof($array_sql) ; $i++) - { - if (! $this->db->query($array_sql[$i])) - { - $err++; - } - } - - if ($err > 0) - { - return 0; - } - else - { - return 1; - } - } - /* - * - * - */ - Function _remove($array_sql) - { - $err = 0; - for ($i = 0 ; $i < sizeof($array_sql) ; $i++) - { - if (! $this->db->query($array_sql[$i])) - { - $err++; - } - } - - /* - * Boites - */ - foreach ($this->boxes as $key => $value) - { - $titre = $this->boxes[$key][0]; - $file = $this->boxes[$key][1]; - - $sql = "DELETE FROM llx_boxes_def WHERE file = '".$file."'"; - if (! $this->db->query($sql) ) - { - $err++; - } - } - - if ($err > 0) - { - return 0; - } - else - { - return 1; - } - } - -} -?> diff --git a/htdocs/includes/modules/modDon.class.php b/htdocs/includes/modules/modDon.class.php index 1b97796f763..8f723d45a5f 100644 --- a/htdocs/includes/modules/modDon.class.php +++ b/htdocs/includes/modules/modDon.class.php @@ -19,38 +19,43 @@ * $Source$ * */ +include_once "DolibarrModules.class.php"; -class modDon +class modDon extends DolibarrModules { /* * Initialisation * */ - Function modDon($DB) { $this->db = $DB ; + + $this->name = "Don"; + $this->description = "Gestion des dons (expérimental)"; + $this->const_name = "MAIN_MODULE_DON"; + $this->const_config = MAIN_MODULE_DON; + + $this->depends = array(); + + $this->const = array(); + $this->boxes = array(); } /* * * * */ - Function init() { /* * Activation du module */ - $sql = array( - ); + $sql = array(); - for ($i = 0 ; $i < sizeof($sql) ; $i++) - { - $this->db->query($sql[$i]); - } + return $this->_init($sql); } /* * @@ -58,7 +63,9 @@ class modDon */ Function remove() { - + $sql = array(); + + return $this->_remove($sql); } } ?> diff --git a/htdocs/includes/modules/modExternalRss.class.php b/htdocs/includes/modules/modExternalRss.class.php index e843302df9e..ace1b8c4a6f 100644 --- a/htdocs/includes/modules/modExternalRss.class.php +++ b/htdocs/includes/modules/modExternalRss.class.php @@ -40,6 +40,7 @@ class modExternalRss extends DolibarrModules $this->depends = array(); + $this->const = array(); $this->boxes = array(); /* * Boites diff --git a/htdocs/includes/modules/modPostnuke.class.php b/htdocs/includes/modules/modPostnuke.class.php index d3db9fa2b95..c493bff3b19 100644 --- a/htdocs/includes/modules/modPostnuke.class.php +++ b/htdocs/includes/modules/modPostnuke.class.php @@ -39,6 +39,9 @@ class modPostnuke extends DolibarrModules $this->const_config = MAIN_MODULE_POSTNUKE; $this->depends = array(); + + $this->const = array(); + $this->boxes = array(); } /* * diff --git a/htdocs/includes/modules/modSociete.class.php b/htdocs/includes/modules/modSociete.class.php index e864679f2cb..bd6a9a62bd8 100644 --- a/htdocs/includes/modules/modSociete.class.php +++ b/htdocs/includes/modules/modSociete.class.php @@ -29,7 +29,6 @@ class modSociete extends DolibarrModules * Initialisation * */ - Function modSociete($DB) { $this->db = $DB ; @@ -39,7 +38,6 @@ class modSociete extends DolibarrModules $this->const_name = "MAIN_MODULE_SOCIETE"; $this->const_config = MAIN_MODULE_SOCIETE; - $this->depends = array(); $this->const = array();