Example #1
0
            }
            $data[3] = '<a href="' . $config["base_url"] . '/index.php?sec=incidents&sec2=operation/incidents/incident_dashboard_detail&id=' . $incident['id_incidencia'] . '">' . $incident['titulo'] . '</a>';
            $data[4] = 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);
                    $data[4] .= "<br><span style='font-style:italic'>{$company_name}</span>";
                }
            }
            $resolution = isset($resolutions[$incident['resolution']]) ? $resolutions[$incident['resolution']] : __('None');
            $data[5] = '<strong>' . $statuses[$incident['estado']] . '</strong><br /><em>' . $resolution . '</em>';
            $data[6] = print_priority_flag_image($incident['prioridad'], true);
            $data[7] = human_time_comparation($incident["actualizacion"]);
            $data[7] .= '<br /><em>';
            $data[7] .= human_time_comparation($incident["inicio"]);
            $data[7] .= '</em>';
            $data[8] = $incident['id_usuario'];
            array_push($table->data, $data);
        }
        print_table($table);
    }
}
echo "<div class= 'dialog ui-dialog-content' title='" . __("Warning") . "' id='custom_search'></div>";
?>
<script type="text/javascript" src="include/js/jquery.ui.datepicker.js"></script>
<script type="text/javascript" src="include/languages/date_<?php 
echo $config['language_code'];
?>
.js"></script>
<script type="text/javascript" src="include/js/integria_date.js"></script>
Example #2
0
         } else {
             $data[3] = "";
         }
         $sum_leads = get_db_sql("SELECT COUNT(id) FROM tlead WHERE progress < 100 AND id_company = " . $company["id"]);
         if ($sum_leads > 0) {
             $leads_data = " ({$sum_leads}) ";
             $leads_data .= get_db_sql("SELECT SUM(estimated_sale) FROM tlead WHERE progress < 100 AND id_company = " . $company["id"]);
             $data[4] = "<a title='{$leads_data}' href='index.php?sec=customers&sec2=operation/companies/company_detail&op=leads&id=" . $company["id"] . "'><img src='images/icon_lead.png'></a>";
         } else {
             $data[4] = "";
         }
         $data[5] = $company["manager"];
         $data[6] = $company["country"];
         // get last activity date for this company record
         $last_activity = get_db_sql("SELECT MAX(date) FROM tcompany_activity WHERE id_company = " . $company["id"]);
         $data[7] = human_time_comparation($last_activity);
         if (!$company["billing"]) {
             $company["billing"] = '0.00';
         }
         $data[8] = $company["billing"];
         // . " " . $config["currency"];
         $manage_permission = check_crm_acl('company', 'cm', $config['id_user'], $company['id']);
         if ($manage_permission) {
             $data[9] = "<a href='#' onClick='javascript: show_validation_delete(\"delete_company\"," . $company['id'] . ",0," . $offset . ",\"" . $search_params . "\");'><img src='images/cross.png'></a>";
         } else {
             $data[9] = '';
         }
         array_push($table->data, $data);
     }
     print_table($table);
 }
Example #3
0
			}

			
			if ($wo["id_wo_category"]){
				$category = get_db_row ("two_category", "id", $wo["id_wo_category"]);
				$data[7] = "<img src='images/wo_category/".$category["icon"]."' title='".$category["name"]."'>";
			} else {
				$data[7] = "";
			}

			if ($wo["end_date"] != "0000-00-00 00:00:00")
				$data[8] = "<span style='font-size: 9px'>".substr($wo["end_date"],0,10). "</span>";
			else
				$data[8] = "--";

			$data[9] = "<span style='font-size: 9px'>". human_time_comparation($wo["start_date"]) . "<br>". human_time_comparation($wo["last_update"]). "</span>";
			
			$data[10] = "";
			if ($wo['assigned_user'] == $config["id_user"]){
				if ($wo["progress"] == 0){
					$data[10] .= "<a href='index.php?sec=projects&sec2=operation/workorders/wo$params&id=". $wo['id']."&set_progress=1'><img src='images/ack.png' title='".__("Set as finished")."'></a>";
				} 
			}

			if (($wo["progress"] < 2) AND ($wo["created_by_user"] == $config["id_user"]) AND ($wo["need_external_validation"] == 1) ){	
				$data[10] = "<a href='index.php?sec=projects&sec2=operation/workorders/wo$params&id="
					. $wo['id']."&set_progress=2&offset=$offset'><img src='images/rosette.png' title='".__("Validate")."'></a>";
			}

			// Evaluate different conditions to allow WO deletion
			$can_delete = dame_admin($config["id_user"]);
