33require
'../main.inc.php';
43require_once DOL_DOCUMENT_ROOT.
'/core/lib/usergroups.lib.php';
44require_once DOL_DOCUMENT_ROOT.
'/core/lib/admin.lib.php';
47$langs->loadLangs(array(
"admin",
"members",
"users"));
52$action =
GETPOST(
'action',
'aZ09');
53$value =
GETPOST(
'value',
'alpha');
54$modulepart =
GETPOST(
'modulepart',
'aZ09');
63include DOL_DOCUMENT_ROOT.
'/core/actions_setmoduleoptions.inc.php';
67if ($action ==
'set_default') {
70} elseif ($action ==
'del_default') {
78} elseif ($action ==
'setdoc') {
83 $conf->global->USERGROUP_ADDON_PDF_ODT = $value;
92} elseif (preg_match(
'/set_([a-z0-9_\-]+)/i', $action, $reg)) {
95 header(
"Location: ".$_SERVER[
"PHP_SELF"]);
100} elseif (preg_match(
'/del_([a-z0-9_\-]+)/i', $action, $reg)) {
103 header(
"Location: ".$_SERVER[
"PHP_SELF"]);
113$help_url =
'EN:Module_Users|FR:Module_Utilisateurs|ES:Módulo_Usuarios';
114llxHeader(
'', $langs->trans(
"UsersSetup"), $help_url,
'', 0, 0,
'',
'',
'',
'mod-admin page-usergroup');
116$linkback =
'<a href="'.dolBuildUrl(DOL_URL_ROOT.
'/admin/modules.php', [
'restore_lastsearch_values' => 1]).
'">'.
img_picto($langs->trans(
"BackToModuleList"),
'back',
'class="pictofixedwidth"').
'<span class="hideonsmartphone">'.$langs->trans(
"BackToModuleList").
'</span></a>';
118print
load_fiche_titre($langs->trans(
"UsersSetup"), $linkback,
'title_setup');
123print
dol_get_fiche_head($head,
'usergroupcard', $langs->trans(
"MenuUsersAndGroups"), -1,
'user');
126$dirmodels = array_merge(array(
'/'), (array)
$conf->modules_parts[
'models']);
133$sql .=
" FROM ".MAIN_DB_PREFIX.
"document_model";
134$sql .=
" WHERE type = '".$db->escape($type).
"'";
135$sql .=
" AND entity = ".((int)
$conf->entity);
136$resql =
$db->query($sql);
139 $num_rows =
$db->num_rows($resql);
140 while ($i < $num_rows) {
141 $array =
$db->fetch_array($resql);
142 if (is_array($array)) {
143 array_push($def, $array[0]);
153print
'<table class="noborder centpercent">';
154print
'<tr class="liste_titre">';
155print
'<td>'.$langs->trans(
"Name").
'</td>';
156print
'<td>'.$langs->trans(
"Description").
'</td>';
157print
'<td align="center" width="60">'.$langs->trans(
"Status").
"</td>\n";
158print
'<td align="center" width="60">'.$langs->trans(
"Default").
"</td>\n";
159print
'<td align="center" width="80">'.$langs->trans(
"ShortInfo").
'</td>';
160print
'<td align="center" width="80">'.$langs->trans(
"Preview").
'</td>';
165foreach ($dirmodels as $reldir) {
166 foreach (array(
'',
'/doc') as $valdir) {
167 $dir =
dol_buildpath($reldir.
"core/modules/usergroup".$valdir);
169 $handle = opendir($dir);
170 if (is_resource($handle)) {
172 while (($file = readdir($handle)) !==
false) {
178 foreach ($filelist as $file) {
179 if (preg_match(
'/\.modules\.php$/i', $file) && preg_match(
'/^(pdf_|doc_)/', $file)) {
180 if (file_exists($dir.
'/'.$file)) {
181 $name = substr($file, 4,
dol_strlen($file) - 16);
182 $classname = substr($file, 0,
dol_strlen($file) - 12);
184 require_once $dir.
'/'.$file;
185 $module =
new $classname(
$db);
186 '@phan-var-force ModelePDFUserGroup $module';
188 $modulequalified = 1;
189 if ($module->version ==
'development' &&
getDolGlobalInt(
'MAIN_FEATURES_LEVEL') < 2) {
190 $modulequalified = 0;
192 if ($module->version ==
'experimental' &&
getDolGlobalInt(
'MAIN_FEATURES_LEVEL') < 1) {
193 $modulequalified = 0;
196 if ($modulequalified) {
197 print
'<tr class="oddeven"><td width="100">';
198 print(empty($module->name) ? $name : $module->
name);
200 if (method_exists($module,
'info')) {
201 print $module->info($langs);
203 print $module->description;
208 if (in_array($name, $def)) {
209 print
'<td class="center">'.
"\n";
210 print
'<a href="'.$_SERVER[
"PHP_SELF"].
'?action=del_default&token='.newToken().
'&value='.urlencode($name).
'">';
211 print
img_picto($langs->trans(
"Enabled"),
'switch_on');
215 print
'<td class="center">'.
"\n";
216 print
'<a href="'.$_SERVER[
"PHP_SELF"].
'?action=set_default&token='.newToken().
'&value='.urlencode($name).
'&scandir='.urlencode($module->scandir).
'&label='.urlencode($module->name).
'">'.
img_picto($langs->trans(
"Disabled"),
'switch_off').
'</a>';
221 print
'<td class="center">';
223 print
img_picto($langs->trans(
"Default"),
'on');
225 print
'<a href="'.$_SERVER[
"PHP_SELF"].
'?action=setdoc&token='.newToken().
'&value='.urlencode($name).
'&scandir='.urlencode($module->scandir).
'&label='.urlencode($module->name).
'" alt="'.$langs->trans(
"Default").
'">'.
img_picto($langs->trans(
"Disabled"),
'off').
'</a>';
230 $htmltooltip =
''.$langs->trans(
"Name").
': '.$module->name;
231 $htmltooltip .=
'<br>'.$langs->trans(
"Type").
': '.($module->type ? $module->type : $langs->trans(
"Unknown"));
232 if ($module->type ==
'pdf') {
233 $htmltooltip .=
'<br>'.$langs->trans(
"Width").
'/'.$langs->trans(
"Height").
': '.$module->page_largeur.
'/'.$module->page_hauteur;
235 $htmltooltip .=
'<br><br><u>'.$langs->trans(
"FeaturesSupported").
':</u>';
236 $htmltooltip .=
'<br>'.$langs->trans(
"Logo").
': '.
yn($module->option_logo, 1, 1);
237 $htmltooltip .=
'<br>'.$langs->trans(
"MultiLanguage").
': '.
yn($module->option_multilang, 1, 1);
240 print
'<td class="center">';
241 print $form->textwithpicto(
'', $htmltooltip, 1,
'info');
245 print
'<td class="center">';
246 if ($module->type ==
'pdf') {
247 print
'<a href="'.$_SERVER[
"PHP_SELF"].
'?action=specimen&module='.$name.
'">'.
img_object($langs->trans(
"Preview"),
'pdf').
'</a>';
249 print
img_object($langs->transnoentitiesnoconv(
"PreviewNotAvailable"),
'generic');
addDocumentModel($name, $type, $label='', $description='')
Add document model used by doc generator.
dolibarr_set_const($db, $name, $value, $type='chaine', $visible=0, $note='', $entity=1)
Insert a parameter (key,value) into database (delete old key then insert it again).
dolibarr_del_const($db, $name, $entity=1)
Delete a constant.
delDocumentModel($name, $type)
Delete document model used by doc generator.
llxFooter($comment='', $zone='private', $disabledoutputofmessages=0)
Empty footer.
if(!defined('NOREQUIRESOC')) if(!defined( 'NOREQUIRETRAN')) if(!defined('NOTOKENRENEWAL')) if(!defined( 'NOREQUIREMENU')) if(!defined('NOREQUIREHTML')) if(!defined( 'NOREQUIREAJAX')) llxHeader($head='', $title='', $help_url='', $target='', $disablejs=0, $disablehead=0, $arrayofjs='', $arrayofcss='', $morequerystring='', $morecssonbody='', $replacemainareaby='', $disablenofollow=0, $disablenoindex=0)
Empty header.
img_picto($titlealt, $picto, $moreatt='', $pictoisfullpath=0, $srconly=0, $notitle=0, $alt='', $morecss='', $marginleftonlyshort=2, $allowothertags=array())
Show picto whatever it's its name (generic function)
dol_get_fiche_head($links=array(), $active='', $title='', $notab=0, $picto='', $pictoisfullpath=0, $morehtmlright='', $morecss='', $limittoshow=0, $moretabssuffix='', $dragdropfile=0, $morecssdiv='')
Show tabs of a record.
dol_get_fiche_end($notab=0)
Return tab footer of a card.
img_object($titlealt, $picto, $moreatt='', $pictoisfullpath=0, $srconly=0, $notitle=0, $allowothertags=array())
Show a picto called object_picto (generic function)
dol_strlen($string, $stringencoding='UTF-8')
Make a strlen call.
getDolGlobalInt($key, $default=0)
Return a Dolibarr global constant int value.
yn($yesno, $format=1, $color=0)
Return yes or no in current language.
GETPOST($paramname, $check='alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0)
Return value of a param into GET or POST supervariable.
dol_buildpath($path, $type=0, $returnemptyifnotfound=0)
Return path of url or filesystem.
dol_print_error($db=null, $error='', $errors=null)
Displays error message system with all the information to facilitate the diagnosis and the escalation...
load_fiche_titre($title, $morehtmlright='', $picto='generic', $pictoisfullpath=0, $id='', $morecssontable='', $morehtmlcenter='', $morecssonpicto='widthpictotitle')
Load a title with picto.
getDolGlobalString($key, $default='')
Return a Dolibarr global constant string value.
$conf db name
Only used if Module[ID]Name translation string is not found.
accessforbidden($message='', $printheader=1, $printfooter=1, $showonlymessage=0, $params=null)
Show a message to say access is forbidden and stop program.
user_admin_prepare_head()
Prepare array with list of tabs.