function incidents_search_result_group_by_project($filter, $ajax = false, $return_incidents = false, $print_result_count = false) { global $config; // ---------------------------------------- // Here we print the result of the search // ---------------------------------------- echo '<table width="99%" cellpadding="0" cellspacing="0" border="0px" class="result_table listing" id="incident_search_result_table">'; echo '<thead>'; echo "<tr>"; echo "<th>"; echo print_checkbox('incidentcb-all', "", false, true); echo "</th>"; echo "<th>"; echo __('ID'); echo "</th>"; echo "<th>"; echo __('SLA'); echo "</th>"; echo "<th>"; echo __('Ticket'); echo "</th>"; echo "<th>"; echo __('Group') . "<br><i>" . __('Company') . "</i>"; echo "</th>"; echo "<th>"; echo __('Status') . "<br><i>" . __('Resolution') . "</i>"; echo "</th>"; echo "<th>"; echo __('Priority'); echo "</th>"; echo "<th style='width: 70px;'>"; echo __('Updated') . "<br><i>" . __('Started') . "</i>"; echo "</th>"; if ($config["show_creator_incident"] == 1) { echo "<th>"; } echo __('Creator'); echo "</th>"; if ($config["show_owner_incident"] == 1) { echo "<th>"; } echo __('Owner'); echo "</th>"; echo "</tr>"; echo '</thead>'; echo "<tbody>"; $tasks_in_tickets = incidents_get_filter_tickets_tree($filter, 'tasks'); if ($tasks_in_tickets === false) { $tasks_in_tickets = array(); } $i = 0; $tickets_str = ''; $add_no_project = false; foreach ($tasks_in_tickets as $task_ticket) { if ($i == 0) { $tickets_str = $task_ticket['id_task']; } else { $tickets_str .= ',' . $task_ticket['id_task']; } if ($task_ticket['id_task'] == 0) { $add_no_project = true; } $i++; } if (!empty($tasks_in_tickets)) { $sql = "SELECT t1.name as n_task, t2.name as n_project, t1.id as id_task FROM ttask t1, tproject t2\n\t\t\tWHERE t1.id_project=t2.id AND t1.id IN ({$tickets_str})\n\t\t\tORDER BY t2.name"; $tickets = get_db_all_rows_sql($sql); } else { $tickets = false; } if ($tickets === false) { $tickets = array(); } if ($add_no_project) { $tickets[$i]['id_task'] = 0; $tickets[$i]['n_project'] = __('No associated project'); } foreach ($tickets as $task_ticket) { $task = get_db_row('ttask', 'id', $task_ticket['id_task']); $img = print_image("images/input_create.png", true, array("style" => 'vertical-align: middle;', "id" => $img_id)); $img_task = print_image("images/task.png", true, array("style" => 'vertical-align: middle;')); //tickets in task $filter['id_task'] = $task_ticket['id_task']; $tickets_in_task = incidents_get_filter_tickets_tree($filter, 'tickets'); $count_tickets = count($tickets_in_task); //print ticket with task if ($task_ticket['id_task'] != 0) { $project_name = $task_ticket['n_project'] . ' - ' . $task_ticket['n_task']; } else { $project_name = $task_ticket['n_project']; } //print project-task echo '<tr><td colspan="10" valign="top">'; echo "\n\t\t<a onfocus='JavaScript: this.blur()' href='javascript: check_rows(\"" . $task_ticket['id_task'] . "\")'>" . $img . " " . $img_task . " " . safe_output($project_name) . " " . "({$count_tickets})" . "</a>" . " "; echo '</td></tr>'; foreach ($tickets_in_task as $incident) { $class = $task_ticket['id_task'] . "-task"; $tr_status = 'class="' . $class . '"'; if ($incident["estado"] < 3) { $tr_status = 'class="red_row ' . $class . '"'; } elseif ($incident["estado"] < 6) { $tr_status = 'class="yellow_row ' . $class . '"'; } else { $tr_status = 'class="green_row ' . $class . '"'; } echo '<tr ' . $tr_status . ' id="incident-' . $incident['id_incidencia'] . '"'; echo " style='border-bottom: 1px solid #ccc;' >"; echo '<td>'; print_checkbox_extended('incidentcb-' . $incident['id_incidencia'], $incident['id_incidencia'], false, '', '', 'class="cb_incident"'); echo '</td>'; //Print incident link if not ajax, if ajax link to js funtion to replace parent $link = "index.php?sec=incidents&sec2=operation/incidents/incident_dashboard_detail&id=" . $incident["id_incidencia"]; if ($ajax) { $link = "javascript:update_parent('" . $incident["id_incidencia"] . "')"; } echo '<td>'; echo '<strong><a href="' . $link . '">#' . $incident['id_incidencia'] . '</a></strong></td>'; // SLA Fired ?? if ($incident["affected_sla_id"] != 0) { echo '<td width="25"><img src="images/exclamation.png" /></td>'; } else { echo '<td></td>'; } echo '<td>'; echo '<strong><a href="' . $link . '">' . $incident['titulo'] . '</a></strong><br>'; echo "<span style='font-size:11px;font-style:italic'>"; echo incidents_get_incident_type_text($incident["id_incidencia"]); // Added by slerena 26Ago2013 $sql = sprintf("SELECT *\n\t\t\t\t\t\t\tFROM tincident_type_field\n\t\t\t\t\t\t\tWHERE id_incident_type = %d", $incident["id_incident_type"]); $config['mysql_result_type'] = MYSQL_ASSOC; $type_fields = get_db_all_rows_sql($sql); $type_fields_values_text = ""; if ($type_fields) { foreach ($type_fields as $type_field) { if ($type_field["show_in_list"]) { $field_data = get_db_value_filter("data", "tincident_field_data", array("id_incident" => $incident["id_incidencia"], "id_incident_field" => $type_field["id"])); if ($field_data) { if ($type_field["type"] == "textarea") { $field_data = "<div style='display: inline-block;' title='{$field_data}'>" . substr($field_data, 0, 15) . "...</div>"; } $type_fields_values_text .= " <div title='" . $type_field["label"] . "' style='display: inline-block;'>[{$field_data}]</div>"; } } } } echo " {$type_fields_values_text}"; echo '</span></td>'; echo '<td>' . get_db_value("nombre", "tgrupo", "id_grupo", $incident['id_grupo']); if ($config["show_creator_incident"] == 1) { $id_creator_company = get_db_value("id_company", "tusuario", "id_usuario", $incident["id_creator"]); if ($id_creator_company != 0) { $company_name = (string) get_db_value('name', 'tcompany', 'id', $id_creator_company); echo "<br><span style='font-size:11px;font-style:italic'>{$company_name}</span>"; } } echo '</td>'; $resolution = isset($resolutions[$incident['resolution']]) ? $resolutions[$incident['resolution']] : __('None'); echo '<td class="f9"><strong>' . $statuses[$incident['estado']] . '</strong><br /><em>' . $resolution . '</em></td>'; // priority echo '<td>'; print_priority_flag_image($incident['prioridad']); $last_wu = get_incident_lastworkunit($incident["id_incidencia"]); if ($last_wu["id_user"] == $incident["id_creator"]) { echo "<br><img src='images/comment.gif' title='" . $last_wu["id_user"] . "'>"; } echo '</td>'; echo '<td style="font-size:11px;">' . human_time_comparation($incident["actualizacion"]); // Show only if it's different if ($incident["inicio"] != $incident["actualizacion"]) { echo "<br><em>[" . human_time_comparation($incident["inicio"]); echo "]</em>"; } echo "<br>"; echo '<span style="font-size:9px;">'; if (isset($config["show_user_name"]) && $config["show_user_name"]) { $updated_by = get_db_value('nombre_real', 'tusuario', 'id_usuario', $last_wu["id_user"]); } else { $updated_by = $last_wu["id_user"]; } //~ echo $last_wu["id_user"]; echo $updated_by; echo "</span>"; echo '</td>'; if ($config["show_creator_incident"] == 1) { echo "<td class='f9'>"; $incident_creator = $incident["id_creator"]; echo substr($incident_creator, 0, 12); echo "</td>"; } if ($config["show_owner_incident"] == 1) { echo "<td class='f9'>"; $incident_owner = $incident["id_usuario"]; echo substr($incident_owner, 0, 12); echo "</td>"; } echo '</tr>'; } } echo '</tbody>'; echo '</table>'; }
$table->class = "none"; $table->size = array(); $table->size[0] = '50%'; $table->size[1] = '50%'; $table->style = array(); $table->data = array(); $table->cellspacing = 0; $table->cellpadding = 0; $table->style[0] = "vertical-align: top"; $table->style[1] = "vertical-align: top"; $resolution = incidents_get_incident_resolution_text($id); $priority = incidents_get_incident_priority_text($id); $priority_image = print_priority_flag_image($incident['prioridad'], true); $group = incidents_get_incident_group_text($id); $status = incidents_get_incident_status_text($id); $type = incidents_get_incident_type_text($id); // Get the status color and icon if ($incident['estado'] < 3) { $status_color = STATUS_COLOR_NEW; $status_icon = 'status_new'; } else { if ($incident['estado'] < 7) { $status_color = STATUS_COLOR_PENDING; $status_icon = 'status_pending'; } else { $status_color = STATUS_COLOR_CLOSED; $status_icon = 'status_closed'; } } // Details $incident_details = "<table width='97%' id='details_table'>";
private function getIncidentDetail() { $system = System::getInstance(); $ui = Ui::getInstance(); $incident = get_db_row("tincidencia", "id_incidencia", $this->id_incident); if (!$incident) { $html = "<h2 class=\"error\">" . __('Ticket not found') . "</h2>"; } else { include_once $system->getConfig('homedir') . "/include/functions_incidents.php"; // DETAILS $resolution = incidents_get_incident_resolution_text($incident['id_incidencia']); $priority = incidents_get_incident_priority_text($incident['id_incidencia']); $priority_image = print_priority_flag_image($incident['prioridad'], true, "../"); $group = incidents_get_incident_group_text($incident['id_incidencia']); $status = incidents_get_incident_status_text($incident['id_incidencia']); $type = incidents_get_incident_type_text($incident['id_incidencia']); // Get the status icon if ($incident['estado'] < 3) { $status_icon = 'status_new'; } else { if ($incident['estado'] < 7) { $status_icon = 'status_pending'; } else { $status_icon = 'status_closed'; } } $ui->contentBeginGrid(); // $options = array( // 'action' => "index.php?page=incidents", // 'method' => 'POST', // 'data-ajax' => 'false' // ); // $ui->beginForm($options); // // Filter status // $values = array(); // $values[0] = __('Any'); // $values[-10] = __('Not closed'); // $status_table = process_sql ("select * from tincident_status"); // foreach ($status_table as $status) { // $values[$status['id']] = __($status['name']); // } // $options = array( // 'name' => 'filter_status', // 'title' => __('Status'), // 'items' => $values, // 'selected' => $this->filter_status // ); // $ui->formAddSelectBox($options); // $form_html = $ui->getEndForm(); $status_cell = "<div class='detail-element'>\n\t\t\t\t\t\t\t\t" . __('Status') . "<br>\n\t\t\t\t\t\t\t\t<img src='../images/{$status_icon}.png'><br>\n\t\t\t\t\t\t\t\t<strong>{$status}</strong>\n\t\t\t\t\t\t\t</div>"; $ui->contentGridAddCell($status_cell); $group_cell = "<div class='detail-element'>\n\t\t\t\t\t\t\t\t" . __('Group') . "<br>\n\t\t\t\t\t\t\t\t<img src='../images/group.png'><br>\n\t\t\t\t\t\t\t\t<strong>{$group}</strong>\n\t\t\t\t\t\t\t</div>"; $ui->contentGridAddCell($group_cell); $priority_cell = "<div class='detail-element'>\n\t\t\t\t\t\t\t\t" . __('Priority') . "<br>\n\t\t\t\t\t\t\t\t{$priority_image}<br>\n\t\t\t\t\t\t\t\t<strong>{$priority}</strong>\n\t\t\t\t\t\t\t</div>"; $ui->contentGridAddCell($priority_cell); $resolution_cell = "<div class='detail-element'>\n\t\t\t\t\t\t\t\t" . __('Resolution') . "<br>\n\t\t\t\t\t\t\t\t<img src='../images/resolution.png'><br>\n\t\t\t\t\t\t\t\t<strong>{$resolution}</strong>\n\t\t\t\t\t\t\t</div>"; $ui->contentGridAddCell($resolution_cell); $type_cell = "<div class='detail-element'>\n\t\t\t\t\t\t\t\t" . __('Type') . "<br>\n\t\t\t\t\t\t\t\t<img src='../images/incident.png'><br>\n\t\t\t\t\t\t\t\t<strong>{$type}</strong>\n\t\t\t\t\t\t\t</div>"; $ui->contentGridAddCell($type_cell); $detail_grid = $ui->getContentEndGrid(); $ui->contentBeginCollapsible(__('Details')); $ui->contentCollapsibleAddItem($detail_grid); $detail = $ui->getEndCollapsible("", "b", "c", false); $detail = "<div style='padding-left: 2px; padding-right: 2px;'>{$detail}</div>"; // DESCRIPTION if ($incident['descripcion'] != "") { $ui->contentBeginCollapsible(__('Description')); $ui->contentCollapsibleAddItem($incident['descripcion']); $description = $ui->getEndCollapsible("", "b", "c", false); } // CUSTOM FIELDS if ($incident['id_incident_type']) { $type_name = get_db_value("name", "tincident_type", "id", $incident['id_incident_type']); $fields = incidents_get_all_type_field($incident['id_incident_type'], $incident['id_incidencia']); $custom_fields = ""; $ui->contentBeginCollapsible($type_name); foreach ($fields as $field) { $custom_fields = $field["label"] . ": <strong>" . $field["data"] . "</strong>"; $ui->contentCollapsibleAddItem($custom_fields); } $custom_fields = $ui->getEndCollapsible("", "b", "c", false); } // PEOPLE $ui->contentBeginGrid(); $name_creator = get_db_value_filter("nombre_real", "tusuario", array("id_usuario" => $incident['id_creator'])); $avatar_creator = get_db_value_filter("avatar", "tusuario", array("id_usuario" => $incident['id_creator'])); $creator_cell = "<div style='text-align: center;'>\n\t\t\t\t\t\t\t\t\t\t<div class='bubble_little'>\n\t\t\t\t\t\t\t\t\t\t\t<img src='../images/avatars/{$avatar_creator}.png'>\n\t\t\t\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t\t\t<strong style='color: #FF9933'>" . __('Created by') . ":</strong><br>\n\t\t\t\t\t\t\t\t\t{$name_creator}\n\t\t\t\t\t\t\t\t</div>"; $ui->contentGridAddCell($creator_cell); $name_owner = get_db_value_filter("nombre_real", "tusuario", array("id_usuario" => $incident['id_usuario'])); $avatar_owner = get_db_value_filter("avatar", "tusuario", array("id_usuario" => $incident['id_usuario'])); $owner_cell = "<div style='text-align: center;'>\n\t\t\t\t\t\t\t\t\t\t<div class='bubble_little'>\n\t\t\t\t\t\t\t\t\t\t\t<img src='../images/avatars/{$avatar_owner}.png'>\n\t\t\t\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t\t\t<strong style='color: #FF9933'>" . __('Owned by') . ":</strong><br>\n\t\t\t\t\t\t\t\t\t{$name_owner}\n\t\t\t\t\t\t\t\t</div>"; $ui->contentGridAddCell($owner_cell); if ($incident['estado'] == STATUS_CLOSED) { if (empty($incident["closed_by"])) { $name_closer = __('Unknown'); $avatar_closer = '../avatar_unknown'; } else { $name_closer = get_db_value_filter("nombre_real", "tusuario", array("id_usuario" => $incident['closed_by'])); $avatar_closer = get_db_value_filter("avatar", "tusuario", array("id_usuario" => $incident['closed_by'])); } $closer_cell = "<div style='text-align: center;'>\n\t\t\t\t\t\t\t\t\t\t<div class='bubble_little'>\n\t\t\t\t\t\t\t\t\t\t\t<img src='../images/avatars/{$avatar_closer}.png'>\n\t\t\t\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t\t\t\t<strong style='color: #FF9933'>" . __('Closed by') . ":</strong><br>\n\t\t\t\t\t\t\t\t\t\t{$name_creator}\n\t\t\t\t\t\t\t\t\t</div>"; $ui->contentGridAddCell($closer_cell); } $people_grid = $ui->getContentEndGrid(); $ui->contentBeginCollapsible(__('People')); $ui->contentCollapsibleAddItem($people_grid); $people = $ui->getEndCollapsible("", "b", "c"); // DATES $ui->contentBeginGrid(); $created_timestamp = strtotime($incident['inicio']); $created_cell .= "<table width='97%' style='text-align: center;' id='incidents_dates_square'>"; $created_cell .= "<tr>"; $created_cell .= "<td>" . __('Created on') . ":</td>"; $created_cell .= "</tr>"; $created_cell .= "<tr>"; $created_cell .= "<td id='created_on' class='mini_calendar'>"; $created_cell .= "<table>"; $created_cell .= "<tr>"; $created_cell .= "<th>" . strtoupper(date('M\' y', $created_timestamp)) . "</th>"; $created_cell .= "</tr>"; $created_cell .= "<tr>"; $created_cell .= "<td class='day'>" . date('d', $created_timestamp) . "</td>"; $created_cell .= "</tr>"; $created_cell .= "<tr>"; $created_cell .= "<td class='time'><img src='../images/cal_clock_grey.png'> " . date('H:i:s', $created_timestamp) . "</td>"; $created_cell .= "</tr>"; $created_cell .= "</table>"; $created_cell .= "</td>"; $created_cell .= "</tr>"; $created_cell .= "</table>"; $ui->contentGridAddCell($created_cell); $updated_timestamp = strtotime($incident['actualizacion']); $updated_cell .= "<table width='97%' style='text-align: center;' id='incidents_dates_square'>"; $updated_cell .= "<tr>"; $updated_cell .= "<td>" . __('Updated on') . ":</td>"; $updated_cell .= "</tr>"; $updated_cell .= "<tr>"; $updated_cell .= "<td id='updated_on' class='mini_calendar'>"; $updated_cell .= "<table>"; $updated_cell .= "<tr>"; $updated_cell .= "<th>" . strtoupper(date('M\' y', $updated_timestamp)) . "</th>"; $updated_cell .= "</tr>"; $updated_cell .= "<tr>"; $updated_cell .= "<td class='day'>" . date('d', $updated_timestamp) . "</td>"; $updated_cell .= "</tr>"; $updated_cell .= "<tr>"; $updated_cell .= "<td class='time'><img src='../images/cal_clock_orange.png'> " . date('H:i:s', $updated_timestamp) . "</td>"; $updated_cell .= "</tr>"; $updated_cell .= "</table>"; $updated_cell .= "</td>"; $updated_cell .= "</tr>"; $updated_cell .= "</table>"; $ui->contentGridAddCell($updated_cell); if ($incident["estado"] == STATUS_CLOSED) { $closed_timestamp = strtotime($incident['cierre']); $closed_cell .= "<table width='97%' style='text-align: center;' id='incidents_dates_square'>"; $closed_cell .= "<tr>"; $closed_cell .= "<td>" . __('Closed on') . ":</td>"; $closed_cell .= "</tr>"; $closed_cell .= "<tr>"; $closed_cell .= "<td id='closed_on' class='mini_calendar'>"; $closed_cell .= "<table>"; $closed_cell .= "<tr>"; $closed_cell .= "<th>" . strtoupper(date('M\' y', $closed_timestamp)) . "</th>"; $closed_cell .= "</tr>"; $closed_cell .= "<tr>"; $closed_cell .= "<td class='day'>" . date('d', $closed_timestamp) . "</td>"; $closed_cell .= "</tr>"; $closed_cell .= "<tr>"; $closed_cell .= "<td class='time'><img src='../images/cal_clock_darkgrey.png'> " . date('H:i:s', $closed_timestamp) . "</td>"; $closed_cell .= "</tr>"; $closed_cell .= "</table>"; $closed_cell .= "</td>"; $closed_cell .= "</tr>"; $closed_cell .= "</table>"; $ui->contentGridAddCell($closed_cell); } $dates_grid = $ui->getContentEndGrid(); $ui->contentBeginCollapsible(__('Dates')); $ui->contentCollapsibleAddItem($dates_grid); $dates = $ui->getEndCollapsible("", "b", "c"); if ($system->getConfig('enabled_ticket_editor')) { $ui->contentBeginCollapsible(__('Quick edit')); $ui->contentCollapsibleAddItem($this->getIncidentQuickForm($incident)); $quick_edit = $ui->getEndCollapsible("", "b", "c"); } else { $quick_edit = ""; } $html = "<h1 class='title'>" . $incident['titulo'] . "</h1>"; $html .= $detail; if (!$description || !$custom_fields) { if ($description) { $html .= $description; } if ($custom_fields) { $html .= $custom_fields; } } else { $ui->contentBeginGrid(); $ui->contentGridAddCell($description); $ui->contentGridAddCell($custom_fields); $html .= $ui->getContentEndGrid(); } $ui->contentBeginGrid(); $ui->contentGridAddCell($people); $ui->contentGridAddCell($dates); $html .= $ui->getContentEndGrid(); $html .= $quick_edit; } return $html; }