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


PHP Tinebase_DateTime::now方法代码示例

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


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

示例1: __construct

 /**
  * the constructor
  *
  */
 private function __construct()
 {
     // set start date to start date of june 1st before last year
     $date = Tinebase_DateTime::now();
     $this->_startDate = $date->setDate($date->format('Y') - 2, 6, 1);
     $this->_loadCostCentersAndDivisions();
 }
开发者ID:ingoratsdorf,项目名称:Tine-2.0-Open-Source-Groupware-and-CRM,代码行数:11,代码来源:DemoData.php

示例2: testNextScheduledImport

 /**
  * testNextScheduledImport
  */
 public function testNextScheduledImport()
 {
     $cc = Calendar_Controller_Event::getInstance();
     $filter = new Calendar_Model_EventFilter(array(array('field' => 'container_id', 'operator' => 'equals', 'value' => $this->_testCalendar->getId())));
     $all = $cc->search($filter);
     $this->assertEquals(0, $all->count());
     $now = Tinebase_DateTime::now()->subHour(1);
     $record = $this->createScheduledImport();
     // assert setting timestamp to start value
     $this->assertEquals($now->format('YMDHi'), $record->timestamp->format('YMDHi'));
     $record = $this->_uit->runNextScheduledImport();
     // assert updating timestamp after successful run
     $now->addHour(1);
     $this->assertEquals($now->format('YMDHi'), $record->timestamp->format('YMDHi'));
     $all = $cc->search($filter);
     $seq = $all->getFirstRecord()->seq;
     // assert all events have been imported
     $this->assertEquals(7, $all->count());
     // this must not be run, the interval is not exceed
     $ret = $this->_uit->runNextScheduledImport();
     $all = $cc->search($filter);
     $this->assertEquals($seq, $all->getFirstRecord()->seq);
     // setting manual timestamp to force run again
     $record->timestamp = $record->timestamp->subHour(1)->subSecond(1);
     $this->_uit->update($record);
     $ret = $this->_uit->runNextScheduledImport();
     $all = $cc->search($filter);
     $this->assertEquals(7, $all->count());
 }
开发者ID:bitExpert,项目名称:Tine-2.0-Open-Source-Groupware-and-CRM,代码行数:32,代码来源:ScheduledImportTest.php

示例3: _onAfterExportRecords

 protected function _onAfterExportRecords($result)
 {
     $user = Tinebase_Core::getUser();
     $this->_docTemplate->setValue('date', Tinebase_DateTime::now()->format('Y-m-d'));
     $this->_docTemplate->setValue('account_n_given', $user->accountFirstName);
     $this->_docTemplate->setValue('account_n_family', $user->accountLastName);
 }
开发者ID:bitExpert,项目名称:Tine-2.0-Open-Source-Groupware-and-CRM,代码行数:7,代码来源:Doc.php

示例4: testWholeCall

 /**
  * test a whole call cycle - start, connect, disconnect
  * 
  */
 public function testWholeCall()
 {
     // start call
     $call = $this->_backend->callStarted($this->_objects['call']);
     $this->assertEquals($this->_objects['call']->destination, $call->destination);
     $this->assertTrue(Tinebase_DateTime::now()->sub($call->start)->getTimestamp() >= 0);
     // sleep for 2 secs (ringing...)
     sleep(2);
     // connect call
     $call = $this->_backend->getCall($this->_objects['call']->getId());
     $ringing = $call->ringing;
     $connectedCall = $this->_backend->callConnected($call);
     $this->assertEquals($this->_objects['call']->destination, $connectedCall->destination);
     $this->assertEquals(-1, $call->start->compare($call->connected));
     // sleep for 5 secs (talking...)
     sleep(5);
     // disconnect call
     $call = $this->_backend->getCall($this->_objects['call']->getId());
     $duration = $call->duration;
     $disconnectedCall = $this->_backend->callDisconnected($call);
     $this->assertGreaterThan($duration, $disconnectedCall->duration);
     $this->assertLessThan(10, $disconnectedCall->ringing, 'wrong ringing duration');
     $this->assertLessThan(15, $disconnectedCall->duration, 'wrong duration');
     $this->assertEquals(-1, $disconnectedCall->connected->compare($disconnectedCall->disconnected));
 }
