'."\n";
+ print '| '.$langs->trans("Name").' | ';
+ print ''.$langs->trans("Description").' | ';
+ print ''.$langs->trans("Status")." | \n";
+ print ''.$langs->trans("Default")." | \n";
+ print ''.$langs->trans("ShortInfo").' | ';
+ print ''.$langs->trans("Preview").' | ';
+ print "
\n";
+
+ clearstatcache();
+
+ foreach ($docGenerationObjects as $myTmpObjectKey => $myTmpObjectArray) {
+ if (empty($myTmpObjectArray['includedocgeneration'])) {
+ continue;
+ }
+
$type = strtolower($myTmpObjectKey);
- print load_fiche_titre($langs->trans("DocumentModules", $myTmpObjectKey), '', '');
+ print ''."\n";
- print ''."\n";
- print '| '.$langs->trans("Name").' | ';
- print ''.$langs->trans("Description").' | ';
- print ''.$langs->trans("Status")." | \n";
- print ''.$langs->trans("Default")." | \n";
- print ''.$langs->trans("ShortInfo").' | ';
- print ''.$langs->trans("Preview").' | ';
- print "
\n";
-
- clearstatcache();
-
foreach ($dirmodels as $reldir) {
foreach (array('', '/doc') as $valdir) {
$realpath = $reldir."core/modules/".$moduledir.$valdir;
$dir = dol_buildpath($realpath);
- if (is_dir($dir)) {
- $handle = opendir($dir);
- if (is_resource($handle)) {
- $filelist = array();
- while (($file = readdir($handle)) !== false) {
- $filelist[] = $file;
- }
- closedir($handle);
- arsort($filelist);
+ if (!is_dir($dir)) {
+ continue;
+ }
- foreach ($filelist as $file) {
- if (preg_match('/\.modules\.php$/i', $file) && preg_match('/^(pdf_|doc_)/', $file)) {
- if (file_exists($dir.'/'.$file)) {
- $name = substr($file, 4, dol_strlen($file) - 16);
- $className = substr($file, 0, dol_strlen($file) - 12);
+ $handle = opendir($dir);
+ if (!is_resource($handle)) {
+ continue;
+ }
- require_once $dir.'/'.$file;
- $module = new $className($db);
- '@phan-var-force ModelePDFMyObject $module';
+ $filelist = array();
- $modulequalified = 1;
- if ($module->version == 'development' && getDolGlobalInt('MAIN_FEATURES_LEVEL') < 2) {
- $modulequalified = 0;
- }
- if ($module->version == 'experimental' && getDolGlobalInt('MAIN_FEATURES_LEVEL') < 1) {
- $modulequalified = 0;
- }
+ while (($file = readdir($handle)) !== false) {
+ $filelist[] = $file;
+ }
+ closedir($handle);
- if ($modulequalified) {
- print '| ';
- print(empty($module->name) ? $name : $module->name);
- print " | \n";
- if (method_exists($module, 'info')) {
- print $module->info($langs); // @phan-suppress-current-line PhanUndeclaredMethod
- } else {
- print $module->description;
- }
- print ' | ';
+ arsort($filelist);
- // Active
- if (in_array($name, $def)) {
- print ''."\n";
- print '';
- print img_picto($langs->trans("Enabled"), 'switch_on');
- print '';
- print ' | ';
- } else {
- print ''."\n";
- print 'scandir).'&label='.urlencode($module->name).'">'.img_picto($langs->trans("Disabled"), 'switch_off').'';
- print " | ";
- }
-
- // Default
- print '';
- $constforvar = 'MYMODULE_'.strtoupper($myTmpObjectKey).'_ADDON_PDF';
- if (getDolGlobalString($constforvar) == $name) {
- //print img_picto($langs->trans("Default"), 'on');
- // Even if choice is the default value, we allow to disable it. Replace this with previous line if you need to disable unset
- print 'scandir).'&label='.urlencode($module->name).'&type='.urlencode($type).'" alt="'.$langs->trans("Disable").'">'.img_picto($langs->trans("Enabled"), 'on').'';
- } else {
- print 'scandir).'&label='.urlencode($module->name).'" alt="'.$langs->trans("Default").'">'.img_picto($langs->trans("Disabled"), 'off').'';
- }
- print ' | ';
-
- // Info
- $htmltooltip = ''.$langs->trans("Name").': '.$module->name;
- $htmltooltip .= '
'.$langs->trans("Type").': '.($module->type ? $module->type : $langs->trans("Unknown"));
- if ($module->type == 'pdf') {
- $htmltooltip .= '
'.$langs->trans("Width").'/'.$langs->trans("Height").': '.$module->page_largeur.'/'.$module->page_hauteur;
- }
- $htmltooltip .= '
'.$langs->trans("Path").': '.preg_replace('/^\//', '', $realpath).'/'.$file;
-
- $htmltooltip .= '
'.$langs->trans("FeaturesSupported").':';
- $htmltooltip .= '
'.$langs->trans("Logo").': '.yn($module->option_logo, 1, 1);
- $htmltooltip .= '
'.$langs->trans("MultiLanguage").': '.yn($module->option_multilang, 1, 1);
-
- print '';
- print $form->textwithpicto('', $htmltooltip, 1, 'info');
- print ' | ';
-
- // Preview
- print '';
- if ($module->type == 'pdf') {
- $newname = preg_replace('/_'.preg_quote(strtolower($myTmpObjectKey), '/').'/', '', $name);
- print ''.img_object($langs->trans("Preview"), 'pdf').'';
- } else {
- print img_object($langs->transnoentitiesnoconv("PreviewNotAvailable"), 'generic');
- }
- print ' | ';
-
- print "
\n";
- }
- }
- }
- }
+ foreach ($filelist as $file) {
+ if (!preg_match('/\.modules\.php$/i', $file) || !preg_match('/^(pdf_|doc_)/', $file)) {
+ continue;
}
+
+ if (!preg_match('/_'.preg_quote($type, '/').'(_odt)?\.modules\.php$/i', $file)) {
+ continue;
+ }
+
+ if (!file_exists($dir.'/'.$file)) {
+ continue;
+ }
+
+ $name = substr($file, 4, dol_strlen($file) - 16);
+ $className = substr($file, 0, dol_strlen($file) - 12);
+
+ require_once $dir.'/'.$file;
+
+ $module = new $className($db);
+ '@phan-var-force ModelePDFMyObject $module';
+
+ $modulequalified = 1;
+ if ($module->version == 'development' && getDolGlobalInt('MAIN_FEATURES_LEVEL') < 2) {
+ $modulequalified = 0;
+ }
+ if ($module->version == 'experimental' && getDolGlobalInt('MAIN_FEATURES_LEVEL') < 1) {
+ $modulequalified = 0;
+ }
+
+ if (!$modulequalified) {
+ continue;
+ }
+
+ print '| ';
+ print(empty($module->name) ? $name : $module->name);
+ print " | \n";
+
+ if (method_exists($module, 'info')) {
+ print $module->info($langs); // @phan-suppress-current-line PhanUndeclaredMethod
+ } else {
+ print $module->description;
+ }
+
+ print ' | ';
+
+ if (in_array($name, $def)) {
+ print ''."\n";
+ print '';
+ print img_picto($langs->trans("Enabled"), 'switch_on');
+ print '';
+ print ' | ';
+ } else {
+ print ''."\n";
+ print 'scandir).'&label='.urlencode($module->name).'&type='.urlencode($type).'">';
+ print img_picto($langs->trans("Disabled"), 'switch_off');
+ print '';
+ print " | ";
+ }
+
+ print '';
+ $constforvar = 'MYMODULE_'.strtoupper($myTmpObjectKey).'_ADDON_PDF';
+
+ if (getDolGlobalString($constforvar) == $name) {
+ print 'scandir).'&label='.urlencode($module->name).'&type='.urlencode($type).'" alt="'.$langs->trans("Disable").'">';
+ print img_picto($langs->trans("Enabled"), 'on');
+ print '';
+ } else {
+ print 'scandir).'&label='.urlencode($module->name).'&type='.urlencode($type).'" alt="'.$langs->trans("Default").'">';
+ print img_picto($langs->trans("Disabled"), 'off');
+ print '';
+ }
+
+ print ' | ';
+
+ $htmltooltip = ''.$langs->trans("Name").': '.$module->name;
+ $htmltooltip .= '
'.$langs->trans("Type").': '.($module->type ? $module->type : $langs->trans("Unknown"));
+
+ if ($module->type == 'pdf') {
+ $htmltooltip .= '
'.$langs->trans("Width").'/'.$langs->trans("Height").': '.$module->page_largeur.'/'.$module->page_hauteur;
+ }
+
+ $htmltooltip .= '
'.$langs->trans("Path").': '.preg_replace('/^\//', '', $realpath).'/'.$file;
+ $htmltooltip .= '
'.$langs->trans("FeaturesSupported").':';
+ $htmltooltip .= '
'.$langs->trans("Logo").': '.yn($module->option_logo, 1, 1);
+ $htmltooltip .= '
'.$langs->trans("MultiLanguage").': '.yn($module->option_multilang, 1, 1);
+
+ print '';
+ print $form->textwithpicto('', $htmltooltip, 1, 'info');
+ print ' | ';
+
+ print '';
+ if ($module->type == 'pdf') {
+ $newname = preg_replace('/_'.preg_quote($type, '/').'/', '', $name);
+ print '';
+ print img_object($langs->trans("Preview"), 'pdf');
+ print '';
+ } else {
+ print img_object($langs->transnoentitiesnoconv("PreviewNotAvailable"), 'generic');
+ }
+ print ' | ';
+
+ print "
\n";
}
}
}
- print '
';
+ print '