Пример #1
0
		
		if ($end_date == "0000-00-00 00:00:00"){
				$end_date = '';
		}

		if ($creator != $config["id_user"]){
			$table->data[4][1] = print_label (__("Deadline"), '', 'input', true);
			if ($end_date == "")
				$table->data[4][1] .= __("None");
			else
				$table->data[4][1] .= $end_date;
			$table->data[4][1] .= print_input_hidden ("end_date", $end_date, true);
		} else 
			$table->data[4][1] = print_input_text ('end_date', $end_date , '', 25, 25, true, __('Deadline'));

		$table->data[5][0] = print_checkbox_extended ('email_notify', 1, $email_notify,
                false, '', '', true, __('Notify changes by email'));
                
		$table->data[6][0] = print_textarea ('description', 12, 50, $description, '', true, __('Description'));

		if ($operation == 'create') {
			$button = print_submit_button (__('Create'), 'crt', false, 'class="sub create"', true);
			$button .= print_input_hidden ('operation', 'insert', true);
		} else {
			$button .= print_submit_button (__('Update'), 'upd', false, 'class="sub upd"', true);
			$button .= print_input_hidden ('operation', 'update2', true);
			$button .= print_input_hidden ('id', $id, true);
		}
		
		$table->data[7][0] = $button;
		$table->colspan[7][0] = 2;
		
