/** * Check if the object that contains the ezpaex attribute is an user * * @return bool if the contentobject is a user or not */ function isUser() { $ezpo = eZPersistentObject::fetchObject(eZContentObject::definition(), null, array('id' => $this->attribute('contentobject_id')), true); return eZUser::isUserObject($ezpo); }
function fetchHTTPInput( $http, $base, $event ) { $sectionsVar = $base . "_event_ezapprove_section_" . $event->attribute( "id" ); if ( $http->hasPostVariable( $sectionsVar ) ) { $sectionsArray = $http->postVariable( $sectionsVar ); if ( in_array( '-1', $sectionsArray ) ) { $sectionsArray = array( -1 ); } $sectionsString = implode( ',', $sectionsArray ); $event->setAttribute( "data_text1", $sectionsString ); } $languageVar = $base . "_event_ezapprove_languages_" . $event->attribute( "id" ); if ( $http->hasPostVariable( $languageVar ) ) { $languageArray = $http->postVariable( $languageVar ); if ( in_array( '-1', $languageArray ) ) { $languageArray = array(); } $languageMask = 0; foreach ( $languageArray as $languageID ) { $languageMask |= $languageID; } $event->setAttribute( "data_int2", $languageMask ); } $versionOptionVar = $base . "_event_ezapprove_version_option_" . $event->attribute( "id" ); if ( $http->hasPostVariable( $versionOptionVar ) ) { $versionOptionArray = $http->postVariable( $versionOptionVar ); $versionOption = 0; if ( is_array( $versionOptionArray ) ) { foreach ( $versionOptionArray as $vv ) { $versionOption = $versionOption | $vv; } } $versionOption = $versionOption & eZApproveType::VERSION_OPTION_ALL; $event->setAttribute( 'data_int3', $versionOption ); } if ( $http->hasSessionVariable( 'BrowseParameters' ) ) { $browseParameters = $http->sessionVariable( 'BrowseParameters' ); if ( isset( $browseParameters['custom_action_data'] ) ) { $customData = $browseParameters['custom_action_data']; if ( isset( $customData['event_id'] ) && $customData['event_id'] == $event->attribute( 'id' ) ) { if ( !$http->hasPostVariable( 'BrowseCancelButton' ) and $http->hasPostVariable( 'SelectedObjectIDArray' ) ) { $objectIDArray = $http->postVariable( 'SelectedObjectIDArray' ); if ( is_array( $objectIDArray ) and count( $objectIDArray ) > 0 ) { switch( $customData['browse_action'] ) { case 'AddApproveUsers': { foreach( $objectIDArray as $key => $userID ) { if ( !eZUser::isUserObject( eZContentObject::fetch( $userID ) ) ) { unset( $objectIDArray[$key] ); } } $event->setAttribute( 'data_text3', implode( ',', array_unique( array_merge( $this->attributeDecoder( $event, 'approve_users' ), $objectIDArray ) ) ) ); } break; case 'AddApproveGroups': { $event->setAttribute( 'data_text4', implode( ',', array_unique( array_merge( $this->attributeDecoder( $event, 'approve_groups' ), $objectIDArray ) ) ) ); } break; case 'AddExcludeUser': { $event->setAttribute( 'data_text2', implode( ',', array_unique( array_merge( $this->attributeDecoder( $event, 'selected_usergroups' ), $objectIDArray ) ) ) ); } break; case 'AddExcludedGroups': { // TODO: // ..... } break; } } $http->removeSessionVariable( 'BrowseParameters' ); } } } } }
function fetchHTTPInput($http, $base, $event) { $eventData = eZApprove2Event::fetch($event->attribute('id'), $event->attribute('version')); $sectionsVar = $base . "_event_ezapprove_section_" . $event->attribute("id"); if ($http->hasPostVariable($sectionsVar)) { $sectionsArray = $http->postVariable($sectionsVar); if (in_array('-1', $sectionsArray)) { $sectionsArray = array(-1); } $sectionsString = implode(',', $sectionsArray); $eventData->setAttribute("selected_sections", $sectionsString); } if ($http->hasPostVariable('ApproveType_' . $event->attribute('id'))) { $eventData->setAttribute('approve_type', $http->postVariable('ApproveType_' . $event->attribute('id'))); } if ($http->hasPostVariable('RequiredNumberApproves_' . $event->attribute('id'))) { $eventData->setAttribute('num_approve_users', $http->postVariable('RequiredNumberApproves_' . $event->attribute('id'))); } if ($http->hasPostVariable('ApproveOneAll_' . $event->attribute('id'))) { $eventData->setAttribute('require_all_approve', $http->postVariable('ApproveOneAll_' . $event->attribute('id'))); } if ($http->hasPostVariable('ApproveAllowAddApprover_' . $event->attribute('id'))) { $eventData->setAttribute('allow_add_approver', $http->postVariable('ApproveAllowAddApprover_' . $event->attribute('id'))); } if ($http->hasSessionVariable('BrowseParameters')) { $browseParameters = $http->sessionVariable('BrowseParameters'); if (isset($browseParameters['custom_action_data'])) { $customData = $browseParameters['custom_action_data']; if (isset($customData['event_id']) && $customData['event_id'] == $event->attribute('id')) { switch ($customData['browse_action']) { case 'AddApproveUsers': if ($http->hasPostVariable('SelectedObjectIDArray') and !$http->hasPostVariable('BrowseCancelButton')) { $userIDArray = $http->postVariable('SelectedObjectIDArray'); foreach ($userIDArray as $key => $userID) { if (!eZUser::isUserObject(eZContentObject::fetch($userID))) { unset($userIDArray[$key]); } } $eventData->setAttribute('approve_users', implode(',', array_unique(array_merge((array) $eventData->attribute('approve_user_list'), (array) $userIDArray)))); } break; case 'AddApproveGroups': if ($http->hasPostVariable('SelectedObjectIDArray')) { $userIDArray = $http->postVariable('SelectedObjectIDArray'); $eventData->setAttribute('approve_groups', implode(',', array_unique(array_merge((array) $eventData->attribute('approve_group_list'), (array) $userIDArray)))); } break; case 'AddExcludeUser': if ($http->hasPostVariable('SelectedObjectIDArray') and !$http->hasPostVariable('BrowseCancelButton')) { $userIDArray = $http->postVariable('SelectedObjectIDArray'); $eventData->setAttribute('selected_usergroups', implode(',', array_unique(array_merge((array) $eventData->attribute('selected_usergroup_list'), (array) $userIDArray)))); } break; } $http->removeSessionVariable('BrowseParameters'); } } } }