dolibarr  19.0.0-dev
modExternalRss.class.php
Go to the documentation of this file.
1 <?php
2 /* Copyright (C) 2003 Rodolphe Quiedeville <rodolphe@quiedeville.org>
3  * Copyright (C) 2004-2007 Laurent Destailleur <eldy@users.sourceforge.net>
4  *
5  * This program is free software; you can redistribute it and/or modify
6  * it under the terms of the GNU General Public License as published by
7  * the Free Software Foundation; either version 3 of the License, or
8  * (at your option) any later version.
9  *
10  * This program is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13  * GNU General Public License for more details.
14  *
15  * You should have received a copy of the GNU General Public License
16  * along with this program. If not, see <https://www.gnu.org/licenses/>.
17  */
18 
27 include_once DOL_DOCUMENT_ROOT.'/core/modules/DolibarrModules.class.php';
28 
29 
34 {
35 
41  public function __construct($db)
42  {
43  global $conf;
44 
45  $this->db = $db;
46  $this->numero = 320;
47 
48  $this->family = "technic";
49  // Module label (no space allowed), used if translation string 'ModuleXXXName' not found (where XXX is value of numeric property 'numero' of module)
50  $this->name = preg_replace('/^mod/i', '', get_class($this));
51  $this->description = "Ajout de files d'informations RSS dans les ecrans Dolibarr";
52  // Possible values for version are: 'development', 'experimental', 'dolibarr' or version
53  $this->version = 'dolibarr';
54  $this->const_name = 'MAIN_MODULE_'.strtoupper($this->name);
55  $this->picto = 'rss';
56 
57  // Data directories to create when module is enabled
58  $this->dirs = array("/externalrss/temp");
59 
60  // Config pages
61  $this->config_page_url = array("external_rss.php");
62 
63  // Dependencies
64  $this->depends = array();
65  $this->requiredby = array();
66  $this->phpmin = array(7, 0);
67  $this->phpmax = array();
68 
69  // Constants
70  $this->const = array();
71 
72  // Boxes
73  $this->boxes = array();
74  // Les boites sont ajoutees lors de la configuration des flux
75 
76  // Permissions
77  $this->rights = array();
78  $this->rights_class = 'externalrss';
79  }
80 
89  public function init($options = '')
90  {
91  global $conf;
92 
93  $sql = array();
94 
95  // Recherche configuration de boites
96  $this->boxes = array();
97  $sql = "select name, value from ".MAIN_DB_PREFIX."const";
98  $sql .= " WHERE name like 'EXTERNAL_RSS_TITLE_%'";
99  $sql .= " AND entity = ".$conf->entity;
100  $result = $this->db->query($sql);
101  if ($result) {
102  while ($obj = $this->db->fetch_object($result)) {
103  $reg = array();
104  if (preg_match('/EXTERNAL_RSS_TITLE_([0-9]+)/i', $obj->name, $reg)) {
105  // Definie la boite si on a trouvee une ancienne configuration
106  //$this->boxes[$reg[1]][0] = "(ExternalRSSInformations)";
107  $this->boxes[$reg[1]]['file'] = "box_external_rss.php";
108  $this->boxes[$reg[1]]['note'] = $reg[1]." (".$obj->value.")";
109  }
110  }
111  $this->db->free($result);
112  }
113 
114  $sql = array();
115 
116  return $this->_init($sql, $options);
117  }
118 
127  public function remove($options = '')
128  {
129  $sql = array();
130 
131  // Delete old declarations of RSS box
132  $this->boxes[0]['file'] = "box_external_rss.php";
133 
134  return $this->_remove($sql, $options);
135  }
136 }
Class DolibarrModules.
_init($array_sql, $options='')
Enables a module.
_remove($array_sql, $options='')
Disable function.
Class to describe and enable module externalrss.
init($options='')
Function called when module is enabled.
__construct($db)
Constructor.
if(isModEnabled('facture') && $user->hasRight('facture', 'lire')) if((isModEnabled('fournisseur') &&empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD) && $user->hasRight("fournisseur", "facture", "lire"))||(isModEnabled('supplier_invoice') && $user->hasRight("supplier_invoice", "lire"))) if(isModEnabled('don') && $user->hasRight('don', 'lire')) if(isModEnabled('tax') &&!empty($user->rights->tax->charges->lire)) if(isModEnabled('facture') &&isModEnabled('commande') && $user->hasRight("commande", "lire") &&empty($conf->global->WORKFLOW_DISABLE_CREATE_INVOICE_FROM_ORDER)) $sql
Social contributions to pay.
Definition: index.php:746
print *****$script_file(".$version.") pid cd cd cd description as description
Only used if Module[ID]Desc translation string is not found.
$conf db name
Only used if Module[ID]Name translation string is not found.
Definition: repair.php:123