Example #1
0
 public static function lock($cid, $ctype)
 {
     // try to get user
     if (!($user = Pimcore_Tool_Admin::getCurrentUser())) {
         return false;
     }
     $lock = new self();
     $lock->setCid($cid);
     $lock->setCtype($ctype);
     $lock->setDate(time());
     $lock->setUserId($user->getId());
     $lock->setSessionId(session_id());
     $lock->save();
     return $lock;
 }
Example #2
0
 public static function lock($cid, $ctype)
 {
     // try to get user
     try {
         $user = Zend_Registry::get("pimcore_admin_user");
     } catch (Exception $e) {
         return false;
     }
     $lock = new self();
     $lock->setCid($cid);
     $lock->setCtype($ctype);
     $lock->setDate(time());
     $lock->setUserId($user->getId());
     $lock->setSessionId(session_id());
     $lock->save();
     return $lock;
 }
 /**
  * Creates a broker properties instance with specified JSON message.  
  *
  * @param string $brokerPropertiesJson A JSON message representing a 
  *                                     broker properties.
  * 
  * @return none
  */
 public static function create($brokerPropertiesJson)
 {
     Validate::isString($brokerPropertiesJson, 'brokerPropertiesJson');
     $brokerProperties = new self();
     $brokerPropertiesArray = (array) json_decode($brokerPropertiesJson);
     if (array_key_exists('CorrelationId', $brokerPropertiesArray)) {
         $brokerProperties->setCorrelationId($brokerPropertiesArray['CorrelationId']);
     }
     if (array_key_exists('SessionId', $brokerPropertiesArray)) {
         $brokerProperties->setSessionId($brokerPropertiesArray['SessionId']);
     }
     if (array_key_exists('DeliveryCount', $brokerPropertiesArray)) {
         $brokerProperties->setDeliveryCount($brokerPropertiesArray['DeliveryCount']);
     }
     if (array_key_exists('LockedUntilUtc', $brokerPropertiesArray)) {
         $brokerProperties->setLockedUntilUtc(\DateTime::createFromFormat(Resources::AZURE_DATE_FORMAT, $brokerPropertiesArray['LockedUntilUtc']));
     }
     if (array_key_exists('LockToken', $brokerPropertiesArray)) {
         $brokerProperties->setLockToken($brokerPropertiesArray['LockToken']);
     }
     if (array_key_exists('MessageId', $brokerPropertiesArray)) {
         $brokerProperties->setMessageId($brokerPropertiesArray['MessageId']);
     }
     if (array_key_exists('Label', $brokerPropertiesArray)) {
         $brokerProperties->setLabel($brokerPropertiesArray['Label']);
     }
     if (array_key_exists('ReplyTo', $brokerPropertiesArray)) {
         $brokerProperties->setReplyTo($brokerPropertiesArray['ReplyTo']);
     }
     if (array_key_exists('SequenceNumber', $brokerPropertiesArray)) {
         $brokerProperties->setSequenceNumber($brokerPropertiesArray['SequenceNumber']);
     }
     if (array_key_exists('TimeToLive', $brokerPropertiesArray)) {
         $brokerProperties->setTimeToLive(doubleval($brokerPropertiesArray['TimeToLive']));
     }
     if (array_key_exists('To', $brokerPropertiesArray)) {
         $brokerProperties->setTo($brokerPropertiesArray['To']);
     }
     if (array_key_exists('ScheduledEnqueueTimeUtc', $brokerPropertiesArray)) {
         $brokerProperties->setScheduledEnqueueTimeUtc(\DateTime::createFromFormat(Resources::AZURE_DATE_FORMAT, $brokerPropertiesArray['ScheduledEnqueueTimeUtc']));
     }
     if (array_key_exists('ReplyToSessionId', $brokerPropertiesArray)) {
         $brokerProperties->setReplyToSessionId($brokerPropertiesArray['ReplyToSessionId']);
     }
     if (array_key_exists('MessageLocation', $brokerPropertiesArray)) {
         $brokerProperties->setMessageLocation($brokerPropertiesArray['MessageLocation']);
     }
     if (array_key_exists('LockLocation', $brokerPropertiesArray)) {
         $brokerProperties->setLockLocation($brokerPropertiesArray['LockLocation']);
     }
     return $brokerProperties;
 }