当前位置: 首页>>代码示例>>PHP>>正文


PHP Utility::createTimestamp方法代码示例

本文整理汇总了PHP中Utility::createTimestamp方法的典型用法代码示例。如果您正苦于以下问题:PHP Utility::createTimestamp方法的具体用法?PHP Utility::createTimestamp怎么用?PHP Utility::createTimestamp使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Utility的用法示例。


在下文中一共展示了Utility::createTimestamp方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: CreateSifLogEvents

 public static function CreateSifLogEvents($header, $category, $code, $desc)
 {
     $db = Zend_Registry::get('my_db');
     $xml = XmlHelper::buildSifLogEvent(Utility::createMessageId(), Utility::createTimestamp(), $header, $category, $code, $desc);
     $xml = str_replace('xmlns="http://www.sifinfo.org/uk/infrastructure/2.x"', '', $xml);
     $xml = str_replace('xmlns="http://www.sifinfo.org/infrastructure/2.x"', '', $xml);
     $xml = str_replace('xmlns="http://www.sifinfo.org/infrastructure/1.x"', '', $xml);
     $dataObject = new DataObject('sif_logentry');
     $query = "select\r\n\t\t\t\t  \tagent_registered.agent_id,\r\n\t\t\t\t\tagent_registered.agent_mode_id,\r\n                    agent_registered.context_id,\r\n                    agent_registered.zone_id\r\n\t\t\t\t  from \r\n\t\t\t\t  \t" . DBConvertor::convertCase('agent_registered') . " \r\n\t\t\t\t  where \r\n\t\t\t\t  \tagent_registered.context_id = " . $_SESSION["CONTEXT_ID"] . " \r\n\t\t\t\t\tand agent_registered.zone_id = " . $_SESSION["ZONE_ID"] . "\r\n\t\t\t\t\tand agent_registered.unregister_timestamp is null";
     $result = $db->fetchAll($query);
     foreach ($result as $row) {
         switch (DB_TYPE) {
             case 'mysql':
                 $agentId = intval($row->agent_id);
                 $agentModeId = intval($row->agent_mode_id);
                 $zoneId = intval($row->zone_id);
                 $contextId = intval($row->context_id);
                 break;
             case 'oci8':
                 $agentId = intval($row->AGENT_ID);
                 $agentModeId = intval($row->AGENT_MODE_ID);
                 $zoneId = intval($row->ZONE_ID);
                 $contextId = intval($row->CONTEXT_ID);
                 break;
         }
         $data = array('event_timestamp' => new Zend_Db_Expr(DBConvertor::convertCurrentTime()), 'agent_id_sender' => intval(0), 'agent_id_rec' => $agentId, 'event_data' => $xml, 'object_id' => $dataObject->objectId, 'action_id' => intval(1), 'zone_id' => $zoneId, 'context_id' => $contextId, 'agent_mode_id' => $agentModeId);
         /*
         *            $db->insert('event', $data);
         */
     }
 }
开发者ID:Koulio,项目名称:OpenZIS,代码行数:31,代码来源:SifLogEntry.php

