function customWorkflowEventHTTPAction( $http, $action, $workflowEvent ) { $eventID = $workflowEvent->attribute( "id" ); $module =& $GLOBALS['eZRequestedModule']; //$siteIni = eZINI::instance(); switch ( $action ) { case 'AddApproveUsers' : { $userClassNames = eZUser::fetchUserClassNames(); if ( count( $userClassNames ) > 0 ) { eZContentBrowse::browse( array( 'action_name' => 'SelectMultipleUsers', 'from_page' => '/workflow/edit/' . $workflowEvent->attribute( 'workflow_id' ), 'custom_action_data' => array( 'event_id' => $eventID, 'browse_action' => $action ), 'class_array' => $userClassNames ), $module ); } } break; case 'RemoveApproveUsers' : { if ( $http->hasPostVariable( 'DeleteApproveUserIDArray_' . $eventID ) ) { $workflowEvent->setAttribute( 'data_text3', implode( ',', array_diff( $this->attributeDecoder( $workflowEvent, 'approve_users' ), $http->postVariable( 'DeleteApproveUserIDArray_' . $eventID ) ) ) ); } } break; case 'AddApproveGroups' : case 'AddExcludeUser' : { $groupClassNames = eZUser::fetchUserGroupClassNames(); if ( count( $groupClassNames ) > 0 ) { eZContentBrowse::browse( array( 'action_name' => 'SelectMultipleUsers', 'from_page' => '/workflow/edit/' . $workflowEvent->attribute( 'workflow_id' ), 'custom_action_data' => array( 'event_id' => $eventID, 'browse_action' => $action ), 'class_array' => $groupClassNames ), $module ); } } break; case 'RemoveApproveGroups' : { if ( $http->hasPostVariable( 'DeleteApproveGroupIDArray_' . $eventID ) ) { $workflowEvent->setAttribute( 'data_text4', implode( ',', array_diff( $this->attributeDecoder( $workflowEvent, 'approve_groups' ), $http->postVariable( 'DeleteApproveGroupIDArray_' . $eventID ) ) ) ); } } break; case 'RemoveExcludeUser' : { if ( $http->hasPostVariable( 'DeleteExcludeUserIDArray_' . $eventID ) ) { $workflowEvent->setAttribute( 'data_text2', implode( ',', array_diff( $this->attributeDecoder( $workflowEvent, 'selected_usergroups' ), $http->postVariable( 'DeleteExcludeUserIDArray_' . $eventID ) ) ) ); } } break; case 'AddExcludedGroups' : { // TODO: // ..... } break; case 'RemoveExcludedGroups' : { // TODO: // ..... } break; } }
function validateGroupIDList($userGroupIDList, &$reason) { $returnState = eZInputValidator::STATE_ACCEPTED; $groupClassNames = eZUser::fetchUserGroupClassNames(); if (count($groupClassNames) > 0) { foreach ($userGroupIDList as $userGroupID) { if (!is_numeric($userGroupID) or !is_object($userGroup = eZContentObject::fetch($userGroupID)) or !in_array($userGroup->attribute('class_identifier'), $groupClassNames)) { $returnState = eZInputValidator::STATE_INVALID; $reason['list'][] = $userGroupID; } } $reason['text'] = "Some of passed user-group IDs are not valid, must be IDs of existing user groups only."; } else { $returnState = eZInputValidator::STATE_INVALID; $reason['text'] = "There is no one user-group classes among the user accounts, please choose standalone users."; } return $returnState; }