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


PHP Tinebase_Record_RecordSet::getArrayOfIds方法代码示例

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


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

示例1: 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);
         if (!$record->grants instanceof Tinebase_Record_RecordSet) {
             $record->grants = new Tinebase_Record_RecordSet($this->_modelName);
         }
         $record->grants->addRecord($recordGrant);
     }
     if (Tinebase_Core::isLogLevel(Zend_Log::TRACE)) {
         Tinebase_Core::getLogger()->trace(__METHOD__ . '::' . __LINE__ . ' Records with grants: ' . print_r($records->toArray(), true));
     }
 }
开发者ID:bitExpert,项目名称:Tine-2.0-Open-Source-Groupware-and-CRM,代码行数:38,代码来源:Grants.php

示例2: testOffsetUnset

 /**
  * testOffsetUnset().
  */
 public function testOffsetUnset()
 {
     unset($this->object[1]);
     unset($this->object[3]);
     $this->assertEquals(2, count($this->object));
     $this->assertEquals(array(0), $this->object->getIdLessIndexes(), 'wrong idLess indexes');
     $this->assertEquals(array(1), $this->object->getArrayOfIds(), 'wrong idFull indexes');
 }
开发者ID:rodrigofns,项目名称:ExpressoLivre3,代码行数:11,代码来源:RecordSetTest.php

示例3: tearDown

 /**
  * Tears down the fixture
  * This method is called after a test is executed.
  *
  * @access protected
  */
 protected function tearDown()
 {
     $this->_groupIdsToDelete = $this->_groupsToDelete->getArrayOfIds();
     if ($this->_schemaConfigChanged) {
         Courses_Config::getInstance()->set(Courses_Config::STUDENTS_USERNAME_SCHEMA, $this->_schemaConfig);
     }
     if ($this->_usernameLengthConfigChanged) {
         Tinebase_Config::getInstance()->set(Tinebase_Config::MAX_USERNAME_LENGTH, $this->_usernameLengthConfig);
     }
     if ($this->_defaultDepartmentConfigChanged) {
         Courses_Config::getInstance()->set(Courses_Config::DEFAULT_DEPARTMENT, $this->_defaultDepartmentConfig);
     }
     parent::tearDown();
 }
开发者ID:ingoratsdorf,项目名称:Tine-2.0-Open-Source-Groupware-and-CRM,代码行数:20,代码来源:JsonTest.php

示例4: getPathsForRecords

 /**
  * getPathsForRecords
  *
  * @param Tinebase_Record_Interface|Tinebase_Record_RecordSet $records
  * @return Tinebase_Record_RecordSet
  * @throws Tinebase_Exception_NotFound
  */
 public function getPathsForRecords($records)
 {
     $ids = $records instanceof Tinebase_Record_Interface ? array($records->getId()) : $records->getArrayOfIds();
     return $this->search(new Tinebase_Model_PathFilter(array(array('field' => 'record_id', 'operator' => 'in', 'value' => $ids))));
 }
开发者ID:ingoratsdorf,项目名称:Tine-2.0-Open-Source-Groupware-and-CRM,代码行数:12,代码来源:Path.php

