dolibarr  7.0.0-beta
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 <http://www.gnu.org/licenses/>.
17  */
18 
27 include_once DOL_DOCUMENT_ROOT .'/core/modules/DolibarrModules.class.php';
28 
29 
34 {
35 
41  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->special = 1;
56  $this->picto='rss';
57 
58  // Data directories to create when module is enabled
59  $this->dirs = array("/externalrss/temp");
60 
61  // Config pages
62  $this->config_page_url = array("external_rss.php");
63 
64  // Dependencies
65  $this->depends = array();
66  $this->requiredby = array();
67  $this->phpmin = array(4,2,0);
68  $this->phpmax = array();
69 
70  // Constants
71  $this->const = array();
72 
73  // Boxes
74  $this->boxes = array();
75  // Les boites sont ajoutees lors de la configuration des flux
76 
77  // Permissions
78  $this->rights = array();
79  $this->rights_class = 'externalrss';
80  }
81 
90  function init($options='')
91  {
92  global $conf;
93 
94  $sql = array();
95 
96  // Recherche configuration de boites
97  $this->boxes=array();
98  $sql="select name, value from ".MAIN_DB_PREFIX."const";
99  $sql.= " WHERE name like 'EXTERNAL_RSS_TITLE_%'";
100  $sql.= " AND entity = ".$conf->entity;
101  $result=$this->db->query($sql);
102  if ($result)
103  {
104  while ($obj = $this->db->fetch_object($result))
105  {
106  if (preg_match('/EXTERNAL_RSS_TITLE_([0-9]+)/i',$obj->name,$reg))
107  {
108  // Definie la boite si on a trouvee une ancienne configuration
109  //$this->boxes[$reg[1]][0] = "(ExternalRSSInformations)";
110  $this->boxes[$reg[1]]['file'] = "box_external_rss.php";
111  $this->boxes[$reg[1]]['note'] = $reg[1]." (".$obj->value.")";
112  }
113  }
114  $this->db->free($result);
115  }
116 
117  $sql = array();
118 
119  return $this->_init($sql,$options);
120  }
121 
130  function remove($options='')
131  {
132  $sql = array();
133 
134  // Delete old declarations of RSS box
135  $this->boxes[0]['file'] = "box_external_rss.php";
136 
137  return $this->_remove($sql,$options);
138  }
139 
140 }
Class DolibarrModules.
_remove($array_sql, $options='')
Disable function.
</td >< tdclass="liste_titre"align="right"></td ></tr >< trclass="liste_titre">< inputtype="checkbox"onClick="toggle(this)"/> Ref p ref Label p label Duration p duration warehouseinternal SELECT description FROM product_lang WHERE qty< br > qty qty qty StockTooLow img yes disabled img no img no< trclass="oddeven">< td >< inputtype="checkbox"class="check"name="'.$i.'"'.$disabled.'></td >< td >< inputtype="checkbox"class="check"name="choose'.$i.'"></td >< tdclass="nowrap"></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:554
__construct($db)
Constructor.
$conf db name
Only used if Module[ID]Name translation string is not found.
Definition: repair.php:104
Class to describe and enable module externalrss.
_init($array_sql, $options='')
Enables a module.
init($options='')
Function called when module is enabled.