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


PHP CRM_Utils_Date::getFromTo方法代碼示例

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


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

示例1: fixDateValues

 static function fixDateValues($relative, &$from, &$to)
 {
     if ($relative) {
         list($from, $to) = CRM_Utils_Date::getFromTo($relative, $from, $to);
     }
 }
開發者ID:peteainsworth,項目名稱:civicrm-4.2.9-drupal,代碼行數:6,代碼來源:Query.php

示例2: convertCustomDateRelativeFields

 /**
  * Convert submitted values for relative custom date fields to query object format.
  *
  * The query will support the sqlOperator format so convert to that format.
  *
  * @param array $formValues
  *   Submitted values.
  * @param array $params
  *   Converted parameters for the query object.
  * @param string $values
  *   Submitted value.
  * @param string $fieldName
  *   Submitted field name. (Matches form field not DB field.)
  */
 protected static function convertCustomDateRelativeFields(&$formValues, &$params, $values, $fieldName)
 {
     if (empty($values)) {
         // e.g we might have relative set & from & to empty. The form flow is a bit funky &
         // this function gets called again after they fields have been converted which can get ugly.
         return;
     }
     $customFieldName = self::getCustomFieldName($fieldName);
     if (substr($fieldName, -9, 9) == '_relative') {
         list($from, $to) = CRM_Utils_Date::getFromTo($values, NULL, NULL);
     } else {
         if ($fieldName == $customFieldName . '_to' && CRM_Utils_Array::value($customFieldName . '_from', $formValues)) {
             // Both to & from are set. We only need to acton one, choosing from.
             return;
         }
         list($from, $to) = CRM_Utils_Date::getFromTo(NULL, empty($formValues[$customFieldName . '_from']) ? NULL : $formValues[$customFieldName . '_from'], CRM_Utils_Array::value($customFieldName . '_to', $formValues));
     }
     if ($from) {
         if ($to) {
             $relativeFunction = array('BETWEEN' => array($from, $to));
         } else {
             $relativeFunction = array('>=' => $from);
         }
     } else {
         $relativeFunction = array('<=' => $to);
     }
     $params[] = array($customFieldName, '=', $relativeFunction, 0, 0);
 }
開發者ID:hoegrammer,項目名稱:civicrm-core,代碼行數:42,代碼來源:Query.php


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