mirror of
https://github.com/Mibew/java.git
synced 2025-01-22 17:40:35 +03:00
Create delete_operator function
This commit is contained in:
parent
6954c598a3
commit
935ad85fd5
@ -259,6 +259,34 @@ function create_operator($login, $email, $password, $localename, $commonname, $a
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Delete operator
|
||||||
|
*
|
||||||
|
* This function remove operator and associations with groups for this operator
|
||||||
|
* from datatabse.
|
||||||
|
* It trigger 'operatorDelete' event and pass to event listeners associative
|
||||||
|
* array with following keys:
|
||||||
|
* - 'id': int, deleted operator ID.
|
||||||
|
*
|
||||||
|
* @param int $operator_id Operator ID
|
||||||
|
*/
|
||||||
|
function delete_operator($operator_id) {
|
||||||
|
$db = Database::getInstance();
|
||||||
|
$db->query(
|
||||||
|
"delete from {chatgroupoperator} where operatorid = ?",
|
||||||
|
array($operator_id)
|
||||||
|
);
|
||||||
|
$db->query(
|
||||||
|
"delete from {chatoperator} where operatorid = ?",
|
||||||
|
array($operator_id)
|
||||||
|
);
|
||||||
|
|
||||||
|
// Trigger 'operatorDelete' event
|
||||||
|
$dispatcher = EventDispatcher::getInstance();
|
||||||
|
$args = array('id' => $operator_id);
|
||||||
|
$dispatcher->triggerEvent('operatorDelete', $args);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set current status of the operator('available' or 'away')
|
* Set current status of the operator('available' or 'away')
|
||||||
*
|
*
|
||||||
|
@ -48,15 +48,7 @@ if (isset($_GET['act'])) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (count($errors) == 0) {
|
if (count($errors) == 0) {
|
||||||
$db = Database::getInstance();
|
delete_operator($operatorid);
|
||||||
$db->query(
|
|
||||||
"delete from {chatgroupoperator} where operatorid = ?",
|
|
||||||
array($operatorid)
|
|
||||||
);
|
|
||||||
$db->query(
|
|
||||||
"delete from {chatoperator} where operatorid = ?",
|
|
||||||
array($operatorid)
|
|
||||||
);
|
|
||||||
header("Location: $webimroot/operator/operators.php");
|
header("Location: $webimroot/operator/operators.php");
|
||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user