Пример #2
0
            $data[5] = __("Validated");
        } else {
            $data[5] = __("Pending");
        }
        if (give_acl($config["id_user"], $id_group, "CN")) {
            $data[6] = '<a href="index.php?sec=customers&sec2=operation/newsletter/address_definition&
						disable=1&id=' . $issue['id'] . '"
						onClick="if (!confirm(\'' . __('Are you sure?') . '\'))
						return false;">
						<img src="images/info.png" title="Disable"></a>';
            $data[6] .= '&nbsp;<a href="index.php?sec=customers&sec2=operation/newsletter/address_definition&
						delete=1&id=' . $issue['id'] . '"
						onClick="if (!confirm(\'' . __('Are you sure?') . '\'))
						return false;">
						<img src="images/cross.png" title="Delete"></a>';
            $data[7] = print_checkbox_extended('delete_multiple[]', $issue['id'], false, false, '', 'class="check_delete"', true);
        }
        array_push($table->data, $data);
    }
}
if ($manager) {
    echo "<form method='post' action='index.php?sec=customers&sec2=operation/newsletter/address_definition&multiple_delete=1&search_text={$search_text}&search_newsletter={$search_newsletter}&search_status={$search_status}&search_validate={$search_validate}'>";
    print_table($table);
    echo '<div class="button" style="width: ' . $table->width . '">';
    print_submit_button(__('Delete selected items'), 'new_btn', false, 'class="sub delete"');
    echo '</div>';
    echo '</form>';
    echo '<br>';
    echo '<form method="post" action="index.php?sec=customers&sec2=operation/newsletter/address_creation&create=1">';
    echo '<div class="button" style="width: ' . $table->width . '">';
    print_submit_button(__('Create'), 'new_btn', false, 'class="sub next"');
Пример #3
0
function user_search_result($filter, $ajax, $size_page, $offset, $clickin, $search_text, $disabled_user, $level, $group, $from_tickets = false)
{
    global $config;
    if ($filter != 0) {
        $offset = $filter['offset'];
        $search_text = $filter['search_text'];
        $disabled_user = $filter['disabled_user'];
        $level = $filter['level'];
        $group = $filter['group'];
    }
    $search = "WHERE 1=1 ";
    if ($search_text != "") {
        $search .= " AND (id_usuario LIKE '%{$search_text}%' OR comentarios LIKE '%{$search_text}%' OR nombre_real LIKE '%{$search_text}%' OR direccion LIKE '%{$search_text}%')";
    }
    if ($disabled_user > -1) {
        $search .= " AND disabled = {$disabled_user}";
    }
    if ($level > -10) {
        $search .= " AND nivel = {$level}";
    }
    if ($group == -1) {
        $search .= " AND tusuario.id_usuario NOT IN (select id_usuario from tusuario_perfil)";
    } else {
        if ($group > 0) {
            $search .= " AND tusuario.id_usuario = ANY (SELECT id_usuario FROM tusuario_perfil WHERE id_grupo = {$group})";
        }
    }
    $query1 = "SELECT * FROM tusuario {$search} ORDER BY id_usuario";
    if ($from_tickets) {
        $query1 = users_get_allowed_users_query($config['id_user'], $filter);
    }
    $count = get_db_sql("SELECT COUNT(id_usuario) FROM tusuario {$search} ");
    $sql1 = "{$query1} LIMIT {$offset}, " . $size_page;
    echo "<div class='divresult'>";
    pagination($count, "index.php?sec=users&sec2=godmode/usuarios/lista_usuarios&search_text=" . $search_text . "&disabled_user="******"&level=" . $level . "&group=" . $group, $offset, true);
    $resq1 = process_sql($sql1);
    if (!$resq1) {
        echo ui_print_error_message(__("No users"), '', true, 'h3', true);
    } else {
        echo '<table width="100%" class="listing">';
        if ($filter == 0) {
            echo '<th>' . print_checkbox('all_user_checkbox', 1, false, true);
            echo '<th title="' . __('Enabled/Disabled') . '">' . __('E/D');
            echo '<th title="' . __('Enabled login') . '">' . __('Enabled login');
        }
        echo '<th>' . __('User ID');
        echo '<th>' . __('Name');
        echo '<th>' . __('Company');
        echo '<th>' . __('Last contact');
        echo '<th>' . __('Profile');
        if ($filter == 0) {
            echo '<th>' . __('Delete');
        }
        // Init vars
        $nombre = "";
        $nivel = "";
        $comentarios = "";
        $fecha_registro = "";
        if ($resq1) {
            foreach ($resq1 as $rowdup) {
                $nombre = $rowdup["id_usuario"];
                $nivel = $rowdup["nivel"];
                $realname = $rowdup["nombre_real"];
                $fecha_registro = $rowdup["fecha_registro"];
                $avatar = $rowdup["avatar"];
                if ($rowdup["nivel"] == 0) {
                    $nivel = "<img src='images/group.png' title='" . __("Grouped user") . "'>";
                } elseif ($rowdup["nivel"] == 1) {
                    $nivel = "<img src='images/integria_mini_logo.png' title='" . __("Administrator") . "'>";
                } else {
                    $nivel = "<img src='images/user_gray.png' title='" . __("Standalone user") . "'>";
                }
                $disabled = $rowdup["disabled"];
                $id_company = $rowdup["id_company"];
                $enabled_login = $rowdup["enable_login"];
                echo "<tr>";
                if ($filter == 0) {
                    echo "<td>";
                    echo print_checkbox_extended("user-" . $rowdup["id_usuario"], $rowdup["id_usuario"], false, false, "", "class='user_checkbox'", true);
                    echo "<td>";
                    if ($disabled == 1) {
                        echo "<img src='images/lightbulb_off.png' title='" . __("Disabled") . "'> ";
                    }
                    echo "<td>";
                    if ($enabled_login == 1) {
                        echo "<img src='images/accept.png' title='" . __("Enabled login") . "'> ";
                    } else {
                        echo "<img src='images/fail.png' title='" . __("Disabled login") . "'> ";
                    }
                }
                echo "<td>";
                if ($filter == 0) {
                    echo "<a href='index.php?sec=users&sec2=godmode/usuarios/configurar_usuarios&update_user="******"'>" . ucfirst($nombre) . "</a>";
                } else {
                    $url = "javascript:loadContactUser(\"" . $nombre . "\",\"" . $clickin . "\");";
                    echo "<a href='" . $url . "'>" . ucfirst($nombre) . "</a>";
                }
                echo "<td style=''>" . $realname;
                $company_name = (string) get_db_value('name', 'tcompany', 'id', $id_company);
                echo "<td>" . $company_name . "</td>";
                echo "<td style=''>" . human_time_comparation($fecha_registro);
                echo "<td>";
                print_user_avatar($nombre, true);
                echo "&nbsp;";
                if ($config["enteprise"] == 1) {
                    $sql1 = 'SELECT * FROM tusuario_perfil WHERE id_usuario = "' . $nombre . '"';
                    $result = mysql_query($sql1);
                    echo "<a href='#' class='tip'>&nbsp;<span>";
                    if (mysql_num_rows($result)) {
                        while ($row = mysql_fetch_array($result)) {
                            echo dame_perfil($row["id_perfil"]) . "/ ";
                            echo dame_grupo($row["id_grupo"]) . "<br>";
                        }
                    } else {
                        echo __('This user doesn\'t have any assigned profile/group');
                    }
                    echo "</span></a>";
                }
                echo $nivel;
                if ($filter == 0) {
                    echo '<td align="center">';
                    echo '<a href="index.php?sec=users&sec2=godmode/usuarios/lista_usuarios&borrar_usuario=' . $nombre . '" onClick="if (!confirm(\'' . __('Are you sure?') . '\')) return false;"><img src="images/cross.png"></a>';
                    echo '</td>';
                }
            }
        }
        echo "</table>";
    }
    echo "</div>";
}
Пример #4
0
function form_search_incident($return = false, $filter = false, $ajax = 0)
{
    include_once "functions_user.php";
    global $config;
    $output = '';
    if (!$filter) {
        $inverse_filter = (bool) get_parameter('search_inverse_filter');
        $search_string = (string) get_parameter('search_string');
        $status = (int) get_parameter('search_status', -10);
        $priority = (int) get_parameter('search_priority', -1);
        $resolution = (int) get_parameter('search_resolution', -1);
        $id_group = (int) get_parameter('search_id_group');
        $id_inventory = (int) get_parameter('search_id_inventory');
        $id_company = (int) get_parameter('search_id_company');
        $search_id_user = (string) get_parameter('search_id_user');
        $search_id_incident_type = (int) get_parameter('search_id_incident_type');
        $date_from = (int) get_parameter("search_from_date");
        $date_start = (string) get_parameter("search_first_date");
        $date_end = (string) get_parameter("search_last_date");
        $search_creator = (string) get_parameter('search_id_creator');
        $search_editor = (string) get_parameter('search_editor');
        $search_closed_by = (string) get_parameter('search_closed_by');
        $group_by_project = (bool) get_parameter('search_group_by_project');
        $sla_state = (int) get_parameter('search_sla_state', 0);
        $id_task = (int) get_parameter('search_id_task', 0);
        $left_sla = (int) get_parameter('search_left_sla', 0);
        $right_sla = (int) get_parameter('search_right_sla', 0);
        $show_hierarchy = (bool) get_parameter('search_show_hierarchy');
        $search_medal = get_parameter('search_medals');
        $name = get_parameter('parent_name');
        $type_fields = incidents_get_type_fields($search_id_incident_type);
        $search_type_field = array();
        foreach ($type_fields as $key => $type_field) {
            $search_type_field[$type_field['id']] = (string) get_parameter('search_type_field_' . $type_field['id']);
        }
    } else {
        $inverse_filter = (bool) $filter['inverse_filter'];
        $search_string = (string) $filter['string'];
        $priority = (int) $filter['priority'];
        $id_group = (int) $filter['id_group'];
        $status = (int) $filter['status'];
        $resolution = (int) $filter['resolution'];
        $id_company = (int) $filter['id_company'];
        $id_inventory = (int) $filter['id_inventory'];
        $search_id_incident_type = (int) $filter['id_incident_type'];
        $search_id_user = (string) $filter['id_user'];
        $date_from = (int) $filter['from_date'];
        $date_start = (string) $filter['first_date'];
        $date_end = (string) $filter['last_date'];
        $search_creator = (string) $filter['id_creator'];
        $search_editor = (string) $filter['editor'];
        $search_closed_by = (string) $filter['closed_by'];
        $group_by_project = (bool) $filter['group_by_project'];
        $sla_state = (int) $filter['sla_state'];
        $id_task = (int) $filter['id_task'];
        $left_sla = (int) $filter['left_sla'];
        $right_sla = (int) $filter['right_sla'];
        $show_hierarchy = (bool) $filter['show_hierarchy'];
        $search_medal = (int) $filter['medals'];
        $name = (string) $filter['parent_name'];
        //This is inventory obj name value !!!
        $type_fields = incidents_get_type_fields($search_id_incident_type);
        $search_type_field = array();
        if ($type_fields) {
            foreach ($type_fields as $key => $type_field) {
                $search_type_field[$type_field['id']] = (string) $filter['type_field_' . $type_field['id']];
            }
        }
    }
    /* No action is set, so the form will be sent to the current page */
    $table = new stdclass();
    $table->width = "100%";
    $table->class = "search-table-button";
    $table->data = array();
    // Filter text
    $table->data[0][0] = print_input_text('search_string', $search_string, '', 30, 100, true, __('Text filter'));
    // Status
    $available_status = get_indicent_status();
    $available_status[-10] = __("Not closed");
    $table->data[0][1] = print_select($available_status, 'search_status', $status, '', __('Any'), 0, true, false, true, __('Status'));
    // Groups
    $groups = users_get_groups_for_select($config['id_user'], "IW", true, true);
    $table->data[0][2] = print_select($groups, 'search_id_group', $id_group, '', '', '', true, false, false, __('Group'));
    // Check Box
    $table->data[0][3] = print_checkbox_extended('search_show_hierarchy', 1, $show_hierarchy, false, '', '', true, __('Show hierarchy'));
    $table_advanced = new stdclass();
    $table_advanced->width = "100%";
    $table_advanced->class = "search-table-button";
    $params_owner = array();
    $params_owner['input_id'] = 'text-search_id_user';
    $params_owner['input_name'] = 'search_id_user';
    $params_owner['input_value'] = $search_id_user;
    $params_owner['title'] = __('Owner');
    $params_owner['attributes'] = 'style="width: 210px;"';
    $params_owner['return'] = true;
    $table_advanced->data[1][0] = user_print_autocomplete_input($params_owner);
    $params_editor = array();
    $params_editor['input_id'] = 'text-search_editor';
    $params_editor['input_name'] = 'search_editor';
    $params_editor['input_value'] = $search_editor;
    $params_editor['title'] = __('Editor');
    $params_editor['attributes'] = 'style="width: 210px;"';
    $params_editor['return'] = true;
    $table_advanced->data[1][1] = user_print_autocomplete_input($params_editor);
    $params_closed_by = array();
    $params_closed_by['input_id'] = 'text-search_closed_by';
    $params_closed_by['input_name'] = 'search_closed_by';
    $params_closed_by['input_value'] = $search_closed_by;
    $params_closed_by['title'] = __('Closed by');
    $params_closed_by['attributes'] = 'style="width: 210px;"';
    $params_closed_by['return'] = true;
    $table_advanced->data[1][2] = user_print_autocomplete_input($params_closed_by);
    $params_creator = array();
    $params_creator['input_id'] = 'text-search_id_creator';
    $params_creator['input_name'] = 'search_id_creator';
    $params_creator['input_value'] = $search_creator;
    $params_creator['title'] = __('Creator');
    $params_creator['attributes'] = 'style="width: 210px;"';
    $params_creator['return'] = true;
    $table_advanced->data[1][3] = user_print_autocomplete_input($params_creator);
    $table_advanced->data[2][0] = print_select(get_priorities(), 'search_priority', $priority, '', __('Any'), -1, true, false, false, __('Priority'), false);
    $table_advanced->data[2][1] = print_select(get_incident_resolutions(), 'search_resolution', $resolution, '', __('Any'), -1, true, false, false, __('Resolution'), false);
    //$name = $id_inventory ? get_inventory_name ($id_inventory) : '';
    //Parent name
    $table_advanced->data[2][2] = print_input_text_extended("parent_name", $name, "text-parent_name", '', 20, 0, false, "", "class='inventory_obj_search' style='width:165px !important;'", true, false, __('Inventory object'), false, true);
    $table_advanced->data[2][2] .= "&nbsp;&nbsp;" . print_image("images/add.png", true, array("onclick" => "show_inventory_search('','','','','','','','','','', '', '')", "style" => "cursor: pointer"));
    $table_advanced->data[2][2] .= "&nbsp;&nbsp;" . print_image("images/cross.png", true, array("onclick" => "cleanParentInventory()", "style" => "cursor: pointer"));
    $table_advanced->data[2][2] .= print_input_hidden('id_parent', $id_inventory, true);
    $table_advanced->data[2][3] = get_last_date_control($date_from, 'search_from_date', __('Date'), $date_start, 'search_first_date', __('Created from'), $date_end, 'search_last_date', __('Created to'));
    $table_advanced->rowspan[2][3] = 2;
    $table_advanced->cellstyle[2][3] = "vertical-align:top;";
    if (!get_standalone_user($config["id_user"])) {
        $table_advanced->data[4][0] = print_select(get_companies(), 'search_id_company', $id_company, '', __('Any'), 0, true, false, false, __('Company'));
    }
    $table_advanced->data[4][1] = print_select(get_incident_types(), 'search_id_incident_type', $search_id_incident_type, 'javascript:change_type_fields_table(\'' . __('Custom field') . '\');', __('Any'), 0, true, false, false, __('Ticket type'));
    $table_advanced->data[4][3] = print_checkbox_extended('search_group_by_project', 1, $group_by_project, false, '', '', true, __('Group by project/task'));
    $sla_states = array();
    $sla_states[1] = __('SLA is fired');
    $sla_states[2] = __('SLA is not fired');
    $table_advanced->data[5][0] = print_select($sla_states, 'search_sla_state', $sla_state, '', __('Any'), 0, true, false, false, __('SLA'));
    $table_advanced->data[5][1] = combo_task_user_participant($config["id_user"], 0, $id_task, true, __("Task"), 'search_id_task');
    $table_advanced->data[5][2] = "<div>";
    $table_advanced->data[5][2] .= "<div style='display: inline-block;'>" . print_input_text('search_left_sla', $left_sla, '', 8, 0, true, __('SLA > (%)'), false) . "</div>";
    $table_advanced->data[5][2] .= "&nbsp;<div style='display: inline-block;'>" . print_input_text('search_right_sla', $right_sla, '', 8, 0, true, __('SLA < (%)'), false) . "</div>";
    $table_advanced->data[5][2] .= "</div>";
    $medals = array();
    $medals[1] = __('Gold medals');
    $medals[2] = __('Black medals');
    $table_advanced->data[5][3] = print_select($medals, 'search_medals', $search_medal, '', __('Any'), 0, true, false, false, __('Medals'));
    $table_type_fields = new StdClass();
    $table_type_fields->width = "100%";
    $table_type_fields->class = "search-table";
    $table_type_fields->data = array();
    $table_type_fields->align[0] = 'left';
    //Print custom field data
    $column = 0;
    $row = 0;
    if ($type_fields) {
        foreach ($type_fields as $key => $type_field) {
            $data = $search_type_field[$type_field['id']];
            switch ($type_field['type']) {
                case "text":
                    $input = print_input_text('search_type_field_' . $type_field['id'], $data, '', 30, 30, true, $type_field['label']);
                    break;
                case "combo":
                    $combo_values = explode(",", $type_field['combo_value']);
                    $values = array();
                    foreach ($combo_values as $value) {
                        $values[$value] = $value;
                    }
                    $input = print_select($values, 'search_type_field_' . $type_field['id'], $data, '', __('Any'), '', true, false, false, $type_field['label']);
                    break;
                case "linked":
                    $linked_values = explode(",", $type_field['linked_value']);
                    $values = array();
                    foreach ($linked_values as $value) {
                        $value_without_parent = preg_replace("/^.*\\|/", "", $value);
                        $values[$value_without_parent] = $value_without_parent;
                        $has_childs = get_db_all_rows_sql("SELECT * FROM tincident_type_field WHERE parent=" . $type_field['id']);
                        if ($has_childs) {
                            $i = 0;
                            foreach ($has_childs as $child) {
                                if ($i == 0) {
                                    $childs = $child['id'];
                                } else {
                                    $childs .= ',' . $child['id'];
                                }
                                $i++;
                            }
                            $childs = "'" . $childs . "'";
                            $script = 'javascript:change_linked_type_fields_table(' . $childs . ',' . $type_field['id'] . ');';
                        } else {
                            $script = '';
                        }
                    }
                    $input = print_select($values, 'search_type_field_' . $type_field['id'], $data, $script, __('Any'), '', true, false, false, $type_field['label']);
                    break;
                case "numeric":
                    $input = print_input_number('search_type_field_' . $type_field['id'], $data, 1, 1000000, '', true, $type_field['label']);
                    break;
                case "date":
                    $input = print_input_date('search_type_field_' . $type_field['id'], $data, '', '', '', true, $type_field['label']);
                    break;
                case "textarea":
                    $input = print_input_text('search_type_field_' . $type_field['id'], $data, '', 30, 30, true, $type_field['label']);
                    break;
            }
            $table_type_fields->data[$row][$column] = $input;
            if ($column >= 3) {
                $column = 0;
                $row++;
            } else {
                $column++;
            }
        }
    }
    $table_advanced->colspan[6][0] = 4;
    if ($table_type_fields->data) {
        $table_type_fields_html = print_table($table_type_fields, true);
    }
    if (!isset($table_type_fields_html)) {
        $table_type_fields_html = '';
    }
    $table_advanced->data[6][0] = "<div id='table_type_fields'>" . $table_type_fields_html . "</div>";
    $table->colspan['row_advanced'][0] = 5;
    $table->data['row_advanced'][0] = print_container_div('advanced_parameters_incidents_search', __('Advanced filter'), print_table($table_advanced, true), 'closed', true, true);
    //Store serialize filter
    serialize_in_temp($filter, $config["id_user"]);
    $table->colspan['button'][0] = 2;
    $table->colspan['button'][2] = 2;
    $table->data['button'][0] = '</br>';
    $table->data['button'][2] = print_submit_button(__('Filter'), 'search', false, 'class="sub search"', true);
    $table->data['button'][2] .= print_input_hidden('search_inverse_filter', (int) $inverse_filter, true);
    $table->data['button'][2] .= print_submit_button(__('Inverse filter'), 'submit_inverse_filter', false, 'class="sub search"', true);
    $table->data['button'][2] .= print_button(__('Export to CSV'), '', false, 'window.open(\'' . 'include/export_csv.php?export_csv_tickets=1' . '\')', 'class="sub"', true);
    // Inverse filter info
    $output .= '<div id="inverse_filter_info" style="display: ' . ($inverse_filter ? 'block' : 'none') . ';">';
    $output .= ui_print_message(__('Inverse filter enabled'), 'suc', 'style="display:inline;padding-top: 15px;padding-bottom: 15px;"', true, 'h3', false);
    $output .= print_help_tip(__('The result will be the items which doesn\'t match the filters') . '. ' . __('The select controls with \'Any\' or \'All\' selected will be ignored'), true);
    $output .= '<br /><br />';
    $output .= '</div>';
    if ($ajax) {
        $output .= '<form id="search_incident_form" method="post">';
    } else {
        $output .= '<form id="search_incident_form" method="post" onsubmit="incidents_gift();return false">';
    }
    //~ $output .= '<form id="search_incident_form" method="post">';
    $output .= '<div class="divresult_incidents">' . print_table($table, true) . '</div>';
    $output .= '</form>';
    echo "<div class= 'dialog ui-dialog-content' id='search_inventory_window'></div>";
    // WARNING: Important for the inverse filter feature
    // Change the search_inverse_filter value when the form is submitted using the submit_inverse_filter or the search buttons
    // Show or hide the inverse filter info
    $output .= '<script type="text/javascript">';
    $output .= '$(document).ready(function () {';
    $output .= 'var inverseFilterInfo = document.getElementById("inverse_filter_info");';
    $output .= 'var filterForm = document.getElementById("search_incident_form");';
    $output .= 'var filterBtn = filterForm.elements["search"];';
    $output .= 'var inverseFilterBtn = filterForm.elements["submit_inverse_filter"];';
    $output .= 'var inverseFilter = filterForm.elements["search_inverse_filter"];';
    $output .= '$(filterBtn).click(function (e) {';
    $output .= 'inverseFilter.value = 0;';
    $output .= '$(inverseFilterInfo).hide();';
    $output .= '});';
    $output .= '$(inverseFilterBtn).click(function (e) {';
    $output .= 'inverseFilter.value = 1;';
    $output .= '$(inverseFilterInfo).show();';
    $output .= '});';
    $output .= '});';
    $output .= '</script>';
    if ($return) {
        return $output;
    }
    echo $output;
}
Пример #5
0
		if(!isset($params['inventory_status'])){
			$params['inventory_status'] = 'All';
		}
		$table_search->data[2][0] = print_select ($all_inventory_status, 'inventory_status', $params['inventory_status'], '', '', '', true, false, false, __('Status'));

		//Parent name
		if(!isset($params['parent_name'])){
			$params['parent_name'] = '';
		}
		$table_search->data[2][1] =  print_input_text_extended ("parent_name", $params['parent_name'], "text-parent_name", '', 20, 0, false, "", "class='inventory_obj_search' style='width:165px !important;'", true, false,  __('Parent object'), false, true);
		$table_search->data[2][1] .= "&nbsp;&nbsp;" . print_image("images/add.png", true, array("onclick" => "show_inventory_search('','','','','','','','','','', '', '')", "style" => "cursor: pointer"));	
		$table_search->data[2][1] .= "&nbsp;&nbsp;" . print_image("images/cross.png", true, array("onclick" => "cleanParentInventory()", "style" => "cursor: pointer"));	
		//$table_search->data[2][1] .= print_input_hidden ('id_parent', $id_parent, true);

		//check
		$table_search->data[2][2] = print_checkbox_extended ('last_update', 1, $params['last_update'],
		false, '', '', true, __('Last updated'));

		//input pagination size
		$table_search->data[3][0] = '<label id="label-text-block_size" for="text-block_size">'.__('Block size for pagination').print_help_tip (__("Selects the paging block. By default it's set in the general options and limited to 2-1000"), true).'</label>';
		$table_search->data[3][0] .= '<input type="number" required pattern="^[2-100]" name="block_size" id="text-block_size" value="'.$params['block_size'].'" size="2" min="2" max="1000">';

		//order column table hidden
		$table_search->data[3][0] .= print_input_hidden ('sort_field', $params['sort_field_num'], true, false, 'sort_field');
		$table_search->data[3][0] .= print_input_hidden	('sort_mode', $params['sort_mode'], true, false, 'sort_mode');
		
		//offset pagination hidden
		if(!isset($params['offset'])){
			$params['offset'] = '';
		}
		$table_search->data[3][0] .= print_input_hidden	('offset', $params['offset'], true, false, 'offset');
		
Пример #6
0
$table->id = 'incident_massive';
$table->data = array();
$table->style = array();
$table->data[0][0] = combo_incident_status(-1, 0, 0, true, true);
$table->data[0][1] = print_select(get_priorities(), 'mass_priority', -1, '', __('Select'), -1, true, 0, true, __('Priority'), false, 'min-width: 70px;');
$table->data[0][2] = combo_incident_resolution($resolution, false, true, true);
$table->data[0][3] = print_select_from_sql('SELECT id_usuario, nombre_real FROM tusuario;', 'mass_assigned_user', '0', '', __('Select'), -1, true, false, true, __('Assigned user'));
//Task
$table->data[1][0] = combo_task_user(0, $config["id_user"], 0, 0, true);
if ($has_im) {
    //Parent ticket
    $table->data[1][1] = print_input_text('search_parent', $parent_name, '', 10, 100, true, __('Parent ticket'));
    $table->data[1][1] .= print_input_hidden('id_parent', $id_parent, true);
    $table->data[1][1] .= print_image("images/cross.png", true, array("onclick" => "clean_parent_field()", "style" => "cursor: pointer"));
    //Email notify
    $table->data[1][2] = print_checkbox_extended('mass_email_notify', 1, 1, false, '', '', true, __('Notify changes by email'));
    //Delete tickets
    $table->data[1][3] = print_image("images/cross.png", true, array("onclick" => "delete_massive_tickets()", "style" => "cursor: pointer"));
}
$table->data[2][0] = print_submit_button(__('Update'), 'massive_update', false, 'class="sub next"', true);
$table->colspan[2][0] = 4;
$massive_oper_incidents = print_table($table, true);
echo print_container('massive_oper_incidents', __('Massive operations over selected items'), $massive_oper_incidents, 'closed', true, '20px');
echo "<div class= 'dialog ui-dialog-content' title='" . __("Tickets") . "' id='parent_search_window'></div>";
?>

<script type="text/javascript" src="include/js/jquery.metadata.js"></script>
<script type="text/javascript" src="include/languages/date_<?php 
echo $config['language_code'];
?>
.js"></script>
Пример #7
0
function inventories_show_list($sql_search, $sql_count, $params = '', $last_update = 0)
{
    global $config;
    $is_enterprise = false;
    if (file_exists("enterprise/include/functions_inventory.php")) {
        require_once "enterprise/include/functions_inventory.php";
        $is_enterprise = true;
    }
    $write_permission = enterprise_hook('inventory_check_acl', array($config['id_user'], $id, true));
    $params .= "&mode=list";
    if (!$sql_search) {
        $sql_search = "SELECT * FROM tinventory";
    }
    if ($last_update) {
        $sql_search .= " ORDER BY last_update DESC";
    } else {
        $sql_search .= " ORDER BY name ASC";
    }
    $clean_output = get_parameter("clean_output");
    if ($clean_output) {
        $block_limit = 5000;
    } else {
        $block_limit = $config["block_size"];
    }
    $sql_search .= " LIMIT " . $block_limit;
    $offset = get_parameter("offset", 0);
    $sql_search .= " OFFSET {$offset}";
    $inventories_aux = get_db_all_rows_sql($sql_search);
    $count_inv = get_db_value_sql($sql_count);
    if ($is_enterprise) {
        $inventories = inventory_get_user_inventories($config['id_user'], $inventories_aux);
    } else {
        $inventories = $inventories_aux;
    }
    if ($inventories === false) {
        echo "<h3 class='error'>" . __("Empty inventory") . "</h3>";
    } else {
        $result_check = inventories_check_same_object_type_list($inventories);
        $table->id = 'inventory_list';
        $table->class = 'listing';
        $table->width = '100%';
        $table->data = array();
        $table->head = array();
        $table->colspan = array();
        $table->head[0] = __('Id');
        $table->head[1] = __('Name');
        $table->head[2] = __('Owner');
        $table->head[3] = __("Parent object");
        $table->head[4] = __('Object type');
        $table->head[5] = __('Manufacturer');
        $table->head[6] = __('Contract');
        if ($result_check) {
            $res_object_fields = inventories_get_all_type_field($result_check, false, true);
            $i = 6;
            foreach ($res_object_fields as $key => $object_field) {
                if (isset($object_field["label"])) {
                    $table->head[$i] = $object_field['label'];
                    $i++;
                }
            }
            $table->head[$i] = __('Actions');
            if ($write_permission) {
                $table->head[$i] = print_checkbox('inventorycb-all', "", false, true);
            }
        } else {
            if (!$clean_output) {
                $table->head[7] = __('Actions');
            }
            if ($write_permission) {
                $table->head[8] = print_checkbox('inventorycb-all', "", false, true);
            }
        }
        $count = $count_inv;
        $url_pag = "index.php?sec=inventory&sec2=operation/inventories/inventory" . $params;
        $offset = get_parameter("offset");
        if (!$clean_output) {
            pagination($count, $url_pag, $offset);
        }
        $idx = 0;
        foreach ($inventories as $key => $inventory) {
            $data = array();
            if (defined('AJAX')) {
                $url = "javascript:loadInventory(" . $inventory['id'] . ");";
            } else {
                $url = 'index.php?sec=inventory&sec2=operation/inventories/inventory_detail&id=' . $inventory['id'];
            }
            $data[0] = "<a href=" . $url . ">" . $inventory['id'] . "</a>";
            $data[1] = "<a href=" . $url . ">" . $inventory['name'] . '</a>';
            if ($inventory['owner'] != '') {
                $name_owner = get_db_value('nombre_real', 'tusuario', 'id_usuario', $inventory['owner']);
            } else {
                $name_owner = '--';
            }
            $data[2] = "<a href=" . 'index.php?sec=inventory&sec2=users&sec2=operation/users/user_edit&id=' . $inventory['owner'] . ">" . $name_owner . '</a>';
            if ($inventory["id_parent"] != 0) {
                $name_parent = get_db_value('name', 'tinventory', 'id', $inventory['id_parent']);
                $data[3] = "<a href=" . 'index.php?sec=inventory&sec2=operation/inventories/inventory_detail&id=' . $inventory['id_parent'] . ">" . $name_parent . '</a>';
            } else {
                $name_parent = '--';
                $data[3] = $name_parent;
            }
            if ($inventory['id_object_type'] != 0) {
                $name_object = get_db_value('name', 'tobject_type', 'id', $inventory['id_object_type']);
                $data[4] = "<a href=" . 'index.php?sec=inventory&sec2=operation/inventories/manage_objects&id=' . $inventory['id_object_type'] . ">" . $name_object . '</a>';
            } else {
                $name_object = '--';
                $data[4] = $name_object;
            }
            if ($inventory['id_manufacturer'] != 0) {
                $name_manufacturer = get_db_value('name', 'tmanufacturer', 'id', $inventory['id_manufacturer']);
                $data[5] = "<a href=" . 'index.php?sec=inventory&sec2=operation/manufacturers/manufacturer_detail&id=' . $inventory['id_manufacturer'] . ">" . $name_manufacturer . '</a>';
            } else {
                $name_manufacturer = '--';
                $data[5] = $name_manufacturer;
            }
            if ($inventory['id_contract'] != 0) {
                $name_contract = get_db_value('name', 'tcontract', 'id', $inventory['id_contract']);
                $data[6] = "<a href=" . 'index.php?sec=inventory&sec2=customers&sec2=operation/contracts/contract_detail&id_contract=' . $inventory['id_contract'] . ">" . $name_contract . '</a>';
            } else {
                $name_contract = '--';
                $data[6] = $name_contract;
            }
            if ($result_check) {
                $result_object_fields = inventories_get_all_type_field($result_check, $inventory['id'], true);
                $i = 6;
                foreach ($result_object_fields as $k => $ob_field) {
                    if (isset($ob_field["label"])) {
                        $data[$i] = $ob_field['data'];
                        $i++;
                    }
                }
                if (!$clean_output) {
                    $data[$i] = '<a href="javascript: toggleInventoryInfo(' . $inventory['id'] . ')" id="show_info-' . $inventory["id"] . '">';
                    $data[$i] .= print_image("images/information.png", true, array("title" => __('Show object type fields')));
                    $data[$i] .= '</a>&nbsp;';
                    if ($write_permission) {
                        $data[$i] .= '<a href="index.php?sec=inventory&sec2=operation/inventories/inventory&quick_delete=' . $inventory["id"] . '" onClick="if (!confirm(\'' . __('Are you sure?') . '\')) return false;"><img src="images/cross.png"></a>';
                    }
                }
                if ($write_permission) {
                    $data[$i] = print_checkbox_extended('inventorycb-' . $inventory['id'], $inventory['id'], false, '', '', 'class="cb_inventory"', true);
                }
            } else {
                if (!$clean_output) {
                    $data[7] = '<a href="javascript: toggleInventoryInfo(' . $inventory['id'] . ')" id="show_info-' . $inventory["id"] . '">';
                    $data[7] .= print_image("images/information.png", true, array("title" => __('Show object type fields')));
                    $data[7] .= '</a>&nbsp;';
                    if ($write_permission) {
                        $data[7] .= '<a href="index.php?sec=inventory&sec2=operation/inventories/inventory&quick_delete=' . $inventory["id"] . '" onClick="if (!confirm(\'' . __('Are you sure?') . '\')) return false;"><img src="images/cross.png"></a>';
                    }
                }
                if ($write_permission) {
                    $data[8] = print_checkbox_extended('inventorycb-' . $inventory['id'], $inventory['id'], false, '', '', 'class="cb_inventory"', true);
                }
            }
            $table->rowclass[$idx] = 'inventory_info_' . $inventory["id"];
            $idx++;
            array_push($table->data, $data);
            if (!$clean_output) {
                $data_info = array();
                $table_info->width = '98%';
                $table_info->class = 'databox_color_without_line';
                $table_info->size = array();
                $table_info->style = array();
                $table_info->data = array();
                $res_obj_fields = inventories_get_all_type_field($inventory['id_object_type'], $inventory['id'], false);
                if (empty($res_obj_fields)) {
                    $table_info->data[0][0] = '<b>' . __('No data to show') . '</b>';
                } else {
                    $j = 0;
                    foreach ($res_obj_fields as $k => $ob_field) {
                        if (isset($ob_field['label']) && $ob_field['label'] != "") {
                            if ($ob_field['type'] == 'external') {
                                $table_info->align[$j] = 'left;';
                                $table_info->data[$j][$j] = '<b>' . $ob_field['label'];
                                $table_info->data[$j][$j] .= ' : ' . '</b>';
                                $table_info->data[$j][$j] .= $ob_field['data'];
                                $j++;
                                if (isset($ob_field['external_label']) && $ob_field['external_label'] != '') {
                                    $label_value = get_db_value_sql("SELECT " . $ob_field['external_label'] . " FROM " . $ob_field['external_table_name'] . " WHERE " . $ob_field['external_reference_field'] . " = " . $ob_field['data']);
                                    $table_info->align[$j] = 'left;';
                                    $table_info->data[$j][$j] = '<b>' . $ob_field['external_label'];
                                    $table_info->data[$j][$j] .= ' : ' . '</b>';
                                    $table_info->data[$j][$j] .= $label_value;
                                    $j++;
                                }
                            } else {
                                $table_info->align[$j] = 'left;';
                                $table_info->data[$j][$j] = '<b>' . $ob_field['label'];
                                $table_info->data[$j][$j] .= ' : ' . '</b>';
                                $table_info->data[$j][$j] .= $ob_field['data'];
                                $j++;
                            }
                        }
                    }
                }
                $data_info['row_info'] = print_table($table_info, true);
                $table_info->colspan[0][0] = 6;
                $table->rowclass[$idx] = 'inventory_more_info_' . $inventory["id"];
                $table->rowstyle[$idx] = 'display: none;';
                if ($write_permission) {
                    $table->colspan[$idx]["row_info"] = 8;
                } else {
                    $table->colspan[$idx]["row_info"] = 7;
                }
                array_push($table->data, $data_info);
                $idx++;
            }
        }
        print_table($table);
        if (!$clean_output) {
            pagination($count, $url_pag, $offset, true);
        }
    }
}
Пример #8
0
function form_search_incident($return = false, $filter = false)
{
    include_once "functions_user.php";
    global $config;
    $output = '';
    if (!$filter) {
        $search_string = (string) get_parameter('search_string');
        $status = (int) get_parameter('search_status', -10);
        $priority = (int) get_parameter('search_priority', -1);
        $resolution = (int) get_parameter('search_resolution', -1);
        $id_group = (int) get_parameter('search_id_group');
        $id_inventory = (int) get_parameter('search_id_inventory');
        $id_company = (int) get_parameter('search_id_company');
        $search_id_user = (string) get_parameter('search_id_user');
        $search_id_incident_type = (int) get_parameter('search_id_incident_type');
        $date_from = (int) get_parameter("search_from_date");
        $date_start = (string) get_parameter("search_first_date");
        $date_end = (string) get_parameter("search_last_date");
        $search_creator = (string) get_parameter('search_id_creator');
        $search_editor = (string) get_parameter('search_editor');
        $search_closed_by = (string) get_parameter('search_id_creator');
        $group_by_project = (bool) get_parameter('search_group_by_project');
        $sla_state = (int) get_parameter('search_sla_state', 0);
        $id_task = (int) get_parameter('search_id_task', 0);
        $left_sla = (int) get_parameter('search_left_sla', 0);
        $right_sla = (int) get_parameter('search_right_sla', 0);
        $show_hierarchy = (bool) get_parameter('show_hierarchy');
        $type_fields = incidents_get_type_fields($search_id_incident_type);
        $search_type_field = array();
        foreach ($type_fields as $key => $type_field) {
            $search_type_field[$type_field['id']] = (string) get_parameter('search_type_field_' . $type_field['id']);
        }
    } else {
        $search_string = (string) $filter['string'];
        $priority = (int) $filter['priority'];
        $id_group = (int) $filter['id_group'];
        $status = (int) $filter['status'];
        $resolution = (int) $filter['resolution'];
        $id_company = (int) $filter['id_company'];
        $id_inventory = (int) $filter['id_inventory'];
        $search_id_incident_type = (int) $filter['id_incident_type'];
        $search_id_user = (string) $filter['id_user'];
        $date_from = (int) $filter['from_date'];
        $date_start = (string) $filter['first_date'];
        $date_end = (string) $filter['last_date'];
        $search_creator = (string) $filter['id_creator'];
        $search_editor = (string) $filter['editor'];
        $search_closed_by = (string) $filter['closed_by'];
        $group_by_project = (bool) $filter['group_by_project'];
        $sla_state = (int) $filter['sla_state'];
        $id_task = (int) $filter['id_task'];
        $left_sla = (int) $filter['left_sla'];
        $right_sla = (int) $filter['right_sla'];
        $show_hierarchy = (bool) $filter['show_hierarchy'];
        $type_fields = incidents_get_type_fields($search_id_incident_type);
        $search_type_field = array();
        if ($type_fields) {
            foreach ($type_fields as $key => $type_field) {
                $search_type_field[$type_field['id']] = (string) $filter['type_field_' . $type_field['id']];
            }
        }
    }
    /* No action is set, so the form will be sent to the current page */
    $table = new stdclass();
    $table->width = "99%";
    $table->class = "search-table-button";
    $table->cellspacing = 2;
    $table->cellpadding = 2;
    $table->data = array();
    $table->size = array();
    $table->style = array();
    $table->style[0] = 'width: 25%';
    $table->style[1] = 'width: 25%';
    $table->style[2] = 'width: 25%; vertical-align:text-top;';
    $table->style[3] = 'width: 25%';
    $table->rowstyle = array();
    $table->rowstyle[1] = 'display: none';
    $table->rowstyle[2] = 'display: none';
    $table->rowstyle[3] = 'display: none';
    $table->rowstyle[4] = 'display: none';
    $table->rowstyle[5] = 'display: none';
    $table->rowstyle[6] = 'text-align: right';
    $table->colspan = array();
    $table->colspan[0][0] = 2;
    $table->colspan[6][0] = 4;
    $table->colspan[7][1] = 3;
    $table->rowspan = array();
    $table->rowspan[2][2] = 2;
    $table->data[0][0] = print_input_text('search_string', $search_string, '', 50, 100, true, __('Search string'));
    $available_status = get_indicent_status();
    $available_status[-10] = __("Not closed");
    $table->data[0][1] = print_select($available_status, 'search_status', $status, '', __('Any'), 0, true, false, true, __('Status'));
    $groups = users_get_groups_for_select($config['id_user'], "IW", true, true);
    $table->data[0][2] = print_select($groups, 'search_id_group', $id_group, '', '', '', true, false, false, __('Group'));
    $table->data[0][3] = print_checkbox_extended('search_show_hierarchy', 1, $show_hierarchy, false, '', '', true, __('Show hierarchy'));
    $params_owner = array();
    $params_owner['input_id'] = 'text-search_id_user';
    $params_owner['input_name'] = 'search_id_user';
    $params_owner['input_value'] = $search_id_user;
    $params_owner['title'] = __('Owner');
    $params_owner['return'] = true;
    $table->data[1][0] = user_print_autocomplete_input($params_owner);
    $params_editor = array();
    $params_editor['input_id'] = 'text-search_editor';
    $params_editor['input_name'] = 'search_editor';
    $params_editor['input_value'] = $search_editor;
    $params_editor['title'] = __('Editor');
    $params_editor['return'] = true;
    $table->data[1][1] = user_print_autocomplete_input($params_editor);
    $params_closed_by = array();
    $params_closed_by['input_id'] = 'text-search_closed_by';
    $params_closed_by['input_name'] = 'search_closed_by';
    $params_closed_by['input_value'] = $search_closed_by;
    $params_closed_by['title'] = __('Closed by');
    $params_closed_by['return'] = true;
    $table->data[1][2] = user_print_autocomplete_input($params_closed_by);
    $params_creator = array();
    $params_creator['input_id'] = 'text-search_id_creator';
    $params_creator['input_name'] = 'search_id_creator';
    $params_creator['input_value'] = $search_creator;
    $params_creator['title'] = __('Creator');
    $params_creator['return'] = true;
    $table->data[1][3] = user_print_autocomplete_input($params_creator);
    $table->data[2][0] = print_select(get_priorities(), 'search_priority', $priority, '', __('Any'), -1, true, false, false, __('Priority'), false);
    $table->data[2][1] = print_select(get_incident_resolutions(), 'search_resolution', $resolution, '', __('Any'), -1, true, false, false, __('Resolution'), false);
    $table->data[2][2] = get_last_date_control($date_from, 'search_from_date', __('Date'), $date_start, 'search_first_date', __('Created from'), $date_end, 'search_last_date', __('Created to'));
    $name = $id_inventory ? get_inventory_name($id_inventory) : '';
    $table->data[2][3] = print_input_text('inventory_name', $name, '', 7, 0, true, __('Inventory'), false);
    $table->data[2][3] .= "&nbsp;&nbsp;<a href='javascript: show_search_inventory(\"\",\"\",\"\",\"\",\"\",\"\");'>" . print_image('images/zoom.png', true, array('title' => __('Search inventory'))) . "</a>";
    $table->data[2][3] .= print_input_hidden('id_inventory', $id_inventory, true);
    if (!get_external_user($config["id_user"])) {
        $table->data[4][0] = print_select(get_companies(), 'search_id_company', $id_company, '', __('All'), 0, true, false, false, __('Company'));
    }
    $table->data[4][1] = print_select(get_incident_types(), 'search_id_incident_type', $search_id_incident_type, 'javascript:change_type_fields_table();', __('All'), 0, true, false, false, __('Ticket type'));
    $table->data[4][3] = print_checkbox_extended('search_group_by_project', 1, $group_by_project, false, '', '', true, __('Group by project/task'));
    $sla_states = array();
    $sla_states[1] = __('SLA is fired');
    $sla_states[2] = __('SLA is not fired');
    $table->data[5][0] = print_select($sla_states, 'search_sla_state', $sla_state, '', __('All'), 0, true, false, false, __('SLA'));
    $table->data[5][1] = combo_task_user_participant($config["id_user"], 0, $id_task, true, __("Task"), 'search_id_task');
    $table->data[5][2] = print_input_text('search_left_sla', $left_sla, '', 7, 0, true, __('SLA > (%)'), false);
    $table->data[5][3] = print_input_text('search_right_sla', $right_sla, '', 7, 0, true, __('SLA < (%)'), false);
    $table_type_fields = new stdclass();
    $table_type_fields->width = "100%";
    $table_type_fields->class = "search-table";
    $table_type_fields->data = array();
    //Print custom field data
    $column = 0;
    $row = 0;
    if ($type_fields) {
        foreach ($type_fields as $key => $type_field) {
            $data = $search_type_field[$type_field['id']];
            if ($type_field['type'] == "text" || $type_field['type'] == "textarea") {
                $input = print_input_text('search_type_field_' . $type_field['id'], $data, '', 30, 30, true, $type_field['label']);
            } else {
                if ($type_field['type'] == "combo") {
                    $combo_values = explode(",", $type_field['combo_value']);
                    $values = array();
                    foreach ($combo_values as $value) {
                        $values[$value] = $value;
                    }
                    $input = print_select($values, 'search_type_field_' . $type_field['id'], $data, '', __('Any'), '', true, false, false, $type_field['label']);
                } else {
                    if ($type_field['type'] == "linked") {
                        $linked_values = explode(",", $type_field['linked_value']);
                        $values = array();
                        foreach ($linked_values as $value) {
                            $value_without_parent = preg_replace("/^.*\\|/", "", $value);
                            $values[$value_without_parent] = $value_without_parent;
                            $has_childs = get_db_all_rows_sql("SELECT * FROM tincident_type_field WHERE parent=" . $type_field['id']);
                            if ($has_childs) {
                                $i = 0;
                                foreach ($has_childs as $child) {
                                    if ($i == 0) {
                                        $childs = $child['id'];
                                    } else {
                                        $childs .= ',' . $child['id'];
                                    }
                                    $i++;
                                }
                                $childs = "'" . $childs . "'";
                                $script = 'javascript:change_linked_type_fields_table(' . $childs . ',' . $type_field['id'] . ');';
                            } else {
                                $script = '';
                            }
                        }
                        $input = print_select($values, 'search_type_field_' . $type_field['id'], $data, $script, __('Any'), '', true, false, false, $type_field['label']);
                    }
                }
            }
            $table_type_fields->data[$row][$column] = $input;
            if ($column >= 3) {
                $column = 0;
                $row++;
            } else {
                $column++;
            }
        }
    }
    if ($table_type_fields->data) {
        $table_type_fields_html = print_table($table_type_fields, true);
    }
    $table->data[6][0] = "<div id='table_type_fields'>" . $table_type_fields_html . "</div>";
    $table->data[7][0] = '<div style="width: 100%; text-align: left; height: 20px;"><a class="show_advanced_search" id="show_advanced_search" href="javascript:show_ad_search();">' . __('Advanced search') . '></a></div>';
    //Store serialize filter
    serialize_in_temp($filter, $config["id_user"]);
    $table->data[7][2] = print_submit_button(__('Search'), 'search', false, 'class="sub search"', true);
    $table->data[7][2] .= print_button(__('Export to CSV'), '', false, 'window.open(\'' . 'include/export_csv.php?export_csv_tickets=1' . '\')', 'class="sub csv"', true);
    $table->colspan[7][2] = 4;
    $output .= '<form id="search_incident_form" method="post" action="index.php?sec=incidents&sec2=operation/incidents/incident_search">';
    $output .= print_table($table, true);
    $output .= '</form>';
    echo "<div class= 'dialog ui-dialog-content' id='search_inventory_window'></div>";
    if ($return) {
        return $output;
    }
    echo $output;
}
Пример #9
0
function print_single_workunit_report($mwur)
{
    if ($mwur['result_out']) {
        echo '<h3 class="suc">' . __('Workunit added') . '</h3>';
    } else {
        echo '<h3 class="error">' . __('Problemd adding workunit.') . '</h3>';
    }
    echo "<table class='search-table' width='99%'>";
    echo "<tr>";
    echo "<td>";
    echo "<strong>" . sprintf(__("Workunit  #%d"), $mwur['id']) . "</strong>";
    echo "</td>";
    echo "</tr>";
    echo "<tr>";
    echo "<td>";
    echo "<strong>" . __("Date") . ": </strong>";
    echo $mwur['date'];
    echo "</td>";
    echo "<td colspan='2'>";
    echo "<strong>" . __("Task") . ": </strong>";
    $task_name = get_db_value("name", "ttask", "id", $mwur['task']);
    echo $task_name;
    echo "</td>";
    echo "<td colspan='2'>";
    echo "<strong>" . __("Role") . ": </strong>";
    $role_name = get_db_value("name", "trole", "id", $mwur['role']);
    echo $role_name;
    echo "</td>";
    echo "<td colspan='2'>";
    echo "<strong>" . __("Username") . ": </strong>";
    echo $mwur['user'];
    echo "</td>";
    echo "</tr>";
    echo "<tr>";
    echo "<td>";
    echo "<strong>" . __("Time used") . ": </strong>";
    echo $mwur['duration'];
    echo " " . __("hours");
    echo "</td>";
    echo "<td>";
    echo "<strong>" . __("Have cost") . ": </strong>";
    echo "</td>";
    echo "<td>";
    echo print_checkbox_extended("id", "nothing", $mwur['cost'], true, "", "", true);
    echo "</td>";
    echo "<td>";
    echo "<strong>" . __("Public") . ": </strong>";
    echo "</td>";
    echo "<td>";
    echo print_checkbox_extended("id", "nothing", $mwur['public'], true, "", "", true);
    echo "</td>";
    echo "<td>";
    echo "<strong>" . __("Forward") . ": </strong>";
    echo "</td>";
    echo "<td>";
    echo print_checkbox_extended("id", "nothing", $mwur['forward'], true, "", "", true);
    echo "</td>";
    echo "<td>";
    echo "<strong>" . __("Split > 1 day") . ": </strong>";
    echo "</td>";
    echo "<td>";
    echo print_checkbox_extended("id", "nothing", $mwur['split'], true, "", "", true);
    echo "</td>";
    echo "</tr>";
    echo "<tr>";
    echo "<td>";
    echo "<strong>" . __("Work from home") . ": </strong>";
    echo "</td>";
    echo "<td>";
    echo print_checkbox_extended("id", "nothing", $mwur['work_home'], true, "", "", true);
    echo "</td>";
    echo "</tr>";
    echo "<tr>";
    echo "<td colspan='5'>";
    echo "<strong>" . __("Description") . "</strong>";
    echo "</td>";
    echo "</tr>";
    echo "<tr>";
    echo "<td colspan='4'>";
    echo $mwur['description'];
    echo "</td>";
    echo "</tr>";
    echo "</table>";
}
Пример #10
0
function inventories_show_list($sql_search, $sql_count, $params = '', $last_update = 0, $modal = 0)
{
    global $config;
    $is_enterprise = false;
    if (file_exists("enterprise/include/functions_inventory.php")) {
        require_once "enterprise/include/functions_inventory.php";
        $is_enterprise = true;
    }
    $write_permission = enterprise_hook('inventory_check_acl', array($config['id_user'], $id, true));
    $params['mode'] = 'list';
    if (!$sql_search) {
        $sql_search = "SELECT * FROM tinventory";
    }
    $pure = get_parameter("pure");
    if ($pure) {
        $block_limit = 5000;
    } else {
        $block_limit = $config["block_size"];
    }
    $sql_search .= " LIMIT " . $block_limit;
    $offset = get_parameter("offset", 0);
    $sql_search .= " OFFSET {$offset}";
    $inventories_aux = get_db_all_rows_sql($sql_search);
    $count_inv = get_db_value_sql($sql_count);
    if ($is_enterprise) {
        $inventories = inventory_get_user_inventories($config['id_user'], $inventories_aux);
    } else {
        $inventories = $inventories_aux;
    }
    if ($inventories === false) {
        echo ui_print_error_message(__("Empty inventory"), '', true, 'h3', true);
    } else {
        $result_check = inventories_check_same_object_type_list($inventories);
        $table->id = 'inventory_list';
        $table->class = 'listing';
        $table->width = '100%';
        $table->data = array();
        $table->head = array();
        $table->colspan = array();
        $table->head[0] = __('Id');
        $table->head[1] = __('Name');
        $table->head[2] = __('Owner');
        $table->head[3] = __("Parent object");
        $table->head[4] = __('Object type');
        $table->head[5] = __('Manufacturer');
        $table->head[6] = __('Contract');
        $table->head[7] = __('Status');
        $table->head[8] = __('Receipt date');
        if ($result_check) {
            $res_object_fields = inventories_get_all_type_field($result_check, false, true);
            $i = 9;
            foreach ($res_object_fields as $key => $object_field) {
                if (isset($object_field["label"])) {
                    $table->head[$i] = $object_field['label'];
                    $i++;
                }
            }
            if (!$pure) {
                if (!$modal) {
                    $table->head[$i] = __('Actions');
                    if ($write_permission) {
                        $i = $i + 1;
                        $table->head[$i] = print_checkbox('inventorycb-all', "", false, true);
                    }
                }
            }
        } else {
            if (!$pure) {
                if (!$modal) {
                    $table->head[9] = __('Actions');
                    if ($write_permission) {
                        $table->head[10] = print_checkbox('inventorycb-all', "", false, true);
                    }
                }
            }
        }
        $count = $count_inv;
        $params = json_encode($params);
        $params = base64_encode($params);
        $url_pag = "index.php?sec=inventory&sec2=operation/inventories/inventory&params=" . $params;
        $offset = get_parameter("offset");
        if (!$pure) {
            pagination($count, $url_pag, $offset, false, '', 0, true);
        }
        $idx = 0;
        foreach ($inventories as $key => $inventory) {
            $data = array();
            if ($modal) {
                $url = "javascript:loadInventory(" . $inventory['id'] . ");";
            } else {
                $url = 'index.php?sec=inventory&sec2=operation/inventories/inventory_detail&id=' . $inventory['id'];
            }
            $data[0] = "<a href=" . $url . ">" . $inventory['id'] . "</a>";
            $data[1] = "<a href=" . $url . ">" . $inventory['name'] . '</a>';
            if ($inventory['owner'] != '') {
                $name_owner = get_db_value('nombre_real', 'tusuario', 'id_usuario', $inventory['owner']);
            } else {
                $name_owner = '--';
            }
            $data[2] = "<a href=" . 'index.php?sec=users&sec2=operation/users/user_edit&id=' . $inventory['owner'] . ">" . $name_owner . '</a>';
            if ($inventory["id_parent"] != 0) {
                $name_parent = get_db_value('name', 'tinventory', 'id', $inventory['id_parent']);
                $data[3] = "<a href=" . 'index.php?sec=inventory&sec2=operation/inventories/inventory_detail&id=' . $inventory['id_parent'] . ">" . $name_parent . '</a>';
            } else {
                $name_parent = '--';
                $data[3] = $name_parent;
            }
            if ($inventory['id_object_type'] != 0) {
                $name_object = get_db_value('name', 'tobject_type', 'id', $inventory['id_object_type']);
                $data[4] = "<a href=" . 'index.php?sec=inventory&sec2=operation/inventories/manage_objects&id=' . $inventory['id_object_type'] . ">" . $name_object . '</a>';
            } else {
                $name_object = '--';
                $data[4] = $name_object;
            }
            if ($inventory['id_manufacturer'] != 0) {
                $name_manufacturer = get_db_value('name', 'tmanufacturer', 'id', $inventory['id_manufacturer']);
                $data[5] = "<a href=" . 'index.php?sec=inventory&sec2=operation/manufacturers/manufacturer_detail&id=' . $inventory['id_manufacturer'] . ">" . $name_manufacturer . '</a>';
            } else {
                $name_manufacturer = '--';
                $data[5] = $name_manufacturer;
            }
            if ($inventory['id_contract'] != 0) {
                $name_contract = get_db_value('name', 'tcontract', 'id', $inventory['id_contract']);
                $data[6] = "<a href=" . 'index.php?sec=customers&sec2=operation/contracts/contract_detail&id_contract=' . $inventory['id_contract'] . ">" . $name_contract . '</a>';
            } else {
                $name_contract = '--';
                $data[6] = $name_contract;
            }
            if ($inventory['status'] != "") {
                $data[7] = __($inventory['status']);
            } else {
                $status_none = '--';
                $data[7] = $status_none;
            }
            if ($inventory['receipt_date'] != "") {
                $data[8] = $inventory['receipt_date'];
            } else {
                $receipt_date = '--';
                $data[8] = $receipt_date;
            }
            if ($result_check) {
                $result_object_fields = inventories_get_all_type_field($result_check, $inventory['id'], true);
                $i = 9;
                foreach ($result_object_fields as $k => $ob_field) {
                    if (isset($ob_field["label"])) {
                        $data[$i] = $ob_field['data'];
                        $i++;
                    }
                }
                if (!$pure) {
                    if (!$modal) {
                        if ($write_permission) {
                            $data[$i] .= '<a href="index.php?sec=inventory&sec2=operation/inventories/inventory&quick_delete=' . $inventory["id"] . '&params=' . $params . '" onClick="if (!confirm(\'' . __('Are you sure?') . '\')) return false;"><img src="images/cross.png"></a>';
                        }
                    }
                }
                if (!$pure) {
                    if (!$modal) {
                        if ($write_permission) {
                            $i = $i + 1;
                            $data[$i] = print_checkbox_extended('inventorycb-' . $inventory['id'], $inventory['id'], false, '', '', 'class="cb_inventory"', true);
                        }
                    }
                }
            } else {
                if (!$pure) {
                    if (!$modal) {
                        if ($write_permission) {
                            $data[9] .= '<a href="index.php?sec=inventory&sec2=operation/inventories/inventory&quick_delete=' . $inventory["id"] . '" onClick="if (!confirm(\'' . __('Are you sure?') . '\')) return false;"><img src="images/cross.png"></a>';
                        }
                    }
                }
                if (!$pure) {
                    if (!$modal) {
                        if ($write_permission) {
                            $data[10] = print_checkbox_extended('inventorycb-' . $inventory['id'], $inventory['id'], false, '', '', 'class="cb_inventory"', true);
                        }
                    }
                }
            }
            $table->rowclass[$idx] = 'inventory_info_' . $inventory["id"];
            $idx++;
            array_push($table->data, $data);
        }
        echo '<div id= "inventory_only_table">';
        print_table($table);
        echo '</div>';
        if (!$pure) {
            pagination($count, $url_pag, $offset, true, '', 0, true);
            if (!$modal) {
                if ($write_permission) {
                    echo '<div class="button-form">';
                    echo print_button(__('Delete All'), '', false, 'javascript: delete_massive_inventory()', 'class="sub"', true);
                    echo '</div>';
                }
            }
        }
    }
}
Пример #11
0
$table->data[0][0] = print_input_text('name', $name, '', 60, 240, true, __('Name'));
$table->data[0][1] = print_select(get_priorities(), 'priority', $priority, '', '', '', true, false, false, __('Priority'));
if ($project_permission['manage'] || $operation == "view") {
    $combo_none = __('None');
} else {
    $combo_none = false;
}
$table->data[0][2] = combo_task_user_manager($config['id_user'], $parent, true, __('Parent'), 'parent', $combo_none, false, $id_project, $id_task);
$table->data[1][0] = print_input_text('start_date', $start, '', 15, 15, true, __('Start'));
$table->data[1][1] = print_input_text('end_date', $end, '', 15, 15, true, __('End'));
$table->data[1][2] = print_select(get_periodicities(), 'periodicity', $periodicity, '', __('None'), 'none', true, false, false, __('Recurrence'));
$table->data[2][0] = print_input_text('hours', $hours, '', 5, 5, true, __('Estimated hours'));
$table->data[2][0] .= "&nbsp;&nbsp;<a href='javascript: show_calculation();'>" . print_image('images/play.gif', true, array('title' => __('Calculate hours'))) . "</a>";
$table->data[2][1] = print_input_text('estimated_cost', $estimated_cost, '', 7, 11, true, __('Estimated cost'));
$table->data[2][1] .= ' ' . $config['currency'];
$table->data[2][2] = print_checkbox_extended('count_hours', 1, $count_hours, false, '', '', true, __('Completion based on hours')) . print_help_tip(__("Calculated task completion using workunits inserted by project members, if not it uses Completion field of this form"), true);
$table->data[3][0] = print_input_text('cc', $cc, '', 60, 240, true, __('CC') . print_help_tip(__("Email to notify changes in workunits"), true));
$table->colspan[4][0] = 3;
$completion_label = __('Completion') . " <em>(<span id=completion>" . $completion . "%</span>)</em>";
$table->data[4][0] = print_label($completion_label, '', '', true, '<div id="slider" style="margin-top: 5px;"><div class="ui-slider-handle"></div></div>');
$table->data[4][0] .= print_input_hidden('completion', $completion, true);
//////TABLA ADVANCED
$table_advanced->width = '98%';
$table_advanced->class = 'search-table';
$table_advanced->size = array();
$table_advanced->size[0] = '33%';
$table_advanced->size[1] = '33%';
$table_advanced->size[2] = '33%';
$table_advanced->style = array();
$table_advanced->data = array();
$links_1 = projects_get_task_links($id_project, $id_task, 1);
Пример #12
0
		$table->size[10] = '40px;';

		$lead_warning_time = $config["lead_warning_time"] * 86400;
		
		foreach ($leads as $lead) {
			$data = array ();
			
			// Detect is the lead is pretty old 
			// Stored in $config["lead_warning_time"] in days, need to calc in secs for this
			if (calendar_time_diff ($lead["modification"]) > $lead_warning_time ){
				$table->rowclass[] = "red_row";
			} else {
				$table->rowclass[] = "";
			}

			$data[0] = print_checkbox_extended ('leadcb-'.$lead['id'], $lead['id'], false, '', '', 'class="cb_lead"', true);

			$data[1] = "<b><a href='index.php?sec=customers&sec2=operation/leads/lead&tab=search&id=".
				$lead['id']."'>#".$lead['id']."</a></b>";


			$data[2] = print_product_icon ($lead['id_category'], true);

			if ($lead['executive_overview'] != '') {
				$overview = print_help_tip ($lead['executive_overview'], true);
			} else {
				$overview = '';
			}
 			$data[3] = "<a href='index.php?sec=customers&sec2=operation/leads/lead&tab=search&id=".
				$lead['id']."'>".$lead['fullname'].$overview."</a><br>";
				$data[3] .= "<span style='font-size: 9px'><i>".$lead["company"]."</i></span>";
Пример #13
0
     $table->data[0][0] = print_label(__('Name'), '', '', true, $name);
 }
 $params_assigned['input_id'] = 'text-owner';
 $params_assigned['input_name'] = 'owner';
 $params_assigned['input_value'] = $owner;
 $params_assigned['title'] = 'Owner';
 $params_assigned['return'] = true;
 if ($write_permission || !$id) {
     $table->data[0][1] = user_print_autocomplete_input($params_assigned);
 } else {
     $table->data[0][1] = print_label(__('Owner'), '', '', true, $owner);
 }
 if ($write_permission || !$id) {
     $table->data[0][2] = print_checkbox_extended('public', 1, $public, false, '', '', true, __('Public'));
 } else {
     $table->data[0][2] = print_checkbox_extended('public', 1, $public, true, '', '', true, __('Public'));
 }
 if ($write_permission || !$id) {
     $parent_name = $id_parent ? get_inventory_name($id_parent) : __("None");
     $table->data[1][0] = print_input_text_extended("parent_name", $parent_name, "text-parent_name", '', 20, 0, false, "show_inventory_search('','','','','','','','','','', '', '')", "class='inventory_obj_search'", true, false, __('Parent object'));
     $table->data[1][0] .= print_image("images/cross.png", true, array("onclick" => "cleanParentInventory()", "style" => "cursor: pointer"));
     $table->data[1][0] .= print_input_hidden('id_parent', $id_parent, true);
 } else {
     $parent_name = $id_parent ? get_inventory_name($id_parent) : __('Not set');
     $table->data[1][0] = print_label(__('Parent object'), '', '', true, $parent_name);
     if ($id_parent) {
         $table->data[1][0] .= '<a href="index.php?sec=inventory&sec2=operation/inventories/inventory_detail&id=' . $id_parent . '"><img src="images/go.png" /></a>';
     }
 }
 $contracts = get_contracts();
 $manufacturers = get_manufacturers();
Пример #14
0
 $objects_type = get_object_types();
 $table_search->data[0][1] = print_label(__('Object type'), '', '', true);
 $table_search->data[0][1] .= print_select($objects_type, 'id_object_type_search', $id_object_type, 'show_type_fields();', 'Select', '', true, 0, true, false, false, 'width: 200px;');
 $table_search->data[0][2] = print_label(__('Object fields'), '', '', true);
 $table_search->data[0][2] .= print_select($object_fields, 'object_fields_search[]', '', '', 'Select', '', true, 4, true, false, false, 'width: 200px;');
 $params_assigned['input_id'] = 'text-owner';
 $params_assigned['input_name'] = 'owner';
 $params_assigned['input_value'] = $owner;
 $params_assigned['title'] = 'Owner';
 $params_assigned['return'] = true;
 $table_search->data[1][0] = user_print_autocomplete_input($params_assigned);
 $contracts = get_contracts();
 $manufacturers = get_manufacturers();
 $table_search->data[1][1] = print_select($contracts, 'id_contract', $id_contract, '', __('None'), 0, true, false, false, __('Contract'), '', 'width: 200px;');
 $table_search->data[1][2] = print_select($manufacturers, 'id_manufacturer', $id_manufacturer, '', __('None'), 0, true, false, false, __('Manufacturer'), '', 'width: 200px;');
 $table_search->data[1][3] = print_checkbox_extended('last_update', 1, $last_update, false, '', '', true, __('Last updated'));
 $buttons = '<div style=" text-align: right;">';
 $buttons .= print_input_hidden('search', 1, true);
 $buttons .= print_input_hidden('mode', $mode, true);
 $buttons .= print_submit_button(__('Search'), 'search', false, 'class="sub search"', true);
 $filter["query"] = $sql_search;
 serialize_in_temp($filter, $config["id_user"]);
 $buttons .= print_button(__('Export to CSV'), '', false, 'window.open(\'' . 'include/export_csv.php?export_csv_inventory=1' . '\')', 'class="sub csv"', true);
 $buttons .= print_report_button("index.php?sec=inventory&sec2=operation/inventories/inventory&search=1&params={$params}", __('Export to PDF') . "&nbsp;");
 $buttons .= '</div>';
 $all_inventory_status = inventories_get_inventory_status();
 array_unshift($all_inventory_status, __("All"));
 $table_search->data[2][0] = print_select($all_inventory_status, 'inventory_status', $inventory_status, '', '', '', true, false, false, __('Status'));
 $params_associated['input_id'] = 'text-associated_user';
 $params_associated['input_name'] = 'associated_user';
 $params_associated['input_value'] = $associated_user;
Пример #15
0
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 . "&nbsp;" . $img_task . "&nbsp;" . safe_output($project_name) . "&nbsp;" . "({$count_tickets})" . "</a>" . "&nbsp;&nbsp;";
        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 "&nbsp;{$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>';
}
Пример #16
0
$table_search = new stdClass();
$table_search->width = '99%';
$table_search->class = 'search-table-button';
$table_search->size = array();
$table_search->style = array();
$table_search->colspan = array();
$table_search->rowspan = array();
$table_search->colspan[4][0] = 4;
$table_search->data = array();
$sql = sprintf('SELECT id, name FROM tcustom_search
	WHERE id_user = "******"
	AND section = "incidents"
	ORDER BY name', $config['id_user']);
$table_search->data[0][0] = print_select_from_sql($sql, 'saved_searches', $id_search, '', __('Select'), 0, true, false, true, __('Custom searches'));
$table_search->data[1][0] = print_checkbox_extended('show_list', 1, $show_list, false, '', '', true, __('Show list'));
$table_search->data[2][0] = print_checkbox_extended('show_stats', 1, $show_stats, false, '', '', true, __('Show stats'));
$table_search->data[4][0] = print_submit_button(__('Search'), 'search', false, 'class="sub search"', true);
$table_search->colspan[4][0] = 4;
echo '<form method="post">';
print_table($table_search);
echo '</form>';
if (isset($search)) {
    echo "<div id='incident-search-content'>";
    echo "<h1>" . __('Report results');
    echo "<div id='button-bar-title'>";
    echo "<ul>";
    echo "<li>";
    echo '<a href="index.php?sec=reporting&amp;sec2=operation/reporting/incidents_html
			&amp;custom_search=' . $id_search . '&amp;show_stats=' . $show_stats . '&amp;show_list=' . $show_list . '&amp;clean_output=1&amp;pdf_output=1">
			<img src="images/page_white_acrobat.png" title="' . __('Export to PDF') . '"></a>';
    echo "</li>";
Пример #17
0
             $data[3] = __('Yes');
         } else {
             $data[3] = __('No');
         }
         $data[4] = "";
         if (!$field["global_id"]) {
             if (get_admin_user($config['id_user'])) {
                 $data[4] = "<a\n\t\t\t\t\t\thref='" . $url_update . "'>\n\t\t\t\t\t\t<img src='images/wrench.png' border=0 /></a>";
             }
         } else {
             $data[4] = "<a\n\t\t\t\t\t\thref='" . $url_update . "'>\n\t\t\t\t\t\t<img src='images/eye.png' border=0 /></a>";
         }
         if (get_admin_user($config['id_user'])) {
             $data[4] .= "<a\n\t\t\t\t\tonclick=\"if (!confirm('" . __('Are you sure?') . "')) return false;\" href='" . $url_delete . "'>\n\t\t\t\t\t<img src='images/cross.png' border=0 /></a>";
         }
         $data[5] = print_checkbox_extended('sorted_items[]', $field['id'], false, false, '', '', true);
         array_push($table->data, $data);
     }
     print_table($table);
 } else {
     echo "<h4>" . __("No fields") . "</h4>";
 }
 echo "<form id='form-add_field' name='dataedit' method='post' action='index.php?sec=incidents&sec2=operation/incidents/incident_type_field&add_field=1&id=" . $id . "'>";
 echo '<div style="width: ' . $table->width . '; text-align: right;">';
 print_submit_button(__('Add field'), 'create_btn', false, 'class="sub create"', false);
 echo '</div>';
 echo "</form>";
 $table_sort->class = 'search-table';
 $table_sort->width = '99%';
 $table_sort->colspan[0][0] = 3;
 $table_sort->size = array();