示例5: _getOrCreateFolders

 /**
  * create new folders or get existing folders from db and return record set
  *
  * @param array $_folders
  * @param Felamimail_Model_Account $_account
  * @param string $_parentFolder
  * @return Tinebase_Record_RecordSet of Felamimail_Model_Folder
  * 
  * @todo    move delete sync to extra function
  */
 protected function _getOrCreateFolders(array $_folders, $_account, $_parentFolder)
 {
     $parentFolder = $_parentFolder !== NULL ? $_parentFolder : '';
     $result = new Tinebase_Record_RecordSet('Felamimail_Model_Folder');
     $systemFolders = Felamimail_Controller_Folder::getInstance()->getSystemFolders($_account);
     // get configured account standard folders here
     if (strtolower($_account->sent_folder) != $systemFolders[2]) {
         $systemFolders[2] = strtolower($_account->sent_folder);
     }
     if (strtolower($_account->trash_folder) != $systemFolders[5]) {
         $systemFolders[5] = strtolower($_account->trash_folder);
     }
     if (Tinebase_Core::isLogLevel(Zend_Log::TRACE)) {
         Tinebase_Core::getLogger()->trace(__METHOD__ . '::' . __LINE__ . ' ' . print_r($_folders, TRUE));
     }
     // do some mapping and save folder in db (if it doesn't exist
     foreach ($_folders as $folderData) {
         try {
             $folderData['localName'] = Felamimail_Model_Folder::decodeFolderName($folderData['localName']);
             $folderData['globalName'] = Felamimail_Model_Folder::decodeFolderName($folderData['globalName']);
             $isSelectable = $this->_isSelectable($folderData, $_account);
             $folder = Felamimail_Controller_Folder::getInstance()->getByBackendAndGlobalName($_account->getId(), $folderData['globalName']);
             $folder->is_selectable = $isSelectable;
             $folder->supports_condstore = $this->_supportsCondStore($folder, $_account);
             $folder->imap_status = Felamimail_Model_Folder::IMAP_STATUS_OK;
             $folder->has_children = $folderData['hasChildren'] == '1';
             $folder->parent = $parentFolder;
             if (Tinebase_Core::isLogLevel(Zend_Log::DEBUG)) {
                 Tinebase_Core::getLogger()->debug(__METHOD__ . '::' . __LINE__ . ' Update cached folder ' . $folderData['globalName']);
             }
         } catch (Tinebase_Exception_NotFound $tenf) {
             // create new folder
             if (empty($folderData['localName'])) {
                 // skip
                 if (Tinebase_Core::isLogLevel(Zend_Log::INFO)) {
                     Tinebase_Core::getLogger()->info(__METHOD__ . '::' . __LINE__ . ' Do not add folder ' . $folderData['globalName'] . '. Localname is empty.');
                 }
                 continue;
             } else {
                 $delimiter = strlen($folderData['delimiter']) === 1 ? $folderData['delimiter'] : '';
                 $folder = new Felamimail_Model_Folder(array('localname' => $folderData['localName'], 'globalname' => $folderData['globalName'], 'is_selectable' => $isSelectable, 'supports_condstore' => $this->_supportsCondStore($folderData['globalName'], $_account), 'has_children' => $folderData['hasChildren'] == '1', 'account_id' => $_account->getId(), 'imap_timestamp' => Tinebase_DateTime::now(), 'imap_status' => Felamimail_Model_Folder::IMAP_STATUS_OK, 'user_id' => Tinebase_Core::getUser()->getId(), 'parent' => $parentFolder, 'system_folder' => in_array(strtolower($folderData['localName']), $systemFolders), 'delimiter' => $delimiter));
                 // update delimiter setting of account
                 if ($folder->delimiter && $folder->delimiter !== $_account->delimiter && $folder->localname === 'INBOX') {
                     $_account->delimiter = $folder->delimiter;
                     $_account = Felamimail_Controller_Account::getInstance()->update($_account);
                 }
                 if (Tinebase_Core::isLogLevel(Zend_Log::INFO)) {
                     Tinebase_Core::getLogger()->info(__METHOD__ . '::' . __LINE__ . ' Adding new folder ' . $folderData['globalName'] . ' to cache.');
                 }
                 if (Tinebase_Core::isLogLevel(Zend_Log::TRACE)) {
                     Tinebase_Core::getLogger()->trace(__METHOD__ . '::' . __LINE__ . print_r($folder->toArray(), true));
                 }
                 $folder = $this->_backend->create($folder);
             }
         }
         $result->addRecord($folder);
     }
     if (count($_folders) > 0) {
         $this->_removeFromCache($_account, $parentFolder, $result->getArrayOfIds());
     }
     return $result;
 }
开发者ID:ingoratsdorf,项目名称:Tine-2.0-Open-Source-Groupware-and-CRM,代码行数:72,代码来源:Folder.php

示例6: _syncDeletedUsers

 /**
  * deletes user in tine20 db that no longer exist in sync backend
  *
  * @param Tinebase_Record_RecordSet $usersInSyncBackend
  */
 protected static function _syncDeletedUsers(Tinebase_Record_RecordSet $usersInSyncBackend)
 {
     $userIdsInSqlBackend = Tinebase_User::getInstance()->getAllUserIdsFromSqlBackend();
     $deletedInSyncBackend = array_diff($userIdsInSqlBackend, $usersInSyncBackend->getArrayOfIds());
     if (Tinebase_Core::isLogLevel(Zend_Log::DEBUG)) {
         Tinebase_Core::getLogger()->debug(__METHOD__ . '::' . __LINE__ . ' About to delete ' . count($deletedInSyncBackend) . ' users in SQL backend...');
     }
     foreach ($deletedInSyncBackend as $userToDelete) {
         $user = Tinebase_User::getInstance()->getUserByPropertyFromSqlBackend('accountId', $userToDelete, 'Tinebase_Model_FullUser');
         Tinebase_User::getInstance()->deleteUserInSqlBackend($userToDelete);
         if (Tinebase_Application::getInstance()->isInstalled('Addressbook') === true && !empty($user->contact_id)) {
             if (Tinebase_Core::isLogLevel(Zend_Log::DEBUG)) {
                 Tinebase_Core::getLogger()->debug(__METHOD__ . '::' . __LINE__ . ' Deleting user contact of ' . $user->accountLoginName);
             }
             $contactsBackend = Addressbook_Backend_Factory::factory(Addressbook_Backend_Factory::SQL);
             $contactsBackend->delete($user->contact_id);
         }
     }
 }
