function show_workunit_user($id_workunit, $full = 0, $show_multiple = true)
{
    global $config;
    $sql = "SELECT * FROM tworkunit WHERE id = {$id_workunit}";
    if ($res = mysql_query($sql)) {
        $row = mysql_fetch_array($res);
    } else {
        return;
    }
    $timestamp = $row["timestamp"];
    $duration = $row["duration"];
    $id_user = $row["id_user"];
    $avatar = get_db_value("avatar", "tusuario", "id_usuario", $id_user);
    $nota = $row["description"];
    $have_cost = $row["have_cost"];
    $profile = $row["id_profile"];
    $public = $row["public"];
    $locked = $row["locked"];
    $work_home = $row["work_home"];
    $id_task = get_db_value("id_task", "tworkunit_task", "id_workunit", $row["id"]);
    if (!$id_task) {
        $id_incident = get_db_value("id_incident", "tworkunit_incident", "id_workunit", $row["id"]);
    }
    $id_project = get_db_value("id_project", "ttask", "id", $id_task);
    $id_profile = get_db_value("id_profile", "tworkunit", "id", $id_workunit);
    $task_title = get_db_value("name", "ttask", "id", $id_task);
    if (!$id_task) {
        $incident_title = get_db_value("titulo", "tincidencia", "id_incidencia", $id_incident);
    }
    $project_title = get_db_value("name", "tproject", "id", $id_project);
    // ACL Check for visibility
    if (!$public && $id_user != $config["id_user"]) {
        if ($id_task) {
            $task_access = get_project_access($config["id_user"], false, $id_task, false, true);
            if (!$task_access["manage"]) {
                return;
            }
        } elseif (!give_acl($config["id_user"], 0, "TM")) {
            return;
        }
    }
    echo "<form method='post' action='index.php?sec=projects&sec2=operation/projects/task_workunit'>";
    // Show data
    echo "<div class='notetitle'>";
    // titulo
    echo "<table class='blank' border=0 width='100%' cellspacing=0 cellpadding=0 style='margin-left: 0px;margin-top: 0px; background: transparent;'>";
    echo "<tr><td rowspan=4 width='7%'>";
    print_user_avatar($id_user, true);
    echo "<td width='60%'><b>";
    if ($id_task) {
        echo __('Task') . " </b> : ";
        echo "<a href='index.php?sec=projects&sec2=operation/projects/task_detail&id_task={$id_task}&operation=view'>{$task_title}</A>";
    } else {
        echo __('Ticket') . " </b> : ";
        echo "<a href='index.php?sec=incidents&sec2=operation/incidents/incident&id={$id_incident}'>{$incident_title}</A>";
    }
    echo "</td>";
    echo "<td width='13%'>";
    echo "<b>" . __('Duration') . "</b>";
    echo "</td>";
    echo "<td width='20%'>";
    echo " : " . format_numeric($duration);
    echo "</td>";
    echo "<td>";
    // Public WU ?
    echo "<span style='margin-bottom:0px; padding-right:10px;'>";
    if ($public == 1) {
        echo "<img src='images/group.png' title='" . __('Public Workunit') . "' />";
    } else {
        echo "<img src='images/delete.png' title='" . __('Non public Workunit') . "' />";
    }
    echo "</span>";
    echo "</td></tr>";
    echo "<tr>";
    echo "<td><b>";
    if ($id_task) {
        echo __('Project') . " </b> : ";
        echo "<a href='index.php?sec=projects&sec2=operation/projects/task&id_project={$id_project}'>{$project_title}</A>";
    } else {
        echo __('Group') . "</b> : ";
        echo dame_nombre_grupo(get_db_sql("SELECT id_grupo FROM tincidencia WHERE id_incidencia = {$id_incident}"));
    }
    echo "</td>";
    echo "<td><b>";
    if ($have_cost != 0) {
        $profile_cost = get_db_value("cost", "trole", "id", $profile);
        $cost = format_numeric($duration * $profile_cost);
        $cost = $cost . " &euro;";
    } else {
        $cost = __('N/A');
    }
    echo __('Cost');
    echo "</b>";
    echo "</td>";
    echo "<td>";
    echo " : " . $cost;
    echo "</td>";
    if ($show_multiple) {
        echo "<td>";
        echo print_checkbox_extended('op_multiple[]', $id_workunit, false, false, '', '', true);
        echo "</td>";
    }
    echo "</tr>";
    echo "<tr>";
    echo "<td><b>";
    echo __('Work from home');
    echo "</b>";
    if ($work_home == 0) {
        $wfh = __('No');
    } else {
        $wfh = __('Yes');
    }
    echo " : " . $wfh;
    echo "</td>";
    echo "<td><b>";
    echo __('Profile');
    echo "</b></td><td>";
    echo " : " . get_db_value("name", "trole", "id", $profile);
    echo "<tr>";
    echo "<td>";
    echo "<a href='index.php?sec=users&sec2=operation/users/user_edit&id={$id_user}'>";
    echo "<b>" . $id_user . "</b>";
    echo "</a>";
    echo " " . __('said on') . ' ' . $timestamp;
    echo "</td></tr>";
    echo "</table>";
    echo "</div>";
    echo "</form>";
    // Body
    //echo "<div class='notebody'>";
    echo "<div class='notebody' id='wu_{$id_workunit}'>";
    echo "<table width='100%'  class='blank'>";
    echo "<tr><td valign='top'>";
    if (strlen($nota) > 1024 and $full == 0) {
        echo topi_richtext(clean_output_breaks(substr($nota, 0, 1024)));
        echo "<br><br>";
        echo "<a href='index.php?sec=users&sec2=operation/users/user_workunit_report&id_workunit=" . $id_workunit . "&title={$task_title}'>";
        echo __('Read more...');
        echo "</a>";
    } else {
        echo topi_richtext(clean_output_breaks($nota));
    }
    echo "<td valign='top'>";
    echo "<table width='100%'  class='blank'>";
    if ($_GET["sec2"] == "operation/users/user_workunit_report") {
        $myurl = "index.php?sec=users&sec2=operation/users/user_workunit_report&id={$id_user}";
    } else {
        if ($id_project > 0) {
            $myurl = "index.php?sec=projects&sec2=operation/users/user_spare_workunit&id_project={$id_project}&id_task={$id_task}";
        } else {
            $myurl = "index.php?sec=users&sec2=operation/users/user_workunit_report&id={$id_user}";
        }
    }
    if (project_manager_check($id_project) == 1 or $id_user == $config["id_user"] or give_acl($config["id_user"], 0, "TM")) {
        echo "<tr><td align='right'>";
        echo "<br>";
        echo "<a class='delete-workunit' id='delete-{$id_workunit}' href='{$myurl}&id_workunit={$id_workunit}&operation=delete' onclick='if (!confirm(\"" . __('Are you sure?') . "\")) return false;'><img src='images/cross.png'  title='" . __('Delete workunit') . "'/></a>";
    }
    // Edit workunit
    if ((project_manager_check($id_project) == 1 or give_acl($config["id_user"], 0, "TM") or $id_user == $config["id_user"]) and ($locked == "" or give_acl($config["id_user"], 0, "UM"))) {
        echo "<tr><td align='right'>";
        echo "<br>";
        echo "<a class='edit-workunit' id='edit-{$id_workunit}' href='index.php?sec=projects&sec2=operation/users/user_spare_workunit&id_project={$id_project}&id_task={$id_task}&id_workunit={$id_workunit}&id_profile={$id_profile}'><img border=0 src='images/page_white_text.png' title='" . __('Edit workunit') . "'></a>";
        echo "</td>";
    }
    // Lock workunit
    if ((project_manager_check($id_project) == 1 or give_acl($config["id_user"], 0, "TM") or $id_user == $config["id_user"]) and $locked == "") {
        echo "<tr><td align='right'>";
        echo "<br>";
        echo "<a class='lock_workunit' id='lock-{$id_workunit}' href='{$myurl}&id_workunit={$id_workunit}&operation=lock'><img src='images/lock.png' title='" . __('Lock workunit') . "'></a>";
        echo "</td>";
    } else {
        echo "<tr><td align='right'>";
        echo "<br><img src='images/rosette.png' title='" . __('Locked by') . " {$locked}'";
        echo print_user_avatar($locked, true);
        echo "</td>";
    }
    echo "</tr></table>";
    echo "</tr></table>";
    echo "</div>";
}
    require "general/noaccess.php";
    exit;
}
$id_nota = get_parameter("id", 0);
$id_incident = get_parameter("id_inc", 0);
// ********************************************************************
// Note detail of $id_note
// ********************************************************************
$sql4 = 'SELECT * FROM tnota WHERE id_nota = ' . $id_nota;
$res4 = mysql_query($sql4);
if ($row3 = mysql_fetch_array($res4)) {
    echo "<div class='notetitle'>";
    // titulo
    $timestamp = $row3["timestamp"];
    $nota = $row3["nota"];
    $id_usuario_nota = $row3["id_usuario"];
    $avatar = get_db_value("avatar", "tusuario", "id_usuario", $id_usuario_nota);
    // Show data
    echo "<img src='images/avatars/" . $avatar . ".png' class='avatar_small'>&nbsp;";
    echo " <a href='index.php?sec=users&sec2=operation/users/user_edit&id={$id_usuario_nota}'>";
    echo $id_usuario_nota;
    echo "</a>";
    echo " " . __("said on {$timestamp}");
    echo "</div>";
    // Body
    echo "<div class='notebody'>";
    echo clean_output_breaks($nota);
    echo "</div>";
} else {
    echo __('No data available');
}
if (empty($incident['workunits'])) {
    $table->colspan[$row][0] = 2;
    $table->data[$row][0] = '<i>' . __('No workunit was done in this ticket') . '</i>';
}
foreach ($incident['workunits'] as $k => $workunit) {
    $table->colspan[$row + $k][0] = 2;
    $avatar = get_db_value("avatar", "tusuario", "id_usuario", $workunit['id_user']);
    $wu = '';
    $wu = "<div class='notetitle' style='width:" . $width . "'>";
    // titulo
    // Show data
    $wu .= "<img src='images/avatars/" . $avatar . ".png' class='avatar_small'>&nbsp;";
    $wu .= " <a href='index.php?sec=users&sec2=operation/users/user_edit&id=" . $workunit['id_user'] . "'>";
    $wu .= $workunit['id_user'];
    $wu .= "</a>";
    $wu .= ' ' . __('said on') . ' ' . $workunit['timestamp'];
    $wu .= "</div>";
    // Body
    $wu .= "<div class='notebody' style='width:" . $width . "'>";
    $wu .= clean_output_breaks($workunit['description']);
    $wu .= "</div>";
    $table->data[$row + $k][0] = $wu;
}
print_table($table);
unset($table);
// Add the description of the incident under the first workunit for usability
$description = get_db_value('descripcion', 'tincidencia', 'id_incidencia', $incident_id);
echo "<h3>" . __("Ticket details") . "</h3>";
echo "<div style='width: 98%' class='incident_details'><p>";
echo clean_output_breaks($description);
echo "</div>";
            $incident_custom_fields .= "</tr>";
        } else {
            $incident_custom_fields .= "<tr>";
            $incident_custom_fields .= "<td>";
            $incident_custom_fields .= "<table>";
            $incident_custom_fields .= "<tr>";
            $incident_custom_fields .= "<td>" . $f["label"] . ":" . "</td>";
            $incident_custom_fields .= "</tr>";
            $incident_custom_fields .= "</table>";
            $incident_custom_fields .= "</td>";
            $incident_custom_fields .= "</tr>";
            $incident_custom_fields .= "<tr>";
            $incident_custom_fields .= "<td>";
            $incident_custom_fields .= "<table>";
            $incident_custom_fields .= "<tr>";
            $incident_custom_fields .= "<td align='right'><b>" . clean_output_breaks($f["data"]) . "</b></td>";
            $incident_custom_fields .= "</tr>";
            $incident_custom_fields .= "</table>";
            $incident_custom_fields .= "</td>";
            $incident_custom_fields .= "</tr>";
        }
    }
    $incident_custom_fields .= "</table>";
    $left_side .= print_container('incident_custom_fields', __('Custom fields'), $incident_custom_fields);
}
/**** DASHBOARD RIGHT SIDE ****/
// People
$incident_users .= "<table style='width: 100%;'>";
$incident_users .= "<tr>";
$long_name_creator = get_db_value_filter("nombre_real", "tusuario", array("id_usuario" => $incident["id_creator"]));
$avatar_creator = get_db_value_filter("avatar", "tusuario", array("id_usuario" => $incident["id_creator"]));
Exemple #5
0
    echo "<th>" . __('Delete');
    foreach ($todos as $todo) {
        echo "<tr><td valign=top>";
        echo "<b>" . $todo["title"] . "</b>";
        echo "<td valign=top>";
        if ($todo['expire']) {
            echo __('Yes');
        } else {
            echo __('No');
        }
        echo "<td valign=top>";
        echo $todo["expire_timestamp"];
        echo '<td align="center" valign=top>';
        echo '<a href="index.php?sec=godmode&sec2=godmode/setup/newsboard&operation=delete&id=' . $todo["id"] . '" onClick="if (!confirm(\' ' . __('Are you sure?') . '\')) return false;"><img border=0 src="images/cross.png"></a>';
        echo "<tr><td colspan=3 style='border-bottom: 1px solid #acacac'>";
        echo clean_output_breaks($todo["content"]);
    }
    echo "</table>";
    echo '<form method="post" action="index.php?sec=godmode&sec2=godmode/setup/newsboard&operation=create">';
    echo '<div style="width: 99%; text-align: right;">';
    print_submit_button(__('Create'), 'crt', false, 'class="sub create');
    echo '</form></div>';
}
// Fin bloque else
?>
<script type="text/javascript" src="include/js/jquery.ui.slider.js"></script>
<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>
echo '</form>';

