1<?php 2 3// Pandora FMS - http://pandorafms.com 4// ================================================== 5// Copyright (c) 2005-2011 Artica Soluciones Tecnologicas 6// Please see http://pandorafms.org for full contribution list 7 8// This program is free software; you can redistribute it and/or 9// modify it under the terms of the GNU General Public License 10// as published by the Free Software Foundation for version 2. 11// This program is distributed in the hope that it will be useful, 12// but WITHOUT ANY WARRANTY; without even the implied warranty of 13// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14// GNU General Public License for more details. 15 16global $search_status; 17global $search_group; 18global $search_string; 19 20global $result; 21global $result_status; 22global $result_groups; 23global $result_resolutions; 24 25if (isset ($result_status['status'])) { 26 27 foreach($result_status['status'] as $st) { 28 $status[$st['id']] = $st['name']; 29 } 30} 31 32// Add special status cases 33$status[0] = __('Any'); 34$status[-10] = __('Not closed'); 35 36if (isset ($result_groups['group'])) { 37 foreach($result_groups['group'] as $gr) { 38 $groups[$gr['id']] = $gr['name']; 39 } 40} 41 42$resolutions[0] = __('None'); 43 44if (isset ($result_resolutions['resolution'])) { 45 foreach ($result_resolutions['resolution'] as $res) { 46 $resolutions[$res['id']] = $res['name']; 47 } 48} 49 50echo '<form method="post">'; 51 52echo '<br><table width="98%" border=0>'; 53echo '<tr>'; 54echo '<td>'; 55echo "<b>".__('Search string')."</b>"; 56echo '</td>'; 57echo '<td>'; 58echo "<b>".__('Status')."</b>"; 59echo '</td>'; 60echo '<td>'; 61echo "<b>".__('Group')."</b>"; 62echo '</td>'; 63echo '</tr><tr>'; 64echo '<td>'; 65html_print_input_text('search_string', $search_string, ''); 66echo '</td>'; 67echo '<td>'; 68html_print_select ($status, 'search_status', $search_status, '', '', 0, false); 69echo '</td>'; 70echo '<td>'; 71if (isset($groups)) { 72html_print_select ($groups, 'search_group', $search_group, '', '', 0, false, false, false); 73} 74echo '</td>'; 75echo '<td>'; 76html_print_submit_button (__('Search'), '', false, "class='sub search'"); 77echo '</td>'; 78echo '</tr></table>'; 79 80echo '</form>'; 81 82 83// Show headers 84$table->width = "98%"; 85$table->class = "databox"; 86$table->cellpadding = 4; 87$table->cellspacing = 4; 88$table->head = array (); 89$table->data = array (); 90$table->size = array (); 91$table->align = array (); 92 93$table->head[0] = __('ID'); 94$table->head[1] = __('Incident'); 95$table->head[2] = __('Group'); 96$table->head[3] = __('Status')."<br/><i>".__('Resolution')."</i>"; 97$table->head[4] = __('Priority'); 98$table->head[5] = __('Updated')."<br/><i>".__('Started')."</i>"; 99$table->head[6] = __('Details'); 100$table->head[7] = __('Creator'); 101$table->head[8] = __('Owner'); 102$table->head[9] = __('Action'); 103 104$table->align[3] = "center"; 105$table->align[4] = "center"; 106 107if(isset($result['incident'][0]) && is_array($result['incident'][0])) { 108 $incidents = $result['incident']; 109} 110else { 111 $incidents = array($result['incident']); 112} 113 114$rowPair = true; 115$iterator = 0; 116foreach ($incidents as $row) { 117 if ($rowPair) 118 $table->rowclass[$iterator] = 'rowPair'; 119 else 120 $table->rowclass[$iterator] = 'rowOdd'; 121 $rowPair = !$rowPair; 122 $iterator++; 123 124 $data = array(); 125 126 $data[0] = '<a href="index.php?login=1&sec=workspace&sec2=operation/integria_incidents/incident&tab=incident&id_incident='.$row["id_incidencia"].'">'.$row["id_incidencia"].'</a>'; 127 $data[1] = '<a href="index.php?login=1&sec=workspace&sec2=operation/integria_incidents/incident&tab=incident&id_incident='.$row["id_incidencia"].'">'.substr(io_safe_output($row["titulo"]),0,45).'</a>'; 128 $data[2] = $groups[$row["id_grupo"]]; 129 $data[3] = $status[$row["estado"]]."<br/><i>".$resolutions[$row["resolution"]]."</i>"; 130 $data[4] = incidents_print_priority_img ($row["prioridad"], true); 131 $data[5] = ui_print_timestamp ($row["actualizacion"], true)."<br/><i>" . ui_print_timestamp ($row["inicio"], true)."</i>"; 132 $data[6] = $row["workunits_hours"]." ".__('Hours')."<br/>".$row["workunits_count"]." ".__('Workunits'); 133 $data[7] = !empty($row["id_creator"]) ? $row["id_creator"] : __('None'); 134 $data[8] = !empty($row["id_usuario"]) ? $row["id_usuario"] : __('None'); 135 $data[9] = "<a href='index.php?sec=workspace&sec2=operation/integria_incidents/incident&delete_incident=".$row['id_incidencia']."'>".html_print_image("images/cross.png", true, array('title' => __('Delete incident')))."</a><a href='index.php?login=1&sec=workspace&sec2=operation/integria_incidents/incident&tab=incident&id_incident=".$row["id_incidencia"]."'>".html_print_image("images/config.png", true, array('title' => __('View incident details')))."</a>"; 136 137 array_push ($table->data, $data); 138} 139 140html_print_table ($table); 141?> 142