* * GlobalNotify Admin Setup Page */ // Load Dolibarr environment $res = 0; if (!$res && !empty($_SERVER["CONTEXT_DOCUMENT_ROOT"])) { $res = @include $_SERVER["CONTEXT_DOCUMENT_ROOT"]."/main.inc.php"; } $tmp = empty($_SERVER['SCRIPT_FILENAME']) ? '' : $_SERVER['SCRIPT_FILENAME']; $tmp2 = realpath(__FILE__); $i = strlen($tmp) - 1; $j = strlen($tmp2) - 1; while ($i > 0 && $j > 0 && isset($tmp[$i]) && isset($tmp2[$j]) && $tmp[$i] == $tmp2[$j]) { $i--; $j--; } if (!$res && $i > 0 && file_exists(substr($tmp, 0, ($i + 1))."/main.inc.php")) { $res = @include substr($tmp, 0, ($i + 1))."/main.inc.php"; } if (!$res && $i > 0 && file_exists(dirname(substr($tmp, 0, ($i + 1)))."/main.inc.php")) { $res = @include dirname(substr($tmp, 0, ($i + 1)))."/main.inc.php"; } if (!$res && file_exists("../../main.inc.php")) { $res = @include "../../main.inc.php"; } if (!$res && file_exists("../../../main.inc.php")) { $res = @include "../../../main.inc.php"; } if (!$res) { die("Include of main fails"); } require_once DOL_DOCUMENT_ROOT."/core/lib/admin.lib.php"; dol_include_once('/globalnotify/class/globalnotify.class.php'); /** * @var Conf $conf * @var DoliDB $db * @var Translate $langs * @var User $user */ $langs->loadLangs(array("admin", "globalnotify@globalnotify")); // Access control if (!$user->admin) { accessforbidden(); } $action = GETPOST('action', 'aZ09'); /* * Actions */ if ($action == 'clearall') { // Clear all notifications $sql = "DELETE FROM ".MAIN_DB_PREFIX."const WHERE name LIKE 'GLOBALNOTIFY_%'"; $db->query($sql); setEventMessages("Alle Benachrichtigungen gelöscht", null, 'mesgs'); header("Location: ".$_SERVER["PHP_SELF"]); exit; } if ($action == 'resetcronjobs') { // Reset all stuck cron jobs $sql = "UPDATE ".MAIN_DB_PREFIX."cronjob SET processing = 0 WHERE processing = 1"; $resql = $db->query($sql); $affected = $db->affected_rows($resql); setEventMessages("{$affected} Cron-Jobs zurückgesetzt", null, 'mesgs'); header("Location: ".$_SERVER["PHP_SELF"]); exit; } /* * View */ $page_name = "GlobalNotify - ".$langs->trans("Settings"); llxHeader('', $page_name); print load_fiche_titre($page_name, '', 'title_setup'); // Get all notifications $notify = new GlobalNotify($db); $allNotifications = $notify->getAllNotifications(0, false); // All, including read // Get stuck cron jobs $sql = "SELECT rowid, label, module_name, datelastrun, processing, status FROM ".MAIN_DB_PREFIX."cronjob WHERE status = 1 ORDER BY processing DESC, label"; $resql = $db->query($sql); print '
'; // Actions print '
'; print 'Alle Benachrichtigungen löschen'; print 'Hängende Cron-Jobs zurücksetzen'; print '
'; // Cron Jobs Overview print ''; print ''; print ''; print ''; print ''; print ''; print ''; if ($resql) { while ($obj = $db->fetch_object($resql)) { print ''; print ''; print ''; print ''; print ''; print ''; } } print '
Cron-JobModulStatusLetzter Lauf
'.$obj->label.''.($obj->module_name ?: '-').''; if ($obj->processing) { print 'HÄNGT'; } else { print 'OK'; } print ''.dol_print_date($db->jdate($obj->datelastrun), 'dayhour').'
'; // All Notifications print '
'; print ''; print ''; print ''; print ''; print ''; print ''; print ''; print ''; if (empty($allNotifications)) { print ''; } else { foreach ($allNotifications as $notif) { print ''; print ''; print ''; print ''; print ''; print ''; print ''; } } print '
Benachrichtigungen ('.count($allNotifications).')ModulTypDatumStatus
Keine Benachrichtigungen
'; print ''.dol_escape_htmltag($notif['title']).'
'; print ''.dol_escape_htmltag($notif['message']).''; if (!empty($notif['action_url'])) { print '
'.$notif['action_label'].''; } print '
'.$notif['module'].''; $typeLabels = array( 'error' => 'Fehler', 'warning' => 'Warnung', 'info' => 'Info', 'success' => 'Erfolg', 'action' => 'Aktion', ); print $typeLabels[$notif['type']] ?? $notif['type']; print ''.dol_print_date($notif['created'], 'dayhour').''; if (!empty($notif['read'])) { print 'Gelesen'; } else { print 'Ungelesen'; } print '
'; print '
'; llxFooter(); $db->close();