Esempio n. 1
0
				$incident_detail .= "</tr>";
				$incident_detail .= "<tr>";
				$incident_detail .= "<td><strong>".__("Time no third people")."</strong>:</td>";
				$incident_detail .= "<td style='text-align:right;'>".give_human_time($stats[INCIDENT_METRIC_TOTAL_TIME_NO_THIRD],true,true,true)."</td>";
				$incident_detail .= "</tr>";
				//$incident_detail .= "</table>";
				
				echo print_container('incident_tracking_detail', __('General statistics'), $incident_detail, 'open', true, '20px', '', '', 1, 'less_widht');
			echo "</td>";
			echo "<td style='vertical-align:top; width: 33%;'>";
				$workunit_count = get_incident_count_workunits ($id);
				//$workunit_detail = "<table class='details_table alternate'>";
				if ($workunit_count) {
					$work_hours = get_incident_workunit_hours ($id);
					$workunits = get_incident_workunits ($id);	
					$workunit_data = get_workunit_data ($workunits[0]['id_workunit']);
					$workunit_detail = "<tr>";
					$workunit_detail .= "<td><strong>".__("Last work at")."</strong>:</td>";
					$workunit_detail .= "<td style='text-align:right;'>".human_time_comparation ($workunit_data['timestamp'])."</td>";
					$workunit_detail .= "</tr>";
					$workunit_detail .= "<tr>";
					$workunit_detail .= "<td><strong>".__("Workunits")."</strong>:</td>";
					$workunit_detail .= "<td style='text-align:right;'>".$workunit_count."</td>";
					$workunit_detail .= "</tr>";				
					$workunit_detail .= "<tr>";
					$workunit_detail .= "<td><strong>".__("Time used")."</strong>:</td>";
					$workunit_detail .= "<td style='text-align:right;'>".give_human_time($work_hours*SECONDS_1HOUR,true,true,true)."</td>";
					$workunit_detail .= "</tr>";
					$workunit_detail .= "<tr>";
					$workunit_detail .= "<td><strong>".__("Reported by")."</strong>:</td>";
					$name = get_db_value ('nombre_real', 'tusuario', 'id_usuario', $workunit_data['id_user']);
Esempio n. 2
0
function incident_details_list($id_incident, $return = false)
{
    $output = '';
    $incident = get_incident($id_incident);
    $output .= '<ul id="incident-details-list" class="sidemenu">';
    $output .= '&nbsp;&nbsp;<strong>' . __('Open at') . '</strong>: ' . human_time_comparation($incident['inicio']);
    if ($incident['estado'] == 7) {
        $output .= '<br />&nbsp;&nbsp;<strong>' . __('Closed at') . '</strong>: ' . human_time_comparation($incident['cierre']);
    }
    if ($incident['actualizacion'] != $incident['inicio']) {
        $output .= '<br />&nbsp;&nbsp;<strong>' . __('Last update') . '</strong>: ' . human_time_comparation($incident['actualizacion']);
    }
    /* Show workunits if there are some */
    $workunit_count = get_incident_count_workunits($id_incident);
    if ($workunit_count) {
        $work_hours = get_incident_workunit_hours($id_incident);
        $workunits = get_incident_workunits($id_incident);
        $workunit_data = get_workunit_data($workunits[0]['id_workunit']);
        $output .= '<br />&nbsp;&nbsp;<strong>' . __('Last work at') . '</strong>: ' . human_time_comparation($workunit_data['timestamp']);
        $output .= '<br />&nbsp;&nbsp;<strong>' . __('Workunits') . '</strong>: ' . $workunit_count;
        $output .= '<br />&nbsp;&nbsp;<strong>' . __('Time used') . '</strong>: ' . $work_hours;
        $output .= '<br />&nbsp;&nbsp;<strong>' . _('Done by') . '</strong>: <em>' . $workunit_data['id_user'] . '</em>';
    }
    $output .= '</ul>';
    if ($return) {
        return $output;
    }
    echo $output;
}
Esempio n. 3
0
    echo '<li class="ui-tabs-title">';
    echo "<h2>" . __('Comments') . "</h2>";
    echo '</li>';
    echo '</ul>';
} else {
    echo "<h1 class='ticket_clean_report_title'>" . __('Comments') . "</h1>";
}
echo '<div id="comment-list">';
// Workunit view
$workunits = get_incident_workunits($id_incident);
if (!$workunits) {
    echo '<h4>' . __('No comment was done in this ticket') . '</h4>';
    return;
}
foreach ($workunits as $workunit) {
    $workunit_data = get_workunit_data($workunit['id_workunit']);
    echo '<div class="comment">';
    show_workunit_data($workunit_data, $title);
    echo '</div>';
}
echo '</div>';
?>

<script type="text/javascript">
	// Enclose in its own scope
	(function ($) {
		// Comment form controller
		var $commentForm = $("form#form-add-workunit");
		var $commentList = $("div#comment-list");

		var $commentProfile = $commentForm.find('select#work_profile');
Esempio n. 4
0
function api_get_incident_workunits($return_type, $user, $id_incident)
{
    if (!check_user_incident($user, $id_incident)) {
        return;
    }
    $filter = array();
    $workunits = get_incident_workunits($id_incident);
    if ($workunits == false) {
        return '';
    }
    $result = array();
    foreach ($workunits as $wu) {
        $result[$wu['id']] = get_workunit_data($wu['id_workunit']);
    }
    if ($result === false) {
        return '';
    }
    $ret = '';
    if ($return_type == 'xml') {
        $ret = "<xml>\n";
    }
    foreach ($result as $index => $item) {
        switch ($return_type) {
            case "xml":
                $ret .= "<workunit>\n";
                foreach ($item as $key => $value) {
                    if (!is_numeric($key)) {
                        $ret .= "<" . $key . ">" . $value . "</" . $key . ">\n";
                    }
                }
                $ret .= "</workunit>\n";
                break;
            case "csv":
                $ret .= array_to_csv($item);
                break;
        }
    }
    if ($return_type == 'xml') {
        $ret .= "</xml>\n";
    }
    return $ret;
}
/**
 * Return the last entered WU in a given incident
 *
 * @param int Incident id
 *
 * @return array WU structure
 */
function get_incident_lastworkunit($id_incident)
{
    $workunits = get_incident_workunits($id_incident);
    if (!isset($workunits[0]['id_workunit'])) {
        return;
    }
    $workunit_data = get_workunit_data($workunits[0]['id_workunit']);
    return $workunit_data;
}