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


PHP Tinebase_Record_Abstract::diff方法代码示例

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


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

示例1: writeModLog

 /**
  * computes changes of records and writes them to the logbook
  * 
  * NOTE: expects last_modified_by and last_modified_time to be set
  * properly in the $_newRecord
  * 
  * @param  Tinebase_Record_Abstract $_newRecord record from user data
  * @param  Tinebase_Record_Abstract $_curRecord record from storage
  * @param  string $_model
  * @param  string $_backend
  * @param  string $_id
  * @return Tinebase_Record_RecordSet RecordSet of Tinebase_Model_ModificationLog
  */
 public function writeModLog($_newRecord, $_curRecord, $_model, $_backend, $_id)
 {
     $commonModLog = $this->_getCommonModlog($_model, $_backend, array('last_modified_time' => $_newRecord->last_modified_time, 'last_modified_by' => $_newRecord->last_modified_by), $_id);
     $diffs = $_curRecord->diff($_newRecord);
     if (!empty($diffs) && Tinebase_Core::isLogLevel(Zend_Log::TRACE)) {
         Tinebase_Core::getLogger()->trace(__METHOD__ . '::' . __LINE__ . ' diffs: ' . print_r($diffs, TRUE));
     }
     if (!empty($diffs) && Tinebase_Core::isLogLevel(Zend_Log::TRACE)) {
         Tinebase_Core::getLogger()->trace(__METHOD__ . '::' . __LINE__ . ' curRecord: ' . print_r($_curRecord->toArray(), TRUE));
     }
     $modifications = new Tinebase_Record_RecordSet('Tinebase_Model_ModificationLog');
     $this->_loopModifications($diffs, $commonModLog, $modifications, $_curRecord->toArray(), $_curRecord->getModlogOmitFields());
     if (Tinebase_Core::isLogLevel(Zend_Log::DEBUG)) {
         Tinebase_Core::getLogger()->debug(__METHOD__ . '::' . __LINE__ . ' Logged ' . count($modifications) . ' modifications.');
     }
     return $modifications;
 }
开发者ID:,项目名称:,代码行数:30,代码来源:

示例2: diff

 /**
  * (non-PHPdoc)
  * @see Tinebase_Record_Abstract::diff()
  */
 public function diff($record, $omitFields = array())
 {
     $checkRrule = false;
     if (!in_array('rrule', $omitFields)) {
         $omitFields[] = 'rrule';
         $checkRrule = true;
     }
     $diff = parent::diff($record, $omitFields);
     if ($checkRrule) {
         $ownRrule = !$this->rrule instanceof Calendar_Model_Rrule ? Calendar_Model_Rrule::getRruleFromString((string) $this->rrule) : $this->rrule;
         $recordRrule = !$record->rrule instanceof Calendar_Model_Rrule ? Calendar_Model_Rrule::getRruleFromString($record->rrule) : $record->rrule;
         $rruleDiff = $ownRrule->diff($recordRrule);
         // don't take small ( < one day) rrule_until changes as diff
         if ($ownRrule->until instanceof Tinebase_DateTime && (isset($rruleDiff->diff['until']) || array_key_exists('until', $rruleDiff->diff)) && $rruleDiff->diff['until'] instanceof Tinebase_DateTime && abs($rruleDiff->diff['until']->getTimestamp() - $ownRrule->until->getTimestamp()) < 86400) {
             $rruleDiffArray = $rruleDiff->diff;
             unset($rruleDiffArray['until']);
             $rruleDiff->diff = $rruleDiffArray;
         }
         if (!empty($rruleDiff->diff)) {
             $diffArray = $diff->diff;
             $diffArray['rrule'] = $rruleDiff;
             $diff->diff = $diffArray;
         }
     }
     return $diff;
 }
开发者ID:ingoratsdorf,项目名称:Tine-2.0-Open-Source-Groupware-and-CRM,代码行数:30,代码来源:Event.php

示例3: _mergeRecord

 /**
  * merge record / skip if no diff
  * 
  * @param Tinebase_Record_Abstract $updateRecord
  * @param Tinebase_Record_Abstract $mergeRecord
  * @return Tinebase_Record_Abstract
  */
 protected function _mergeRecord($updateRecord, $mergeRecord)
 {
     $omitFields = array('creation_time', 'created_by', 'last_modified_time', 'last_modified_by', 'seq', 'id');
     $diff = $updateRecord->diff($mergeRecord, $omitFields);
     if (!$diff || $diff->isEmpty()) {
         if (Tinebase_Core::isLogLevel(Zend_Log::DEBUG)) {
             Tinebase_Core::getLogger()->debug(__METHOD__ . '::' . __LINE__ . ' Records are identical, no need to update');
         }
         return null;
     } else {
         if (Tinebase_Core::isLogLevel(Zend_Log::TRACE)) {
             Tinebase_Core::getLogger()->trace(__METHOD__ . '::' . __LINE__ . ' Got diff: ' . print_r($diff->diff, TRUE));
         }
     }
     return $updateRecord->merge($mergeRecord, $diff);
 }
开发者ID:hernot,项目名称:Tine-2.0-Open-Source-Groupware-and-CRM,代码行数:23,代码来源:Abstract.php


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