Copyright (C) 2010 All Rights Reserved. Contributor(s): Mark J Crane */ require_once "root.php"; require_once "resources/require.php"; require_once "resources/check_auth.php"; if (if_group("agent") || if_group("admin") || if_group("superadmin")) { //access granted } else { echo "access denied"; exit; } //save the uuid to a variable from the http GET $uuid = check_str($_GET["uuid"]); //POST to PHP variables if (count($_POST)>0) { //$domain_uuid = check_str($_POST["domain_uuid"]); $resolution_code = check_str($_POST["resolution_code"]); $transaction_id = check_str($_POST["transaction_id"]); $action_item = check_str($_POST["action_item"]); $uuid = check_str($_POST["uuid"]); $notes = check_str($_POST["notes"]); //$fifo_name = check_str($_POST["fifo_name"]); //$agent_username = check_str($_POST["agent_username"]); //$agent_priority = check_str($_POST["agent_priority"]); $agent_status = check_str($_POST["agent_status"]); //$agent_last_call = check_str($_POST["agent_last_call"]); //$agent_contact_number = check_str($_POST["agent_contact_number"]); } if (count($_POST)>0 && strlen($_POST["persistformvar"]) == 0) { $msg = ''; //check for all required data if (strlen($domain_uuid) == 0) { $msg .= "Please provide: domain_uuid
\n"; } //if (strlen($domain_uuid) == 0) { $msg .= "Please provide: domain_uuid
\n"; } //if (strlen($resolution_code) == 0) { $msg .= "Please provide: Resolution Code
\n"; } //if (strlen($transaction_id) == 0) { $msg .= "Please provide: Transaction ID
\n"; } //if (strlen($action_item) == 0) { $msg .= "Please provide: Action Item
\n"; } //if (strlen($uuid) == 0) { $msg .= "Please provide: UUID
\n"; } //if (strlen($notes) == 0) { $msg .= "Please provide: Notes
\n"; } //if (strlen($fifo_name) == 0) { $msg .= "Please provide: Queue Name
\n"; } //if (strlen($agent_username) == 0) { $msg .= "Please provide: Username
\n"; } //if (strlen($agent_priority) == 0) { $msg .= "Please provide: Agent Priority
\n"; } if (strlen($agent_status) == 0) { $msg .= "Please provide: Status
\n"; } //if (strlen($agent_last_call) == 0) { $msg .= "Please provide: Last Call
\n"; } //if (strlen($agent_contact_number) == 0) { $msg .= "Please provide: Contact Number
\n"; } if (strlen($msg) > 0 && strlen($_POST["persistformvar"]) == 0) { require_once "resources/header.php"; require_once "resources/persist_form_var.php"; echo "
\n"; echo "
\n"; echo $msg."
"; echo "
\n"; persistformvar($_POST); echo "
\n"; require_once "resources/footer.php"; return; } //update the database if ($_POST["persistformvar"] != "true") { //do not insert {uuid} into the database if ($uuid == "{uuid}") { $uuid = ''; } //add to the agent call logs if (strlen($uuid) > 0) { $sql = "insert into v_fifo_agent_call_logs "; $sql .= "("; $sql .= "domain_uuid, "; $sql .= "resolution_code, "; $sql .= "transaction_id, "; $sql .= "action_item, "; $sql .= "uuid, "; $sql .= "notes, "; $sql .= "add_user, "; $sql .= "add_date "; $sql .= ")"; $sql .= "values "; $sql .= "("; $sql .= "'$domain_uuid', "; $sql .= "'$resolution_code', "; $sql .= "'$transaction_id', "; $sql .= "'$action_item', "; $sql .= "'$uuid', "; $sql .= "'$notes', "; $sql .= "'".$_SESSION["username"]."', "; $sql .= "now() "; $sql .= ")"; $db->exec(check_sql($sql)); unset($sql); } //update the status $sql = "update v_fifo_agents set "; $sql .= "domain_uuid = '$domain_uuid', "; //$sql .= "fifo_name = '$fifo_name', "; //$sql .= "agent_username = '$agent_username', "; //$sql .= "agent_priority = '$agent_priority', "; $sql .= "agent_status = '$agent_status', "; $sql .= "agent_status_epoch = ".time()." "; //$sql .= "agent_last_call = '$agent_last_call', "; //$sql .= "agent_contact_number = '$agent_contact_number' "; $sql .= " where agent_username = '".$_SESSION["username"]."' "; $db->exec(check_sql($sql)); unset($sql); //agent status log if (strlen($agent_status) > 0) { $sql = "insert into v_fifo_agent_status_logs "; $sql .= "("; $sql .= "domain_uuid, "; $sql .= "username, "; $sql .= "agent_status, "; $sql .= "uuid, "; $sql .= "add_date "; $sql .= ")"; $sql .= "values "; $sql .= "("; $sql .= "'$domain_uuid', "; $sql .= "'".$_SESSION["username"]."', "; $sql .= "'$agent_status', "; $sql .= "'$uuid', "; $sql .= "now() "; $sql .= ")"; $db->exec(check_sql($sql)); unset($sql); } require_once "resources/header.php"; echo "\n"; echo "
\n"; echo "Update Complete\n"; echo "
\n"; require_once "resources/footer.php"; return; } //if ($_POST["persistformvar"] != "true") { } //(count($_POST)>0 && strlen($_POST["persistformvar"]) == 0) //pre-populate the form if ($_POST["persistformvar"] != "true") { $login_status = false; $sql = ""; $sql .= "select * from v_fifo_agents "; $sql .= " where agent_username = '".$_SESSION["username"]."' "; $prep_statement = $db->prepare(check_sql($sql)); $prep_statement->execute(); $result = $prep_statement->fetchAll(PDO::FETCH_NAMED); foreach ($result as &$row) { $domain_uuid = $row["domain_uuid"]; //$fifo_name = $row["fifo_name"]; //$agent_username = $row["agent_username"]; //$agent_priority = $row["agent_priority"]; $agent_status = $row["agent_status"]; $agent_last_call = $row["agent_last_call"]; $agent_last_uuid = $row["agent_last_uuid"]; //$agent_contact_number = $row["agent_contact_number"]; $login_status = true; break; //limit to 1 row } unset ($prep_statement); } //format the last call time if ($agent_last_call == 0) { $agent_last_call_desc = ''; } else { $agent_last_call_desc = date("g:i:s a j M Y",$agent_last_call); } //show the content require_once "resources/header.php"; //if the agent_status is available and the uuid has been supplied then refrsh the page //until the status changes or until a time out has been reached if ($agent_status == '2' && strlen($uuid) > 0 && $uuid != "{uuid}") { if (count($_GET["refresh"]) < 10) { if (substr($_SERVER["SERVER_PROTOCOL"], 0,5) == "HTTP/") { $meta_refresh_url = "http://".$_SERVER["HTTP_HOST"].$_SERVER["REQUEST_URI"]."&refresh[]=".count($_SERVER["refresh"]); } else { $meta_refresh_url = "https://".$_SERVER["HTTP_HOST"].$_SERVER["REQUEST_URI"]."&refresh[]=".count($_SERVER["refresh"]); } echo "\n"; } } echo "
"; echo "\n"; echo "\n"; echo " "; echo " "; echo "
\n"; //echo "
"; echo "
\n"; echo "
\n"; echo "\n"; echo "\n"; echo "\n"; echo "\n"; echo "\n"; echo "\n"; echo "\n"; echo "\n"; echo "\n"; echo "\n"; echo "\n"; echo "\n"; //echo "\n"; //echo "\n"; //echo "\n"; //echo "\n"; if ($login_status) { echo "\n"; echo "\n"; echo "\n"; echo "\n"; echo "\n"; echo "\n"; echo "\n"; echo "\n"; } /* echo "\n"; echo "\n"; echo "\n"; echo "\n"; */ if ($login_status && $agent_status == '9') { echo "\n"; echo "\n"; echo "\n"; echo "\n"; echo "\n"; echo "\n"; echo "\n"; echo "\n"; echo "\n"; echo "\n"; echo "\n"; echo "\n"; echo "\n"; echo "\n"; echo "\n"; echo "\n"; } if ($login_status) { echo " \n"; echo " \n"; echo " "; } echo "
Agent\n"; if (!$login_status) { echo " \n"; } if ($login_status) { echo " \n"; } //echo " \n"; echo "
\n"; echo "Enables the agent to set their status.

\n"; echo "
\n"; echo " Username:\n"; echo "\n"; echo " ".$_SESSION["username"].""; echo "
\n"; echo "\n"; echo "
\n"; //echo " Last Call:\n"; //echo "\n"; //echo $agent_last_call_desc; //echo " \n"; //echo "
\n"; //echo "\n"; //echo "
\n"; echo " Status:\n"; echo "\n"; //generate the agent status select list $sql = "SELECT var_name, var_value FROM v_vars "; $sql .= "where domain_uuid = '$domain_uuid' "; $sql .= "and var_cat = 'Queues Agent Status' "; $sql .= "and var_name not like 'system%' "; $prep_statement = $db->prepare(check_sql($sql)); $prep_statement->execute(); echo ""; $_SESSION["array_agent_status"] = ""; if (!is_array($_SESSION["array_agent_status"])) { foreach($result as $field) { $_SESSION["array_agent_status"][$field[var_value]] = $field[var_name]; } } /* foreach($result as $field) { $_SESSION["array_agent_status"][$field[var_value]] = $field[var_name]; } $x=1; foreach($_SESSION["array_agent_status"] as $value) { echo "$x $value
\n"; $x++; } */ unset($sql, $result); echo "
\n"; echo "Enter the status of the Agent.\n"; echo "
\n"; echo "  \n"; echo "\n"; echo "
\n"; echo "
\n"; echo " Contact Number:\n"; echo "\n"; echo $agent_contact_number; //echo " \n"; echo "
\n"; //echo "Enter the agent contact number.\n"; echo "
\n"; echo " Resolution Code:\n"; echo "\n"; echo " \n"; echo "
\n"; echo "Enter the resolution code.\n"; echo "
\n"; echo " Transaction ID:\n"; echo "\n"; echo " \n"; echo "
\n"; echo "Enter the Transaction ID.\n"; echo "
\n"; echo " Action Item:\n"; echo "\n"; echo " \n"; echo "
\n"; echo "Enter the Action Item.\n"; echo "
\n"; echo " Notes:\n"; echo "\n"; echo " \n"; echo "
\n"; echo "Enter the notes.\n"; echo "
\n"; if (strlen($uuid) == 0) { $uuid = $agent_last_uuid; } echo " \n"; echo " \n"; echo "
"; echo ""; echo "
"; echo "
"; require_once "resources/footer.php"; ?>