/** * Display command result * * @param $message * **/ static function displayCommandResult(PluginShellcommandsShellcommand $shellcommands, $targetParam, $message, $error) { global $CFG_GLPI; $result = PluginShellcommandsShellcommand::handleShellcommandResult($error, $message); // Result icon echo "<tr class='tab_bg_1 shellcommands_result_line'>"; switch ($result) { case PluginShellcommandsShellcommand::OK_RESULT: echo "<td class='center'><img src='" . $CFG_GLPI["root_doc"] . "/plugins/shellcommands/pics/ok.png'></td>"; break; case PluginShellcommandsShellcommand::WARNING_RESULT: echo "<td class='center'><img src='" . $CFG_GLPI["root_doc"] . "/plugins/shellcommands/pics/warning.png'></td>"; break; case PluginShellcommandsShellcommand::KO_RESULT: echo "<td class='center'><img src='" . $CFG_GLPI["root_doc"] . "/plugins/shellcommands/pics/ko.png'></td>"; break; case PluginShellcommandsShellcommand::CRITICAL_RESULT: echo "<td class='center'><img src='" . $CFG_GLPI["root_doc"] . "/plugins/shellcommands/pics/ko.png'></td>"; break; } echo "<td class='center'>" . $shellcommands->getName() . "</td>"; // Result short message switch ($result) { case PluginShellcommandsShellcommand::OK_RESULT: echo "<td class='center'><div class='shellcommands_result_ok'>OK</div></td>"; break; case PluginShellcommandsShellcommand::WARNING_RESULT: echo "<td class='center'><div class='shellcommands_result_warning'>WARNING</div></td>"; break; case PluginShellcommandsShellcommand::KO_RESULT: echo "<td class='center'><div class='shellcommands_result_ko'>KO</div></td>"; break; case PluginShellcommandsShellcommand::CRITICAL_RESULT: echo "<td class='center'><div class='shellcommands_result_ko'>CRITICAL</div></td>"; break; } echo "<td>"; if ($command = PluginShellcommandsShellcommand_Item::getCommandLine($shellcommands->getID(), $targetParam)) { echo "<b> > " . $command . "</b><br>"; } if ($shellcommands->getName() !== PluginShellcommandsShellcommand_Item::WOL_COMMAND_NAME) { echo "<font color='blue'>" . nl2br($message) . "</font>"; } else { echo nl2br($message); } echo "</td>"; echo "</tr>"; }