function ShowErrors($input = '') { global $DB, $LANG; $ci = new commonitem(); echo "<table class='tab_cadre' cellpadding='5' width='950'>"; echo "<tr class='tab_bg_1'>"; echo "<th>"; echo $LANG['plugin_fusioninventory']["processes"][1]; echo " <a href='" . GLPI_ROOT . "/plugins/fusioninventory/front/agents.processes.form.php'>(" . $LANG['common'][66] . ")</a>"; echo "</th>"; echo "<th>"; echo $LANG['common'][27]; echo "</th>"; echo "<th>"; echo $LANG['common'][17]; echo "</th>"; echo "<th>"; echo $LANG['common'][1]; echo "</th>"; echo "<th>"; echo $LANG['plugin_fusioninventory']["errors"][104]; echo "</th>"; echo "</tr>"; $condition = ""; if (isset($input['process_number'])) { $condition = "WHERE `process_number`='" . $input['process_number'] . "'"; if (isset($input['agent_type'])) { $condition .= " AND agent_type='" . $input['agent_type'] . "' "; } } $query = "SELECT * FROM `" . $this->table . "`\n " . $condition . "\n ORDER BY `process_number` DESC"; if ($result = $DB->query($query)) { while ($data = $DB->fetch_array($result)) { echo "<tr class='tab_bg_1 center'>"; echo "<td>"; echo $data['process_number']; echo "</td>"; echo "<td>"; echo convDateTime($data['date']); echo "</td>"; echo "<td>"; if ($data['agent_type'] == "SNMPQUERY") { echo $LANG['plugin_fusioninventory']["processes"][27]; } else { if ($data['agent_type'] == "NETDISCOVERY") { echo $LANG['plugin_fusioninventory']["processes"][26]; } } echo "</td>"; echo "<td>"; $ci->getFromDB($data['device_type'], $data['on_device']); echo $ci->getLink(1); echo "</td>"; echo "<td>"; echo $data['error_message']; echo "</td>"; echo "</tr>"; } } echo "</table>"; }
function ShowProcesses() { global $DB, $LANG; $ci = new commonitem(); echo "<table class='tab_cadre' cellpadding='5' width='1150'>"; $this->ShowHeader(); $i = 0; $query = "SELECT * FROM `" . $this->table . "`\n ORDER BY `process_number` DESC"; if ($result = $DB->query($query)) { while ($data = $DB->fetch_array($result)) { $i++; if ($i == '8') { echo "<tr class='tab_bg_2'>"; echo "<td colspan='14' height='5'></td>"; echo "</tr>"; $this->ShowHeader(); $i = 0; } echo "<tr class='tab_bg_2'>"; echo "<td colspan='14' height='5'></td>"; echo "</tr>"; echo "<tr class='tab_bg_1 center'>"; echo "<td rowspan='2'>"; echo $data['process_number']; echo "</td>"; echo "<td rowspan='2'>"; $ci->getFromDB(PLUGIN_FUSIONINVENTORY_SNMP_AGENTS, $data['FK_agent']); echo $ci->getLink(1); echo "</td>"; echo "<td rowspan='2'>"; switch ($data['status']) { case 3: echo "<img src='../pics/export.png' />"; break; case 2: echo "<img src='../pics/wait.png' />"; break; case 1: echo "<img src='../pics/ok2.png' />"; break; } echo "</td>"; echo "<td rowspan='2'>"; echo convDateTime($data['start_time']); echo "</td>"; echo "<td rowspan='2'>"; if ($data['start_time'] != '0000-00-00 00:00:00' and $data['end_time'] != '0000-00-00 00:00:00') { $duree_timestamp = strtotime($data['end_time']) - strtotime($data['start_time']); echo timestampToString($duree_timestamp); } else { echo '-'; } echo "</td>"; echo "<td height='28'>"; if ($data['start_time_discovery'] != '0000-00-00 00:00:00') { if ($data['end_time_discovery'] != '0000-00-00 00:00:00') { echo "<img src='../pics/export.png' />"; } else { echo "<img src='../pics/wait.png' />"; } } else { if ($data['discovery_core'] != '0') { echo "<img src='../pics/ok2.png' />"; } } echo "</td>"; echo "<td>"; if ($data['start_time_discovery'] != '0000-00-00 00:00:00') { echo convDateTime($data['start_time_discovery']); } else { echo '-'; } echo "</td>"; echo "<td>"; if ($data['start_time_discovery'] != '0000-00-00 00:00:00' and $data['end_time_discovery'] != '0000-00-00 00:00:00') { $duree_timestamp = strtotime($data['end_time_discovery']) - strtotime($data['start_time_discovery']); echo timestampToString($duree_timestamp); } else { echo '-'; } echo "</td>"; echo "<td>"; echo $data['discovery_core']; echo "</td>"; echo "<td>"; echo $data['discovery_threads']; echo "</td>"; echo "<td>"; echo $data['discovery_nb_ip']; echo "</td>"; echo "<td>"; echo $data['discovery_nb_found']; if ($data['discovery_nb_error'] > 0) { echo " / <a href='" . GLPI_ROOT . "/plugins/fusioninventory/front/agents.processes.form.php?process_number=" . $data['process_number'] . "&agent_type=NETDISCOVERY'>\n <font color='#ff0000'>" . $data['discovery_nb_error'] . "</font></a>"; } else { echo " / " . $data['discovery_nb_error']; } echo "</td>"; echo "<td>"; echo $data['discovery_nb_exists']; echo "</td>"; echo "<td>"; echo $data['discovery_nb_import']; echo "</td>"; echo "</tr>"; echo "<tr class='tab_bg_1 center'>"; echo "<td height='28'>"; if ($data['start_time_query'] != '0000-00-00 00:00:00') { if ($data['end_time_query'] != '0000-00-00 00:00:00') { echo "<img src='../pics/export.png' />"; } else { echo "<img src='../pics/wait.png' />"; } } else { if ($data['query_core'] != '0') { echo "<img src='../pics/ok2.png' />"; } } echo "</td>"; echo "<td>"; if ($data['start_time_query'] != '0000-00-00 00:00:00') { echo convDateTime($data['start_time_query']); } else { echo '-'; } echo "</td>"; echo "<td>"; if ($data['start_time_query'] != '0000-00-00 00:00:00' and $data['end_time_query'] != '0000-00-00 00:00:00') { $duree_timestamp = strtotime($data['end_time_query']) - strtotime($data['start_time_query']); echo timestampToString($duree_timestamp); } else { echo '-'; } echo "</td>"; echo "<td>"; echo $data['query_core']; echo "</td>"; echo "<td>"; echo $data['query_threads']; echo "</td>"; echo "<td>"; echo $data['query_nb_query']; echo "</td>"; echo "<td>"; if ($data['query_nb_error'] > 0) { echo "<a href='" . GLPI_ROOT . "/plugins/fusioninventory/front/agents.processes.form.php?process_number=" . $data['process_number'] . "&agent_type=SNMPQUERY'>\n <font color='#ff0000'>" . $data['query_nb_error'] . "</font></a>"; } else { echo $data['query_nb_error']; } echo "</td>"; echo "<td>"; if ($data['query_nb_connections_created'] > 0) { echo "<a href='" . GLPI_ROOT . "/plugins/fusioninventory/front/agents.processes.form.php?process_number=" . $data['process_number'] . "&created=1'>\n " . $data['query_nb_connections_created'] . "</a>"; } else { echo $data['query_nb_connections_created']; } echo "</td>"; echo "<td>"; if ($data['query_nb_connections_deleted'] > 0) { echo "<a href='" . GLPI_ROOT . "/plugins/fusioninventory/front/agents.processes.form.php?process_number=" . $data['process_number'] . "&created=0'>\n " . $data['query_nb_connections_deleted'] . "</a>"; } else { echo $data['query_nb_connections_deleted']; } echo "</td>"; echo "</tr>"; } } echo "<tr class='tab_bg_2'>"; echo "<td colspan='14' height='5'></td>"; echo "</tr>"; echo "</table>"; }