Example #1
0
 private function processRespondObjects($objectNode)
 {
     $objects = $objectNode->getElementsByTagName('SIF_Object');
     foreach ($objects as $object) {
         $objectName = $object->getAttribute('ObjectName');
         $contexts = $object->getElementsByTagName('SIF_Context');
         if (!DataObject::objectExists($objectName)) {
             ProvisionError::invalidObject($this->originalSourceId, $this->originalMsgId, $objectName);
             if (CODELEVEL != 3) {
                 exit;
             } else {
                 return false;
             }
         } else {
             if ($contexts->length != 0) {
                 foreach ($contexts as $context) {
                     $contextId = Context::getContextId($context->nodeValue);
                     if (!DataObject::allowedToRespond($this->agent->agentId, $objectName, $contextId)) {
                         ProvisionError::invalidPermissionToRespond($this->originalSourceId, $this->originalMsgId, $objectName);
                         if (CODELEVEL != 3) {
                             exit;
                         } else {
                             return false;
                         }
                     } else {
                         $dataObject = new DataObject($objectName);
                         $dataObject->contextId = $contextId;
                         array_push($this->respondObjects, $dataObject);
                     }
                     //check if allowed to respond
                 }
             } else {
                 if (!DataObject::allowedToRespond($this->agent->agentId, $objectName)) {
                     ProvisionError::invalidPermissionToRespond($this->originalSourceId, $this->originalMsgId, $objectName);
                     if (CODELEVEL != 3) {
                         exit;
                     } else {
                         return false;
                     }
                 } else {
                     $dataObject = new DataObject($objectName);
                     array_push($this->respondObjects, $dataObject);
                 }
                 //check if allowed to respond
             }
             //check if there are contexts
         }
         //check if object exist
     }
     //loop through objects
 }