示例2: processEvent

 private function processEvent()
 {
     $dom = $this->dom;
     $headerNode = $dom->getElementsByTagName('SIF_Header')->item(0);
     $originalMsgId = $headerNode->getElementsByTagName('SIF_MsgId')->item(0)->nodeValue;
     $originalSourceId = $headerNode->getElementsByTagName('SIF_SourceId')->item(0)->nodeValue;
     $originalTimestamp = $headerNode->getElementsByTagName('SIF_Timestamp')->item(0)->nodeValue;
     $validSourceId = Agent::checkSourceId($originalSourceId);
     if (!$validSourceId) {
         RegisterError::invalidSourceId($agent->sourceId, $originalMsgId);
     } else {
         $agent = new Agent($originalSourceId);
         if ($agent->isRegistered()) {
             $eventObjectNode = $dom->getElementsByTagName('SIF_EventObject')->item(0);
             $objectName = $eventObjectNode->getAttribute('ObjectName');
             $objectAction = $eventObjectNode->getAttribute('Action');
             $objectAction = strtolower($objectAction);
             if (!DataObject::objectExists($objectName)) {
                 ProvisionError::invalidObject($originalSourceId, $originalMsgId, $objectName);
                 exit;
             } else {
                 $allowed = $this->hasPermission($objectName, $objectAction, $agent->agentId);
                 if ($allowed) {
                     $provider = DataObject::isProvider($objectName, $agent->agentId);
                     if ($provider) {
                         $this->publishEvent($agent->agentId, $objectName, $objectAction, $_SESSION['ZONE_VERSION'], $dom->saveXml($headerNode));
                         $timestamp = Utility::createTimestamp();
                         $msgId = Utility::createMessageId();
                         $sifMessageNode = $dom->getElementsByTagName('SIF_Message')->item(0);
                         XmlHelper::buildSuccessMessage($msgId, $timestamp, $originalSourceId, $originalMsgId, 0, $originalMsg = null, $desc = null);
                     } else {
                         ProvisionError::notProviderError($originalSourceId, $originalMsgId);
                     }
                 } else {
                     switch ($objectAction) {
                         case 'add':
                             ProvisionError::invalidPermissionToPublishAdd($originalSourceId, $originalMsgId, $objectName);
                             break;
                         case 'change':
                             ProvisionError::invalidPermissionToPublishChange($originalSourceId, $originalMsgId, $objectName);
                             break;
                         case 'delete':
                             ProvisionError::invalidPermissionToPublishDelete($originalSourceId, $originalMsgId, $objectName);
                             break;
                     }
                     //switch for error message
                 }
                 //allowed
             }
             //object exist
         } else {
             RegisterError::notRegisteredError($originalSourceId, $originalMsgId);
         }
         //not registered
     }
     //valid sourceId
 }
开发者ID:Koulio,项目名称:OpenZIS,代码行数:57,代码来源:Event2.php

示例3: UnSubscribe

 public function UnSubscribe($dom)
 {
     $this->dom = $dom;
     $this->processUnSubscribe();
     $this->saveUnSubscribes();
     $timestamp = Utility::createTimestamp();
     $msgId = Utility::createMessageId();
     $sifMessageNode = $dom->getElementsByTagName('SIF_Message')->item(0);
     XmlHelper::buildSuccessMessage($msgId, $timestamp, $this->originalSourceId, $this->originalMsgId, 0, $originalMsg = null, $desc = null);
 }
开发者ID:Koulio,项目名称:OpenZIS,代码行数:10,代码来源:UnSubscribe.php

示例4: Provide

 public function Provide($dom)
 {
     $this->dom = $dom;
     $this->processProvide();
     DataObject::saveProvides($this->provideObjects, $this->agent->agentId);
     $timestamp = Utility::createTimestamp();
     $msgId = Utility::createMessageId();
     $sifMessageNode = $dom->getElementsByTagName('SIF_Message')->item(0);
     XmlHelper::buildSuccessMessage($msgId, $timestamp, $this->originalSourceId, $this->originalMsgId, 0, $originalMsg = null, $desc = null);
 }
开发者ID:Koulio,项目名称:OpenZIS,代码行数:10,代码来源:Provide.php

示例5: notRegisteredError

 public static function notRegisteredError($originalSourceId, $originalMsgId)
 {
     $categoryCode = "5";
     $sifCode = "1";
     $shortDesc = "Registration Error";
     $longDesc = "Agent Not Registerd";
     $timestamp = Utility::createTimestamp();
     $msgId = Utility::createMessageId();
     XmlHelper::buildErrorMessage($categoryCode, $sifCode, $shortDesc, $longDesc, $msgId, $timestamp, $originalSourceId, $originalMsgId);
 }
开发者ID:neilberget,项目名称:OpenZIS,代码行数:10,代码来源:RegisterError.php