开发者ID:bitExpert,项目名称:Tine-2.0-Open-Source-Groupware-and-CRM,代码行数:24,代码来源:User.php

示例7: _syncDeletedUsers

 /**
  * deletes user in tine20 db that no longer exist in sync backend
  *
  * @param Tinebase_Record_RecordSet $usersInSyncBackend
  */
 protected static function _syncDeletedUsers(Tinebase_Record_RecordSet $usersInSyncBackend)
 {
     $userIdsInSqlBackend = Tinebase_User::getInstance()->getAllUserIdsFromSqlBackend();
     $deletedInSyncBackend = array_diff($userIdsInSqlBackend, $usersInSyncBackend->getArrayOfIds());
     if (Tinebase_Core::isLogLevel(Zend_Log::DEBUG)) {
         Tinebase_Core::getLogger()->debug(__METHOD__ . '::' . __LINE__ . ' About to delete / expire ' . count($deletedInSyncBackend) . ' users in SQL backend...');
     }
     foreach ($deletedInSyncBackend as $userToDelete) {
         $user = Tinebase_User::getInstance()->getUserByPropertyFromSqlBackend('accountId', $userToDelete, 'Tinebase_Model_FullUser');
         if (in_array($user->accountLoginName, self::getSystemUsernames())) {
             return;
         }
         // at first, we expire+deactivate the user
         $now = Tinebase_DateTime::now();
         if (!$user->accountExpires || $user->accountStatus !== Tinebase_Model_User::ACCOUNT_STATUS_DISABLED) {
             if (Tinebase_Core::isLogLevel(Zend_Log::DEBUG)) {
                 Tinebase_Core::getLogger()->debug(__METHOD__ . '::' . __LINE__ . ' Disable user and set expiry date of ' . $user->accountLoginName . ' to ' . $now);
             }
             $user->accountExpires = $now;
             $user->accountStatus = Tinebase_Model_User::ACCOUNT_STATUS_DISABLED;
             Tinebase_User::getInstance()->updateUserInSqlBackend($user);
         } else {
             if (Tinebase_Core::isLogLevel(Zend_Log::DEBUG)) {
                 Tinebase_Core::getLogger()->debug(__METHOD__ . '::' . __LINE__ . ' User already expired ' . print_r($user->toArray(), true));
             }
             // TODO make time span configurable?
             if ($user->accountExpires->isEarlier($now->subYear(1))) {
                 // if he or she is already expired longer than configured expiry, we remove them!
                 Tinebase_User::getInstance()->deleteUserInSqlBackend($userToDelete);
                 if (Tinebase_Application::getInstance()->isInstalled('Addressbook') === true && !empty($user->contact_id)) {
                     if (Tinebase_Core::isLogLevel(Zend_Log::DEBUG)) {
                         Tinebase_Core::getLogger()->debug(__METHOD__ . '::' . __LINE__ . ' Deleting user contact of ' . $user->accountLoginName);
                     }
                     $contactsBackend = Addressbook_Backend_Factory::factory(Addressbook_Backend_Factory::SQL);
                     $contactsBackend->delete($user->contact_id);
                 }
             } else {
                 // keep user in expiry state
             }
         }
     }
 }
开发者ID:hernot,项目名称:Tine-2.0-Open-Source-Groupware-and-CRM,代码行数:47,代码来源:User.php

