* * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ /** * \file netdiag/netdiagindex.php * \ingroup netdiag * \brief Liste aller Netzwerk-Diagnose-Protokolle (Backend) */ // Dolibarr-Umgebung laden $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/class/html.formcompany.class.php'; require_once __DIR__.'/class/netdiagprotocol.class.php'; /** * @var DoliDB $db * @var Translate $langs * @var User $user */ $langs->loadLangs(array("netdiag@netdiag", "companies", "orders")); if (!$user->hasRight('netdiag', 'protocol', 'read')) { accessforbidden(); } $search_ref = GETPOST('search_ref', 'alpha'); $search_soc = GETPOST('search_soc', 'alpha'); $limit = GETPOSTINT('limit') ? GETPOSTINT('limit') : $conf->liste_limit; $page = GETPOSTINT('page'); if ($page < 0) { $page = 0; } $offset = $limit * $page; /* * Ansicht */ $form = new Form($db); $title = $langs->trans("NetDiagProtocols"); llxHeader('', $title, '', '', 0, 0, '', '', '', 'mod-netdiag page-list'); // Datensätze laden $sql = "SELECT p.rowid, p.ref, p.label, p.date_diag, p.standort, p.subnet, p.status,"; $sql .= " s.rowid as socid, s.nom as socname,"; $sql .= " (SELECT COUNT(*) FROM ".$db->prefix()."netdiag_device d WHERE d.fk_protocol = p.rowid) as devcount"; $sql .= " FROM ".$db->prefix()."netdiag_protocol as p"; $sql .= " LEFT JOIN ".$db->prefix()."societe as s ON s.rowid = p.fk_soc"; $sql .= " WHERE p.entity IN (".getEntity('netdiagprotocol').")"; if ($search_ref) { $sql .= natural_search('p.ref', $search_ref); } if ($search_soc) { $sql .= natural_search('s.nom', $search_soc); } $sql .= " ORDER BY p.date_diag DESC, p.rowid DESC"; $sql .= $db->plimit($limit, $offset); $resql = $db->query($sql); $rows = array(); if ($resql) { while ($obj = $db->fetch_object($resql)) { $rows[] = $obj; } } print load_fiche_titre($title, '', 'fa-network-wired'); print '
'; print '
'; print ''; print ''; print ''; print ''; print ''; print ''; print ''; print ''; print ''; print ''; print ''; print ''; print ''; print ''; $proto = new NetDiagProtocol($db); foreach ($rows as $obj) { $proto->id = $obj->rowid; $proto->status = $obj->status; $cardurl = dol_buildpath('/netdiag/netdiagprotocol_card.php', 1).'?id='.$obj->rowid; print ''; print ''; if ($obj->socid) { print ''; } else { print ''; } print ''; print ''; print ''; print ''; print ''; } if (empty($rows)) { print ''; } print '
'.$langs->trans("Ref").''.$langs->trans("ThirdParty").''.$langs->trans("DateDiag").''.$langs->trans("Location").''.$langs->trans("NetDiagDevices").''.$langs->trans("Status").'
'.img_picto('', 'fa-network-wired').' '.dol_escape_htmltag($obj->ref).''.dol_escape_htmltag($obj->socname).''.dol_print_date($db->jdate($obj->date_diag), 'dayhour').''.dol_escape_htmltag($obj->standort).''.((int) $obj->devcount).''.$proto->getLibStatut(3).'
'.$langs->trans("NoRecordFound").'
'; print '
'; print '
'; llxFooter(); $db->close();