示例6: updateMessageQueue

 private function updateMessageQueue($agent, $originalMsgId, $msgId)
 {
     $res = DataObject::updateEvent($agent->agentId, $originalMsgId, $msgId);
     if ($res == 1) {
         $timestamp = Utility::createTimestamp();
         $msgId_u = Utility::createMessageId();
         XmlHelper::buildSuccessMessage($msgId_u, $timestamp, $agent->sourceId, $msgId, 0, $originalMsg = null, $desc = null);
     } else {
         GeneralError::EventACKError($this->xml);
     }
 }
开发者ID:Koulio,项目名称:OpenZIS,代码行数:11,代码来源:Ack.php

示例7: processProvision

 private function processProvision()
 {
     $dom = $this->dom;
     $headerNode = $dom->getElementsByTagName('SIF_Header')->item(0);
     $this->originalMsgId = $headerNode->getElementsByTagName('SIF_MsgId')->item(0)->nodeValue;
     $this->originalSourceId = $headerNode->getElementsByTagName('SIF_SourceId')->item(0)->nodeValue;
     $this->originalTimestamp = $headerNode->getElementsByTagName('SIF_Timestamp')->item(0)->nodeValue;
     $validSourceId = Agent::checkSourceId($this->originalSourceId);
     if (!$validSourceId) {
         ProvisionError::invalidSourceId($this->originalSourceId, $this->originalMsgId);
         if (CODELEVEL != 3) {
             exit;
         } else {
             return false;
         }
     } else {
         $this->agent = new Agent($this->originalSourceId);
         if (!$this->agent->isRegistered()) {
             RegisterError::notRegisteredError($this->originalSourceId, $this->originalMsgId);
         } else {
             $provideObjectNode = $dom->getElementsByTagName('SIF_ProvideObjects')->item(0);
             $this->processProvideObjects($provideObjectNode);
             $subscribeObjectNode = $dom->getElementsByTagName('SIF_SubscribeObjects')->item(0);
             $this->processSubscribeObjects($subscribeObjectNode);
             $publishAddObjectNode = $dom->getElementsByTagName('SIF_PublishAddObjects')->item(0);
             $this->processPublishAddObjects($publishAddObjectNode);
             $publishChangeObjectNode = $dom->getElementsByTagName('SIF_PublishChangeObjects')->item(0);
             $this->processPublishChangeObjects($publishChangeObjectNode);
             $publishDeleteObjectNode = $dom->getElementsByTagName('SIF_PublishDeleteObjects')->item(0);
             $this->processPublishDeleteObjects($publishDeleteObjectNode);
             $requestObjectNode = $dom->getElementsByTagName('SIF_RequestObjects')->item(0);
             $this->processRequestObjects($requestObjectNode);
             $respondObjectNode = $dom->getElementsByTagName('SIF_RespondObjects')->item(0);
             $this->processRespondObjects($respondObjectNode);
             $this->saveProvisions();
             $timestamp = Utility::createTimestamp();
             $msgId = Utility::createMessageId();
             $sifMessageNode = $dom->getElementsByTagName('SIF_Message')->item(0);
             XmlHelper::buildSuccessMessage($msgId, $timestamp, $this->originalSourceId, $this->originalMsgId, 0, $originalMsg = null, $desc = null);
         }
     }
 }
开发者ID:Koulio,项目名称:OpenZIS,代码行数:42,代码来源:Provision.php

示例8: processUnregistration

 public function processUnregistration()
 {
     $dom = $this->xmlDom;
     $headerNode = $dom->getElementsByTagName('SIF_Header')->item(0);
     $originalMsgId = $headerNode->getElementsByTagName('SIF_MsgId')->item(0)->nodeValue;
     $originalSourceId = $headerNode->getElementsByTagName('SIF_SourceId')->item(0)->nodeValue;
     $originalTimestamp = $headerNode->getElementsByTagName('SIF_Timestamp')->item(0)->nodeValue;
     $validSourceId = Agent::checkSourceId($originalSourceId);
     if (!$validSourceId) {
         RegisterError::invalidSourceId($agent->sourceId, $originalMsgId);
     } else {
         $agent = new Agent($originalSourceId);
         if ($agent->isRegistered()) {
             if ($agent->unRegister()) {
                 XmlHelper::buildSuccessMessage(Utility::createMessageId(), Utility::createTimestamp(), $agent->sourceId, $originalMsgId, 0);
             } else {
                 RegisterError::genericError($agent->sourceId, $originalMsgId);
             }
         } else {
             RegisterError::notRegisteredError($originalSourceId, $originalMsgId);
         }
     }
 }
