當前位置: 首頁>>代碼示例>>PHP>>正文


PHP CRM_Contact_BAO_Contact::getTimestamps方法代碼示例

本文整理匯總了PHP中CRM_Contact_BAO_Contact::getTimestamps方法的典型用法代碼示例。如果您正苦於以下問題:PHP CRM_Contact_BAO_Contact::getTimestamps方法的具體用法?PHP CRM_Contact_BAO_Contact::getTimestamps怎麽用?PHP CRM_Contact_BAO_Contact::getTimestamps使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在CRM_Contact_BAO_Contact的用法示例。


在下文中一共展示了CRM_Contact_BAO_Contact::getTimestamps方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: formRule

 /**
  * Ensure that modified_date hasn't changed in the underlying DB
  *
  * @param array $fields  the input form values
  * @param array $files   the uploaded files if any
  * @param array $options additional user data
  *
  * @return true if no errors, else array of errors
  * @access public
  * @static
  */
 static function formRule($fields, $files, $contactID = NULL)
 {
     $errors = array();
     $timestamps = CRM_Contact_BAO_Contact::getTimestamps($contactID);
     if ($fields['modified_date'] != $timestamps['modified_date']) {
         // Inline buttons generated via JS
         $open = sprintf("<span id='update_modified_date' data:latest_modified_date='%s'>", $timestamps['modified_date']);
         $close = "</span>";
         $errors['modified_date'] = $open . ts('This record was modified by another user!') . $close;
     }
     return empty($errors) ? TRUE : $errors;
 }
開發者ID:hguru,項目名稱:224Civi,代碼行數:23,代碼來源:Lock.php

示例2: _testTimestamps

 /**
  * Helper for testing timestamp manipulation.
  *
  * Create a contact and perform a series of steps with it; after each
  * step, ensure that the contact's modified_date has increased.
  *
  * @param array $callbacks
  *   ($name => $callable).
  */
 public function _testTimestamps($callbacks)
 {
     CRM_Core_DAO::triggerRebuild();
     $contactId = $this->individualCreate();
     $origTimestamps = CRM_Contact_BAO_Contact::getTimestamps($contactId);
     $this->assertRegexp('/^\\d\\d\\d\\d-\\d\\d-\\d\\d /', $origTimestamps['created_date']);
     $this->assertRegexp('/^\\d\\d\\d\\d-\\d\\d-\\d\\d /', $origTimestamps['modified_date']);
     $this->assertTrue($origTimestamps['created_date'] <= $origTimestamps['modified_date']);
     $prevTimestamps = $origTimestamps;
     foreach ($callbacks as $callbackName => $callback) {
         sleep(1);
         // advance clock by 1 second to ensure timestamps change
         $callback($contactId);
         $newTimestamps = CRM_Contact_BAO_Contact::getTimestamps($contactId);
         $this->assertRegexp('/^\\d\\d\\d\\d-\\d\\d-\\d\\d /', $newTimestamps['created_date'], "Malformed created_date (after {$callbackName})");
         $this->assertRegexp('/^\\d\\d\\d\\d-\\d\\d-\\d\\d /', $newTimestamps['modified_date'], "Malformed modified_date (after {$callbackName})");
         $this->assertEquals($origTimestamps['created_date'], $newTimestamps['created_date'], "Changed created_date (after {$callbackName})");
         $this->assertTrue($prevTimestamps['modified_date'] < $newTimestamps['modified_date'], "Misordered modified_date (after {$callbackName})");
         $prevTimestamps = $newTimestamps;
     }
     $this->contactDelete($contactId);
 }
開發者ID:kcristiano,項目名稱:civicrm-core,代碼行數:31,代碼來源:ContactTest.php

示例3: getResponse

 /**
  * Return any post-save data.
  *
  * @param int $contactID
  *
  * @return array
  *   extra options to return in JSON
  */
 public static function getResponse($contactID)
 {
     $timestamps = CRM_Contact_BAO_Contact::getTimestamps($contactID);
     return array('oplock_ts' => $timestamps['modified_date']);
 }
開發者ID:nielosz,項目名稱:civicrm-core,代碼行數:13,代碼來源:Lock.php


注:本文中的CRM_Contact_BAO_Contact::getTimestamps方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。