dolibarr 21.0.0-alpha
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
27include_once DOL_DOCUMENT_ROOT.'/core/modules/DolibarrModules.class.php';
28
29
34{
40 public function __construct($db)
41 {
42 global $conf;
43
44 $this->db = $db;
45 $this->numero = 320;
46
47 $this->family = "technic";
48 // Module label (no space allowed), used if translation string 'ModuleXXXName' not found (where XXX is value of numeric property 'numero' of module)
49 $this->name = preg_replace('/^mod/i', '', get_class($this));
50 $this->description = "Ajout de files d'informations RSS dans les ecrans Dolibarr";
51 // Possible values for version are: 'development', 'experimental', 'dolibarr' or version
52 $this->version = 'dolibarr';
53 $this->const_name = 'MAIN_MODULE_'.strtoupper($this->name);
54 $this->picto = 'rss';
55
56 // Data directories to create when module is enabled
57 $this->dirs = array("/externalrss/temp");
58
59 // Config pages
60 $this->config_page_url = array("external_rss.php");
61
62 // Dependencies
63 $this->depends = array();
64 $this->requiredby = array();
65 $this->phpmin = array(7, 0);
66 $this->phpmax = array();
67
68 // Constants
69 $this->const = array();
70
71 // Boxes
72 $this->boxes = array();
73 // Les boites sont ajoutees lors de la configuration des flux
74
75 // Permissions
76 $this->rights = array();
77 $this->rights_class = 'externalrss';
78 }
79
88 public function init($options = '')
89 {
90 global $conf;
91
92 $sql = array();
93
94 // Recherche configuration de boites
95 $this->boxes = array();
96 $sql = "select name, value from ".MAIN_DB_PREFIX."const";
97 $sql .= " WHERE name like 'EXTERNAL_RSS_TITLE_%'";
98 $sql .= " AND entity = ".$conf->entity;
99 $result = $this->db->query($sql);
100 if ($result) {
101 while ($obj = $this->db->fetch_object($result)) {
102 $reg = array();
103 if (preg_match('/EXTERNAL_RSS_TITLE_([0-9]+)/i', $obj->name, $reg)) {
104 // Definie la boite si on a trouvee une ancienne configuration
105 //$this->boxes[$reg[1]][0] = "(ExternalRSSInformations)";
106 $this->boxes[$reg[1]]['file'] = "box_external_rss.php";
107 $this->boxes[$reg[1]]['note'] = $reg[1]." (".$obj->value.")";
108 }
109 }
110 $this->db->free($result);
111 }
112
113 $sql = array();
114
115 return $this->_init($sql, $options);
116 }
117
126 public function remove($options = '')
127 {
128 $sql = array();
129
130 // Delete old declarations of RSS box
131 $this->boxes[0]['file'] = "box_external_rss.php";
132
133 return $this->_remove($sql, $options);
134 }
135}
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.
print $script_file $mode $langs defaultlang(is_numeric($duration_value) ? " delay=". $duration_value :"").(is_numeric($duration_value2) ? " after 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:140