开发者ID:Koulio,项目名称:OpenZIS,代码行数:23,代码来源:UnRegister.php

示例9: systemError

 static function systemError($xml)
 {
     try {
         if ($xml != '' or $xml != null) {
             $dom = new DomDocument();
             try {
                 $dom->loadXML($xml);
             } catch (Exception $e) {
                 $originalMsgId = '';
                 $originalSourceId = '';
                 $longDesc = "Premature end of Data.";
                 $categoryCode = "11";
                 $sifCode = "1";
                 $shortDesc = "Generic Error";
                 $timestamp = Utility::createTimestamp();
                 $msgId = Utility::createMessageId();
                 XmlHelper::buildErrorMessage($categoryCode, $sifCode, $shortDesc, $longDesc, $msgId, $timestamp, $originalSourceId, $originalMsgId, false);
                 exit;
             }
             $headerNode = $dom->getElementsByTagName('SIF_Header');
             if ($headerNode->length != 0) {
                 $header = $headerNode->item(0);
             } else {
                 $originalMsgId = '';
                 $originalSourceId = '';
                 $longDesc = "SIF_Header failed: possible a premature end of data caused this.";
                 $categoryCode = "11";
                 $sifCode = "1";
                 $shortDesc = "Generic Error";
                 $timestamp = Utility::createTimestamp();
                 $msgId = Utility::createMessageId();
                 XmlHelper::buildErrorMessage($categoryCode, $sifCode, $shortDesc, $longDesc, $msgId, $timestamp, $originalSourceId, $originalMsgId, false);
                 exit;
             }
             $SIF_MsgIdNode = $header->getElementsByTagName('SIF_MsgId');
             if ($SIF_MsgIdNode->length != 0) {
                 $msgIdNode = $header->getElementsByTagName('SIF_MsgId')->item(0);
             } else {
                 $originalMsgId = '';
                 $originalSourceId = '';
                 $longDesc = "SIF_MsgId - has issues.";
                 $categoryCode = "11";
                 $sifCode = "1";
                 $shortDesc = "Generic Error";
                 $timestamp = Utility::createTimestamp();
                 $msgId = Utility::createMessageId();
                 XmlHelper::buildErrorMessage($categoryCode, $sifCode, $shortDesc, $longDesc, $msgId, $timestamp, $originalSourceId, $originalMsgId, false);
                 exit;
             }
             $sourceIdNode = $header->getElementsByTagName('SIF_SourceId')->item(0);
             $originalMsgId = isset($msgIdNode->nodeValue) ? $msgIdNode->nodeValue : '';
             $originalSourceId = isset($sourceIdNode->nodeValue) ? $sourceIdNode->nodeValue : '';
             $longDesc = "Event was not updated as recieved.";
         } else {
             $originalMsgId = '';
             $originalSourceId = '';
             $longDesc = "Event was not updated as recieved. XML not found.";
         }
     } catch (Exception $e) {
         $originalMsgId = '';
         $originalSourceId = '';
         $longDesc = "Event was not updated as recieved. XML not found.";
     }
     $categoryCode = "11";
     $sifCode = "1";
     $shortDesc = "Generic Error";
     $timestamp = Utility::createTimestamp();
     $msgId = Utility::createMessageId();
     XmlHelper::buildErrorMessage($categoryCode, $sifCode, $shortDesc, $longDesc, $msgId, $timestamp, $originalSourceId, $originalMsgId, false);
 }
开发者ID:Koulio,项目名称:OpenZIS,代码行数:70,代码来源:GeneralError.php

