function print_operators() { global $mibew_encoding; echo "<operators>"; $operators = operator_get_all(); foreach ($operators as $operator) { if (!operator_is_online($operator)) { continue; } $name = myiconv($mibew_encoding, "utf-8", safe_htmlspecialchars(safe_htmlspecialchars($operator['vclocalename']))); $away = operator_is_away($operator) ? " away=\"1\"" : ""; echo "<operator name=\"{$name}\"{$away}/>"; } echo "</operators>"; }
/** * Return updated operators list. API function * * @param array $args Associative array of arguments. It must contains the * following keys: * - 'agentId': Id of the agent related to users window * * @return array Array of results. It contains the following keys: * - 'operators': array of online operators */ protected function apiUpdateOperators($args) { // Check access and get operators info $operator = $this->checkOperator($args['agentId']); // Return empty array if show operators option disabled if (Settings::get('showonlineoperators') != '1') { return array('operators' => array()); } // Check if curent operator is in isolation $list_options = in_isolation($operator) ? array('isolated_operator_id' => $operator['operatorid']) : array(); // Get operators list $operators = get_operators_list($list_options); // Create resulting list of operators $result_list = array(); foreach ($operators as $item) { if (!operator_is_online($item)) { continue; } $result_list[] = array('id' => (int) $item['operatorid'], 'name' => htmlspecialchars($item['vclocalename']), 'away' => (bool) operator_is_away($item)); } // Send operators list to the client side return array('operators' => $result_list); }
function print_operators() { echo "<operators>"; $operators = operator_get_all(); foreach ($operators as $operator) { if (!operator_is_online($operator)) { continue; } $name = htmlspecialchars(htmlspecialchars($operator['vclocalename'])); $away = operator_is_away($operator) ? " away=\"1\"" : ""; echo "<operator name=\"{$name}\"{$away}/>"; } echo "</operators>"; }