开发者ID:ingoratsdorf,项目名称:Tine-2.0-Open-Source-Groupware-and-CRM,代码行数:29,代码来源:ControllerTest.php

示例5: testCreateTempFileWithBigSize

 /**
  * @see 0011156: big files can't be uploaded
  */
 public function testCreateTempFileWithBigSize()
 {
     $size = (double) (3.8 * 1024.0 * 1024.0 * 1024.0);
     $tempFile = new Tinebase_Model_TempFile(array('id' => '123', 'session_id' => 'abc', 'time' => Tinebase_DateTime::now()->get(Tinebase_Record_Abstract::ISO8601LONG), 'path' => '/tmp/tmpfile', 'name' => 'tmpfile', 'type' => 'unknown', 'error' => 0, 'size' => $size));
     $createdTempFile = $this->_instance->create($tempFile);
     $this->assertEquals(4080218931.0, $createdTempFile->size);
 }
开发者ID:bitExpert,项目名称:Tine-2.0-Open-Source-Groupware-and-CRM,代码行数:10,代码来源:TempFileTest.php

示例6: testSetLogout

 /**
  * Test create a access log and logout to set logout time
  *
  * @see 0010728: Strange error in tine20 log when performing logout from Web
  */
 public function testSetLogout()
 {
     $accessLog = new Tinebase_Model_AccessLog(array('ip' => '127.0.0.1', 'li' => Tinebase_DateTime::now(), 'result' => Zend_Auth_Result::SUCCESS, 'clienttype' => 'unittest', 'login_name' => 'unittest', 'user_agent' => 'phpunit', 'sessionid' => Tinebase_Record_Abstract::generateUID()), true);
     $this->_uit->setSessionId($accessLog);
     $this->_uit->create($accessLog);
     $accessLog = $this->_uit->setLogout();
     $this->assertEquals(Tinebase_DateTime::now()->toString(), $accessLog->lo->toString(), 'logout time mismatch/empty: ' . print_r($accessLog, true));
 }
开发者ID:hernot,项目名称:Tine-2.0-Open-Source-Groupware-and-CRM,代码行数:13,代码来源:AccessLogTest.php

示例7: _deleteUserById

 /**
  * delete user by id
  * 
  * @param string $id
  */
 protected function _deleteUserById($id)
 {
     $where = array($this->_db->quoteIdentifier($this->_propertyMapping['emailUserId']) . ' = ?' => $id, $this->_db->quoteIdentifier($this->_userTable . '.domain') . ' = ?' => $this->_config['domain']);
     if (Tinebase_Core::isLogLevel(Zend_Log::TRACE)) {
         Tinebase_Core::getLogger()->trace(__METHOD__ . '::' . __LINE__ . ' ' . print_r($where, TRUE));
     }
     $this->_db->update($this->_userTable, array('is_deleted' => '1', 'last_modified' => Tinebase_DateTime::now()->getIso()), $where);
 }
开发者ID:ingoratsdorf,项目名称:Tine-2.0-Open-Source-Groupware-and-CRM,代码行数:13,代码来源:DovecotCombined.php