示例10: setupRequest

 private function setupRequest($objectName, $sourceId, $agent)
 {
     $db = ZitDBAdapter::getDBAdapter();
     $dom = $this->dom;
     $providerId = null;
     if ($sourceId != null) {
         $agent = new Agent($sourceId);
         $providerId = $agent->agentId;
     } else {
         $providerId = DataObject::getProviderId($objectName);
     }
     if ($providerId == 0) {
         RequestError::invalidProvider($this->originalSourceId, $this->originalMsgId);
     } else {
         $error = false;
         $sifMessageNode = $dom->getElementsByTagName('SIF_Message')->item(0);
         $eventXML = $dom->saveXML($sifMessageNode);
         $eventXML = str_replace('xmlns:sif="http://www.sifinfo.org/infrastructure/2.x" ', '', $eventXML);
         $eventXML = str_replace('xmlns="http://www.sifinfo.org/infrastructure/2.x" ', '', $eventXML);
         $eventXML = str_replace('xmlns:sif="http://www.sifinfo.org/infrastructure/1.x" ', '', $eventXML);
         $eventXML = str_replace('xmlns="http://www.sifinfo.org/infrastructure/1.x" ', '', $eventXML);
         $eventXML = str_replace('xmlns="http://www.sifinfo.org/uk/infrastructure/2.x" ', '', $eventXML);
         $eventXML = str_replace('xmlns="http://www.sifinfo.org/au/infrastructure/2.x" ', '', $eventXML);
         $eventXML = str_replace('xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" ', '', $eventXML);
         $messageId = $dom->getElementsByTagName('SIF_MsgId')->item(0)->nodeValue;
         $bufferSize = $dom->getElementsByTagName('SIF_MaxBufferSize')->item(0)->nodeValue;
         /*
         PUSH all messages to the ZONE Version:
         DO NOT Check Message Version:
         */
         $version = $_SESSION['ZONE_VERSION'];
         $query = "select\r\n                            agent_registered.sif_version,\r\n                            agent_registered.maxbuffersize,\r\n                            agent_registered.agent_mode_id,\r\n                            agent.source_id\r\n                      from " . DBConvertor::convertCase('agent_registered') . " \r\n                      inner join " . DBConvertor::convertCase('agent') . " on agent.agent_id = agent_registered.agent_id\r\n                      where agent_registered.agent_id = {$providerId} and agent_registered.unregister_timestamp is null\r\n                      and   agent_registered.zone_id = " . $_SESSION["ZONE_ID"] . "\r\n                      and   agent_registered.context_id = " . $_SESSION["CONTEXT_ID"];
         $result = $db->fetchAll($query);
         switch (DB_TYPE) {
             case 'mysql':
                 $agentModeId = $result[0]->agent_mode_id;
                 $maxbuffersize = intval($result[0]->maxbuffersize);
                 $source_id = $result[0]->source_id;
                 $sif_version = $result[0]->sif_version;
                 break;
             case 'oci8':
                 $agentModeId = $result[0]->AGENT_MODE_ID;
                 $maxbuffersize = intval($result[0]->MAXBUFFERSIZE);
                 $source_id = $result[0]->SOURCE_ID;
                 $sif_version = $result[0]->SIF_VERSION;
                 break;
         }
         $messageSize = strlen($eventXML);
         if ($messageSize > $maxbuffersize) {
             $error = true;
             $header = $this->headerNode;
             SifLogEntry::CreateSifLogEvents($header, '4', '2', 'Buffer size of agent ' . $source_id . ' is too small to recieve this request [size : ' . $maxbuffersize . ']');
         }
         /*
                     if($version != '2.*') {
                         if($version != $sif_version) {
                             $header = $this->headerNode;
         					$error = true;
                             SifLogEntry::CreateSifLogEvents($header,
                                     '4',
                                     '4',
                                     'Version in request not supported by agent '.$source_id
                             );
                         }
                     } else {
         				$version = $_SESSION['ZONE_VERSION'];
         			}
         */
         if (!$error) {
             $dataObject = new DataObject($objectName);
             #				$request = new Requests($db);
             #                $data = array(
             #                        DBConvertor::convertCase('request_msg_id')      => $messageId,
             #                        DBConvertor::convertCase('request_timestamp')   => new Zend_Db_Expr(DBConvertor::convertCurrentTime()),
             #                        DBConvertor::convertCase('agent_id_requester')  => $agent->agentId,
             #                        DBConvertor::convertCase('agent_id_responder')  => intval($providerId),
             #                        DBConvertor::convertCase('request_data')        => $eventXML,
             #                        DBConvertor::convertCase('max_buffer_size')     => $bufferSize,
             #                        DBConvertor::convertCase('version')				=> $version,
             #                        DBConvertor::convertCase('agent_mode_id')		=> intval($agentModeId),
             #                        DBConvertor::convertCase('zone_id')         	=> $_SESSION["ZONE_ID"],
             #                        DBConvertor::convertCase('context_id')			=> $_SESSION["CONTEXT_ID"]
             #                );
             #                $request->insert($data);
             $messagequeue = new MessageQueues($db);
             $data = null;
             $data = array(DBConvertor::convertCase('msg_id') => $messageId, DBConvertor::convertCase('msg_type') => 1, DBConvertor::convertCase('status_id') => 1, DBConvertor::convertCase('insert_timestamp') => new Zend_Db_Expr(DBConvertor::convertCurrentTime()), DBConvertor::convertCase('agt_id_in') => intval($agent->agentId), DBConvertor::convertCase('agt_id_out') => intval($providerId), DBConvertor::convertCase('data') => $eventXML, DBConvertor::convertCase('maxbuffersize') => intval($bufferSize), DBConvertor::convertCase('version') => $version, DBConvertor::convertCase('agt_mode_id') => intval($agentModeId), DBConvertor::convertCase('zone_id') => $_SESSION["ZONE_ID"], DBConvertor::convertCase('context_id') => $_SESSION["CONTEXT_ID"]);
             $messagequeue->insert($data);
         }
         $timestamp = Utility::createTimestamp();
         $msgId = Utility::createMessageId();
         $sifMessageNode = $dom->getElementsByTagName('SIF_Message')->item(0);
         XmlHelper::buildSuccessMessage($msgId, $timestamp, $this->originalSourceId, $this->originalMsgId, 0, $originalMsg = null, $desc = null);
     }
     //invalid provider check
 }
