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


PHP Tinebase_Record_RecordSet::removeRecord方法代码示例

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


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

示例1: testRemoveRecord

 public function testRemoveRecord()
 {
     $idLess1 = $this->object->find('string', 'idLess1');
     $countBefore = $this->object->count();
     $this->object->removeRecord($idLess1);
     $this->assertEquals($countBefore - 1, $this->object->count(), 'recordSet count should decrease by 1');
     foreach ($this->object as $record) {
         $this->assertFalse($record === $idLess1, 'idLess1 is still in set');
     }
 }
开发者ID:ingoratsdorf,项目名称:Tine-2.0-Open-Source-Groupware-and-CRM,代码行数:10,代码来源:RecordSetTest.php

示例2: getGrantsForRecords

 /**
  * get grants for records
  * 
  * @param Tinebase_Record_RecordSet $records
  */
 public function getGrantsForRecords(Tinebase_Record_RecordSet $records)
 {
     $recordIds = $records->getArrayOfIds();
     if (empty($recordIds)) {
         return;
     }
     $select = $this->_getAclSelectByRecordIds($recordIds)->group(array('record_id', 'account_type', 'account_id'));
     Tinebase_Backend_Sql_Abstract::traitGroup($select);
     if (Tinebase_Core::isLogLevel(Zend_Log::TRACE)) {
         Tinebase_Core::getLogger()->trace(__METHOD__ . '::' . __LINE__ . ' ' . $select);
     }
     $stmt = $this->_db->query($select);
     $grantsData = $stmt->fetchAll(Zend_Db::FETCH_ASSOC);
     if (Tinebase_Core::isLogLevel(Zend_Log::TRACE)) {
         Tinebase_Core::getLogger()->trace(__METHOD__ . '::' . __LINE__ . ' grantsData: ' . print_r($grantsData, true));
     }
     foreach ($grantsData as $grantData) {
         $givenGrants = explode(',', $grantData['account_grants']);
         foreach ($givenGrants as $grant) {
             $grantData[$grant] = TRUE;
         }
         $recordGrant = new $this->_modelName($grantData, true);
         unset($recordGrant->account_grant);
         $record = $records->getById($recordGrant->record_id);
         $records->removeRecord($record);
         if (!$record->grants instanceof Tinebase_Record_RecordSet) {
             $record->grants = new Tinebase_Record_RecordSet($this->_modelName);
         }
         $record->grants->addRecord($recordGrant);
         // NOTICE: this is strange - we have to remove the record and add it
         //   again to make sure that grants are updated ...
         //   maybe we should add a "replace" method?
         $records->addRecord($record);
     }
     if (Tinebase_Core::isLogLevel(Zend_Log::TRACE)) {
         Tinebase_Core::getLogger()->trace(__METHOD__ . '::' . __LINE__ . ' Records with grants: ' . print_r($records->toArray(), true));
     }
 }
开发者ID:hernot,项目名称:Tine-2.0-Open-Source-Groupware-and-CRM,代码行数:43,代码来源:Grants.php

示例3: mergeRecurrenceSet

 /**
  * merges Recurrences of given events into the given event set
  * 
  * @param  Tinebase_Record_RecordSet    $_events
  * @param  Tinebase_DateTime                    $_from
  * @param  Tinebase_DateTime                    $_until
  * @return void
  */
 public static function mergeRecurrenceSet($_events, $_from, $_until)
 {
     if (Tinebase_Core::isLogLevel(Zend_Log::TRACE)) {
         Tinebase_Core::getLogger()->trace(__METHOD__ . '::' . __LINE__ . " from: {$_from} until: {$_until}");
     }
     //compute recurset
     $candidates = $_events->filter('rrule', "/^FREQ.*/", TRUE);
     foreach ($candidates as $candidate) {
         try {
             $exceptions = $_events->filter('recurid', "/^{$candidate->uid}-.*/", TRUE);
             $recurSet = Calendar_Model_Rrule::computeRecurrenceSet($candidate, $exceptions, $_from, $_until);
             foreach ($recurSet as $event) {
                 $_events->addRecord($event);
             }
             // check if candidate/baseEvent has an exception itself -> in this case remove baseEvent from set
             if (is_array($candidate->exdate) && in_array($candidate->dtstart, $candidate->exdate)) {
                 $_events->removeRecord($candidate);
             }
         } catch (Exception $e) {
             if (Tinebase_Core::isLogLevel(Zend_Log::DEBUG)) {
                 Tinebase_Core::getLogger()->debug(__METHOD__ . '::' . __LINE__ . " Could not compute recurSet of event: {$candidate->getId()}");
             }
             Tinebase_Exception::log($e);
             continue;
         }
     }
 }