Example #4
0
$incidents = get_incidents($filter);
if (empty($incidents)) {
    $table->colspan[0][0] = 9;
    $table->data[0][0] = __('Nothing was found');
    $incidents = array();
}
$row = 0;
foreach ($incidents as $incident) {
    $table->data[$row][0] = '#' . $incident['id_incidencia'];
    $table->data[$row][1] = '<a href="index.php?sec=incidents&sec2=operation/incidents_simple/incident&id=' . $incident['id_incidencia'] . '">' . $incident['titulo'] . '</a>';
    $resolution = isset($resolutions[$incident['resolution']]) ? $resolutions[$incident['resolution']] : __('None');
    $table->data[$row][2] = '<strong>' . $statuses[$incident['estado']] . '</strong><br /><em>' . $resolution . '</em>';
    $table->data[$row][3] = print_priority_flag_image($incident['prioridad'], true);
    $table->data[$row][4] = human_time_comparation($incident["actualizacion"]);
    $table->data[$row][4] .= '<br /><em>';
    $table->data[$row][4] .= human_time_comparation($incident["inicio"]);
    $table->data[$row][4] .= '</em>';
    if ($config["show_owner_incident"] == 1) {
        $table->data[$row][5] = $incident['id_usuario'];
    }
    if ($incident["estado"] < 3) {
        $table->rowclass[$row] = 'red';
    } elseif ($incident["estado"] < 6) {
        $table->rowclass[$row] = 'yellow';
    } else {
        $table->rowclass[$row] = 'green';
    }
    $table->rowstyle[$row] = 'border-bottom: 1px solid rgb(204, 204, 204);';
    $row++;
}
print_table($table);
Example #5
0
                    $row["id_type"] = -1;
                }
                $data[3] = get_download_type_icon($row["id_type"]);
                if (give_acl($config["id_user"], 0, "FRW")) {
                    // Downloads
                    $data[4] = get_db_sql("SELECT COUNT(*) FROM tdownload_tracking where id_download = " . $row["id"]);
                    // Public URL
                    if ($row["public"]) {
                        $url = $config["base_url"] . "/operation/common/download_file.php?type=external_release&id_attachment=" . $row["external_id"];
                        $data[5] = "<a href='{$url}'><img src='images/world.png'></a>";
                    } else {
                        $data[5] = "";
                    }
                }
                // Timestamp
                $data[6] = human_time_comparation($row["date"]);
                if (give_acl($config["id_user"], 0, "FRW")) {
                    // Edit
                    $data[7] = "<a href='index.php?sec=download&sec2=operation/download/browse&update=" . $row["id"] . "'><img border='0' src='images/wrench.png'></a>";
                    $data[7] .= "&nbsp;&nbsp;";
                    // Delete
                    $data[7] .= "<a href='index.php?sec=download&sec2=operation/download/browse&delete_data=" . $row["id"] . "' onClick='if (!confirm(\\' " . __('Are you sure?') . "\\')) return false;'><img border='0' src='images/cross.png'></a>";
                }
                array_push($table->data, $data);
            }
            print_table($table);
        }
    }
}
//external_id hidden
echo '<div id="external_id_hidden" style="display:none;">';
Example #6
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>";
}
function print_file_types_table($return = false)
{
    $condition = get_filter_by_fr_category_accessibility();
    $types = process_sql("SELECT tdownload_type.id AS id,\n\t\t\t\t\t\t\t\ttdownload_type.name AS name,\n\t\t\t\t\t\t\t\ttdownload_type.description AS description,\n\t\t\t\t\t\t\t\ttdownload_type.icon AS icon,\n\t\t\t\t\t\t\t\tCOUNT(tdownload.id) AS num_files,\n\t\t\t\t\t\t\t\tMAX(tdownload.date) AS last_update\n\t\t\t\t\t\tFROM tdownload, tdownload_type, tdownload_type_file\n\t\t\t\t\t\tWHERE tdownload.id = tdownload_type_file.id_download\n\t\t\t\t\t\t\tAND tdownload_type.id = tdownload_type_file.id_type\n\t\t\t\t\t\t\t{$condition}\n\t\t\t\t\t\tGROUP BY name\n\t\t\t\t\t\tORDER BY last_update DESC");
    if (!$types) {
        $types = array();
    }
    $without_type = process_sql("SELECT -1 AS id,\n\t\t\t\t\t\t\t\t\t\t'' AS name,\n\t\t\t\t\t\t\t\t\t\t'' AS description,\n\t\t\t\t\t\t\t\t\t\t'default.png' AS icon,\n\t\t\t\t\t\t\t\t\t\tCOUNT(id) AS num_files,\n\t\t\t\t\t\t\t\t\t\tMAX(date) AS last_update\n\t\t\t\t\t\t\t\tFROM tdownload\n\t\t\t\t\t\t\t\tWHERE id NOT IN (SELECT id_download FROM tdownload_type_file)\n\t\t\t\t\t\t\t\t\t{$condition}\n\t\t\t\t\t\t\t\tORDER BY last_update DESC");
    if ($without_type) {
        $without_type = $without_type[0];
        $without_type["name"] = __('Without type');
        if (!$types) {
            $types[0] = $without_type;
        } elseif ($types[0]["last_update"] < $without_type["last_update"]) {
            array_unshift($types, $without_type);
        } elseif ($types[count($types) - 1]["last_update"] > $without_type["last_update"]) {
            array_push($types, $without_type);
        } else {
            $types_aux = array();
            for ($i = 0; $i < count($types); $i++) {
                $types_aux[] = $types[$i];
                if (isset($types[$i]["last_update"]) && isset($types[$i + 1]["last_update"])) {
                    if ($types[$i]["last_update"] > $without_type["last_update"] && $types[$i + 1]["last_update"] < $without_type["last_update"]) {
                        $types_aux[] = $without_type;
                    }
                }
            }
            $types = $types_aux;
            $types_aux = null;
        }
    }
    $table = new stdClass();
    $table->width = '100%';
    $table->class = 'blank';
    $table->style = array();
    $table->style[0] = "min-width:50%; width:50%; max-width:50%";
    $table->style[1] = "min-width:50%; width:50%; max-width:50%";
    $table->valign = array();
    $table->valign[0] = "top";
    $table->valign[1] = "top";
    $table->data = array();
    $column_num = 2;
    $column_count = 0;
    $column = 0;
    foreach ($types as $type) {
        $table_type = new stdClass();
        $table_type->width = '100%';
        $table_type->class = 'search-table-white';
        $table_type->style = array();
        $table_type->style[0] = "vertical-align:top; min-width:25px; width:25px; max-width:25px";
        $table_type->data = array();
        if ((int) $type["num_files"] > 0) {
            $file_releases = get_file_releases(0, $type["id"], 10, true);
            $fr_names = __('Last updated file releases') . ":";
            foreach ($file_releases as $fr) {
                $fr_names .= "\n" . $fr;
            }
        } else {
            $fr_names = "";
        }
        $table_type->data[0][0] = print_image("images/download_type/" . $type["icon"], true);
        $table_type->data[0][1] = "<a style='font-weight: bold;' href='index.php?sec=download&sec2=operation/download/browse&id_type=" . $type["id"] . "'>" . $type["name"] . "</a>";
        $table_type->data[0][1] .= " <div style='display:inline;' title='{$fr_names}'>(" . (int) $type["num_files"] . ")</div>";
        $table_type->data[0][1] .= "<br>";
        $table_type->data[0][1] .= "<div>" . $type["description"] . "</div>";
        $table_type->data[0][1] .= "<div style='color: #FF9933;'><i>" . __('Last update') . ": " . human_time_comparation($type["last_update"]) . "</i></div>";
        $table->data[0][$column] .= print_table($table_type, true);
        $column_count += 1;
        $column += 1;
        if ($column_count >= $column_num) {
            $column_count = 0;
            $column = 0;
        }
    }
    print_table($table, $return);
}
Example #8
0
function incident_details_list($id_incident, $return = false)
{
    $output = '';
    $incident = get_incident($id_incident);
    $output .= '<ul id="incident-details-list" class="sidemenu">';
    $output .= '&nbsp;&nbsp;<strong>' . __('Open at') . '</strong>: ' . human_time_comparation($incident['inicio']);
    if ($incident['estado'] == 7) {
        $output .= '<br />&nbsp;&nbsp;<strong>' . __('Closed at') . '</strong>: ' . human_time_comparation($incident['cierre']);
    }
    if ($incident['actualizacion'] != $incident['inicio']) {
        $output .= '<br />&nbsp;&nbsp;<strong>' . __('Last update') . '</strong>: ' . human_time_comparation($incident['actualizacion']);
    }
    /* Show workunits if there are some */
    $workunit_count = get_incident_count_workunits($id_incident);
    if ($workunit_count) {
        $work_hours = get_incident_workunit_hours($id_incident);
        $workunits = get_incident_workunits($id_incident);
        $workunit_data = get_workunit_data($workunits[0]['id_workunit']);
        $output .= '<br />&nbsp;&nbsp;<strong>' . __('Last work at') . '</strong>: ' . human_time_comparation($workunit_data['timestamp']);
        $output .= '<br />&nbsp;&nbsp;<strong>' . __('Workunits') . '</strong>: ' . $workunit_count;
        $output .= '<br />&nbsp;&nbsp;<strong>' . __('Time used') . '</strong>: ' . $work_hours;
        $output .= '<br />&nbsp;&nbsp;<strong>' . _('Done by') . '</strong>: <em>' . $workunit_data['id_user'] . '</em>';
    }
    $output .= '</ul>';
    if ($return) {
        return $output;
    }
    echo $output;
}
Example #9
0
			echo "<td class=f9>";
			$product_name = get_db_sql ("SELECT name FROM tkb_product WHERE id = ".$row["id_product"]);
			$product_img = get_db_sql ("SELECT icon FROM tkb_product WHERE id = ".$row["id_product"]);
			if (!$product_img) {
				echo "";
			}
			else {
				echo "<img title='$product_name' src='images/products/". $product_img . "'>";
			}
			// Language
			echo "<td class=f9>";
			echo $row["id_language"];

			// Timestamp
			echo "<td class='f9' valign='top'>";
			echo human_time_comparation($row["timestamp"]);
			
			if (give_acl($config["id_user"], 0, "KW")) {
				// Delete
				echo "<td class='f9' align='center' >";
				echo "<a href='index.php?sec=kb&sec2=operation/kb/manage_data&update=".$row['id']."'><img border=0 title='".__('Edit')."' src='images/application_edit.png'></a>";
				echo "&nbsp;&nbsp;";
				echo '<a href="index.php?sec=kb&sec2=operation/kb/browse&delete_data='.$row["id"].'" onClick="if (!confirm(\''.__('Are you sure?').'\')) return false;"><img src="images/cross.png"></a>';
			}	

		}
		echo "</table>";
	} else {
		$downloads = array();
		echo ui_print_error_message (__('No items found'), '', true, 'h3', true); 
	}