开发者ID:neilberget,项目名称:OpenZIS,代码行数:96,代码来源:Request.php

示例11: checkIfZitIsSleeping

 public static function checkIfZitIsSleeping($dom)
 {
     if (Zit::isAsleep()) {
         /* todo: Should create a SIF_MESSAGE_TYPE for errors */
         $_SESSION['SIF_MESSAGE_TYPE'] = 1;
         $headerNode = $dom->getElementsByTagName('SIF_Header')->item(0);
         $originalMsgId = $headerNode->getElementsByTagName('SIF_MsgId')->item(0)->nodeValue;
         $originalSourceId = $headerNode->getElementsByTagName('SIF_SourceId')->item(0)->nodeValue;
         $timestamp = Utility::createTimestamp();
         $msgId = Utility::createMessageId();
         $sifMessageNode = $dom->getElementsByTagName('SIF_Message')->item(0);
         XmlHelper::buildSuccessMessage($msgId, $timestamp, $originalSourceId, $originalMsgId, 8, $originalMsg = null, $desc = 'Receiver is sleeping');
         exit;
     }
 }
开发者ID:Koulio,项目名称:OpenZIS,代码行数:15,代码来源:SifProcessRequest_2.php

示例12: processRequestMessages

 public function processRequestMessages()
 {
     $db = ZitDBAdapter::getDBAdapter();
     $query = "select \r\n\t\t\t      \trequest_data,\r\n\t\t\t\t\tagent_registered.callback_url,\r\n\t\t\t\t\tagent_registered.frozen,\r\n\t\t\t\t\trequest_id\r\n\t\t\t\t  from\r\n\t\t\t\t  \trequest\r\n\t\t\t\t  inner join\r\n\t\t\t\t  \tagent_registered on request.agent_id_responder = agent_registered.agent_id\r\n\t\t\t\t   where\r\n\t\t\t\t  \trequest.status_id in (1,2)\r\n\t\t\t\t  and\r\n\t\t\t\t  \tagent_registered.asleep = 0\r\n\t\t\t\t  and\r\n\t\t\t\t  \trequest.agent_mode_id = 1\r\n\t\t\t\t  and\r\n\t\t\t\t  \trequest.zone_id = " . $this->zoneId . "\r\n\t\t\t\t  and\r\n\t\t\t\t\tagent_registered.zone_id = " . $this->zoneId . "\r\n\t\t\t\t  and \r\n\t\t\t\t  \trequest.context_id = " . $this->contextId . "\r\n\t\t\t\t  and \r\n\t\t\t\t\tagent_registered.context_id = " . $this->contextId;
     $result = $db->fetchAll($query);
     foreach ($result as $row) {
         if ($row->frozen != 1) {
             $timestamp = Utility::createTimestamp();
             $msgId = Utility::createMessageId();
             $xml = XmlHelper::buildSuccessMessage($msgId, $timestamp, $this->zoneName, $msgId, 0, $this->zoneVersion, $this->versionNamespace, $this->zoneName, $originalMsg = $row->request_data, $desc = null);
             $sendMessageResult = $this->sendMessage($xml, $row->callback_url, $this->zoneId, $this->contextId, $row->agent_id);
             echo 'here after';
             if (!$sendMessageResult['Error']) {
                 $data = array('status_id' => 2, 'msg_id' => $msgId);
                 $db->update('request', $data, 'request_id = ' . $row->request_id);
                 $processResponseResult = $this->processResponseMessage($sendMessageResult['Xml'], $this->zoneId, $this->contextId, $row->agent_id);
                 if (!$processResponseResult['Error']) {
                     if ($processResponseResult['ImmediateUpdate']) {
                         $data = array('status_id' => 3, 'msg_id' => $msgId);
                         $db->update('request', $data, 'request_id = ' . $row->request_id);
                     }
                     ZitLog::writeToLog($sendMessageResult['Xml'], $xml, $this->zoneId, $row->agent_id, 6);
                 }
                 //check for errors in response
             } else {
                 $data = array('status_id' => 4, 'msg_id' => $msgId);
                 $db->update('request', $data, 'request_id = ' . $row->request_id);
             }
             //errors in request
         }
         //make sure agent is not frozen
     }
     //loop through results
 }