$sql = "SELECT * FROM tlead_activity WHERE id_lead = $id ORDER BY creation DESC";

$activities = get_db_all_rows_sql ($sql);
$activities = print_array_pagination ($activities, "index.php?sec=customers&sec2=operation/leads/lead_detail&id=$id&op=activity");

if ($activities !== false) {	
	if (sizeof($activities) == 0){
		echo "<h3>".__("There is no activity")."</h3>";
	} else {
		foreach ($activities as $activity) {
			echo "<div class='notetitle'>"; // titulo

			$timestamp = $activity["creation"];
			$nota = clean_output_breaks($activity["description"]);
			$id_usuario_nota = $activity["written_by"];

			$avatar = get_db_value ("avatar", "tusuario", "id_usuario", $id_usuario_nota);

			// Show data
			echo "<img src='images/avatars/".$avatar.".png' class='avatar_small'>&nbsp;";
			echo " <a href='index.php?sec=users&sec2=operation/users/user_edit&id=$id_usuario_nota'>";
			echo $id_usuario_nota;
			echo "</a>";
			echo " ".__("said on $timestamp");

			// show delete activity only on owners
			$owner = get_db_value ("owner", "tlead", "id", $id);
			if ($owner == $config["id_user"])
				echo "&nbsp;&nbsp;<a href='index.php?sec=customers&sec2=operation/leads/lead_detail&id=$id&op=activity&op2=purge&activity_id=".$activity["id"]." '><img src='images/cross.png'></a>";
Exemple #7
0
echo " " . __("Wrote on ") . $timestamp;
echo "<td>";
echo "<b>";
echo __('Category') . " </b> : ";
echo $category;
echo "<td align=right>";
if (give_acl($config["id_user"], 0, "KW")) {
    echo "<a href='index.php?sec=kb&sec2=operation/kb/manage_data&update=" . $kb_data['id'] . "'><img border=0 title='" . __('Edit') . "' src='images/application_edit.png'></a>";
}
echo "</table>";
echo "</div>";
// Body
echo "<div class='notebody'>";
echo "<table class='blank' width='100%' cellpadding=0 cellspacing=0>";
echo "<tr><td valign='top'>";
echo clean_output_breaks($data);
echo "</table>";
echo "</div>";
// Show list of attachments
$attachments = get_db_all_rows_field_filter('tattachment', 'id_kb', $id, 'description');
if ($attachments !== false && $id) {
    echo '<h3>' . __('Attachment list') . '</h3>';
    $table->width = '735';
    $table->class = 'listing';
    $table->data = array();
    $table->head = array();
    $table->head[0] = __('Filename');
    $table->head[1] = __('Description');
    foreach ($attachments as $attachment) {
        $data = array();
        $attach_id = $attachment['id_attachment'];
Exemple #8
0
function replace_return_by_breaks($string)
{
    $string = clean_output_breaks($string);
    return preg_replace('/\\n/', "<br>", $string);
}
			$incident_custom_fields .= "</tr>";	
		} else {
			$incident_custom_fields .= "<tr>";
			$incident_custom_fields .= "<td>";
				$incident_custom_fields .= "<table>";
				$incident_custom_fields .= "<tr>";
				$incident_custom_fields .= "<td><b>".$f["label"].":"."</b></td>";
				$incident_custom_fields .= "</tr>";
				$incident_custom_fields .= "</table>";
			$incident_custom_fields .= "</td>";
			$incident_custom_fields .= "</tr>";	
			$incident_custom_fields .= "<tr>";
			$incident_custom_fields .= "<td>";	
				$incident_custom_fields .= "<table>";
				$incident_custom_fields .= "<tr>";
				$incident_custom_fields .= "<td>".clean_output_breaks($f["data"])."</td>";
				$incident_custom_fields .= "</tr>";
				$incident_custom_fields .= "</table>";
			$incident_custom_fields .= "</td>";
			$incident_custom_fields .= "</tr>";	
		}

	}

	$incident_custom_fields .= "</table>";

	$left_side .= print_container_div('incident_custom_fields', __('Custom fields'), $incident_custom_fields, 'open',true, true, '' , 'no_border',4, 'less_widht');
}

/**** DASHBOARD RIGHT SIDE ****/