示例8: testBackslashInDescription

 /**
  * testBackslashInDescription
  *
  * @see 0009176: iCal adds another backslash to description field
  */
 public function testBackslashInDescription()
 {
     $event = new Calendar_Model_Event(array('summary' => 'CalDAV test', 'dtstart' => Tinebase_DateTime::now(), 'dtend' => Tinebase_DateTime::now()->addHour(1), 'description' => 'lalala \\\\', 'originator_tz' => 'Europe/Berlin', 'creation_time' => Tinebase_DateTime::now(), 'uid' => Tinebase_Record_Abstract::generateUID(), 'seq' => 1));
     $converter = Calendar_Convert_Event_VCalendar_Factory::factory(Calendar_Convert_Event_VCalendar_Factory::CLIENT_MACOSX);
     $vevent = $converter->fromTine20Model($event)->serialize();
     $convertedEvent = $converter->toTine20Model($vevent);
     $this->assertEquals($event->description, $convertedEvent->description);
 }
开发者ID:ingoratsdorf,项目名称:Tine-2.0-Open-Source-Groupware-and-CRM,代码行数:13,代码来源:MacOSXTest.php

示例9: setUp

 /**
  * Sets up the fixture.
  * This method is called before a test is executed.
  *
  * @access protected
  */
 protected function setUp()
 {
     parent::setUp();
     $this->_testContainer = $this->_getPersonalContainer('Crm');
     $this->objects['lead'] = new Crm_Model_Lead(array('lead_name' => 'PHPUnit', 'leadstate_id' => 1, 'leadtype_id' => 1, 'leadsource_id' => 1, 'container_id' => $this->_testContainer->id, 'start' => new Tinebase_DateTime("2007-12-12"), 'description' => 'Lead Description', 'end' => Tinebase_DateTime::now(), 'turnover' => '200000', 'probability' => 70, 'end_scheduled' => Tinebase_DateTime::now()));
     $this->objects['leadWithLink'] = new Crm_Model_Lead(array('lead_name' => 'PHPUnit with contact', 'leadstate_id' => 1, 'leadtype_id' => 1, 'leadsource_id' => 1, 'container_id' => $this->_testContainer->id, 'start' => new Tinebase_DateTime("2007-12-24"), 'description' => 'Lead Description', 'end' => Tinebase_DateTime::now(), 'turnover' => '200000', 'probability' => 50, 'end_scheduled' => Tinebase_DateTime::now()));
     $this->objects['linkedContact'] = new Addressbook_Model_Contact(array('adr_one_countryname' => 'DE', 'adr_one_locality' => 'Hamburg', 'adr_one_postalcode' => '24xxx', 'adr_one_region' => 'Hamburg', 'adr_one_street' => 'Pickhuben 4', 'adr_one_street2' => 'no second street', 'adr_two_countryname' => 'DE', 'adr_two_locality' => 'Hamburg', 'adr_two_postalcode' => '24xxx', 'adr_two_region' => 'Hamburg', 'adr_two_street' => 'Pickhuben 4', 'adr_two_street2' => 'no second street2', 'assistent' => 'Cornelius Weiß', 'bday' => '1975-01-02 03:04:05', 'email' => 'unittests@tine20.org', 'email_home' => 'unittests@tine20.org', 'note' => 'Bla Bla Bla', 'role' => 'Role', 'title' => 'Title', 'url' => 'http://www.tine20.org', 'url_home' => 'http://www.tine20.com', 'n_family' => 'Kneschke', 'n_fileas' => 'Kneschke, Lars', 'n_given' => 'Lars', 'n_middle' => 'no middle name', 'n_prefix' => 'no prefix', 'n_suffix' => 'no suffix', 'org_name' => 'Metaways Infosystems GmbH', 'org_unit' => 'Tine 2.0', 'tel_assistent' => '+49TELASSISTENT', 'tel_car' => '+49TELCAR', 'tel_cell' => '+49TELCELL', 'tel_cell_private' => '+49TELCELLPRIVATE', 'tel_fax' => '+49TELFAX', 'tel_fax_home' => '+49TELFAXHOME', 'tel_home' => '+49TELHOME', 'tel_pager' => '+49TELPAGER', 'tel_work' => '+49TELWORK'));
     $this->objects['linkedTask'] = new Tasks_Model_Task(array('summary' => 'task test'));
     Crm_Controller_Lead::getInstance()->create($this->objects['leadWithLink']);
     $this->objects['linkedContact'] = Addressbook_Controller_Contact::getInstance()->create($this->objects['linkedContact'], FALSE);
 }
