當前位置: 首頁>>代碼示例>>PHP>>正文


PHP eZWorkflowEvent::attribute方法代碼示例

本文整理匯總了PHP中eZWorkflowEvent::attribute方法的典型用法代碼示例。如果您正苦於以下問題:PHP eZWorkflowEvent::attribute方法的具體用法?PHP eZWorkflowEvent::attribute怎麽用?PHP eZWorkflowEvent::attribute使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在eZWorkflowEvent的用法示例。


在下文中一共展示了eZWorkflowEvent::attribute方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: validateHTTPInput

 /**
  * @param eZHTTPTool $http
  * @param $base
  * @param eZWorkflowEvent $workflowEvent
  * @param $validation
  *
  * @return bool|int
  */
 function validateHTTPInput($http, $base, $workflowEvent, &$validation)
 {
     $returnState = eZInputValidator::STATE_ACCEPTED;
     $reason = array();
     if (!$http->hasSessionVariable('BrowseParameters')) {
         // No validation when deleting to avoid blocking deletion of invalid items
         if ($http->hasPostVariable('DeleteApproveUserIDArray_' . $workflowEvent->attribute('id')) || $http->hasPostVariable('DeleteApproveGroupIDArray_' . $workflowEvent->attribute('id'))) {
             return eZInputValidator::STATE_ACCEPTED;
         }
         // check approve-users
         $approversIDs = array_unique($this->attributeDecoder($workflowEvent, 'approve_users'));
         if (is_array($approversIDs) and count($approversIDs) > 0) {
             $returnState = eZApproveType::validateUserIDList($approversIDs, $reason);
         } else {
             $returnState = false;
         }
         if ($returnState != eZInputValidator::STATE_INVALID) {
             // check approve-groups
             $userGroupIDList = array_unique($this->attributeDecoder($workflowEvent, 'approve_groups'));
             if (is_array($userGroupIDList) and count($userGroupIDList) > 0) {
                 $returnState = eZApproveType::validateGroupIDList($userGroupIDList, $reason);
             } else {
                 if ($returnState === false) {
                     // if no one user or user-group was passed as approvers
                     $returnState = eZInputValidator::STATE_INVALID;
                     $reason['text'] = "There must be passed at least one valid user or user group who approves content for the event.";
                 }
             }
             // check excluded-users
             /*
             if ( $returnState != eZInputValidator::STATE_INVALID )
             {
                 // TODO:
                 // ....
             }
             */
             // check excluded-groups
             if ($returnState != eZInputValidator::STATE_INVALID) {
                 $userGroupIDList = array_unique($this->attributeDecoder($workflowEvent, 'selected_usergroups'));
                 if (is_array($userGroupIDList) and count($userGroupIDList) > 0) {
                     $returnState = eZApproveType::validateGroupIDList($userGroupIDList, $reason);
                 }
             }
         }
     } else {
         $browseParameters = $http->sessionVariable('BrowseParameters');
         if (isset($browseParameters['custom_action_data'])) {
             $customData = $browseParameters['custom_action_data'];
             if (isset($customData['event_id']) and $customData['event_id'] == $workflowEvent->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":
                                 $returnState = eZApproveType::validateUserIDList($objectIDArray, $reason);
                                 break;
                             case 'AddApproveGroups':
                             case 'AddExcludeUser':
                                 $returnState = eZApproveType::validateGroupIDList($objectIDArray, $reason);
                                 break;
                             case 'AddExcludedGroups':
                                 // TODO:
                                 // .....
                                 break;
                         }
                     }
                 }
             }
         }
     }
     if ($returnState == eZInputValidator::STATE_INVALID) {
         $validation['processed'] = true;
         $validation['events'][] = array('id' => $workflowEvent->attribute('id'), 'placement' => $workflowEvent->attribute('placement'), 'workflow_type' => &$this, 'reason' => $reason);
     }
     return $returnState;
 }
開發者ID:brookinsconsulting,項目名稱:ezecosystem,代碼行數:84,代碼來源:ezapprovetype.php


注:本文中的eZWorkflowEvent::attribute方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。