Horde_Mapi_Timezone::getSyncTZFromOffsets PHP Method

getSyncTZFromOffsets() public static method

Build an MAPI TZ blob given a TZ Offset hash.
public static getSyncTZFromOffsets ( array $offsets ) : string
$offsets array A TZ offset hash
return string A base64_encoded MAPI Timezone structure suitable for transmitting via wbxml.
    public static function getSyncTZFromOffsets(array $offsets)
    {
        if (!Horde_Mapi::isLittleEndian()) {
            $offsets['bias'] = Horde_Mapi::chbo($offsets['bias']);
            $offsets['stdbias'] = Horde_Mapi::chbo($offsets['stdbias']);
            $offsets['dstbias'] = Horde_Mapi::chbo($offsets['dstbias']);
        }
        $packed = pack('la64vvvvvvvvla64vvvvvvvvl', $offsets['bias'], '', 0, $offsets['stdmonth'], $offsets['stdday'], $offsets['stdweek'], $offsets['stdhour'], $offsets['stdminute'], $offsets['stdsecond'], $offsets['stdmillis'], $offsets['stdbias'], '', 0, $offsets['dstmonth'], $offsets['dstday'], $offsets['dstweek'], $offsets['dsthour'], $offsets['dstminute'], $offsets['dstsecond'], $offsets['dstmillis'], $offsets['dstbias']);
        return base64_encode($packed);
    }

Usage Example

Beispiel #1
0
 /**
  * Test generating an ActiveSync TZ structure given a TZ Offset hash
  */
 public function testGetSyncTZFromOffsets()
 {
     foreach ($this->_offsets as $tz => $offsets) {
         $blob = Horde_Mapi_Timezone::getSyncTZFromOffsets($offsets);
         $this->assertEquals($this->_packed[$tz], $blob);
     }
 }
All Usage Examples Of Horde_Mapi_Timezone::getSyncTZFromOffsets