';
$table_files_section->data[1][0] .= html_print_input_text(
'file_description',
'',
__('Description'),
50,
100,
true,
false
);
$table_files_section->data[2][0] .= '
'.html_print_submit_button(__('Upload'), 'accion', false, 'class="sub wand"', true).'
';
}
// Here starts incident comments management.
if ($update) {
$upload_comment = get_parameter('upload_comment');
$comment_description = get_parameter('comment_description');
// Comments section table.
$table_comments_section = new stdClass();
$table_comments_section->width = '100%';
$table_comments_section->id = 'files_section_table';
$table_comments_section->class = 'databox filters';
$table_comments_section->head = [];
$table_comments_section->data = [];
$table_comments_section->size = [];
// Comments list table.
$table_comments = new stdClass();
$table_comments->width = '100%';
$table_comments->class = 'info_table';
$table_comments->head = [];
$table_comments->head[0] = __('Filename');
$table_comments->head[1] = __('Timestamp');
$table_comments->head[2] = __('Description');
$table_comments->head[3] = __('User');
$table_comments->head[4] = __('Size');
$table_comments->head[5] = __('Delete');
$table_comments->data = [];
$table_comments_section->data[0][0] = '
'.__('Description').':
';
$table_comments_section->data[0][0] .= html_print_textarea(
'comment_description',
3,
20,
'',
'',
true
);
$table_comments_section->data[1][1] .= '
'.html_print_submit_button(__('Add'), 'accion', false, 'class="sub wand"', true).'
';
// Upload comment.
if ($upload_comment) {
$result_api_call = integria_api_call($config['integria_hostname'], $config['integria_user'], $config['integria_pass'], $config['integria_api_pass'], 'create_workunit', [$incident_id_edit, $comment_description, '0.00', 'no', 'no', '0']);
// API method returns id of new comment if success.
$comment_added = ($result_api_call >= '0') ? true : false;
ui_print_result_message(
$comment_added,
__('Comment successfully added'),
__('Comment could not be added')
);
}
// Retrieve comments belonging to incident and create comments table.
$result_api_call = integria_api_call($config['integria_hostname'], $config['integria_user'], $config['integria_pass'], $config['integria_api_pass'], 'get_incident_workunits', [$incident_id_edit]);
if ($result_api_call != false && strlen($result_api_call) > 0) {
$comments = [];
$csv_array = explode("\n", $result_api_call);
foreach ($csv_array as $csv_line) {
if (!empty($csv_line)) {
$comments[] = explode(',', $csv_line);
}
}
}
$upload_comment_form = '';
foreach ($comments as $key => $value) {
$upload_comment_form .= '';
$upload_comment_form .= '
'.$value[4].'
';
}
$upload_comment_form = '
'.'
'.__('Comments').'
'.$upload_comment_form.'';
}
// Print forms and stuff.
echo '
';
echo '
';
ui_toggle(
$upload_file_form,
__('Attached files'),
'',
'',
true,
false,
'white_box white_box_opened',
'no-border flex'
);
echo '
';
echo '
';
ui_toggle(
$upload_comment_form,
__('Comments'),
'',
'',
true,
false,
'white_box white_box_opened',
'no-border flex'
);
echo '
';
}
echo '
';
if ($update) {
html_print_submit_button(__('Update'), 'accion', false, 'form="create_integria_incident_form" class="sub wand"');
} else {
html_print_submit_button(__('Create'), 'accion', false, 'form="create_integria_incident_form" class="sub wand"');
}
echo '
';