开发者ID:ingoratsdorf,项目名称:Tine-2.0-Open-Source-Groupware-and-CRM,代码行数:35,代码来源:Rrule.php

示例4: resolveGroupMembers

 /**
  * resolves group members and adds/removes them if nesesary
  * 
  * NOTE: If a user is listed as user and as groupmember, we supress the groupmember
  * 
  * NOTE: The role to assign to a new group member is not always clear, as multiple groups
  *       might be the 'source' of the group member. To deal with this, we take the role of
  *       the first group when we add new group members
  *       
  * @param Tinebase_Record_RecordSet $_attendee
  * @return void
  */
 public static function resolveGroupMembers($_attendee)
 {
     if (!$_attendee instanceof Tinebase_Record_RecordSet) {
         return;
     }
     $groupAttendee = $_attendee->filter('user_type', Calendar_Model_Attender::USERTYPE_GROUP);
     $allCurrGroupMembers = $_attendee->filter('user_type', Calendar_Model_Attender::USERTYPE_GROUPMEMBER);
     $allCurrGroupMembersContactIds = $allCurrGroupMembers->user_id;
     $allGroupMembersContactIds = array();
     foreach ($groupAttendee as $groupAttender) {
         #$groupAttenderMemberIds = Tinebase_Group::getInstance()->getGroupMembers($groupAttender->user_id);
         #$groupAttenderContactIds = Tinebase_User::getInstance()->getMultiple($groupAttenderMemberIds)->contact_id;
         #$allGroupMembersContactIds = array_merge($allGroupMembersContactIds, $groupAttenderContactIds);
         $listId = null;
         if ($groupAttender->user_id instanceof Addressbook_Model_List) {
             $listId = $groupAttender->user_id->getId();
         } else {
             if ($groupAttender->user_id !== NULL) {
                 $group = Tinebase_Group::getInstance()->getGroupById($groupAttender->user_id);
                 if (!empty($group->list_id)) {
                     $listId = $group->list_id;
                 }
             } else {
                 if (Tinebase_Core::isLogLevel(Zend_Log::NOTICE)) {
                     Tinebase_Core::getLogger()->notice(__METHOD__ . '::' . __LINE__ . ' Group attender ID missing');
                 }
                 if (Tinebase_Core::isLogLevel(Zend_Log::DEBUG)) {
                     Tinebase_Core::getLogger()->debug(__METHOD__ . '::' . __LINE__ . ' ' . print_r($groupAttender->toArray(), TRUE));
                 }
             }
         }
         if ($listId !== null) {
             $groupAttenderContactIds = Addressbook_Controller_List::getInstance()->get($listId)->members;
             $allGroupMembersContactIds = array_merge($allGroupMembersContactIds, $groupAttenderContactIds);
             $toAdd = array_diff($groupAttenderContactIds, $allCurrGroupMembersContactIds);
             foreach ($toAdd as $userId) {
                 $_attendee->addRecord(new Calendar_Model_Attender(array('user_type' => Calendar_Model_Attender::USERTYPE_GROUPMEMBER, 'user_id' => $userId, 'role' => $groupAttender->role)));
             }
         }
     }
     $toDel = array_diff($allCurrGroupMembersContactIds, $allGroupMembersContactIds);
     foreach ($toDel as $idx => $contactId) {
         $attender = $allCurrGroupMembers->find('user_id', $contactId);
         $_attendee->removeRecord($attender);
     }
     // calculate double members (groupmember + user)
     $groupmembers = $_attendee->filter('user_type', Calendar_Model_Attender::USERTYPE_GROUPMEMBER);
     $users = $_attendee->filter('user_type', Calendar_Model_Attender::USERTYPE_USER);
     $doublicates = array_intersect($users->user_id, $groupmembers->user_id);
     foreach ($doublicates as $user_id) {
         $attender = $groupmembers->find('user_id', $user_id);
         $_attendee->removeRecord($attender);
     }
 }
开发者ID:rodrigofns,项目名称:ExpressoLivre3,代码行数:66,代码来源:Attender.php

示例5: _freeBusyCleanup

 /**
  * cleanup search results (freebusy)
  * 
  * @param Tinebase_Record_RecordSet $_events
  * @param string $_action
  */
 protected function _freeBusyCleanup(Tinebase_Record_RecordSet $_events, $_action)
 {
     foreach ($_events as $event) {
         $doFreeBusyCleanup = $event->doFreeBusyCleanup();
         if ($doFreeBusyCleanup && $_action !== 'get') {
             $_events->removeRecord($event);
         }
     }
 }
开发者ID:hernot,项目名称:Tine-2.0-Open-Source-Groupware-and-CRM,代码行数:15,代码来源:Event.php


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