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


PHP Tinebase_DateTime::get方法代码示例

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


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

示例1: setUp

 /**
  * Sets up the fixture.
  * This method is called before a test is executed.
  *
  * @access protected
  */
 protected function setUp()
 {
     // initial object
     $this->objects['TestRecord'] = new Tinebase_Record_DummyRecord(array(), true);
     $this->objects['TestRecord']->setFromArray(array('id' => '2', 'test_2' => NULL), NULL);
     // date management
     $date = new Tinebase_DateTime();
     $this->objects['TestRecord']->date_single = clone $date;
     $this->objects['TestRecord']->date_multiple = array($date);
     // bypass filters
     $this->objects['TestRecordBypassFilters'] = new Tinebase_Record_DummyRecord(array('id' => '7', 'test_2' => 'STRING'), true);
     $this->expectFailure['TestRecord']['testSetId'][] = array('2', '3');
     $this->expectFailure['TestRecord']['testSetId'][] = array('30000000', '3000000000000000000000000000');
     $this->expectSuccess['TestRecord']['testSetId'][] = array('2', '2');
     $this->expectFailure['TestRecordBypassFilters']['testSetIdBypassFilters'][] = array('2', '3');
     $this->expectFailure['TestRecordBypassFilters']['testSetIdBypassFilters'][] = array('30000000', '3000000000000000000000000000');
     $this->expectSuccess['TestRecordBypassFilters']['testSetIdBypassFilters'][] = array('2', '2');
     $this->expectSuccess['TestRecord']['testSetFromArray'][] = array(array('test_1' => '2', 'test_2' => NULL), 'test_1');
     $this->expectFailure['TestRecord']['testSetFromArrayException'][] = array('Tinebase_Exception_Record_Validation', array('test_2' => 'string'));
     $this->expectFailure['TestRecord']['testSetTimezoneException'][] = array('Tinebase_Exception_Record_NotAllowed', 'UTC');
     $dummy = array('id' => 2, 'test_2' => '', 'date_single' => $date->get(Tinebase_Record_Abstract::ISO8601LONG), 'date_multiple' => array($date->get(Tinebase_Record_Abstract::ISO8601LONG)));
     $this->expectSuccess['TestRecord']['testToArray'][] = array($dummy);
     $this->expectSuccess['TestRecord']['__set'][] = array('test_3', 4);
     $this->expectSuccess['TestRecord']['__get'][] = array('test_3', 4);
     $this->expectSuccess['TestRecord']['test__isset'][] = array('id');
     $this->expectFailure['TestRecord']['test__isset'][] = array('string');
     $this->expectFailure['TestRecord']['test__setException'][] = array('Tinebase_Exception_UnexpectedValue', 'test_100');
     $this->expectFailure['TestRecord']['test__getException'][] = array('Tinebase_Exception_UnexpectedValue', 'test_100');
     $this->expectFailure['TestRecord']['testOffsetUnset'][] = array('Tinebase_Exception_Record_NotAllowed', 'test_2');
 }
开发者ID:bitExpert,项目名称:Tine-2.0-Open-Source-Groupware-and-CRM,代码行数:36,代码来源:RecordTest.php

示例2: __construct

 /**
  * the constructor
  *
  * @param  mixed                    $_requestBody
  * @param  ActiveSync_Model_Device  $_device
  * @param  string                   $_policyKey
  */
 public function __construct($_requestBody, ActiveSync_Model_Device $_device = null, $_policyKey = null)
 {
     if ($this->_skipValidatePolicyKey !== true && $_policyKey === null) {
         #throw new ActiveSync_Exception_PolicyKeyMissing();
     }
     if ($this->_skipValidatePolicyKey !== true && ($_policyKey === 0 || $_device->policykey != $_policyKey)) {
         #throw new ActiveSync_Exception_ProvisioningNeeded();
     }
     // should we wipe the mobile phone?
     if ($this->_skipValidatePolicyKey !== true && !empty($_policyKey) && $_device->remotewipe >= ActiveSync_Command_Provision::REMOTEWIPE_REQUESTED) {
         throw new ActiveSync_Exception_ProvisioningNeeded();
     }
     $this->_policyKey = $_policyKey;
     $this->_device = $_device;
     $this->_inputDom = $_requestBody;
     $this->_syncTimeStamp = Tinebase_DateTime::now();
     if (Tinebase_Core::isLogLevel(Zend_Log::DEBUG)) {
         Tinebase_Core::getLogger()->debug(__METHOD__ . '::' . __LINE__ . " sync timestamp: " . $this->_syncTimeStamp->get(Tinebase_Record_Abstract::ISO8601LONG));
     }
     // Creates an instance of the DOMImplementation class
     $imp = new DOMImplementation();
     // Creates a DOMDocumentType instance
     $dtd = $imp->createDocumentType('AirSync', "-//AIRSYNC//DTD AirSync//EN", "http://www.microsoft.com/");
     // Creates a DOMDocument instance
     $this->_outputDom = $imp->createDocument($this->_defaultNameSpace, $this->_documentElement, $dtd);
     $this->_outputDom->formatOutput = false;
     $this->_outputDom->encoding = 'utf-8';
 }