示例8: getAlarmsOfRecord

 /**
  * get all alarms of given record(s) / adds record_id index to result set
  * 
  * @param  string $_model model to get alarms for
  * @param  string|array|Tinebase_Record_Interface|Tinebase_Record_RecordSet $_recordId record id(s) to get alarms for
  * @param  boolean $_onlyIds
  * @return Tinebase_Record_RecordSet|array of ids
  */
 public function getAlarmsOfRecord($_model, $_recordId, $_onlyIds = FALSE)
 {
     if ($_recordId instanceof Tinebase_Record_RecordSet) {
         $recordId = $_recordId->getArrayOfIds();
     } else {
         if ($_recordId instanceof Tinebase_Record_Interface) {
             $recordId = $_recordId->getId();
         } else {
             $recordId = $_recordId;
         }
     }
     //if (Tinebase_Core::isLogLevel(Zend_Log::DEBUG)) Tinebase_Core::getLogger()->debug(__METHOD__ . '::' . __LINE__ . "  model: '$_model' id:" . print_r((array)$recordId, true));
     $filter = new Tinebase_Model_AlarmFilter(array(array('field' => 'model', 'operator' => 'equals', 'value' => $_model), array('field' => 'record_id', 'operator' => 'in', 'value' => (array) $recordId)));
     $result = $this->_backend->search($filter, NULL, $_onlyIds);
     // NOTE: Adding indices to empty recordsets breaks empty tests
     if (count($result) > 0 && $result instanceof Tinebase_Record_RecordSet) {
         $result->addIndices(array('record_id'));
     }
     return $result;
 }
开发者ID:bitExpert,项目名称:Tine-2.0-Open-Source-Groupware-and-CRM,代码行数:28,代码来源:Alarm.php

示例9: _clearFlagsOnCache

 /**
  * clears flags in local database
  * 
  * @param Tinebase_Record_RecordSet $_messagesToFlag
  * @param array $_flags
  * @param array $_folderCounts
  * @return array folder counts
  */
 protected function _clearFlagsOnCache(Tinebase_Record_RecordSet $_messagesToUnflag, $_flags, $_folderCounts)
 {
     $folderCounts = $_folderCounts;
     // set flags in local database
     $transactionId = Tinebase_TransactionManager::getInstance()->startTransaction(Tinebase_Core::getDb());
     // store flags in local cache
     foreach ($_messagesToUnflag as $message) {
         if (in_array(Zend_Mail_Storage::FLAG_SEEN, $_flags) && in_array(Zend_Mail_Storage::FLAG_SEEN, $message->flags)) {
             // count messages with seen flag for the first time
             $folderCounts[$message->folder_id]['incrementUnreadCounter']++;
         }
         $this->_backend->clearFlag($message, $_flags);
     }
     // mark message as changed in the cache backend
     $this->_backend->updateMultiple($_messagesToUnflag->getArrayOfIds(), array('timestamp' => Tinebase_DateTime::now()->get(Tinebase_Record_Abstract::ISO8601LONG)));
     Tinebase_TransactionManager::getInstance()->commitTransaction($transactionId);
     return $folderCounts;
 }
开发者ID:rodrigofns,项目名称:ExpressoLivre3,代码行数:26,代码来源:Flags.php

示例10: tearDown

 /**
  * Tears down the fixture
  * This method is called after a test is executed.
  *
  * @access protected
  */
 protected function tearDown()
 {
     $this->_groupIdsToDelete = $this->_groupsToDelete->getArrayOfIds();
     parent::tearDown();
 }
开发者ID:bitExpert,项目名称:Tine-2.0-Open-Source-Groupware-and-CRM,代码行数:11,代码来源:CliTest.php

示例11: diff

 /**
  * compares two recordsets / only compares the ids / returns all records that are different in an array:
  *  - removed  -> all records that are in $this but not in $_recordSet
  *  - added    -> all records that are in $_recordSet but not in $this
  *  - modified -> array of diffs  for all different records that are in both record sets
  * 
  * @param Tinebase_Record_RecordSet $recordSet
  * @return Tinebase_Record_RecordSetDiff
  */
 public function diff($recordSet)
 {
     if (!$recordSet instanceof Tinebase_Record_RecordSet) {
         if (Tinebase_Core::isLogLevel(Zend_Log::DEBUG)) {
             Tinebase_Core::getLogger()->debug(__METHOD__ . '::' . __LINE__ . ' Did not get Tinebase_Record_RecordSet, skipping diff(' . $this->_recordClass . ')');
         }
         return new Tinebase_Record_RecordSetDiff(array('model' => $this->getRecordClassName()));
     }
     if ($this->getRecordClassName() !== $recordSet->getRecordClassName()) {
         throw new Tinebase_Exception_InvalidArgument('can only compare recordsets with the same type of records');
     }
     $existingRecordsIds = $this->getArrayOfIds();
     $toCompareWithRecordsIds = $recordSet->getArrayOfIds();
     $removedIds = array_diff($existingRecordsIds, $toCompareWithRecordsIds);
     $addedIds = array_diff($toCompareWithRecordsIds, $existingRecordsIds);
     $modifiedIds = array_intersect($existingRecordsIds, $toCompareWithRecordsIds);
     $removed = new Tinebase_Record_RecordSet($this->getRecordClassName());
     $added = new Tinebase_Record_RecordSet($this->getRecordClassName());
     $modified = new Tinebase_Record_RecordSet('Tinebase_Record_Diff');
     foreach ($addedIds as $id) {
         $added->addRecord($recordSet->getById($id));
     }
     // consider records without id, too
     foreach ($recordSet->getIdLessIndexes() as $index) {
         $added->addRecord($recordSet->getByIndex($index));
     }
     foreach ($removedIds as $id) {
         $removed->addRecord($this->getById($id));
     }
     // consider records without id, too
     foreach ($this->getIdLessIndexes() as $index) {
         $removed->addRecord($this->getByIndex($index));
     }
     foreach ($modifiedIds as $id) {
         $diff = $this->getById($id)->diff($recordSet->getById($id));
         if (!$diff->isEmpty()) {
             $modified->addRecord($diff);
         }
     }
     $result = new Tinebase_Record_RecordSetDiff(array('model' => $this->getRecordClassName(), 'added' => $added, 'removed' => $removed, 'modified' => $modified));
     return $result;
 }
