dolibarr  7.0.0-beta
modOpenSurvey.class.php
Go to the documentation of this file.
1 <?php
2 /* Copyright (C) 2013-2014 Laurent Destailleur <eldy@users.sourceforge.net>
3  * Copyright (C) 2014 Marcos GarcĂ­a <marcosgdf@gmail.com>
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 
26 include_once(DOL_DOCUMENT_ROOT ."/core/modules/DolibarrModules.class.php");
27 
28 
33 {
34 
40  function __construct($db)
41  {
42  global $langs,$conf;
43 
44  $this->db = $db;
45 
46  // Id for module (must be unique).
47  // Use here a free id (See in Home -> System information -> Dolibarr for list of used module id).
48  $this->numero = 55000;
49  // Key text used to identify module (for permission, menus, etc...)
50  $this->rights_class = 'opensurvey';
51 
52  // Family can be 'crm','financial','hr','projects','product','technic','other'
53  // It is used to group modules in module setup page
54  $this->family = "portal";
55  $this->module_position = 40;
56  // Module label (no space allowed), used if translation string 'ModuleXXXName' not found (where XXX is value of numeric property 'numero' of module)
57  $this->name = preg_replace('/^mod/i','',get_class($this));
58  // Module description used if translation string 'ModuleXXXDesc' not found (XXX is value MyModule)
59  $this->description = "Module to make online surveys (like Doodle, Studs, Rdvz, ...)";
60  // Possible values for version are: 'development', 'experimental', 'dolibarr' or version
61  $this->version = 'dolibarr';
62  // Key used in llx_const table to save module status enabled/disabled (where MYMODULE is value of property name of module in uppercase)
63  $this->const_name = 'MAIN_MODULE_'.strtoupper($this->name);
64  // Where to store the module in setup page (0=common,1=interface,2=others,3=very specific)
65  $this->special = 0;
66  // Name of image file used for this module.
67  // If file is in theme/yourtheme/img directory under name object_pictovalue.png, use this->picto='pictovalue'
68  // If file is in module/img directory under name object_pictovalue.png, use this->picto='pictovalue@module'
69  $this->picto='opensurvey.png@opensurvey';
70 
71  // Data directories to create when module is enabled
72  $this->dirs = array();
73  //$this->dirs[0] = DOL_DATA_ROOT.'/mymodule;
74  //$this->dirs[1] = DOL_DATA_ROOT.'/mymodule/temp;
75 
76  // Dependencies
77  $this->depends = array(); // List of modules id that must be enabled if this module is enabled
78  $this->requiredby = array(); // List of modules id to disable if this one is disabled
79  $this->phpmin = array(4,1); // Minimum version of PHP required by module
80  $this->need_dolibarr_version = array(3,4,0); // Minimum version of Dolibarr required by module
81 
82  // Constants
83  $this->const = array(); // List of parameters
84 
85  // Dictionaries
86  $this->dictionaries=array();
87 
88  // Boxes
89  $this->boxes = array(); // List of boxes
90  $r=0;
91 
92  // Add here list of php file(s) stored in includes/boxes that contains class to show a box.
93  // Example:
94  //$this->boxes[$r][1] = "myboxa.php";
95  //$r++;
96  //$this->boxes[$r][1] = "myboxb.php";
97  //$r++;
98 
99  // Permissions
100  $this->rights = array(); // Permission array used by this module
101  $r=0;
102 
103  // Add here list of permission defined by an id, a label, a boolean and two constant strings.
104  // Example:
105  $this->rights[$r][0] = 55001; // Permission id (must not be already used)
106  $this->rights[$r][1] = 'Read surveys'; // Permission label
107  $this->rights[$r][2] = 'r'; // Permission by default for new user (0/1)
108  $this->rights[$r][3] = 0; // Permission by default for new user (0/1)
109  $this->rights[$r][4] = 'read'; // In php code, permission will be checked by test if ($user->rights->permkey->level1->level2)
110  $r++;
111 
112  // Add here list of permission defined by an id, a label, a boolean and two constant strings.
113  // Example:
114  $this->rights[$r][0] = 55002; // Permission id (must not be already used)
115  $this->rights[$r][1] = 'Create/modify surveys'; // Permission label
116  $this->rights[$r][2] = 'w'; // Permission by default for new user (0/1)
117  $this->rights[$r][3] = 0; // Permission by default for new user (0/1)
118  $this->rights[$r][4] = 'write'; // In php code, permission will be checked by test if ($user->rights->permkey->level1->level2)
119  $r++;
120 
121 
122  // Menus
123  //-------
124  $r=0;
125  $this->menu[$r]=array( 'fk_menu'=>'fk_mainmenu=tools', // Use 'fk_mainmenu=xxx' or 'fk_mainmenu=xxx,fk_leftmenu=yyy' where xxx is mainmenucode and yyy is a leftmenucode
126  'type'=>'left',
127  'titre'=>'Survey',
128  'mainmenu'=>'tools',
129  'leftmenu'=>'opensurvey',
130  'url'=>'/opensurvey/index.php?mainmenu=tools&leftmenu=opensurvey',
131  'langs'=>'opensurvey',
132  'position'=>200,
133  'enabled'=>'$conf->opensurvey->enabled', // Define condition to show or hide menu entry. Use '$conf->NewsSubmitter->enabled' if entry must be visible if module is enabled.
134  'perms'=>'$user->rights->opensurvey->read',
135  'target'=>'',
136  'user'=>0);
137  $r++;
138 
139  $this->menu[$r]=array( 'fk_menu'=>'fk_mainmenu=tools,fk_leftmenu=opensurvey', // Use 'fk_mainmenu=xxx' or 'fk_mainmenu=xxx,fk_leftmenu=yyy' where xxx is mainmenucode and yyy is a leftmenucode
140  'type'=>'left',
141  'titre'=>'NewSurvey',
142  'mainmenu'=>'tools',
143  'leftmenu'=>'opensurvey_new',
144  'url'=>'/opensurvey/wizard/index.php',
145  'langs'=>'opensurvey',
146  'position'=>210,
147  'enabled'=>'$conf->opensurvey->enabled', // Define condition to show or hide menu entry. Use '$conf->NewsSubmitter->enabled' if entry must be visible if module is enabled.
148  'perms'=>'$user->rights->opensurvey->write',
149  'target'=>'',
150  'user'=>0);
151  $r++;
152 
153  $this->menu[$r]=array( 'fk_menu'=>'fk_mainmenu=tools,fk_leftmenu=opensurvey', // Use 'fk_mainmenu=xxx' or 'fk_mainmenu=xxx,fk_leftmenu=yyy' where xxx is mainmenucode and yyy is a leftmenucode
154  'type'=>'left',
155  'titre'=>'List',
156  'mainmenu'=>'tools',
157  'leftmenu'=>'opensurvey_list',
158  'url'=>'/opensurvey/list.php',
159  'langs'=>'opensurvey',
160  'position'=>220,
161  'enabled'=>'$conf->opensurvey->enabled', // Define condition to show or hide menu entry. Use '$conf->NewsSubmitter->enabled' if entry must be visible if module is enabled.
162  'perms'=>'$user->rights->opensurvey->read',
163  'target'=>'',
164  'user'=>0);
165  $r++;
166  }
167 
176  function init($options='')
177  {
178  // Permissions
179  $this->remove($options);
180 
181  $sql = array();
182 
183  return $this->_init($sql,$options);
184  }
185 }
186 
Class DolibarrModules.
</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
init($options='')
Function called when module is enabled.
Description and activation class for module opensurvey.
$conf db name
Only used if Module[ID]Name translation string is not found.
Definition: repair.php:104
_init($array_sql, $options='')
Enables a module.
__construct($db)
Constructor.