'index.php?sec=ITSM&sec2=operation/ITSM/itsm',
'label' => __('ITSM'),
],
[
'link' => 'index.php?sec=ITSM&sec2=operation/ITSM/itsm&operation=list',
'label' => __('ITSM Tickets'),
],
[
'link' => 'index.php?sec=ITSM&sec2=operation/ITSM/itsm',
'label' => __('ITSM Detailed'),
],
]
);
if (empty($error) === false) {
ui_print_error_message($error);
}
if (empty($error_upload) === false) {
ui_print_error_message($error_upload);
}
if (empty($error_comment) === false) {
ui_print_error_message($error_comment);
}
if (empty($error_delete_attachment) === false) {
ui_print_error_message($error_delete_attachment);
}
if (empty($successfullyMsg) === false) {
ui_print_success_message($successfullyMsg);
}
if (empty($incidence) === true) {
ui_print_info_message(__('Incidence not found'));
} else {
$nameIncidence = '--';
if (empty($incidence['idIncidenceType']) === false) {
$nameIncidence = $objectTypes[$incidence['idIncidenceType']];
}
// Details box.
$details_box = '
';
$details_box .= '
'.__('Status').'
';
$details_box .= '
'.__('Resolution').'
';
$details_box .= '
'.__('Group').'
';
$details_box .= '
'.__('Priority').'
';
$details_box .= '
'.__('Type').'
';
$details_box .= '
';
$details_box .= html_print_image('images/heart.png', true, ['class' => 'invert_filter']);
$details_box .= '
';
$details_box .= '
';
$details_box .= html_print_image('images/builder@svg.svg', true, ['class' => 'invert_filter']);
$details_box .= '
';
$details_box .= '
';
$details_box .= html_print_image('images/user_green.png', true, ['class' => 'invert_filter']);
$details_box .= '
';
$details_box .= '
';
$details_box .= $priorityDiv;
$details_box .= '
';
$details_box .= '
';
$details_box .= html_print_image('images/incidents.png', true, ['class' => 'invert_filter']);
$details_box .= '
';
$details_box .= '
'.$status[$incidence['status']].'
';
$details_box .= '
';
$details_box .= ($incidence['resolution'] !== 'NOTRESOLVED') ? $resolutions[$incidence['resolution']] : '--';
$details_box .= '
';
$details_box .= '
'.$groups[$incidence['idGroup']].'
';
$details_box .= '
'.$priorities[$incidence['priority']].'
';
$details_box .= '
';
$details_box .= $nameIncidence;
$details_box .= '
';
$details_box .= '
';
// People box.
$people_box = '';
$people_box .= '
';
$people_box .= html_print_image('images/header_user_green.png', true, ['width' => '21']);
$people_box .= '
';
$people_box .= '
';
$people_box .= html_print_image('images/header_user_green.png', true, ['width' => '21']);
$people_box .= '
';
$people_box .= '
';
$people_box .= html_print_image('images/header_user_green.png', true, ['width' => '21']);
$people_box .= '
';
$people_box .= '
'.__('Created by').':
';
$people_box .= '
'.__('Owned by').':
';
$people_box .= '
'.__('Closed by').':
';
$people_box .= '
';
$people_box .= (empty($incidence['idCreator']) === false) ? $users[$incidence['idCreator']]['fullName'] : '--';
$people_box .= '
';
$people_box .= '
';
$people_box .= (empty($incidence['owner']) === false) ? $users[$incidence['owner']]['fullName'] : '--';
$people_box .= '
';
$people_box .= '
';
$people_box .= (empty($incidence['closedBy']) === false) ? $users[$incidence['closedBy']]['fullName'] : '--';
$people_box .= '
';
$people_box .= '
';
// Dates box.
$dates_box = '';
$dates_box .= '
';
$dates_box .= html_print_image('images/tick.png', true, ['class' => 'invert_filter']);
$dates_box .= '
';
$dates_box .= '
';
$dates_box .= html_print_image('images/update.png', true, ['width' => '21', 'class' => 'invert_filter']);
$dates_box .= '
';
$dates_box .= '
';
$dates_box .= html_print_image('images/mul.png', true, ['class' => 'invert_filter']);
$dates_box .= '
';
$dates_box .= '
'.__('Created at').':
';
$dates_box .= '
'.__('Updated at').':
';
$dates_box .= '
'.__('Closed at').':
';
$dates_box .= '
'.$incidence['startDate'].'
';
$dates_box .= '
'.$incidence['updateDate'].'
';
$dates_box .= '
';
$dates_box .= (($incidence['closeDate'] === '0000-00-00 00:00:00') ? '--' : $incidence['closeDate']);
$dates_box .= '
';
$dates_box .= '
';
// Show details, people and dates.
echo '';
ui_toggle(
$details_box,
__('Details'),
'',
'details_box',
false,
false,
'',
'ITSM_details_content white-box-content',
'ITSM_details_shadow box-flat white_table_graph'
);
ui_toggle(
$people_box,
__('People'),
'',
'people_box',
false,
false,
'',
'ITSM_details_content white-box-content',
'ITSM_details_shadow box-flat white_table_graph'
);
ui_toggle(
$dates_box,
__('Dates'),
'',
'dates_box',
false,
false,
'',
'ITSM_details_content white-box-content',
'ITSM_details_shadow box-flat white_table_graph'
);
echo '
';
// Show description.
$description_box = '';
$description_box .= str_replace("\r\n", '', $incidence['description']);
$description_box .= '
';
ui_toggle($description_box, __('Description'), '', '', false);
if (empty($inventories) === false) {
$inventories_box = '';
$inventories_box .= '
';
foreach ($inventories as $inventory) {
$inventories_box .= '- ';
if (empty($inventory['idPandora']) === true) {
$inventories_box .= $inventory['name'];
} else {
$id_agent = explode('-', $inventory['idPandora'])[1];
$url_agent = $config['homeurl'];
$url_agent .= 'index.php?sec=estado&sec2=operation/agentes/ver_agente&id_agente='.$id_agent;
$inventories_box .= '';
$inventories_box .= $inventory['name'];
$inventories_box .= '';
}
$inventories_box .= '
';
}
$inventories_box .= '
';
$inventories_box .= '
';
ui_toggle($inventories_box, __('Related to inventory object'), '', '', false);
}
// Files section table.
$table_files_section = new stdClass();
$table_files_section->width = '100%';
$table_files_section->id = 'files_section_table';
$table_files_section->class = 'databox filters';
$table_files_section->head = [];
$table_files_section->data = [];
$table_files_section->size = [];
$table_files_section->size[0] = '20%';
$table_files_section->size[1] = '60%';
$table_files_section->size[2] = '20%';
$table_files_section->data[0][0] = '';
$table_files_section->data[0][0] .= '
'.__('File name').':
';
$table_files_section->data[0][0] .= html_print_input_file('userfile', true, ['required' => true]);
$table_files_section->data[0][1] = '
';
$table_files_section->data[0][1] .= '
';
$table_files_section->data[0][1] .= __('Attachment description');
$table_files_section->data[0][1] .= ':
';
$table_files_section->data[0][1] .= html_print_textarea(
'file_description',
3,
20,
'',
'',
true,
'w100p'
);
$table_files_section->data[0][2] = '
';
$table_files_section->data[0][2] .= html_print_submit_button(
__('Upload'),
'accion',
false,
[
'icon' => 'wand',
'mode' => 'mini secondary',
'class' => 'right',
],
true
);
$table_files_section->data[0][2] .= '
';
// Files list table.
$table_files = new stdClass();
$table_files->width = '100%';
$table_files->class = 'info_table';
$table_files->head = [];
$table_files->head[0] = __('Filename');
$table_files->head[1] = __('Timestamp');
$table_files->head[2] = __('Description');
$table_files->head[3] = __('User');
$table_files->head[4] = __('Size');
$table_files->head[5] = __('Delete');
$table_files->data = [];
$url = \ui_get_full_url('index.php?sec=manageTickets&sec2=operation/ITSM/itsm');
foreach ($files['data'] as $key => $file) {
$onClick = 'downloadIncidenceAttachment('.$file['idIncidence'].','.$file['idAttachment'];
$onClick .= ',\''.ui_get_full_url('ajax.php').'\',\''.$file['filename'].'\')';
$table_files->data[$key][0] = '
'.$file['filename'].'';
$table_files->data[$key][1] = $file['timestamp'];
$table_files->data[$key][2] = $file['description'];
$table_files->data[$key][3] = $file['idUser'];
$table_files->data[$key][4] = $file['size'];
$urlDelete = $url.'&operation=detail&idIncidence='.$file['idIncidence'].'&idAttachment='.$file['idAttachment'];
$onclickDelete = 'javascript:if (!confirm(\''.__('Are you sure?').'\')) return false;';
$table_files->data[$key][5] .= '
';
$table_files->data[$key][5] .= html_print_image(
'images/delete.svg',
true,
[
'title' => __('Delete'),
'class' => 'invert_filter main_menu_icon',
]
);
$table_files->data[$key][5] .= '';
}
$upload_file_form = '
';
$upload_file_form .= '';
$upload_file_form .= '
';
echo '
';
ui_toggle(
$upload_file_form,
__('Attached files'),
'',
'',
true,
false,
'white-box-content',
'w98p'
);
echo '
';
// 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->size = [];
$table_comments_section->size[0] = '80%';
$table_comments_section->size[1] = '20%';
$table_comments_section->data = [];
$table_comments_section->data[0][0] = '
';
$table_comments_section->data[0][0] .= '
';
$table_comments_section->data[0][0] .= __('Description');
$table_comments_section->data[0][0] .= ':
';
$table_comments_section->data[0][0] .= html_print_textarea(
'comment_description',
3,
20,
'',
'',
true,
'w100p'
);
$table_comments_section->data[0][1] = '
';
$table_comments_section->data[0][1] .= html_print_submit_button(
__('Add'),
'accion',
false,
[
'icon' => 'wand',
'mode' => 'mini secondary',
'class' => 'right',
],
true
);
$table_comments_section->data[0][1] .= '
';
// Comments list table.
$comment_table = '';
if (empty($wus) === false) {
foreach ($wus['data'] as $wu) {
$comment_table .= '';
$comment_table .= '
';
$comment_table .= $wu['description'];
$comment_table .= '
';
}
} else {
$comment_table = __('No comments found');
}
$upload_comment_form = '
';
$upload_comment_form .= '';
$upload_comment_form .= '
'.__('Comments').'
';
$upload_comment_form .= $comment_table;
$upload_comment_form .= '';
echo '
';
ui_toggle(
$upload_comment_form,
__('Comments'),
'',
'',
true,
false,
'white-box-content',
'w98p'
);
echo '
';
}