Beispiel #1
0
function removeSelectedGroups($http, &$groups, $base)
{
    if ($http->hasPostVariable("DeleteGroupButton")) {
        if (eZHTTPPersistence::splitSelected($base, $groups, $http, "id", $keepers, $rejects)) {
            $groups = $keepers;
            foreach ($rejects as $reject) {
                $group_id = $reject->attribute("id");
                // Remove all workflows in current group
                $list_in_group = eZWorkflowGroupLink::fetchWorkflowList(0, $group_id, $asObject = true);
                $workflow_list = eZWorkflow::fetchList();
                $list = array();
                foreach ($workflow_list as $workflow) {
                    foreach ($list_in_group as $group) {
                        $id = $workflow->attribute("id");
                        $workflow_id = $group->attribute("workflow_id");
                        if ($id === $workflow_id) {
                            $list[] = $workflow;
                        }
                    }
                }
                foreach ($list as $workFlow) {
                    eZTrigger::removeTriggerForWorkflow($workFlow->attribute('id'));
                    $workFlow->remove();
                }
                $reject->remove();
                eZWorkflowGroupLink::removeGroupMembers($group_id);
            }
        }
    }
}