dolibarr  13.0.2
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(4, 2, 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  {
103  while ($obj = $this->db->fetch_object($result))
104  {
105  if (preg_match('/EXTERNAL_RSS_TITLE_([0-9]+)/i', $obj->name, $reg))
106  {
107  // Definie la boite si on a trouvee une ancienne configuration
108  //$this->boxes[$reg[1]][0] = "(ExternalRSSInformations)";
109  $this->boxes[$reg[1]]['file'] = "box_external_rss.php";
110  $this->boxes[$reg[1]]['note'] = $reg[1]." (".$obj->value.")";
111  }
112  }
113  $this->db->free($result);
114  }
115 
116  $sql = array();
117 
118  return $this->_init($sql, $options);
119  }
120 
129  public function remove($options = '')
130  {
131  $sql = array();
132 
133  // Delete old declarations of RSS box
134  $this->boxes[0]['file'] = "box_external_rss.php";
135 
136  return $this->_remove($sql, $options);
137  }
138 }
Class DolibarrModules.
</td > param sortfield sortorder printFieldListOption< tdclass="liste_titremaxwidthsearchright"></td ></tr >< trclass="liste_titre">< inputtype="checkbox"onClick="toggle(this)"/> Ref p ref Label p label Duration p duration center DesiredStock p desiredstock right StockLimitShort p seuil_stock_alerte right stock_physique right stock_real_warehouse right Ordered right StockToBuy right SupplierRef right param sortfield sortorder printFieldListTitle warehouseinternal SELECT description FROM product_lang WHERE qty< br > qty qty qty StockTooLow StockTooLow help help help< trclass="oddeven">< td >< inputtype="checkbox"class="check"name="choose'.$i.'"></td >< tdclass="nowrap"> stock</td >< td >< inputtype="hidden"name="desc'.$i.'"value="'.dol_escape_htmltag($objp-> description
Only used if Module[ID]Desc translation string is not found.
Definition: replenish.php:750
$conf db name
Only used if Module[ID]Name translation string is not found.
Definition: repair.php:108
$conf db
API class for accounts.
Definition: inc.php:54
_remove($array_sql, $options= '')
Disable function.
__construct($db)
Constructor.
init($options= '')
Function called when module is enabled.
_init($array_sql, $options= '')
Enables a module.
Class to describe and enable module externalrss.