Example #10
0
		$table->width = "95%";
		$table->class = "listing";
		$table->data = array ();
		$table->size = array ();
		$table->style = array ();
		$table->style[0] = 'font-weight: bold';
		$table->head = array ();
	
		$table->head[0] = __("Description");
		$table->head[1] = __("Timestamp");
		$table->head[2] = __("User ID");
		
		foreach ($activities as $activity) {
			$data = array ();

			$timestamp = $activity["timestamp"];
			$nota = $activity["description"];
			$id_usuario_nota = $activity["id_user"];

			$data[0] = $nota;
			$data[1] = human_time_comparation ($timestamp);
			$data[2] = $id_usuario_nota;

			array_push ($table->data, $data);
		}

		print_table ($table);
	}
} 
?>
Example #11
0
			$data[4] = "<a href='index.php?sec=customers&sec2=operation/companies/company_detail&id=".$lead['id_company']."'>".get_db_value ('name', 'tcompany', 'id', $lead['id_company'])."</a>";
			if ($lead["owner"] != "")
				$data[4] .= "<br><i>" . $lead["owner"] . "</i>";

			$data[5] = translate_lead_progress ($lead['progress']) . " <i>(".$lead['progress']. "%)</i>";
			
			if ($lead['estimated_sale'] != 0)
				$data[6] = format_numeric($lead['estimated_sale']);
			else
				$data[6] = "--";
		
			$data[7] = "<img src='images/lang/".$lead["id_language"].".png'>"; 
	
			$data[8] =  ucfirst(strtolower($lead['country']));
			$data[9] = "<span style='font-size: 9px' title='". $lead['creation'] . "'>" . human_time_comparation ($lead['creation']) . "</span>";
			$data[9] .= "<br><span style='font-size: 9px'>". human_time_comparation ($lead['modification']). "</span>";

			if ($lead['progress'] < 100 && $lead['owner'] == "")
				$data[10] = "<a href='index.php?sec=customers&sec2=operation/leads/lead&tab=search&id=".
				$lead['id']."&make_owner=1&offset=$offset'><img src='images/award_star_silver_1.png' title='".__("Take ownership of this lead")."'></a>&nbsp;";
			else
				$data[10] = "";


			// Close that lead
			if ($lead['progress'] < 100 && ((($config["id_user"] == $lead["owner"] && ($section_write_permission || $section_manage_permission)) || dame_admin($config["id_user"])))) {
				$data[10] .= "<a href='index.php?sec=customers&sec2=operation/leads/lead&tab=search&id=".
				$lead['id']."&close=1&offset=$offset'><img src='images/lock.png' title='".__('Close this lead')."'></a>";
			}

			// Show delete control if its owned by the user