开发者ID:rodrigofns,项目名称:ExpressoLivre3,代码行数:35,代码来源:Wbxml.php

示例3: addUTCDateDstFix

 /**
  * adds diff to date and applies dst fix
  *
  * @param Tinebase_DateTime $_dateInUTC
  * @param DateTimeInterval $_diff
  * @param string    $_timezoneForDstFix
  */
 public static function addUTCDateDstFix($_dateInUTC, $_diff, $_timezoneForDstFix)
 {
     $_dateInUTC->setTimezone($_timezoneForDstFix);
     $_dateInUTC->add($_dateInUTC->get('I') ? 1 : 0, Tinebase_DateTime::MODIFIER_HOUR);
     $_dateInUTC->add($_diff);
     $_dateInUTC->subHour($_dateInUTC->get('I') ? 1 : 0);
     $_dateInUTC->setTimezone('UTC');
 }
开发者ID:ingoratsdorf,项目名称:Tine-2.0-Open-Source-Groupware-and-CRM,代码行数:15,代码来源:Rrule.php

示例4: _getFirstAndLastDayOfWeek

 /**
  * get string representation of first and last days of the week defined by date/week number
  * 
  * @param Tinebase_DateTime $_date
  * @param integer $_weekNumber optional
  * @return array
  */
 protected function _getFirstAndLastDayOfWeek(Tinebase_DateTime $_date, $_weekNumber = NULL)
 {
     $firstDayOfWeek = $this->_getFirstDayOfWeek();
     if ($_weekNumber !== NULL) {
         $_date->setWeek($_weekNumber);
     }
     $dayOfWeek = $_date->get('w');
     // in some locales sunday is last day of the week -> we need to init dayOfWeek with 7
     $dayOfWeek = $firstDayOfWeek == 1 && $dayOfWeek == 0 ? 7 : $dayOfWeek;
     $_date->sub($dayOfWeek - $firstDayOfWeek, Tinebase_DateTime::MODIFIER_DAY);
     $firstDay = $_date->toString($this->_dateFormat);
     $_date->add(6, Tinebase_DateTime::MODIFIER_DAY);
     $lastDay = $_date->toString($this->_dateFormat);
     $result = array($firstDay, $lastDay);
     return $result;
 }
开发者ID:ingoratsdorf,项目名称:Tine-2.0-Open-Source-Groupware-and-CRM,代码行数:23,代码来源:Date.php

示例5: getPeriodFilter

 /**
  * Adds the properly filter according e-mail application
  * @param Tinebase_DateTime $received
  */
 public static function getPeriodFilter($received)
 {
     $mailApplication = self::getMailApplicationName();
     if ($mailApplication !== 'Felamimail') {
         $class = $mailApplication . '_Model_Filter_DateTime';
         return new $class('received', 'after', $received->get(Tinebase_Record_Abstract::ISO8601LONG));
     } else {
         return new Tinebase_Model_Filter_DateTime('received', 'after', $received->get(Tinebase_Record_Abstract::ISO8601LONG));
     }
 }
开发者ID:ingoratsdorf,项目名称:Tine-2.0-Open-Source-Groupware-and-CRM,代码行数:14,代码来源:Factory.php

