mirror of
https://github.com/Mibew/mibew.git
synced 2025-04-10 09:50:12 +03:00
Add "groupUpdate" event
This commit is contained in:
parent
7af300b8f5
commit
0a3207e879
@ -59,6 +59,16 @@ final class Events
|
|||||||
*/
|
*/
|
||||||
const GROUP_CREATE = 'groupCreate';
|
const GROUP_CREATE = 'groupCreate';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A group is updated.
|
||||||
|
*
|
||||||
|
* This event is triggered after a group is saved. An associative array with
|
||||||
|
* the following items is passed to the event handlers:
|
||||||
|
* - "group": array, the state of the group after update.
|
||||||
|
* - "original_group": array, the state of the group before update.
|
||||||
|
*/
|
||||||
|
const GROUP_UPDATE = 'groupUpdate';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A group is deleted.
|
* A group is deleted.
|
||||||
*
|
*
|
||||||
|
@ -374,6 +374,9 @@ function update_group($group)
|
|||||||
{
|
{
|
||||||
check_group_params($group, array('id'));
|
check_group_params($group, array('id'));
|
||||||
|
|
||||||
|
// Get the original state of the group to trigger the "update" event later.
|
||||||
|
$original_group = group_by_id($group['id']);
|
||||||
|
|
||||||
$db = Database::getInstance();
|
$db = Database::getInstance();
|
||||||
$db->query(
|
$db->query(
|
||||||
("UPDATE {opgroup} SET "
|
("UPDATE {opgroup} SET "
|
||||||
@ -404,6 +407,28 @@ function update_group($group)
|
|||||||
array($group['id'])
|
array($group['id'])
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Get the current state of the group
|
||||||
|
$current_group = array(
|
||||||
|
'groupid' => $group['id'],
|
||||||
|
'parent' => ($group['parent'] ? (int) $group['parent'] : null),
|
||||||
|
'vclocalname' => $group['name'],
|
||||||
|
'vclocaldescription' => $group['description'],
|
||||||
|
'vccommonname' => $group['commonname'],
|
||||||
|
'vccommondescription' => $group['commondescription'],
|
||||||
|
'vcemail' => $group['email'],
|
||||||
|
'vctitle' => $group['title'],
|
||||||
|
'vcchattitle' => $group['chattitle'],
|
||||||
|
'vchosturl' => $group['hosturl'],
|
||||||
|
'vclogo' => $group['logo'],
|
||||||
|
'iweight' => $group['weight'],
|
||||||
|
);
|
||||||
|
|
||||||
|
$args = array(
|
||||||
|
'group' => $current_group,
|
||||||
|
'original_group' => $original_group,
|
||||||
|
);
|
||||||
|
EventDispatcher::getInstance()->triggerEvent(Events::GROUP_UPDATE, $args);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Loading…
Reference in New Issue
Block a user