Example #12
0
			$owner = $l['owner'];
			$details = ui_print_truncate_text($owner, $char_truncate, false, true);

			$lead_list .= "<div class='pipeline-list-owner'>".$owner."</div>";
		}

		if (!empty($l['estimated_close_date']) && $l['estimated_close_date'] != '0000-00-00 00:00:00') {

			$estimated_close_date = date('Y-m-d', strtotime($l['estimated_close_date']));

			$lead_list .= "<div title= '".__('Estimated close date')."' class='pipeline-list-estimated_close_date'>".$estimated_close_date."</div>";
		}

		// Detect if the lead is pretty old 
		if (calendar_time_diff ($l["modification"]) > $lead_warning_time) {
			$human_time_lead = human_time_comparation ($l['modification']);

			$time_title = sprintf (__("Updated %s ago"), $human_time_lead);
		
			$lead_list .= "<img class='pipeline-warning-icon' src='images/header_warning.png' title='".$time_title."' alt='".$time_title."'>";
		}

		// Detect if the lead have specific changes in the last 7 days
		$sql = sprintf("SELECT id_lead, id_user, description, UNIX_TIMESTAMP(timestamp) AS datetime
						FROM tlead_history
						WHERE id_lead = %d
							AND UNIX_TIMESTAMP(timestamp) >= %d
						ORDER BY datetime DESC", $l['id'], time() - SECONDS_1WEEK);
		$lead_history = process_sql($sql);
		
		if ($lead_history !== false) {
Example #13
0
 $incidents_home = '';
 if ($incidents > 0) {
     $sql_2 = "SELECT * FROM tincidencia WHERE (id_creator = '" . $config["id_user"] . "' OR id_usuario = '" . $config["id_user"] . "') AND estado IN (1,2,3,4,5) ORDER BY actualizacion DESC limit 5";
     $result_2 = mysql_query($sql_2);
     if ($result_2) {
         $incidents_home .= "<table width=100% class='landing_incidents listing'>";
         $incidents_home .= "<tr><th>" . _("Status") . "</th><th>" . __("Priority") . "</th><th>" . __("Updated") . "</th><th>" . __("Ticket") . "</th><th>" . __("Last WU") . "</th></tr>";
     }
     while ($row_2 = mysql_fetch_array($result_2)) {
         $idi = $row_2["id_incidencia"];
         $incidents_home .= "<tr><td>";
         $incidents_home .= render_status($row_2["estado"]);
         $incidents_home .= "<td>";
         $incidents_home .= print_priority_flag_image($row_2['prioridad'], true);
         $incidents_home .= "<td>";
         $incidents_home .= human_time_comparation($row_2["actualizacion"]);
         $incidents_home .= "<td>";
         $incidents_home .= "<a href='index.php?sec=incidents&sec2=operation/incidents/incident_dashboard_detail&id={$idi}'>";
         $incidents_home .= $row_2["titulo"];
         $incidents_home .= "</b></a>";
         $incidents_home .= "</td>";
         $incidents_home .= "<td style='font-size: 10px'>";
         $last_wu = get_incident_lastworkunit($idi);
         $incidents_home .= $last_wu["id_user"];
         $incidents_home .= "</td></tr>";
     }
     if (isset($row_2)) {
         $incidents_home .= "</table>";
     }
 } else {
     $incidents_home .= "<div class='landing_empty'>";
	$table->head[3] = __("Priority");
	$table->head[4] = __("Updated");
	$table->data = array();

	foreach ($incidents as $inc) {
		$data = array();

		if (give_acl($config["id_user"], 0, "IR")) {
			$link_start = '<a href="index.php?sec=incidents&sec2=operation/incidents/incident_dashboard_detail&id='.$inc["id_incidencia"].'">';
			$link_end = '</a>';
		} else {
			$link_start = "";
			$link_end = "";
		}

		$data[0] = $link_start."#".$inc["id_incidencia"].$link_end;
		$data[1] = $link_start.$inc["titulo"].$link_end;
	
		$status = get_db_value("name", "tincident_status", "id", $inc["estado"]);

		$data[2] = $status;
		$data[3] = print_priority_flag_image ($inc['prioridad'], true);
		$data[4] = human_time_comparation ($inc["actualizacion"]); 
	
		array_push($table->data, $data);
	}

	print_table($table);
}
?>
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>';
}
Example #16
0
	} else {
		$completion = format_numeric (calculate_project_progress ($project['id']));
		$data[2] = progress_bar($completion, 90, 20);
	}

	// Last update time
	$sql = sprintf ('SELECT tworkunit.timestamp
		FROM ttask, tworkunit_task, tworkunit
		WHERE ttask.id_project = %d
		AND ttask.id = tworkunit_task.id_task
		AND tworkunit_task.id_workunit = tworkunit.id
		ORDER BY tworkunit.timestamp DESC LIMIT 1',
		$project['id']);
	$timestamp = get_db_sql ($sql);
	if ($timestamp != "")
		$data[3] = "<span style='font-size: 10px'>".human_time_comparation ($timestamp)."</span>";
	else
		$data[3] = __('Never');
	$offset = 0;
	$data[4] = '';
	// Disable or delete
	if ($project['id'] != -1 && $project_permission['manage']) {
		$table->head[4] = __('Delete/Unarchive');
		$data[4] = "<a href='#' onClick='javascript: show_validation_delete_general(\"delete_project\",".$project['id'].",0,".$offset.",\"".$search_params."\");'><img src='images/icons/icono_papelera.png' title='".__('Delete')."'></a>";
		
		$data[4] .= '<a href="index.php?sec=projects&sec2=operation/projects/project&view_disabled=1&activate_project=1&id='.$project['id'].'">
			<img src="images/upload.png" /></a>';
	}
	
	array_push ($table->data, $data);
}
Example #17
0
	public function getIncidentsList ($href = "", $ajax = false) {
		$system = System::getInstance();
		$ui = Ui::getInstance();

		if ($href == "") {
			$href = "index.php?page=incident";
		}

		$html = "";
		
		if (! $ajax) {
			$html .= "<ul id='listview' class='ui-itemlistview' data-role='listview'>";
		}
		if ($this->getCountIncidents() > 0) {
			$sql = $this->getIncidentsQuery();
			$new = true;
			while ( $incident = get_db_all_row_by_steps_sql($new, $result_query, $sql) ) {
				$new = false;
				// Background color
				if ($incident["estado"] < 3) {
					$background_color = "light-red-background";
				} elseif ($incident["estado"] < 7) {
					$background_color = "light-yellow-background";
				} elseif ($incident["estado"] == 7) {
					$background_color = "light-green-background";
				} else {
					$background_color = "";
				}
				$html .= "<li class=\"$background_color\">";
				$html .= "<a href='$href&id_incident=".$incident['id_incidencia']."' class='ui-link-inherit' data-ajax='false'>";
					//$html .= $ui->getPriorityFlagImage($incident['prioridad']);
					$html .= print_priority_flag_image ($incident['prioridad'], true, "../", "priority-list ui-li-icon");
					$html .= "<h3 class='ui-li-heading'>#".$incident['id_incidencia'];
					$html .= "&nbsp;&nbsp;-&nbsp;&nbsp;".$incident['titulo']."</h3>";
					$html .= "<p class='ui-li-desc'>".__('Owner').": ".$incident['id_usuario'];
					if ( include_once ($system->getConfig('homedir')."/include/functions_calendar.php") ) {
						$html .= "&nbsp;&nbsp;-&nbsp;&nbsp;".human_time_comparation($incident["actualizacion"])."&nbsp;".__('since the last update')."</p>";
					} else {
						$html .= "&nbsp;&nbsp;-&nbsp;&nbsp;".__('Last update').": ".$incident['actualizacion']."</p>";
					}
				$html .= "</a>";
				
				//~ $options = array(
					//~ 'popup_id' => 'delete_popup_'.$incident['id_incidencia'],
					//~ 'delete_href' => 'index.php?page=incidents&operation=delete&id_incident='.$incident['id_incidencia']
					//~ );
				//~ $html .= $ui->getDeletePopupHTML($options);
				//~ $html .= "<a data-icon=\"delete\" data-rel=\"popup\" href=\"#delete_popup_".$incident['id_incidencia']."\"></a>";
				$html .= "</li>";
			}
		} else {
			$html .= "<li>";
			$html .= "<h3 class='error'>".__('There is no tickets')."</h3>";
			$html .= "</li>";
		}
		if (! $ajax) {
			$html .= "</ul>";
		} else {
			ob_clean();
		}
		
		return $html;
	}
				$incident_detail .= "<td style='text-align:right;'>".give_human_time($stats[INCIDENT_METRIC_TOTAL_TIME_NO_THIRD],true,true,true)."</td>";
				$incident_detail .= "</tr>";
				//$incident_detail .= "</table>";
				
				echo print_container('incident_tracking_detail', __('General statistics'), $incident_detail, 'open', true, '20px', '', '', 1, 'less_widht');
			echo "</td>";
			echo "<td style='vertical-align:top; width: 33%;'>";
				$workunit_count = get_incident_count_workunits ($id);
				//$workunit_detail = "<table class='details_table alternate'>";
				if ($workunit_count) {
					$work_hours = get_incident_workunit_hours ($id);
					$workunits = get_incident_workunits ($id);	
					$workunit_data = get_workunit_data ($workunits[0]['id_workunit']);
					$workunit_detail = "<tr>";
					$workunit_detail .= "<td><strong>".__("Last work at")."</strong>:</td>";
					$workunit_detail .= "<td style='text-align:right;'>".human_time_comparation ($workunit_data['timestamp'])."</td>";
					$workunit_detail .= "</tr>";
					$workunit_detail .= "<tr>";
					$workunit_detail .= "<td><strong>".__("Workunits")."</strong>:</td>";
					$workunit_detail .= "<td style='text-align:right;'>".$workunit_count."</td>";
					$workunit_detail .= "</tr>";				
					$workunit_detail .= "<tr>";
					$workunit_detail .= "<td><strong>".__("Time used")."</strong>:</td>";
					$workunit_detail .= "<td style='text-align:right;'>".give_human_time($work_hours*SECONDS_1HOUR,true,true,true)."</td>";
					$workunit_detail .= "</tr>";
					$workunit_detail .= "<tr>";
					$workunit_detail .= "<td><strong>".__("Reported by")."</strong>:</td>";
					$name = get_db_value ('nombre_real', 'tusuario', 'id_usuario', $workunit_data['id_user']);
					$workunit_detail .= "<td style='text-align:right;'>".$name."</td>";
					$workunit_detail .= "</tr>";				
				} else {
Example #19
0
     $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 . '"';
     $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');
     }