开发者ID:ingoratsdorf,项目名称:Tine-2.0-Open-Source-Groupware-and-CRM,代码行数:17,代码来源:PdfTest.php

示例10: setUp

 /**
  * Sets up the fixture.
  * 
  * This method is called before a test is executed.
  */
 protected function setUp()
 {
     $personalContainer = Tinebase_Container::getInstance()->getPersonalContainer(Zend_Registry::get('currentAccount'), 'Crm', Zend_Registry::get('currentAccount'), Tinebase_Model_Grants::GRANT_EDIT);
     if ($personalContainer->count() === 0) {
         $this->_testContainer = Tinebase_Container::getInstance()->addPersonalContainer(Zend_Registry::get('currentAccount')->accountId, 'Crm', 'PHPUNIT');
     } else {
         $this->_testContainer = $personalContainer[0];
     }
     $this->_objects['initialLead'] = new Crm_Model_Lead(array('id' => 120, 'lead_name' => 'PHPUnit', 'leadstate_id' => 1, 'leadtype_id' => 1, 'leadsource_id' => 1, 'container_id' => $this->_testContainer->id, 'start' => Tinebase_DateTime::now(), 'description' => 'Description', 'end' => Tinebase_DateTime::now(), 'turnover' => '200000', 'probability' => 70, 'end_scheduled' => Tinebase_DateTime::now()));
     $this->_objects['updatedLead'] = new Crm_Model_Lead(array('id' => 120, 'lead_name' => 'PHPUnit', 'leadstate_id' => 1, 'leadtype_id' => 1, 'leadsource_id' => 1, 'container_id' => $this->_testContainer->id, 'start' => Tinebase_DateTime::now(), 'description' => 'Description updated', 'end' => NULL, 'turnover' => '200000', 'probability' => 70, 'end_scheduled' => NULL));
     $this->_backend = new Crm_Backend_Lead();
 }
开发者ID:rodrigofns,项目名称:ExpressoLivre3,代码行数:17,代码来源:LeadTest.php

示例11: getLastModified

 /**
  * Returns the last modification time 
  *
  * @return int 
  */
 public function getLastModified()
 {
     if ($this->_node instanceof Tinebase_Model_Tree_Node) {
         if ($this->_node->last_modified_time instanceof Tinebase_DateTime) {
             $timestamp = $this->_node->last_modified_time->getTimestamp();
         } else {
             $timestamp = $this->_node->creation_time->getTimestamp();
         }
     } else {
         $timestamp = Tinebase_DateTime::now()->getTimestamp();
     }
     return $timestamp;
 }
开发者ID:ingoratsdorf,项目名称:Tine-2.0-Open-Source-Groupware-and-CRM,代码行数:18,代码来源:Node.php

示例12: testUpdateProductLifespan

 /**
  * testUpdateProductLifespan
  * 
  * @see 0010766: set product lifespan
  */
 public function testUpdateProductLifespan()
 {
     $product1 = $this->getUit()->create(new Sales_Model_Product(array('name' => 'product activates in future', 'lifespan_start' => Tinebase_DateTime::now()->addDay(1))));
     $product2 = $this->getUit()->create(new Sales_Model_Product(array('name' => 'product lifespan ended', 'lifespan_end' => Tinebase_DateTime::now()->subDay(1))));
     $product3 = $this->getUit()->create(new Sales_Model_Product(array('is_active' => 0, 'name' => 'product lifespan started', 'lifespan_start' => Tinebase_DateTime::now()->subDay(1))));
     $product4 = $this->getUit()->create(new Sales_Model_Product(array('is_active' => 0, 'name' => 'product lifespan not yet ended', 'lifespan_end' => Tinebase_DateTime::now()->addDay(1))));
     $productsToTest = array(array('expectedIsActive' => 0, 'product' => $product1), array('expectedIsActive' => 0, 'product' => $product2), array('expectedIsActive' => 1, 'product' => $product3), array('expectedIsActive' => 1, 'product' => $product4));
     $this->getUit()->updateProductLifespan();
     foreach ($productsToTest as $product) {
         $updatedProduct = $this->getUit()->get($product['product']);
         $this->assertEquals($product['expectedIsActive'], $updatedProduct->is_active, print_r($product['product']->toArray(), true));
     }
 }
