mirror of
https://github.com/Mibew/mibew-operator-status-plugin.git
synced 2024-11-15 00:34:19 +03:00
add group support and fix #8
This commit is contained in:
parent
5284d7e5ad
commit
0375ef42d7
@ -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.
|
||||
*
|
||||
|
@ -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:
|
||||
|
Loading…
Reference in New Issue
Block a user