28require
"../main.inc.php";
31require_once DOL_DOCUMENT_ROOT.
"/core/lib/admin.lib.php";
32require_once DOL_DOCUMENT_ROOT.
'/workstation/lib/workstation.lib.php';
43$langs->loadLangs(array(
"admin",
"workstation"));
46$action =
GETPOST(
'action',
'aZ09');
47$backtopage =
GETPOST(
'backtopage',
'alpha');
48$modulepart =
GETPOST(
'modulepart',
'aZ09');
49$label =
GETPOST(
'label',
'alpha');
50$scandir =
GETPOST(
'scan_dir',
'alpha');
52$value =
GETPOST(
'value',
'alpha');
56$dirmodels = array_merge([
'/'], (array)
$conf->modules_parts[
'models']);
64$moduledir =
'workstation';
70include DOL_DOCUMENT_ROOT.
'/core/actions_setmoduleoptions.inc.php';
72if ($action ==
'updateMask') {
73 $maskconst =
GETPOST(
'maskconstWorkstation',
'aZ09');
74 $maskorder =
GETPOST(
'maskWorkstation',
'alpha');
78 if ($maskconst && preg_match(
'/_MASK$/', $maskconst)) {
87 setEventMessages($langs->trans(
"SetupSaved"),
null,
'mesgs');
89 setEventMessages($langs->trans(
"Error"),
null,
'errors');
91} elseif ($action ==
'specimen') {
92 $modele =
GETPOST(
'module',
'alpha');
95 $tmpobject->initAsSpecimen();
100 $dirmodels = array_merge(array(
'/'), (array)
$conf->modules_parts[
'models']);
101 foreach ($dirmodels as $reldir) {
102 $file =
dol_buildpath($reldir.
"core/modules/workstation/doc/pdf_".$modele.
"_workstation.modules.php", 0);
103 if (file_exists($file)) {
104 $classname =
"pdf_".$modele;
109 if ($classname !==
'') {
113 '@phan-var-force ModelePDFWorkstation $module';
116 if (
$module->write_file($tmpobject, $langs) > 0) {
117 header(
"Location: ".DOL_URL_ROOT.
"/document.php?modulepart=workstation&file=SPECIMEN.pdf");
120 setEventMessages(
$module->error,
null,
'errors');
124 setEventMessages($langs->trans(
"ErrorModuleNotFound"),
null,
'errors');
125 dol_syslog($langs->trans(
"ErrorModuleNotFound"), LOG_ERR);
127} elseif ($action ==
'set') {
130} elseif ($action ==
'del') {
133 $constforval =
'WORKSTATION_ADDON_PDF';
138} elseif ($action ==
'setdoc') {
140 $constforval =
'WORKSTATION_ADDON_PDF';
144 $conf->global->$constforval = $value;
152} elseif ($action ==
'setmod') {
155 $constforval =
'WORKSTATION_WORKSTATION_ADDON';
165$form =
new Form($db);
168$page_name =
"WorkstationSetup";
170llxHeader(
'', $langs->trans($page_name), $help_url,
'', 0, 0,
'',
'',
'',
'mod-admin page-workstation');
173$linkback =
'<a href="'.($backtopage ? $backtopage : 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>';
179print
dol_get_fiche_head($head,
'settings', $langs->trans($page_name), -1,
"workstation");
184print
load_fiche_titre($langs->trans(
"NumberingModules",
'Workstation'),
'',
'');
186print
'<table class="noborder centpercent">';
187print
'<tr class="liste_titre">';
188print
'<td>'.$langs->trans(
"Name").
'</td>';
189print
'<td>'.$langs->trans(
"Description").
'</td>';
190print
'<td class="nowrap">'.$langs->trans(
"Example").
'</td>';
191print
'<td class="center" width="60">'.$langs->trans(
"Status").
'</td>';
192print
'<td class="center" width="16">'.$langs->trans(
"ShortInfo").
'</td>';
197foreach ($dirmodels as $reldir) {
201 $handle = opendir($dir);
202 if (is_resource($handle)) {
203 while (($file = readdir($handle)) !==
false) {
204 if (strpos($file,
'mod_workstation_') === 0 &&
dol_substr($file,
dol_strlen($file) - 3, 3) ==
'php') {
207 require_once $dir.
'/'.$file.
'.php';
210 '@phan-var-force ModeleNumRefWorkstation $module';
224 print
'<tr class="oddeven"><td>'.$module->name.
"</td><td>\n";
229 print
'<td class="nowrap">';
231 if (preg_match(
'/^Error/', $tmp)) {
232 $langs->load(
"errors");
233 print
'<div class="error">'.$langs->trans($tmp).
'</div>';
234 } elseif ($tmp ==
'NotConfigured') {
235 print
'<span class="opacitymedium">'.$langs->trans($tmp).
'</span>';
241 print
'<td class="center">';
242 $constforvar =
'WORKSTATION_WORKSTATION_ADDON';
244 print img_picto($langs->trans(
"Activated"),
'switch_on');
246 print
'<a href="'.$_SERVER[
"PHP_SELF"].
'?action=setmod&token='.
newToken().
'&value='.urlencode($file).
'">';
247 print img_picto($langs->trans(
"Disabled"),
'switch_off');
253 $mytmpinstance->initAsSpecimen();
257 $htmltooltip .= $langs->trans(
"Version").
': <b>'.
$module->getVersion().
'</b><br>';
259 $nextval =
$module->getNextValue($mytmpinstance);
260 if (
"$nextval" != $langs->trans(
"NotAvailable")) {
261 $htmltooltip .=
''.$langs->trans(
"NextValue").
': ';
263 if (preg_match(
'/^Error/', $nextval) || $nextval ==
'NotConfigured') {
264 $nextval = $langs->trans($nextval);
266 $htmltooltip .= $nextval.
'<br>';
268 $htmltooltip .= $langs->trans(
$module->error).
'<br>';
272 print
'<td class="center">';
273 print $form->textwithpicto(
'', $htmltooltip, 1,
'info');
284print
"</table><br>\n";
289 printDocumentModelList($type, $moduledir,
'WORKSTATION_ADDON_PDF', $langs->trans(
"DocumentModules",
'Workstation'), array(
290 'Logo' =>
'option_logo',
291 'MultiLanguage' =>
'option_multilang',
292 ),
false,
'mod_workstation_standard');
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.
if(! $sortfield) if(! $sortorder) $module
dol_strlen($string, $stringencoding='UTF-8')
Make a strlen call.
getDolGlobalInt($key, $default=0)
Return a Dolibarr global constant int value.
if(!function_exists( 'dol_getprefix')) dol_include_once($relpath, $classname='')
Make an include_once using default root and alternate root if it fails.
newToken()
Return the value of token currently saved into session with name 'newtoken'.
GETPOST($paramname, $check='alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0, $nodefault=0)
Return value of a param into GET or POST supervariable.
dol_substr($string, $start, $length=null, $stringencoding='', $trunconbytes=0)
Make a substring.
dol_buildpath($path, $type=0, $returnemptyifnotfound=0)
Return path of url or filesystem.
getDolGlobalString($key, $default='')
Return a Dolibarr global constant string value.
dol_syslog($message, $level=LOG_INFO, $ident=0, $suffixinfilename='', $restricttologhandler='', $logcontext=null)
Write log message into outputs.
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.
load_fiche_titre($title, $morehtmlright='', $picto='generic', $pictoisfullpath=0, $id='', $morecssontable='', $morehtmlcenter='', $morecssonpicto='widthpictotitle')
Load a title with picto.
accessforbidden($message='', $printheader=1, $printfooter=1, $showonlymessage=0, $params=null)
Show a message to say access is forbidden and stop program.
workstationAdminPrepareHead()
Prepare admin pages header.