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


PHP Tinebase_DateTime::getIso方法代码示例

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


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

示例1: diff

 /**
  * returns a Tinebase_Record_Diff record with differences to the given record
  * 
  * @param Tinebase_Record_Interface $_record record for comparison
  * @param array $omitFields omit fields (for example modlog fields)
  * @return Tinebase_Record_Diff|NULL
  */
 public function diff($_record, $omitFields = array())
 {
     if (!$_record instanceof Tinebase_Record_Abstract) {
         return $_record;
     }
     $result = new Tinebase_Record_Diff(array('id' => $this->getId(), 'model' => get_class($_record)));
     $diff = array();
     foreach (array_keys($this->_validators) as $fieldName) {
         if (in_array($fieldName, $omitFields)) {
             continue;
         }
         $ownField = $this->__get($fieldName);
         $recordField = $_record->{$fieldName};
         if ($fieldName == 'customfields' && is_array($ownField) && is_array($recordField)) {
             // special handling for customfields, remove empty customfields from array
             foreach (array_keys($recordField, '', true) as $key) {
                 unset($recordField[$key]);
             }
             foreach (array_keys($ownField, '', true) as $key) {
                 unset($ownField[$key]);
             }
         }
         if (in_array($fieldName, $this->_datetimeFields)) {
             if ($ownField instanceof DateTime && $recordField instanceof DateTime) {
                 /** @var Tinebase_DateTime $recordField */
                 if (!$ownField instanceof Tinebase_DateTime) {
                     if (Tinebase_Core::isLogLevel(Zend_Log::NOTICE)) {
                         Tinebase_Core::getLogger()->notice(__METHOD__ . '::' . __LINE__ . ' Convert ' . $fieldName . ' to Tinebase_DateTime to make sure we have the compare() method');
                     }
                     $ownField = new Tinebase_DateTime($ownField);
                 }
                 if ($ownField->compare($recordField) === 0) {
                     continue;
                 } else {
                     if (Tinebase_Core::isLogLevel(Zend_Log::DEBUG)) {
                         Tinebase_Core::getLogger()->debug(__METHOD__ . '::' . __LINE__ . ' datetime for field ' . $fieldName . ' is not equal: ' . $ownField->getIso() . ' != ' . $recordField->getIso());
                     }
                 }
             } else {
                 if (!$recordField instanceof DateTime && $ownField == $recordField) {
                     continue;
                 }
             }
         } else {
             if ($fieldName == $this->_identifier && $this->getId() == $_record->getId()) {
                 continue;
             } else {
                 if ($ownField instanceof Tinebase_Record_Abstract || $ownField instanceof Tinebase_Record_RecordSet) {
                     if (Tinebase_Core::isLogLevel(Zend_Log::TRACE)) {
                         Tinebase_Core::getLogger()->trace(__METHOD__ . '::' . __LINE__ . ' Doing subdiff for field ' . $fieldName);
                     }
                     $subdiff = $ownField->diff($recordField);
                     if (is_object($subdiff) && !$subdiff->isEmpty()) {
                         $diff[$fieldName] = $subdiff;
                     }
                     continue;
                 } else {
                     if ($recordField instanceof Tinebase_Record_Abstract && is_scalar($ownField)) {
                         // maybe we have the id of the record -> just compare the id
                         if ($recordField->getId() == $ownField) {
                             continue;
                         } else {
                             $recordField = $recordField->getId();
                         }
                     } else {
                         if ($ownField == $recordField) {
                             continue;
                         } else {
                             if (empty($ownField) && empty($recordField)) {
                                 continue;
                             } else {
                                 if (empty($ownField) && $recordField instanceof Tinebase_Record_RecordSet && count($recordField) == 0 || empty($recordField) && $ownField instanceof Tinebase_Record_RecordSet && count($ownField) == 0) {
                                     continue;
                                 }
                             }
                         }
                     }
                 }
             }
         }
         if (Tinebase_Core::isLogLevel(Zend_Log::TRACE)) {
             Tinebase_Core::getLogger()->trace(__METHOD__ . '::' . __LINE__ . ' Found diff for ' . $fieldName . '(this/other):' . print_r($ownField, true) . '/' . print_r($recordField, true));
         }
         $diff[$fieldName] = $recordField;
     }
     $result->diff = $diff;
     return $result;
 }
开发者ID:ingoratsdorf,项目名称:Tine-2.0-Open-Source-Groupware-and-CRM,代码行数:95,代码来源:Abstract.php


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