dolibarr  7.0.0-beta
modWebsite.class.php
Go to the documentation of this file.
1 <?php
2 /* Copyright (C) 2015 Laurent Destailleur <eldy@users.sourceforge.net>
3  *
4  * This program is free software; you can redistribute it and/or modify
5  * it under the terms of the GNU General Public License as published by
6  * the Free Software Foundation; either version 3 of the License, or
7  * (at your option) any later version.
8  *
9  * This program is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12  * GNU General Public License for more details.
13  *
14  * You should have received a copy of the GNU General Public License
15  * along with this program. If not, see <http://www.gnu.org/licenses/>.
16  */
17 
25 include_once DOL_DOCUMENT_ROOT .'/core/modules/DolibarrModules.class.php';
26 
27 
32 {
33 
39  function __construct($db)
40  {
41  global $langs,$conf;
42 
43  $this->db = $db;
44  $this->numero = 10000;
45 
46  // Family can be 'crm','financial','hr','projects','products','ecm','technic','other'
47  // It is used to group modules in module setup page
48  $this->family = "portal";
49  $this->module_position = 50;
50  // Module label (no space allowed), used if translation string 'ModuleXXXName' not found (where XXX is value of numeric property 'numero' of module)
51  $this->name = preg_replace('/^mod/i','',get_class($this));
52  $this->description = "Enable to build and serve public web sites with CMS features";
53  // Possible values for version are: 'development', 'experimental', 'dolibarr' or version
54  $this->version = 'experimental';
55  // Key used in llx_const table to save module status enabled/disabled (where MYMODULE is value of property name of module in uppercase)
56  $this->const_name = 'MAIN_MODULE_'.strtoupper($this->name);
57  // Where to store the module in setup page (0=common,1=interface,2=others,3=very specific)
58  $this->special = 0;
59  // Name of image file used for this module.
60  $this->picto='globe';
61 
62  // Data directories to create when module is enabled
63  $this->dirs = array("/website/temp");
64 
65  // Config pages
66  //-------------
67  $this->config_page_url = array('website.php');
68 
69  // Dependancies
70  //-------------
71  $this->hidden = ! empty($conf->global->MODULE_WEBSITE_DISABLED); // A condition to disable module
72  $this->depends = array('modFckeditor'); // List of modules id that must be enabled if this module is enabled
73  $this->requiredby = array(); // List of modules id to disable if this one is disabled
74  $this->conflictwith = array(); // List of modules id this module is in conflict with
75  $this->langfiles = array("website");
76 
77  // Constants
78  //-----------
79  $this->const = array();
80 
81  // New pages on tabs
82  // -----------------
83  //$this->tabs[] = array('data'=>'thirdparty:+website:WebSites:website:($conf->societe->enabled && $user->rights->societe->lire):/societe/website.php?mainmenu=home&id=__ID__'); // To add a new tab identified by code tabname1
84 
85  // Boxes
86  //------
87  $this->boxes = array();
88 
89  // Permissions
90  $this->rights = array(); // Permission array used by this module
91  $this->rights_class = 'website';
92  $r=0;
93 
94  $this->rights[$r][0] = 10001;
95  $this->rights[$r][1] = 'Read website content';
96  $this->rights[$r][3] = 0;
97  $this->rights[$r][4] = 'read';
98  $r++;
99 
100  $this->rights[$r][0] = 10002;
101  $this->rights[$r][1] = 'Create/modify website content';
102  $this->rights[$r][3] = 0;
103  $this->rights[$r][4] = 'write';
104  $r++;
105 
106  $this->rights[$r][0] = 10003;
107  $this->rights[$r][1] = 'Delete website content';
108  $this->rights[$r][3] = 0;
109  $this->rights[$r][4] = 'delete';
110  $r++;
111 
112  // Main menu entries
113  $r=0;
114  $this->menu[$r]=array( 'fk_menu'=>'0', // Use 'fk_mainmenu=xxx' or 'fk_mainmenu=xxx,fk_leftmenu=yyy' where xxx is mainmenucode and yyy is a leftmenucode
115  'type'=>'top', // This is a Left menu entry
116  'titre'=>'Websites',
117  'mainmenu'=>'website',
118  'url'=>'/website/index.php',
119  'langs'=>'website', // Lang file to use (without .lang) by module. File must be in langs/code_CODE/ directory.
120  'position'=>100,
121  'enabled'=>'$conf->website->enabled', // Define condition to show or hide menu entry. Use '$conf->mymodule->enabled' if entry must be visible if module is enabled. Use '$leftmenu==\'system\'' to show if leftmenu system is selected.
122  'perms'=>'$user->rights->website->read', // Use 'perms'=>'$user->rights->mymodule->level1->level2' if you want your menu with a permission rules
123  'target'=>'',
124  'user'=>2); // 0=Menu for internal users, 1=external users, 2=both
125  $r++;
126 
127  // Exports
128  $r=1;
129 
130  $this->export_code[$r]=$this->rights_class.'_'.$r;
131  $this->export_label[$r]='MyWebsitePages'; // Translation key (used only if key ExportDataset_xxx_z not found)
132  $this->export_icon[$r]='globe';
133  $keyforclass = 'WebsitePage'; $keyforclassfile='/website/class/websitepage.class.php'; $keyforelement='Website';
134  include DOL_DOCUMENT_ROOT.'/core/commonfieldsinexport.inc.php';
135  //$keyforselect='myobject'; $keyforelement='myobject'; $keyforaliasextra='extra';
136  //include DOL_DOCUMENT_ROOT.'/core/extrafieldsinexport.inc.php';
137  //$this->export_dependencies_array[$r]=array('mysubobject'=>'ts.rowid', 't.myfield'=>array('t.myfield2','t.myfield3')); // To force to activate one or several fields if we select some fields that need same (like to select a unique key if we ask a field of a child to avoid the DISTINCT to discard them, or for computed field than need several other fields)
138  $this->export_sql_start[$r]='SELECT DISTINCT ';
139  $this->export_sql_end[$r] =' FROM '.MAIN_DB_PREFIX.'website_page as t, '.MAIN_DB_PREFIX.'website as p';
140  $this->export_sql_end[$r] .=' WHERE t.fk_website = p.rowid';
141  $this->export_sql_end[$r] .=' AND p.entity IN ('.getEntity('website').')';
142  $r++;
143  }
144 }
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
$conf db name
Only used if Module[ID]Name translation string is not found.
Definition: repair.php:104
Class to describe Websites module.
__construct($db)
Constructor.