开发者ID:ingoratsdorf,项目名称:Tine-2.0-Open-Source-Groupware-and-CRM,代码行数:18,代码来源:ProductControllerTest.php

示例13: testCreateEvent

 public function testCreateEvent()
 {
     $event = $this->_getEvent();
     $event->creation_time = Tinebase_DateTime::now();
     $persistentEvent = $this->_backend->create($event);
     $event->attendee->cal_event_id = $persistentEvent->getId();
     foreach ($event->attendee as $attender) {
         $this->_backend->createAttendee($attender);
     }
     $loadedPersitentEvent = $this->_backend->get($persistentEvent->getId());
     $this->assertEquals($event->summary, $loadedPersitentEvent->summary);
     $this->_assertAttendee($event->attendee, $loadedPersitentEvent->attendee);
     return $loadedPersitentEvent;
 }
开发者ID:ingoratsdorf,项目名称:Tine-2.0-Open-Source-Groupware-and-CRM,代码行数:14,代码来源:SqlTest.php

示例14: lockFolder

 /**
  * try to lock a folder
  *
  * @param  Felamimail_Model_Folder  $_folder  the folder to lock
  * @return bool  true if locking was successful, false if locking was not possible
  */
 public function lockFolder(Felamimail_Model_Folder $_folder)
 {
     $folderData = $_folder->toArray();
     $data = array('cache_timestamp' => Tinebase_DateTime::now()->get(Tinebase_Record_Abstract::ISO8601LONG), 'cache_status' => Felamimail_Model_Folder::CACHE_STATUS_UPDATING);
     $where = array($this->_db->quoteInto($this->_db->quoteIdentifier('id') . ' = ?', $folderData['id']), $this->_db->quoteInto($this->_db->quoteIdentifier('cache_status') . ' = ?', $folderData['cache_status']));
     if (!empty($folderData['cache_timestamp'])) {
         $where[] = $this->_db->quoteInto($this->_db->quoteIdentifier('cache_timestamp') . ' = ?', $folderData['cache_timestamp']);
     }
     $affectedRows = $this->_db->update($this->_tablePrefix . $this->_tableName, $data, $where);
     if ($affectedRows !== 1) {
         return false;
     }
     return true;
 }
开发者ID:rodrigofns,项目名称:ExpressoLivre3,代码行数:20,代码来源:Folder.php

示例15: setLogout

 /**
  * add logout entry to the access log
  *
  * @param string $_sessionId the session id
  * @param string $_ipAddress the ip address the user connects from
  * @return void|Tinebase_Model_AccessLog
  */
 public function setLogout($_sessionId, $_ipAddress = NULL)
 {
     try {
         $loginRecord = $this->_backend->getByProperty($_sessionId, 'sessionid');
     } catch (Tinebase_Exception_NotFound $tenf) {
         Tinebase_Core::getLogger()->warn(__METHOD__ . '::' . __LINE__ . ' Could not find access log login record for session id ' . $_sessionId);
         return;
     }
     $loginRecord->lo = Tinebase_DateTime::now()->get(Tinebase_Record_Abstract::ISO8601LONG);
     if ($_ipAddress !== NULL) {
         $loginRecord->ip = $_ipAddress;
     }
     return $this->update($loginRecord);
 }
开发者ID:,项目名称:,代码行数:21,代码来源:


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