Пример #18
0
// Table for advanced controls
if ($editor) {
    $table_advanced->data[0][0] = print_label(__('Editor'), '', '', true, $editor);
} else {
    $table_advanced->data[0][0] = "&nbsp;";
}
if ($has_im && $create_incident) {
    $groups = get_user_groups($config['id_user'], "IW");
    $table_advanced->data[0][1] = print_select($groups, "id_group_creator", $id_grupo_incident, '', '', 0, true, false, false, __('Creator group'), $blocked_incident);
} elseif ($create_incident) {
    $table_advanced->data[0][1] = print_label(__('Creator group'), '', '', true, dame_nombre_grupo($id_grupo_incident));
} elseif ($id_group_creator) {
    $table_advanced->data[0][1] = print_label(__('Creator group'), '', '', true, dame_nombre_grupo($id_group_creator));
}
if ($has_im) {
    $table_advanced->data[0][2] = print_checkbox_extended('sla_disabled', 1, $sla_disabled, $blocked_incident, '', '', true, __('SLA disabled'));
    $table_advanced->data[1][0] = print_checkbox("email_notify_form", 1, $email_notify, true, __('Notify changes by email '), $blocked_incident);
} else {
    $table_advanced->data[0][2] = print_input_hidden('sla_disabled', 0, true);
    $table_advanced->data[1][0] = print_input_hidden('email_notify', 1, true);
}
$parent_name = $id_parent ? __('Ticket') . ' #' . $id_parent : __('None');
if ($has_im) {
    $table_advanced->data[3][0] = print_input_text('search_parent', $parent_name, '', 10, 100, true, __('Parent ticket'), $blocked_incident);
    $table_advanced->data[3][0] .= print_input_hidden('id_parent', $id_parent, true);
    if (!$blocked_incident) {
        $table_advanced->data[3][0] .= print_image("images/cross.png", true, array("onclick" => "clean_parent_field()", "style" => "cursor: pointer"));
    }
}
// Show link to go parent incident
if ($id_parent) {
Пример #19
0
$invoice_status_ar['pending']= __("Pending");
$invoice_status_ar['paid']= __("Paid");
$invoice_status_ar['canceled']= __("Canceled");
$table->data[2][0] = print_select ($invoice_status_ar, 'invoice_status',
	$invoice_status, '','', 0, true, false, false, __('Invoice status'));

$table->data[2][1] = print_input_text ('invoice_create_date', $invoice_create_date, '', 15, 50, true, __('Invoice creation date'));
$table->data[3][0] = print_input_text ('invoice_payment_date', $invoice_payment_date, '', 15, 50, true,__('Invoice effective payment date'));

if ($id_invoice != -1) {
	$disabled = true;
} else {
	$disabled = false;
}

$table->data[3][0] .= print_checkbox_extended ('calendar_event', 1, '', false, '', '', true, __('Create calendar event'));

$table->data[3][1] = print_input_text ('invoice_expiration_date', $invoice_expiration_date, '', 15, 50, true,__('Invoice expiration date'));

$table->data[4][0] = print_select_from_sql ('SELECT id_language, name FROM tlanguage ORDER BY name', 'id_language', 
	$language, '', '', '', true, false, false, __('Language'));
	
$table->data[4][1] = print_input_text ('invoice_contract_number', $invoice_contract_number, '', 15, 50, true,__('Contract number'));

$table->data[5][0] = "<h4>".__('Concept')."</h4>";
$table->data[5][1] = "<h4>".__('Amount')."</h4>";
$table->data[6][0] = print_input_text ('concept1', $concept[0], '', 60, 250, true);
$table->data[6][1] = print_input_text ('amount1', $amount[0], '', 10, 20, true);
$table->data[7][0] = print_input_text ('concept2', $concept[1], '', 60, 250, true);
$table->data[7][1] = print_input_text ('amount2', $amount[1], '', 10, 20, true);
$table->data[8][0] = print_input_text ('concept3', $concept[2], '', 60, 250, true);
Пример #20
0
/**
 * Render a checkbox button input.
 *
 * @param string Input name.
 * @param string Input value.
 * @param string Set the button to be marked (optional, unmarked by default).
 * @param bool Whether to return an output string or echo now (optional, echo by default).
 */
function print_checkbox($name, $value, $checked = false, $return = false, $label = false, $disabled = false)
{
    $output = print_checkbox_extended($name, $value, (bool) $checked, $disabled, '', '', true, $label);
    if ($return) {
        return $output;
    }
    echo $output;
}
Пример #21
0
 $nombre = $rowdup["id_usuario"];
 $nivel = $rowdup["nivel"];
 $realname = $rowdup["nombre_real"];
 $fecha_registro = $rowdup["fecha_registro"];
 $avatar = $rowdup["avatar"];
 if ($rowdup["nivel"] == 0) {
     $nivel = "<img src='images/group.png' title='" . __("Standard user") . "'>";
 } elseif ($rowdup["nivel"] == 1) {
     $nivel = "<img src='images/integria_mini_logo.png' title='" . __("Administrator") . "'>";
 } else {
     $nivel = "<img src='images/user_gray.png' title='" . __("External user") . "'>";
 }
 $disabled = $rowdup["disabled"];
 $id_company = $rowdup["id_company"];
 echo "<tr><td>";
 echo print_checkbox_extended("user-" . $rowdup["id_usuario"], $rowdup["id_usuario"], false, false, "", "class='user_checkbox'", true);
 echo "<td>";
 if ($disabled == 1) {
     echo "<img src='images/lightbulb_off.png' title='" . __("Disabled") . "'> ";
 }
 echo "<td>";
 echo "<a href='index.php?sec=users&sec2=godmode/usuarios/configurar_usuarios&update_user="******"'>" . ucfirst($nombre) . "</a>";
 echo "<td style='font-size:9px'>" . $realname;
 $company_name = (string) get_db_value('name', 'tcompany', 'id', $id_company);
 echo "<td>" . $company_name . "</td>";
 echo "<td style='font-size:9px'>" . human_time_comparation($fecha_registro);
 echo "<td>";
 print_user_avatar($nombre, true);
 echo "&nbsp;";
 if ($config["enteprise"] == 1) {
     $sql1 = 'SELECT * FROM tusuario_perfil WHERE id_usuario = "' . $nombre . '"';