mirror of
https://github.com/itflow-org/itflow
synced 2026-03-01 11:24:52 +00:00
Comments
This commit is contained in:
13
ajax.php
13
ajax.php
@@ -155,12 +155,22 @@ if(isset($_POST['client_set_notes'])){
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Collision Detection/Avoidance
|
||||||
|
* Called upon loading a ticket, and every 2 mins thereafter
|
||||||
|
* Is used in conjunction with ticket_query_views to show who is currently viewing a ticket
|
||||||
|
*/
|
||||||
if(isset($_GET['ticket_add_view'])){
|
if(isset($_GET['ticket_add_view'])){
|
||||||
$ticket_id = intval($_GET['ticket_id']);
|
$ticket_id = intval($_GET['ticket_id']);
|
||||||
|
|
||||||
$a = mysqli_query($mysqli, "INSERT INTO ticket_views SET view_ticket_id = '$ticket_id', view_user_id = '$session_user_id', view_timestamp = NOW()");
|
mysqli_query($mysqli, "INSERT INTO ticket_views SET view_ticket_id = '$ticket_id', view_user_id = '$session_user_id', view_timestamp = NOW()");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Collision Detection/Avoidance
|
||||||
|
* Returns formatted text of the agents currently viewing a ticket
|
||||||
|
* Called upon loading a ticket, and every 2 mins thereafter
|
||||||
|
*/
|
||||||
if(isset($_GET['ticket_query_views'])){
|
if(isset($_GET['ticket_query_views'])){
|
||||||
$ticket_id = intval($_GET['ticket_id']);
|
$ticket_id = intval($_GET['ticket_id']);
|
||||||
|
|
||||||
@@ -184,5 +194,4 @@ if(isset($_GET['ticket_query_views'])){
|
|||||||
$response['message'] = "";
|
$response['message'] = "";
|
||||||
}
|
}
|
||||||
echo json_encode($response);
|
echo json_encode($response);
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -668,8 +668,8 @@ if($ticket_status !== "Closed"){ ?>
|
|||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
|
|
||||||
// Collision detection
|
// Collision detection
|
||||||
// Adds a "view" record of the current ticket every 3 mins into the database
|
// Adds a "view" entry of the current ticket every 2 mins into the database
|
||||||
// Updates the currently viewing <p> element with anyone that's looked at this ticket recently
|
// Updates the currently viewing (ticket_collision_viewing) element with anyone that's looked at this ticket in the last two mins
|
||||||
function ticket_collision_detection() {
|
function ticket_collision_detection() {
|
||||||
|
|
||||||
// Get the page ticket id
|
// Get the page ticket id
|
||||||
@@ -695,7 +695,10 @@ if($ticket_status !== "Closed"){ ?>
|
|||||||
}
|
}
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
// Call on page load
|
||||||
ticket_collision_detection();
|
ticket_collision_detection();
|
||||||
|
|
||||||
|
// Run every 2 mins
|
||||||
setInterval(ticket_collision_detection, 120*1000);
|
setInterval(ticket_collision_detection, 120*1000);
|
||||||
</script>
|
</script>
|
||||||
<?php } ?>
|
<?php } ?>
|
||||||
Reference in New Issue
Block a user