示例6: _checkDeadline

 /**
  * checks deadline of record
  * 
  * @param Timetracker_Model_Timesheet $_record
  * @param boolean $_throwException
  * @return void
  * @throws Timetracker_Exception_Deadline
  */
 protected function _checkDeadline(Timetracker_Model_Timesheet $_record, $_throwException = TRUE)
 {
     // get timeaccount
     $timeaccount = Timetracker_Controller_Timeaccount::getInstance()->get($_record->timeaccount_id);
     if (isset($timeaccount->deadline) && $timeaccount->deadline == Timetracker_Model_Timeaccount::DEADLINE_LASTWEEK) {
         if (Tinebase_Core::isLogLevel(Zend_Log::INFO)) {
             Tinebase_Core::getLogger()->info(__METHOD__ . '::' . __LINE__ . ' Check if deadline is exceeded for timeaccount ' . $timeaccount->title);
         }
         // it is only on monday allowed to add timesheets for last week
         $date = new Tinebase_DateTime();
         $date->setTime(0, 0, 0);
         $dayOfWeek = $date->get('w');
         if ($dayOfWeek >= 2) {
             // only allow to add ts for this week
             $date->sub($dayOfWeek, Tinebase_DateTime::MODIFIER_DAY);
         } else {
             // only allow to add ts for last week
             $date->sub($dayOfWeek + 7, Tinebase_DateTime::MODIFIER_DAY);
         }
         // convert start date to Tinebase_DateTime
         $startDate = new Tinebase_DateTime($_record->start_date);
         if ($date->compare($startDate) >= 0) {
             if (Tinebase_Core::isLogLevel(Zend_Log::INFO)) {
                 Tinebase_Core::getLogger()->info(__METHOD__ . '::' . __LINE__ . ' Deadline exceeded: ' . $startDate . ' < ' . $date);
             }
             if ($this->checkRight(Timetracker_Acl_Rights::MANAGE_TIMEACCOUNTS, FALSE) || Timetracker_Model_TimeaccountGrants::hasGrant($_record->timeaccount_id, Tinebase_Model_Grants::GRANT_ADMIN)) {
                 if (Tinebase_Core::isLogLevel(Zend_Log::INFO)) {
                     Tinebase_Core::getLogger()->info(__METHOD__ . '::' . __LINE__ . ' User with admin / manage all rights is allowed to save Timesheet even if it exceeds the deadline.');
                 }
             } else {
                 if ($_throwException) {
                     throw new Timetracker_Exception_Deadline();
                 }
             }
         } else {
             if (Tinebase_Core::isLogLevel(Zend_Log::DEBUG)) {
                 Tinebase_Core::getLogger()->debug(__METHOD__ . '::' . __LINE__ . ' Valid date: ' . $startDate . ' >= ' . $date);
             }
         }
     }
 }
开发者ID:rodrigofns,项目名称:ExpressoLivre3,代码行数:49,代码来源:Timesheet.php

示例7: test__call

 /**
  * test__call().
  */
 public function test__call()
 {
     $now = new Tinebase_DateTime();
     $now->setTimezone('Europe/Berlin');
     $this->object->date_single = clone $now;
     $this->object->setTimezone('America/Los_Angeles');
     foreach ($this->object as $record) {
         $this->assertNotEquals($record->date_single->get(Tinebase_Record_Abstract::ISO8601LONG), $now->get(Tinebase_Record_Abstract::ISO8601LONG));
     }
 }
开发者ID:rodrigofns,项目名称:ExpressoLivre3,代码行数:13,代码来源:RecordSetTest.php

示例8: updateSyncKey

 /**
  * update sync key
  * 
  * @param ActiveSync_Model_Device $_device
  * @param Tinebase_DateTime $_counter
  * @param $_timeStamp
  * @param $_class
  * @param $_collectionId
  * @deprecated
  * @return void
  */
 public function updateSyncKey(ActiveSync_Model_Device $_device, $_counter, Tinebase_DateTime $_timeStamp, $_class, $_collectionId = NULL, $_keepPreviousSyncKey = true)
 {
     $type = $_collectionId !== NULL ? $_class . '-' . $_collectionId : $_class;
     if (Tinebase_Core::isLogLevel(Zend_Log::DEBUG)) {
         Tinebase_Core::getLogger()->debug(__METHOD__ . '::' . __LINE__ . ' update synckey to ' . $_counter . ' for type: ' . $type);
     }
     $newSyncState = new ActiveSync_Model_SyncState(array('device_id' => $_device->getId(), 'counter' => $_counter, 'type' => $type, 'lastsync' => $_timeStamp->get(Tinebase_Record_Abstract::ISO8601LONG)));
     try {
         // check if we need to update synckey timestamps
         $this->_syncStateBackend->get($newSyncState);
         $this->_syncStateBackend->update($newSyncState);
     } catch (ActiveSync_Exception_SyncStateNotFound $asessnf) {
         // otherwise add new synckey
         $this->_syncStateBackend->create($newSyncState);
     }
     if ($_keepPreviousSyncKey !== true) {
         // remove all other synckeys
         $this->_syncStateBackend->deleteOther($newSyncState);
     }
     return $newSyncState;
 }
开发者ID:rodrigofns,项目名称:ExpressoLivre3,代码行数:32,代码来源:Controller.php


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