开发者ID:neilberget,项目名称:OpenZIS,代码行数:34,代码来源:PushMessageHandler.php

示例13: processSubscribe

 private function processSubscribe()
 {
     $dom = $this->dom;
     $headerNode = $dom->getElementsByTagName('SIF_Header')->item(0);
     $originalMsgId = $headerNode->getElementsByTagName('SIF_MsgId')->item(0)->nodeValue;
     $originalSourceId = $headerNode->getElementsByTagName('SIF_SourceId')->item(0)->nodeValue;
     if ($headerNode->getElementsByTagName('SIF_Timestamp')->item(0)) {
         $originalTimestamp = $headerNode->getElementsByTagName('SIF_Timestamp')->item(0)->nodeValue;
     } else {
         $originalTimestamp = Utility::createTimestamp();
     }
     $this->originalSourceId = $originalSourceId;
     $this->originalMsgId = $originalMsgId;
     $validSourceId = Agent::checkSourceId($originalSourceId);
     if (!$validSourceId) {
         ProvisionError::invalidSourceId($originalSourceId, $originalMsgId);
         exit;
     } else {
         $agent = new Agent($originalSourceId);
         $this->agent = $agent;
         if (!$this->agent->isRegistered()) {
             RegisterError::notRegisteredError($originalSourceId, $originalMsgId);
             exit;
         } else {
             $objects = $dom->getElementsByTagName('SIF_Object');
             foreach ($objects as $object) {
                 $objectName = $object->getAttribute('ObjectName');
                 $contexts = $object->getElementsByTagName('SIF_Context');
                 if (!DataObject::objectExists($objectName)) {
                     ProvisionError::invalidObject($originalSourceId, $originalMsgId, $objectName);
                     exit;
                 } else {
                     if ($contexts->length != 0) {
                         foreach ($contexts as $context) {
                             if (Context::isValidContext($context->nodeValue)) {
                                 $contextId = Context::getContextId($context->nodeValue);
                                 if (!DataObject::allowedToSubscribe($agent->agentId, $objectName, $contextId)) {
                                     ProvisionError::invalidPermissionToSubscribe($originalSourceId, $originalMsgId, $objectName);
                                     exit;
                                 } else {
                                     $dataObject = new DataObject($objectName);
                                     $dataObject->contextId = $contextId;
                                     array_push($this->subscribeObjects, $dataObject);
                                 }
                                 //check if allowed to subscribe
                             } else {
                                 ProvisionError::contextNotSupportedError($originalSourceId, $originalMsgId);
                                 exit;
                             }
                         }
                         //loop through contexts
                     } else {
                         if (!DataObject::allowedToSubscribe($agent->agentId, $objectName)) {
                             ProvisionError::invalidPermissionToSubscribe($originalSourceId, $originalMsgId, $objectName);
                             exit;
                         } else {
                             $dataObject = new DataObject($objectName);
                             array_push($this->subscribeObjects, $dataObject);
                         }
                         //check if allowed to subscribe
                     }
                     // check if there are contexts
                 }
                 //check if object is valid
             }
             //loop through objects
         }
         //check if registered
     }
     //check sourceId
 }