开发者ID:ingoratsdorf,项目名称:Tine-2.0-Open-Source-Groupware-and-CRM,代码行数:51,代码来源:RecordSet.php

示例12: setNotesOfRecord

 /**
  * sets notes of a record
  * 
  * @param Tinebase_Record_Abstract  $_record            the record object
  * @param string                    $_backend           backend (default: 'Sql')
  * @param string                    $_notesProperty     the property in the record where the tags are in (default: 'notes')
  * 
  * @todo add update notes ?
  */
 public function setNotesOfRecord($_record, $_backend = 'Sql', $_notesProperty = 'notes')
 {
     $model = get_class($_record);
     $backend = ucfirst(strtolower($_backend));
     //if (Tinebase_Core::isLogLevel(Zend_Log::DEBUG)) Tinebase_Core::getLogger()->debug(__METHOD__ . '::' . __LINE__ . ' ' . print_r($_record->toArray(), TRUE));
     $currentNotesIds = $this->getNotesOfRecord($model, $_record->getId(), $backend)->getArrayOfIds();
     $notes = $_record->{$_notesProperty};
     if ($notes instanceof Tinebase_Record_RecordSet) {
         $notesToSet = $notes;
     } else {
         if (count($notes) > 0 && $notes[0] instanceof Tinebase_Record_Abstract) {
             // array of notes records given
             $notesToSet = new Tinebase_Record_RecordSet('Tinebase_Model_Note', $notes);
         } else {
             // array of arrays given
             $notesToSet = new Tinebase_Record_RecordSet('Tinebase_Model_Note');
             foreach ($notes as $noteData) {
                 if (!empty($noteData)) {
                     $noteArray = !is_array($noteData) ? array('note' => $noteData) : $noteData;
                     if (!isset($noteArray['note_type_id'])) {
                         // get default note type
                         $defaultNote = $this->getNoteTypeByName('note');
                         $noteArray['note_type_id'] = $defaultNote->getId();
                     }
                     try {
                         $note = new Tinebase_Model_Note($noteArray);
                         $notesToSet->addRecord($note);
                     } catch (Tinebase_Exception_Record_Validation $terv) {
                         // discard invalid notes here
                         Tinebase_Core::getLogger()->warn(__METHOD__ . '::' . __LINE__ . ' Note is invalid! ' . $terv->getMessage());
                     }
                 }
             }
         }
     }
     //$toAttach = array_diff($notesToSet->getArrayOfIds(), $currentNotesIds);
     $toDetach = array_diff($currentNotesIds, $notesToSet->getArrayOfIds());
     // delete detached/deleted notes
     $this->deleteNotes($toDetach);
     // add new notes
     Tinebase_Core::getLogger()->info(__METHOD__ . '::' . __LINE__ . ' Adding ' . count($notesToSet) . ' note(s) to record.');
     foreach ($notesToSet as $note) {
         //if (in_array($note->getId(), $toAttach)) {
         if (!$note->getId()) {
             $note->record_model = $model;
             $note->record_backend = $backend;
             $note->record_id = $_record->getId();
             $this->addNote($note);
         }
     }
 }
开发者ID:bitExpert,项目名称:Tine-2.0-Open-Source-Groupware-and-CRM,代码行数:60,代码来源:Notes.php


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