Example #1
0
function api_get_incident_files($return_type, $user, $id_incident)
{
    if (!check_user_incident($user, $id_incident)) {
        return;
    }
    $filter = array();
    $result = get_incident_files($id_incident);
    $result = clean_numerics($result);
    if ($result === false) {
        return '';
    }
    $ret = '';
    if ($return_type == 'xml') {
        $ret = "<xml>\n";
    }
    foreach ($result as $index => $item) {
        switch ($return_type) {
            case "xml":
                $ret .= "<file>\n";
                foreach ($item as $key => $value) {
                    if (!is_numeric($key)) {
                        $ret .= "<" . $key . ">" . $value . "</" . $key . ">\n";
                    }
                }
                $ret .= "</file>\n";
                break;
            case "csv":
                $ret .= array_to_csv($item);
                break;
        }
    }
    if ($return_type == 'xml') {
        $ret .= "</xml>\n";
    }
    return $ret;
}
Example #2
0
// CHECK LOGIN AND ACLs
check_login();
// SET VARS
$width = '99%';
if (!give_acl($config['id_user'], 0, "IR")) {
    audit_db($config['id_user'], $config["REMOTE_ADDR"], "ACL Violation", "Trying to access ticket viewer");
    require "general/noaccess.php";
    exit;
}
$incident_id = get_parameter('incident_id', 0);
if ($incident_id == 0) {
    ui_print_error_message(__('Unable to load ticket'));
    exit;
}
// GET THE FILES
$incident['files'] = get_incident_files($incident_id, true);
if ($incident['files'] === false) {
    $incident['files'] = array();
}
// SHOW THE FILES
$table->class = 'result_table listing';
$table->width = $width;
$table->id = 'incident_search_result_table';
$separator_style = 'border-bottom: 1px solid rgb(204, 204, 204);border-top: 1px solid rgb(204, 204, 204);';
$table->style = array();
$table->data = array();
$table->rowstyle = array();
$table->head = array();
$files = '';
$row = 0;
if (empty($incident['files'])) {
Example #3
0
	$table->data[0][0] = print_textarea ("file_description", 5, 40, '', '', true, __('Description'));
	$table->data[1][0] = print_submit_button (__('Add'), 'crt_btn', false, 'class="sub create"', true);
	print_table($table);
	echo "</div>";

}


if ($clean_output) {
	echo '<h1 class="ticket_clean_report_title">'.__("Files")."</h1>";
} else {
	echo "<h3>".__('Files')."</h3>";
}

// Files attached to this incident
$files = get_incident_files ($id);
if ($files === false) {
	$files = array();
	echo '<h4 id="no_files_message">'.__('No files were added to the ticket').'</h4>';
	$hidden = "style=\"display:none;\"";
}

echo "<div style='width: 90%; margin: 0 auto;'>";
echo "<table id='table-incident_files' $hidden class=listing cellpadding=0 cellspacing=0 width='100%'>";
echo "<tr>";
echo "<th>".__('Filename');
echo "<th>".__('Timestamp');
echo "<th>".__('Description');
echo "<th>".__('ID user');
echo "<th>".__('Size');
/**
 * Return an array with the incident details, files and workunits
 *
 * @param array List of incidents to get stats.
 *
 */
function get_full_incident($id_incident, $only_names = false)
{
    $full_incident['details'] = get_db_row_filter('tincidencia', array('id_incidencia' => $id_incident), '*');
    $full_incident['files'] = get_incident_files($id_incident, true);
    if ($full_incident['files'] === false) {
        $full_incident['files'] = array();
    }
    $full_incident['workunits'] = get_incident_full_workunits($id_incident);
    if ($full_incident['workunits'] === false) {
        $full_incident['workunits'] = array();
    }
    return $full_incident;
}