diff --git a/Controller/OperatorStatusController.php b/Controller/OperatorStatusController.php index 005a16d..03f9311 100644 --- a/Controller/OperatorStatusController.php +++ b/Controller/OperatorStatusController.php @@ -59,7 +59,7 @@ class OperatorStatusController extends AbstractController } /** - * Returns true or false of whether an operator is online or not. + * Returns true or false of whether any operators is online or not. * * @param Request $request * @return Response Rendered page content @@ -72,6 +72,25 @@ class OperatorStatusController extends AbstractController return $this->prepareResponse($is_online, $callback); } + /** + * Returns true or false of whether any operators in specificed group is online or not. + * + * @param Request $request + * @return Response Rendered page content + */ + public function isOperatorGroupOnlineAction(Request $request) + { + $is_online = false; + + $group_id = $request->attributes->get('group_id'); + if (Settings::get('enablegroups') == '1') { + $is_online = has_online_operators($group_id); + } + + $callback = $request->query->get('callback'); + return $this->prepareResponse($is_online, $callback); + } + /** * Returns prepared response: JSONP or plain text. * diff --git a/routing.yml b/routing.yml index e1c2f72..f7a9b7f 100644 --- a/routing.yml +++ b/routing.yml @@ -3,6 +3,11 @@ mibew_operator_status_has_online_operators: defaults: _controller: Mibew\Mibew\Plugin\OperatorStatus\Controller\OperatorStatusController::hasOnlineOperatorsAction +mibew_operator_status_has_online_group_operators: + path: /opstatus/group/{group_id} + defaults: + _controller: Mibew\Mibew\Plugin\OperatorStatus\Controller\OperatorStatusController::isOperatorGroupOnlineAction + mibew_operator_status_is_operator_online: path: /opstatus/{opcode} defaults: