gramphp Posted December 16, 2011 Share Posted December 16, 2011 Hi all, I have a tool currently in place that pulls information from one server and displays it. Currently in the setup, whenever the status of a chat has "Waiting". It's grouped with all other's as $num_waiting. The problem I am having is do to the server it pulls the information from, 1 session would equal 11 if there are 11 reps answering chats. The issue with divising by the number of active agents is on occasion the server reports more or less than the number of agents which in turn generates responses like 3.3333 and so on. And no the number with that status has never actually equaled to a single instance. As such you can see my dilemma here, I need to find a way of taking all sessions with that status and most likely cross-referencing another attribute such as $customername to prevent the doubles and finally provide only a single instance for each of these sessions. I am including the bulk of the current code below. Any help is much appreciated. <?php $num_waiting = 0; foreach($loginParams as $login){ $soapclient = new soapclient("https://secure.logmeinrescue.com/API/API.asmx?WSDL"); $loginResult = $soapclient->login($login); if($login[sEmail] == "[email protected]"){ } $hierparams = array(""=>""); $hierarchyResult = $soapclient->getHierarchy($hierparams); $hierarchy = $hierarchyResult->aHierarchy; $nodes = $hierarchy->HIERARCHY; $numberofnodes = count($nodes); $eNodeRef = "NODE"; echo "<table border =\"5\" cellspacing = \"5\">"; $totalsessioncount = 0; $numberoftechs = 0; for ($iNodes = 0; $iNodes < $numberofnodes; $iNodes += 1) { if($nodes[$iNodes]->eStatus == "Online" && $nodes[$iNodes]->eType == "Technician"){ if($nodes[$iNodes]->iParentID == 000000 || $nodes[$iNodes]->iParentID == 00000000){ print_r("<tr>"); $techname = $nodes[$iNodes]->sName; $emailaddress = findaddress($techname); echo '<td><a href="xmpp:' . $emailaddress . '?message&subject=chat">' . $techname .'</a><br /></td>'; $iNodeID = $nodes[$iNodes]->iNodeID; $sessionparams = array( 'iNodeID' => $iNodeID, 'eNodeRef' => $eNodeRef ); $sessionresult = $soapclient->getSession($sessionparams); $session = $sessionresult->aSessions; $sessionnodes = $session->SESSION; $numberofsessionnodes = count($sessionnodes); $totalsessioncount = $totalsessioncount + $numberofsessionnodes; $numberoftechs = $numberoftechs + 1; if($numberofsessionnodes >= 2) { for ($isessionNodes = 0; $isessionNodes < $numberofsessionnodes; $isessionNodes += 1) { $session_status = $sessionnodes[$isessionNodes]->sStatus; $session_customername = $sessionnodes[$isessionNodes]->sCustomField0; $isdouble = check_doubles($session_customername); if(!$isdouble && ($session_status != "Waiting")) { if(isset($session_status)){postsessioninfo($session_status, $session_customername);} }else{ $num_waiting++; } } } unset($session_customername); unset($session_starttime); print_r("</td>"); } } } print_r("</table>"); $soapclient->logout(); clear_table(); } $session_que = $num_waiting; echo "Sessions Waiting -- " . $session_que . "<br><br>"; ?> MOD EDIT: . . . BBCode tags added. Quote Link to comment https://forums.phpfreaks.com/topic/253336-creating-a-chats-waiting-monitor/ Share on other sites More sharing options...
Pikachu2000 Posted December 16, 2011 Share Posted December 16, 2011 When posting code, enclose it within the forum's . . . BBCode tags. Quote Link to comment https://forums.phpfreaks.com/topic/253336-creating-a-chats-waiting-monitor/#findComment-1298683 Share on other sites More sharing options...
gramphp Posted December 16, 2011 Author Share Posted December 16, 2011 Will do, I want to edit it now with that as well and update it some but I do not have an option to edit? Ok, thank you for that but why do I not get the option to update the orginal post with new data? I only get it on sub-posts Quote Link to comment https://forums.phpfreaks.com/topic/253336-creating-a-chats-waiting-monitor/#findComment-1298685 Share on other sites More sharing options...
Pikachu2000 Posted December 16, 2011 Share Posted December 16, 2011 The edit feature is time-limited. I've added the tags to your post. If you need to update the code, just add a new post to this thread. Quote Link to comment https://forums.phpfreaks.com/topic/253336-creating-a-chats-waiting-monitor/#findComment-1298687 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.