开发者ID:Koulio,项目名称:OpenZIS,代码行数:71,代码来源:Subscribe.php

示例14: notProviderError

 public static function notProviderError($originalSourceId, $originalMsgId)
 {
     $categoryCode = "6";
     $sifCode = "5";
     $shortDesc = "Not Provider";
     $longDesc = "Not the provider of the object.";
     $timestamp = Utility::createTimestamp();
     $msgId = Utility::createMessageId();
     XmlHelper::buildErrorMessage($categoryCode, $sifCode, $shortDesc, $longDesc, $msgId, $timestamp, $originalSourceId, $originalMsgId);
 }
开发者ID:Koulio,项目名称:OpenZIS,代码行数:10,代码来源:ProvisionError.php

示例15: systemError

 static function systemError($xml)
 {
     try {
         if ($xml != '' or $xml != null) {
             $dom = new DomDocument();
             $dom->loadXML($xml);
             $header = $dom->getElementsByTagName('SIF_Header')->item(0);
             $msgIdNode = $header->getElementsByTagName('SIF_MsgId')->item(0);
             $sourceIdNode = $header->getElementsByTagName('SIF_SourceId')->item(0);
             $originalMsgId = isset($msgIdNode->nodeValue) ? $msgIdNode->nodeValue : '';
             $originalSourceId = isset($sourceIdNode->nodeValue) ? $sourceIdNode->nodeValue : '';
             $longDesc = "Event was not updated as recieved.";
         } else {
             $originalMsgId = '';
             $originalSourceId = '';
             $longDesc = "Event was not updated as recieved. XML not found.";
         }
     } catch (Exception $e) {
         $originalMsgId = '';
         $originalSourceId = '';
         $longDesc = "Event was not updated as recieved. XML not found.";
     }
     $categoryCode = "11";
     $sifCode = "1";
     $shortDesc = "Generic Error";
     $timestamp = Utility::createTimestamp();
     $msgId = Utility::createMessageId();
     XmlHelper::buildErrorMessage($categoryCode, $sifCode, $shortDesc, $longDesc, $msgId, $timestamp, $originalSourceId, $originalMsgId, false);
 }
开发者ID:neilberget,项目名称:OpenZIS,代码行数:29,代码来源:GeneralError.php


注:本文中的Utility::createTimestamp方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。